* add widgets/ to DIST_SUBDIRS
[modest] / src / modest-text-utils.c
index ddf2476..27a829c 100644 (file)
@@ -1,9 +1,38 @@
-/* modest-ui.c */
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
-/* insert (c)/licensing information) */
+/* modest-ui.c */
 
 #include <gtk/gtk.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include "modest-text-utils.h"
 
@@ -74,7 +103,6 @@ get_indent_level (const char *l)
 static void
 unquote_line (GString * l)
 {
-       GString *r;
        gchar *p;
 
        p = l->str;
@@ -170,18 +198,29 @@ get_breakpoint (const gchar * s, const gint indent, const gint limit)
 }
 
 
+
+/* just to prevent warnings:
+ * warning: `%x' yields only last 2 digits of year in some locales
+ */
+static size_t
+my_strftime(char *s, size_t max, const char  *fmt,  const
+           struct tm *tm) {
+       return strftime(s, max, fmt, tm);
+}
+
+
 gchar *
 modest_text_utils_quote (const gchar * to_quote, const gchar * from,
                         const time_t sent_date, const int limit)
 {
        const gchar *iter;
-       gint indent, breakpoint, rem_indent;
+       gint indent, breakpoint, rem_indent = 0;
        gchar sent_str[101];
        GString *q, *l, *remaining;
        gsize len;
 
        /* format sent_date */
-       strftime (sent_str, 100, "%c", localtime (&sent_date));
+       my_strftime (sent_str, 100, "%c", localtime (&sent_date));
        q = g_string_new ("");
        g_string_printf (q, "On %s, %s wrote:\n", sent_str, from);