From 9249f54531664424b03ac55e6120451c478d481c Mon Sep 17 00:00:00 2001 From: Stephen Lombardo Date: Tue, 23 Oct 2018 09:08:30 -0400 Subject: [PATCH] correct warnings for UAP builds --- src/crypto.c | 8 ++++---- src/crypto_impl.c | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/crypto.c b/src/crypto.c index 15e9afe..5f89be7 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -336,7 +336,7 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef if( sqlite3StrICmp(zLeft,"cipher_hmac_algorithm")==0 ){ if(ctx) { if(zRight) { - int rc = SQLITE_ERROR; + rc = SQLITE_ERROR; if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA1_LABEL) == 0) { rc = sqlcipher_codec_ctx_set_hmac_algorithm(ctx, SQLCIPHER_HMAC_SHA1); } else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA256_LABEL) == 0) { @@ -361,7 +361,7 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef }else if( sqlite3StrICmp(zLeft,"cipher_default_hmac_algorithm")==0 ){ if(zRight) { - int rc = SQLITE_ERROR; + rc = SQLITE_ERROR; if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA1_LABEL) == 0) { rc = sqlcipher_set_default_hmac_algorithm(SQLCIPHER_HMAC_SHA1); } else if(sqlite3StrICmp(zRight, SQLCIPHER_HMAC_SHA256_LABEL) == 0) { @@ -384,7 +384,7 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef if( sqlite3StrICmp(zLeft,"cipher_kdf_algorithm")==0 ){ if(ctx) { if(zRight) { - int rc = SQLITE_ERROR; + rc = SQLITE_ERROR; if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL) == 0) { rc = sqlcipher_codec_ctx_set_kdf_algorithm(ctx, SQLCIPHER_PBKDF2_HMAC_SHA1); } else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL) == 0) { @@ -407,7 +407,7 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef }else if( sqlite3StrICmp(zLeft,"cipher_default_kdf_algorithm")==0 ){ if(zRight) { - int rc = SQLITE_ERROR; + rc = SQLITE_ERROR; if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA1_LABEL) == 0) { rc = sqlcipher_set_default_kdf_algorithm(SQLCIPHER_PBKDF2_HMAC_SHA1); } else if(sqlite3StrICmp(zRight, SQLCIPHER_PBKDF2_HMAC_SHA256_LABEL) == 0) { diff --git a/src/crypto_impl.c b/src/crypto_impl.c index 3b8475c..8b80cd8 100644 --- a/src/crypto_impl.c +++ b/src/crypto_impl.c @@ -301,8 +301,8 @@ int sqlcipher_memcmp(const void *v0, const void *v1, int len) { void sqlcipher_mlock(void *ptr, int sz) { #ifndef OMIT_MEMLOCK - int rc; #if defined(__unix__) || defined(__APPLE__) + int rc; unsigned long pagesize = sysconf(_SC_PAGESIZE); unsigned long offset = (unsigned long) ptr % pagesize; @@ -315,6 +315,7 @@ void sqlcipher_mlock(void *ptr, int sz) { } #elif defined(_WIN32) #if !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP || WINAPI_FAMILY == WINAPI_FAMILY_APP)) + int rc; CODEC_TRACE("sqlcipher_mem_lock: calling VirtualLock(%p,%d)\n", ptr, sz); rc = VirtualLock(ptr, sz); if(rc==0) { @@ -327,8 +328,8 @@ void sqlcipher_mlock(void *ptr, int sz) { void sqlcipher_munlock(void *ptr, int sz) { #ifndef OMIT_MEMLOCK - int rc; #if defined(__unix__) || defined(__APPLE__) + int rc; unsigned long pagesize = sysconf(_SC_PAGESIZE); unsigned long offset = (unsigned long) ptr % pagesize; @@ -341,6 +342,7 @@ void sqlcipher_munlock(void *ptr, int sz) { } #elif defined(_WIN32) #if !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP || WINAPI_FAMILY == WINAPI_FAMILY_APP)) + int rc; CODEC_TRACE("sqlcipher_mem_lock: calling VirtualUnlock(%p,%d)\n", ptr, sz); rc = VirtualUnlock(ptr, sz); if(!rc) {