1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-05 04:30:38 +03:00

Change OS/2 version of sqlite3Os2FullPathname() for cross-compiler compatibility:

- allocate zBuff on demand (restricted stack space on old compilers)
- 2 bytes in zDrive in include '\0'
- pass drive number to DosQueryCurrentDir() instead of 0 to make EMX work
- zFull does not need to be preallocated (CVS 4149)

FossilOrigin-Name: cc2105176563c352a6dccef89a429a76b6f3adf5
This commit is contained in:
pweilbacher
2007-07-01 15:41:02 +00:00
parent 2b9ca8d3e4
commit 503028d61a
3 changed files with 21 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
C Including\sos2safe.h\sfrom\sos_os2.c\sis\sno\slonger\snecessary\s(now\sthat\sit's\sincluding\sfrom\sos.h)\s(CVS\s4148)
D 2007-06-30T16:30:40
C Change\sOS/2\sversion\sof\ssqlite3Os2FullPathname()\sfor\scross-compiler\scompatibility:\n-\sallocate\szBuff\son\sdemand\s(restricted\sstack\sspace\son\sold\scompilers)\n-\s2\sbytes\sin\szDrive\sin\sinclude\s'\\0'\n-\spass\sdrive\snumber\sto\sDosQueryCurrentDir()\sinstead\sof\s0\sto\smake\sEMX\swork\n-\szFull\sdoes\snot\sneed\sto\sbe\spreallocated\s(CVS\s4149)
D 2007-07-01T15:41:03
F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -89,7 +89,7 @@ F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F src/os.c 1f10b47acc1177fb9225edb4f5f0d25ed716f9cb
F src/os.h cea2e179bb33f4fc09dbb9fcd51b2246544bd2db
F src/os_common.h a38233cd3b1f260db6f01f1093295d5708130065
F src/os_os2.c ca47aa5fd9c7d501f7d15aedb912146e9826c1c3
F src/os_os2.c a8220ba38b6f376d10f99d0d7a5ee833173fcc5c
F src/os_os2.h e5f17dd69333632bbc3112881ea407c37d245eb3
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
@@ -517,7 +517,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P d69204fec718a5d6d95351ee7a0c068a1c59222d
R be39a5ac8d7d6d1748b4e11d52e672fa
P 6432bbe1c1db1d31bd0057d99a9d6b6a428d8ffc
R 2986768553c0040e902823ab3782ee13
U pweilbacher
Z 71fb05fb67c7461fdb4943b9d9652f2f
Z f8445765174dacd892cb83b5501c5290

View File

@@ -1 +1 @@
6432bbe1c1db1d31bd0057d99a9d6b6a428d8ffc
cc2105176563c352a6dccef89a429a76b6f3adf5

View File

@@ -682,16 +682,22 @@ char *sqlite3Os2FullPathname( const char *zRelative ){
if( strchr(zRelative, ':') ){
sqlite3SetString( &zFull, zRelative, (char*)0 );
}else{
char zBuff[SQLITE_TEMPNAME_SIZE - 2] = {0};
char zDrive[1] = {0};
ULONG cbzFullLen = SQLITE_TEMPNAME_SIZE;
ULONG ulDriveNum = 0;
ULONG ulDriveMap = 0;
ULONG cbzBufLen = SQLITE_TEMPNAME_SIZE;
char zDrive[2];
char *zBuff;
zBuff = sqliteMalloc( cbzBufLen );
if( zBuff != 0 ){
DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
DosQueryCurrentDir( 0L, zBuff, &cbzFullLen );
zFull = sqliteMalloc( cbzFullLen );
if( DosQueryCurrentDir( ulDriveNum, zBuff, &cbzBufLen ) == NO_ERROR ){
sprintf( zDrive, "%c", (char)('A' + ulDriveNum - 1) );
sqlite3SetString( &zFull, zDrive, ":\\", zBuff, "\\", zRelative, (char*)0 );
sqlite3SetString( &zFull, zDrive, ":\\", zBuff,
"\\", zRelative, (char*)0 );
}
sqliteFree( zBuff );
}
}
return zFull;
}