Skip to content

Commit 6e46b5e

Browse files
committed
Terminate unpadded sequences with \n\0
1 parent e6f0328 commit 6e46b5e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/commons/DBReader.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ template <typename T> bool DBReader<T>::open(int accessType){
193193
dstream = new ZSTD_DStream*[threads];
194194
for(int i = 0; i < threads; i++){
195195
// allocated buffer
196-
compressedBufferSizes[i] = std::max(maxSeqLen+1, 1024u);
196+
compressedBufferSizes[i] = std::max(maxSeqLen+2, 1024u);
197197
compressedBuffers[i] = (char*) malloc(compressedBufferSizes[i]);
198198
incrementMemory(compressedBufferSizes[i]);
199199
if(compressedBuffers[i]==NULL){
@@ -552,6 +552,8 @@ template <typename T> char* DBReader<T>::getUnpadded(size_t id, int thrIdx) {
552552
unsigned char baseCode = (code >= 32) ? code - 32 : code;
553553
compressedBuffers[thrIdx][i] = CODE_TO_CHAR[baseCode];
554554
}
555+
compressedBuffers[thrIdx][seqLen + 0] = '\n';
556+
compressedBuffers[thrIdx][seqLen + 1] = '\0';
555557
return compressedBuffers[thrIdx];
556558
}
557559

0 commit comments

Comments
 (0)