diff --git a/src/common/hobject.cc b/src/common/hobject.cc index a965c87d622..dffd471b7f9 100644 --- a/src/common/hobject.cc +++ b/src/common/hobject.cc @@ -75,7 +75,7 @@ string hobject_t::to_str() const char snap_with_hash[1000]; char *t = snap_with_hash; - char *end = t + sizeof(snap_with_hash); + const char *end = t + sizeof(snap_with_hash); uint64_t poolid(pool); t += snprintf(t, end - t, "%.*llX", 16, (long long unsigned)poolid); @@ -90,7 +90,7 @@ string hobject_t::to_str() const else t += snprintf(t, end - t, ".%llx", (long long unsigned)snap); - out += string(snap_with_hash); + out.append(snap_with_hash, t); out.push_back('.'); append_escaped(oid.name, &out);