@@ -105,18 +105,18 @@ err error ) start: // Reply with the buffered data if there is any - if sr.to-sr.from > 0 { + if sr.to > 0 { count = copy(output, sr.buffer[sr.from:sr.to]) // Advance the data in the buffer sr.from += count // Check whether we have reached the end of the buffer - if sr.to-sr.from == 0 { + if sr.from == sr.to { // Reset the buffer sr.from, sr.to = 0, 0 return count, err } @@ -134,12 +134,12 @@ count, err = sr.reader.Read(sr.buffer) // Size the buffer down to the read data size // and restart if we have successfully read some bytes sr.from, sr.to = 0, count - if sr.to-sr.from > 0 { + if sr.to > 0 { goto start } // Returning on err/misbehaving noop reader return 0, err }