121c4f382ac9adc1994e7ff98c84c493a394964a galt Mon Jun 25 16:21:03 2012 -0700 fixing problem truncating bed lists after first element by restoring the comma diff --git src/lib/linefile.c src/lib/linefile.c index 675e90a..d67188e 100644 --- src/lib/linefile.c +++ src/lib/linefile.c @@ -1110,41 +1110,43 @@ int lineFileAllIntsArray(struct lineFile *lf, char *words[], int wordIx, void *array, int arraySize, boolean isSigned, int byteCount, char *typeString, boolean noNeg) /* Convert comma separated list of numbers to an array. Pass in * array and max size of array. Aborts on error. Returns number of elements in parsed array. */ { char *s = words[wordIx]; char errMsg[256]; unsigned count = 0; char *cArray = array; for (;;) { char *e; if (s == NULL || s[0] == 0 || count == arraySize) break; e = strchr(s, ','); - if (e != NULL) - *e++ = 0; + if (e) + *e = 0; int res = lineFileCheckAllIntsNoAbort(s, cArray, isSigned, byteCount, typeString, noNeg, errMsg, sizeof errMsg); if (res > 0) { errAbort("%s in column %d of array field %d line %d of %s, got %s", errMsg, count, wordIx+1, lf->lineIx, lf->fileName, s); } if (cArray) // NULL means validation only. cArray += byteCount; count++; + if (e) // restore input string + *e++ = ','; s = e; } return count; } double lineFileNeedDouble(struct lineFile *lf, char *words[], int wordIx) /* Make sure that words[wordIx] is an ascii double value, and return * binary representation of it. */ { char *valEnd; char *val = words[wordIx]; double doubleValue; doubleValue = strtod(val, &valEnd);