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

Unified Diff: src/string-search.h

Issue 3530004: Fix bad cast in string-search.h. (Closed)
Patch Set: Added test-case Created 10 years, 3 months 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 | « no previous file | test/mjsunit/string-indexof-1.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string-search.h
diff --git a/src/string-search.h b/src/string-search.h
index 4412e32ed3d735c61818fa4bcd901f11e94fff0c..eac84757ecf1d45458133442c5cfc200627cd691 100644
--- a/src/string-search.h
+++ b/src/string-search.h
@@ -170,12 +170,12 @@ class StringSearch : private StringSearchBase {
return bad_char_occurrence[static_cast<int>(char_code)];
}
if (sizeof(PatternChar) == 1) {
- if (static_cast<unsigned char>(char_code) > String::kMaxAsciiCharCode) {
+ if (static_cast<unsigned int>(char_code) > String::kMaxAsciiCharCodeU) {
return -1;
}
- return bad_char_occurrence[static_cast<int>(char_code)];
+ return bad_char_occurrence[static_cast<unsigned int>(char_code)];
}
- // Reduce to equivalence class.
+ // Both pattern and subject are UC16. Reduce character to equivalence class.
int equiv_class = char_code % kUC16AlphabetSize;
return bad_char_occurrence[equiv_class];
}
« no previous file with comments | « no previous file | test/mjsunit/string-indexof-1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698