Parcourir la source

[5110] Minor changes after review:

 - port check fixed
 - removed 2 unused parameter warnings
 - one typo corrected
Tomek Mrugalski il y a 8 ans
Parent
commit
8d39e95282

+ 4 - 4
src/bin/d2/d2_parser.yy

@@ -272,8 +272,8 @@ ip_address: IP_ADDRESS {
 };
 
 port: PORT COLON INTEGER {
-    if ($3 <= 0 || $3 >= 65792 ) {
-        error(@3, "port must be greater than zero but less than 65792");
+    if ($3 <= 0 || $3 >= 65535 ) {
+        error(@3, "port must be greater than zero but less than 65535");
     }
     ElementPtr i(new IntElement($3, ctx.loc2pos(@3)));
     ctx.stack_.back()->set("port", i);
@@ -484,8 +484,8 @@ dns_server_ip_address: IP_ADDRESS {
 };
 
 dns_server_port: PORT COLON INTEGER {
-    if ($3 <= 0 || $3 >= 65792 ) {
-        error(@3, "port must be greater than zero but less than 65792");
+    if ($3 <= 0 || $3 >= 65535 ) {
+        error(@3, "port must be greater than zero but less than 65536");
     }
     ElementPtr i(new IntElement($3, ctx.loc2pos(@3)));
     ctx.stack_.back()->set("port", i);

+ 1 - 1
src/bin/d2/tests/d2_cfg_mgr_unittests.cc

@@ -421,7 +421,7 @@ TEST_F(D2CfgMgrTest, invalidEntry) {
 
     // Cannot use port  0
     config = makeParamsConfigString ("127.0.0.1", 0, 333, "UDP", "JSON");
-    SYNTAX_ERROR(config, "<string>:1.40: port must be greater than zero but less than 65792");
+    SYNTAX_ERROR(config, "<string>:1.40: port must be greater than zero but less than 65535");
 
     // Cannot use dns server timeout of 0
     config = makeParamsConfigString ("127.0.0.1", 777, 0, "UDP", "JSON");

+ 2 - 2
src/bin/d2/tests/d2_simple_parser_unittest.cc

@@ -150,7 +150,7 @@ class D2SimpleParserTest : public ::testing::Test {
 public:
     /// @brief Constructor
     ///
-    /// @param parser_type specificies the parsing starting point at which
+    /// @param parser_type specifies the parsing starting point at which
     /// the JSON parser should begin. It defaults to PARSER_JSON. See @c
     /// D2ParserContext::ParserType for all possible values.
     D2SimpleParserTest(const D2ParserContext::ParserType&
@@ -835,7 +835,7 @@ TEST_F(DnsServerInfoParserTest, invalidEntry) {
     config = "{ \"hostname\": \"\", "
              "  \"ip-address\": \"192.168.5.6\" ,"
              "  \"port\": -100 }";
-    PARSE_FAIL(config, "<string>:1.60-63: port must be greater than zero but less than 65792");
+    PARSE_FAIL(config, "<string>:1.60-63: port must be greater than zero but less than 65536");
 }
 
 

+ 1 - 1
src/bin/d2/tests/testdata/d2_cfg_tests.json

@@ -163,7 +163,7 @@
 #-----
 ,{
 "description" : "D2Params.port can't be 0",
-"syntax-error" : "<string>:1.33: port must be greater than zero but less than 65792",
+"syntax-error" : "<string>:1.33: port must be greater than zero but less than 65536",
 "data" :
     {
     "port" : 0,

+ 1 - 0
src/lib/process/d_controller.h

@@ -429,6 +429,7 @@ protected:
     /// @return pointer to the elements created
     ///
     virtual isc::data::ConstElementPtr parseText(const std::string& input) {
+        static_cast<void>(input); // just tu shut up the unused parameter warning
         isc::data::ConstElementPtr elements;
         return (elements);
     }

+ 1 - 1
src/lib/process/testutils/d_test_stubs.cc

@@ -195,7 +195,7 @@ DStubController::processSignal(int signum){
 }
 
 isc::data::ConstElementPtr
-DStubController::parseFile(const std::string& file_name) {
+DStubController::parseFile(const std::string& /*file_name*/) {
     isc::data::ConstElementPtr elements;
     if (use_alternate_parser_) {
         std::ostringstream os;