You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2022/02/14 21:21:42 UTC
[GitHub] [daffodil] jadams-tresys commented on a change in pull request #752: Fix and add test cases for prefixed length bugs.
jadams-tresys commented on a change in pull request #752:
URL: https://github.com/apache/daffodil/pull/752#discussion_r806248453
##########
File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/BinaryNumberTraits.scala
##########
@@ -108,15 +109,32 @@ trait PrefixedLengthParserMixin {
*/
def getPrefixedLengthInBits(state: PState): Long = {
val lenInUnits = getPrefixedLengthInUnits(state)
- lengthUnits match {
+ val lenInBits = lengthUnits match {
case LengthUnits.Bits => lenInUnits
case LengthUnits.Bytes => lenInUnits * 8
case LengthUnits.Characters => {
val mfw = state.encoder.bitsCharset.maybeFixedWidth
- if (mfw.isDefined) mfw.get
+ if (mfw.isDefined)
+ lenInUnits * mfw.get // fixed, only supported for parsing (maybe)
else
Assert.invariantFailed("Prefixed length for text data in non-fixed width encoding.")
}
}
+ // Now we save the contentLength that we obtained from the prefix
+ // so that the dfdl:contentLength function can be called on the prefixed length element.
+ // as parse time.
Review comment:
Typo in the comment here. Assuming you don't want the period on the previous line and "at parse time" instead of "as parse time".
--
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: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org