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).
#include <libxml/parser.h>
#include <gtk/gtk.h>
+#include <glib.h>
#include <glib/gprintf.h>
#include "gst_analyzer.h"
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;
}
} 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;
}
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;
}
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;
}
#include "mpeg_xml.h"
#include "xml_utils.h"
+#include <glib.h>
static gboolean
create_seq_hdr_xml (xmlTextWriterPtr writer, GstMpegVideoSequenceHdr * seq_hdr)
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;
}
}
#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;
}
*/
#include "xml_parse.h"
+#include <glib.h>
+
void
analyzer_node_list_free (GList * list)
{
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;
}
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;
}
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;
list = g_list_reverse (list);
return list;
+
+error:
+ return NULL;
}