"Fossies" - the Fresh Open Source Software Archive

Member "qt-everywhere-src-6.3.1/qtwebengine/src/3rdparty/chromium/third_party/tensorflow-text/patches/0001-convert-string_view-to-StringPiece-for-FindAndConsum.patch" (8 Jun 2022, 2479 Bytes) of package /linux/misc/qt-everywhere-src-6.3.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 From 854084169d48807d67179b2861c512294b4dbd28 Mon Sep 17 00:00:00 2001
    2 From: Michael Crouse <mcrouse@chromium.org>
    3 Date: Thu, 28 Jan 2021 16:05:36 -0800
    4 Subject: [PATCH] convert string_view to StringPiece for FindAndConsume
    5 
    6 ---
    7  .../src/tensorflow_text/core/kernels/regex_split.cc    | 10 +++++-----
    8  1 file changed, 5 insertions(+), 5 deletions(-)
    9 
   10 diff --git a/third_party/tensorflow-text/src/tensorflow_text/core/kernels/regex_split.cc b/third_party/tensorflow-text/src/tensorflow_text/core/kernels/regex_split.cc
   11 index aa17d772dcfc..3165412d5088 100644
   12 --- a/third_party/tensorflow-text/src/tensorflow_text/core/kernels/regex_split.cc
   13 +++ b/third_party/tensorflow-text/src/tensorflow_text/core/kernels/regex_split.cc
   14 @@ -28,11 +28,11 @@ void RegexSplitImpl(absl::string_view input,
   15                      std::vector<absl::string_view>* tokens,
   16                      std::vector<T>* begin_offsets,
   17                      std::vector<T>* end_offsets) {
   18 -  absl::string_view leftover(input.data());
   19 -  absl::string_view last_end = leftover;
   20 +  re2::StringPiece leftover(input.data());
   21 +  re2::StringPiece last_end = leftover;
   22  
   23    // Keep looking for split points until we have reached the end of the input.
   24 -  absl::string_view extracted_delim_token;
   25 +  re2::StringPiece extracted_delim_token;
   26    while (RE2::FindAndConsume(&leftover, re2, &extracted_delim_token)) {
   27      absl::string_view token(last_end.data(),
   28                              extracted_delim_token.data() - last_end.data());
   29 @@ -52,7 +52,7 @@ void RegexSplitImpl(absl::string_view input,
   30  
   31      if (should_include_delim) {
   32        // If desired, include the deliminator as a token.
   33 -      tokens->push_back(extracted_delim_token);
   34 +      tokens->push_back(absl:string_view(extracted_delim_token.data(),
   35 +                                         extracted_delim_token.size()));
   36        // Mark the end of the token at the end of the beginning of the delimiter.
   37        begin_offsets->push_back(extracted_delim_token.data() - input.begin());
   38        end_offsets->push_back(extracted_delim_token.data() +
   39 @@ -62,7 +62,7 @@ void RegexSplitImpl(absl::string_view input,
   40  
   41    // Close the last token.
   42    if (!leftover.empty()) {
   43 -    tokens->push_back(leftover);
   44 +    tokens->push_back(absl::string_view(leftover.data(), leftover.size()));
   45      begin_offsets->push_back(leftover.data() - input.begin());
   46      end_offsets->push_back(leftover.data() + leftover.length() - input.begin());
   47    }
   48 -- 
   49 2.30.0.365.g02bc693789-goog
   50