Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix compilation warnings shown when using strict GCC options for os_os2.c. (CVS 4154) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
22277b7e1b3eb1678280de5d49a66139 |
User & Date: | pweilbacher 2007-07-03 23:37:10.000 |
Context
2007-07-12
| ||
13:18 | Fix for #2497. Set the database error code to the return value of sqlite3_step(). (CVS 4155) (check-in: b01fda5f50 user: danielk1977 tags: trunk) | |
2007-07-03
| ||
23:37 | Fix compilation warnings shown when using strict GCC options for os_os2.c. (CVS 4154) (check-in: 22277b7e1b user: pweilbacher tags: trunk) | |
05:31 | Fix a memory leak in shell.c. Reported on the mailing list. This has only been informally tested. (CVS 4153) (check-in: a008905b39 user: danielk1977 tags: trunk) | |
Changes
Changes to src/os_os2.c.
︙ | ︙ | |||
157 158 159 160 161 162 163 | } f.h = hf; f.locktype = NO_LOCK; f.delOnClose = delFlag ? 1 : 0; f.pathToDel = delFlag ? sqlite3OsFullPathname( zFilename ) : NULL; OpenCounter( +1 ); | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | } f.h = hf; f.locktype = NO_LOCK; f.delOnClose = delFlag ? 1 : 0; f.pathToDel = delFlag ? sqlite3OsFullPathname( zFilename ) : NULL; OpenCounter( +1 ); if( delFlag ) DosForceDelete( (PSZ)sqlite3OsFullPathname( zFilename ) ); OSTRACE3( "OPEN EX %d \"%s\"\n", hf, sqlite3OsFullPathname ( zFilename ) ); return allocateOs2File( &f, pld ); } /* ** Attempt to open a new file for read-only access. ** |
︙ | ︙ | |||
226 227 228 229 230 231 232 | int sqlite3Os2TempFileName( char *zBuf ){ static const unsigned char zChars[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; int i, j; PSZ zTempPath = 0; | | | | | | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | int sqlite3Os2TempFileName( char *zBuf ){ static const unsigned char zChars[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; int i, j; PSZ zTempPath = 0; if( DosScanEnv( (PSZ)"TEMP", &zTempPath ) ){ if( DosScanEnv( (PSZ)"TMP", &zTempPath ) ){ if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){ ULONG ulDriveNum = 0, ulDriveMap = 0; DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap ); sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) ); } } } for(;;){ sprintf( zBuf, "%s\\"TEMP_FILE_PREFIX, zTempPath ); j = strlen( zBuf ); sqlite3Randomness( 15, &zBuf[j] ); |
︙ | ︙ | |||
260 261 262 263 264 265 266 | os2File *pFile; APIRET rc = NO_ERROR; if( pld && (pFile = (os2File*)*pld) != 0 ){ OSTRACE2( "CLOSE %d\n", pFile->h ); rc = DosClose( pFile->h ); pFile->locktype = NO_LOCK; if( pFile->delOnClose != 0 ){ | | | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | os2File *pFile; APIRET rc = NO_ERROR; if( pld && (pFile = (os2File*)*pld) != 0 ){ OSTRACE2( "CLOSE %d\n", pFile->h ); rc = DosClose( pFile->h ); pFile->locktype = NO_LOCK; if( pFile->delOnClose != 0 ){ rc = DosForceDelete( (PSZ)pFile->pathToDel ); } *pld = 0; OpenCounter( -1 ); } return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR; } |
︙ | ︙ | |||
282 283 284 285 286 287 288 | ULONG got; assert( id!=0 ); SimulateIOError( return SQLITE_IOERR ); OSTRACE3( "READ %d lock=%d\n", ((os2File*)id)->h, ((os2File*)id)->locktype ); DosRead( ((os2File*)id)->h, pBuf, amt, &got ); if (got == (ULONG)amt) return SQLITE_OK; | | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | ULONG got; assert( id!=0 ); SimulateIOError( return SQLITE_IOERR ); OSTRACE3( "READ %d lock=%d\n", ((os2File*)id)->h, ((os2File*)id)->locktype ); DosRead( ((os2File*)id)->h, pBuf, amt, &got ); if (got == (ULONG)amt) return SQLITE_OK; else if (got == 0) return SQLITE_IOERR_READ; else { memset(&((char*)pBuf)[got], 0, amt-got); return SQLITE_IOERR_SHORT_READ; } } |
︙ | ︙ | |||
687 688 689 690 691 692 693 | ULONG cbzBufLen = SQLITE_TEMPNAME_SIZE; char zDrive[2]; char *zBuff; zBuff = sqliteMalloc( cbzBufLen ); if( zBuff != 0 ){ DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap ); | | | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | ULONG cbzBufLen = SQLITE_TEMPNAME_SIZE; char zDrive[2]; char *zBuff; zBuff = sqliteMalloc( cbzBufLen ); if( zBuff != 0 ){ 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 ); } sqliteFree( zBuff ); } } |
︙ | ︙ | |||
795 796 797 798 799 800 801 | ** Interfaces for opening a shared library, finding entry points ** within the shared library, and closing the shared library. */ void *sqlite3Os2Dlopen(const char *zFilename){ UCHAR loadErr[256]; HMODULE hmod; APIRET rc; | | | | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | ** Interfaces for opening a shared library, finding entry points ** within the shared library, and closing the shared library. */ void *sqlite3Os2Dlopen(const char *zFilename){ UCHAR loadErr[256]; HMODULE hmod; APIRET rc; rc = DosLoadModule((PSZ)loadErr, sizeof(loadErr), zFilename, &hmod); if (rc != NO_ERROR) return 0; return (void*)hmod; } void *sqlite3Os2Dlsym(void *pHandle, const char *zSymbol){ PFN pfn; APIRET rc; rc = DosQueryProcAddr((HMODULE)pHandle, 0L, zSymbol, &pfn); if (rc != NO_ERROR) { /* if the symbol itself was not found, search again for the same * symbol with an extra underscore, that might be needed depending * on the calling convention */ char _zSymbol[256] = "_"; strncat(_zSymbol, zSymbol, 255); rc = DosQueryProcAddr((HMODULE)pHandle, 0L, _zSymbol, &pfn); } if (rc != NO_ERROR) return 0; return (void *)pfn; } int sqlite3Os2Dlclose(void *pHandle){ return DosFreeModule((HMODULE)pHandle); } #endif /* SQLITE_OMIT_LOAD_EXTENSION */ |
︙ | ︙ | |||
868 869 870 871 872 873 874 | ** multi-threaded processes. Only a single thread is allowed to ** executed code that is surrounded by EnterMutex() and LeaveMutex(). ** ** SQLite uses only a single Mutex. There is not much critical ** code and what little there is executes quickly and without blocking. */ void sqlite3Os2EnterMutex(){ | < > > > | 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | ** multi-threaded processes. Only a single thread is allowed to ** executed code that is surrounded by EnterMutex() and LeaveMutex(). ** ** SQLite uses only a single Mutex. There is not much critical ** code and what little there is executes quickly and without blocking. */ void sqlite3Os2EnterMutex(){ #ifdef SQLITE_OS2_THREADS PTIB ptib; DosEnterCritSec(); DosGetInfoBlocks( &ptib, NULL ); mutexOwner = ptib->tib_ptib2->tib2_ultid; #endif assert( !inMutex ); inMutex = 1; } void sqlite3Os2LeaveMutex(){ #ifdef SQLITE_OS2_THREADS PTIB ptib; #endif assert( inMutex ); inMutex = 0; #ifdef SQLITE_OS2_THREADS DosGetInfoBlocks( &ptib, NULL ); assert( mutexOwner == ptib->tib_ptib2->tib2_ultid ); DosExitCritSec(); #endif |
︙ | ︙ |