]> git.donarmstrong.com Git - bamtools.git/commitdiff
Bug discovered. The chunkStop was not being read from the correct offset (rather...
authorgabeiscoding <gaberudy@gmail.com>
Thu, 8 Sep 2011 13:32:48 +0000 (07:32 -0600)
committergabeiscoding <gaberudy@gmail.com>
Thu, 8 Sep 2011 13:32:48 +0000 (07:32 -0600)
The result of this is that chunkStop will never be >= minOffset (or maybe rarely, since it always equals the first chunkStart for the first chunk) and thus the linear index doesn't really help in reducing the number of seeks performed.

src/api/internal/BamStandardIndex_p.cpp

index 8993d43175a2d93bc4b5fea65525808a41c42056..6d8273e9c1477a965aebb0bea553026014c90d4a 100644 (file)
@@ -125,7 +125,7 @@ bool BamStandardIndex::CalculateCandidateOffsets(const BaiReferenceSummary& refS
                 // read chunk start & stop from buffer
                 memcpy((char*)&chunkStart, m_buffer+offset, sizeof(uint64_t));
                 offset += sizeof(uint64_t);
-                memcpy((char*)&chunkStop, m_buffer, sizeof(uint64_t));
+                memcpy((char*)&chunkStop, m_buffer+offset, sizeof(uint64_t));
                 offset += sizeof(uint64_t);
 
                 // swap endian-ness if necessary