Merge with sync sequoia_windows
authorThomas
Thu, 16 May 2019 12:05:14 +0200
branchsequoia_windows
changeset 3704ce00fd902b41
parent 3701 1f717dccd337
parent 3703 b8ff8becff09
child 3718 a6355f25976f
Merge with sync
src/pgp_sequoia.c
     1.1 --- a/src/pgp_sequoia.c	Thu May 16 08:14:02 2019 +0200
     1.2 +++ b/src/pgp_sequoia.c	Thu May 16 12:05:14 2019 +0200
     1.3 @@ -28,16 +28,17 @@
     1.4  #if TRACING
     1.5  #include "status_to_string.h"
     1.6  
     1.7 -#ifdef ANDROID
     1.8 -#  include <android/log.h>
     1.9 -#  define _T(...) do {                          \
    1.10 -        __android_log_print(ANDROID_LOG_DEBUG, "pEpEngine-sequoia", __VA_ARGS__);         \
    1.11 +#  ifdef ANDROID
    1.12 +#    include <android/log.h>
    1.13 +#    define _T(...) do {                                                \
    1.14 +        __android_log_print(ANDROID_LOG_DEBUG, "pEpEngine-sequoia",     \
    1.15 +                            ##__VA_ARGS__);                             \
    1.16      } while (0)
    1.17 -#else
    1.18 -#  define _T(...) do {                          \
    1.19 +#  else
    1.20 +#    define _T(...) do {                        \
    1.21          fprintf(stderr, ##__VA_ARGS__);         \
    1.22      } while (0)
    1.23 -#endif
    1.24 +#  endif
    1.25  #else
    1.26  #  define _T(...) do { } while (0)
    1.27  #endif
    1.28 @@ -85,7 +86,7 @@
    1.29      }                                                               \
    1.30  } while(0)
    1.31  
    1.32 -DYNAMIC_API PEP_STATUS pgp_config_cipher_suite(PEP_SESSION session,
    1.33 +PEP_STATUS pgp_config_cipher_suite(PEP_SESSION session,
    1.34          PEP_CIPHER_SUITE suite)
    1.35  {
    1.36      switch (suite) {
    1.37 @@ -184,12 +185,12 @@
    1.38  #endif
    1.39  
    1.40  #ifdef _WIN32
    1.41 -    #define PATH "\\pEp\\.pEp_keys.db"
    1.42 +	#define PEP_KEYS_PATH "\\pEp\\keys.db"
    1.43  
    1.44      if (!home_env)
    1.45 -        home_env = getenv("LOCALAPPDATA");
    1.46 +        home_env = getenv("APPDATA");
    1.47  #else
    1.48 -    #define PATH "/.pEp_keys.db"
    1.49 +	#define PEP_KEYS_PATH "/keys.db"
    1.50  
    1.51      if (!home_env)
    1.52          home_env = getenv("HOME");
    1.53 @@ -199,17 +200,13 @@
    1.54          ERROR_OUT(NULL, PEP_INIT_GPGME_INIT_FAILED, "HOME unset");
    1.55  
    1.56      // Create the DB and initialize it.
    1.57 -    size_t path_size = strlen(home_env) + sizeof(PATH);
    1.58 +    size_t path_size = strlen(home_env) + sizeof(PEP_KEYS_PATH);
    1.59      char *path = (char *) calloc(1, path_size);
    1.60      assert(path);
    1.61      if (!path)
    1.62          ERROR_OUT(NULL, PEP_OUT_OF_MEMORY, "out of memory");
    1.63  
    1.64 -#ifdef _WIN32
    1.65 -    int r = snprintf(path, path_size, "%s\\pEp\\.pEp_keys.db", home_env);
    1.66 -#else
    1.67 -    int r = snprintf(path, path_size, "%s/.pEp_keys.db", home_env);
    1.68 -#endif
    1.69 +	int r = snprintf(path, path_size, "%s" PEP_KEYS_PATH, home_env);
    1.70      assert(r >= 0 && r < path_size);
    1.71      if (r < 0)
    1.72          ERROR_OUT(NULL, PEP_UNKNOWN_ERROR, "snprintf");