Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-1600

StringOfSpecifiedLengthUnparser - rename since it only truncates now

XMLWordPrintableJSON

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.0.0
    • None
    • Back End, Middle "End"
    • None

      Possible better names:

      StringMaybeTruncateUnparser

      The code itself of this class still is structured as if it was doing padding and truncation with local variable names like nCharsToPad that must be <= 0 now. Those should be touched up to better indicate what this code does, which is when truncation is allowed, truncate the string.

      This code assumes the bitLimit will have been set if truncation is to take place. It is unclear if this invariant holds. This invariant needs to be checked. It's possible no truncation will occur in situations where it should. If the type is xs:string the lengthKind is explicit or implicit, and the optTruncateSpecifiedLengthString is defined and true, then we must have a length limit.

      Alternatively, this should check and truncate only in that case, but we need to insist this is done consistently. Either the surrounding unparser ALWAYS sets the bit limit (not sure how in case of lengthUnits 'characters'), or this primitive doesn't pay attention to the bit limit and decides itself.

      (This idea that the bitLimit setting is how this is detected is a hold-over from the design of the parser which may not be the right choice for the unparser.)

              dthompson David Thompson
              mbeckerle.dfdl Mike Beckerle
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: