r18748 - gnucash/trunk - Win32 compatibility: Use glib wrappers of non-usual POSIX functions.

Christian Stimming cstim at code.gnucash.org
Sat Feb 27 13:39:15 EST 2010


Author: cstim
Date: 2010-02-27 13:39:15 -0500 (Sat, 27 Feb 2010)
New Revision: 18748
Trac: http://svn.gnucash.org/trac/changeset/18748

Modified:
   gnucash/trunk/lib/libc/strptime.c
   gnucash/trunk/src/backend/xml/sixtp-dom-parsers.c
   gnucash/trunk/src/engine/gnc-pricedb.c
   gnucash/trunk/src/libqof/qof/gnc-numeric.c
   gnucash/trunk/src/libqof/qof/guid.c
   gnucash/trunk/src/libqof/qof/qofsession.c
   gnucash/trunk/src/libqof/qof/qofsql.c
Log:
Win32 compatibility: Use glib wrappers of non-usual POSIX functions.

Modified: gnucash/trunk/lib/libc/strptime.c
===================================================================
--- gnucash/trunk/lib/libc/strptime.c	2010-02-27 18:38:52 UTC (rev 18747)
+++ gnucash/trunk/lib/libc/strptime.c	2010-02-27 18:39:15 UTC (rev 18748)
@@ -219,13 +219,13 @@
 #if defined __GNUC__ && __GNUC__ >= 2
 # define match_string(cs1, s2) \
   ({ size_t len = strlen (cs1);						      \
-     int result = strncasecmp ((cs1), (s2), len) == 0;			      \
+     int result = g_strncasecmp ((cs1), (s2), len) == 0;			      \
      if (result) (s2) += len;						      \
      result; })
 #else
 /* Oh come on.  Get a reasonable compiler.  */
 # define match_string(cs1, s2) \
-  (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
+  (g_strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
 #endif
 /* We intentionally do not use isdigit() for testing because this will
    lead to problems with the wide character version.  */
@@ -261,7 +261,7 @@
 	  while (*alts != '\0')						      \
 	    {								      \
 	      size_t len = strlen (alts);				      \
-	      if (strncasecmp (alts, rp, len) == 0)			      \
+	      if (g_strncasecmp (alts, rp, len) == 0)			      \
 	        break;							      \
 	      alts += len + 1;						      \
 	      ++val;							      \

Modified: gnucash/trunk/src/backend/xml/sixtp-dom-parsers.c
===================================================================
--- gnucash/trunk/src/backend/xml/sixtp-dom-parsers.c	2010-02-27 18:38:52 UTC (rev 18747)
+++ gnucash/trunk/src/backend/xml/sixtp-dom-parsers.c	2010-02-27 18:39:15 UTC (rev 18748)
@@ -144,12 +144,12 @@
     gchar* text;
 
     text = dom_tree_to_text(node);
-    if (strcasecmp(text, "true") == 0)
+    if (g_strcasecmp(text, "true") == 0)
     {
         *b = TRUE;
         return TRUE;
     }
-    else if (strcasecmp(text, "false") == 0)
+    else if (g_strcasecmp(text, "false") == 0)
     {
         *b = FALSE;
         return TRUE;

Modified: gnucash/trunk/src/engine/gnc-pricedb.c
===================================================================
--- gnucash/trunk/src/engine/gnc-pricedb.c	2010-02-27 18:38:52 UTC (rev 18747)
+++ gnucash/trunk/src/engine/gnc-pricedb.c	2010-02-27 18:39:15 UTC (rev 18748)
@@ -2470,7 +2470,7 @@
   commodity = gnc_price_get_commodity(pr);
   currency = gnc_price_get_currency(pr);
 
-  snprintf (buff, 2048, "%s %s / %s on %s", val,
+  g_snprintf (buff, 2048, "%s %s / %s on %s", val,
         gnc_commodity_get_unique_name(commodity),
         gnc_commodity_get_unique_name(currency),
         da);

Modified: gnucash/trunk/src/libqof/qof/gnc-numeric.c
===================================================================
--- gnucash/trunk/src/libqof/qof/gnc-numeric.c	2010-02-27 18:38:52 UTC (rev 18747)
+++ gnucash/trunk/src/libqof/qof/gnc-numeric.c	2010-02-27 18:39:15 UTC (rev 18748)
@@ -1386,11 +1386,11 @@
         return FALSE;
     }
 #else
-    tmpnum = strtoll (str, NULL, 0);
+    tmpnum = g_ascii_strtoll (str, NULL, 0);
     str = strchr (str, '/');
     if (!str) return FALSE;
     str ++;
-    tmpdenom = strtoll (str, NULL, 0);
+    tmpdenom = g_ascii_strtoll (str, NULL, 0);
     num_read = strspn (str, "0123456789");
 #endif
     n->num = tmpnum;

Modified: gnucash/trunk/src/libqof/qof/guid.c
===================================================================
--- gnucash/trunk/src/libqof/qof/guid.c	2010-02-27 18:38:52 UTC (rev 18747)
+++ gnucash/trunk/src/libqof/qof/guid.c	2010-02-27 18:39:15 UTC (rev 18748)
@@ -257,7 +257,7 @@
         md5_process_bytes(de, strlen(de), &guid_context);
         total += strlen(de);
 
-        result = snprintf(filename, sizeof(filename),
+        result = g_snprintf(filename, sizeof(filename),
                           "%s/%s", dirname, de);
         if ((result < 0) || (result >= (int)sizeof(filename)))
             continue;

Modified: gnucash/trunk/src/libqof/qof/qofsession.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofsession.c	2010-02-27 18:38:52 UTC (rev 18747)
+++ gnucash/trunk/src/libqof/qof/qofsession.c	2010-02-27 18:39:15 UTC (rev 18748)
@@ -1095,7 +1095,7 @@
     {
         prov = p->data;
         /* Does this provider handle the desired access method? */
-        if (0 == strcasecmp (access_method, prov->access_method))
+        if (0 == g_ascii_strcasecmp (access_method, prov->access_method))
         {
             /* More than one backend could provide this
             access method, check file type compatibility. */
@@ -1453,7 +1453,7 @@
             {
                 /** \todo check the access_method too, not in scope here, yet. */
                 /*	if((TRUE == prov->partial_book_supported) &&
-                (0 == strcasecmp (access_method, prov->access_method)))
+                (0 == g_ascii_strcasecmp (access_method, prov->access_method)))
                 {*/
                 if (NULL == prov->backend_new) continue;
                 /* Use the providers creation callback */

Modified: gnucash/trunk/src/libqof/qof/qofsql.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofsql.c	2010-02-27 18:38:52 UTC (rev 18747)
+++ gnucash/trunk/src/libqof/qof/qofsql.c	2010-02-27 18:39:15 UTC (rev 18748)
@@ -214,7 +214,7 @@
 
     /* Look to see if its the special KVP value holder.
      * If it is, look up the value. */
-    if (0 == strncasecmp (qvalue_name, "kvp://", 6))
+    if (0 == g_ascii_strncasecmp (qvalue_name, "kvp://", 6))
     {
         if (NULL == query->kvp_join)
         {



More information about the gnucash-changes mailing list