diff --git a/samples/lineprocessor.cc b/samples/lineprocessor.cc index 505dabf945..61517d36e5 100644 --- a/samples/lineprocessor.cc +++ b/samples/lineprocessor.cc @@ -152,7 +152,7 @@ int RunMain(int argc, char* argv[]) { } else if (strcmp(str, "--main-cycle-in-js") == 0) { cycle_type = CycleInJs; } else if (strcmp(str, "-p") == 0 && i + 1 < argc) { - port_number = atoi(argv[i + 1]); + port_number = atoi(argv[i + 1]); // NOLINT i++; } else if (strncmp(str, "--", 2) == 0) { printf("Warning: unknown flag %s.\nTry --help for options\n", str); diff --git a/src/d8-readline.cc b/src/d8-readline.cc index 34b7b60df2..67fc9eff7e 100644 --- a/src/d8-readline.cc +++ b/src/d8-readline.cc @@ -27,8 +27,8 @@ #include // NOLINT -#include -#include +#include // NOLINT +#include // NOLINT #include "d8.h" diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index 92e18e0685..23d1a576fa 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -3884,6 +3884,11 @@ bool IsEvaluateResponseMessage(char* message) { } +static int StringToInt(const char* s) { + return atoi(s); // NOLINT +} + + // We match parts of the message to get evaluate result int value. int GetEvaluateIntResult(char *message) { const char* value = "\"value\":"; @@ -3892,7 +3897,7 @@ int GetEvaluateIntResult(char *message) { return -1; } int res = -1; - res = atoi(pos + strlen(value)); + res = StringToInt(pos + strlen(value)); return res; } @@ -3905,7 +3910,7 @@ int GetBreakpointIdFromBreakEventMessage(char *message) { return -1; } int res = -1; - res = atoi(pos + strlen(breakpoints)); + res = StringToInt(pos + strlen(breakpoints)); return res; } @@ -3918,11 +3923,7 @@ int GetTotalFramesInt(char *message) { return -1; } pos += strlen(prefix); - char* pos_end = pos; - int res = static_cast(strtol(pos, &pos_end, 10)); - if (pos_end == pos) { - return -1; - } + int res = StringToInt(pos); return res; }