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

Unified Diff: src/inspector/String16.cpp

Issue 2339173004: Revert of [inspector] fixed all shorten-64-to-32 warnings (Closed)
Patch Set: Created 4 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 | « src/inspector/String16.h ('k') | src/inspector/StringUtil.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/String16.cpp
diff --git a/src/inspector/String16.cpp b/src/inspector/String16.cpp
index d7649a7bb914aa16408ac144180d47c87a6d7b73..e14d19eee7440a8e763b212a6c7ea19142ed63db 100644
--- a/src/inspector/String16.cpp
+++ b/src/inspector/String16.cpp
@@ -11,7 +11,6 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
-#include <limits>
#include <locale>
#include <string>
@@ -39,12 +38,9 @@
buffer.push_back('\0');
char* endptr;
- long result = std::strtol(buffer.data(), &endptr, 10);
- if (ok) {
- *ok = !(*endptr) && result <= std::numeric_limits<int>::max() &&
- result >= std::numeric_limits<int>::min();
- }
- return static_cast<int>(result);
+ int result = std::strtol(buffer.data(), &endptr, 10);
+ if (ok) *ok = !(*endptr);
+ return result;
}
const UChar replacementCharacter = 0xFFFD;
@@ -253,7 +249,7 @@
static_cast<UChar32>(0xFA082080UL),
static_cast<UChar32>(0x82082080UL)};
-static inline UChar32 readUTF8Sequence(const char*& sequence, size_t length) {
+static inline UChar32 readUTF8Sequence(const char*& sequence, unsigned length) {
UChar32 character = 0;
// The cases all fall through.
@@ -371,14 +367,6 @@
}
// static
-String16 String16::fromInteger(size_t number) {
- const size_t kBufferSize = 50;
- char buffer[kBufferSize];
- std::snprintf(buffer, kBufferSize, "%zu", number);
- return String16(buffer);
-}
-
-// static
String16 String16::fromDouble(double number) {
const size_t kBufferSize = 100;
char buffer[kBufferSize];
@@ -409,8 +397,8 @@
String16 String16::stripWhiteSpace() const {
if (!length()) return String16();
- size_t start = 0;
- size_t end = length() - 1;
+ unsigned start = 0;
+ unsigned end = length() - 1;
// skip white space from start
while (start <= end && isSpaceOrNewLine(characters16()[start])) ++start;
@@ -468,12 +456,12 @@
true) != conversionOK)
return String16();
- size_t utf16Length = bufferCurrent - bufferStart;
+ unsigned utf16Length = bufferCurrent - bufferStart;
return String16(bufferStart, utf16Length);
}
std::string String16::utf8() const {
- size_t length = this->length();
+ unsigned length = this->length();
if (!length) return std::string("");
« no previous file with comments | « src/inspector/String16.h ('k') | src/inspector/StringUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698