Skip to content

Commit 1ba0e0e

Browse files
Adjust db_index search count and rename codec_pragma
1 parent 20a92ab commit 1ba0e0e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/crypto.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static int codec_set_pass_key(sqlite3* db, int nDb, const void *zKey, int nKey,
7878
return SQLITE_ERROR;
7979
}
8080

81-
int codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLeft, const char *zRight) {
81+
int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLeft, const char *zRight) {
8282
struct Db *pDb = &db->aDb[iDb];
8383
codec_ctx *ctx = NULL;
8484
int rc;
@@ -87,8 +87,8 @@ int codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLeft, const c
8787
sqlite3pager_get_codec(pDb->pBt->pBt->pPager, (void **) &ctx);
8888
}
8989

90-
CODEC_TRACE(("codec_pragma: entered db=%p iDb=%d pParse=%p zLeft=%s zRight=%s ctx=%p\n", db, iDb, pParse, zLeft, zRight, ctx));
91-
90+
CODEC_TRACE(("sqlcipher_codec_pragma: entered db=%p iDb=%d pParse=%p zLeft=%s zRight=%s ctx=%p\n", db, iDb, pParse, zLeft, zRight, ctx));
91+
9292
if( sqlite3StrICmp(zLeft, "cipher_migrate")==0 && !zRight ){
9393
if(ctx){
9494
char *migrate_status = sqlite3_mprintf("%d", sqlcipher_codec_ctx_migrate(ctx));
@@ -341,12 +341,12 @@ void sqlite3_activate_see(const char* in) {
341341
/* do nothing, security enhancements are always active */
342342
}
343343

344-
int sqlcipher_find_db_index(sqlite3 *db, const char *zDb) {
344+
static int sqlcipher_find_db_index(sqlite3 *db, const char *zDb) {
345345
if(zDb == NULL){
346346
return 0;
347347
}
348348
int db_index;
349-
for(db_index = 0; db_index < db->nDb - 1; db_index++) {
349+
for(db_index = 0; db_index < db->nDb; db_index++) {
350350
struct Db *pDb = &db->aDb[db_index];
351351
if(strcmp(pDb->zName, zDb) == 0) {
352352
return db_index;

src/pragma.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ void sqlite3Pragma(
356356
Vdbe *v = sqlite3GetVdbe(pParse); /* Prepared statement */
357357
/* BEGIN SQLCIPHER */
358358
#ifdef SQLITE_HAS_CODEC
359-
extern int codec_pragma(sqlite3*, int, Parse *, const char *, const char *);
359+
extern int sqlcipher_codec_pragma(sqlite3*, int, Parse *, const char *, const char *);
360360
#endif
361361
/* END SQLCIPHER */
362362

@@ -422,8 +422,8 @@ void sqlite3Pragma(
422422

423423
/* BEGIN SQLCIPHER */
424424
#ifdef SQLITE_HAS_CODEC
425-
if(codec_pragma(db, iDb, pParse, zLeft, zRight)) {
426-
/* codec_pragma executes internal */
425+
if(sqlcipher_codec_pragma(db, iDb, pParse, zLeft, zRight)) {
426+
/* sqlcipher_codec_pragma executes internal */
427427
}else
428428
#endif
429429
/* END SQLCIPHER */

0 commit comments

Comments
 (0)