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

Unified Diff: src/scanner.h

Issue 864273005: Scanner / Unicode decoding: use size_t instead of unsigned. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: tentative Created 5 years, 10 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 | « src/objects.cc ('k') | src/scanner-character-streams.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.h
diff --git a/src/scanner.h b/src/scanner.h
index 8537c5308c9f73e8dbf2f5f97e8188f195d531cc..86a0098f86c0b4c97b4958148c4f6d27f04ce9b8 100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -67,15 +67,14 @@ class Utf16CharacterStream {
// Return the current position in the code unit stream.
// Starts at zero.
- inline unsigned pos() const { return pos_; }
+ inline size_t pos() const { return pos_; }
// Skips forward past the next code_unit_count UTF-16 code units
// in the input, or until the end of input if that comes sooner.
// Returns the number of code units actually skipped. If less
// than code_unit_count,
- inline unsigned SeekForward(unsigned code_unit_count) {
- unsigned buffered_chars =
- static_cast<unsigned>(buffer_end_ - buffer_cursor_);
+ inline size_t SeekForward(size_t code_unit_count) {
+ size_t buffered_chars = buffer_end_ - buffer_cursor_;
if (code_unit_count <= buffered_chars) {
buffer_cursor_ += code_unit_count;
pos_ += code_unit_count;
@@ -98,11 +97,11 @@ class Utf16CharacterStream {
// is at or after the end of the input, return false. If there
// are more code_units available, return true.
virtual bool ReadBlock() = 0;
- virtual unsigned SlowSeekForward(unsigned code_unit_count) = 0;
+ virtual size_t SlowSeekForward(size_t code_unit_count) = 0;
const uint16_t* buffer_cursor_;
const uint16_t* buffer_end_;
- unsigned pos_;
+ size_t pos_;
};
@@ -697,7 +696,7 @@ class Scanner {
// Return the current source position.
int source_pos() {
- return source_->pos() - kCharacterLookaheadBufferSize;
+ return static_cast<int>(source_->pos()) - kCharacterLookaheadBufferSize;
}
UnicodeCache* unicode_cache_;
« no previous file with comments | « src/objects.cc ('k') | src/scanner-character-streams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698