explicit conversions
authorVolker Birk <vb@pep.foundation>
Mon, 12 Mar 2018 20:25:55 +0100
changeset 2571817d69de911f
parent 2570 c907f9904e73
child 2572 9aaa4c236d08
explicit conversions
src/message_api.c
src/pEpEngine.c
src/pEp_internal.h
src/platform_windows.cpp
     1.1 --- a/src/message_api.c	Mon Mar 12 13:27:33 2018 +0100
     1.2 +++ b/src/message_api.c	Mon Mar 12 20:25:55 2018 +0100
     1.3 @@ -393,7 +393,7 @@
     1.4  
     1.5  static char* get_base_36_rep(unsigned long long value, int num_sig_bits) {
     1.6          
     1.7 -    int bufsize = ceil(num_sig_bits / _pEp_log2_36) + 1;
     1.8 +    int bufsize = ((int) ceil((double) num_sig_bits / _pEp_log2_36)) + 1;
     1.9      
    1.10      // based on
    1.11      // https://en.wikipedia.org/wiki/Base36#C_implementation
    1.12 @@ -478,7 +478,7 @@
    1.13      
    1.14      time_t curr_time = time(NULL);
    1.15      
    1.16 -    time_prefix = get_base_36_rep(curr_time, ceil(log2(curr_time)));
    1.17 +    time_prefix = get_base_36_rep(curr_time, (int) ceil(log2((double) curr_time)));
    1.18  
    1.19      if (!time_prefix)
    1.20          goto enomem;
     2.1 --- a/src/pEpEngine.c	Mon Mar 12 13:27:33 2018 +0100
     2.2 +++ b/src/pEpEngine.c	Mon Mar 12 20:25:55 2018 +0100
     2.3 @@ -1336,7 +1336,7 @@
     2.4      // Note: Following statement is NOT for any cryptographic/secure functionality; it is
     2.5      //       ONLY used for some randomness in generated outer message ID, which are
     2.6      //       required by the RFC to be globally unique!
     2.7 -    srand(time(NULL));
     2.8 +    srand((unsigned int) time(NULL));
     2.9      
    2.10      return PEP_STATUS_OK;
    2.11  
     3.1 --- a/src/pEp_internal.h	Mon Mar 12 13:27:33 2018 +0100
     3.2 +++ b/src/pEp_internal.h	Mon Mar 12 20:25:55 2018 +0100
     3.3 @@ -427,6 +427,6 @@
     3.4  extern double _pEp_log2_36;
     3.5  
     3.6  static inline void _init_globals() {
     3.7 -    _pEp_rand_max_bits = ceil(log2(RAND_MAX));
     3.8 +    _pEp_rand_max_bits = (int) ceil(log2((double) RAND_MAX));
     3.9      _pEp_log2_36 = log2(36);
    3.10  }
     4.1 --- a/src/platform_windows.cpp	Mon Mar 12 13:27:33 2018 +0100
     4.2 +++ b/src/platform_windows.cpp	Mon Mar 12 20:25:55 2018 +0100
     4.3 @@ -145,7 +145,7 @@
     4.4  		TEXT("SOFTWARE\\GnuPG"), TEXT("Install Directory"), path,
     4.5  		PATH_BUF_SIZE, NULL);
     4.6  	// If not found in current user, look up in local machine
     4.7 -	if (!result)
     4.8 +	if (!result)
     4.9  		result = readRegistryString(HKEY_LOCAL_MACHINE,
    4.10  			TEXT("SOFTWARE\\GnuPG"), TEXT("Install Directory"), path,
    4.11  			PATH_BUF_SIZE, NULL);