Changeset: 954c3dd4b140 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=954c3dd4b140
Modified Files:
        clients/mapiclient/mclient.c
Branch: DVframework_bam
Log Message:

Added sanity check, thereby fixing an unused variable warning


diffs (31 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -725,11 +725,17 @@ FASTQrenderer(MapiHdl hdl)
        FILE *file1 = fopen(fastq_filepath1, "w"), *file2 = 
fopen(fastq_filepath2, "w");
        
        if(file1 == NULL || file2 == NULL) {
-           mnstr_printf(toConsole, "Couldn't open FASTQ file for writing.");
+           mnstr_printf(toConsole, "FASTQrenderer: Couldn't open FASTQ file 
for writing.\n");
            return;
        }
 
        while (!mnstr_errnr(toConsole) && (fields = fetch_row(hdl)) != 0) {
+           /* Sanity check on fields; we expect exactly 5 */
+        if(fields != 5)  {
+            mnstr_printf(toConsole, "FASTQrenderer: Mismatch in number of 
columns in data; expected: 5, found: %d.\n", fields);
+            return;
+        }
+        
                qname = mapi_fetch_field(hdl, 0);
                seq1  = mapi_fetch_field(hdl, 1);
                qual1 = mapi_fetch_field(hdl, 2);
@@ -737,7 +743,7 @@ FASTQrenderer(MapiHdl hdl)
                qual2 = mapi_fetch_field(hdl, 4);
                
                if (qname == NULL || seq1 == NULL || qual1 == NULL || seq2 == 
NULL || qual2 == NULL) {
-                   mnstr_printf(toConsole, "Attributes couldn't be fetched 
from query result");
+                   mnstr_printf(toConsole, "FASTQrenderer: Attributes couldn't 
be fetched from query result.\n");
                    return;
                }
                fputc('@'    , file1);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to