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

Unified Diff: src/inspector/string-16.cc

Issue 2343733002: [inspector] enabled presubmit for inspector sub folder (Closed)
Patch Set: addressed comments 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/string-16.h ('k') | src/inspector/string-util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/string-16.cc
diff --git a/src/inspector/string-16.cc b/src/inspector/string-16.cc
index d4eedb450b483c7c330829f5613d3e7d4e8b76a7..e0cf0059a6f7f31abbbbabbed19e8ea3a94d6282 100644
--- a/src/inspector/string-16.cc
+++ b/src/inspector/string-16.cc
@@ -3,8 +3,6 @@
// found in the LICENSE file.
#include "src/inspector/string-16.h"
-#include "src/base/platform/platform.h"
-#include "src/inspector/protocol-platform.h"
#include <algorithm>
#include <cctype>
@@ -14,6 +12,9 @@
#include <locale>
#include <string>
+#include "src/base/platform/platform.h"
+#include "src/inspector/protocol-platform.h"
+
namespace v8_inspector {
namespace {
@@ -38,7 +39,8 @@ int charactersToInteger(const UChar* characters, size_t length,
buffer.push_back('\0');
char* endptr;
- long result = std::strtol(buffer.data(), &endptr, 10);
+ int64_t result =
+ static_cast<int64_t>(std::strtol(buffer.data(), &endptr, 10));
if (ok) {
*ok = !(*endptr) && result <= std::numeric_limits<int>::max() &&
result >= std::numeric_limits<int>::min();
@@ -84,17 +86,17 @@ ConversionResult convertUTF16ToUTF8(const UChar** sourceStart,
char* target = *targetStart;
while (source < sourceEnd) {
UChar32 ch;
- unsigned short bytesToWrite = 0;
+ uint32_t bytesToWrite = 0;
const UChar32 byteMask = 0xBF;
const UChar32 byteMark = 0x80;
const UChar* oldSource =
source; // In case we have to back up because of target overflow.
- ch = static_cast<unsigned short>(*source++);
+ ch = static_cast<uint16_t>(*source++);
// If we have a surrogate pair, convert to UChar32 first.
if (ch >= 0xD800 && ch <= 0xDBFF) {
// If the 16 bits following the high surrogate are in the source buffer...
if (source < sourceEnd) {
- UChar32 ch2 = static_cast<unsigned short>(*source);
+ UChar32 ch2 = static_cast<uint16_t>(*source);
// If it's a low surrogate, convert to UChar32.
if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
ch = ((ch - 0xD800) << 10) + (ch2 - 0xDC00) + 0x0010000;
@@ -140,16 +142,16 @@ ConversionResult convertUTF16ToUTF8(const UChar** sourceStart,
}
switch (bytesToWrite) { // note: everything falls through.
case 4:
- *--target = (char)((ch | byteMark) & byteMask);
+ *--target = static_cast<char>((ch | byteMark) & byteMask);
ch >>= 6;
case 3:
- *--target = (char)((ch | byteMark) & byteMask);
+ *--target = static_cast<char>((ch | byteMark) & byteMask);
ch >>= 6;
case 2:
- *--target = (char)((ch | byteMark) & byteMask);
+ *--target = static_cast<char>((ch | byteMark) & byteMask);
ch >>= 6;
case 1:
- *--target = (char)(ch | firstByteMark[bytesToWrite]);
+ *--target = static_cast<char>(ch | firstByteMark[bytesToWrite]);
}
target += bytesToWrite;
}
« no previous file with comments | « src/inspector/string-16.h ('k') | src/inspector/string-util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698