src: fix warnings around node_options · nodejs/node@e6c1ad5 (original) (raw)

5 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -213,15 +213,15 @@ auto OptionsParser::Convert(
213 213 template
214 214 template
215 215 void OptionsParser::Insert(
216 -const OptionsParser* child_options_parser,
216 +const OptionsParser& child_options_parser,
217 217 ChildOptions* (Options::* get_child)()) {
218 - aliases_.insert(child_options_parser->aliases_.begin(),
219 -child_options_parser->aliases_.end());
218 + aliases_.insert(std::begin(child_options_parser.aliases_),
219 +std::end(child_options_parser.aliases_));
220 220
221 -for (const auto& pair : child_options_parser->options_)
221 +for (const auto& pair : child_options_parser.options_)
222 222 options_.emplace(pair.first, Convert(pair.second, get_child));
223 223
224 -for (const auto& pair : child_options_parser->implications_)
224 +for (const auto& pair : child_options_parser.implications_)
225 225 implications_.emplace(pair.first, Convert(pair.second, get_child));
226 226 }
227 227
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@ class EnvironmentOptionsParser : public OptionsParser {
121 121 EnvironmentOptionsParser();
122 122 explicit EnvironmentOptionsParser(const DebugOptionsParser& dop)
123 123 : EnvironmentOptionsParser() {
124 -Insert(&dop, &EnvironmentOptions::get_debug_options);
124 +Insert(dop, &EnvironmentOptions::get_debug_options);
125 125 }
126 126 };
127 127
@@ -386,7 +386,7 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(
386 386 kAllowedInEnvironment);
387 387 #endif // NODE_REPORT
388 388
389 -Insert(&eop, &PerIsolateOptions::get_per_env_options);
389 +Insert(eop, &PerIsolateOptions::get_per_env_options);
390 390 }
391 391
392 392 PerProcessOptionsParser::PerProcessOptionsParser(
@@ -496,7 +496,7 @@ PerProcessOptionsParser::PerProcessOptionsParser(
496 496 #endif
497 497 #endif
498 498
499 -Insert(&iop, &PerProcessOptions::get_per_isolate_options);
499 +Insert(iop, &PerProcessOptions::get_per_isolate_options);
500 500 }
501 501
502 502 inline std::string RemoveBrackets(const std::string& host) {
@@ -510,7 +510,8 @@ inline int ParseAndValidatePort(const std::string& port,
510 510 std::vectorstd::string* errors) {
511 511 char* endptr;
512 512 errno = 0;
513 -const long result = strtol(port.c_str(), &endptr, 10); // NOLINT(runtime/int)
513 +const unsigned long result = // NOLINT(runtime/int)
514 +strtoul(port.c_str(), &endptr, 10);
514 515 if (errno != 0 |
515 516 (result != 0 && result < 1024) |
516 517 errors->push_back(" must be 0 or in range 1024 to 65535.");
Original file line number Diff line number Diff line change
@@ -297,7 +297,7 @@ class OptionsParser {
297 297 // a method that yields the target options type from this parser's options
298 298 // type.
299 299 template
300 -void Insert(const OptionsParser* child_options_parser,
300 +void Insert(const OptionsParser& child_options_parser,
301 301 ChildOptions* (Options::* get_child)());
302 302
303 303 // Parse a sequence of options into an options struct, a list of
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
1 -#include <climits> // PATH_MAX
2 -
3 1 #include "env-inl.h"
4 2 #include "node_internals.h"
5 3 #include "node_options-inl.h"
@@ -8,6 +6,8 @@
8 6 #include "node_revert.h"
9 7 #include "util-inl.h"
10 8
9 +#include <climits> // PATH_MAX
10 +
11 11 namespace node {
12 12 using v8::Context;
13 13 using v8::DEFAULT;
Original file line number Diff line number Diff line change
@@ -447,13 +447,13 @@ void Worker::New(const FunctionCallbackInfo& args) {
447 447 // The first argument is program name.
448 448 invalid_args.erase(invalid_args.begin());
449 449 if (errors.size() > 0 |
450 - v8::Localv8::Value value =
450 + v8::Localv8::Value error =
451 451 ToV8Value(env->context(),
452 452 errors.size() > 0 ? errors : invalid_args)
453 453 .ToLocalChecked();
454 454 Local key =
455 455 FIXED_ONE_BYTE_STRING(env->isolate(), "invalidExecArgv");
456 - args.This()->Set(env->context(), key, value).FromJust();
456 +USE(args.This()->Set(env->context(), key, error).FromJust());
457 457 return;
458 458 }
459 459 }