Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1305)

Unified Diff: webrtc/modules/audio_coding/codecs/g711/test/testG711.cc

Issue 1172163004: Reformat existing code. There should be no functional effects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/g711/test/testG711.cc
diff --git a/webrtc/modules/audio_coding/codecs/g711/test/testG711.cc b/webrtc/modules/audio_coding/codecs/g711/test/testG711.cc
index 9511df7915a16efa24d58eb96d4f307bcf8642d5..49c671c5a0aee9fc304b20b72a1badaabfe7d860 100644
--- a/webrtc/modules/audio_coding/codecs/g711/test/testG711.cc
+++ b/webrtc/modules/audio_coding/codecs/g711/test/testG711.cc
@@ -24,18 +24,12 @@
#define CLOCKS_PER_SEC_G711 1000
/* function for reading audio data from PCM file */
-int readframe(int16_t* data, FILE* inp, int length) {
-
- short k, rlen, status = 0;
-
- rlen = (short) fread(data, sizeof(int16_t), length, inp);
- if (rlen < length) {
- for (k = rlen; k < length; k++)
- data[k] = 0;
- status = 1;
- }
-
- return status;
+bool readframe(int16_t* data, FILE* inp, int length) {
+ short rlen = (short) fread(data, sizeof(int16_t), length, inp);
+ if (rlen >= length)
+ return false;
+ memset(data + rlen, 0, (length - rlen) * sizeof(int16_t));
+ return true;
}
int main(int argc, char* argv[]) {
@@ -43,7 +37,8 @@ int main(int argc, char* argv[]) {
FILE* inp;
FILE* outp;
FILE* bitp = NULL;
- int framecnt, endfile;
+ int framecnt;
+ bool endfile;
int16_t framelength = 80;
@@ -122,8 +117,8 @@ int main(int argc, char* argv[]) {
/* Initialize encoder and decoder */
framecnt = 0;
- endfile = 0;
- while (endfile == 0) {
+ endfile = false;
+ while (!endfile) {
framecnt++;
/* Read speech block */
endfile = readframe(shortdata, inp, framelength);

Powered by Google App Engine
This is Rietveld 408576698