mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Use type i64 instead of off_t for file offsets since off_t is giving
portability problems. Ticket #924. (CVS 1992) FossilOrigin-Name: 8972c004dc825f668d952e7d082a89046b9260f1
This commit is contained in:
32
manifest
32
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Strict\sprototype\son\ssqlite3_libversion().\s\sTicket\s#936\s(CVS\s1991)
|
C Use\stype\si64\sinstead\sof\soff_t\sfor\sfile\soffsets\ssince\soff_t\sis\sgiving\nportability\sproblems.\s\sTicket\s#924.\s(CVS\s1992)
|
||||||
D 2004-09-30T14:24:50
|
D 2004-10-01T02:00:31
|
||||||
F Makefile.in abdeb5bd9d017822691884935c320037c33f6ee6
|
F Makefile.in abdeb5bd9d017822691884935c320037c33f6ee6
|
||||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||||
@@ -31,7 +31,7 @@ F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea
|
|||||||
F src/btree.c 014d3c9d31136050f3b3294c0c5dc0c7615557bf
|
F src/btree.c 014d3c9d31136050f3b3294c0c5dc0c7615557bf
|
||||||
F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
|
F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
|
||||||
F src/build.c 2ed6d9c26ad736142012bc99898869db17337121
|
F src/build.c 2ed6d9c26ad736142012bc99898869db17337121
|
||||||
F src/date.c eb8d5fa1a6d5cfc09031c8852d10ff742a94b15b
|
F src/date.c 93927e2d1ffbd833fc220644896cfdc8f8d4af34
|
||||||
F src/delete.c d862b383a9abc0b79f4588783c2619fe52d74ea7
|
F src/delete.c d862b383a9abc0b79f4588783c2619fe52d74ea7
|
||||||
F src/expr.c f255c5c56c0371cb2955cbc2733621051e4f79f8
|
F src/expr.c f255c5c56c0371cb2955cbc2733621051e4f79f8
|
||||||
F src/func.c 1fbc5256639586573fd0e70814d6dcd8bc10afc1
|
F src/func.c 1fbc5256639586573fd0e70814d6dcd8bc10afc1
|
||||||
@@ -41,17 +41,17 @@ F src/insert.c 2c10c001f62cde92e9517ec7516b6584519754d1
|
|||||||
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
|
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
|
||||||
F src/main.c 2a1b9623fde3fe5e22fe726cdae4e10f33671caa
|
F src/main.c 2a1b9623fde3fe5e22fe726cdae4e10f33671caa
|
||||||
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
|
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
|
||||||
F src/os.h d1780e0db95cad01f213d48da22ab490eb4fd345
|
F src/os.h 5834a404b7c8318dc1928c9fc0137a65c9c0416c
|
||||||
F src/os_common.h cd7eb025fdab7dc91e0e97bf6310f1648205857f
|
F src/os_common.h cd7eb025fdab7dc91e0e97bf6310f1648205857f
|
||||||
F src/os_mac.c 3d31e26be1411acfb7961033098631b4f3486fdf
|
F src/os_mac.c 7367dab0c44ab0b2c4337e73ac6f6f97f171c2cb
|
||||||
F src/os_mac.h 51d2445f47e182ed32d3bd6937f81070c6fd9bd4
|
F src/os_mac.h 608fdf39eafa1ce25fc8cb223b8b0a073341d4da
|
||||||
F src/os_test.c d3cb336448d28cb6238f8c0d7a44b0ff010601ea
|
F src/os_test.c d9a21852d170f20adeae6f224d1beba2cb5af8aa
|
||||||
F src/os_test.h 6a26a4978492e4bbdbf385554958418ff02db162
|
F src/os_test.h 6a26a4978492e4bbdbf385554958418ff02db162
|
||||||
F src/os_unix.c a5625eed7ab071d1715df783f4684945ae538a22
|
F src/os_unix.c 6a02c1bc1d6d73332daaea695116030aebd60c2a
|
||||||
F src/os_unix.h f3097815e041e82e24d92505e1ff61ba24172d13
|
F src/os_unix.h f3097815e041e82e24d92505e1ff61ba24172d13
|
||||||
F src/os_win.c 9e2887825b1a32f0ceb1b73b93ffe29a112cd86f
|
F src/os_win.c 0ab81ce1e4739e0e251b6aa3e74e1a6b75b612da
|
||||||
F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44
|
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||||
F src/pager.c 705a61117f05d7dd031762408f9a279834e88c3a
|
F src/pager.c 39e0ad16ffb94fecf3dc9fd73bccf3e7445f0e17
|
||||||
F src/pager.h 67739fe649f33be55dba522ca8a9cc4e42d14f71
|
F src/pager.h 67739fe649f33be55dba522ca8a9cc4e42d14f71
|
||||||
F src/parse.y 968231351dd13ef6ee544336295db54708c22faf
|
F src/parse.y 968231351dd13ef6ee544336295db54708c22faf
|
||||||
F src/pragma.c 45978cc82fdf91f00d024a8e875c2b679fbce488
|
F src/pragma.c 45978cc82fdf91f00d024a8e875c2b679fbce488
|
||||||
@@ -60,11 +60,11 @@ F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
|
|||||||
F src/select.c 96b1489111abe9b584be2f2cce26ad6f2d425b4e
|
F src/select.c 96b1489111abe9b584be2f2cce26ad6f2d425b4e
|
||||||
F src/shell.c 0856973c2b94e22664bc43f398ba3fc22d5e080c
|
F src/shell.c 0856973c2b94e22664bc43f398ba3fc22d5e080c
|
||||||
F src/sqlite.h.in 9bb76ff9e79ee72e6d529ff6ab1c252d513c3864
|
F src/sqlite.h.in 9bb76ff9e79ee72e6d529ff6ab1c252d513c3864
|
||||||
F src/sqliteInt.h 1259d965d61209d35e5fb3704ab5167a8a123a72
|
F src/sqliteInt.h 5c406ebc830c5129748b77539283c0e20f978887
|
||||||
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
|
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
|
||||||
F src/tclsqlite.c 0302e3f42f015d132d1291f3388c06e86c24a008
|
F src/tclsqlite.c 0302e3f42f015d132d1291f3388c06e86c24a008
|
||||||
F src/test1.c 3d78e5d827bf5d037f697c233c5934d45af46cb5
|
F src/test1.c 3d78e5d827bf5d037f697c233c5934d45af46cb5
|
||||||
F src/test2.c 0f3e0ad7b675a6f3323211ab4ea95490855654c3
|
F src/test2.c 2d25e3893f7d1efeeba21958e6e66d92d5ec7762
|
||||||
F src/test3.c 5b5b0f3d11b097399c1054fff73d8f3711092301
|
F src/test3.c 5b5b0f3d11b097399c1054fff73d8f3711092301
|
||||||
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
|
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
|
||||||
F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1
|
F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1
|
||||||
@@ -247,7 +247,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
|
|||||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||||
P 85ad18712d2bd2b4322ceb617f33c265c1933240
|
P 1d3c6f735101d8fc582871c0370805596d975001
|
||||||
R 97f876db8e571c0e481dc83e4b085746
|
R 4ac86aa49220b9d9c39284b9bff439d6
|
||||||
U drh
|
U drh
|
||||||
Z f318429a04f656933a5e6c25b9072cc1
|
Z 3cafaabb57dd86a72ca0b894aa70f6d5
|
||||||
|
@@ -1 +1 @@
|
|||||||
1d3c6f735101d8fc582871c0370805596d975001
|
8972c004dc825f668d952e7d082a89046b9260f1
|
@@ -16,7 +16,7 @@
|
|||||||
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
|
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
|
||||||
** All other code has file scope.
|
** All other code has file scope.
|
||||||
**
|
**
|
||||||
** $Id: date.c,v 1.35 2004/09/06 17:24:12 drh Exp $
|
** $Id: date.c,v 1.36 2004/10/01 02:00:31 drh Exp $
|
||||||
**
|
**
|
||||||
** NOTES:
|
** NOTES:
|
||||||
**
|
**
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
** Willmann-Bell, Inc
|
** Willmann-Bell, Inc
|
||||||
** Richmond, Virginia (USA)
|
** Richmond, Virginia (USA)
|
||||||
*/
|
*/
|
||||||
#include "os.h"
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
#include "os.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
6
src/os.h
6
src/os.h
@@ -179,10 +179,10 @@ int sqlite3OsTempFileName(char*);
|
|||||||
int sqlite3OsClose(OsFile*);
|
int sqlite3OsClose(OsFile*);
|
||||||
int sqlite3OsRead(OsFile*, void*, int amt);
|
int sqlite3OsRead(OsFile*, void*, int amt);
|
||||||
int sqlite3OsWrite(OsFile*, const void*, int amt);
|
int sqlite3OsWrite(OsFile*, const void*, int amt);
|
||||||
int sqlite3OsSeek(OsFile*, off_t offset);
|
int sqlite3OsSeek(OsFile*, i64 offset);
|
||||||
int sqlite3OsSync(OsFile*);
|
int sqlite3OsSync(OsFile*);
|
||||||
int sqlite3OsTruncate(OsFile*, off_t size);
|
int sqlite3OsTruncate(OsFile*, i64 size);
|
||||||
int sqlite3OsFileSize(OsFile*, off_t *pSize);
|
int sqlite3OsFileSize(OsFile*, i64 *pSize);
|
||||||
int sqlite3OsRandomSeed(char*);
|
int sqlite3OsRandomSeed(char*);
|
||||||
int sqlite3OsSleep(int ms);
|
int sqlite3OsSleep(int ms);
|
||||||
int sqlite3OsCurrentTime(double*);
|
int sqlite3OsCurrentTime(double*);
|
||||||
|
@@ -13,9 +13,9 @@
|
|||||||
** This file contains code that is specific classic mac. Mac OS X
|
** This file contains code that is specific classic mac. Mac OS X
|
||||||
** uses the os_unix.c file, not this one.
|
** uses the os_unix.c file, not this one.
|
||||||
*/
|
*/
|
||||||
#include "os.h" /* Must be first to enable large file support */
|
|
||||||
#if OS_MAC /* This file used on classic mac only */
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
#include "os.h"
|
||||||
|
#if OS_MAC /* This file used on classic mac only */
|
||||||
|
|
||||||
#include <extras.h>
|
#include <extras.h>
|
||||||
#include <path2fss.h>
|
#include <path2fss.h>
|
||||||
|
@@ -19,11 +19,6 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <Files.h>
|
#include <Files.h>
|
||||||
#ifdef _LARGE_FILE
|
|
||||||
typedef SInt64 off_t;
|
|
||||||
#else
|
|
||||||
typedef SInt32 off_t;
|
|
||||||
#endif
|
|
||||||
#define SQLITE_TEMPNAME_SIZE _MAX_PATH
|
#define SQLITE_TEMPNAME_SIZE _MAX_PATH
|
||||||
#define SQLITE_MIN_SLEEP_MS 17
|
#define SQLITE_MIN_SLEEP_MS 17
|
||||||
|
|
||||||
|
@@ -13,9 +13,9 @@
|
|||||||
** This file contains code that is specific to Unix systems. It is used
|
** This file contains code that is specific to Unix systems. It is used
|
||||||
** for testing SQLite only.
|
** for testing SQLite only.
|
||||||
*/
|
*/
|
||||||
#include "os.h" /* Must be first to enable large file support */
|
|
||||||
#if OS_TEST /* This file is used for the test backend only */
|
#if OS_TEST /* This file is used for the test backend only */
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
#include "os.h" /* Must be first to enable large file support */
|
||||||
|
|
||||||
#define sqlite3OsOpenReadWrite sqlite3RealOpenReadWrite
|
#define sqlite3OsOpenReadWrite sqlite3RealOpenReadWrite
|
||||||
#define sqlite3OsOpenExclusive sqlite3RealOpenExclusive
|
#define sqlite3OsOpenExclusive sqlite3RealOpenExclusive
|
||||||
@@ -149,7 +149,7 @@ static void closeFile(OsFile *id){
|
|||||||
** Return the current seek offset from the start of the file. This
|
** Return the current seek offset from the start of the file. This
|
||||||
** is unix-only code.
|
** is unix-only code.
|
||||||
*/
|
*/
|
||||||
static off_t osTell(OsTestFile *pFile){
|
static i64 osTell(OsTestFile *pFile){
|
||||||
return lseek(pFile->fd.h, 0, SEEK_CUR);
|
return lseek(pFile->fd.h, 0, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ static int cacheBlock(OsTestFile *pFile, int blk){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( !pFile->apBlk[blk] ){
|
if( !pFile->apBlk[blk] ){
|
||||||
off_t filesize;
|
i64 filesize;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
u8 *p = sqliteMalloc(BLOCKSIZE);
|
u8 *p = sqliteMalloc(BLOCKSIZE);
|
||||||
@@ -201,7 +201,7 @@ static int cacheBlock(OsTestFile *pFile, int blk){
|
|||||||
static int writeCache2(OsTestFile *pFile, int crash){
|
static int writeCache2(OsTestFile *pFile, int crash){
|
||||||
int i;
|
int i;
|
||||||
int nMax = pFile->nMaxWrite;
|
int nMax = pFile->nMaxWrite;
|
||||||
off_t offset;
|
i64 offset;
|
||||||
int rc = SQLITE_OK;
|
int rc = SQLITE_OK;
|
||||||
|
|
||||||
offset = osTell(pFile);
|
offset = osTell(pFile);
|
||||||
@@ -295,8 +295,8 @@ int sqlite3OsClose(OsFile *id){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
|
int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
|
||||||
off_t offset; /* The current offset from the start of the file */
|
i64 offset; /* The current offset from the start of the file */
|
||||||
off_t end; /* The byte just past the last byte read */
|
i64 end; /* The byte just past the last byte read */
|
||||||
int blk; /* Block number the read starts on */
|
int blk; /* Block number the read starts on */
|
||||||
int i;
|
int i;
|
||||||
u8 *zCsr;
|
u8 *zCsr;
|
||||||
@@ -340,8 +340,8 @@ int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
|
int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
|
||||||
off_t offset; /* The current offset from the start of the file */
|
i64 offset; /* The current offset from the start of the file */
|
||||||
off_t end; /* The byte just past the last byte written */
|
i64 end; /* The byte just past the last byte written */
|
||||||
int blk; /* Block number the write starts on */
|
int blk; /* Block number the write starts on */
|
||||||
int i;
|
int i;
|
||||||
const u8 *zCsr;
|
const u8 *zCsr;
|
||||||
@@ -403,7 +403,7 @@ int sqlite3OsSync(OsFile *id){
|
|||||||
** file size to ensure that nothing in the write-cache past this point
|
** file size to ensure that nothing in the write-cache past this point
|
||||||
** is written to disk.
|
** is written to disk.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
int sqlite3OsTruncate(OsFile *id, i64 nByte){
|
||||||
(*id)->nMaxWrite = nByte;
|
(*id)->nMaxWrite = nByte;
|
||||||
return sqlite3RealTruncate(&(*id)->fd, nByte);
|
return sqlite3RealTruncate(&(*id)->fd, nByte);
|
||||||
}
|
}
|
||||||
@@ -412,7 +412,7 @@ int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
|||||||
** Return the size of the file. If the cache contains a write that extended
|
** Return the size of the file. If the cache contains a write that extended
|
||||||
** the file, then return this size instead of the on-disk size.
|
** the file, then return this size instead of the on-disk size.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsFileSize(OsFile *id, off_t *pSize){
|
int sqlite3OsFileSize(OsFile *id, i64 *pSize){
|
||||||
int rc = sqlite3RealFileSize(&(*id)->fd, pSize);
|
int rc = sqlite3RealFileSize(&(*id)->fd, pSize);
|
||||||
if( rc==SQLITE_OK && pSize && *pSize<(*id)->nMaxWrite ){
|
if( rc==SQLITE_OK && pSize && *pSize<(*id)->nMaxWrite ){
|
||||||
*pSize = (*id)->nMaxWrite;
|
*pSize = (*id)->nMaxWrite;
|
||||||
@@ -442,7 +442,7 @@ int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){
|
|||||||
** These six function calls are passed straight through to the os_unix.c
|
** These six function calls are passed straight through to the os_unix.c
|
||||||
** backend.
|
** backend.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsSeek(OsFile *id, off_t offset){
|
int sqlite3OsSeek(OsFile *id, i64 offset){
|
||||||
return sqlite3RealSeek(&(*id)->fd, offset);
|
return sqlite3RealSeek(&(*id)->fd, offset);
|
||||||
}
|
}
|
||||||
int sqlite3OsCheckReservedLock(OsFile *id){
|
int sqlite3OsCheckReservedLock(OsFile *id){
|
||||||
|
@@ -12,9 +12,9 @@
|
|||||||
**
|
**
|
||||||
** This file contains code that is specific to Unix systems.
|
** This file contains code that is specific to Unix systems.
|
||||||
*/
|
*/
|
||||||
#include "os.h" /* Must be first to enable large file support */
|
|
||||||
#if OS_UNIX /* This file is used on unix only */
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
#include "os.h"
|
||||||
|
#if OS_UNIX /* This file is used on unix only */
|
||||||
|
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
# define O_BINARY 0
|
# define O_BINARY 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The DJGPP compiler environment looks mostly like Unix, but it
|
** The DJGPP compiler environment looks mostly like Unix, but it
|
||||||
** lacks the fcntl() system call. So redefine fcntl() to be something
|
** lacks the fcntl() system call. So redefine fcntl() to be something
|
||||||
@@ -662,7 +663,7 @@ int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
|
|||||||
/*
|
/*
|
||||||
** Move the read/write pointer in a file.
|
** Move the read/write pointer in a file.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsSeek(OsFile *id, off_t offset){
|
int sqlite3OsSeek(OsFile *id, i64 offset){
|
||||||
assert( id->isOpen );
|
assert( id->isOpen );
|
||||||
SEEK(offset/1024 + 1);
|
SEEK(offset/1024 + 1);
|
||||||
lseek(id->h, offset, SEEK_SET);
|
lseek(id->h, offset, SEEK_SET);
|
||||||
@@ -733,7 +734,7 @@ int sqlite3OsSyncDirectory(const char *zDirname){
|
|||||||
/*
|
/*
|
||||||
** Truncate an open file to a specified size
|
** Truncate an open file to a specified size
|
||||||
*/
|
*/
|
||||||
int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
int sqlite3OsTruncate(OsFile *id, i64 nByte){
|
||||||
assert( id->isOpen );
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
return ftruncate(id->h, nByte)==0 ? SQLITE_OK : SQLITE_IOERR;
|
return ftruncate(id->h, nByte)==0 ? SQLITE_OK : SQLITE_IOERR;
|
||||||
@@ -742,7 +743,7 @@ int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
|||||||
/*
|
/*
|
||||||
** Determine the current size of a file in bytes
|
** Determine the current size of a file in bytes
|
||||||
*/
|
*/
|
||||||
int sqlite3OsFileSize(OsFile *id, off_t *pSize){
|
int sqlite3OsFileSize(OsFile *id, i64 *pSize){
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
assert( id->isOpen );
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
|
12
src/os_win.c
12
src/os_win.c
@@ -12,9 +12,9 @@
|
|||||||
**
|
**
|
||||||
** This file contains code that is specific to windows.
|
** This file contains code that is specific to windows.
|
||||||
*/
|
*/
|
||||||
#include "os.h" /* Must be first to enable large file support */
|
|
||||||
#if OS_WIN /* This file is used for windows only */
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
#include "os.h"
|
||||||
|
#if OS_WIN /* This file is used for windows only */
|
||||||
|
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
|
|||||||
/*
|
/*
|
||||||
** Move the read/write pointer in a file.
|
** Move the read/write pointer in a file.
|
||||||
*/
|
*/
|
||||||
int sqlite3OsSeek(OsFile *id, off_t offset){
|
int sqlite3OsSeek(OsFile *id, i64 offset){
|
||||||
LONG upperBits = offset>>32;
|
LONG upperBits = offset>>32;
|
||||||
LONG lowerBits = offset & 0xffffffff;
|
LONG lowerBits = offset & 0xffffffff;
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
@@ -329,7 +329,7 @@ int sqlite3OsSyncDirectory(const char *zDirname){
|
|||||||
/*
|
/*
|
||||||
** Truncate an open file to a specified size
|
** Truncate an open file to a specified size
|
||||||
*/
|
*/
|
||||||
int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
int sqlite3OsTruncate(OsFile *id, i64 nByte){
|
||||||
LONG upperBits = nByte>>32;
|
LONG upperBits = nByte>>32;
|
||||||
assert( id->isOpen );
|
assert( id->isOpen );
|
||||||
TRACE3("TRUNCATE %d %lld\n", id->h, nByte);
|
TRACE3("TRUNCATE %d %lld\n", id->h, nByte);
|
||||||
@@ -342,12 +342,12 @@ int sqlite3OsTruncate(OsFile *id, off_t nByte){
|
|||||||
/*
|
/*
|
||||||
** Determine the current size of a file in bytes
|
** Determine the current size of a file in bytes
|
||||||
*/
|
*/
|
||||||
int sqlite3OsFileSize(OsFile *id, off_t *pSize){
|
int sqlite3OsFileSize(OsFile *id, i64 *pSize){
|
||||||
DWORD upperBits, lowerBits;
|
DWORD upperBits, lowerBits;
|
||||||
assert( id->isOpen );
|
assert( id->isOpen );
|
||||||
SimulateIOError(SQLITE_IOERR);
|
SimulateIOError(SQLITE_IOERR);
|
||||||
lowerBits = GetFileSize(id->h, &upperBits);
|
lowerBits = GetFileSize(id->h, &upperBits);
|
||||||
*pSize = (((off_t)upperBits)<<32) + lowerBits;
|
*pSize = (((i64)upperBits)<<32) + lowerBits;
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
src/os_win.h
11
src/os_win.h
@@ -18,17 +18,6 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
|
||||||
typedef __int64 off_t;
|
|
||||||
#else
|
|
||||||
# if !defined(_CYGWIN_TYPES_H)
|
|
||||||
typedef long long off_t;
|
|
||||||
# if defined(__MINGW32__)
|
|
||||||
# define _OFF_T_
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The OsFile structure is a operating-system independing representation
|
** The OsFile structure is a operating-system independing representation
|
||||||
** of an open file handle. It is defined differently for each architecture.
|
** of an open file handle. It is defined differently for each architecture.
|
||||||
|
48
src/pager.c
48
src/pager.c
@@ -18,10 +18,10 @@
|
|||||||
** file simultaneously, or one process from reading the database while
|
** file simultaneously, or one process from reading the database while
|
||||||
** another is writing.
|
** another is writing.
|
||||||
**
|
**
|
||||||
** @(#) $Id: pager.c,v 1.164 2004/09/24 22:32:31 drh Exp $
|
** @(#) $Id: pager.c,v 1.165 2004/10/01 02:00:31 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "os.h" /* Must be first to enable large file support */
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
#include "os.h"
|
||||||
#include "pager.h"
|
#include "pager.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -190,7 +190,7 @@ struct Pager {
|
|||||||
int dbSize; /* Number of pages in the file */
|
int dbSize; /* Number of pages in the file */
|
||||||
int origDbSize; /* dbSize before the current change */
|
int origDbSize; /* dbSize before the current change */
|
||||||
int stmtSize; /* Size of database (in pages) at stmt_begin() */
|
int stmtSize; /* Size of database (in pages) at stmt_begin() */
|
||||||
off_t stmtJSize; /* Size of journal at stmt_begin() */
|
i64 stmtJSize; /* Size of journal at stmt_begin() */
|
||||||
int nRec; /* Number of pages written to the journal */
|
int nRec; /* Number of pages written to the journal */
|
||||||
u32 cksumInit; /* Quasi-random value added to every checksum */
|
u32 cksumInit; /* Quasi-random value added to every checksum */
|
||||||
int stmtNRec; /* Number of records in stmt subjournal */
|
int stmtNRec; /* Number of records in stmt subjournal */
|
||||||
@@ -228,10 +228,10 @@ struct Pager {
|
|||||||
PgHdr *pFirstSynced; /* First free page with PgHdr.needSync==0 */
|
PgHdr *pFirstSynced; /* First free page with PgHdr.needSync==0 */
|
||||||
PgHdr *pAll; /* List of all pages */
|
PgHdr *pAll; /* List of all pages */
|
||||||
PgHdr *pStmt; /* List of pages in the statement subjournal */
|
PgHdr *pStmt; /* List of pages in the statement subjournal */
|
||||||
off_t journalOff; /* Current byte offset in the journal file */
|
i64 journalOff; /* Current byte offset in the journal file */
|
||||||
off_t journalHdr; /* Byte offset to previous journal header */
|
i64 journalHdr; /* Byte offset to previous journal header */
|
||||||
off_t stmtHdrOff; /* First journal header written this statement */
|
i64 stmtHdrOff; /* First journal header written this statement */
|
||||||
off_t stmtCksum; /* cksumInit when statement was started */
|
i64 stmtCksum; /* cksumInit when statement was started */
|
||||||
int sectorSize; /* Assumed sector size during rollback */
|
int sectorSize; /* Assumed sector size during rollback */
|
||||||
PgHdr *aHash[N_PG_HASH]; /* Hash table to map page number to PgHdr */
|
PgHdr *aHash[N_PG_HASH]; /* Hash table to map page number to PgHdr */
|
||||||
};
|
};
|
||||||
@@ -399,7 +399,7 @@ static int pager_errcode(Pager *pPager){
|
|||||||
static int readMasterJournal(OsFile *pJrnl, char **pzMaster){
|
static int readMasterJournal(OsFile *pJrnl, char **pzMaster){
|
||||||
int rc;
|
int rc;
|
||||||
u32 len;
|
u32 len;
|
||||||
off_t szJ;
|
i64 szJ;
|
||||||
u32 cksum;
|
u32 cksum;
|
||||||
int i;
|
int i;
|
||||||
unsigned char aMagic[8]; /* A buffer to hold the magic header */
|
unsigned char aMagic[8]; /* A buffer to hold the magic header */
|
||||||
@@ -469,8 +469,8 @@ static int readMasterJournal(OsFile *pJrnl, char **pzMaster){
|
|||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
static int seekJournalHdr(Pager *pPager){
|
static int seekJournalHdr(Pager *pPager){
|
||||||
off_t offset = 0;
|
i64 offset = 0;
|
||||||
off_t c = pPager->journalOff;
|
i64 c = pPager->journalOff;
|
||||||
if( c ){
|
if( c ){
|
||||||
offset = ((c-1)/JOURNAL_HDR_SZ(pPager) + 1) * JOURNAL_HDR_SZ(pPager);
|
offset = ((c-1)/JOURNAL_HDR_SZ(pPager) + 1) * JOURNAL_HDR_SZ(pPager);
|
||||||
}
|
}
|
||||||
@@ -562,7 +562,7 @@ static int writeJournalHdr(Pager *pPager){
|
|||||||
*/
|
*/
|
||||||
static int readJournalHdr(
|
static int readJournalHdr(
|
||||||
Pager *pPager,
|
Pager *pPager,
|
||||||
off_t journalSize,
|
i64 journalSize,
|
||||||
u32 *pNRec,
|
u32 *pNRec,
|
||||||
u32 *pDbSize
|
u32 *pDbSize
|
||||||
){
|
){
|
||||||
@@ -871,7 +871,7 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
|
|||||||
assert( pPager->state>=PAGER_EXCLUSIVE || pPg );
|
assert( pPager->state>=PAGER_EXCLUSIVE || pPg );
|
||||||
TRACE3("PLAYBACK %d page %d\n", pPager->fd.h, pgno);
|
TRACE3("PLAYBACK %d page %d\n", pPager->fd.h, pgno);
|
||||||
if( pPager->state>=PAGER_EXCLUSIVE ){
|
if( pPager->state>=PAGER_EXCLUSIVE ){
|
||||||
sqlite3OsSeek(&pPager->fd, (pgno-1)*(off_t)pPager->pageSize);
|
sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize);
|
||||||
rc = sqlite3OsWrite(&pPager->fd, aData, pPager->pageSize);
|
rc = sqlite3OsWrite(&pPager->fd, aData, pPager->pageSize);
|
||||||
}
|
}
|
||||||
if( pPg ){
|
if( pPg ){
|
||||||
@@ -911,7 +911,7 @@ static int pager_delmaster(const char *zMaster){
|
|||||||
int master_open = 0;
|
int master_open = 0;
|
||||||
OsFile master;
|
OsFile master;
|
||||||
char *zMasterJournal = 0; /* Contents of master journal file */
|
char *zMasterJournal = 0; /* Contents of master journal file */
|
||||||
off_t nMasterJournal; /* Size of master journal file */
|
i64 nMasterJournal; /* Size of master journal file */
|
||||||
|
|
||||||
/* Open the master journal file exclusively in case some other process
|
/* Open the master journal file exclusively in case some other process
|
||||||
** is running this routine also. Not that it makes too much difference.
|
** is running this routine also. Not that it makes too much difference.
|
||||||
@@ -996,7 +996,7 @@ static int pager_reload_cache(Pager *pPager){
|
|||||||
char zBuf[SQLITE_MAX_PAGE_SIZE];
|
char zBuf[SQLITE_MAX_PAGE_SIZE];
|
||||||
if( !pPg->dirty ) continue;
|
if( !pPg->dirty ) continue;
|
||||||
if( (int)pPg->pgno <= pPager->origDbSize ){
|
if( (int)pPg->pgno <= pPager->origDbSize ){
|
||||||
sqlite3OsSeek(&pPager->fd, pPager->pageSize*(off_t)(pPg->pgno-1));
|
sqlite3OsSeek(&pPager->fd, pPager->pageSize*(i64)(pPg->pgno-1));
|
||||||
rc = sqlite3OsRead(&pPager->fd, zBuf, pPager->pageSize);
|
rc = sqlite3OsRead(&pPager->fd, zBuf, pPager->pageSize);
|
||||||
TRACE3("REFETCH %d page %d\n", pPager->fd.h, pPg->pgno);
|
TRACE3("REFETCH %d page %d\n", pPager->fd.h, pPg->pgno);
|
||||||
if( rc ) break;
|
if( rc ) break;
|
||||||
@@ -1023,7 +1023,7 @@ static int pager_reload_cache(Pager *pPager){
|
|||||||
** indicated.
|
** indicated.
|
||||||
*/
|
*/
|
||||||
static int pager_truncate(Pager *pPager, int nPage){
|
static int pager_truncate(Pager *pPager, int nPage){
|
||||||
return sqlite3OsTruncate(&pPager->fd, pPager->pageSize*(off_t)nPage);
|
return sqlite3OsTruncate(&pPager->fd, pPager->pageSize*(i64)nPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1080,7 +1080,7 @@ static int pager_truncate(Pager *pPager, int nPage){
|
|||||||
** and an error code is returned.
|
** and an error code is returned.
|
||||||
*/
|
*/
|
||||||
static int pager_playback(Pager *pPager){
|
static int pager_playback(Pager *pPager){
|
||||||
off_t szJ; /* Size of the journal file in bytes */
|
i64 szJ; /* Size of the journal file in bytes */
|
||||||
u32 nRec; /* Number of Records in the journal */
|
u32 nRec; /* Number of Records in the journal */
|
||||||
int i; /* Loop counter */
|
int i; /* Loop counter */
|
||||||
Pgno mxPg = 0; /* Size of the original file in pages */
|
Pgno mxPg = 0; /* Size of the original file in pages */
|
||||||
@@ -1215,8 +1215,8 @@ end_playback:
|
|||||||
** at offset pPager->stmtJSize.
|
** at offset pPager->stmtJSize.
|
||||||
*/
|
*/
|
||||||
static int pager_stmt_playback(Pager *pPager){
|
static int pager_stmt_playback(Pager *pPager){
|
||||||
off_t szJ; /* Size of the full journal */
|
i64 szJ; /* Size of the full journal */
|
||||||
off_t hdrOff;
|
i64 hdrOff;
|
||||||
int nRec; /* Number of Records */
|
int nRec; /* Number of Records */
|
||||||
int i; /* Loop counter */
|
int i; /* Loop counter */
|
||||||
int rc;
|
int rc;
|
||||||
@@ -1224,7 +1224,7 @@ static int pager_stmt_playback(Pager *pPager){
|
|||||||
szJ = pPager->journalOff;
|
szJ = pPager->journalOff;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
{
|
{
|
||||||
off_t os_szJ;
|
i64 os_szJ;
|
||||||
rc = sqlite3OsFileSize(&pPager->jfd, &os_szJ);
|
rc = sqlite3OsFileSize(&pPager->jfd, &os_szJ);
|
||||||
if( rc!=SQLITE_OK ) return rc;
|
if( rc!=SQLITE_OK ) return rc;
|
||||||
assert( szJ==os_szJ );
|
assert( szJ==os_szJ );
|
||||||
@@ -1566,7 +1566,7 @@ void sqlite3pager_read_fileheader(Pager *pPager, int N, unsigned char *pDest){
|
|||||||
** pPager.
|
** pPager.
|
||||||
*/
|
*/
|
||||||
int sqlite3pager_pagecount(Pager *pPager){
|
int sqlite3pager_pagecount(Pager *pPager){
|
||||||
off_t n;
|
i64 n;
|
||||||
assert( pPager!=0 );
|
assert( pPager!=0 );
|
||||||
if( pPager->dbSize>=0 ){
|
if( pPager->dbSize>=0 ){
|
||||||
return pPager->dbSize;
|
return pPager->dbSize;
|
||||||
@@ -1852,7 +1852,7 @@ static int syncJournal(Pager *pPager){
|
|||||||
/* Make sure the pPager->nRec counter we are keeping agrees
|
/* Make sure the pPager->nRec counter we are keeping agrees
|
||||||
** with the nRec computed from the size of the journal file.
|
** with the nRec computed from the size of the journal file.
|
||||||
*/
|
*/
|
||||||
off_t jSz;
|
i64 jSz;
|
||||||
rc = sqlite3OsFileSize(&pPager->jfd, &jSz);
|
rc = sqlite3OsFileSize(&pPager->jfd, &jSz);
|
||||||
if( rc!=0 ) return rc;
|
if( rc!=0 ) return rc;
|
||||||
assert( pPager->journalOff==jSz );
|
assert( pPager->journalOff==jSz );
|
||||||
@@ -1949,7 +1949,7 @@ static int pager_write_pagelist(PgHdr *pList){
|
|||||||
|
|
||||||
while( pList ){
|
while( pList ){
|
||||||
assert( pList->dirty );
|
assert( pList->dirty );
|
||||||
sqlite3OsSeek(&pPager->fd, (pList->pgno-1)*(off_t)pPager->pageSize);
|
sqlite3OsSeek(&pPager->fd, (pList->pgno-1)*(i64)pPager->pageSize);
|
||||||
CODEC(pPager, PGHDR_TO_DATA(pList), pList->pgno, 6);
|
CODEC(pPager, PGHDR_TO_DATA(pList), pList->pgno, 6);
|
||||||
TRACE3("STORE %d page %d\n", pPager->fd.h, pList->pgno);
|
TRACE3("STORE %d page %d\n", pPager->fd.h, pList->pgno);
|
||||||
rc = sqlite3OsWrite(&pPager->fd, PGHDR_TO_DATA(pList), pPager->pageSize);
|
rc = sqlite3OsWrite(&pPager->fd, PGHDR_TO_DATA(pList), pPager->pageSize);
|
||||||
@@ -2226,12 +2226,12 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
|
|||||||
}else{
|
}else{
|
||||||
int rc;
|
int rc;
|
||||||
assert( pPager->memDb==0 );
|
assert( pPager->memDb==0 );
|
||||||
sqlite3OsSeek(&pPager->fd, (pgno-1)*(off_t)pPager->pageSize);
|
sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize);
|
||||||
rc = sqlite3OsRead(&pPager->fd, PGHDR_TO_DATA(pPg), pPager->pageSize);
|
rc = sqlite3OsRead(&pPager->fd, PGHDR_TO_DATA(pPg), pPager->pageSize);
|
||||||
TRACE3("FETCH %d page %d\n", pPager->fd.h, pPg->pgno);
|
TRACE3("FETCH %d page %d\n", pPager->fd.h, pPg->pgno);
|
||||||
CODEC(pPager, PGHDR_TO_DATA(pPg), pPg->pgno, 3);
|
CODEC(pPager, PGHDR_TO_DATA(pPg), pPg->pgno, 3);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
off_t fileSize;
|
i64 fileSize;
|
||||||
if( sqlite3OsFileSize(&pPager->fd,&fileSize)!=SQLITE_OK
|
if( sqlite3OsFileSize(&pPager->fd,&fileSize)!=SQLITE_OK
|
||||||
|| fileSize>=pgno*pPager->pageSize ){
|
|| fileSize>=pgno*pPager->pageSize ){
|
||||||
sqlite3pager_unref(PGHDR_TO_DATA(pPg));
|
sqlite3pager_unref(PGHDR_TO_DATA(pPg));
|
||||||
|
@@ -11,11 +11,34 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** Internal interface definitions for SQLite.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqliteInt.h,v 1.324 2004/09/25 14:39:19 drh Exp $
|
** @(#) $Id: sqliteInt.h,v 1.325 2004/10/01 02:00:31 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITEINT_H_
|
#ifndef _SQLITEINT_H_
|
||||||
#define _SQLITEINT_H_
|
#define _SQLITEINT_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
** These #defines should enable >2GB file support on Posix if the
|
||||||
|
** underlying operating system supports it. If the OS lacks
|
||||||
|
** large file support, or if the OS is windows, these should be no-ops.
|
||||||
|
**
|
||||||
|
** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
|
||||||
|
** on the compiler command line. This is necessary if you are compiling
|
||||||
|
** on a recent machine (ex: RedHat 7.2) but you want your code to work
|
||||||
|
** on an older machine (ex: RedHat 6.0). If you compile on RedHat 7.2
|
||||||
|
** without this option, LFS is enable. But LFS does not exist in the kernel
|
||||||
|
** in RedHat 6.0, so the code won't work. Hence, for maximum binary
|
||||||
|
** portability you should omit LFS.
|
||||||
|
**
|
||||||
|
** Similar is true for MacOS. LFS is only supported on MacOS 9 and later.
|
||||||
|
*/
|
||||||
|
#ifndef SQLITE_DISABLE_LFS
|
||||||
|
# define _LARGE_FILE 1
|
||||||
|
# ifndef _FILE_OFFSET_BITS
|
||||||
|
# define _FILE_OFFSET_BITS 64
|
||||||
|
# endif
|
||||||
|
# define _LARGEFILE_SOURCE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sqlite3.h"
|
#include "sqlite3.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
@@ -13,10 +13,10 @@
|
|||||||
** is not included in the SQLite library. It is used for automated
|
** is not included in the SQLite library. It is used for automated
|
||||||
** testing of the SQLite library.
|
** testing of the SQLite library.
|
||||||
**
|
**
|
||||||
** $Id: test2.c,v 1.25 2004/09/08 20:13:06 drh Exp $
|
** $Id: test2.c,v 1.26 2004/10/01 02:00:31 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "os.h"
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
#include "os.h"
|
||||||
#include "pager.h"
|
#include "pager.h"
|
||||||
#include "tcl.h"
|
#include "tcl.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -497,7 +497,7 @@ static int fake_big_file(
|
|||||||
){
|
){
|
||||||
int rc;
|
int rc;
|
||||||
int n;
|
int n;
|
||||||
off_t offset;
|
i64 offset;
|
||||||
OsFile fd;
|
OsFile fd;
|
||||||
int readOnly = 0;
|
int readOnly = 0;
|
||||||
if( argc!=3 ){
|
if( argc!=3 ){
|
||||||
|
Reference in New Issue
Block a user