Use C++11 integer types and fully qualify std::string (#9253)

pull/9260/head
Adam Cozzette 3 years ago committed by GitHub
parent bf481851d8
commit 1ced82f8fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/google/protobuf/compiler/command_line_interface.cc
  2. 2
      src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
  3. 2
      src/google/protobuf/compiler/csharp/csharp_field_base.cc
  4. 2
      src/google/protobuf/compiler/csharp/csharp_message.cc
  5. 4
      src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
  6. 6
      src/google/protobuf/compiler/php/php_generator.cc
  7. 2
      src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
  8. 4
      src/google/protobuf/stubs/common.h

@ -1675,7 +1675,9 @@ CommandLineInterface::InterpretArgument(const std::string& name,
// file names (e.g. foo\*.proto), so we do it ourselves.
switch (google::protobuf::io::win32::ExpandWildcards(
value,
[this](const string& path) { this->input_files_.push_back(path); })) {
[this](const std::string& path) {
this->input_files_.push_back(path);
})) {
case google::protobuf::io::win32::ExpandWildcardsResult::kSuccess:
break;
case google::protobuf::io::win32::ExpandWildcardsResult::

@ -116,7 +116,7 @@ class GenerateAndTest {
&context_, &error_));
context_.ExpectFileMatches(file1, file2);
}
void SetParameter(string parameter) {
void SetParameter(std::string parameter) {
parameter_ = parameter;
}

@ -61,7 +61,7 @@ void FieldGeneratorBase::SetCommonFieldVariables(
part_tag_size /= 2;
}
uint tag = internal::WireFormat::MakeTag(descriptor_);
uint8 tag_array[5];
uint8_t tag_array[5];
io::CodedOutputStream::WriteTagToArray(tag, tag_array);
std::string tag_bytes = StrCat(tag_array[0]);
for (int i = 1; i < part_tag_size; i++) {

@ -717,7 +717,7 @@ void MessageGenerator::GenerateMainParseLoop(io::Printer* printer, bool use_pars
const FieldDescriptor* field = fields_by_number()[i];
internal::WireFormatLite::WireType wt =
internal::WireFormat::WireTypeForFieldType(field->type());
uint32 tag = internal::WireFormatLite::MakeTag(field->number(), wt);
uint32_t tag = internal::WireFormatLite::MakeTag(field->number(), wt);
// Handle both packed and unpacked repeated fields with the same Read*Array call;
// the two generated cases are the packed and unpacked tags.
// TODO(jonskeet): Check that is_packable is equivalent to

@ -153,7 +153,7 @@ TEST(ObjCHelper, TextFormatDecodeData_RawStrings) {
EXPECT_EQ(4, decode_data.num_entries());
uint8 expected_data[] = {
uint8_t expected_data[] = {
0x4,
0x1, 0x0, 'z', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'I', 'J', 0x0,
0x3, 0x0, 'a', 'b', 'c', 'd', 'e', 'z', 'g', 'h', 'I', 'J', 0x0,
@ -178,7 +178,7 @@ TEST(ObjCHelper, TextFormatDecodeData_ByteCodes) {
EXPECT_EQ(5, decode_data.num_entries());
uint8 expected_data[] = {
uint8_t expected_data[] = {
0x5,
// All as is (00 op)
0x1, 0x0A, 0x0,

@ -83,14 +83,14 @@ struct Options {
bool is_descriptor = false;
bool aggregate_metadata = false;
bool gen_c_wkt = false;
std::set<string> aggregate_metadata_prefixes;
std::set<std::string> aggregate_metadata_prefixes;
};
namespace {
// Forward decls.
std::string PhpName(const std::string& full_name, const Options& options);
std::string IntToString(int32 value);
std::string IntToString(int32_t value);
std::string FilenameToClassname(const std::string& filename);
std::string GeneratedMetadataFileName(const FileDescriptor* file,
const Options& options);
@ -430,7 +430,7 @@ std::string GeneratedServiceFileName(const ServiceDescriptor* service,
return result + ".php";
}
std::string IntToString(int32 value) {
std::string IntToString(int32_t value) {
std::ostringstream os;
os << value;
return os.str();

@ -57,7 +57,7 @@ std::string FindRubyTestDir() {
// Some day, we may integrate build systems between protoc and the language
// extensions to the point where we can do this test in a more automated way.
void RubyTest(string proto_file, string import_proto_file = "") {
void RubyTest(std::string proto_file, std::string import_proto_file = "") {
std::string ruby_tests = FindRubyTestDir();
google::protobuf::compiler::CommandLineInterface cli;

@ -189,10 +189,6 @@ class FatalException : public std::exception {
};
#endif
// This is at the end of the file instead of the beginning to work around a bug
// in some versions of MSVC.
using std::string;
} // namespace protobuf
} // namespace google

Loading…
Cancel
Save