pivotal-jbarrett commented on a change in pull request #861:
URL: https://github.com/apache/geode-native/pull/861#discussion_r696931901
##########
File path: cppcache/integration-test/testExpiration.cpp
##########
@@ -54,33 +54,26 @@ void startDSandCreateCache(std::shared_ptr<Cache> &cache) {
void doNPuts(std::shared_ptr<Region> &rptr, int n) {
std::shared_ptr<CacheableString> value;
- char buf[16];
- memset(buf, 'A', 15);
- buf[15] = '\0';
- memcpy(buf, "Value - ", 8);
- value = CacheableString::create(buf);
+ value = CacheableString::create("Value - AAAAAAA");
ASSERT(value != nullptr, "Failed to create value.");
for (int i = 0; i < n; i++) {
- sprintf(buf, "KeyA - %d", i + 1);
- auto key = CacheableKey::create(buf);
- LOGINFO("Putting key %s value %s in region %s", buf,
+ auto keyStr = std::string("KeyA - ") + std::to_string(i + 1);
+ auto key = CacheableKey::create(keyStr.c_str());
Review comment:
Don't call `c_str()`.
##########
File path: cppcache/integration-test/testThinClientLRUExpiration.cpp
##########
@@ -172,19 +172,15 @@ void createRegion(const char *name, bool ackMode,
void doRgnOperations(const char *name, int n, int rgnOpt = 0) {
std::shared_ptr<CacheableString> value;
- char buf[16];
if (rgnOpt == 0) {
- memset(buf, 'A', 15);
- buf[15] = '\0';
- memcpy(buf, "Value - ", 8);
- value = CacheableString::create(buf);
+ value = CacheableString::create("Value - AAAAAAA");
ASSERT(value != nullptr, "Failed to create value.");
}
auto rptr = getHelper()->getRegion(name);
ASSERT(rptr != nullptr, "Region not found.");
for (int i = 0; i < n; i++) {
- sprintf(buf, "KeyA - %d", i + 1);
- auto key = CacheableKey::create(buf);
+ auto keyStr = std::string("KeyA - ") + std::to_string(i + 1);
+ auto key = CacheableKey::create(keyStr.c_str());
Review comment:
Don't call `c_str()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]