Can't use char * for quoted literals. I knew that.

pull/10148/head
Jorg Brown 3 years ago
parent e9668e41be
commit 81491e034f
  1. 4
      src/google/protobuf/stubs/strutil.cc
  2. 2
      src/google/protobuf/stubs/strutil.h

@ -136,7 +136,7 @@ void StripWhitespace(std::string *str) {
uintptr_t((dest).size()))
void StringReplace(StringPiece s, StringPiece oldsub, StringPiece newsub,
bool replace_all, std::string *res, char *filename, int linenum) {
bool replace_all, std::string *res, const char *filename, int linenum) {
if (oldsub.empty()) {
DONOTCHECKIN_GOOGLE_DCHECK_NO_OVERLAP(*res, s);
StrAppend(res, s); // if empty, append the given string.
@ -171,7 +171,7 @@ void StringReplace(StringPiece s, StringPiece oldsub, StringPiece newsub,
// ----------------------------------------------------------------------
std::string StringReplaceImpl(StringPiece s, StringPiece oldsub, StringPiece newsub,
bool replace_all, char *filename, int linenum) {
bool replace_all, const char *filename, int linenum) {
std::string ret;
StringReplace(s, oldsub, newsub, replace_all, &ret, filename, linenum);
return ret;

@ -205,7 +205,7 @@ inline std::string ToUpper(StringPiece s) {
// ----------------------------------------------------------------------
PROTOBUF_EXPORT std::string StringReplaceImpl(StringPiece s, StringPiece oldsub,
StringPiece newsub, bool replace_all, char *filename = nullptr, int linenum = 0);
StringPiece newsub, bool replace_all, const char *filename = nullptr, int linenum = 0);
#define StringReplace(s,o,n,all) StringReplaceImpl(s,o,n,all,__FILE__, __LINE__);
// ----------------------------------------------------------------------

Loading…
Cancel
Save