Fix compilation on Windows.

This commit is contained in:
Ghislain MARY 2016-05-23 17:37:30 +02:00
parent c95fb27ecf
commit d2b8cb2dd5
2 changed files with 8 additions and 6 deletions

View file

@ -439,7 +439,7 @@ LpConfig *lp_config_new_with_factory(const char *config_filename, const char *fa
#ifdef RENAME_REQUIRES_NONEXISTENT_NEW_PATH
if (fd == -1){
pFile = bctbx_filecreate_and_open(lpconfig->g_bctbx_vfs,lpconfig->tmpfilename, "r+");
pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,lpconfig->tmpfilename, "r+");
if (fd){
ms_warning("Could not open %s but %s works, app may have crashed during last sync.",lpconfig->filename,lpconfig->tmpfilename);
}

View file

@ -206,11 +206,13 @@ static int sqlite3bctbx_nolockUnlock(sqlite3_file *pUnused, int unused){
* @return SQLITE_OK on success, SLITE_IOERR_FSYNC if an error occurred.
*/
static int sqlite3bctbx_Sync(sqlite3_file *p, int flags){
sqlite3_bctbx_file *pFile = (sqlite3_bctbx_file*)p;
int rc;
rc = fsync(pFile->pbctbx_file->fd);
return (rc==0 ? SQLITE_OK : SQLITE_IOERR_FSYNC);
sqlite3_bctbx_file *pFile = (sqlite3_bctbx_file*)p;
#if _WIN32
return (FlushFileBuffers(pFile->pbctbx_file->fd) ? SQLITE_OK : SQLITE_IOERR_FSYNC);
#else
int rc = fsync(pFile->pbctbx_file->fd);
return (rc==0 ? SQLITE_OK : SQLITE_IOERR_FSYNC);
#endif
}