diff options
author | Bastien Nocera <hadess@hadess.net> | 2012-11-07 22:49:46 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2012-11-07 22:49:46 +0100 |
commit | 6f997be4378231bc99ad1fa18504c6db7cc8c7ed (patch) | |
tree | fcade704b3cc6766ff42352430e5a22c29923a7d /plparse/tests | |
parent | 5ad5be6b6848e6de8699013b8a9bfa8aa4bbdfd7 (diff) | |
download | totem-pl-parser-6f997be4378231bc99ad1fa18504c6db7cc8c7ed.tar.gz |
tests: Fix short-reads in parseability tests
Diffstat (limited to 'plparse/tests')
-rw-r--r-- | plparse/tests/parser.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c index 181c1d7..af7b1b2 100644 --- a/plparse/tests/parser.c +++ b/plparse/tests/parser.c @@ -144,11 +144,12 @@ test_date (void) static char * test_data_get_data (const char *uri, guint *len) { - gssize bytes_read; + gsize bytes_read; GFileInputStream *stream; GFile *file; GError *error = NULL; char *buffer; + gboolean res; *len = 0; @@ -175,14 +176,9 @@ test_data_get_data (const char *uri, guint *len) g_object_unref (file); buffer = g_malloc (MIME_READ_CHUNK_SIZE); - bytes_read = g_input_stream_read (G_INPUT_STREAM (stream), buffer, MIME_READ_CHUNK_SIZE, NULL, &error); + res = g_input_stream_read_all (G_INPUT_STREAM (stream), buffer, MIME_READ_CHUNK_SIZE, &bytes_read, NULL, &error); g_object_unref (G_INPUT_STREAM (stream)); - if (bytes_read == -1) { - g_free (buffer); - return NULL; - } - - if (bytes_read == -1) { + if (res == FALSE) { g_test_message ("URI '%s' couldn't be read or closed in _get_mime_type_with_data: '%s'", uri, error->message); g_error_free (error); g_free (buffer); |