]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/internal/io/RollingBuffer_p.cpp
Fixed: premature EOF issues & updated Windows implementation
[bamtools.git] / src / api / internal / io / RollingBuffer_p.cpp
index c3f709d6fdf5ad1a13ac998b80ef95bdac7da95b..10e762732d201f2351182df9b189378f591bc7a5 100644 (file)
@@ -2,7 +2,7 @@
 // RollingBuffer_p.cpp (c) 2011 Derek Barnett
 // Marth Lab, Department of Biology, Boston College
 // ---------------------------------------------------------------------------
-// Last modified: 10 November 2011 (DB)
+// Last modified: 8 December 2011 (DB)
 // ---------------------------------------------------------------------------
 // Provides a dynamic I/O FIFO byte queue, which removes bytes as they are
 // read from the front of the buffer and grows to accept bytes being written
@@ -167,6 +167,10 @@ void RollingBuffer::Free(size_t n) {
 
 size_t RollingBuffer::IndexOf(char c) const {
 
+    // skip processing if empty buffer
+    if ( IsEmpty() )
+        return string::npos;
+
     size_t index(0);
 
     // iterate over byte arrays