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

Use "unsigned char" instead of "char" when comparing byte sequences #24

Conversation

masatake
Copy link
Member

The original bug was found when developing Juila parser in u-ctags
repo[1]. When searching a tag name "α", readtags reported nothing
though an entry for "α" was in the tags file used for testing
the Julia parser.

"α" is {206, 177} as a byte sequence.

However, when comparing bytes in strings, libreadtags used (singed)
char type. In the case "α" was {-50, -79}. Using {-50, -79} for
comparison, the binary search didn't work as we expected.

The test for this change will be done in u-ctag side.

[1] universal-ctags/ctags#2654

Signed-off-by: Masatake YAMATO yamato@redhat.com

The original bug was found when developing Juila parser in u-ctags
repo[1].  When searching a tag name "α", readtags reported nothing
though an entry for "α" was in the tags file used for testing
the Julia parser.

"α" is {206, 177} as a byte sequence.

However, when comparing bytes in strings, libreadtags used (singed)
char type. In the case "α" was {-50, -79}.  Using {-50, -79} for
comparison, the binary search didn't work as we expected.

The test for this change will be done in u-ctag side.

[1] universal-ctags/ctags#2654

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake merged commit fbc0e8d into universal-ctags:master Nov 21, 2020
@masatake masatake deleted the use-unsigned-char-when-comparing-string branch November 21, 2020 20:36
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