Prepare to convert various types to size_t.

This makes some behaviorally-invariant changes to make certain code that
currently only works correctly with signed types work safely regardless of the
signedness of the types in question.  This is preparation for a future change
that will convert a variety of types to size_t.

There are also some formatting changes (e.g. converting "enum hack" usage to real consts) to make it simpler to just change "int" to "size_t" in the future to change the types of those constants.

BUG=none
R=andrew@webrtc.org, juberti@webrtc.org, kwiberg@webrtc.org
TBR=ajm

Review URL: https://codereview.webrtc.org/1174813003

Cr-Commit-Position: refs/heads/master@{#9413}
This commit is contained in:
Peter Kasting
2015-06-10 21:15:38 -07:00
parent 786dbdcc38
commit f045e4da43
42 changed files with 153 additions and 127 deletions

View File

@ -88,13 +88,13 @@ AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeInternal(
}
CHECK_EQ(speech_buffer_.size(), full_frame_samples_);
CHECK_GE(max_encoded_bytes, full_frame_samples_);
int16_t ret = EncodeCall(&speech_buffer_[0], full_frame_samples_, encoded);
CHECK_GE(ret, 0);
speech_buffer_.clear();
EncodedInfo info;
info.encoded_timestamp = first_timestamp_in_buffer_;
info.payload_type = payload_type_;
int16_t ret = EncodeCall(&speech_buffer_[0], full_frame_samples_, encoded);
CHECK_GE(ret, 0);
info.encoded_bytes = static_cast<size_t>(ret);
speech_buffer_.clear();
return info;
}

View File

@ -86,6 +86,10 @@ int main(int argc, char* argv[]) {
printf("G.711 version: %s\n\n", versionNumber);
/* Get frame length */
framelength = atoi(argv[1]);
if (framelength < 0) {
printf(" G.711: Invalid framelength %d.\n", framelength);
exit(1);
}
/* Get compression law */
strcpy(law, argv[2]);