Skip to content

Fixed parsing of integers#5

Open
chenz wants to merge 1 commit intoHertzDevil:masterfrom
chenz:fix-int-parsers
Open

Fixed parsing of integers#5
chenz wants to merge 1 commit intoHertzDevil:masterfrom
chenz:fix-int-parsers

Conversation

@chenz
Copy link
Copy Markdown

@chenz chenz commented Oct 27, 2018

string_view::data() must not be interpreted as a C-string (ie not
passed to strtol etc.), because it may not be terminated
properly. Example:

string_view{"asd"}.substr(0,2).data()

is "asd", not "as".

This is an issue when fixed length literals are not separated in the
MML - for example
in (https://www.smwcentral.net/?p=section&a=details&id=18255),
"q7Ad16" was tokenized correctly as "q", "7A" - but then the
conversion to int returned 0x7ad16 instead of 0x7a.

string_view::data() must not be interpreted as a C-string (ie *not*
passed to strtol etc.), because it may not be terminated
properly. Example:

    string_view{"asd"}.substr(0,2).data()

is "asd", *not* "as".

This is an issue when fixed length literals are not separated in the
MML - for example
in (https://www.smwcentral.net/?p=section&a=details&id=18255),
"q7Ad16" was tokenized correctly as "q", "7A" - but then the
conversion to int returned 0x7ad16 instead of 0x7a.
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.

1 participant