Merge pull request #9 from tree-sitter/signed-unsigned

Correctly cast `name_length`
This commit is contained in:
Max Brunsfeld 2019-04-08 13:15:20 -07:00 committed by GitHub
commit 95500a29f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -71,7 +71,7 @@ struct Scanner {
Tag &tag = tags[j]; Tag &tag = tags[j];
tag.type = static_cast<TagType>(buffer[i++]); tag.type = static_cast<TagType>(buffer[i++]);
if (tag.type == CUSTOM) { if (tag.type == CUSTOM) {
uint16_t name_length = (uint16_t)buffer[i++]; uint16_t name_length = static_cast<uint8_t>(buffer[i++]);
tag.custom_tag_name.assign(&buffer[i], &buffer[i + name_length]); tag.custom_tag_name.assign(&buffer[i], &buffer[i + name_length]);
i += name_length; i += name_length;
} }