4c23ed8c2c9becf91f0c521dac0983c21ca0e20b angie Mon Jan 6 14:35:20 2014 -0800 Tolerate missing '=' in metadata line for VCF3 because as Jonathan pointed out, the spec didn't demand key=val in 3.3.refs #12412 diff --git src/lib/vcf.c src/lib/vcf.c index b2eaed7..8b43371 100644 --- src/lib/vcf.c +++ src/lib/vcf.c @@ -270,30 +270,31 @@ { (void)strSwapStrs(line, strlen(line)+1, "\342\200\234", "\""); (void)strSwapStrs(line, strlen(line)+1, "\342\200\235", "\""); } static void parseMetadataLine(struct vcfFile *vcff, char *line) /* Parse a VCF header line beginning with "##" that defines a metadata. */ { char *ptr = line; if (ptr == NULL && !startsWith(ptr, "##")) errAbort("Bad line passed to parseMetadataLine"); ptr += 2; char *firstEq = strchr(ptr, '='); if (firstEq == NULL) { + if (vcff->majorVersion >= 4) vcfFileErr(vcff, "Metadata line lacks '=': \"%s\"", line); return; } regmatch_t substrs[8]; // Some of the metadata lines are crucial for parsing the rest of the file: if (startsWith("##fileformat=", line) || startsWith("##format", line)) { if (regexMatchSubstr(line, fileformatRegex, substrs, ArraySize(substrs))) { // substrs[2] is major version #, substrs[3] is set only if there is a minor version, // and substrs[4] is the minor version #. vcff->majorVersion = atoi(line + substrs[2].rm_so); if (substrs[3].rm_so != -1) vcff->minorVersion = atoi(line + substrs[4].rm_so); }