| Index: third_party/re2/util/strutil.cc
|
| diff --git a/third_party/re2/util/strutil.cc b/third_party/re2/util/strutil.cc
|
| index d3a0249133df514ff107d9c8a539effa6f3230bf..6ab79b3c6b60ac1caa3b5384a9bb4dd7822829b6 100644
|
| --- a/third_party/re2/util/strutil.cc
|
| +++ b/third_party/re2/util/strutil.cc
|
| @@ -20,7 +20,7 @@
|
| int used = 0;
|
|
|
| for (; src < src_end; src++) {
|
| - if (dest_len - used < 2) // space for two-character escape
|
| + if (dest_len - used < 2) // Need space for two letter escape
|
| return -1;
|
|
|
| unsigned char c = *src;
|
| @@ -36,15 +36,9 @@
|
| // digit then that digit must be escaped too to prevent it being
|
| // interpreted as part of the character code by C.
|
| if (c < ' ' || c > '~') {
|
| - if (dest_len - used < 5) // space for four-character escape + \0
|
| + if (dest_len - used < 4) // need space for 4 letter escape
|
| return -1;
|
| -#if !defined(_WIN32)
|
| - snprintf(dest + used, 5, "\\%03o", c);
|
| -#else
|
| - // On Windows, the function takes 4+VA arguments, not 3+VA. With an
|
| - // array, the buffer size will be inferred, but not with a pointer.
|
| - snprintf(dest + used, 5, _TRUNCATE, "\\%03o", c);
|
| -#endif
|
| + sprintf(dest + used, "\\%03o", c);
|
| used += 4;
|
| } else {
|
| dest[used++] = c; break;
|
| @@ -63,7 +57,7 @@
|
| // ----------------------------------------------------------------------
|
| // CEscape()
|
| // Copies 'src' to result, escaping dangerous characters using
|
| -// C-style escape sequences. 'src' and 'dest' should not overlap.
|
| +// C-style escape sequences. 'src' and 'dest' should not overlap.
|
| // ----------------------------------------------------------------------
|
| string CEscape(const StringPiece& src) {
|
| const int dest_length = src.size() * 4 + 1; // Maximum possible expansion
|
| @@ -83,7 +77,7 @@
|
| // 255's, we just return the empty string.
|
| bool done = false;
|
| string limit(prefix.data(), prefix.size());
|
| - int index = static_cast<int>(limit.size()) - 1;
|
| + int index = limit.length() - 1;
|
| while (!done && index >= 0) {
|
| if ((limit[index]&255) == 255) {
|
| limit.erase(index);
|
|
|