Index: third_party/protobuf/src/google/protobuf/stubs/strutil.cc |
diff --git a/third_party/protobuf/src/google/protobuf/stubs/strutil.cc b/third_party/protobuf/src/google/protobuf/stubs/strutil.cc |
index 7ba92e8f1fa4d95dd77feb4a14abe6aa1326c1b7..15b6e53f1a648ab38e09bf77c346f94a739847f8 100644 |
--- a/third_party/protobuf/src/google/protobuf/stubs/strutil.cc |
+++ b/third_party/protobuf/src/google/protobuf/stubs/strutil.cc |
@@ -93,6 +93,21 @@ void StripString(string* s, const char* remove, char replacewith) { |
} |
} |
+// ---------------------------------------------------------------------- |
+// ReplaceCharacters |
+// Replaces any occurrence of the character 'remove' (or the characters |
+// in 'remove') with the character 'replacewith'. |
+// ---------------------------------------------------------------------- |
+void ReplaceCharacters(string *s, const char *remove, char replacewith) { |
+ const char *str_start = s->c_str(); |
+ const char *str = str_start; |
+ for (str = strpbrk(str, remove); |
+ str != NULL; |
+ str = strpbrk(str + 1, remove)) { |
+ (*s)[str - str_start] = replacewith; |
+ } |
+} |
+ |
void StripWhitespace(string* str) { |
int str_length = str->length(); |
@@ -966,7 +981,7 @@ static const char two_ASCII_digits[100][2] = { |
}; |
char* FastUInt32ToBufferLeft(uint32 u, char* buffer) { |
- int digits; |
+ uint32 digits; |
const char *ASCII_digits = NULL; |
// The idea of this implementation is to trim the number of divides to as few |
// as possible by using multiplication and subtraction rather than mod (%), |