Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2189)

Unified Diff: base/i18n/streaming_utf8_validator.cc

Issue 1542323002: Switch to standard integer types in base/i18n/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: header Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/i18n/streaming_utf8_validator.h ('k') | base/i18n/streaming_utf8_validator_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/streaming_utf8_validator.cc
diff --git a/base/i18n/streaming_utf8_validator.cc b/base/i18n/streaming_utf8_validator.cc
index c809985e168a2c67e2d68af028b9bb1f72c95bb4..19c86a37a471e94f3de9d61b8cb1d3a7efccfb8e 100644
--- a/base/i18n/streaming_utf8_validator.cc
+++ b/base/i18n/streaming_utf8_validator.cc
@@ -14,7 +14,7 @@
namespace base {
namespace {
-uint8 StateTableLookup(uint8 offset) {
+uint8_t StateTableLookup(uint8_t offset) {
DCHECK_LT(offset, internal::kUtf8ValidatorTablesSize);
return internal::kUtf8ValidatorTables[offset];
}
@@ -25,7 +25,7 @@ StreamingUtf8Validator::State StreamingUtf8Validator::AddBytes(const char* data,
size_t size) {
// Copy |state_| into a local variable so that the compiler doesn't have to be
// careful of aliasing.
- uint8 state = state_;
+ uint8_t state = state_;
for (const char* p = data; p != data + size; ++p) {
if ((*p & 0x80) == 0) {
if (state == 0)
@@ -33,8 +33,8 @@ StreamingUtf8Validator::State StreamingUtf8Validator::AddBytes(const char* data,
state = internal::I18N_UTF8_VALIDATOR_INVALID_INDEX;
break;
}
- const uint8 shift_amount = StateTableLookup(state);
- const uint8 shifted_char = (*p & 0x7F) >> shift_amount;
+ const uint8_t shift_amount = StateTableLookup(state);
+ const uint8_t shifted_char = (*p & 0x7F) >> shift_amount;
state = StateTableLookup(state + shifted_char + 1);
// State may be INVALID here, but this code is optimised for the case of
// valid UTF-8 and it is more efficient (by about 2%) to not attempt an
« no previous file with comments | « base/i18n/streaming_utf8_validator.h ('k') | base/i18n/streaming_utf8_validator_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698