Skip to content

Commit

Permalink
Fix sign-comparison warnings in public header files.
Browse files Browse the repository at this point in the history
  • Loading branch information
xfxyjwf committed Jul 22, 2016
1 parent 16adea3 commit 9009662
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/google/protobuf/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ class Map {
// Return whether table_[b] is a linked list that seems awfully long.
// Requires table_[b] to point to a non-empty linked list.
bool TableEntryIsTooLong(size_type b) {
const int kMaxLength = 8;
const size_type kMaxLength = 8;
size_type count = 0;
Node* node = static_cast<Node*>(table_[b]);
do {
Expand Down
10 changes: 5 additions & 5 deletions src/google/protobuf/wire_format_lite_inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
io::CodedInputStream* input, RepeatedField<CType>* values) {
int length;
if (!input->ReadVarintSizeAsInt(&length)) return false;
const uint32 old_entries = values->size();
const uint32 new_entries = length / sizeof(CType);
const uint32 new_bytes = new_entries * sizeof(CType);
const int old_entries = values->size();
const int new_entries = length / sizeof(CType);
const int new_bytes = new_entries * sizeof(CType);
if (new_bytes != length) return false;
// We would *like* to pre-allocate the buffer to write into (for
// speed), but *must* avoid performing a very large allocation due
Expand Down Expand Up @@ -382,7 +382,7 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
#else
values->Reserve(old_entries + new_entries);
CType value;
for (uint32 i = 0; i < new_entries; ++i) {
for (int i = 0; i < new_entries; ++i) {
if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
values->AddAlreadyReserved(value);
}
Expand All @@ -392,7 +392,7 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
// safely allocate. We read as much as we can into *values
// without pre-allocating "length" bytes.
CType value;
for (uint32 i = 0; i < new_entries; ++i) {
for (int i = 0; i < new_entries; ++i) {
if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
values->Add(value);
}
Expand Down

0 comments on commit 9009662

Please sign in to comment.