diff --git a/src/aes_hardware.c b/src/aes_hardware.c index 2787712..9a45b9f 100644 --- a/src/aes_hardware.c +++ b/src/aes_hardware.c @@ -198,7 +198,7 @@ aesGenKeyEncrypt(const unsigned char* userKey, const int bits, unsigned char* ke { int numberOfRounds = (bits == 128) ? 10 : (bits == 192) ? 12 : (bits == 256) ? 14 : 0; int rc = (!userKey || !keyData) ? -1 : (numberOfRounds > 0) ? 0 : -2; - + if (rc == 0) { __m128i tempKey[_MAX_ROUNDS + 1]; @@ -347,7 +347,7 @@ aesDecryptCBC(const unsigned char* in, int offset; --numBlocks; offset = numBlocks * 16; - + /* Decrypt the last plain block. */ last_in = _mm_loadu_si128(&((__m128i*) in)[numBlocks]); data = _mm_xor_si128(last_in, key[numberOfRounds - 0]); @@ -477,7 +477,7 @@ aesGenKeyEncryptInternal(const unsigned char* userKey, const int bits, uint8x16_ int i; int j; int numberOfRounds = (bits == 128) ? 10 : (bits == 192) ? 12 : (bits == 256) ? 14 : 0; - int keyWords = bits / 32; + int keyWords = bits / 32; int schedWords = (numberOfRounds + 1) * 4; /* @@ -538,7 +538,7 @@ aesGenKeyEncrypt(const unsigned char* userKey, const int bits, unsigned char* ke { int numberOfRounds = (bits == 128) ? 10 : (bits == 192) ? 12 : (bits == 256) ? 14 : 0; int rc = (!userKey || !keyData) ? -1 : (numberOfRounds > 0) ? 0 : -2; - + if (rc == 0) { uint8x16_t tempKey[_MAX_ROUNDS + 1]; @@ -648,7 +648,7 @@ aesEncryptCBC(const unsigned char* in, } feedback = vaeseq_u8(feedback, key[numberOfRounds-1]); feedback = veorq_u8(feedback, key[numberOfRounds]); \ - + vst1q_u8(&out[(numBlocks-1)*16], feedback); memcpy(&out[numBlocks*16], lastblock, lenFrag); @@ -689,7 +689,7 @@ aesDecryptCBC(const unsigned char* in, int offset; --numBlocks; offset = numBlocks * 16; - + /* Decrypt the last plain block. */ last_in = vld1q_u8(&in[numBlocks*16]); diff --git a/src/ascon/pbkdf2.c b/src/ascon/pbkdf2.c index 8db33c9..010096d 100644 --- a/src/ascon/pbkdf2.c +++ b/src/ascon/pbkdf2.c @@ -73,7 +73,7 @@ static void ascon_pbkdf2_f(ascon_state_t* state, memset(temp, 0, ASCON_SALT_LEN); memcpy(temp, salt, asconSaltLen); STORE32_BE(temp+ASCON_SALT_LEN, blocknum); - + /* Copy initial state */ for (j = 0; j < 5; ++j) state2.x[j] = state->x[j]; diff --git a/src/ascon/prolog.h b/src/ascon/prolog.h index 4e65e45..5efe9ba 100644 --- a/src/ascon/prolog.h +++ b/src/ascon/prolog.h @@ -1,6 +1,6 @@ /* ** Name: prolog.h -** Purpose: Include important header files, before +** Purpose: Include important header files, before ** Based on: Public domain Ascon reference implementation ** and optimized variants for 32- and 64-bit ** (see https://github.com/ascon/ascon-c) diff --git a/src/chacha20poly1305.c b/src/chacha20poly1305.c index 57a9693..9c8238f 100644 --- a/src/chacha20poly1305.c +++ b/src/chacha20poly1305.c @@ -286,7 +286,7 @@ static size_t entropy(void* buf, size_t n) } #else - + #include #define RtlGenRandom SystemFunction036 BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength); diff --git a/src/cipher_common.c b/src/cipher_common.c index 6e4eed9..8da412a 100644 --- a/src/cipher_common.c +++ b/src/cipher_common.c @@ -610,7 +610,7 @@ sqlite3mcConfigureSQLCipherVersion(sqlite3* db, int configDefault, int legacyVer static char* defNames[] = { "default:legacy_page_size", "default:kdf_iter", "default:hmac_use", "default:kdf_algorithm", "default:hmac_algorithm", NULL }; static int versionParams[SQLCIPHER_VERSION_MAX][5] = { - { 1024, 4000, 0, SQLCIPHER_KDF_ALGORITHM_SHA1, SQLCIPHER_HMAC_ALGORITHM_SHA1 }, + { 1024, 4000, 0, SQLCIPHER_KDF_ALGORITHM_SHA1, SQLCIPHER_HMAC_ALGORITHM_SHA1 }, { 1024, 4000, 1, SQLCIPHER_KDF_ALGORITHM_SHA1, SQLCIPHER_HMAC_ALGORITHM_SHA1 }, { 1024, 64000, 1, SQLCIPHER_KDF_ALGORITHM_SHA1, SQLCIPHER_HMAC_ALGORITHM_SHA1 }, { 4096, 256000, 1, SQLCIPHER_KDF_ALGORITHM_SHA512, SQLCIPHER_HMAC_ALGORITHM_SHA512 } diff --git a/src/codec_algos.c b/src/codec_algos.c index 12cf69b..5b17107 100644 --- a/src/codec_algos.c +++ b/src/codec_algos.c @@ -131,7 +131,7 @@ sqlite3mcAES128(Rijndael* aesCtx, int page, int encrypt, unsigned char encryptio { len = RijndaelBlockDecrypt(aesCtx, datain, datalen*8, dataout); } - + /* It is a good idea to check the error code */ if (len < 0) { @@ -185,7 +185,7 @@ sqlite3mcAES256(Rijndael* aesCtx, int page, int encrypt, unsigned char encryptio { len = RijndaelBlockDecrypt(aesCtx, datain, datalen*8, dataout); } - + /* It is a good idea to check the error code */ if (len < 0) { diff --git a/src/codecext.c b/src/codecext.c index ddc8450..005886d 100644 --- a/src/codecext.c +++ b/src/codecext.c @@ -59,7 +59,7 @@ sqlite3_activate_see(const char *info) /* ** Free the encryption data structure associated with a pager instance. -** (called from the modified code in pager.c) +** (called from the modified code in pager.c) */ SQLITE_PRIVATE void sqlite3mcCodecFree(void *pCodecArg) @@ -411,7 +411,7 @@ sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey) sqlite3ErrorWithMsg(db, rc, "Rekeying is not supported in WAL journal mode."); return rc; } - + if ((zKey == NULL || nKey == 0) && (codec == NULL || !sqlite3mcIsEncrypted(codec))) { /* Database not encrypted and key not specified, therefore do nothing */ diff --git a/src/compress.c b/src/compress.c index e6534e8..302fc7c 100644 --- a/src/compress.c +++ b/src/compress.c @@ -112,14 +112,14 @@ static void uncompressFunc( __declspec(dllexport) #endif int sqlite3_compress_init( - sqlite3 *db, - char **pzErrMsg, + sqlite3 *db, + char **pzErrMsg, const sqlite3_api_routines *pApi ){ int rc = SQLITE_OK; SQLITE_EXTENSION_INIT2(pApi); (void)pzErrMsg; /* Unused parameter */ - rc = sqlite3_create_function(db, "compress", 1, + rc = sqlite3_create_function(db, "compress", 1, SQLITE_UTF8 | SQLITE_INNOCUOUS, 0, compressFunc, 0, 0); if( rc==SQLITE_OK ){ diff --git a/src/extensionfunctions.c b/src/extensionfunctions.c index 5dcaa10..de1e704 100644 --- a/src/extensionfunctions.c +++ b/src/extensionfunctions.c @@ -54,7 +54,7 @@ Usage instructions for the sqlite3 program: security measure; see "Security Considerations" in http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions. If the sqlite3 program and library are built this - way, you cannot use these functions from the program, you + way, you cannot use these functions from the program, you must write your own program using the sqlite3 API, and call sqlite3_enable_load_extension as described above, or else rebuilt the sqlite3 program to allow loadable extensions. @@ -319,7 +319,7 @@ static int sqlite3ReadUtf8(const unsigned char *z){ ** pZ is a UTF-8 encoded unicode string. If nByte is less than zero, ** return the number of unicode characters in pZ up to (but not including) ** the first 0x00 byte. If nByte is not less than zero, return the -** number of unicode characters in the first nByte of pZ (or up to +** number of unicode characters in the first nByte of pZ (or up to ** the first 0x00, whichever comes first). */ static int sqlite3Utf8CharLen(const char *z, int nByte){ @@ -354,7 +354,7 @@ static int sqlite3Utf8CharLen(const char *z, int nByte){ ** ** Could have been implemented using pointers to functions but this way it's inline ** and thus more efficient. Lower * ranking though... -** +** ** Parameters: ** name: function name to de defined (eg: sinFunc) ** function: function defined in math.h to wrap (eg: sin) @@ -400,7 +400,7 @@ GEN_MATH_WRAP_DOUBLE_1(atanFunc, atan) /* ** Many of systems don't have inverse hyperbolic trig functions so this will emulate -** them on those systems in terms of log and sqrt (formulas are too trivial to demand +** them on those systems in terms of log and sqrt (formulas are too trivial to demand ** written proof here) */ @@ -572,7 +572,7 @@ static void squareFunc(sqlite3_context *context, int argc, sqlite3_value **argv) ** (see sqrt just before this). Here the result is always double */ /* LMH 2007-03-25 Changed to use errno; no pre-checking for errors. Also removes - but that was present in the pre-checking that called sqlite3_result_error on + but that was present in the pre-checking that called sqlite3_result_error on a non-positive first argument, which is not always an error. */ static void powerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ double r1 = 0.0; @@ -580,9 +580,9 @@ static void powerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ double val; assert( argc==2 ); - + if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){ - sqlite3_result_null(context); + sqlite3_result_null(context); }else{ r1 = sqlite3_value_double(argv[0]); r2 = sqlite3_value_double(argv[1]); @@ -590,9 +590,9 @@ static void powerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ val = pow(r1,r2); if (errno == 0) { sqlite3_result_double(context, val); - } else { + } else { sqlite3_result_error(context, strerror(errno), errno); - } + } } } @@ -606,9 +606,9 @@ static void atn2Func(sqlite3_context *context, int argc, sqlite3_value **argv){ double r2 = 0.0; assert( argc==2 ); - + if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){ - sqlite3_result_null(context); + sqlite3_result_null(context); }else{ r1 = sqlite3_value_double(argv[0]); r2 = sqlite3_value_double(argv[1]); @@ -705,14 +705,14 @@ static void floorFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ #endif /* SQLITE_ENABLE_MATH_FUNCTIONS */ /* -** Given a string (s) in the first argument and an integer (n) in the second returns the +** Given a string (s) in the first argument and an integer (n) in the second returns the ** string that constains s contatenated n times */ static void replicateFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ unsigned char *z; /* input string */ unsigned char *zo; /* result string */ i64 iCount; /* times to repeat */ - i64 nLen; /* length of the input string (no multibyte considerations) */ + i64 nLen; /* length of the input string (no multibyte considerations) */ i64 nTLen; /* length of the result string (no multibyte considerations) */ i64 i=0; @@ -747,7 +747,7 @@ static void replicateFunc(sqlite3_context *context, int argc, sqlite3_value **ar } } -/* +/* ** Some systems (win32 among others) don't have an isblank function, this will emulate it. ** This function is not UFT-8 safe since it only analyses a byte character. */ @@ -812,9 +812,9 @@ static void padlFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ char *zt; assert( argc==2 ); - + if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){ - sqlite3_result_null(context); + sqlite3_result_null(context); }else{ zi = (char *)sqlite3_value_text(argv[0]); ilen = sqlite3_value_int64(argv[1]); @@ -866,9 +866,9 @@ static void padrFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ char *zt; assert( argc==2 ); - + if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){ - sqlite3_result_null(context); + sqlite3_result_null(context); }else{ zi = (char *)sqlite3_value_text(argv[0]); ilen = sqlite3_value_int64(argv[1]); @@ -921,9 +921,9 @@ static void padcFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ char *zt; assert( argc==2 ); - + if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){ - sqlite3_result_null(context); + sqlite3_result_null(context); }else{ zi = (char *)sqlite3_value_text(argv[0]); ilen = sqlite3_value_int64(argv[1]); @@ -980,17 +980,17 @@ static void strfilterFunc(sqlite3_context *context, int argc, sqlite3_value **ar int c2 = 0; assert( argc==2 ); - + if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){ - sqlite3_result_null(context); + sqlite3_result_null(context); }else{ zi1 = (char *)sqlite3_value_text(argv[0]); zi2 = (char *)sqlite3_value_text(argv[1]); - /* - ** maybe I could allocate less, but that would imply 2 passes, rather waste + /* + ** maybe I could allocate less, but that would imply 2 passes, rather waste ** (possibly) some memory */ - zo = sqlite3_malloc((int) (strlen(zi1)+1)); + zo = sqlite3_malloc((int) (strlen(zi1)+1)); if (!zo){ sqlite3_result_error_nomem(context); return; @@ -1034,11 +1034,11 @@ static int _substr(const char* z1, const char* z2, int s, const char** p){ if( '\0'==*z1 ){ return -1; } - + while( (sqliteCharVal((unsigned char *)z2) != 0) && (c++) 0 ){ sqliteNextChar(zt); } @@ -1186,7 +1186,7 @@ static void rightFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ return; } strcpy((char*) rz, (char*) (zt)); - sqlite3_result_text(context, (char*)rz, -1, SQLITE_TRANSIENT); + sqlite3_result_text(context, (char*)rz, -1, SQLITE_TRANSIENT); sqlite3_free(rz); } @@ -1224,7 +1224,7 @@ static void ltrimFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ return; } z = sqlite3_value_text(argv[0]); - sqlite3_result_text(context, ltrim(z), -1, SQLITE_TRANSIENT); + sqlite3_result_text(context, ltrim(z), -1, SQLITE_TRANSIENT); } /* @@ -1465,7 +1465,7 @@ static void modeStep(sqlite3_context *context, int argc, sqlite3_value **argv){ if( type == SQLITE_NULL) return; - + p = sqlite3_aggregate_context(context, sizeof(*p)); if( 0==(p->m) ){ @@ -1504,7 +1504,7 @@ static void modeIterate(void* e, i64 c, void* pp){ i64 ei; double ed; ModeCtx *p = (ModeCtx*)pp; - + if( 0==p->is_double ){ ei = *(int*)(e); @@ -1530,7 +1530,7 @@ static void modeIterate(void* e, i64 c, void* pp){ /* ** Auxiliary function that iterates all elements in a map and finds the median -** (the value such that the number of elements smaller is equal the the number of +** (the value such that the number of elements smaller is equal the the number of ** elements larger) */ static void medianIterate(void* e, i64 c, void* pp){ @@ -1723,12 +1723,12 @@ static void differenceFunc(sqlite3_context *context, int argc, sqlite3_value **a const u8 *zIn2; assert( argc==2 ); - + if( sqlite3_value_type(argv[0])==SQLITE_NULL || sqlite3_value_type(argv[1])==SQLITE_NULL ){ sqlite3_result_null(context); return; } - + zIn1 = (u8*)sqlite3_value_text(argv[0]); zIn2 = (u8*)sqlite3_value_text(argv[1]); @@ -1865,7 +1865,7 @@ int RegisterExtensionFunctions(sqlite3 *db){ aFuncs[i].eTextRep, pArg, aFuncs[i].xFunc, 0, 0); #if 0 if( aFuncs[i].needCollSeq ){ - struct FuncDef *pFunc = sqlite3FindFunction(db, aFuncs[i].zName, + struct FuncDef *pFunc = sqlite3FindFunction(db, aFuncs[i].zName, strlen(aFuncs[i].zName), aFuncs[i].nArg, aFuncs[i].eTextRep, 0); if( pFunc && aFuncs[i].needCollSeq ){ pFunc->needCollSeq = 1; @@ -1882,7 +1882,7 @@ int RegisterExtensionFunctions(sqlite3 *db){ } /* sqlite3CreateFunc */ /* LMH no error checking */ - sqlite3_create_function(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8, + sqlite3_create_function(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8, pArg, 0, aAggs[i].xStep, aAggs[i].xFinalize); #if 0 if( aAggs[i].needCollSeq ){ diff --git a/src/miniz.c b/src/miniz.c index 87bdedb..4949df4 100644 --- a/src/miniz.c +++ b/src/miniz.c @@ -6704,7 +6704,7 @@ mz_bool mz_zip_writer_add_read_buf_callback(mz_zip_archive *pZip, const char *pA if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, (mz_uint16)(extra_size + user_extra_data_len), - (max_size >= MZ_UINT32_MAX) ? MZ_UINT32_MAX : uncomp_size, + (max_size >= MZ_UINT32_MAX) ? MZ_UINT32_MAX : uncomp_size, (max_size >= MZ_UINT32_MAX) ? MZ_UINT32_MAX : comp_size, uncomp_crc32, method, gen_flags, dos_time, dos_date)) return mz_zip_set_error(pZip, MZ_ZIP_INTERNAL_ERROR); diff --git a/src/miniz.h b/src/miniz.h index 6cc398c..0e65e38 100644 --- a/src/miniz.h +++ b/src/miniz.h @@ -115,7 +115,7 @@ -/* Defines to completely disable specific portions of miniz.c: +/* Defines to completely disable specific portions of miniz.c: If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. */ /* Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. */ @@ -138,7 +138,7 @@ /* Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. */ /*#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES */ -/* Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc. +/* Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc. Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. */ @@ -908,7 +908,7 @@ struct tinfl_decompressor_tag #ifdef __cplusplus } #endif - + #pragma once diff --git a/src/mystdint.h b/src/mystdint.h index 3648a1f..a6beaf8 100644 --- a/src/mystdint.h +++ b/src/mystdint.h @@ -19,7 +19,7 @@ typedef unsigned long long uint64_t; #define UINT8_MAX 255 #define UINT16_MAX 65535 #define UINT32_MAX 0xffffffffU /* 4294967295U */ -#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ +#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ #else #include #endif diff --git a/src/rijndael.c b/src/rijndael.c index fccca80..de7ce7a 100644 --- a/src/rijndael.c +++ b/src/rijndael.c @@ -86,21 +86,21 @@ static UINT8 S[256]= { - 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, - 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, - 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, - 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, - 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, - 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, - 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, - 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, - 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, - 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, - 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, - 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, - 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, - 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, - 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, + 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, + 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, + 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, + 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, + 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, + 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, + 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, + 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, + 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, + 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, + 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, + 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, + 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, + 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, + 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22 }; @@ -171,7 +171,7 @@ static UINT8 T1[256][4]= {0x82,0x41,0x41,0xc3}, {0x29,0x99,0x99,0xb0}, {0x5a,0x2d,0x2d,0x77}, {0x1e,0x0f,0x0f,0x11}, {0x7b,0xb0,0xb0,0xcb}, {0xa8,0x54,0x54,0xfc}, {0x6d,0xbb,0xbb,0xd6}, {0x2c,0x16,0x16,0x3a} }; - + static UINT8 T2[256][4]= { {0xa5,0xc6,0x63,0x63}, {0x84,0xf8,0x7c,0x7c}, {0x99,0xee,0x77,0x77}, {0x8d,0xf6,0x7b,0x7b}, @@ -783,7 +783,7 @@ static UINT8 U1[256][4]= {0xa7,0x79,0xb4,0x92}, {0xa9,0x70,0xb9,0x99}, {0xbb,0x6b,0xae,0x84}, {0xb5,0x62,0xa3,0x8f}, {0x9f,0x5d,0x80,0xbe}, {0x91,0x54,0x8d,0xb5}, {0x83,0x4f,0x9a,0xa8}, {0x8d,0x46,0x97,0xa3} }; - + static UINT8 U2[256][4]= { {0x00,0x00,0x00,0x00}, {0x0b,0x0e,0x09,0x0d}, {0x16,0x1c,0x12,0x1a}, {0x1d,0x12,0x1b,0x17}, @@ -989,7 +989,7 @@ static UINT8 U4[256][4]= }; static UINT32 rcon[30]= -{ +{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, @@ -1092,7 +1092,7 @@ int RijndaelInit(Rijndael* rijndael, int mode, int dir, UINT8* key, int keyLen, #endif } } -#ifndef TEST_AES_HW +#ifndef TEST_AES_HW else #endif #endif @@ -1104,7 +1104,7 @@ int RijndaelInit(Rijndael* rijndael, int mode, int dir, UINT8* key, int keyLen, if (rijndael->m_direction == RIJNDAEL_Direction_Decrypt) RijndaelKeyEncToDec(rijndael); } -#ifdef TEST_AES_HW +#ifdef TEST_AES_HW { int cmpkeyexp = memcmp((unsigned char*) rijndael->m_expandedKey, aesKeySched, (rijndael->m_uRounds+1)*16); int datalen = (rijndael->m_uRounds + 1) * 16; @@ -1134,10 +1134,10 @@ int RijndaelBlockEncrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* numBlocks = inputLen/128; lenFrag = (inputLen % 128) / 8; - + switch (rijndael->m_mode) { - case RIJNDAEL_Direction_Mode_ECB: + case RIJNDAEL_Direction_Mode_ECB: for(i = numBlocks;i > 0;i--) { RijndaelEncrypt(rijndael, input, outBuffer); @@ -1149,7 +1149,7 @@ int RijndaelBlockEncrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* #if HAS_AES_HARDWARE if (aesHardwareAvailable()) { -#ifndef TEST_AES_HW +#ifndef TEST_AES_HW aesEncryptCBC(input, outBuffer, rijndael->m_initVector, inputLen/8, (unsigned char*) (rijndael->m_expandedKey), rijndael->m_uRounds); #else TEST_AES_HW_DEBUG_LOG("aes enc: hw enabled\n"); @@ -1195,8 +1195,8 @@ int RijndaelBlockEncrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* } break; case RIJNDAEL_Direction_Mode_CFB1: -#if STRICT_ALIGN - memcpy(iv,rijndael->m_initVector,16); +#if STRICT_ALIGN + memcpy(iv,rijndael->m_initVector,16); #else /* !STRICT_ALIGN */ *((UINT32*)iv[0]) = *((UINT32*)(rijndael->m_initVector )); *((UINT32*)iv[1]) = *((UINT32*)(rijndael->m_initVector + 4)); @@ -1240,7 +1240,7 @@ int RijndaelBlockEncrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* break; } -#ifdef TEST_AES_HW +#ifdef TEST_AES_HW { int cmpdata = memcmp((unsigned char*) outOrig, outBuffer2, inputLen/8); TEST_AES_HW_DEBUG_LOG("aes enc: cmp=%d\n", cmpdata); @@ -1248,7 +1248,7 @@ int RijndaelBlockEncrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* TEST_AES_HW_DEBUG_HEX("aes enc HW:", outBuffer2, 16); } #endif - + return 128 * numBlocks; } @@ -1266,7 +1266,7 @@ int RijndaelPadEncrypt(Rijndael* rijndael, UINT8 *input, int inputOctets, UINT8 switch (rijndael->m_mode) { - case RIJNDAEL_Direction_Mode_ECB: + case RIJNDAEL_Direction_Mode_ECB: for(i = numBlocks; i > 0; i--) { RijndaelEncrypt(rijndael, input, outBuffer); @@ -1306,10 +1306,10 @@ int RijndaelPadEncrypt(Rijndael* rijndael, UINT8 *input, int inputOctets, UINT8 return -1; break; } - + return 16*(numBlocks + 1); } - + int RijndaelBlockDecrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* outBuffer) { int i, k, numBlocks, lenFrag; @@ -1329,7 +1329,7 @@ int RijndaelBlockDecrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* switch (rijndael->m_mode) { - case RIJNDAEL_Direction_Mode_ECB: + case RIJNDAEL_Direction_Mode_ECB: for (i = numBlocks; i > 0; i--) { RijndaelDecrypt(rijndael, input, outBuffer); @@ -1384,8 +1384,8 @@ int RijndaelBlockDecrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* } } } -#if STRICT_ALIGN - memcpy(iv,rijndael->m_initVector,16); +#if STRICT_ALIGN + memcpy(iv,rijndael->m_initVector,16); #else *((UINT32*)iv[0]) = *((UINT32*)(rijndael->m_initVector )); *((UINT32*)iv[1]) = *((UINT32*)(rijndael->m_initVector+ 4)); @@ -1414,8 +1414,8 @@ int RijndaelBlockDecrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* } break; case RIJNDAEL_Direction_Mode_CFB1: -#if STRICT_ALIGN - memcpy(iv, rijndael->m_initVector, 16); +#if STRICT_ALIGN + memcpy(iv, rijndael->m_initVector, 16); #else *((UINT32*)iv[0]) = *((UINT32*)(rijndael->m_initVector)); *((UINT32*)iv[1]) = *((UINT32*)(rijndael->m_initVector+ 4)); @@ -1459,7 +1459,7 @@ int RijndaelBlockDecrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* break; } -#ifdef TEST_AES_HW +#ifdef TEST_AES_HW { int cmpdata = memcmp((unsigned char*) outOrig, outBuffer2, inputLen/8); TEST_AES_HW_DEBUG_LOG("aes dec: cmp=%d\n", cmpdata); @@ -1467,7 +1467,7 @@ int RijndaelBlockDecrypt(Rijndael* rijndael, UINT8* input, int inputLen, UINT8* TEST_AES_HW_DEBUG_HEX("aes dec HW:", outBuffer2, 16); } #endif - + return 128*numBlocks; } @@ -1504,7 +1504,7 @@ int RijndaelPadDecrypt(Rijndael* rijndael, UINT8 *input, int inputOctets, UINT8 if (block[i] != padLen) return RIJNDAEL_CORRUPTED_DATA; } memcpy(outBuffer, block, 16 - padLen); - break; + break; case RIJNDAEL_Direction_Mode_CBC: memcpy(iv, rijndael->m_initVector, 16); /* all blocks but last */ @@ -1534,12 +1534,12 @@ int RijndaelPadDecrypt(Rijndael* rijndael, UINT8 *input, int inputOctets, UINT8 } memcpy(outBuffer, block, 16 - padLen); break; - + default: return -1; break; } - + return 16*numBlocks - padLen; } @@ -1585,7 +1585,7 @@ void RijndaelKeySched(Rijndael* rijndael, UINT8 key[_MAX_KEY_COLUMNS][4]) t = 0; } } - + while(r <= rijndael->m_uRounds) { tempKey[0][0] ^= S[tempKey[uKeyColumns-1][1]]; @@ -1626,7 +1626,7 @@ void RijndaelKeySched(Rijndael* rijndael, UINT8 key[_MAX_KEY_COLUMNS][4]) t = 0; } } - } + } } void RijndaelKeyEncToDec(Rijndael* rijndael) @@ -1645,7 +1645,7 @@ void RijndaelKeyEncToDec(Rijndael* rijndael) w = rijndael->m_expandedKey[r][3]; *((UINT32*)w) = *((UINT32*)U1[w[0]]) ^ *((UINT32*)U2[w[1]]) ^ *((UINT32*)U3[w[2]]) ^ *((UINT32*)U4[w[3]]); } -} +} void RijndaelEncrypt(Rijndael* rijndael, UINT8 a[16], UINT8 b[16]) { @@ -1658,19 +1658,19 @@ void RijndaelEncrypt(Rijndael* rijndael, UINT8 a[16], UINT8 b[16]) *((UINT32*)temp[3]) = *((UINT32*)(a+12)) ^ *((UINT32*)rijndael->m_expandedKey[0][3]); *((UINT32*)(b )) = *((UINT32*)T1[temp[0][0]]) ^ *((UINT32*)T2[temp[1][1]]) - ^ *((UINT32*)T3[temp[2][2]]) + ^ *((UINT32*)T3[temp[2][2]]) ^ *((UINT32*)T4[temp[3][3]]); *((UINT32*)(b + 4)) = *((UINT32*)T1[temp[1][0]]) ^ *((UINT32*)T2[temp[2][1]]) - ^ *((UINT32*)T3[temp[3][2]]) + ^ *((UINT32*)T3[temp[3][2]]) ^ *((UINT32*)T4[temp[0][3]]); *((UINT32*)(b + 8)) = *((UINT32*)T1[temp[2][0]]) ^ *((UINT32*)T2[temp[3][1]]) - ^ *((UINT32*)T3[temp[0][2]]) + ^ *((UINT32*)T3[temp[0][2]]) ^ *((UINT32*)T4[temp[1][3]]); *((UINT32*)(b +12)) = *((UINT32*)T1[temp[3][0]]) ^ *((UINT32*)T2[temp[0][1]]) - ^ *((UINT32*)T3[temp[1][2]]) + ^ *((UINT32*)T3[temp[1][2]]) ^ *((UINT32*)T4[temp[2][3]]); for(r = 1; r < rijndael->m_uRounds-1; r++) { @@ -1681,19 +1681,19 @@ void RijndaelEncrypt(Rijndael* rijndael, UINT8 a[16], UINT8 b[16]) *((UINT32*)(b )) = *((UINT32*)T1[temp[0][0]]) ^ *((UINT32*)T2[temp[1][1]]) - ^ *((UINT32*)T3[temp[2][2]]) + ^ *((UINT32*)T3[temp[2][2]]) ^ *((UINT32*)T4[temp[3][3]]); *((UINT32*)(b + 4)) = *((UINT32*)T1[temp[1][0]]) ^ *((UINT32*)T2[temp[2][1]]) - ^ *((UINT32*)T3[temp[3][2]]) + ^ *((UINT32*)T3[temp[3][2]]) ^ *((UINT32*)T4[temp[0][3]]); *((UINT32*)(b + 8)) = *((UINT32*)T1[temp[2][0]]) ^ *((UINT32*)T2[temp[3][1]]) - ^ *((UINT32*)T3[temp[0][2]]) + ^ *((UINT32*)T3[temp[0][2]]) ^ *((UINT32*)T4[temp[1][3]]); *((UINT32*)(b +12)) = *((UINT32*)T1[temp[3][0]]) ^ *((UINT32*)T2[temp[0][1]]) - ^ *((UINT32*)T3[temp[1][2]]) + ^ *((UINT32*)T3[temp[1][2]]) ^ *((UINT32*)T4[temp[2][3]]); } *((UINT32*)temp[0]) = *((UINT32*)(b )) ^ *((UINT32*)rijndael->m_expandedKey[rijndael->m_uRounds-1][0]); @@ -1726,7 +1726,7 @@ void RijndaelDecrypt(Rijndael* rijndael, UINT8 a[16], UINT8 b[16]) { int r; UINT8 temp[4][4]; - + *((UINT32*)temp[0]) = *((UINT32*)(a )) ^ *((UINT32*)rijndael->m_expandedKey[rijndael->m_uRounds][0]); *((UINT32*)temp[1]) = *((UINT32*)(a+ 4)) ^ *((UINT32*)rijndael->m_expandedKey[rijndael->m_uRounds][1]); *((UINT32*)temp[2]) = *((UINT32*)(a+ 8)) ^ *((UINT32*)rijndael->m_expandedKey[rijndael->m_uRounds][2]); @@ -1734,19 +1734,19 @@ void RijndaelDecrypt(Rijndael* rijndael, UINT8 a[16], UINT8 b[16]) *((UINT32*)(b )) = *((UINT32*)T5[temp[0][0]]) ^ *((UINT32*)T6[temp[3][1]]) - ^ *((UINT32*)T7[temp[2][2]]) + ^ *((UINT32*)T7[temp[2][2]]) ^ *((UINT32*)T8[temp[1][3]]); *((UINT32*)(b+ 4)) = *((UINT32*)T5[temp[1][0]]) ^ *((UINT32*)T6[temp[0][1]]) - ^ *((UINT32*)T7[temp[3][2]]) + ^ *((UINT32*)T7[temp[3][2]]) ^ *((UINT32*)T8[temp[2][3]]); *((UINT32*)(b+ 8)) = *((UINT32*)T5[temp[2][0]]) ^ *((UINT32*)T6[temp[1][1]]) - ^ *((UINT32*)T7[temp[0][2]]) + ^ *((UINT32*)T7[temp[0][2]]) ^ *((UINT32*)T8[temp[3][3]]); *((UINT32*)(b+12)) = *((UINT32*)T5[temp[3][0]]) ^ *((UINT32*)T6[temp[2][1]]) - ^ *((UINT32*)T7[temp[1][2]]) + ^ *((UINT32*)T7[temp[1][2]]) ^ *((UINT32*)T8[temp[0][3]]); for(r = rijndael->m_uRounds-1; r > 1; r--) { @@ -1756,22 +1756,22 @@ void RijndaelDecrypt(Rijndael* rijndael, UINT8 a[16], UINT8 b[16]) *((UINT32*)temp[3]) = *((UINT32*)(b+12)) ^ *((UINT32*)rijndael->m_expandedKey[r][3]); *((UINT32*)(b )) = *((UINT32*)T5[temp[0][0]]) ^ *((UINT32*)T6[temp[3][1]]) - ^ *((UINT32*)T7[temp[2][2]]) + ^ *((UINT32*)T7[temp[2][2]]) ^ *((UINT32*)T8[temp[1][3]]); *((UINT32*)(b+ 4)) = *((UINT32*)T5[temp[1][0]]) ^ *((UINT32*)T6[temp[0][1]]) - ^ *((UINT32*)T7[temp[3][2]]) + ^ *((UINT32*)T7[temp[3][2]]) ^ *((UINT32*)T8[temp[2][3]]); *((UINT32*)(b+ 8)) = *((UINT32*)T5[temp[2][0]]) ^ *((UINT32*)T6[temp[1][1]]) - ^ *((UINT32*)T7[temp[0][2]]) + ^ *((UINT32*)T7[temp[0][2]]) ^ *((UINT32*)T8[temp[3][3]]); *((UINT32*)(b+12)) = *((UINT32*)T5[temp[3][0]]) ^ *((UINT32*)T6[temp[2][1]]) - ^ *((UINT32*)T7[temp[1][2]]) + ^ *((UINT32*)T7[temp[1][2]]) ^ *((UINT32*)T8[temp[0][3]]); } - + *((UINT32*)temp[0]) = *((UINT32*)(b )) ^ *((UINT32*)rijndael->m_expandedKey[1][0]); *((UINT32*)temp[1]) = *((UINT32*)(b+ 4)) ^ *((UINT32*)rijndael->m_expandedKey[1][1]); *((UINT32*)temp[2]) = *((UINT32*)(b+ 8)) ^ *((UINT32*)rijndael->m_expandedKey[1][2]); diff --git a/src/sha2.h b/src/sha2.h index 4e63b26..720fc49 100644 --- a/src/sha2.h +++ b/src/sha2.h @@ -55,7 +55,7 @@ typedef sqlite3_uint64 uint64; #define li_64(h) 0x##h##ui64 #else #define li_64(h) 0x##h##ull -#endif +#endif #if 0 /* Start of original int64 defines */ diff --git a/src/sqlite3mc.c b/src/sqlite3mc.c index d127521..d2dd1fd 100644 --- a/src/sqlite3mc.c +++ b/src/sqlite3mc.c @@ -128,7 +128,7 @@ SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*); #include "sqlite3patched.c" /* -** Include SQLite3MultiCipher components +** Include SQLite3MultiCipher components */ #include "sqlite3mc_config.h" #include "sqlite3mc.h" diff --git a/src/sqlite3mc.rc b/src/sqlite3mc.rc index fea52cf..953a3dd 100644 --- a/src/sqlite3mc.rc +++ b/src/sqlite3mc.rc @@ -16,7 +16,7 @@ #define SQLITE3MC_MAKE_VERSION_DOT_STRING(x, y, z, w) \ SQLITE3MC_STRINGIZE(x) "." SQLITE3MC_STRINGIZE(y) "." SQLITE3MC_STRINGIZE(z) "." SQLITE3MC_STRINGIZE(w) - + #define SQLITE3MC_FILE_VERSION_NUM_DOT_STRING \ SQLITE3MC_MAKE_VERSION_DOT_STRING(SQLITE3MC_VERSION_MAJOR, SQLITE3MC_VERSION_MINOR, SQLITE3MC_VERSION_RELEASE, SQLITE3MC_VERSION_SUBRELEASE) #define SQLITE3MC_PROD_VERSION_NUM_DOT_STRING \ diff --git a/src/sqlite3mc_shell.rc b/src/sqlite3mc_shell.rc index 2726967..8f29888 100644 --- a/src/sqlite3mc_shell.rc +++ b/src/sqlite3mc_shell.rc @@ -18,7 +18,7 @@ ID_SQLITE3 ICON "sqlite370.ico" #define SQLITE3MC_MAKE_VERSION_DOT_STRING(x, y, z, w) \ SQLITE3MC_STRINGIZE(x) "." SQLITE3MC_STRINGIZE(y) "." SQLITE3MC_STRINGIZE(z) "." SQLITE3MC_STRINGIZE(w) - + #define SQLITE3MC_FILE_VERSION_NUM_DOT_STRING \ SQLITE3MC_MAKE_VERSION_DOT_STRING(SQLITE3MC_VERSION_MAJOR, SQLITE3MC_VERSION_MINOR, SQLITE3MC_VERSION_RELEASE, SQLITE3MC_VERSION_SUBRELEASE) #define SQLITE3MC_PROD_VERSION_NUM_DOT_STRING \ diff --git a/src/sqlite3mc_vfs.c b/src/sqlite3mc_vfs.c index ed0fc83..59d9bb1 100644 --- a/src/sqlite3mc_vfs.c +++ b/src/sqlite3mc_vfs.c @@ -213,7 +213,7 @@ static void mcMainListRemove(sqlite3mc_file* pFile) } /* -** Given that zFileName points to a buffer containing a database file name passed to +** Given that zFileName points to a buffer containing a database file name passed to ** either the xOpen() or xAccess() VFS method, search the list of main database files ** for a file handle opened by the same database connection on the corresponding ** database file. @@ -357,8 +357,8 @@ SQLITE_PRIVATE void* sqlite3mcPagerCodec(PgHdrMC* pPg) { sqlite3_file* pFile = sqlite3PagerFile(pPg->pPager); void* aData = 0; - if (pFile->pMethods == &mcIoMethodsGlobal1 || - pFile->pMethods == &mcIoMethodsGlobal2 || + if (pFile->pMethods == &mcIoMethodsGlobal1 || + pFile->pMethods == &mcIoMethodsGlobal2 || pFile->pMethods == &mcIoMethodsGlobal3) { sqlite3mc_file* mcFile = (sqlite3mc_file*) pFile; diff --git a/src/sqlite3userauth.h b/src/sqlite3userauth.h index c6fb200..fe467f5 100644 --- a/src/sqlite3userauth.h +++ b/src/sqlite3userauth.h @@ -66,7 +66,7 @@ SQLITE_API int sqlite3_user_add( ** The sqlite3_user_change() interface can be used to change a users ** login credentials or admin privilege. Any user can change their own ** login credentials. Only an admin user can change another users login -** credentials or admin privilege setting. No user may change their own +** credentials or admin privilege setting. No user may change their own ** admin privilege setting. */ SQLITE_API int sqlite3_user_change( diff --git a/src/userauth.c b/src/userauth.c index 61d0db2..287b7c4 100644 --- a/src/userauth.c +++ b/src/userauth.c @@ -247,7 +247,7 @@ SQLITE_API int sqlite3_user_add( if( db->auth.authLevel module name ("zipfile") ** argv[1] -> database name ** argv[2] -> table name @@ -404,7 +404,7 @@ static void zipfileEntryFree(ZipfileEntry *p){ } /* -** Release resources that should be freed at the end of a write +** Release resources that should be freed at the end of a write ** transaction. */ static void zipfileCleanupTransaction(ZipfileTab *pTab){ @@ -513,7 +513,7 @@ static void zipfileCursorErr(ZipfileCsr *pCsr, const char *zFmt, ...){ /* ** Read nRead bytes of data from offset iOff of file pFile into buffer ** aRead[]. Return SQLITE_OK if successful, or an SQLite error code -** otherwise. +** otherwise. ** ** If an error does occur, output variable (*pzErrmsg) may be set to point ** to an English language error message. It is the responsibility of the @@ -721,7 +721,7 @@ static int zipfileScanExtra(u8 *aExtra, int nExtra, u32 *pmTime){ ** File modification date: ** Bits 00-04: day ** Bits 05-08: month (1-12) -** Bits 09-15: years from 1980 +** Bits 09-15: years from 1980 ** ** https://msdn.microsoft.com/en-us/library/9kkf9tah.aspx */ @@ -781,9 +781,9 @@ static void zipfileMtimeToDos(ZipfileCDS *pCds, u32 mUnixTime){ pCds->mDate = pCds->mTime = 0; } - assert( mUnixTime<315507600 - || mUnixTime==zipfileMtime(pCds) - || ((mUnixTime % 2) && mUnixTime-1==zipfileMtime(pCds)) + assert( mUnixTime<315507600 + || mUnixTime==zipfileMtime(pCds) + || ((mUnixTime % 2) && mUnixTime-1==zipfileMtime(pCds)) /* || (mUnixTime % 2) */ ); } @@ -851,7 +851,7 @@ static int zipfileGetEntry( if( rc==SQLITE_OK ){ u32 *pt = &pNew->mUnixTime; - pNew->cds.zFile = sqlite3_mprintf("%.*s", nFile, aRead); + pNew->cds.zFile = sqlite3_mprintf("%.*s", nFile, aRead); pNew->aExtra = (u8*)&pNew[1]; memcpy(pNew->aExtra, &aRead[nFile], nExtra); if( pNew->cds.zFile==0 ){ @@ -879,7 +879,7 @@ static int zipfileGetEntry( memcpy(pNew->aData, &aBlob[pNew->iDataOff], pNew->cds.szCompressed); } }else{ - *pzErr = sqlite3_mprintf("failed to read LFH at offset %d", + *pzErr = sqlite3_mprintf("failed to read LFH at offset %d", (int)pNew->cds.iOffset ); } @@ -931,8 +931,8 @@ static int zipfileNext(sqlite3_vtab_cursor *cur){ return rc; } -static void zipfileFree(void *p) { - sqlite3_free(p); +static void zipfileFree(void *p) { + sqlite3_free(p); } /* @@ -982,7 +982,7 @@ static void zipfileInflate( ** Buffer aIn (size nIn bytes) contains uncompressed data. This function ** compresses it and sets (*ppOut) to point to a buffer containing the ** compressed data. The caller is responsible for eventually calling -** sqlite3_free() to release buffer (*ppOut). Before returning, (*pnOut) +** sqlite3_free() to release buffer (*ppOut). Before returning, (*pnOut) ** is set to the size of buffer (*ppOut) in bytes. ** ** If no error occurs, SQLITE_OK is returned. Otherwise, an SQLite error @@ -1171,8 +1171,8 @@ static int zipfileReadEOCD( /* Scan backwards looking for the signature bytes */ for(i=nRead-20; i>=0; i--){ - if( aRead[i]==0x50 && aRead[i+1]==0x4b - && aRead[i+2]==0x05 && aRead[i+3]==0x06 + if( aRead[i]==0x50 && aRead[i+1]==0x4b + && aRead[i+2]==0x05 && aRead[i+3]==0x06 ){ break; } @@ -1197,14 +1197,14 @@ static int zipfileReadEOCD( } /* -** Add object pNew to the linked list that begins at ZipfileTab.pFirstEntry +** Add object pNew to the linked list that begins at ZipfileTab.pFirstEntry ** and ends with pLastEntry. If argument pBefore is NULL, then pNew is added ** to the end of the list. Otherwise, it is added to the list immediately ** before pBefore (which is guaranteed to be a part of said list). */ static void zipfileAddEntry( - ZipfileTab *pTab, - ZipfileEntry *pBefore, + ZipfileTab *pTab, + ZipfileEntry *pBefore, ZipfileEntry *pNew ){ assert( (pTab->pFirstEntry==0)==(pTab->pLastEntry==0) ); @@ -1250,7 +1250,7 @@ static int zipfileLoadDirectory(ZipfileTab *pTab, const u8 *aBlob, int nBlob){ ** xFilter callback. */ static int zipfileFilter( - sqlite3_vtab_cursor *cur, + sqlite3_vtab_cursor *cur, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ @@ -1413,7 +1413,7 @@ static int zipfileAppendEntry( } static int zipfileGetMode( - sqlite3_value *pVal, + sqlite3_value *pVal, int bIsDir, /* If true, default to directory */ u32 *pMode, /* OUT: Mode value */ char **pzErr /* OUT: Error message */ @@ -1476,7 +1476,7 @@ static int zipfileBegin(sqlite3_vtab *pVtab){ } /* Open a write fd on the file. Also load the entire central directory - ** structure into memory. During the transaction any new file data is + ** structure into memory. During the transaction any new file data is ** appended to the archive file, but the central directory is accumulated ** in main-memory until the transaction is committed. */ pTab->pWriteFd = fopen(pTab->zFile, "ab+"); @@ -1559,9 +1559,9 @@ static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){ ** xUpdate method. */ static int zipfileUpdate( - sqlite3_vtab *pVtab, - int nVal, - sqlite3_value **apVal, + sqlite3_vtab *pVtab, + int nVal, + sqlite3_value **apVal, sqlite_int64 *pRowid ){ ZipfileTab *pTab = (ZipfileTab*)pVtab; @@ -1616,7 +1616,7 @@ static int zipfileUpdate( rc = SQLITE_CONSTRAINT; } if( sqlite3_value_type(apVal[6])!=SQLITE_NULL ){ - zipfileTableErr(pTab, "rawdata must be NULL"); + zipfileTableErr(pTab, "rawdata must be NULL"); rc = SQLITE_CONSTRAINT; } @@ -2208,7 +2208,7 @@ static int zipfileRegister(sqlite3 *db){ int rc = sqlite3_create_module(db, "zipfile" , &zipfileModule, 0); if( rc==SQLITE_OK ) rc = sqlite3_overload_function(db, "zipfile_cds", -1); if( rc==SQLITE_OK ){ - rc = sqlite3_create_function(db, "zipfile", -1, SQLITE_UTF8, 0, 0, + rc = sqlite3_create_function(db, "zipfile", -1, SQLITE_UTF8, 0, 0, zipfileStep, zipfileFinal ); } @@ -2226,8 +2226,8 @@ static int zipfileRegister(sqlite3 *db){ __declspec(dllexport) #endif int sqlite3_zipfile_init( - sqlite3 *db, - char **pzErrMsg, + sqlite3 *db, + char **pzErrMsg, const sqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi);