gmime r1545 - trunk/tests
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: gmime r1545 - trunk/tests
- Date: Thu, 2 Apr 2009 18:04:20 +0000 (UTC)
Author: fejj
Date: Thu Apr 2 18:04:20 2009
New Revision: 1545
URL: http://svn.gnome.org/viewvc/gmime?rev=1545&view=rev
Log:
use %z for size_t/ssize_t printf formatters
Modified:
trunk/tests/test-cat.c
trunk/tests/test-headers.c
trunk/tests/test-iconv.c
trunk/tests/test-mbox.c
trunk/tests/test-mime.c
trunk/tests/test-parser.c
trunk/tests/test-pgp.c
trunk/tests/test-streams.c
Modified: trunk/tests/test-cat.c
==============================================================================
--- trunk/tests/test-cat.c (original)
+++ trunk/tests/test-cat.c Thu Apr 2 18:04:20 2009
@@ -44,7 +44,7 @@
extern int verbose;
-#define d(x)
+#define d(x)
#define v(x) if (verbose > 3) x;
@@ -59,7 +59,7 @@
/* read between 4k and 14k bytes */
size = 4096 + (size_t) (10240.0 * (rand () / (RAND_MAX + 1.0)));
- v(fprintf (stdout, "Generating " SIZE_T " bytes of random data... ", size));
+ v(fprintf (stdout, "Generating %zu bytes of random data... ", size));
v(fflush (stdout));
g_mkdir_with_parents (datadir, 0755);
@@ -138,19 +138,19 @@
nread = 0;
totalread += n;
- d(fprintf (stderr, "read " SIZE_T " bytes from original stream\n", size));
+ d(fprintf (stderr, "read %zu bytes from original stream\n", size));
do {
if ((n = g_mime_stream_read (dup, dbuf + nread, size - nread)) <= 0) {
- d(fprintf (stderr, "dup read() returned " SSIZE_T ", EOF\n", n));
+ d(fprintf (stderr, "dup read() returned %zd, EOF\n", n));
break;
}
- d(fprintf (stderr, "read " SSIZE_T " bytes from dup stream\n", n));
+ d(fprintf (stderr, "read %zd bytes from dup stream\n", n));
nread += n;
} while (nread < size);
if (nread < size) {
- sprintf (errstr, "Error: `%s' appears to be truncated, short %u+ bytes\n",
+ sprintf (errstr, "Error: `%s' appears to be truncated, short %zu+ bytes\n",
filename, size - nread);
goto fail;
}
@@ -159,7 +159,7 @@
sprintf (errstr, "Error: `%s': content does not match\n", filename);
goto fail;
} else {
- d(fprintf (stderr, SIZE_T " bytes identical\n", size));
+ d(fprintf (stderr, "%zu bytes identical\n", size));
}
}
Modified: trunk/tests/test-headers.c
==============================================================================
--- trunk/tests/test-headers.c (original)
+++ trunk/tests/test-headers.c Thu Apr 2 18:04:20 2009
@@ -368,13 +368,12 @@
static void
test_header_sync (void)
{
- InternetAddressList *members, *list;
+ InternetAddressList *list;
InternetAddress *addr, *ia;
GMimeMessage *message;
GMimeObject *object;
const char *value;
GMimePart *part;
- int i;
part = g_mime_part_new_with_type ("application", "octet-stream");
object = (GMimeObject *) part;
Modified: trunk/tests/test-iconv.c
==============================================================================
--- trunk/tests/test-iconv.c (original)
+++ trunk/tests/test-iconv.c Thu Apr 2 18:04:20 2009
@@ -30,10 +30,8 @@
#include "testsuite.h"
-#ifndef G_OS_WIN32
-#define ENABLE_ZENTIMER
+/*#define ENABLE_ZENTIMER*/
#include "zentimer.h"
-#endif
#ifdef TEST_CACHE
static char *charsets[] = {
Modified: trunk/tests/test-mbox.c
==============================================================================
--- trunk/tests/test-mbox.c (original)
+++ trunk/tests/test-mbox.c Thu Apr 2 18:04:20 2009
@@ -168,19 +168,19 @@
nread = 0;
totalread += n;
- d(fprintf (stderr, "read " SIZE_T " bytes from istream\n", size));
+ d(fprintf (stderr, "read %zu bytes from istream\n", size));
do {
if ((n = g_mime_stream_read (ostream, dbuf + nread, size - nread)) <= 0) {
- fprintf (stderr, "ostream's read(%p, dbuf + " SIZE_T ", " SIZE_T ") returned " SSIZE_T ", EOF\n", ostream, nread, size - nread, n);
+ fprintf (stderr, "ostream's read(%p, dbuf + %zu, %zu) returned %zd, EOF\n", ostream, nread, size - nread, n);
break;
}
- d(fprintf (stderr, "read " SSIZE_T " bytes from ostream\n", n));
+ d(fprintf (stderr, "read %zd bytes from ostream\n", n));
nread += n;
} while (nread < size);
if (nread < size) {
- sprintf (errstr, "Error: ostream appears to be truncated, short %u+ bytes\n",
+ sprintf (errstr, "Error: ostream appears to be truncated, short %zu+ bytes\n",
size - nread);
goto fail;
}
@@ -204,7 +204,7 @@
bufend - bufptr, bufptr, bufend - bufptr, dbufptr);*/
goto fail;
} else {
- d(fprintf (stderr, SIZE_T " bytes identical\n", size));
+ d(fprintf (stderr, "%zu bytes identical\n", size));
}
offset += size;
Modified: trunk/tests/test-mime.c
==============================================================================
--- trunk/tests/test-mime.c (original)
+++ trunk/tests/test-mime.c Thu Apr 2 18:04:20 2009
@@ -328,6 +328,7 @@
"OT - ich =?iso-8859-1?b?d2Vp3yw=?= trotzdem" },
};
+#if 0
static struct {
const char *input;
const char *decoded;
@@ -335,6 +336,7 @@
} rfc2047_phrase[] = {
/* FIXME: add some phrase tests */
};
+#endif
static void
test_rfc2047 (gboolean test_broken)
Modified: trunk/tests/test-parser.c
==============================================================================
--- trunk/tests/test-parser.c (original)
+++ trunk/tests/test-parser.c Thu Apr 2 18:04:20 2009
@@ -94,7 +94,6 @@
{
GMimeParser *parser;
GMimeMessage *message;
- gboolean is_html;
char *text;
fprintf (stdout, "\nTesting MIME parser...\n\n");
Modified: trunk/tests/test-pgp.c
==============================================================================
--- trunk/tests/test-pgp.c (original)
+++ trunk/tests/test-pgp.c Thu Apr 2 18:04:20 2009
@@ -257,7 +257,7 @@
throw (ex);
}
- inbuf = GMIME_STREAM_MEM (istream)->buffer->data;
+ inbuf = (const char *) GMIME_STREAM_MEM (istream)->buffer->data;
inlen = GMIME_STREAM_MEM (istream)->buffer->len;
if ((inptr = strstr (inbuf, "\n\n"))) {
/* skip past the headers which may have different version numbers */
@@ -266,7 +266,7 @@
inbuf = inptr;
}
- outbuf = GMIME_STREAM_MEM (ostream)->buffer->data;
+ outbuf = (const char *) GMIME_STREAM_MEM (ostream)->buffer->data;
outlen = GMIME_STREAM_MEM (ostream)->buffer->len;
if ((inptr = strstr (outbuf, "\n\n"))) {
/* skip past the headers which may have different version numbers */
Modified: trunk/tests/test-streams.c
==============================================================================
--- trunk/tests/test-streams.c (original)
+++ trunk/tests/test-streams.c Thu Apr 2 18:04:20 2009
@@ -60,7 +60,7 @@
if (streams[0]->bound_end != -1) {
totalsize = streams[0]->bound_end - streams[0]->position;
} else if ((n = g_mime_stream_length (streams[0])) == -1) {
- sprintf (errstr, "Error: Unable to get length of original stream\n");
+ sprintf (errstr, "Error: Unable to get length of original stream: %s\n", g_strerror (errno));
goto fail;
} else if (n < (streams[0]->position - streams[0]->bound_start)) {
sprintf (errstr, "Error: Overflow on original stream?\n");
@@ -77,19 +77,19 @@
nread = 0;
totalread += n;
- d(fprintf (stderr, "read " SIZE_T " bytes from stream[0]\n", size));
+ d(fprintf (stderr, "read %zu bytes from stream[0]\n", size));
do {
if ((n = g_mime_stream_read (streams[1], dbuf + nread, size - nread)) <= 0) {
- d(fprintf (stderr, "stream[1] read() returned " SSIZE_T ", EOF\n", n));
+ d(fprintf (stderr, "stream[1] read() returned %zd, EOF\n", n));
break;
}
- d(fprintf (stderr, "read " SSIZE_T " bytes from stream[1]\n", n));
+ d(fprintf (stderr, "read %zd bytes from stream[1]\n", n));
nread += n;
} while (nread < size);
if (nread < size) {
- sprintf (errstr, "Error: `%s' appears to be truncated, short %u+ bytes\n",
+ sprintf (errstr, "Error: `%s' appears to be truncated, short %zu+ bytes\n",
filename, size - nread);
goto fail;
}
@@ -98,7 +98,7 @@
sprintf (errstr, "Error: `%s': content does not match\n", filename);
goto fail;
} else {
- d(fprintf (stderr, "%u bytes identical\n", size));
+ d(fprintf (stderr, "%zu bytes identical\n", size));
}
}
@@ -132,7 +132,7 @@
FILE *fp;
if (!(fp = fopen (filename, "r+")))
- throw (exception_new ("could not open `%s': %s", filename, strerror (errno)));
+ throw (exception_new ("could not open `%s': %s", filename, g_strerror (errno)));
while (!g_mime_stream_eos (stream)) {
rbuf[0] = '\0';
@@ -146,8 +146,8 @@
fclose (fp);
if (strcmp (sbuf, rbuf) != 0) {
- v(fprintf (stderr, "\tstream: \"%s\" (" SIZE_T ")\n", sbuf, strlen (sbuf)));
- v(fprintf (stderr, "\treal: \"%s\" (" SIZE_T ")\n", rbuf, strlen (rbuf)));
+ v(fprintf (stderr, "\tstream: \"%s\" (%zu)\n", sbuf, strlen (sbuf)));
+ v(fprintf (stderr, "\treal: \"%s\" (%zu)\n", rbuf, strlen (rbuf)));
throw (exception_new ("streams did not match"));
}
}
@@ -155,7 +155,7 @@
static void
test_stream_buffer_gets (const char *filename)
{
- GMimeStream *stream, *buffered;
+ GMimeStream *stream, *buffered = NULL;
int fd;
if ((fd = open (filename, O_RDONLY)) == -1) {
@@ -204,7 +204,7 @@
int fd;
if ((fd = open (filename, O_RDONLY)) == -1) {
- v(fprintf (stderr, "failed to open %s", filename));
+ v(fprintf (stderr, "failed to open %s: %s\n", filename, g_strerror (errno)));
return;
}
@@ -489,7 +489,7 @@
/* read between 4k and 14k bytes */
size = 4096 + (size_t) (10240.0 * (rand () / (RAND_MAX + 1.0)));
- v(fprintf (stdout, "Generating " SIZE_T " bytes of random data... ", size));
+ v(fprintf (stdout, "Generating %zu bytes of random data... ", size));
v(fflush (stdout));
while (total < size) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]