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

Fix compilation warnings shown when using strict GCC options for os_os2.c. (CVS 4154)

FossilOrigin-Name: 22277b7e1b3eb1678280de5d49a6613908ab4bff
This commit is contained in:
pweilbacher
2007-07-03 23:37:09 +00:00
parent 2ac2762f37
commit d8e9b6238e
3 changed files with 21 additions and 19 deletions

View File

@@ -161,7 +161,7 @@ int sqlite3Os2OpenExclusive( const char *zFilename, OsFile **pld, int delFlag ){
f.delOnClose = delFlag ? 1 : 0;
f.pathToDel = delFlag ? sqlite3OsFullPathname( zFilename ) : NULL;
OpenCounter( +1 );
if( delFlag ) DosForceDelete( sqlite3OsFullPathname( zFilename ) );
if( delFlag ) DosForceDelete( (PSZ)sqlite3OsFullPathname( zFilename ) );
OSTRACE3( "OPEN EX %d \"%s\"\n", hf, sqlite3OsFullPathname ( zFilename ) );
return allocateOs2File( &f, pld );
}
@@ -230,12 +230,12 @@ int sqlite3Os2TempFileName( char *zBuf ){
"0123456789";
int i, j;
PSZ zTempPath = 0;
if( DosScanEnv( "TEMP", &zTempPath ) ){
if( DosScanEnv( "TMP", &zTempPath ) ){
if( DosScanEnv( "TMPDIR", &zTempPath ) ){
if( DosScanEnv( (PSZ)"TEMP", &zTempPath ) ){
if( DosScanEnv( (PSZ)"TMP", &zTempPath ) ){
if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){
ULONG ulDriveNum = 0, ulDriveMap = 0;
DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
sprintf( zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
}
}
}
@@ -264,7 +264,7 @@ int os2Close( OsFile **pld ){
rc = DosClose( pFile->h );
pFile->locktype = NO_LOCK;
if( pFile->delOnClose != 0 ){
rc = DosForceDelete( pFile->pathToDel );
rc = DosForceDelete( (PSZ)pFile->pathToDel );
}
*pld = 0;
OpenCounter( -1 );
@@ -286,7 +286,7 @@ int os2Read( OsFile *id, void *pBuf, int amt ){
DosRead( ((os2File*)id)->h, pBuf, amt, &got );
if (got == (ULONG)amt)
return SQLITE_OK;
else if (got < 0)
else if (got == 0)
return SQLITE_IOERR_READ;
else {
memset(&((char*)pBuf)[got], 0, amt-got);
@@ -691,7 +691,7 @@ char *sqlite3Os2FullPathname( const char *zRelative ){
zBuff = sqliteMalloc( cbzBufLen );
if( zBuff != 0 ){
DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
if( DosQueryCurrentDir( ulDriveNum, zBuff, &cbzBufLen ) == NO_ERROR ){
if( DosQueryCurrentDir( ulDriveNum, (PBYTE)zBuff, &cbzBufLen ) == NO_ERROR ){
sprintf( zDrive, "%c", (char)('A' + ulDriveNum - 1) );
sqlite3SetString( &zFull, zDrive, ":\\", zBuff,
"\\", zRelative, (char*)0 );
@@ -799,7 +799,7 @@ void *sqlite3Os2Dlopen(const char *zFilename){
UCHAR loadErr[256];
HMODULE hmod;
APIRET rc;
rc = DosLoadModule(loadErr, sizeof(loadErr), zFilename, &hmod);
rc = DosLoadModule((PSZ)loadErr, sizeof(loadErr), zFilename, &hmod);
if (rc != NO_ERROR) return 0;
return (void*)hmod;
}
@@ -816,7 +816,7 @@ void *sqlite3Os2Dlsym(void *pHandle, const char *zSymbol){
rc = DosQueryProcAddr((HMODULE)pHandle, 0L, _zSymbol, &pfn);
}
if (rc != NO_ERROR) return 0;
return pfn;
return (void *)pfn;
}
int sqlite3Os2Dlclose(void *pHandle){
return DosFreeModule((HMODULE)pHandle);
@@ -872,8 +872,8 @@ static ULONG mutexOwner;
** code and what little there is executes quickly and without blocking.
*/
void sqlite3Os2EnterMutex(){
PTIB ptib;
#ifdef SQLITE_OS2_THREADS
PTIB ptib;
DosEnterCritSec();
DosGetInfoBlocks( &ptib, NULL );
mutexOwner = ptib->tib_ptib2->tib2_ultid;
@@ -882,7 +882,9 @@ void sqlite3Os2EnterMutex(){
inMutex = 1;
}
void sqlite3Os2LeaveMutex(){
#ifdef SQLITE_OS2_THREADS
PTIB ptib;
#endif
assert( inMutex );
inMutex = 0;
#ifdef SQLITE_OS2_THREADS