Fixed some issues reported by static analyzer.
authorEdouard Tisserant
Wed, 20 Jan 2016 17:19:31 +0100
changeset 417323a3d09dc08
parent 416 f47bd5f1b17e
child 418 8c8a44854e2a
Fixed some issues reported by static analyzer.
src/mime.c
src/pEpEngine.c
src/pgp_netpgp.c
     1.1 --- a/src/mime.c	Tue Jan 19 11:00:32 2016 +0100
     1.2 +++ b/src/mime.c	Wed Jan 20 17:19:31 2016 +0100
     1.3 @@ -54,7 +54,7 @@
     1.4      char *env_tmp = getenv("TEMP");
     1.5  
     1.6      if(env_tmp){
     1.7 -        int tmp_l = strlen(env_tmp);
     1.8 +        unsigned long tmp_l = strlen(env_tmp);
     1.9          if(tmp_l == 0 ) {
    1.10              goto err_file;
    1.11          } else {
     2.1 --- a/src/pEpEngine.c	Tue Jan 19 11:00:32 2016 +0100
     2.2 +++ b/src/pEpEngine.c	Wed Jan 20 17:19:31 2016 +0100
     2.3 @@ -204,48 +204,48 @@
     2.4          sql_reset_trust = "delete from trust where pgp_keypair_fpr = ?1 ;";
     2.5      }
     2.6  
     2.7 -    int_result = sqlite3_prepare_v2(_session->db, sql_log, strlen(sql_log),
     2.8 +    int_result = sqlite3_prepare_v2(_session->db, sql_log, (int)strlen(sql_log),
     2.9              &_session->log, NULL);
    2.10  	assert(int_result == SQLITE_OK);
    2.11  
    2.12      int_result = sqlite3_prepare_v2(_session->system_db, sql_trustword,
    2.13 -            strlen(sql_trustword), &_session->trustword, NULL);
    2.14 +            (int)strlen(sql_trustword), &_session->trustword, NULL);
    2.15  	assert(int_result == SQLITE_OK);
    2.16  
    2.17      int_result = sqlite3_prepare_v2(_session->db, sql_get_identity,
    2.18 -            strlen(sql_get_identity), &_session->get_identity, NULL);
    2.19 +            (int)strlen(sql_get_identity), &_session->get_identity, NULL);
    2.20  	assert(int_result == SQLITE_OK);
    2.21  
    2.22      int_result = sqlite3_prepare_v2(_session->db, sql_set_person,
    2.23 -            strlen(sql_set_person), &_session->set_person, NULL);
    2.24 +            (int)strlen(sql_set_person), &_session->set_person, NULL);
    2.25      assert(int_result == SQLITE_OK);
    2.26  
    2.27      int_result = sqlite3_prepare_v2(_session->db, sql_set_pgp_keypair,
    2.28 -            strlen(sql_set_pgp_keypair), &_session->set_pgp_keypair, NULL);
    2.29 +            (int)strlen(sql_set_pgp_keypair), &_session->set_pgp_keypair, NULL);
    2.30  	assert(int_result == SQLITE_OK);
    2.31  
    2.32      int_result = sqlite3_prepare_v2(_session->db, sql_set_identity,
    2.33 -            strlen(sql_set_identity), &_session->set_identity, NULL);
    2.34 +            (int)strlen(sql_set_identity), &_session->set_identity, NULL);
    2.35  	assert(int_result == SQLITE_OK);
    2.36  
    2.37      int_result = sqlite3_prepare_v2(_session->db, sql_set_trust,
    2.38 -            strlen(sql_set_trust), &_session->set_trust, NULL);
    2.39 +            (int)strlen(sql_set_trust), &_session->set_trust, NULL);
    2.40  	assert(int_result == SQLITE_OK);
    2.41  
    2.42      int_result = sqlite3_prepare_v2(_session->db, sql_get_trust,
    2.43 -            strlen(sql_get_trust), &_session->get_trust, NULL);
    2.44 +            (int)strlen(sql_get_trust), &_session->get_trust, NULL);
    2.45      assert(int_result == SQLITE_OK);
    2.46  
    2.47      int_result = sqlite3_prepare_v2(_session->db, sql_least_trust,
    2.48 -            strlen(sql_least_trust), &_session->least_trust, NULL);
    2.49 +            (int)strlen(sql_least_trust), &_session->least_trust, NULL);
    2.50      assert(int_result == SQLITE_OK);
    2.51  
    2.52      int_result = sqlite3_prepare_v2(_session->db, sql_mark_as_compromized,
    2.53 -            strlen(sql_mark_as_compromized), &_session->mark_compromized, NULL);
    2.54 +            (int)strlen(sql_mark_as_compromized), &_session->mark_compromized, NULL);
    2.55      assert(int_result == SQLITE_OK);
    2.56  
    2.57      int_result = sqlite3_prepare_v2(_session->db, sql_reset_trust,
    2.58 -                                    strlen(sql_reset_trust), &_session->reset_trust, NULL);
    2.59 +                                    (int)strlen(sql_reset_trust), &_session->reset_trust, NULL);
    2.60      assert(int_result == SQLITE_OK);
    2.61      
    2.62      status = init_cryptotech(_session, in_first);
     3.1 --- a/src/pgp_netpgp.c	Tue Jan 19 11:00:32 2016 +0100
     3.2 +++ b/src/pgp_netpgp.c	Wed Jan 20 17:19:31 2016 +0100
     3.3 @@ -1265,7 +1265,7 @@
     3.4          char *request;
     3.5          size_t encoded_key_len;
     3.6  
     3.7 -        encoded_key = curl_escape(buffer, buflen);
     3.8 +        encoded_key = curl_escape(buffer, (int)buflen);
     3.9          if(!encoded_key){
    3.10              result = PEP_OUT_OF_MEMORY;
    3.11              goto free_buffer;