Open
Conversation
Relax the string size validation from `size > 0` to `size >= 0` so that `string size 0` is accepted. This is useful when a configured constant drives the string size and a value of 0 is used to disable a field. Update the spec to document the valid range as [0,2^31-1], matching the intent described on the published website. Fixes nasa#878
Collaborator
|
Thanks for making this PR! In order to accept this change, we will need testing, to make sure that the zero-length string case works as expected in every case. I think we will need the following:
Ideally we would supplement every |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #878
Summary
The FPP spec and the published website describe
string sizen as valid in the range[0, 2^31), but the compiler was rejectingstring size 0with an "invalid string size" error.This is useful when a configured constant drives the string size and a value of 0 is used to disable a field.
Changes
FinalizeTypeDefs.scalafromsize > 0tosize >= 0Types.adoc) to document the valid range as[0,2^31-1]Testing
Ran the existing
fpp-checktype test suite — all 7 tests pass, includingstring_size_negative(rejects -1) andstring_size_too_large(rejects0x80000000).