Skip to content

Commit 52e5c67

Browse files
authored
Update more code to use standard int types. (#9851)
1 parent 42a2873 commit 52e5c67

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/google/protobuf/compiler/js/js_generator.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ std::string GetMessagesFileName(const GeneratorOptions& options, const SCC* scc,
406406
GetSnakeFilename(scc->GetRepresentative()->file()->name()));
407407
(*long_name_dict)[scc->GetRepresentative()] =
408408
StrCat(snake_name, "_long_sccs_",
409-
static_cast<uint64>((*long_name_dict).size()));
409+
static_cast<uint64_t>((*long_name_dict).size()));
410410
}
411411
filename_base = (*long_name_dict)[scc->GetRepresentative()];
412412
}
@@ -575,7 +575,7 @@ std::string JSOneofIndex(const OneofDescriptor* oneof) {
575575
}
576576

577577
// Decodes a codepoint in \x0000 -- \xFFFF.
578-
uint16 DecodeUTF8Codepoint(uint8* bytes, size_t* length) {
578+
uint16_t DecodeUTF8Codepoint(uint8_t* bytes, size_t* length) {
579579
if (*length == 0) {
580580
return 0;
581581
}
@@ -620,13 +620,13 @@ uint16 DecodeUTF8Codepoint(uint8* bytes, size_t* length) {
620620
bool EscapeJSString(const std::string& in, std::string* out) {
621621
size_t decoded = 0;
622622
for (size_t i = 0; i < in.size(); i += decoded) {
623-
uint16 codepoint = 0;
623+
uint16_t codepoint = 0;
624624
// Decode the next UTF-8 codepoint.
625625
size_t have_bytes = in.size() - i;
626-
uint8 bytes[3] = {
627-
static_cast<uint8>(in[i]),
628-
static_cast<uint8>(((i + 1) < in.size()) ? in[i + 1] : 0),
629-
static_cast<uint8>(((i + 2) < in.size()) ? in[i + 2] : 0),
626+
uint8_t bytes[3] = {
627+
static_cast<uint8_t>(in[i]),
628+
static_cast<uint8_t>(((i + 1) < in.size()) ? in[i + 1] : 0),
629+
static_cast<uint8_t>(((i + 2) < in.size()) ? in[i + 2] : 0),
630630
};
631631
codepoint = DecodeUTF8Codepoint(bytes, &have_bytes);
632632
if (have_bytes == 0) {
@@ -814,13 +814,13 @@ std::string JSFieldDefault(const FieldDescriptor* field) {
814814
// integer values as signed integer values. In order to exactly match the
815815
// output, we need to reinterpret as base-2 signed. Ugh.
816816
return MaybeNumberString(
817-
field, StrCat(static_cast<int32>(field->default_value_uint32())));
817+
field, StrCat(static_cast<int32_t>(field->default_value_uint32())));
818818
case FieldDescriptor::CPPTYPE_INT64:
819819
return MaybeNumberString(field, StrCat(field->default_value_int64()));
820820
case FieldDescriptor::CPPTYPE_UINT64:
821821
// See above note for uint32 -- reinterpreting as signed.
822822
return MaybeNumberString(
823-
field, StrCat(static_cast<int64>(field->default_value_uint64())));
823+
field, StrCat(static_cast<int64_t>(field->default_value_uint64())));
824824
case FieldDescriptor::CPPTYPE_ENUM:
825825
return StrCat(field->default_value_enum()->number());
826826
case FieldDescriptor::CPPTYPE_BOOL:

src/google/protobuf/compiler/js/js_generator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
151151
const std::string& parameter, GeneratorContext* context,
152152
std::string* error) const override;
153153

154-
uint64 GetSupportedFeatures() const override {
154+
uint64_t GetSupportedFeatures() const override {
155155
return FEATURE_PROTO3_OPTIONAL;
156156
}
157157

0 commit comments

Comments
 (0)