diff --git a/cql3/column_condition.cc b/cql3/column_condition.cc index c92afc0bdf..6b2b210f8b 100644 --- a/cql3/column_condition.cc +++ b/cql3/column_condition.cc @@ -338,7 +338,7 @@ column_condition::raw::prepare(database& db, const sstring& keyspace, const colu const sstring& pattern = literal_term->get_raw_text(); return column_condition::condition(receiver, collection_element_term, _value->prepare(db, keyspace, value_spec), - std::make_unique(bytes_view(reinterpret_cast(pattern.begin()), pattern.size())), + std::make_unique(bytes_view(reinterpret_cast(pattern.data()), pattern.size())), _op); } else { // Pass through rhs value, matcher object built on execution diff --git a/exceptions/exceptions.hh b/exceptions/exceptions.hh index 7319ed03c5..a71f2e3e99 100644 --- a/exceptions/exceptions.hh +++ b/exceptions/exceptions.hh @@ -99,7 +99,7 @@ public: : _code(code) , _msg(std::move(msg)) { } - virtual const char* what() const noexcept override { return _msg.begin(); } + virtual const char* what() const noexcept override { return _msg.c_str(); } exception_code code() const { return _code; } sstring get_message() const { return what(); } }; diff --git a/json.hh b/json.hh index 1de0a252ee..1f71a8358a 100644 --- a/json.hh +++ b/json.hh @@ -71,7 +71,7 @@ inline Json::Value to_json_value(const sstring& raw) { #if defined(JSONCPP_VERSION_HEXA) && (JSONCPP_VERSION_HEXA >= 0x010400) // >= 1.4.0 Json::CharReaderBuilder rbuilder; std::unique_ptr reader(rbuilder.newCharReader()); - bool result = reader->parse(raw.begin(), raw.end(), &root, NULL); + bool result = reader->parse(raw.data(), raw.data() + raw.size(), &root, NULL); if (!result) { throw std::runtime_error(format("Failed to parse JSON: {}", raw)); } @@ -86,7 +86,7 @@ inline bool to_json_value(const sstring& raw, Json::Value& root) { #if defined(JSONCPP_VERSION_HEXA) && (JSONCPP_VERSION_HEXA >= 0x010400) // >= 1.4.0 Json::CharReaderBuilder rbuilder; std::unique_ptr reader(rbuilder.newCharReader()); - return reader->parse(raw.begin(), raw.end(), &root, NULL); + return reader->parse(raw.data(), raw.data() + raw.size(), &root, NULL); #else Json::Reader reader; return reader.parse(std::string{raw}, root); diff --git a/redis/exceptions.hh b/redis/exceptions.hh index 0afb543b86..7e20036971 100644 --- a/redis/exceptions.hh +++ b/redis/exceptions.hh @@ -28,7 +28,7 @@ class redis_exception : public std::exception { sstring _message; public: redis_exception(sstring message) : _message(std::move(message)) {} - virtual const char* what() const noexcept override { return _message.begin(); } + virtual const char* what() const noexcept override { return _message.c_str(); } const sstring& what_message() const noexcept { return _message; } }; diff --git a/serializer_impl.hh b/serializer_impl.hh index 74eb588957..dbc78eeb55 100644 --- a/serializer_impl.hh +++ b/serializer_impl.hh @@ -573,13 +573,13 @@ struct serializer { static sstring read(Input& in) { auto sz = deserialize(in, boost::type()); sstring v(sstring::initialized_later(), sz); - in.read(v.begin(), sz); + in.read(v.data(), sz); return v; } template static void write(Output& out, const sstring& v) { safe_serialize_as_uint32(out, uint32_t(v.size())); - out.write(v.begin(), v.size()); + out.write(v.data(), v.size()); } template static void skip(Input& in) { @@ -712,7 +712,7 @@ unknown_variant_type deserialize(Input& in, boost::type) { auto index = deserialize(in, boost::type()); auto sz = size - sizeof(size_type) * 2; sstring v(sstring::initialized_later(), sz); - in.read(v.begin(), sz); + in.read(v.data(), sz); return unknown_variant_type{ index, std::move(v) }; }); } diff --git a/test/boost/checksum_utils_test.cc b/test/boost/checksum_utils_test.cc index 4b328bed61..b1c5b0b4d5 100644 --- a/test/boost/checksum_utils_test.cc +++ b/test/boost/checksum_utils_test.cc @@ -65,12 +65,12 @@ void test() { for (auto size : {0, 1, 2, 10, 13, 16, 17, 22, 31, 1024, 2000, 80000}) { auto data = make_random_string(size); - auto current = Impl::checksum(data.cbegin(), data.size()); - auto ref_current = ReferenceImpl::checksum(data.cbegin(), data.size()); + auto current = Impl::checksum(data.data(), data.size()); + auto ref_current = ReferenceImpl::checksum(data.data(), data.size()); BOOST_REQUIRE_EQUAL(current, ref_current); - auto new_rolling = Impl::checksum(rolling, data.cbegin(), data.size()); - auto ref_new_rolling = ReferenceImpl::checksum(rolling, data.cbegin(), data.size()); + auto new_rolling = Impl::checksum(rolling, data.data(), data.size()); + auto ref_new_rolling = ReferenceImpl::checksum(rolling, data.data(), data.size()); BOOST_REQUIRE_EQUAL(new_rolling, ref_new_rolling); auto new_rolling_via_combine = Impl::checksum_combine(rolling, current, data.size()); diff --git a/test/boost/sstable_test.cc b/test/boost/sstable_test.cc index 8b5e5488d7..14770fa81f 100644 --- a/test/boost/sstable_test.cc +++ b/test/boost/sstable_test.cc @@ -43,7 +43,7 @@ using namespace sstables; bytes as_bytes(const sstring& s) { - return { reinterpret_cast(s.begin()), s.size() }; + return { reinterpret_cast(s.data()), s.size() }; } future<> test_using_working_sst(schema_ptr s, sstring dir, int64_t gen) { diff --git a/test/perf/perf_cql_parser.cc b/test/perf/perf_cql_parser.cc index d109b863c6..77984e369c 100644 --- a/test/perf/perf_cql_parser.cc +++ b/test/perf/perf_cql_parser.cc @@ -35,7 +35,7 @@ int main(int argc, char* argv[]) { time_it([&] { cql3_parser::CqlLexer::collector_type lexer_error_collector(query); cql3_parser::CqlParser::collector_type parser_error_collector(query); - cql3_parser::CqlLexer::InputStreamType input{reinterpret_cast(query.begin()), ANTLR_ENC_UTF8, static_cast(query.size()), nullptr}; + cql3_parser::CqlLexer::InputStreamType input{reinterpret_cast(query.data()), ANTLR_ENC_UTF8, static_cast(query.size()), nullptr}; cql3_parser::CqlLexer lexer{&input}; lexer.set_error_listener(lexer_error_collector); cql3_parser::CqlParser::TokenStreamType tstream(ANTLR_SIZE_HINT, lexer.get_tokSource()); diff --git a/transport/response.hh b/transport/response.hh index e2359358a7..5738e218fb 100644 --- a/transport/response.hh +++ b/transport/response.hh @@ -109,7 +109,7 @@ private: template sstring make_frame_one(uint8_t version, size_t length) { sstring frame_buf(sstring::initialized_later(), sizeof(CqlFrameHeaderType)); - auto* frame = reinterpret_cast(frame_buf.begin()); + auto* frame = reinterpret_cast(frame_buf.data()); frame->version = version | 0x80; frame->flags = _flags; frame->opcode = static_cast(_opcode);