e323c52d6da91a50d484da6ff11dbbf0c706a29c galt Tue Dec 31 22:17:30 2024 -0800 fix faSplit found by Rocky 9 compiler on hgwdev-new diff --git src/utils/faSplit/faSplit.c src/utils/faSplit/faSplit.c index 5efef08..3ae56be 100644 --- src/utils/faSplit/faSplit.c +++ src/utils/faSplit/faSplit.c @@ -269,31 +269,31 @@ f = mustOpen(outPath, "w"); } curPos += seq.size; faWriteNext(f, seq.name, seq.dna, seq.size); } carefulClose(&f); lineFileClose(&lf); } void splitByName(char *inName, char *outRoot) /* Split into chunks using sequence names. */ { struct dnaSeq seq; struct lineFile *lf = lineFileOpen(inName, TRUE); FILE *f = NULL; -char outDir[256], outFile[128], ext[64], outPath[512]; +char outDir[PATH_LEN], outFile[FILENAME_LEN], ext[FILEEXT_LEN], outPath[1024]; ZeroVar(&seq); splitPath(outRoot, outDir, outFile, ext); while (faMixedSpeedReadNext(lf, &seq.dna, &seq.size, &seq.name)) { carefulClose(&f); if (outDirDepth > 0) { char *ptr; for(ptr=&seq.name[strlen(seq.name) - 1]; isdigit(*ptr); ptr--) ; if (ptr > &seq.name[strlen(seq.name)]) errAbort("outDirDepth specified but sequence name doesn't have any digits"); @@ -306,31 +306,31 @@ sprintf(outPath, "%s%s.fa", outDir, seq.name); verbose(2, "writing %s\n", outPath); f = mustOpen(outPath, "w"); faWriteNext(f, seq.name, seq.dna, seq.size); } carefulClose(&f); lineFileClose(&lf); } void splitByNamePrefix(char *inName, char *outRoot, int preFixCount) /* Split into chunks using prefix of sequence names. */ { struct dnaSeq seq; struct lineFile *lf = lineFileOpen(inName, TRUE); FILE *f = NULL; -char outDir[256], outFile[128], ext[64], outPath[512], preFix[512]; +char outDir[PATH_LEN], outFile[FILENAME_LEN], ext[FILEEXT_LEN], outPath[2048], preFix[512]; ZeroVar(&seq); splitPath(outRoot, outDir, outFile, ext); assert(preFixCount < sizeof(preFix)); while (faMixedSpeedReadNext(lf, &seq.dna, &seq.size, &seq.name)) { carefulClose(&f); strncpy(preFix, seq.name, preFixCount); preFix[preFixCount] = '\0'; sprintf(outPath, "%s%s.fa", outDir, preFix); verbose(2, "writing %s\n", outPath); f = mustOpen(outPath, "a"); faWriteNext(f, seq.name, seq.dna, seq.size); } @@ -447,31 +447,31 @@ /* Count number of N's from s[0] to s[size-1]. * Treat any parts past end of string as N's. */ while (faMixedSpeedReadNext(lf, &seq.dna, &seq.size, &seq.name)) { bits = bitAlloc(seq.size); setBitsN(seq.dna, seq.size, bits); ++seqCount; if (outFile != NULL) { if (seqCount > 1) errAbort("Can only handle in files with one sequence using out option"); bitsForOut(outFile, seq.size, bits); } for (pos = 0; pos < seq.size; pos += pieceSize) { - char numOut[128]; + char numOut[512]; int thisSize = seq.size - pos; if (thisSize > (pieceSize + extra)) thisSize = pieceSize + extra; if ((thisSize <= extra) && (pos > 0)) break; /* nobody wants duplicate smaller than extra overhang */ if (bitCountRange(bits, pos, thisSize) <= maxN) { if (!oneFile) { mkOutPath(fileName, outRoot, digits, pieceIx); f = mustOpen(fileName, "w"); } sprintf(numOut, "%s%0*d", noPath, digits, pieceIx); @@ -539,31 +539,31 @@ } if (nSize > minGapSize) { gotGap = TRUE; gapStart = nStart; gapSize = nSize; } } *retGapStart = gapStart; *retGapSize = gapSize; return(gotGap); } static void writeOneByGap(boolean oneFile, char *outRoot, - int digits, int *pieceIx, FILE *f, char noPath[256], int pos, int thisSize, + int digits, int *pieceIx, FILE *f, char noPath[FILENAME_LEN], int pos, int thisSize, struct dnaSeq *seq, FILE *lift, int *writeCount, char *outPath) { char numOut[128]; if (!oneFile) { char fileName[512]; mkOutPath(fileName, outRoot, digits, *pieceIx); f = mustOpen(fileName, "w"); verbose(2, "writing %s\n", fileName); } else verbose(2, "writing %s\n", outPath); sprintf(numOut, "%s%0*d", noPath, digits, *pieceIx); verbose(3,"#\twriting piece %s, at pos %d for size %d\n", numOut,pos,thisSize); faWriteNext(f, numOut, seq->dna + pos, thisSize); @@ -574,32 +574,32 @@ *pieceIx += 1; if (!oneFile) carefulClose(&f); } void splitByGap(char *inName, int pieceSize, char *outRoot, long long estSize) /* Split up file into pieces at most pieceSize bases long, at gap boundaries * if possible. */ { off_t pieces = (estSize + pieceSize-1)/pieceSize; int digits = digitsBaseTen(pieces); int minGapSize = optionInt("minGapSize", 1000); boolean noGapDrops = optionExists("noGapDrops"); int maxN = optionInt("maxN", pieceSize-1); boolean oneFile = optionExists("oneFile"); -char fileName[512]; -char dirOnly[256], noPath[128]; +char fileName[FILENAME_LEN]; +char dirOnly[PATH_LEN], noPath[FILENAME_LEN]; int pos, pieceIx = 0, writeCount = 0; struct dnaSeq seq; struct lineFile *lf = lineFileOpen(inName, TRUE); FILE *f = NULL; Bits *bits = NULL; int seqCount = 0; char *outFile = optionVal("out", NULL); char *liftFile = optionVal("lift", NULL); FILE *lift = NULL; ZeroVar(&seq); if (minGapSize < 1) errAbort("ERROR: minGapSize must be > 0"); splitPath(outRoot, dirOnly, noPath, NULL);