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

Unified Diff: src/inspector/String16.cc

Issue 2343733002: [inspector] enabled presubmit for inspector sub folder (Closed)
Patch Set: more fixes 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
Index: src/inspector/String16.cc
diff --git a/src/inspector/String16.cc b/src/inspector/String16.cc
index ab9956022ca230701f15208b8116586752b30044..eb05287b280d3dc9e58eb00cb1418581174fbfa2 100644
--- a/src/inspector/String16.cc
+++ b/src/inspector/String16.cc
@@ -4,9 +4,6 @@
#include "src/inspector/String16.h"
-#include "src/base/platform/platform.h"
-#include "src/inspector/ProtocolPlatform.h"
-
#include <algorithm>
#include <cctype>
#include <cstdlib>
@@ -15,6 +12,9 @@
#include <locale>
#include <string>
+#include "src/base/platform/platform.h"
+#include "src/inspector/ProtocolPlatform.h"
+
namespace v8_inspector {
namespace {
@@ -39,7 +39,7 @@ 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 = std::strtol(buffer.data(), &endptr, 10);
alph 2016/09/15 17:31:47 strtol returns long. Does it compile?
kozy 2016/09/24 01:35:55 it compiles, I added static_cast to be sure.
if (ok) {
*ok = !(*endptr) && result <= std::numeric_limits<int>::max() &&
result >= std::numeric_limits<int>::min();
@@ -85,17 +85,17 @@ ConversionResult convertUTF16ToUTF8(const UChar** sourceStart,
char* target = *targetStart;
while (source < sourceEnd) {
UChar32 ch;
- unsigned short bytesToWrite = 0;
+ uint8_t bytesToWrite = 0;
alph 2016/09/15 17:31:47 I don't see a point of using byte type here. Use t
kozy 2016/09/24 01:35:55 uint32_t
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;
@@ -141,16 +141,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;
}

Powered by Google App Engine
This is Rietveld 408576698