mbeckerle commented on a change in pull request #539:
URL: https://github.com/apache/daffodil/pull/539#discussion_r620558282
##########
File path: daffodil-io/src/main/scala/org/apache/daffodil/io/InputSource.scala
##########
@@ -255,18 +292,27 @@ class BucketingInputSource(
*/
private def fillBucketsToIndex(goalBucketIndex: Long, bytesNeededInBucket:
Long): Boolean = {
var lastBucketIndex = buckets.length - 1
- var hasMoreData = true
+
var needsMoreData = goalBucketIndex > lastBucketIndex || (goalBucketIndex
== lastBucketIndex && bytesNeededInBucket > bytesFilledInLastBucket)
while (needsMoreData && hasMoreData) {
// Try to fill the rest of this bucket, regardless of how many bytes are
// actually needed
val emptyBytesInLastBucket = bucketSize - bytesFilledInLastBucket
+ Assert.invariant(emptyBytesInLastBucket >= 0)
// Try to read enough bytes to fill the rest of this bucket. Note that
// the .read() function could hit EOF (returns -1) or could return
- // anywhere from zero to emptyBytesInLastBucket bytes
- val bytesRead = inputStream.read(buckets(lastBucketIndex).bytes,
bytesFilledInLastBucket, emptyBytesInLastBucket)
+ // anywhere from 0 to emptyBytesInLastBucket bytes
Review comment:
yes, done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]