Commit 286ed402 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Change short/int to uint16_t in third_party/blink/renderer/core/html/parser &...

Change short/int to uint16_t in third_party/blink/renderer/core/html/parser & make_html_entity_table.py

- short/int -> uint16_t considering the total number of HTMLEntityTableEntry
- Reference: https://google.github.io/styleguide/cppguide.html#Integer_Types

Bug: 929985
Change-Id: I4e6f06ae1b2d8091ec0b71764914855c082ef86c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1502252Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637627}
parent f045e13f
......@@ -182,11 +182,11 @@ static const HTMLEntityTableEntry staticEntityTable[%s] = {\n""" % entity_count)
output_file.write("};\n\n")
output_file.write("\n}\n")
output_file.write("static const short uppercaseOffset[] = {\n")
output_file.write("static const int16_t uppercaseOffset[] = {\n")
for letter in range(ord('A'), ord('Z') + 1):
output_file.write("%d,\n" % index[chr(letter)])
output_file.write("%d\n" % index['a'])
output_file.write("};\n\nstatic const short lowercaseOffset[] = {\n")
output_file.write("};\n\nstatic const int16_t lowercaseOffset[] = {\n")
for letter in range(ord('a'), ord('z') + 1):
output_file.write("%d,\n" % index[chr(letter)])
output_file.write("%d\n" % entity_count)
......
......@@ -130,9 +130,9 @@ static bool ConsumeNamedEntity(SegmentedString& source,
UnconsumeCharacters(source, consumed_characters);
consumed_characters.clear();
const HTMLEntityTableEntry* most_recent = entity_search.MostRecentMatch();
const int length = most_recent->length;
const uint16_t length = most_recent->length;
const LChar* reference = HTMLEntityTable::EntityString(*most_recent);
for (int i = 0; i < length; ++i) {
for (uint16_t i = 0; i < length; ++i) {
cc = source.CurrentChar();
DCHECK_EQ(cc, static_cast<UChar>(*reference++));
consumed_characters.push_back(cc);
......
......@@ -42,7 +42,7 @@ class HTMLEntitySearch {
void Advance(UChar);
bool IsEntityPrefix() const { return !!first_; }
int CurrentLength() const { return current_length_; }
uint16_t CurrentLength() const { return current_length_; }
const HTMLEntityTableEntry* MostRecentMatch() const {
return most_recent_match_;
......@@ -64,7 +64,7 @@ class HTMLEntitySearch {
last_ = nullptr;
}
int current_length_;
uint16_t current_length_;
const HTMLEntityTableEntry* most_recent_match_;
const HTMLEntityTableEntry* first_;
......
......@@ -38,8 +38,8 @@ struct HTMLEntityTableEntry {
UChar32 first_value;
UChar second_value; // UChar since double char sequences only use BMP chars.
short entity_offset;
short length;
uint16_t entity_offset;
uint16_t length;
};
class HTMLEntityTable {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment