From f101adee5cd04c1ffc94cc54a960c9b523ee1f22 Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sat, 27 Feb 2010 18:39:15 +0000 Subject: [PATCH] Win32 compatibility: Use glib wrappers of non-usual POSIX functions. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18748 57a11ea4-9604-0410-9ed3-97b8803252fd --- lib/libc/strptime.c | 6 +++--- src/backend/xml/sixtp-dom-parsers.c | 4 ++-- src/engine/gnc-pricedb.c | 2 +- src/libqof/qof/gnc-numeric.c | 4 ++-- src/libqof/qof/guid.c | 2 +- src/libqof/qof/qofsession.c | 4 ++-- src/libqof/qof/qofsql.c | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/libc/strptime.c b/lib/libc/strptime.c index 03b878001d..1a85ff922e 100644 --- a/lib/libc/strptime.c +++ b/lib/libc/strptime.c @@ -219,13 +219,13 @@ translate_win32_picture (const char *picture) #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 @@ translate_win32_picture (const char *picture) 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; \ diff --git a/src/backend/xml/sixtp-dom-parsers.c b/src/backend/xml/sixtp-dom-parsers.c index ca3bba0b17..cf2c03751e 100644 --- a/src/backend/xml/sixtp-dom-parsers.c +++ b/src/backend/xml/sixtp-dom-parsers.c @@ -144,12 +144,12 @@ dom_tree_to_boolean(xmlNodePtr node, gboolean* b) 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; diff --git a/src/engine/gnc-pricedb.c b/src/engine/gnc-pricedb.c index d7aa8eac11..d45d13beec 100644 --- a/src/engine/gnc-pricedb.c +++ b/src/engine/gnc-pricedb.c @@ -2470,7 +2470,7 @@ price_printable(gpointer obj) 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); diff --git a/src/libqof/qof/gnc-numeric.c b/src/libqof/qof/gnc-numeric.c index 7575c3a196..30ab45b3d9 100644 --- a/src/libqof/qof/gnc-numeric.c +++ b/src/libqof/qof/gnc-numeric.c @@ -1386,11 +1386,11 @@ string_to_gnc_numeric(const gchar* str, gnc_numeric *n) 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; diff --git a/src/libqof/qof/guid.c b/src/libqof/qof/guid.c index c549b2cf0d..9fabde84b3 100644 --- a/src/libqof/qof/guid.c +++ b/src/libqof/qof/guid.c @@ -257,7 +257,7 @@ init_from_dir(const char *dirname, unsigned int max_files) 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; diff --git a/src/libqof/qof/qofsession.c b/src/libqof/qof/qofsession.c index f195757610..4d104e3f1d 100644 --- a/src/libqof/qof/qofsession.c +++ b/src/libqof/qof/qofsession.c @@ -1095,7 +1095,7 @@ qof_session_load_backend(QofSession * session, const char * access_method) { 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 @@ qof_session_save (QofSession *session, { /** \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 */ diff --git a/src/libqof/qof/qofsql.c b/src/libqof/qof/qofsql.c index a26b8f427b..a6c5f7607f 100644 --- a/src/libqof/qof/qofsql.c +++ b/src/libqof/qof/qofsql.c @@ -214,7 +214,7 @@ handle_single_condition (QofSqlQuery *query, sql_condition * cond) /* 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) {