]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2798] fixed compilation warnings
authorRazvan Becheriu <razvan@isc.org>
Tue, 2 May 2023 12:49:37 +0000 (15:49 +0300)
committerRazvan Becheriu <razvan@isc.org>
Tue, 2 May 2023 12:49:37 +0000 (15:49 +0300)
src/bin/netconf/netconf.cc
src/hooks/dhcp/high_availability/tests/communication_state_unittest.cc
src/lib/cc/tests/simple_parser_unittest.cc
src/lib/dhcp/tests/option_custom_unittest.cc
src/lib/dhcpsrv/tests/client_class_def_unittest.cc
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
src/lib/http/tests/request_unittests.cc

index 5d8e3fd2a6ada29b19c6df12f107dcfe12f69ce9..2bd681a617b71bf13a5c4a29815e7134c389a1ec 100644 (file)
@@ -449,7 +449,7 @@ NetconfAgent::subscribeToDataChanges(const CfgServersMapPair& service_pair) {
         }
         Subscription subscription(
             running_sess_->onModuleChange(model, callback, nullopt, 0, options));
-        subscriptions_.emplace(server, forward<Subscription>(subscription));
+        subscriptions_.emplace(server, std::forward<Subscription>(subscription));
     } catch (exception const& ex) {
         ostringstream msg;
         msg << "module change subscribe failed with " << ex.what();
@@ -488,7 +488,7 @@ NetconfAgent::subscribeToNotifications(const CfgServersMapPair& service_pair) {
     };
     try {
         Subscription subscription(running_sess_->onNotification(model, callback));
-        subscriptions_.emplace(server, forward<Subscription>(subscription));
+        subscriptions_.emplace(server, std::forward<Subscription>(subscription));
     } catch (exception const& ex) {
         ostringstream msg;
         msg << "event notification subscription for model " << model <<
index 501fc0e883dd8d1b4bd98891b86dc6d43e9352ab..8c33c094ed9375d946205fba39817069d15d0ec0 100644 (file)
@@ -978,6 +978,15 @@ TEST_F(CommunicationStateTest, partnerStateTestMultiThreading) {
     partnerStateTest();
 }
 
+TEST_F(CommunicationStateTest, partnerStateUnavailableTest) {
+    partnerStateUnavailableTest();
+}
+
+TEST_F(CommunicationStateTest, partnerStateUnavailableTestMultiThreading) {
+    MultiThreadingMgr::instance().setMode(true);
+    partnerStateUnavailableTest();
+}
+
 TEST_F(CommunicationStateTest, partnerScopesTest) {
     partnerScopesTest();
 }
index 58aa40d6b859157be1213de8dd37c221a5019678..51fff614acdc115a45591f397e3a03d057ad6782 100644 (file)
@@ -251,7 +251,7 @@ TEST_F(SimpleParserTest, getInteger) {
 
     // The value specified is 100.
     ElementPtr json = Element::fromJSON("{ \"bar\": 100 }");
-    int64_t x;
+    int64_t x = -1;
 
     // Positive case: we expect value in range 0..200. All ok.
     EXPECT_NO_THROW(x = SimpleParser::getInteger(json, "bar", 0, 200));
index 56e6d6c27c8a994ea7cc77f93f1a6e3eea60b7e3..27c3a438c7a0199cafeea93450260aa37fc7408b 100644 (file)
@@ -1737,13 +1737,13 @@ TEST_F(OptionCustomTest, setUint16DataArray) {
     ASSERT_EQ(3, option->getDataFieldsNum());
 
     // Check that the values have been correctly set.
-    uint16_t value0;
+    uint16_t value0 = 0;
     ASSERT_NO_THROW(value0 = option->readInteger<uint16_t>(0));
     EXPECT_EQ(67, value0);
-    uint16_t value1;
+    uint16_t value1 = 0;
     ASSERT_NO_THROW(value1 = option->readInteger<uint16_t>(1));
     EXPECT_EQ(876, value1);
-    uint16_t value2;
+    uint16_t value2 = 0;
     ASSERT_NO_THROW(value2 = option->readInteger<uint16_t>(2));
     EXPECT_EQ(32222, value2);
 }
@@ -2042,7 +2042,7 @@ TEST_F(OptionCustomTest, setRecordData) {
     ASSERT_EQ(9, option->getDataFieldsNum());
 
     // Check that the default values have been correctly set.
-    uint16_t value0;
+    uint16_t value0 = 0;
     ASSERT_NO_THROW(value0 = option->readInteger<uint16_t>(0));
     EXPECT_EQ(0, value0);
     bool value1 = true;
@@ -2133,7 +2133,7 @@ TEST_F(OptionCustomTest, setRecordArrayData) {
     ASSERT_EQ(9, option->getDataFieldsNum());
 
     // Check that the default values have been correctly set.
-    uint16_t value0;
+    uint16_t value0 = 0;
     ASSERT_NO_THROW(value0 = option->readInteger<uint16_t>(0));
     EXPECT_EQ(0, value0);
     bool value1 = true;
@@ -2368,7 +2368,7 @@ TEST_F(OptionCustomTest, unpackRecordArray) {
     ASSERT_EQ(4, option->getDataFieldsNum());
 
     // We expect a 16 bit integer
-    uint16_t value0;
+    uint16_t value0 = 0;
     ASSERT_NO_THROW(value0 = option->readInteger<uint16_t>(0));
     EXPECT_EQ(8712, value0);
 
index 429c7c29742c433bbd72407b96a0b4910b748a03..8fc5aed213d2fc984336f3cd6b6e0f0d8f1d7db3 100644 (file)
@@ -732,10 +732,10 @@ TEST(ClientClassDictionary, unparseDict) {
                     "\"option-data\": [ ] }");
     };
 
-    std::string expected = "[\n" +
-        add_defaults("one") + ",\n" +
-        add_defaults("two") + ",\n" +
-        add_defaults("three") + "]\n";
+    std::string expected = "[\n";
+    expected += add_defaults("one") + ",\n";
+    expected += add_defaults("two") + ",\n";
+    expected += add_defaults("three") + "]\n";
 
     runToElementTest<ClientClassDictionary>(expected, *dictionary);
 }
@@ -1587,10 +1587,10 @@ TEST(ClientClassDictionary, templateUnparseDict) {
                     "\"option-data\": [ ] }");
     };
 
-    std::string expected = "[\n" +
-        add_defaults("one") + ",\n" +
-        add_defaults("two") + ",\n" +
-        add_defaults("three") + "]\n";
+    std::string expected = "[\n";
+    expected += add_defaults("one") + ",\n";
+    expected += add_defaults("two") + ",\n";
+    expected += add_defaults("three") + "]\n";
 
     runToElementTest<ClientClassDictionary>(expected, *dictionary);
 }
index 0cca269d2da0abfdcb073b1a8654fb7cb2dcb68b..489f7cca0c38b10626654a4ec59fcb4ce90cd6f5 100644 (file)
@@ -1296,9 +1296,9 @@ TEST_F(ParseConfigTest, encapsulatedOptionData) {
         (getOptionPtr(MAPE_V6_OPTION_SPACE, D6O_S46_RULE));
     ASSERT_TRUE(s46_rule);
 
-    uint8_t flags;
-    uint8_t ea_len;
-    uint8_t prefix4_len;
+    uint8_t flags = 0;
+    uint8_t ea_len = 0;
+    uint8_t prefix4_len = 0;
     IOAddress ipv4_prefix(IOAddress::IPV4_ZERO_ADDRESS());
     PrefixTuple ipv6_prefix(PrefixLen(0), IOAddress::IPV6_ZERO_ADDRESS());;
 
index f902400420c50f22ae0ac2ce41887e77c03d217a..9ba987e348fb24b03d4617a906b0739579c6966b 100644 (file)
@@ -139,7 +139,7 @@ TEST_F(HttpRequestTest, includeHeaders) {
     ASSERT_NO_THROW(content_type = request_->getHeaderValue("Content-Type"));
     EXPECT_EQ("application/json", content_type);
 
-    uint64_t content_length;
+    uint64_t content_length = 0;
     ASSERT_NO_THROW(
         content_length = request_->getHeaderValueAsUint64("Content-Length")
     );