mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Update the cygwin interface to use the newer 1.7 APIs instead of the
1.5 APIs. Also shorten over-length source code lines in os_win.c. FossilOrigin-Name: 6b2838336a31e34c540210ccc9c934d4ba94757c
This commit is contained in:
47
src/os_win.c
47
src/os_win.c
@@ -1838,7 +1838,8 @@ static BOOL winceLockFile(
|
||||
}
|
||||
|
||||
/* Want a pending lock? */
|
||||
else if (dwFileOffsetLow == (DWORD)PENDING_BYTE && nNumberOfBytesToLockLow == 1){
|
||||
else if (dwFileOffsetLow == (DWORD)PENDING_BYTE
|
||||
&& nNumberOfBytesToLockLow == 1){
|
||||
/* If no pending lock has been acquired, then acquire it */
|
||||
if (pFile->shared->bPending == 0) {
|
||||
pFile->shared->bPending = TRUE;
|
||||
@@ -1848,7 +1849,8 @@ static BOOL winceLockFile(
|
||||
}
|
||||
|
||||
/* Want a reserved lock? */
|
||||
else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE && nNumberOfBytesToLockLow == 1){
|
||||
else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE
|
||||
&& nNumberOfBytesToLockLow == 1){
|
||||
if (pFile->shared->bReserved == 0) {
|
||||
pFile->shared->bReserved = TRUE;
|
||||
pFile->local.bReserved = TRUE;
|
||||
@@ -1891,7 +1893,8 @@ static BOOL winceUnlockFile(
|
||||
|
||||
/* Did we just have a reader lock? */
|
||||
else if (pFile->local.nReaders){
|
||||
assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE || nNumberOfBytesToUnlockLow == 1);
|
||||
assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE
|
||||
|| nNumberOfBytesToUnlockLow == 1);
|
||||
pFile->local.nReaders --;
|
||||
if (pFile->local.nReaders == 0)
|
||||
{
|
||||
@@ -1902,7 +1905,8 @@ static BOOL winceUnlockFile(
|
||||
}
|
||||
|
||||
/* Releasing a pending lock */
|
||||
else if (dwFileOffsetLow == (DWORD)PENDING_BYTE && nNumberOfBytesToUnlockLow == 1){
|
||||
else if (dwFileOffsetLow == (DWORD)PENDING_BYTE
|
||||
&& nNumberOfBytesToUnlockLow == 1){
|
||||
if (pFile->local.bPending){
|
||||
pFile->local.bPending = FALSE;
|
||||
pFile->shared->bPending = FALSE;
|
||||
@@ -1910,7 +1914,8 @@ static BOOL winceUnlockFile(
|
||||
}
|
||||
}
|
||||
/* Releasing a reserved lock */
|
||||
else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE && nNumberOfBytesToUnlockLow == 1){
|
||||
else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE
|
||||
&& nNumberOfBytesToUnlockLow == 1){
|
||||
if (pFile->local.bReserved) {
|
||||
pFile->local.bReserved = FALSE;
|
||||
pFile->shared->bReserved = FALSE;
|
||||
@@ -3073,7 +3078,7 @@ static int winOpenSharedMemory(winFile *pDbFd){
|
||||
rc = winOpen(pDbFd->pVfs,
|
||||
pShmNode->zFilename, /* Name of the file (UTF-8) */
|
||||
(sqlite3_file*)&pShmNode->hFile, /* File handle here */
|
||||
SQLITE_OPEN_WAL | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, /* Mode flags */
|
||||
SQLITE_OPEN_WAL | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
|
||||
0);
|
||||
if( SQLITE_OK!=rc ){
|
||||
goto shm_open_err;
|
||||
@@ -3827,7 +3832,9 @@ static int winOpen(
|
||||
sqlite3_free(zConverted);
|
||||
if( isReadWrite && !isExclusive ){
|
||||
return winOpen(pVfs, zName, id,
|
||||
((flags|SQLITE_OPEN_READONLY)&~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)), pOutFlags);
|
||||
((flags|SQLITE_OPEN_READONLY) &
|
||||
~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)),
|
||||
pOutFlags);
|
||||
}else{
|
||||
return SQLITE_CANTOPEN_BKPT;
|
||||
}
|
||||
@@ -3910,7 +3917,8 @@ static int winDelete(
|
||||
attr = sAttrData.dwFileAttributes;
|
||||
}else{
|
||||
lastErrno = osGetLastError();
|
||||
if( lastErrno==ERROR_FILE_NOT_FOUND || lastErrno==ERROR_PATH_NOT_FOUND ){
|
||||
if( lastErrno==ERROR_FILE_NOT_FOUND
|
||||
|| lastErrno==ERROR_PATH_NOT_FOUND ){
|
||||
rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
|
||||
}else{
|
||||
rc = SQLITE_ERROR;
|
||||
@@ -3922,7 +3930,8 @@ static int winDelete(
|
||||
#endif
|
||||
if ( attr==INVALID_FILE_ATTRIBUTES ){
|
||||
lastErrno = osGetLastError();
|
||||
if( lastErrno==ERROR_FILE_NOT_FOUND || lastErrno==ERROR_PATH_NOT_FOUND ){
|
||||
if( lastErrno==ERROR_FILE_NOT_FOUND
|
||||
|| lastErrno==ERROR_PATH_NOT_FOUND ){
|
||||
rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
|
||||
}else{
|
||||
rc = SQLITE_ERROR;
|
||||
@@ -3949,7 +3958,8 @@ static int winDelete(
|
||||
attr = osGetFileAttributesA(zConverted);
|
||||
if ( attr==INVALID_FILE_ATTRIBUTES ){
|
||||
lastErrno = osGetLastError();
|
||||
if( lastErrno==ERROR_FILE_NOT_FOUND || lastErrno==ERROR_PATH_NOT_FOUND ){
|
||||
if( lastErrno==ERROR_FILE_NOT_FOUND
|
||||
|| lastErrno==ERROR_PATH_NOT_FOUND ){
|
||||
rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
|
||||
}else{
|
||||
rc = SQLITE_ERROR;
|
||||
@@ -4117,16 +4127,12 @@ static int winFullPathname(
|
||||
*/
|
||||
char zOut[MAX_PATH+1];
|
||||
memset(zOut, 0, MAX_PATH+1);
|
||||
cygwin_conv_to_win32_path(zRelative, zOut); /* POSIX to Win32 */
|
||||
cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut,
|
||||
MAX_PATH+1);
|
||||
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s\\%s",
|
||||
sqlite3_data_directory, zOut);
|
||||
}else{
|
||||
/*
|
||||
** NOTE: The Cygwin docs state that the maximum length needed
|
||||
** for the buffer passed to cygwin_conv_to_full_win32_path
|
||||
** is MAX_PATH.
|
||||
*/
|
||||
cygwin_conv_to_full_win32_path(zRelative, zFull);
|
||||
cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull);
|
||||
}
|
||||
return SQLITE_OK;
|
||||
#endif
|
||||
@@ -4284,9 +4290,9 @@ static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
|
||||
UNUSED_PARAMETER(pVfs);
|
||||
getLastErrorMsg(osGetLastError(), nBuf, zBufOut);
|
||||
}
|
||||
static void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){
|
||||
static void (*winDlSym(sqlite3_vfs *pVfs,void *pH,const char *zSym))(void){
|
||||
UNUSED_PARAMETER(pVfs);
|
||||
return (void(*)(void))osGetProcAddressA((HANDLE)pHandle, zSymbol);
|
||||
return (void(*)(void))osGetProcAddressA((HANDLE)pH, zSym);
|
||||
}
|
||||
static void winDlClose(sqlite3_vfs *pVfs, void *pHandle){
|
||||
UNUSED_PARAMETER(pVfs);
|
||||
@@ -4384,7 +4390,8 @@ static int winCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow){
|
||||
#endif
|
||||
/* 2^32 - to avoid use of LL and warnings in gcc */
|
||||
static const sqlite3_int64 max32BitValue =
|
||||
(sqlite3_int64)2000000000 + (sqlite3_int64)2000000000 + (sqlite3_int64)294967296;
|
||||
(sqlite3_int64)2000000000 + (sqlite3_int64)2000000000 +
|
||||
(sqlite3_int64)294967296;
|
||||
|
||||
#if SQLITE_OS_WINCE
|
||||
SYSTEMTIME time;
|
||||
|
||||
Reference in New Issue
Block a user