|
@@ -659,7 +659,7 @@ string GetCapitalizedType(const FieldDescriptor* field) {
|
|
// Some compilers report reaching end of function even though all cases of
|
|
// Some compilers report reaching end of function even though all cases of
|
|
// the enum are handed in the switch.
|
|
// the enum are handed in the switch.
|
|
GOOGLE_LOG(FATAL) << "Can't get here.";
|
|
GOOGLE_LOG(FATAL) << "Can't get here.";
|
|
- return NULL;
|
|
|
|
|
|
+ return string();
|
|
}
|
|
}
|
|
|
|
|
|
ObjectiveCType GetObjectiveCType(FieldDescriptor::Type field_type) {
|
|
ObjectiveCType GetObjectiveCType(FieldDescriptor::Type field_type) {
|
|
@@ -1052,13 +1052,13 @@ bool ExpectedPrefixesCollector::ConsumeLine(
|
|
line.ToString() + "'.";
|
|
line.ToString() + "'.";
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- StringPiece package(line, 0, offset);
|
|
|
|
- StringPiece prefix(line, offset + 1, line.length() - offset - 1);
|
|
|
|
|
|
+ StringPiece package = line.substr(0, offset);
|
|
|
|
+ StringPiece prefix = line.substr(offset + 1);
|
|
TrimWhitespace(&package);
|
|
TrimWhitespace(&package);
|
|
TrimWhitespace(&prefix);
|
|
TrimWhitespace(&prefix);
|
|
// Don't really worry about error checking the package/prefix for
|
|
// Don't really worry about error checking the package/prefix for
|
|
// being valid. Assume the file is validated when it is created/edited.
|
|
// being valid. Assume the file is validated when it is created/edited.
|
|
- (*prefix_map_)[package.ToString()] = prefix.ToString();
|
|
|
|
|
|
+ (*prefix_map_)[string(package)] = string(prefix);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1474,7 +1474,7 @@ class Parser {
|
|
|
|
|
|
bool Parser::ParseChunk(StringPiece chunk) {
|
|
bool Parser::ParseChunk(StringPiece chunk) {
|
|
if (!leftover_.empty()) {
|
|
if (!leftover_.empty()) {
|
|
- chunk.AppendToString(&leftover_);
|
|
|
|
|
|
+ leftover_ += chunk;
|
|
p_ = StringPiece(leftover_);
|
|
p_ = StringPiece(leftover_);
|
|
} else {
|
|
} else {
|
|
p_ = chunk;
|
|
p_ = chunk;
|
|
@@ -1483,7 +1483,7 @@ bool Parser::ParseChunk(StringPiece chunk) {
|
|
if (p_.empty()) {
|
|
if (p_.empty()) {
|
|
leftover_.clear();
|
|
leftover_.clear();
|
|
} else {
|
|
} else {
|
|
- leftover_ = p_.ToString();
|
|
|
|
|
|
+ leftover_ = string(p_);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -1506,7 +1506,7 @@ bool Parser::ParseLoop() {
|
|
while (ReadLine(&p_, &line)) {
|
|
while (ReadLine(&p_, &line)) {
|
|
++line_;
|
|
++line_;
|
|
RemoveComment(&line);
|
|
RemoveComment(&line);
|
|
- StringPieceTrimWhitespace(&line);
|
|
|
|
|
|
+ TrimWhitespace(&line);
|
|
if (line.size() == 0) {
|
|
if (line.size() == 0) {
|
|
continue; // Blank line.
|
|
continue; // Blank line.
|
|
}
|
|
}
|
|
@@ -1698,7 +1698,7 @@ bool ImportWriter::ProtoFrameworkCollector::ConsumeLine(
|
|
}
|
|
}
|
|
StringPiece framework_name(line, 0, offset);
|
|
StringPiece framework_name(line, 0, offset);
|
|
StringPiece proto_file_list(line, offset + 1, line.length() - offset - 1);
|
|
StringPiece proto_file_list(line, offset + 1, line.length() - offset - 1);
|
|
- StringPieceTrimWhitespace(&framework_name);
|
|
|
|
|
|
+ TrimWhitespace(&framework_name);
|
|
|
|
|
|
int start = 0;
|
|
int start = 0;
|
|
while (start < proto_file_list.length()) {
|
|
while (start < proto_file_list.length()) {
|
|
@@ -1708,24 +1708,24 @@ bool ImportWriter::ProtoFrameworkCollector::ConsumeLine(
|
|
}
|
|
}
|
|
|
|
|
|
StringPiece proto_file(proto_file_list, start, offset - start);
|
|
StringPiece proto_file(proto_file_list, start, offset - start);
|
|
- StringPieceTrimWhitespace(&proto_file);
|
|
|
|
|
|
+ TrimWhitespace(&proto_file);
|
|
if (proto_file.size() != 0) {
|
|
if (proto_file.size() != 0) {
|
|
std::map<string, string>::iterator existing_entry =
|
|
std::map<string, string>::iterator existing_entry =
|
|
- map_->find(proto_file.ToString());
|
|
|
|
|
|
+ map_->find(string(proto_file));
|
|
if (existing_entry != map_->end()) {
|
|
if (existing_entry != map_->end()) {
|
|
std::cerr << "warning: duplicate proto file reference, replacing framework entry for '"
|
|
std::cerr << "warning: duplicate proto file reference, replacing framework entry for '"
|
|
- << proto_file.ToString() << "' with '" << framework_name.ToString()
|
|
|
|
|
|
+ << string(proto_file) << "' with '" << string(framework_name)
|
|
<< "' (was '" << existing_entry->second << "')." << std::endl;
|
|
<< "' (was '" << existing_entry->second << "')." << std::endl;
|
|
std::cerr.flush();
|
|
std::cerr.flush();
|
|
}
|
|
}
|
|
|
|
|
|
if (proto_file.find(' ') != StringPiece::npos) {
|
|
if (proto_file.find(' ') != StringPiece::npos) {
|
|
std::cerr << "note: framework mapping file had a proto file with a space in, hopefully that isn't a missing comma: '"
|
|
std::cerr << "note: framework mapping file had a proto file with a space in, hopefully that isn't a missing comma: '"
|
|
- << proto_file.ToString() << "'" << std::endl;
|
|
|
|
|
|
+ << string(proto_file) << "'" << std::endl;
|
|
std::cerr.flush();
|
|
std::cerr.flush();
|
|
}
|
|
}
|
|
|
|
|
|
- (*map_)[proto_file.ToString()] = framework_name.ToString();
|
|
|
|
|
|
+ (*map_)[string(proto_file)] = string(framework_name);
|
|
}
|
|
}
|
|
|
|
|
|
start = offset + 1;
|
|
start = offset + 1;
|