]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
test/rgw: fix -Wstring-plus-char warning in test_d4n_policy 67665/head
authorKefu Chai <k.chai@proxmox.com>
Thu, 5 Mar 2026 04:59:54 +0000 (12:59 +0800)
committerKefu Chai <k.chai@proxmox.com>
Thu, 5 Mar 2026 05:07:12 +0000 (13:07 +0800)
commit8df5776c162c9d9e90390be1e7afd8c32e1bc0d9
tree762ef3d41572c69e49ab34d79ddb3d4aee9dfc8b
parentfc321295b7feb34f382e3424b37cb439c1d52056
test/rgw: fix -Wstring-plus-char warning in test_d4n_policy

`c_str() + '\0'` adds char value 0 to the pointer, which is a no-op.
The null terminator is already included by passing `length() + 1` as the
length argument to append(). Drop the spurious `+ '\0'`.

this change addresses the warning:

```
[1588/1869] Building CXX object src/test/rgw/CMakeFiles/ceph_test_rgw_d4n_policy.dir/test_d4n_policy.cc.o
/home/kefu/dev/ceph/src/test/rgw/test_d4n_policy.cc:324:39: warning: adding 'char' to a string pointer does not append to the string [-Wstring-plus-char]
  324 |     attrVal.append(length_str.c_str() + '\0', length_str.length() + 1);
      |                    ~~~~~~~~~~~~~~~~~~~^~~~~~
/home/kefu/dev/ceph/src/test/rgw/test_d4n_policy.cc:324:39: note: use array indexing to silence this warning
  324 |     attrVal.append(length_str.c_str() + '\0', length_str.length() + 1);
      |                                       ^
      |                    &                  [     ]
```

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/test/rgw/test_d4n_policy.cc