summaryrefslogtreecommitdiff
path: root/absl/strings/internal
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/internal')
-rw-r--r--absl/strings/internal/str_format/output.h4
-rw-r--r--absl/strings/internal/str_format/parser.cc4
-rw-r--r--absl/strings/internal/str_format/parser.h7
-rw-r--r--absl/strings/internal/str_format/parser_test.cc4
-rw-r--r--absl/strings/internal/str_split_internal.h2
5 files changed, 11 insertions, 10 deletions
diff --git a/absl/strings/internal/str_format/output.h b/absl/strings/internal/str_format/output.h
index 3b0aa5e7..12ecd99e 100644
--- a/absl/strings/internal/str_format/output.h
+++ b/absl/strings/internal/str_format/output.h
@@ -69,10 +69,10 @@ class FILERawSink {
// Provide RawSink integration with common types from the STL.
inline void AbslFormatFlush(std::string* out, string_view s) {
- out->append(s.begin(), s.size());
+ out->append(s.data(), s.size());
}
inline void AbslFormatFlush(std::ostream* out, string_view s) {
- out->write(s.begin(), s.size());
+ out->write(s.data(), s.size());
}
template <class AbslCord, typename = typename std::enable_if<
diff --git a/absl/strings/internal/str_format/parser.cc b/absl/strings/internal/str_format/parser.cc
index 10114f48..c3e16fce 100644
--- a/absl/strings/internal/str_format/parser.cc
+++ b/absl/strings/internal/str_format/parser.cc
@@ -81,8 +81,8 @@ static constexpr std::int8_t kIds[] = {
template <bool is_positional>
bool ConsumeConversion(string_view *src, UnboundConversion *conv,
int *next_arg) {
- const char *pos = src->begin();
- const char *const end = src->end();
+ const char *pos = src->data();
+ const char *const end = pos + src->size();
char c;
// Read the next char into `c` and update `pos`. Reads '\0' if at end.
const auto get_char = [&] { c = pos == end ? '\0' : *pos++; };
diff --git a/absl/strings/internal/str_format/parser.h b/absl/strings/internal/str_format/parser.h
index 7414e153..1022f062 100644
--- a/absl/strings/internal/str_format/parser.h
+++ b/absl/strings/internal/str_format/parser.h
@@ -90,7 +90,7 @@ bool ParseFormatString(string_view src, Consumer consumer) {
int next_arg = 0;
while (!src.empty()) {
const char* percent =
- static_cast<const char*>(memchr(src.begin(), '%', src.size()));
+ static_cast<const char*>(memchr(src.data(), '%', src.size()));
if (!percent) {
// We found the last substring.
return consumer.Append(src);
@@ -98,7 +98,7 @@ bool ParseFormatString(string_view src, Consumer consumer) {
// We found a percent, so push the text run then process the percent.
size_t percent_loc = percent - src.data();
if (!consumer.Append(string_view(src.data(), percent_loc))) return false;
- if (percent + 1 >= src.end()) return false;
+ if (percent + 1 >= src.data() + src.size()) return false;
UnboundConversion conv;
@@ -178,7 +178,8 @@ class ParsedFormatBase {
const char* const base = data_.get();
string_view text(base, 0);
for (const auto& item : items_) {
- text = string_view(text.end(), (base + item.text_end) - text.end());
+ const char* const end = text.data() + text.size();
+ text = string_view(end, (base + item.text_end) - end);
if (item.is_conversion) {
if (!consumer.ConvertOne(item.conv, text)) return false;
} else {
diff --git a/absl/strings/internal/str_format/parser_test.cc b/absl/strings/internal/str_format/parser_test.cc
index e698020b..ac6886d0 100644
--- a/absl/strings/internal/str_format/parser_test.cc
+++ b/absl/strings/internal/str_format/parser_test.cc
@@ -66,10 +66,10 @@ class ConsumeUnboundConversionTest : public ::testing::Test {
typedef UnboundConversion Props;
string_view Consume(string_view* src) {
int next = 0;
- const char* prev_begin = src->begin();
+ const char* prev_begin = src->data();
o = UnboundConversion(); // refresh
ConsumeUnboundConversion(src, &o, &next);
- return {prev_begin, static_cast<size_t>(src->begin() - prev_begin)};
+ return {prev_begin, static_cast<size_t>(src->data() - prev_begin)};
}
bool Run(const char *fmt, bool force_positional = false) {
diff --git a/absl/strings/internal/str_split_internal.h b/absl/strings/internal/str_split_internal.h
index 73a30fdf..81e8d555 100644
--- a/absl/strings/internal/str_split_internal.h
+++ b/absl/strings/internal/str_split_internal.h
@@ -159,7 +159,7 @@ class SplitIterator {
}
const absl::string_view text = splitter_->text();
const absl::string_view d = delimiter_.Find(text, pos_);
- if (d.data() == text.end()) state_ = kLastState;
+ if (d.data() == text.data() + text.size()) state_ = kLastState;
curr_ = text.substr(pos_, d.data() - (text.data() + pos_));
pos_ += curr_.size() + d.size();
} while (!predicate_(curr_));