From: Reynaldo H. Verdejo Pinochet Date: Thu, 28 Jan 2016 22:48:17 +0000 (-0800) Subject: codecanalyzer: do not use g_error if abort is not desired X-Git-Tag: 1.19.3~491^2~1076 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=13010830b6c5e77caac26ff3551172fef2e5a9ce;p=platform%2Fupstream%2Fgstreamer.git codecanalyzer: do not use g_error if abort is not desired Use g_printerr() instead. g_error() calls abort after outputting the message so these blocks' return statements and free()s were unreachable. Aditionally, fix wrong void returns on non-void function, drop trailing whitespace before newline and add \n's as needed (default handler won't add one). --- diff --git a/codecanalyzer/src/codecanalyzer.c b/codecanalyzer/src/codecanalyzer.c index 061d806299..a835876714 100644 --- a/codecanalyzer/src/codecanalyzer.c +++ b/codecanalyzer/src/codecanalyzer.c @@ -29,6 +29,7 @@ #include #include +#include #include #include "gst_analyzer.h" @@ -1034,13 +1035,13 @@ main (int argc, char *argv[]) ret = analyzer_ui_init (); if (!ret) { - g_error ("Failed to activate the gtk+-3.x backend \n"); + g_printerr ("Failed to activate the gtk+-3.x backend\n"); goto done; } ret = analyzer_create_dirs (); if (!ret) { - g_error ("Failed to create the necessary dir names \n"); + g_printerr ("Failed to create the necessary dir names\n"); goto done; } diff --git a/codecanalyzer/src/gst_analyzer.c b/codecanalyzer/src/gst_analyzer.c index c7cf35d09c..f5fee9bf33 100644 --- a/codecanalyzer/src/gst_analyzer.c +++ b/codecanalyzer/src/gst_analyzer.c @@ -187,7 +187,7 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data) } else if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) { GError *error = NULL; gst_message_parse_error (message, &error, NULL); - g_error ("gstreamer error : %s", error->message); + g_printerr ("gstreamer error : %s\n", error->message); g_error_free (error); return FALSE; } @@ -264,7 +264,7 @@ gst_analyzer_init (GstAnalyzer * analyzer, char *uri) gst_init (NULL, NULL); if (!analyzer_sink_register_static ()) { - g_error ("Failed to register static plugins.... \n"); + g_printerr ("Failed to register static plugins....\n"); status = GST_ANALYZER_STATUS_CODEC_PARSER_MISSING; goto error; } @@ -303,7 +303,7 @@ gst_analyzer_init (GstAnalyzer * analyzer, char *uri) analyzer->pipeline = gst_pipeline_new ("pipeline"); if (!analyzer->src || !analyzer->parser || !analyzer->sink) { - g_error ("Failed to create the necessary gstreamer elements.."); + g_printerr ("Failed to create the necessary gstreamer elements..\n"); status = GST_ANALYZER_STATUS_ERROR_UNKNOWN; goto error; } diff --git a/codecanalyzer/src/plugins/gst/analyzersink/mpeg_xml.c b/codecanalyzer/src/plugins/gst/analyzersink/mpeg_xml.c index adfd7effc9..e97efc4d66 100644 --- a/codecanalyzer/src/plugins/gst/analyzersink/mpeg_xml.c +++ b/codecanalyzer/src/plugins/gst/analyzersink/mpeg_xml.c @@ -21,6 +21,7 @@ #include "mpeg_xml.h" #include "xml_utils.h" +#include static gboolean create_seq_hdr_xml (xmlTextWriterPtr writer, GstMpegVideoSequenceHdr * seq_hdr) @@ -423,7 +424,7 @@ analyzer_create_mpeg2video_frame_xml (GstMpegVideoMeta * mpeg_meta, if (xmlTextWriterWriteComment (writer, (xmlChar *) "Data parssed from the mpeg2 stream") < 0) { - g_error ("Error: Failed to write the comment \n"); + g_printerr ("Error: Failed to write the comment\n"); return FALSE; } @@ -532,12 +533,12 @@ analyzer_create_mpeg2video_frame_xml (GstMpegVideoMeta * mpeg_meta, } #endif if (xmlTextWriterEndElement (writer) < 0) { - g_error ("Error: Failed to end mpeg2 root element \n"); + g_printerr ("Error: Failed to end mpeg2 root element\n"); return FALSE; } if (xmlTextWriterEndDocument (writer) < 0) { - g_error ("Error: Ending document \n"); + g_printerr ("Error: Ending document\n"); return FALSE; } diff --git a/codecanalyzer/src/xml_parse.c b/codecanalyzer/src/xml_parse.c index f6800fc7b5..adb31f7a0f 100644 --- a/codecanalyzer/src/xml_parse.c +++ b/codecanalyzer/src/xml_parse.c @@ -19,6 +19,8 @@ */ #include "xml_parse.h" +#include + void analyzer_node_list_free (GList * list) { @@ -62,13 +64,13 @@ analyzer_get_list_header_strings (char *file_name) doc = xmlParseFile (file_name); if (!doc) { - g_error ("Failed to do xmlParseFile for the file.. %s\n", file_name); + g_printerr ("Failed to do xmlParseFile for the file.. %s\n", file_name); goto error; } cur = xmlDocGetRootElement (doc); if (cur == NULL) { - g_error ("empty document\n"); + g_printerr ("empty document\n"); xmlFreeDoc (doc); goto error; } @@ -76,7 +78,7 @@ analyzer_get_list_header_strings (char *file_name) if (xmlStrcmp (cur->name, (const xmlChar *) "mpeg2") && xmlStrcmp (cur->name, (const xmlChar *) "h264") && xmlStrcmp (cur->name, (const xmlChar *) "h265")) { - g_error ("document of the wrong type !!"); + g_printerr ("document of the wrong type !!\n"); xmlFreeDoc (doc); goto error; } @@ -105,22 +107,23 @@ analyzer_get_list_analyzer_node_from_xml (char *file_name, char *node_name) doc = xmlParseFile (file_name); if (!doc) { - g_error ("Failed to do xmlParseFile for the file.. %s\n", file_name); + g_printerr ("Failed to do xmlParseFile for the file.. %s\n", file_name); + goto error; } cur = xmlDocGetRootElement (doc); if (cur == NULL) { - g_error ("empty document\n"); xmlFreeDoc (doc); - return; + g_printerr ("empty document\n"); + goto error; } if (xmlStrcmp (cur->name, (const xmlChar *) "mpeg2") && xmlStrcmp (cur->name, (const xmlChar *) "h264") && xmlStrcmp (cur->name, (const xmlChar *) "h265")) { - g_error ("document of the wrong type !!"); xmlFreeDoc (doc); - return; + g_printerr ("document of the wrong type !!\n"); + goto error; } tmp = cur->xmlChildrenNode; @@ -179,4 +182,7 @@ analyzer_get_list_analyzer_node_from_xml (char *file_name, char *node_name) list = g_list_reverse (list); return list; + +error: + return NULL; }