Fix printf formats for size_t and goffset arguments.
[claws.git] / src / common / ssl_certificate.c
index 6db05f5bc8e4fa938bd7e30cb62a79064ff4e728..ebe6168187356bf3b6669aedcc8045546b134864 100644 (file)
@@ -54,14 +54,22 @@ gboolean prefs_common_unsafe_ssl_certs(void);
 
 static gchar *get_certificate_path(const gchar *host, const gchar *port, const gchar *fp)
 {
-       if (fp != NULL && prefs_common_unsafe_ssl_certs())
-               return g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, 
-                         "certs", G_DIR_SEPARATOR_S,
-                         host, ".", port, ".", fp, ".cert", NULL);
-       else 
-               return g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, 
-                         "certs", G_DIR_SEPARATOR_S,
-                         host, ".", port, ".cert", NULL);
+       gchar *ret;
+       gchar *filename;
+
+       if (fp != NULL && prefs_common_unsafe_ssl_certs()) {
+               filename = g_strconcat(host, ".", port, ".", fp, ".cert", NULL);
+       } else {
+               filename = g_strconcat(host, ".", port, ".cert", NULL);
+       }
+       subst_for_filename(filename);
+
+       ret = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+                 "certs", G_DIR_SEPARATOR_S,
+                 filename, NULL);
+
+       g_free(filename);
+       return ret;
 }
 
 static gchar *get_certificate_chain_path(const gchar *host, const gchar *port, const gchar *fp)
@@ -168,11 +176,14 @@ static void gnutls_export_X509_fp(FILE *fp, gnutls_x509_crt_t x509_cert, gnutls_
        int r;
        
        if ((r = gnutls_x509_crt_export(x509_cert, format, output, &cert_size)) < 0) {
-               g_warning("couldn't export cert %s (%zd)", gnutls_strerror(r), cert_size);
+               g_warning("couldn't export cert %s (%"G_GSIZE_FORMAT")", gnutls_strerror(r), cert_size);
                return;
        }
-
+#ifdef G_OS_WIN32
+       debug_print("writing %Iu bytes\n",cert_size);
+#else
        debug_print("writing %zd bytes\n",cert_size);
+#endif
        if (claws_fwrite(&output, 1, cert_size, fp) < cert_size) {
                g_warning("failed to write cert: %d %s", errno, g_strerror(errno));
        }
@@ -189,7 +200,7 @@ size_t gnutls_i2d_X509(gnutls_x509_crt_t x509_cert, unsigned char **output)
        *output = malloc(cert_size);
 
        if ((r = gnutls_x509_crt_export(x509_cert, GNUTLS_X509_FMT_DER, *output, &cert_size)) < 0) {
-               g_warning("couldn't export cert %s (%zd)", gnutls_strerror(r), cert_size);
+               g_warning("couldn't export cert %s (%"G_GSIZE_FORMAT")", gnutls_strerror(r), cert_size);
                free(*output);
                *output = NULL;
                return 0;
@@ -208,7 +219,7 @@ size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey_t pkey, unsigned char **output)
        *output = malloc(key_size);
 
        if ((r = gnutls_x509_privkey_export(pkey, GNUTLS_X509_FMT_DER, *output, &key_size)) < 0) {
-               g_warning("couldn't export key %s (%zd)", gnutls_strerror(r), key_size);
+               g_warning("couldn't export key %s (%"G_GSIZE_FORMAT")", gnutls_strerror(r), key_size);
                free(*output);
                *output = NULL;
                return 0;
@@ -502,7 +513,7 @@ static gboolean ssl_certificate_compare (SSLCertificate *cert_a, SSLCertificate
                return FALSE;
        }
        if (cert_size_a != cert_size_b) {
-               g_warning("size differ %zd %zd", cert_size_a, cert_size_b);
+               g_warning("size differ %"G_GSIZE_FORMAT" %"G_GSIZE_FORMAT, cert_size_a, cert_size_b);
                g_free(output_a);
                g_free(output_b);
                return FALSE;