camel-mime-part.c camel-mime-utils.c camel-movemail.c
authorTor Lillqvist <tml@novell.com>
Thu, 15 Sep 2005 17:35:45 +0000 (17:35 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 15 Sep 2005 17:35:45 +0000 (17:35 +0000)
2005-09-15  Tor Lillqvist  <tml@novell.com>

* camel-mime-part.c
* camel-mime-utils.c
* camel-movemail.c
* camel-sasl-popb4smtp.c
* camel-string-utils.c
* camel-url.c: Use g_ascii_str(n)casecmp() instead of
str(n)casecmp(). The strings we are comparing in these cases
should be just ASCII anyway, so spell it out that we really do
need ASCII casefolding only.

camel/ChangeLog
camel/camel-mime-part.c
camel/camel-mime-utils.c
camel/camel-movemail.c
camel/camel-sasl-popb4smtp.c
camel/camel-string-utils.c
camel/camel-url.c

index 728e253..29bac2b 100644 (file)
@@ -3,11 +3,16 @@
        * broken-date-parser.c (get_wday, get_month)
        * camel-folder-search.c (check_header)
        * camel-http-stream.c (http_connect, http_get_statuscode)
-       * camel-mime-filter-enriched.c (param_parse_colour, enriched_to_html): 
-       Use g_ascii_str(n)casecmp() instead of str(n)casecmp(). The
-       strings we are comparing in these cases should be just ASCII
-       anyway, so spell it out that we really do need ASCII casefolding
-       only.
+       * camel-mime-filter-enriched.c (param_parse_colour, enriched_to_html)
+       * camel-mime-part.c
+       * camel-mime-utils.c
+       * camel-movemail.c
+       * camel-sasl-popb4smtp.c
+       * camel-string-utils.c
+       * camel-url.c: Use g_ascii_str(n)casecmp() instead of
+       str(n)casecmp(). The strings we are comparing in these cases
+       should be just ASCII anyway, so spell it out that we really do
+       need ASCII casefolding only.
 
        * camel-debug.c: Use e_util_pthread_id() to identify threads.
 
index 956913d..389d0c6 100644 (file)
 #include <ctype.h>
 #include <errno.h>
 
-#include <libedataserver/e-iconv.h>
+#include "libedataserver/e-iconv.h"
 
-#include "camel-mime-parser.h"
-#include "camel-stream-mem.h"
-#include "camel-stream-filter.h"
+#include "camel-charset-map.h"
+#include "camel-exception.h"
 #include "camel-mime-filter-basic.h"
-#include "camel-mime-filter-crlf.h"
 #include "camel-mime-filter-charset.h"
-#include "camel-mime-part.h"
+#include "camel-mime-filter-crlf.h"
+#include "camel-mime-parser.h"
 #include "camel-mime-part-utils.h"
+#include "camel-mime-part.h"
 #include "camel-mime-utils.h"
-#include "camel-exception.h"
-#include "camel-charset-map.h"
+#include "camel-stream-filter.h"
+#include "camel-stream-mem.h"
 #include "camel-string-utils.h"
 
 #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
@@ -950,7 +950,7 @@ construct_from_parser (CamelMimePart *mime_part, CamelMimeParser *mp)
                        process_header((CamelMedium *)dw, "content-type", content);
 
                while (headers) {
-                       if (strcasecmp(headers->name, "content-type") == 0
+                       if (g_ascii_strcasecmp(headers->name, "content-type") == 0
                            && headers->value != content)
                                camel_medium_add_header((CamelMedium *)dw, "X-Invalid-Content-Type", headers->value);
                        else
index 4bd00e5..e763820 100644 (file)
 #endif
 
 #include <glib.h>
-#include <libedataserver/e-iconv.h>
-#include <libedataserver/e-time-utils.h>
 
-#include "camel-mime-utils.h"
+#include "libedataserver/e-iconv.h"
+#include "libedataserver/e-time-utils.h"
+
 #include "camel-charset-map.h"
+#include "camel-mime-utils.h"
 #include "camel-net-utils.h"
 #include "camel-utf8.h"
 
 #include "broken-date-parser.h"
 #endif
 
+#ifdef G_OS_WIN32
+/* Undef the similar macro from pthread.h, it doesn't check if
+ * gmtime() returns NULL.
+ */
+#undef gmtime_r
+
+/* The gmtime() in Microsoft's C library is MT-safe */
+#define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
+#endif
+
 #if 0
 int strdup_count = 0;
 int malloc_count = 0;
@@ -1297,7 +1308,7 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char *
        
        ascii = g_alloca (bufflen);
        
-       if (strcasecmp (type, "UTF-8") != 0)
+       if (g_ascii_strcasecmp (type, "UTF-8") != 0)
                ic = e_iconv_open (type, "UTF-8");
        
        while (inlen) {
@@ -2151,16 +2162,16 @@ camel_content_type_is(CamelContentType *ct, const char *type, const char *subtyp
 {
        /* no type == text/plain or text/"*" */
        if (ct==NULL || (ct->type == NULL && ct->subtype == NULL)) {
-               return (!strcasecmp(type, "text")
+               return (!g_ascii_strcasecmp(type, "text")
                        && (!g_ascii_strcasecmp(subtype, "plain")
-                           || !strcasecmp(subtype, "*")));
+                           || !strcmp(subtype, "*")));
        }
 
        return (ct->type != NULL
                && (!g_ascii_strcasecmp(ct->type, type)
                    && ((ct->subtype != NULL
                         && !g_ascii_strcasecmp(ct->subtype, subtype))
-                       || !strcasecmp("*", subtype))));
+                       || !strcmp("*", subtype))));
 }
 
 
@@ -3363,7 +3374,7 @@ camel_content_type_decode(const char *in)
                        inptr++;
                        subtype = decode_token(&inptr);
                }
