mike-mcgann commented on code in PR #988:
URL: https://github.com/apache/daffodil/pull/988#discussion_r1138629546


##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BlobLengthParsers.scala:
##########
@@ -55,9 +55,9 @@ trait ByteChunkWriter { self: PrimParser =>
         remainingBitsToGet -= bitsToGet
       } else {
         val remainingBits =
-          if (dis.remainingBits.isDefined) {
+          if (dis.remainingLimitedBits.isDefined) {
             val totalBitsRead = nBits - remainingBitsToGet
-            MaybeULong(dis.remainingBits.get + totalBitsRead)
+            MaybeULong(dis.remainingLimitedBits.get + totalBitsRead)

Review Comment:
   The old `remainingBits` function which only considers end-of-limit got 
renamed to `remainingLimitedBits`. The new function that returns the length to 
the end-of-limit or end-of-stream now uses the name of `remainingBits`. I 
originally considered `reminaingLimitedBits` and `remainingStreamBits` but I 
didn't think that worked well. So this change isn't really a change to 
functionality but a refactoring to use the new name.
   
   To fix this bug, I initially found the two locations that output the error 
message and threw a `RuntimeException` if the order of the numbers was 
backwards. I updated all instances where the error message was called because 
it seemed like getting the length to end-of-limit or end-of-file was correct 
when reporting an error message. 
   
   In this case, it is doing more than reporting an error, so I decided to 
leave the functionality as-is. 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to