]> sigrok.org Git - libsigrok.git/blobdiff - src/input/csv.c
input: sr_input_new() always allocates the instance buffer.
[libsigrok.git] / src / input / csv.c
index 6dd06f4877ccbc4e4f592c4bdca4e807a77a858e..2d53bf6f67f5998075c8c7df5c770c21f39be457 100644 (file)
@@ -134,6 +134,10 @@ struct context {
 
 static int format_match(const char *filename)
 {
+       /* Require .csv extension. */
+       if (strcmp(filename + strlen(filename) - 4, ".csv"))
+               return FALSE;
+
        if (!filename) {
                sr_err("%s: filename was NULL.", __func__);
                return FALSE;
@@ -859,9 +863,9 @@ static int loadfile(struct sr_input *in, const char *filename)
        return SR_OK;
 }
 
-SR_PRIV struct sr_input_format input_csv = {
+SR_PRIV struct sr_input_module input_csv = {
        .id = "csv",
-       .description = "Comma-separated values (CSV)",
+       .desc = "Comma-separated values (CSV)",
        .format_match = format_match,
        .init = init,
        .loadfile = loadfile,