r18798 - gnucash/trunk/src - Reduce compiler warnings by replacing strerror() with g_strerror() and similar glib replacements.
Christian Stimming
cstim at code.gnucash.org
Wed Mar 3 15:46:20 EST 2010
Author: cstim
Date: 2010-03-03 15:46:20 -0500 (Wed, 03 Mar 2010)
New Revision: 18798
Trac: http://svn.gnucash.org/trac/changeset/18798
Modified:
gnucash/trunk/src/backend/xml/gnc-backend-xml.c
gnucash/trunk/src/backend/xml/io-gncxml-v2.c
gnucash/trunk/src/engine/TransLog.c
gnucash/trunk/src/engine/gnc-commodity.c
gnucash/trunk/src/engine/gnc-filepath-utils.c
gnucash/trunk/src/libqof/qof/gnc-date.c
Log:
Reduce compiler warnings by replacing strerror() with g_strerror() and similar glib replacements.
Modified: gnucash/trunk/src/backend/xml/gnc-backend-xml.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2010-03-03 20:45:58 UTC (rev 18797)
+++ gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2010-03-03 20:46:20 UTC (rev 18798)
@@ -342,7 +342,7 @@
if (rv)
{
PWARN("Error on g_unlink(%s): %d: %s", be->lockfile,
- errno, strerror(errno) ? strerror(errno) : "");
+ errno, g_strerror(errno) ? g_strerror(errno) : "");
}
}
@@ -472,7 +472,7 @@
{
qof_backend_set_error((QofBackend*)be, ERR_FILEIO_BACKUP_ERROR);
PWARN ("unable to make file backup from %s to %s: %s",
- orig, bkup, strerror(errno) ? strerror(errno) : "");
+ orig, bkup, g_strerror(errno) ? g_strerror(errno) : "");
return FALSE;
}
}
@@ -657,7 +657,7 @@
failed. Instead, we simply ignore this. */
PWARN("unable to chmod filename %s: %s",
tmp_name ? tmp_name : "(null)",
- strerror(errno) ? strerror(errno) : "");
+ g_strerror(errno) ? g_strerror(errno) : "");
#if VFAT_DOESNT_SUCK /* chmod always fails on vfat/samba fs */
/* g_free(tmp_name); */
/* return FALSE; */
@@ -686,7 +686,7 @@
qof_backend_set_error(be, ERR_BACKEND_READONLY);
PWARN("unable to unlink filename %s: %s",
datafile ? datafile : "(null)",
- strerror(errno) ? strerror(errno) : "");
+ g_strerror(errno) ? g_strerror(errno) : "");
g_free(tmp_name);
LEAVE("");
return FALSE;
@@ -703,7 +703,7 @@
qof_backend_set_error(be, ERR_BACKEND_PERM);
PWARN("unable to unlink temp filename %s: %s",
tmp_name ? tmp_name : "(null)",
- strerror(errno) ? strerror(errno) : "");
+ g_strerror(errno) ? g_strerror(errno) : "");
g_free(tmp_name);
LEAVE("");
return FALSE;
@@ -735,7 +735,7 @@
qof_backend_set_error(be, be_err);
PWARN("unable to unlink temp_filename %s: %s",
tmp_name ? tmp_name : "(null)",
- strerror(errno) ? strerror(errno) : "");
+ g_strerror(errno) ? g_strerror(errno) : "");
/* already in an error just flow on through */
}
else
Modified: gnucash/trunk/src/backend/xml/io-gncxml-v2.c
===================================================================
--- gnucash/trunk/src/backend/xml/io-gncxml-v2.c 2010-03-03 20:45:58 UTC (rev 18797)
+++ gnucash/trunk/src/backend/xml/io-gncxml-v2.c 2010-03-03 20:46:20 UTC (rev 18798)
@@ -1371,7 +1371,7 @@
else
{
g_warning("Could not read from pipe. The error is '%s' (errno %d)",
- strerror(errno), errno);
+ g_strerror(errno) ? g_strerror(errno) : "", errno);
success = 0;
}
}
@@ -1386,7 +1386,7 @@
if (write(params->fd, buffer, gzval) < 0)
{
g_warning("Could not write to pipe. The error is '%s' (%d)",
- strerror(errno), errno);
+ g_strerror(errno) ? g_strerror(errno) : "", errno);
success = 0;
}
}
Modified: gnucash/trunk/src/engine/TransLog.c
===================================================================
--- gnucash/trunk/src/engine/TransLog.c 2010-03-03 20:45:58 UTC (rev 18797)
+++ gnucash/trunk/src/engine/TransLog.c 2010-03-03 20:46:20 UTC (rev 18798)
@@ -169,7 +169,7 @@
{
int norr = errno;
printf ("Error: xaccOpenLog(): cannot open journal \n"
- "\t %d %s\n", norr, strerror (norr));
+ "\t %d %s\n", norr, g_strerror (norr) ? g_strerror (norr) : "");
g_free (filename);
g_free (timestamp);
Modified: gnucash/trunk/src/engine/gnc-commodity.c
===================================================================
--- gnucash/trunk/src/engine/gnc-commodity.c 2010-03-03 20:45:58 UTC (rev 18797)
+++ gnucash/trunk/src/engine/gnc-commodity.c 2010-03-03 20:46:20 UTC (rev 18798)
@@ -299,13 +299,13 @@
/* This name can be changed if/when support for this price source is
* integrated into gnucash. */
- new_source->user_name = strdup(source_name);
+ new_source->user_name = g_strdup(source_name);
/* This name is permanent and must be kept the same if/when support
* for this price source is integrated into gnucash (i.e. for a
* nice user name). */
- new_source->old_internal_name = strdup(source_name);
- new_source->internal_name = strdup(source_name);
+ new_source->old_internal_name = g_strdup(source_name);
+ new_source->internal_name = g_strdup(source_name);
new_quote_sources = g_list_append(new_quote_sources, new_source);
return new_source;
}
Modified: gnucash/trunk/src/engine/gnc-filepath-utils.c
===================================================================
--- gnucash/trunk/src/engine/gnc-filepath-utils.c 2010-03-03 20:45:58 UTC (rev 18797)
+++ gnucash/trunk/src/engine/gnc-filepath-utils.c 2010-03-03 20:46:20 UTC (rev 18798)
@@ -338,7 +338,7 @@
" %s\n"
"Please correct the problem and restart GnuCash.\n"
"The reported error was '%s' (errno %d).\n"),
- dirname, strerror(errno), errno);
+ dirname, g_strerror(errno) ? g_strerror(errno) : "", errno);
exit(1);
}
g_stat (dirname, &statbuf);
@@ -370,7 +370,7 @@
"directory exists and is usable. Please correct the\n"
"problem and restart GnuCash. The reported error \n"
"was '%s' (errno %d)."),
- dirname, strerror(errno), errno);
+ dirname, g_strerror(errno) ? g_strerror(errno) : "", errno);
exit(1);
}
}
Modified: gnucash/trunk/src/libqof/qof/gnc-date.c
===================================================================
--- gnucash/trunk/src/libqof/qof/gnc-date.c 2010-03-03 20:45:58 UTC (rev 18797)
+++ gnucash/trunk/src/libqof/qof/gnc-date.c 2010-03-03 20:46:20 UTC (rev 18798)
@@ -510,7 +510,7 @@
static char buff[MAX_DATE_LENGTH];
time_t t;
- t = ts.tv_sec + (ts.tv_nsec / 1000000000.0);
+ t = ts.tv_sec + (time_t)(ts.tv_nsec / 1000000000.0);
qof_print_date_buff (buff, MAX_DATE_LENGTH, t);
More information about the gnucash-changes
mailing list