558767decf16c46bbf8c63ea4b36839fbee66ef8 kent Thu May 20 11:24:09 2021 -0700 Fixing error messages per code review #27569 diff --git src/hca/toHca/hcaAffixTsvToTemplate/hcaAffixTsvToTemplate.c src/hca/toHca/hcaAffixTsvToTemplate/hcaAffixTsvToTemplate.c index 39eb67b..f0d91b5 100644 --- src/hca/toHca/hcaAffixTsvToTemplate/hcaAffixTsvToTemplate.c +++ src/hca/toHca/hcaAffixTsvToTemplate/hcaAffixTsvToTemplate.c @@ -33,54 +33,54 @@ /* Command line validation table. */ static struct optionSpec options[] = { {"dir", OPTION_BOOLEAN}, {"full", OPTION_BOOLEAN}, {"append", OPTION_BOOLEAN}, {NULL, 0}, }; void affixToTemplate(char *inSheet, char *inTemplate, char *outSheet) /* affixToTemplate - Affix a single file to template. */ { /* Read in input sheet and template */ struct fieldedTable *smallSheet = fieldedTableFromTabFile(inSheet, inSheet, NULL, 0); struct fieldedTable *template = fieldedTableFromTabFile(inTemplate, inTemplate, NULL, 0); if (template->rowCount < 4) - errAbort("Expecting at least three rows in template %s, got %d", inTemplate, template->rowCount); + errAbort("Expecting at least four rows in template %s, got %d", inTemplate, template->rowCount); struct fieldedRow *computerNamesFr = slElementFromIx(template->rowList, 2); assert(computerNamesFr != NULL); char **computerNames = computerNamesFr->row; int computerNamesCount = template->fieldCount; /* Figure out how inSheet field indexes relate to inTemplate field indexes */ int translate[smallSheet->fieldCount]; int i; for (i=0; ifieldCount; ++i) { char *fieldName = smallSheet->fields[i]; int tx = stringArrayIx(fieldName, computerNames, computerNamesCount); if (tx < 0) errAbort("field %s not found in row 4 of %s", fieldName, inTemplate); translate[i] = tx; } /* Create an output row that is prefilled with empty strings. */ char *outRow[template->fieldCount]; for (i=0; ifieldCount; ++i) outRow[i] = ""; -/* Create output table with same fields and same first three rows as template */ +/* Create output table with same fields and same first four rows as template */ struct fieldedTable *outTable = fieldedTableNew(outSheet, template->fields, template->fieldCount); struct fieldedRow *fr; for (i=0, fr=template->rowList; i<4; ++i, fr = fr->next) fieldedTableAdd(outTable, fr->row, template->fieldCount, i); if (gAppend) { // Keep going if they ask us to. for (; fr != NULL; ++i, fr = fr->next) fieldedTableAdd(outTable, fr->row, template->fieldCount, i); } /* Add remaining rows from inTable spread over outRow */ int smallCount = smallSheet->fieldCount; for (fr = smallSheet->rowList; fr != NULL; fr = fr->next) {