1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-03 08:01:19 +03:00

Fix a bug in jrnlTruncate(). And other coverage improvements. (CVS 4367)

FossilOrigin-Name: 02b751fb9dbc683b1b77a2ed3cdeb4190f7339e0
This commit is contained in:
danielk1977
2007-09-01 18:24:55 +00:00
parent 4ff7fa0d67
commit 880c15beb9
11 changed files with 100 additions and 44 deletions

View File

@@ -10,7 +10,7 @@
**
*************************************************************************
**
** @(#) $Id: journal.c,v 1.4 2007/08/31 18:34:59 drh Exp $
** @(#) $Id: journal.c,v 1.5 2007/09/01 18:24:55 danielk1977 Exp $
*/
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
@@ -93,13 +93,8 @@ static int jrnlRead(
if( p->pReal ){
rc = sqlite3OsRead(p->pReal, zBuf, iAmt, iOfst);
}else{
int n = iAmt;
memset(zBuf, 0, n);
if( n+iOfst>p->iSize ){
rc = SQLITE_IOERR_SHORT_READ;
}else{
memcpy(zBuf, &p->zBuf[iOfst], n);
}
assert( n+iOfst<=p->iSize );
memcpy(zBuf, &p->zBuf[iOfst], iAmt);
}
return rc;
}
@@ -139,7 +134,7 @@ static int jrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){
JournalFile *p = (JournalFile *)pJfd;
if( p->pReal ){
rc = sqlite3OsTruncate(p->pReal, size);
}else if( size>p->iSize ){
}else if( size<p->iSize ){
p->iSize = size;
}
return rc;