OLD | NEW |
1 /* | 1 /* |
2 ** 2007 September 14 | 2 ** 2007 September 14 |
3 ** | 3 ** |
4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
6 ** | 6 ** |
7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
10 ** | 10 ** |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 */ | 501 */ |
502 static int fsSync(sqlite3_file *pFile, int flags){ | 502 static int fsSync(sqlite3_file *pFile, int flags){ |
503 fs_file *p = (fs_file *)pFile; | 503 fs_file *p = (fs_file *)pFile; |
504 fs_real_file *pReal = p->pReal; | 504 fs_real_file *pReal = p->pReal; |
505 sqlite3_file *pRealFile = pReal->pFile; | 505 sqlite3_file *pRealFile = pReal->pFile; |
506 int rc = SQLITE_OK; | 506 int rc = SQLITE_OK; |
507 | 507 |
508 if( p->eType==DATABASE_FILE ){ | 508 if( p->eType==DATABASE_FILE ){ |
509 unsigned char zSize[4]; | 509 unsigned char zSize[4]; |
510 zSize[0] = (pReal->nDatabase&0xFF000000)>>24; | 510 zSize[0] = (pReal->nDatabase&0xFF000000)>>24; |
511 zSize[1] = (pReal->nDatabase&0x00FF0000)>>16; | 511 zSize[1] = (unsigned char)((pReal->nDatabase&0x00FF0000)>>16); |
512 zSize[2] = (pReal->nDatabase&0x0000FF00)>>8; | 512 zSize[2] = (pReal->nDatabase&0x0000FF00)>>8; |
513 zSize[3] = (pReal->nDatabase&0x000000FF); | 513 zSize[3] = (pReal->nDatabase&0x000000FF); |
514 rc = pRealFile->pMethods->xWrite(pRealFile, zSize, 4, 0); | 514 rc = pRealFile->pMethods->xWrite(pRealFile, zSize, 4, 0); |
515 } | 515 } |
516 if( rc==SQLITE_OK ){ | 516 if( rc==SQLITE_OK ){ |
517 rc = pRealFile->pMethods->xSync(pRealFile, flags&(~SQLITE_SYNC_DATAONLY)); | 517 rc = pRealFile->pMethods->xSync(pRealFile, flags&(~SQLITE_SYNC_DATAONLY)); |
518 } | 518 } |
519 | 519 |
520 return rc; | 520 return rc; |
521 } | 521 } |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 if( fs_vfs.pParent ) return SQLITE_OK; | 821 if( fs_vfs.pParent ) return SQLITE_OK; |
822 fs_vfs.pParent = sqlite3_vfs_find(0); | 822 fs_vfs.pParent = sqlite3_vfs_find(0); |
823 fs_vfs.base.mxPathname = fs_vfs.pParent->mxPathname; | 823 fs_vfs.base.mxPathname = fs_vfs.pParent->mxPathname; |
824 fs_vfs.base.szOsFile = MAX(sizeof(tmp_file), sizeof(fs_file)); | 824 fs_vfs.base.szOsFile = MAX(sizeof(tmp_file), sizeof(fs_file)); |
825 return sqlite3_vfs_register(&fs_vfs.base, 0); | 825 return sqlite3_vfs_register(&fs_vfs.base, 0); |
826 } | 826 } |
827 | 827 |
828 #ifdef SQLITE_TEST | 828 #ifdef SQLITE_TEST |
829 int SqlitetestOnefile_Init() {return fs_register();} | 829 int SqlitetestOnefile_Init() {return fs_register();} |
830 #endif | 830 #endif |
OLD | NEW |