diff --git a/google/cloud/bigtable/bytes.h b/google/cloud/bigtable/bytes.h index aca790a185f6b..53d91facea372 100644 --- a/google/cloud/bigtable/bytes.h +++ b/google/cloud/bigtable/bytes.h @@ -44,6 +44,9 @@ class Bytes { /// An empty sequence. Bytes() = default; + /// Stops copying at the null-terminator character from input bytes. + explicit Bytes(char const* bytes) : bytes_(bytes) {} + /// @name Construction from a sequence of octets. ///@{ template diff --git a/google/cloud/bigtable/bytes_test.cc b/google/cloud/bigtable/bytes_test.cc index 8d9c562cd46c4..070c614ab2ba7 100644 --- a/google/cloud/bigtable/bytes_test.cc +++ b/google/cloud/bigtable/bytes_test.cc @@ -105,8 +105,8 @@ TEST(Bytes, OutputStream) { {Bytes(std::string("a\377B")), R"(B"a\377B")"}, {Bytes(std::string("!@#$%^&*()-.")), R"(B"!@#$%^&*()-.")"}, {Bytes(std::string(3, '\0')), R"(B"\000\000\000")"}, - {Bytes(""), R"(B"\000")"}, - {Bytes("foo"), R"(B"foo\000")"}, + {Bytes(""), R"(B"")"}, + {Bytes("foo"), R"(B"foo")"}, }; for (auto const& tc : test_cases) {