AsyncFileData *p = ((AsyncFile *)pFile)->pData;
int rc = SQLITE_OK;
sqlite3_int64 filesize;
- int nRead;
sqlite3_file *pBase = p->pBaseRead;
+ sqlite3_int64 iAmt64 = (sqlite3_int64)iAmt;
/* Grab the write queue mutex for the duration of the call */
async_mutex_enter(ASYNC_MUTEX_QUEUE);
}
if( pBase->pMethods ){
+ sqlite3_int64 nRead;
rc = pBase->pMethods->xFileSize(pBase, &filesize);
if( rc!=SQLITE_OK ){
goto asyncread_out;
}
- nRead = (int)MIN(filesize - iOffset, iAmt);
+ nRead = MIN(filesize - iOffset, iAmt64);
if( nRead>0 ){
rc = pBase->pMethods->xRead(pBase, zOut, nRead, iOffset);
ASYNC_TRACE(("READ %s %d bytes at %d\n", p->zName, nRead, iOffset));
(pWrite->pFileData==p) ||
(zName && pWrite->pFileData->zName==zName)
)){
+ sqlite3_int64 nCopy;
+ sqlite3_int64 nByte64 = (sqlite3_int64)pWrite->nByte;
+
+ /* Set variable iBeginIn to the offset in buffer pWrite->zBuf[] from
+ ** which data should be copied. Set iBeginOut to the offset within
+ ** the output buffer to which data should be copied. If either of
+ ** these offsets is a negative number, set them to 0.
+ */
sqlite3_int64 iBeginOut = (pWrite->iOffset-iOffset);
sqlite3_int64 iBeginIn = -iBeginOut;
- int nCopy;
-
if( iBeginIn<0 ) iBeginIn = 0;
if( iBeginOut<0 ) iBeginOut = 0;
- nCopy = (int)MIN(pWrite->nByte-iBeginIn, iAmt-iBeginOut);
+ nCopy = MIN(nByte64-iBeginIn, iAmt64-iBeginOut);
if( nCopy>0 ){
memcpy(&((char *)zOut)[iBeginOut], &pWrite->zBuf[iBeginIn], nCopy);
ASYNC_TRACE(("OVERREAD %d bytes at %d\n", nCopy, iBeginOut+iOffset));
-C Fix\sa\sproblem\sin\sthe\sicu.test\sscript.
-D 2009-10-17T14:19:30
+C Use\s64-bit\sarithmetic\sin\sthe\sxRead()\smethod\sof\sasyncRead.\sFix\sfor\s[94c04eaadb].
+D 2009-10-19T07:50:26
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 4ca3f1dd6efa2075bcb27f4dc43eef749877740d
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538
F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1
F ext/async/README.txt 0c541f418b14b415212264cbaaf51c924ec62e5b
-F ext/async/sqlite3async.c ec97d85cdb56dda9312cce39dd3cd9d62a747ec6
+F ext/async/sqlite3async.c 3d5396cd69851f5633ef29c7491ca9249eac903a
F ext/async/sqlite3async.h a21e1252deb14a2c211f0e165c4b9122a8f1f344
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
F test/tkt-2ea2425d34.test 1cf13e6f75d149b3209a0cb32927a82d3d79fb28
F test/tkt-4a03edc4c8.test 2865e4edbc075b954daa82f8da7cc973033ec76e
F test/tkt-5ee23731f.test 3581260f2a71e51db94e1506ba6b0f7311d002a9
+F test/tkt-94c04eaadb.test 40e6b1fce420fbecf8c2379d3ec3cb6889e49091
F test/tkt-f777251dc7a.test 6f24c053bc5cdb7e1e19be9a72c8887cf41d5e87
F test/tkt1435.test f8c52c41de6e5ca02f1845f3a46e18e25cadac00
F test/tkt1443.test bacc311da5c96a227bf8c167e77a30c99f8e8368
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f x
-P e74f8dc436213b7ef754adcab5ef7554d774474c
-R 526f4f2594b313400514824834c58d50
+P 8a21fdaf6a89f74b040ea0c6bb996ac1c6fcd369
+R aa642d0be1b406a438b276a4ecef679d
U dan
-Z 506ccf08e87e0a1ee5dc78641f8ad030
+Z 90329c1ce6ebc56353157655ea929310
-8a21fdaf6a89f74b040ea0c6bb996ac1c6fcd369
\ No newline at end of file
+ca3e41b0574cfd8d971c2be2114e58273a531970
\ No newline at end of file
--- /dev/null
+# 2009 October 19
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+if {[info commands sqlite3async_initialize] eq ""} {
+ # The async logic is not built into this system
+ finish_test
+ return
+}
+
+# Create a database.
+do_test tkt-94c94-1.1 {
+ execsql { CREATE TABLE t1(a, b) }
+} {}
+
+# Grow the file to larger than 4096MB (2^32 bytes)
+db close
+if {[catch {fake_big_file 4096 [pwd]/test.db} msg]} {
+ puts "**** Unable to create a file larger than 4096 MB. *****"
+ finish_test
+ return
+}
+
+# Switch to async mode.
+sqlite3async_initialize "" 1
+sqlite3 db test.db
+sqlite3 db2 test.db
+
+# Read from and write to the db just past the 4096MB mark.
+#
+do_test tkt-94c94-2.1 {
+ execsql { CREATE TABLE t2(x, y) } db
+} {}
+do_test tkt-94c94-2.2 {
+breakpoint
+ execsql { INSERT INTO t2 VALUES(1, 2) } db2
+} {}
+do_test tkt-94c94-2.3 {
+ execsql { SELECT * FROM t2 } db
+} {1 2}
+do_test tkt-94c94-2.4 {
+ sqlite3async_control halt idle
+ sqlite3async_start
+ sqlite3async_wait
+} {}
+do_test tkt-94c94-2.5 {
+ execsql { SELECT * FROM t2 } db
+} {1 2}
+do_test tkt-94c94-2.6 {
+ sqlite3async_start
+ sqlite3async_wait
+} {}
+
+db close
+db2 close
+sqlite3async_start
+sqlite3async_wait
+sqlite3async_shutdown
+
+finish_test