remove const from function return type if returning const value (#10101)

pull/10104/head
Namgoo Lee 3 years ago committed by GitHub
parent 4548b4ac0e
commit e7cc1aa970
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
  2. 6
      src/google/protobuf/util/internal/protostream_objectsource.cc
  3. 2
      src/google/protobuf/util/internal/protostream_objectsource.h
  4. 4
      src/google/protobuf/util/internal/utility.cc
  5. 4
      src/google/protobuf/util/internal/utility.h

@ -112,7 +112,7 @@ class PrefixModeStorage {
public:
PrefixModeStorage();
const std::string package_to_prefix_mappings_path() const { return package_to_prefix_mappings_path_; }
std::string package_to_prefix_mappings_path() const { return package_to_prefix_mappings_path_; }
void set_package_to_prefix_mappings_path(const std::string& path) {
package_to_prefix_mappings_path_ = path;
package_to_prefix_map_.clear();
@ -123,7 +123,7 @@ class PrefixModeStorage {
bool use_package_name() const { return use_package_name_; }
void set_use_package_name(bool on_or_off) { use_package_name_ = on_or_off; }
const std::string exception_path() const { return exception_path_; }
std::string exception_path() const { return exception_path_; }
void set_exception_path(const std::string& path) {
exception_path_ = path;
exceptions_.clear();

@ -83,7 +83,7 @@ const google::protobuf::EnumValue* FindEnumValueByNumber(
const google::protobuf::Enum& tech_enum, int number);
// Utility function to format nanos.
const std::string FormatNanos(uint32_t nanos, bool with_trailing_zeros);
std::string FormatNanos(uint32_t nanos, bool with_trailing_zeros);
util::StatusOr<std::string> MapKeyDefaultValueAsString(
const google::protobuf::Field& field) {
@ -892,7 +892,7 @@ util::Status ProtoStreamObjectSource::RenderNonMessageField(
}
// TODO(skarvaje): Fix this to avoid code duplication.
const std::string ProtoStreamObjectSource::ReadFieldValueAsString(
std::string ProtoStreamObjectSource::ReadFieldValueAsString(
const google::protobuf::Field& field) const {
std::string result;
switch (field.kind()) {
@ -1093,7 +1093,7 @@ const google::protobuf::EnumValue* FindEnumValueByNumber(
// TODO(skarvaje): Look into optimizing this by not doing computation on
// double.
const std::string FormatNanos(uint32_t nanos, bool with_trailing_zeros) {
std::string FormatNanos(uint32_t nanos, bool with_trailing_zeros) {
if (nanos == 0) {
return with_trailing_zeros ? ".000" : "";
}

@ -164,7 +164,7 @@ class PROTOBUF_EXPORT ProtoStreamObjectSource : public ObjectSource {
// Reads field value according to Field spec in 'field' and returns the read
// value as string. This only works for primitive datatypes (no message
// types).
const std::string ReadFieldValueAsString(
std::string ReadFieldValueAsString(
const google::protobuf::Field& field) const;

@ -125,7 +125,7 @@ std::string GetStringFromAny(const google::protobuf::Any& any) {
return s.value();
}
const StringPiece GetTypeWithoutUrl(StringPiece type_url) {
StringPiece GetTypeWithoutUrl(StringPiece type_url) {
if (type_url.size() > kTypeUrlSize && type_url[kTypeUrlSize] == '/') {
return type_url.substr(kTypeUrlSize + 1);
} else {
@ -137,7 +137,7 @@ const StringPiece GetTypeWithoutUrl(StringPiece type_url) {
}
}
const std::string GetFullTypeWithUrl(StringPiece simple_type) {
std::string GetFullTypeWithUrl(StringPiece simple_type) {
return StrCat(kTypeServiceBaseUrl, "/", simple_type);
}

@ -98,7 +98,7 @@ PROTOBUF_EXPORT std::string GetStringFromAny(const google::protobuf::Any& any);
// Returns the type string without the url prefix. e.g.: If the passed type is
// 'type.googleapis.com/tech.type.Bool', the returned value is 'tech.type.Bool'.
PROTOBUF_EXPORT const StringPiece GetTypeWithoutUrl(
PROTOBUF_EXPORT StringPiece GetTypeWithoutUrl(
StringPiece type_url);
// Returns the simple_type with the base type url (kTypeServiceBaseUrl)
@ -107,7 +107,7 @@ PROTOBUF_EXPORT const StringPiece GetTypeWithoutUrl(
// E.g:
// GetFullTypeWithUrl("google.protobuf.Timestamp") returns the string
// "type.googleapis.com/google.protobuf.Timestamp".
PROTOBUF_EXPORT const std::string GetFullTypeWithUrl(
PROTOBUF_EXPORT std::string GetFullTypeWithUrl(
StringPiece simple_type);
// Finds and returns option identified by name and option_name within the

Loading…
Cancel
Save