1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +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

@@ -14,7 +14,7 @@
** systems that do not need this facility may omit it by recompiling
** the library with -DSQLITE_OMIT_AUTHORIZATION=1
**
** $Id: auth.c,v 1.27 2007/08/21 19:33:56 drh Exp $
** $Id: auth.c,v 1.28 2007/09/01 18:24:55 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -109,7 +109,7 @@ void sqlite3AuthRead(
){
sqlite3 *db = pParse->db;
int rc;
Table *pTab; /* The table being read */
Table *pTab = 0; /* The table being read */
const char *zCol; /* Name of the column of the table */
int iSrc; /* Index in pTabList->a[] of table being read */
const char *zDBase; /* Name of database being accessed */
@@ -135,8 +135,6 @@ void sqlite3AuthRead(
*/
assert( pExpr->iTable==pStack->newIdx || pExpr->iTable==pStack->oldIdx );
pTab = pStack->pTab;
}else{
return;
}
if( pTab==0 ) return;
if( pExpr->iColumn>=0 ){

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.311 2007/08/31 17:42:48 danielk1977 Exp $
** $Id: expr.c,v 1.312 2007/09/01 18:24:55 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -318,11 +318,7 @@ Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){
}else if( pRight==0 ){
return pLeft;
}else{
Expr *p = sqlite3Expr(db, TK_AND, pLeft, pRight, 0);
if( p==0 ){
db->mallocFailed = 1;
}
return p;
return sqlite3Expr(db, TK_AND, pLeft, pRight, 0);
}
}

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;