Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json_writer: fix inverted sense in isAnyCharRequiredQuoting #1120

Merged

Conversation

thefloweringash
Copy link
Contributor

This bug is only affects platforms where char is unsigned.

When char is a signed type, values >= 0x80 are also considered < 0,
and hence require escaping due to the < ' ' condition.

When char is an unsigned type, values >= 0x80 match none of the
conditions and are considered safe to emit without escaping.

This shows up as a test failure:

  • Detail of EscapeSequenceTest/writeEscapeSequence test failure:
    /build/source/src/test_lib_json/main.cpp(3370): expected == result
    Expected: '[""","\","\b","\f","\n","\r","\t","\u0278","\ud852\udf62"]
    '
    Actual : '[""","\","\b","\f","\n","\r","\t","ɸ","𤭢"]
    '

@thefloweringash thefloweringash changed the title json_writer: fix inverted sense isAnyCharRequiredQuoting json_writer: fix inverted sense in isAnyCharRequiredQuoting Dec 18, 2019
This bug is only affects platforms where `char` is unsigned.

When char is a signed type, values >= 0x80 are also considered < 0,
and hence require escaping due to the < ' ' condition.

When char is an unsigned type, values >= 0x80 match none of the
conditions and are considered safe to emit without escaping.

This shows up as a test failure:

* Detail of EscapeSequenceTest/writeEscapeSequence test failure:
/build/source/src/test_lib_json/main.cpp(3370): expected == result
  Expected: '["\"","\\","\b","\f","\n","\r","\t","\u0278","\ud852\udf62"]
  '
  Actual  : '["\"","\\","\b","\f","\n","\r","\t","ɸ","𤭢"]
  '
@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 93.598% when pulling 9093358 on thefloweringash:inverted-escaping into d6c4a8f on open-source-parsers:master.

thefloweringash added a commit to thefloweringash/nixpkgs that referenced this pull request Dec 18, 2019
@dota17 dota17 merged commit f11611c into open-source-parsers:master Dec 28, 2019
@thefloweringash thefloweringash deleted the inverted-escaping branch January 5, 2020 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants