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
pull/1/head
Christian Stimming 16 years ago
parent e346345fc4
commit f101adee5c

@ -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; \

@ -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;

@ -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);

@ -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;

@ -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;

@ -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 */

@ -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)
{

Loading…
Cancel
Save