[discident-glib] lib: Return copied data if not compressed



commit 37607067d944725684447769701f774eeb03e4e8
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 5 23:56:03 2012 +0100

    lib: Return copied data if not compressed

 discident-glib/discident-ean-glib.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/discident-glib/discident-ean-glib.c b/discident-glib/discident-ean-glib.c
index ee1a439..3a4eadb 100644
--- a/discident-glib/discident-ean-glib.c
+++ b/discident-glib/discident-ean-glib.c
@@ -218,7 +218,8 @@ uncompress (const char *data,
 				     G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
 				     NULL, NULL)) {
 		g_object_unref (output);
-		return NULL;
+		/* Probably not compressed */
+		return g_strndup (data, len);
 	}
 
 	ret = g_strdup (g_memory_output_stream_get_data ((GMemoryOutputStream *) output));
@@ -316,11 +317,6 @@ discident_ean_lookup_sync (DiscidentEan *ean,
 	    msg->response_body != NULL) {
 		response = uncompress (msg->response_body->data,
 				       msg->response_body->length);
-		/* Probably not compressed */
-		if (response == NULL) {
-			response = g_strndup (msg->response_body->data,
-					      msg->response_body->length);
-		}
 	}
 	g_object_unref (msg);
 	g_object_unref (session);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]