everywhere: Don't assume sstring::begin() and sstring::end() are pointers

If we switch to using std::string we have to handle begin and end
returning iterators.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
This commit is contained in:
Rafael Ávila de Espíndola
2020-03-05 11:20:46 -08:00
parent 0cb7182768
commit caef2ef903
9 changed files with 15 additions and 15 deletions

View File

@@ -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());

View File

@@ -43,7 +43,7 @@
using namespace sstables;
bytes as_bytes(const sstring& s) {
return { reinterpret_cast<const int8_t*>(s.begin()), s.size() };
return { reinterpret_cast<const int8_t*>(s.data()), s.size() };
}
future<> test_using_working_sst(schema_ptr s, sstring dir, int64_t gen) {

View File

@@ -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<const ANTLR_UINT8*>(query.begin()), ANTLR_ENC_UTF8, static_cast<ANTLR_UINT32>(query.size()), nullptr};
cql3_parser::CqlLexer::InputStreamType input{reinterpret_cast<const ANTLR_UINT8*>(query.data()), ANTLR_ENC_UTF8, static_cast<ANTLR_UINT32>(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());