From 605eda115a7061488d2fb0e4264338598ea904d4 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Wed, 3 Dec 2003 19:23:16 +0000 Subject: Fix strftime(3) usage. 2003-12-03 Christian Persch * embed/mozilla/GtkNSSDialogs.cpp: * src/pdm-dialog.c: (show_cookies_properties): Fix strftime(3) usage. --- ChangeLog | 7 +++++++ embed/mozilla/GtkNSSDialogs.cpp | 7 +++++-- src/pdm-dialog.c | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ffaf0c71a..a8883e63d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-12-03 Christian Persch + + * embed/mozilla/GtkNSSDialogs.cpp: + * src/pdm-dialog.c: (show_cookies_properties): + + Fix strftime(3) usage. + 2003-12-03 Christian Persch * src/pdm-dialog.c: (pdm_cmd_delete_selection), (compare_cookies): diff --git a/embed/mozilla/GtkNSSDialogs.cpp b/embed/mozilla/GtkNSSDialogs.cpp index 410293e52..94d8e9527 100644 --- a/embed/mozilla/GtkNSSDialogs.cpp +++ b/embed/mozilla/GtkNSSDialogs.cpp @@ -391,7 +391,8 @@ GtkNSSDialogs::ConfirmCertExpired (nsIInterfaceRequestor *ctx, nsAutoString commonName; time_t t; struct tm tm; - char formattedDate[32]; + char formattedDate[128]; + char *fdate; const char *primary, *text; char *ttCommonName, *secondary, *msg; @@ -430,11 +431,12 @@ GtkNSSDialogs::ConfirmCertExpired (nsIInterfaceRequestor *ctx, * strftime(3) */ strftime (formattedDate, sizeof(formattedDate), _("%a %d %b %Y"), localtime_r (&t, &tm)); + fdate = g_locale_to_utf8 (formattedDate, -1, NULL, NULL, NULL); ttCommonName = g_strdup_printf ("\"%s\"", NS_ConvertUCS2toUTF8(commonName).get()); - secondary = g_strdup_printf (text, ttCommonName, formattedDate); + secondary = g_strdup_printf (text, ttCommonName, fdate); msg = g_strdup_printf ("%s\n\n%s\n\n%s", primary, secondary, @@ -442,6 +444,7 @@ GtkNSSDialogs::ConfirmCertExpired (nsIInterfaceRequestor *ctx, int res = display_cert_warning_box (ctx, cert, msg, NULL, NULL, NULL); + g_free (fdate); g_free (msg); g_free (secondary); g_free (ttCommonName); diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index df1002f23..69c63b4ae 100755 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -946,7 +946,11 @@ show_cookies_properties (PdmDialog *dialog, } else { - str = g_strdup_printf ("%s",ctime((time_t*)&info->expires)); + struct tm t; + char s[128]; + const char *fmt_hack = "%c"; + strftime (s, sizeof(s), fmt_hack, localtime_r (&info->expires, &t)); + str = g_locale_to_utf8 (s, -1, NULL, NULL, NULL); } label = gtk_label_new (str); g_free (str); -- cgit v1.2.3