@@ -1206,17 +1206,22 @@ int sqlcipher_codec_add_random(codec_ctx *ctx, const char *zRight, int random_sz
1206
1206
1207
1207
int sqlcipher_cipher_profile (sqlite3 * db , const char * destination ){
1208
1208
FILE * f ;
1209
- if ( strcmp (destination ,"stdout" )== 0 ){
1209
+ if (sqlite3StrICmp (destination , "stdout" ) == 0 ){
1210
1210
f = stdout ;
1211
- }else if ( strcmp (destination , "stderr" )== 0 ){
1211
+ }else if (sqlite3StrICmp (destination , "stderr" ) == 0 ){
1212
1212
f = stderr ;
1213
- }else if ( strcmp (destination , "off" )== 0 ){
1213
+ }else if (sqlite3StrICmp (destination , "off" ) == 0 ){
1214
1214
f = 0 ;
1215
1215
}else {
1216
- f = fopen (destination , "wb" );
1217
- if ( f == 0 ){
1218
- return SQLITE_ERROR ;
1219
- }
1216
+ #if defined(_WIN32 ) && (__STDC_VERSION__ > 199901L )
1217
+ if (fopen_s (& f , destination , "a" ) != 0 ){
1218
+ #else
1219
+ f = fopen (destination , "a" );
1220
+ if (f == 0 ){
1221
+ #endif
1222
+ return SQLITE_ERROR;
1223
+ }
1224
+
1220
1225
}
1221
1226
sqlite3_profile (db , sqlcipher_profile_callback , f );
1222
1227
return SQLITE_OK ;
@@ -1225,7 +1230,7 @@ int sqlcipher_cipher_profile(sqlite3 *db, const char *destination){
1225
1230
static void sqlcipher_profile_callback (void * file , const char * sql , sqlite3_uint64 run_time ){
1226
1231
FILE * f = (FILE * )file ;
1227
1232
double elapsed = run_time /1000000.0 ;
1228
- if ( f ) fprintf (f , "Elapsed time:%.3f ms - %s\n" , elapsed , sql );
1233
+ if (f ) fprintf (f , "Elapsed time:%.3f ms - %s\n" , elapsed , sql );
1229
1234
}
1230
1235
1231
1236
int sqlcipher_codec_fips_status (codec_ctx * ctx ) {
0 commit comments