-               if (subtype == NULL && (!strcasecmp(type, "text"))) {
+               if (subtype == NULL && (!g_ascii_strcasecmp(type, "text"))) {
                        w(g_warning("text type with no subtype, resorting to text/plain: %s", in));
                        subtype = g_strdup("plain");
                }
@@ -3829,13 +3840,13 @@ camel_header_raw_append(struct _camel_header_raw **list, const char *name, const
 
        /* debug */
 #if 0
-       if (!strcasecmp(name, "To")) {
+       if (!g_ascii_strcasecmp(name, "To")) {
                printf("- Decoding To\n");
                camel_header_to_decode(value);
-       } else if (!strcasecmp(name, "Content-type")) {
+       } else if (!g_ascii_strcasecmp(name, "Content-type")) {
                printf("- Decoding content-type\n");
                camel_content_type_dump(camel_content_type_decode(value));              
-       } else if (!strcasecmp(name, "MIME-Version")) {
+       } else if (!g_ascii_strcasecmp(name, "MIME-Version")) {
                printf("- Decoding mime version\n");
                camel_header_mime_decode(value);
        }
index d85436e..30838e7 100644 (file)
@@ -410,7 +410,7 @@ solaris_header_write(int fd, struct _camel_header_raw *header)
         iv[3].iov_len = 1;
 
         while (header) {
-               if (strcasecmp(header->name, "Content-Length")) {
+               if (g_ascii_strcasecmp(header->name, "Content-Length")) {
                        iv[0].iov_base = header->name;
                        iv[0].iov_len = strlen(header->name);
                        iv[2].iov_base = header->value;
index c189945..90d6346 100644 (file)
 #include <string.h>
 #include <time.h>
 
+#include "camel-i18n.h"
 #include "camel-sasl-popb4smtp.h"
 #include "camel-service.h"
 #include "camel-session.h"
-#include "camel-i18n.h"
 
 CamelServiceAuthType camel_sasl_popb4smtp_authtype = {
        N_("POP before SMTP"),
@@ -108,7 +108,7 @@ popb4smtp_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
                return NULL;
        }
 
-       if (strncasecmp(popuri, "pop:", 4) != 0) {
+       if (g_ascii_strncasecmp(popuri, "pop:", 4) != 0) {
                camel_exception_setv(ex, 1, _("POP Before SMTP auth using a non-pop source"));
                return NULL;
        }
index 503276d..1825ee1 100644 (file)
@@ -88,7 +88,7 @@ camel_strstrcase (const char *haystack, const char *needle)
                return (char *) haystack;
        
        for (ptr = haystack; *(ptr + len - 1) != '\0'; ptr++)
-               if (!strncasecmp (ptr, needle, len))
+               if (!g_ascii_strncasecmp (ptr, needle, len))
                        return (char *) ptr;
        
        return NULL;
index 0f1a894..34224a3 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#include "camel-url.h"
 #include "camel-exception.h"
+#include "camel-i18n.h"
 #include "camel-mime-utils.h"
 #include "camel-object.h"
 #include "camel-string-utils.h"
-#include "camel-i18n.h"
+#include "camel-url.h"
 
 static void copy_param (GQuark key_id, gpointer data, gpointer user_data);
 static void output_param (GQuark key_id, gpointer data, gpointer user_data);
@@ -110,7 +110,7 @@ camel_url_new_with_base (CamelURL *base, const char *url_string)
 
                        semi = strchr(url_string, ';');
                        if (semi && semi < colon &&
-                           !strncasecmp (semi, ";auth=", 6)) {
+                           !g_ascii_strncasecmp (semi, ";auth=", 6)) {
                                url->authmech = g_strndup (semi + 6,
                                                           colon - semi - 6);
                                camel_url_decode (url->authmech);