Fix up objectivec sources to simplfy import into Google.

pull/8767/head
Dave MacLachlan 4 years ago committed by Thomas Van Lenten
parent cf12bffd9d
commit 3fd4d3fe8e
  1. 8
      src/google/protobuf/compiler/objectivec/objectivec_generator.cc
  2. 3
      src/google/protobuf/compiler/objectivec/objectivec_helpers.cc

@ -150,11 +150,11 @@ bool ObjectiveCGenerator::GenerateAll(
// is just what to do if that isn't set. The available options are: // is just what to do if that isn't set. The available options are:
// "no": Not prefixed (the existing mode). // "no": Not prefixed (the existing mode).
// "yes": Make a prefix out of the proto package. // "yes": Make a prefix out of the proto package.
std::string lower_value(options[i].second); std::string upper_value(options[i].second);
LowerString(&lower_value); UpperString(&upper_value);
if (lower_value == "no") { if (upper_value == "NO") {
SetUseProtoPackageAsDefaultPrefix(false); SetUseProtoPackageAsDefaultPrefix(false);
} else if (lower_value == "yes") { } else if (upper_value == "YES") {
SetUseProtoPackageAsDefaultPrefix(true); SetUseProtoPackageAsDefaultPrefix(true);
} else { } else {
*error = "error: Unknown use_package_as_prefix: " + options[i].second; *error = "error: Unknown use_package_as_prefix: " + options[i].second;

@ -523,8 +523,7 @@ std::string FileClassPrefix(const FileDescriptor* file) {
// camelcase each one and then join them with underscores, and add an // camelcase each one and then join them with underscores, and add an
// underscore at the end. // underscore at the end.
std::string result; std::string result;
const std::vector<std::string> segments = const std::vector<std::string> segments = Split(file->package(), ".", true);
Split(file->package(), ".", true /* skip_empty */);
for (const auto& segment : segments) { for (const auto& segment : segments) {
const std::string part = UnderscoresToCamelCase(segment, true); const std::string part = UnderscoresToCamelCase(segment, true);
if (part.empty()) { if (part.empty()) {

Loading…
Cancel
Save