[gmime] Use g_strerror() instead of strerror()
- From: Jeffrey Stedfast <fejj src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gmime] Use g_strerror() instead of strerror()
- Date: Sun, 20 Sep 2009 00:35:13 +0000 (UTC)
commit 1bd653357309d8a341c27997824d7cc41d1928e1
Author: Jeffrey Stedfast <fejj gnome org>
Date: Sat Sep 19 20:35:47 2009 -0400
Use g_strerror() instead of strerror()
tests/test-cat.c | 22 +++++++++++-----------
tests/test-mbox.c | 6 +++---
tests/test-pgp.c | 7 +++++--
tests/test-pgpmime.c | 2 +-
4 files changed, 20 insertions(+), 17 deletions(-)
---
diff --git a/tests/test-cat.c b/tests/test-cat.c
index ef693aa..9a00542 100644
--- a/tests/test-cat.c
+++ b/tests/test-cat.c
@@ -66,7 +66,7 @@ random_whole_stream (const char *datadir, char **filename)
snprintf (buf, sizeof (buf), "%s%cstream.%u", datadir, G_DIR_SEPARATOR, getpid ());
if ((fd = open (buf, O_CREAT | O_TRUNC | O_RDWR, 0666)) == -1) {
- fprintf (stderr, "Error: Cannot create `%s': %s\n", buf, strerror (errno));
+ fprintf (stderr, "Error: Cannot create `%s': %s\n", buf, g_strerror (errno));
exit (EXIT_FAILURE);
}
@@ -200,7 +200,7 @@ test_cat_write (GMimeStream *whole, struct _StreamPart *parts, int bounded)
part->filename, part->pstart, part->pend));
if ((fd = open (part->filename, O_CREAT | O_TRUNC | O_WRONLY, 0666)) == -1) {
- ex = exception_new ("could not create `%s': %s", part->filename, strerror (errno));
+ ex = exception_new ("could not create `%s': %s", part->filename, g_strerror (errno));
throw (ex);
}
@@ -213,7 +213,7 @@ test_cat_write (GMimeStream *whole, struct _StreamPart *parts, int bounded)
g_mime_stream_reset (whole);
if (g_mime_stream_write_to_stream (whole, (GMimeStream *) cat) == -1) {
- ex = exception_new ("%s", strerror (errno));
+ ex = exception_new ("%s", g_strerror (errno));
g_object_unref (cat);
throw (ex);
}
@@ -226,7 +226,7 @@ test_cat_write (GMimeStream *whole, struct _StreamPart *parts, int bounded)
while (part != NULL) {
d(fprintf (stderr, "checking substream %s\n", part->filename));
if ((fd = open (part->filename, O_RDONLY)) == -1) {
- ex = exception_new ("could not open `%s': %s", part->filename, strerror (errno));
+ ex = exception_new ("could not open `%s': %s", part->filename, g_strerror (errno));
throw (ex);
}
@@ -272,7 +272,7 @@ test_cat_read (GMimeStream *whole, struct _StreamPart *parts, int bounded)
part->filename, part->pstart, part->pend));
if ((fd = open (part->filename, O_RDONLY)) == -1) {
- ex = exception_new ("could not open `%s': %s", part->filename, strerror (errno));
+ ex = exception_new ("could not open `%s': %s", part->filename, g_strerror (errno));
g_object_unref (cat);
throw (ex);
}
@@ -319,7 +319,7 @@ test_cat_seek (GMimeStream *whole, struct _StreamPart *parts, int bounded)
part->filename, part->pstart, part->pend));
if ((fd = open (part->filename, O_RDONLY)) == -1) {
- ex = exception_new ("could not open `%s': %s", part->filename, strerror (errno));
+ ex = exception_new ("could not open `%s': %s", part->filename, g_strerror (errno));
g_object_unref (cat);
throw (ex);
}
@@ -336,13 +336,13 @@ test_cat_seek (GMimeStream *whole, struct _StreamPart *parts, int bounded)
if (g_mime_stream_seek (whole, offset, GMIME_STREAM_SEEK_SET) == -1) {
ex = exception_new ("could not seek to %lld in original stream: %s",
- offset, strerror (errno));
+ offset, g_strerror (errno));
throw (ex);
}
if (g_mime_stream_seek (cat, offset, GMIME_STREAM_SEEK_SET) == -1) {
ex = exception_new ("could not seek to %lld: %s",
- offset, strerror (errno));
+ offset, g_strerror (errno));
throw (ex);
}
@@ -380,7 +380,7 @@ test_cat_substream (GMimeStream *whole, struct _StreamPart *parts, int bounded)
part->filename, part->pstart, part->pend));
if ((fd = open (part->filename, O_RDONLY)) == -1) {
- ex = exception_new ("could not open `%s': %s", part->filename, strerror (errno));
+ ex = exception_new ("could not open `%s': %s", part->filename, g_strerror (errno));
g_object_unref (cat);
throw (ex);
}
@@ -401,13 +401,13 @@ test_cat_substream (GMimeStream *whole, struct _StreamPart *parts, int bounded)
if (!(sub1 = g_mime_stream_substream (whole, start, end))) {
ex = exception_new ("could not substream the original stream: %s",
- strerror (errno));
+ g_strerror (errno));
g_object_unref (cat);
throw (ex);
}
if (!(sub2 = g_mime_stream_substream (cat, start, end))) {
- ex = exception_new ("%s", strerror (errno));
+ ex = exception_new ("%s", g_strerror (errno));
g_object_unref (sub1);
g_object_unref (cat);
throw (ex);
diff --git a/tests/test-mbox.c b/tests/test-mbox.c
index b548aa8..ea36143 100644
--- a/tests/test-mbox.c
+++ b/tests/test-mbox.c
@@ -302,14 +302,14 @@ int main (int argc, char **argv)
try {
if ((fd = open (input, O_RDONLY)) == -1) {
throw (exception_new ("could not open `%s': %s",
- input, strerror (errno)));
+ input, g_strerror (errno)));
}
istream = g_mime_stream_fs_new (fd);
if ((fd = open (output, O_RDONLY)) == -1) {
throw (exception_new ("could not open `%s': %s",
- output, strerror (errno)));
+ output, g_strerror (errno)));
}
ostream = g_mime_stream_fs_new (fd);
@@ -318,7 +318,7 @@ int main (int argc, char **argv)
tmp = g_strdup_printf ("./tmp/%s.XXXXXX", dent->d_name);
if ((fd = g_mkstemp (tmp)) == -1) {
throw (exception_new ("could not open `%s': %s",
- tmp, strerror (errno)));
+ tmp, g_strerror (errno)));
}
mstream = g_mime_stream_fs_new (fd);
diff --git a/tests/test-pgp.c b/tests/test-pgp.c
index 34ae10d..74b4269 100644
--- a/tests/test-pgp.c
+++ b/tests/test-pgp.c
@@ -17,6 +17,9 @@
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
@@ -174,7 +177,7 @@ test_export (GMimeCipherContext *ctx, const char *path)
int fd;
if ((fd = open (path, O_RDONLY)) == -1)
- throw (exception_new ("open() failed: %s", strerror (errno)));
+ throw (exception_new ("open() failed: %s", g_strerror (errno)));
ostream = g_mime_stream_fs_new (fd);
istream = g_mime_stream_mem_new ();
@@ -234,7 +237,7 @@ import_key (GMimeCipherContext *ctx, const char *path)
int fd;
if ((fd = open (path, O_RDONLY)) == -1)
- throw (exception_new ("open() failed: %s", strerror (errno)));
+ throw (exception_new ("open() failed: %s", g_strerror (errno)));
stream = g_mime_stream_fs_new (fd);
g_mime_cipher_context_import_keys (ctx, stream, &err);
diff --git a/tests/test-pgpmime.c b/tests/test-pgpmime.c
index fed11c4..932fbb8 100644
--- a/tests/test-pgpmime.c
+++ b/tests/test-pgpmime.c
@@ -378,7 +378,7 @@ import_key (GMimeCipherContext *ctx, const char *path)
int fd;
if ((fd = open (path, O_RDONLY)) == -1)
- throw (exception_new ("open() failed: %s", strerror (errno)));
+ throw (exception_new ("open() failed: %s", g_strerror (errno)));
stream = g_mime_stream_fs_new (fd);
g_mime_cipher_context_import_keys (ctx, stream, &err);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]