]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4045] Fixed some cppcheck reports (first round)
authorFrancis Dupont <fdupont@isc.org>
Wed, 23 Sep 2015 10:51:41 +0000 (12:51 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 23 Sep 2015 10:51:41 +0000 (12:51 +0200)
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/hooks/tests/hooks_manager_unittest.cc
src/lib/hooks/tests/library_manager_collection_unittest.cc

index b49fc4dd08a0a5fd6402b8a7f81aaf6afe736fd0..8e38e7457bc810b3b49ef2702e1f9b9c1e652752 100644 (file)
@@ -567,7 +567,7 @@ Memfile_LeaseMgr::updateLease4(const Lease4Ptr& lease) {
 
     // Lease must exist if it is to be updated.
     Lease4StorageAddressIndex::const_iterator lease_it = index.find(lease->addr_);
-    if (lease_it == storage4_.end()) {
+    if (lease_it == index.end()) {
         isc_throw(NoSuchLease, "failed to update the lease with address "
                   << lease->addr_ << " - no such lease");
     }
index 7386b7a94ed242068ed0d0485881f29194a6dbea..ec5bfe2c1f686c83184802a62b99fdd737f52567 100644 (file)
@@ -101,10 +101,14 @@ public:
 
 private:
     /// To avoid unused variable errors
-    void dummy() {
-        std::string n = MARKER_FILE;
-        n = LOAD_CALLOUT_LIBRARY;
-        n = LOAD_ERROR_CALLOUT_LIBRARY;
+    std::string dummy(int i) {
+        if (i == 0) {
+            return (MARKER_FILE);
+        } else if (i > 0) {
+            return (LOAD_CALLOUT_LIBRARY);
+        } else {
+            return (LOAD_ERROR_CALLOUT_LIBRARY);
+        }
     }
 };
 
index 6a3e5d071efc82a8555424e7eb7be9cab1ef3e2e..0f578a62c6bff6c46de4cda89fffcb3312252d88 100644 (file)
@@ -39,10 +39,14 @@ class LibraryManagerCollectionTest : public ::testing::Test,
                                      public HooksCommonTestClass {
 private:
     /// To avoid unused variable errors
-    void dummy() {
-        std::string n = MARKER_FILE;
-        n = LOAD_CALLOUT_LIBRARY;
-        n = LOAD_ERROR_CALLOUT_LIBRARY;
+    std::string dummy(int i) {
+        if (i == 0) {
+            return (MARKER_FILE);
+        } else if (i > 0) {
+            return (LOAD_CALLOUT_LIBRARY);
+        } else {
+            return (LOAD_ERROR_CALLOUT_LIBRARY);
+        }
     }
 };