summaryrefslogtreecommitdiff
path: root/src/test6.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2013-08-13 15:43:01 -0400
committerHans-Christoph Steiner <hans@eds.org>2013-08-13 15:43:01 -0400
commit4228998fd796fa2f9e84fb73632e0a07cc7cd188 (patch)
tree15b2336f351468fedd0c39e9de4ad905a686f3b0 /src/test6.c
parentbdee7cf7d974b2f70d5934786c5666006e7360be (diff)
parent08119c361d1181b3e8f1abb429236e488a664753 (diff)
Merge tag 'upstream/2.2.1'
Upstream version 2.2.1 # gpg: Signature made Tue 13 Aug 2013 03:42:56 PM EDT using RSA key ID 374BBE81 # gpg: Good signature from "Hans-Christoph Steiner <hans@at.or.at>" # gpg: aka "[jpeg image of size 5408]" # gpg: aka "Hans-Christoph Steiner <hs420@nyu.edu>" # gpg: aka "Hans-Christoph Steiner <hans@eds.org>" # gpg: aka "Hans-Christoph Steiner <hans@guardianproject.info>" # gpg: aka "Hans-Christoph Steiner <hansi@nyu.edu>" # gpg: aka "Hans-Christoph Steiner <hans@guardianproject.info>"
Diffstat (limited to 'src/test6.c')
-rw-r--r--src/test6.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/test6.c b/src/test6.c
index bae6b65..c151ea4 100644
--- a/src/test6.c
+++ b/src/test6.c
@@ -87,7 +87,7 @@ typedef struct WriteBuffer WriteBuffer;
** an aligned write() of an integer number of 512 byte regions, then
** option (3) above is never selected. Instead, each 512 byte region
** is either correctly written or left completely untouched. Similar
-** logic governs the behaviour if any of the other ATOMICXXX flags
+** logic governs the behavior if any of the other ATOMICXXX flags
** is set.
**
** If either the IOCAP_SAFEAPPEND or IOCAP_SEQUENTIAL flags are set
@@ -312,8 +312,8 @@ static int writeListSync(CrashFile *pFile, int isCrash){
assert(pWrite->zBuf);
#ifdef TRACE_CRASHTEST
- printf("Trashing %d sectors @ sector %d (%s)\n",
- 1+iLast-iFirst, iFirst, pWrite->pFile->zName
+ printf("Trashing %d sectors @ %lld (sector %d) (%s)\n",
+ 1+iLast-iFirst, pWrite->iOffset, iFirst, pWrite->pFile->zName
);
#endif
@@ -628,18 +628,19 @@ static int cfOpen(
** to read data from the 512-byte locking region of a file opened
** with the SQLITE_OPEN_MAIN_DB flag. This region of a database file
** never contains valid data anyhow. So avoid doing such a read here.
+ **
+ ** UPDATE: It also contains an assert() verifying that each call
+ ** to the xRead() method reads less than 128KB of data.
*/
const int isDb = (flags&SQLITE_OPEN_MAIN_DB);
- i64 iChunk = pWrapper->iSize;
- if( iChunk>PENDING_BYTE && isDb ){
- iChunk = PENDING_BYTE;
- }
+ i64 iOff;
+
memset(pWrapper->zData, 0, pWrapper->nData);
- rc = sqlite3OsRead(pReal, pWrapper->zData, (int)iChunk, 0);
- if( SQLITE_OK==rc && pWrapper->iSize>(PENDING_BYTE+512) && isDb ){
- i64 iOff = PENDING_BYTE+512;
- iChunk = pWrapper->iSize - iOff;
- rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], (int)iChunk, iOff);
+ for(iOff=0; iOff<pWrapper->iSize; iOff += 512){
+ int nRead = pWrapper->iSize - (int)iOff;
+ if( nRead>512 ) nRead = 512;
+ if( isDb && iOff==PENDING_BYTE ) continue;
+ rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], nRead, iOff);
}
}else{
rc = SQLITE_NOMEM;