- /* Desired file formats either start with digit+space or "trace32". */
- if (g_strcmp0(format_name_sig, "trace32")) {
- if (inc)
- inc->format = AD_FORMAT_BINHDR;
- } else if (g_ascii_isdigit(format_name[0]) && (format_name[1] == 0x20)) {
- if (inc)
- inc->format = AD_FORMAT_TXTHDR;
- g_free(format_name_sig);
+ /*
+ * File format names either start with the "trace32" literal,
+ * or with a digit and SPACE.
+ */
+ format_name_sig = g_strndup(format_name, strlen(TRACE32));
+ has_trace32 = g_strcmp0(format_name_sig, TRACE32) == 0;
+ g_free(format_name_sig);
+
+ format = AD_FORMAT_UNKNOWN;
+ if (has_trace32) {
+ /* Literal "trace32" leader, binary header follows. */
+ format = AD_FORMAT_BINHDR1;
+ } else if (g_ascii_isdigit(format_name[0]) && (format_name[1] == SPACE)) {
+ /* Digit and SPACE leader, currently unsupported text header. */
+ format = AD_FORMAT_TXTHDR;