]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librados/c_read_operations.cc: fix invalid checks
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 30 Oct 2014 02:57:16 +0000 (03:57 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 11 Nov 2014 12:26:37 +0000 (13:26 +0100)
Wrong variable for return of rados_getxattrs_next() and
rados_omap_get_next() used (len vs. val_len).

Fix for:

CID 1219464 (#1 of 1): Logically dead code (DEADCODE)
 dead_error_line: Execution cannot reach this expression
 key == NULL inside statement if (len == 0UL && key == NU...

CID 1219465 (#1 of 1): Logically dead code (DEADCODE)
 dead_error_line: Execution cannot reach this expression
 key == NULL inside statement if (len == 0UL && key == NU...

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/test/librados/c_read_operations.cc

index 3ca31f4ce42e9e4a2727f4c8b765e33f715ad969..33a4675f2e286755af49444f0de8e84b29861f07 100644 (file)
@@ -70,7 +70,7 @@ protected:
     size_t val_len = 0;
     while (i < len) {
       ASSERT_EQ(0, rados_omap_get_next(iter, &key, &val, &val_len));
-      if (len == 0 && key == NULL && val == NULL)
+      if (val_len == 0 && key == NULL && val == NULL)
        break;
       if (key)
        EXPECT_EQ(std::string(keys[i]), std::string(key));
@@ -101,7 +101,7 @@ protected:
     while (i < len) {
       ASSERT_EQ(0, rados_getxattrs_next(iter, (const char**) &key,
                                        (const char**) &val, &val_len));
-      if (len == 0 && key == NULL && val == NULL)
+      if (val_len == 0 && key == NULL && val == NULL)
        break;
       EXPECT_EQ(std::string(keys[i]), std::string(key));
       EXPECT_EQ(0, memcmp(vals[i], val, val_len));