]> sigrok.org Git - libsigrok.git/commitdiff
input/trace32_ad: silence format errors during input format match
authorGerhard Sittig <redacted>
Tue, 24 Apr 2018 21:28:41 +0000 (23:28 +0200)
committerUwe Hermann <redacted>
Sat, 28 Apr 2018 21:42:42 +0000 (23:42 +0200)
When auto-detection tries to find the input module that can handle a
file, unexpected input format should be considered non-fatal. Only emit
error messages when process_header() got invoked from process_buffer()
after initialization. Emit debug messages in early stages where no input
module context exists yet.

src/input/trace32_ad.c

index 6cb6bcb4d51f2d6a2fc97a7b6d51828db0bc0947..779c0dac058df5032d4baa5eea006bb55e73d855 100644 (file)
@@ -213,12 +213,18 @@ static int process_header(GString *buf, struct context *inc)
                        inc->format = AD_FORMAT_TXTHDR;
                g_free(format_name_sig);
                g_free(format_name);
-               sr_err("This format isn't implemented yet, aborting.");
+               if (inc)
+                       sr_err("This format isn't implemented yet, aborting.");
+               else
+                       sr_dbg("Not a supported trace32 input file.");
                return SR_ERR;
        } else {
                g_free(format_name_sig);
                g_free(format_name);
-               sr_err("Don't know this file format, aborting.");
+               if (inc)
+                       sr_err("Don't know this file format, aborting.");
+               else
+                       sr_dbg("Not a trace32 input file.");
                return SR_ERR;
        }