simplify os2FullPathname() and at the same time make the allocations more robust (CVS 4647)

FossilOrigin-Name: 6f8952a8366065c9baa48cacc9c36743788210db
This commit is contained in:
pweilbacher 2007-12-30 23:35:15 +00:00
parent efd9eff475
commit ce3dc640f5
3 changed files with 10 additions and 12 deletions

View File

@ -1,5 +1,5 @@
C move\svariable\sdeclaration\sto\sbe\sable\sto\scompile\ssqlite3_mutex_alloc()\swith\solder\scompilers\s(like\sEMX/gcc\s2.8.1)\s(CVS\s4646)
D 2007-12-30T23:29:07
C simplify\sos2FullPathname()\sand\sat\sthe\ssame\stime\smake\sthe\sallocations\smore\srobust\s(CVS\s4647)
D 2007-12-30T23:35:15
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 30789bf70614bad659351660d76b8e533f3340e9
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -116,7 +116,7 @@ F src/mutex_w32.c 6e197765f283815496193e78e9548b5d0e53b68e
F src/os.c 8360932f1450b2b45edb608a3b184b031f7d00cc
F src/os.h d04706d54a072c7a30ab9e346ad916ef28c842d5
F src/os_common.h 98862f120ca6bf7a48ce8b16f158b77d00bc9d2f
F src/os_os2.c b88b833ff1a79f269c02a27f0ff1334e169d7cb9
F src/os_os2.c 507e9271c732352a5f68f4a8eda207d6b0244012
F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
@ -602,7 +602,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 2ddc8d72723e5a294e850491fcd9c1fb7474a9c3
R f1fcd7030dfb95382f484d98c6273742
P a568a9cf3705f45c4734f212eb359cadd3b0c897
R f11ffa6652f1bb12f593a4877bef97a3
U pweilbacher
Z 98dbe4ac09bff8828bc39f790ed936c9
Z 7fb50af183722102715e160f20580cde

View File

@ -1 +1 @@
a568a9cf3705f45c4734f212eb359cadd3b0c897
6f8952a8366065c9baa48cacc9c36743788210db

View File

@ -790,21 +790,19 @@ static int os2FullPathname(
char *zFull /* Output buffer */
){
if( strchr(zRelative, ':') ){
sqlite3SetString( &zFull, zRelative, (char*)0 );
sqlite3_snprintf( nFull, zFull, "%s", zRelative );
}else{
ULONG ulDriveNum = 0;
ULONG ulDriveMap = 0;
ULONG cbzBufLen = SQLITE_TEMPNAME_SIZE;
char zDrive[2];
char *zBuff = (char*)malloc( cbzBufLen );
if( zBuff == 0 ){
return SQLITE_NOMEM;
}
DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
if( DosQueryCurrentDir( ulDriveNum, (PBYTE)zBuff, &cbzBufLen ) == NO_ERROR ){
sprintf( zDrive, "%c", (char)('A' + ulDriveNum - 1) );
sqlite3SetString( &zFull, zDrive, ":\\", zBuff,
"\\", zRelative, (char*)0 );
sqlite3_snprintf( nFull, zFull, "%c:\\%s\\%s",
(char)('A' + ulDriveNum - 1), zBuff, zRelative);
}
free( zBuff );
}