| Summary: | Support for variable-length strings w/o terminator | ||
|---|---|---|---|
| Product: | [Applications] okteta | Reporter: | Johannes Zarl-Zierl <johannes> |
| Component: | Structures Tool | Assignee: | Alex Richardson <arichardson.kde> |
| Status: | REPORTED --- | ||
| Severity: | wishlist | CC: | bart+kde, kossebau |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Johannes Zarl-Zierl
2020-05-11 18:19:52 UTC
Alex, would you remember a reason besides no spare time resources that maxCharCount and maxByteCount could not be also optionally scripted properties? Would look into this otherwise in the next weeks.
FTR, as another work-around (though resulting in data reparsing) one can use the updateFunc, starting with maxCharCount or maxByteCount set to 0 and then have the value updated from that type-wide generic function.
E.g. with JS:
var obj = struct({
length: uint16(),
data: string("utf-8").set({
maxByteCount: 0,
updateFunc: function() { this.maxByteCount = this.parent.length.value; }
})
});
or with XML
<struct name="variablelengthstring">
<primitive name="length" type="uint16" />
<string name="data" encoding="utf-8" maxByteCount="0" updateFunc="function() { this.maxByteCount = this.parent.length.value; }">
</struct>
|