From 0fd508e3f6335fdc5a827541dca1bd453c904aef Mon Sep 17 00:00:00 2001 From: pweilbacher Date: Fri, 1 Feb 2008 00:31:59 +0000 Subject: [PATCH] make os2Truncate() actually do something and fix os2FullPathname() to be more elegant and work more correctly in all cases (Ticket #2904) (CVS 4766) FossilOrigin-Name: 921c7a0ac4581255ea5061980ff7991088b9b78a --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_os2.c | 27 +++------------------------ 3 files changed, 11 insertions(+), 32 deletions(-) diff --git a/manifest b/manifest index f216e1c1a9..4a79ea7976 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\svirtual\stables\sand\sleft\sjoins\sintroduced\sby\ncheck-in\s(4761).\s\sTicket\s#2894\sand\s#2913.\s(CVS\s4765) -D 2008-01-31T19:34:52 +C make\sos2Truncate()\sactually\sdo\ssomething\sand\sfix\sos2FullPathname()\sto\sbe\smore\selegant\sand\swork\smore\scorrectly\sin\sall\scases\s(Ticket\s#2904)\s(CVS\s4766) +D 2008-02-01T00:31:59 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in bc2b5df3e3d0d4b801b824b7ef6dec43812b049b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -117,7 +117,7 @@ F src/mutex_w32.c 6e197765f283815496193e78e9548b5d0e53b68e F src/os.c 50c0c1706c35f872db312815aaecc4b5ebcd6a4c F src/os.h d04706d54a072c7a30ab9e346ad916ef28c842d5 F src/os_common.h 98862f120ca6bf7a48ce8b16f158b77d00bc9d2f -F src/os_os2.c 4aca68faa5fe20e41e1b123a46087ebd9e0bb170 +F src/os_os2.c 0c3e3f98ae76a59d42f6a72bbf2999eff3b059da F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3 @@ -614,7 +614,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P cb5bf4642f30ccd9052d76c3a47e7c5afc32afe6 -R a37040921705bf91b118e412481fa829 -U drh -Z 0aaeaf0fdf81d2ffa30bec3d67135f9d +P ebeac2a499ce16ac7e6d12daa5ce9d41e9067d28 +R c6eab2721dc7a2503f5dba9236f9ecde +U pweilbacher +Z 3abc0ef4950723d8e67f5617acc8d019 diff --git a/manifest.uuid b/manifest.uuid index 8a5d85d7bc..9502f3a43d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ebeac2a499ce16ac7e6d12daa5ce9d41e9067d28 \ No newline at end of file +921c7a0ac4581255ea5061980ff7991088b9b78a \ No newline at end of file diff --git a/src/os_os2.c b/src/os_os2.c index b3f6c69ea7..a0c2e1213e 100644 --- a/src/os_os2.c +++ b/src/os_os2.c @@ -165,15 +165,10 @@ int os2Write( */ int os2Truncate( sqlite3_file *id, i64 nByte ){ APIRET rc = NO_ERROR; - ULONG filePosition = 0L; os2File *pFile = (os2File*)id; OSTRACE3( "TRUNCATE %d %lld\n", pFile->h, nByte ); SimulateIOError( return SQLITE_IOERR_TRUNCATE ); - rc = DosSetFilePtr( pFile->h, nByte, FILE_BEGIN, &filePosition ); - if( rc != NO_ERROR ){ - return SQLITE_IOERR; - } - rc = DosSetFilePtr( pFile->h, 0L, FILE_END, &filePosition ); + rc = DosSetFileSize( pFile->h, nByte ); return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR; } @@ -790,24 +785,8 @@ static int os2FullPathname( int nFull, /* Size of output buffer in bytes */ char *zFull /* Output buffer */ ){ - if( strchr(zRelative, ':') ){ - sqlite3_snprintf( nFull, zFull, "%s", zRelative ); - }else{ - ULONG ulDriveNum = 0; - ULONG ulDriveMap = 0; - ULONG cbzBufLen = SQLITE_TEMPNAME_SIZE; - char *zBuff = (char*)malloc( cbzBufLen ); - if( zBuff == 0 ){ - return SQLITE_NOMEM; - } - DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap ); - if( DosQueryCurrentDir( ulDriveNum, (PBYTE)zBuff, &cbzBufLen ) == NO_ERROR ){ - sqlite3_snprintf( nFull, zFull, "%c:\\%s\\%s", - (char)('A' + ulDriveNum - 1), zBuff, zRelative); - } - free( zBuff ); - } - return SQLITE_OK; + APIRET rc = DosQueryPathInfo( zRelative, FIL_QUERYFULLNAME, zFull, nFull ); + return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR; } #ifndef SQLITE_OMIT_LOAD_EXTENSION -- 2.47.3