Fix Mac-gcc warnings.

Resolves:
- warning: allocating zero-element array
- warning: suggest a space before ‘;’ or explicit braces around empty
  body in ‘for’ statement

BUG=none
TEST=build on Mac-gcc, trybots

Review URL: https://webrtc-codereview.appspot.com/675006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2519 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2012-07-16 17:05:47 +00:00
parent 837bc7b44c
commit d41f59a23f
5 changed files with 19 additions and 14 deletions

View File

@ -644,7 +644,7 @@ int main(int argc, char* argv[])
if (stereoMode > stereoModeMono)
{
// stereo
WebRtc_Word16 tempLen;
WebRtc_Word16 tempLen;
tempLen = NetEQvector[0]->recOut( out_data, msInfo ); // master
outLen = NetEQvector[1]->recOut( &out_data[tempLen], msInfo ); // slave
@ -715,8 +715,9 @@ int main(int argc, char* argv[])
// }
free(msInfo);
for (std::vector<NETEQTEST_NetEQClass *>::iterator it = NetEQvector.begin();
it < NetEQvector.end(); delete *it++);
for (std::vector<NETEQTEST_NetEQClass *>::iterator it = NetEQvector.begin();
it < NetEQvector.end(); delete *it++) {
}
printf("\nSimulation done!\n");
@ -885,7 +886,7 @@ void parsePtypeFile(FILE *ptypeFile, std::map<WebRtc_UWord8, decoderStruct>* dec
bool isStereo = false;
if (codec[L-1] == '*') {
// stereo codec
// stereo codec
isStereo = true;
// remove '*'
@ -1187,7 +1188,7 @@ void parsePtypeFile(FILE *ptypeFile, std::map<WebRtc_UWord8, decoderStruct>* dec
else if(isStereo)
{
switch(tempDecoder.codec) {
// sample based codecs
// sample based codecs
case kDecoderPCMu:
case kDecoderPCMa:
case kDecoderG722:
@ -1592,7 +1593,7 @@ int doAPItest() {
printf("NetEq version: %s\n\n", version);
/* test that API functions return -1 if instance is NULL */
#define CHECK_MINUS_ONE(x) {int errCode = x; if((errCode)!=-1){printf("\n API test failed at line %d: %s. Function did not return -1 as expected\n",__LINE__,#x); return(-1);}}
#define CHECK_MINUS_ONE(x) {int errCode = x; if((errCode)!=-1){printf("\n API test failed at line %d: %s. Function did not return -1 as expected\n",__LINE__,#x); return(-1);}}
//#define RESET_ERROR(x) ((MainInst_t*) x)->ErrorCode = 0;
inst = NULL;

View File

@ -164,7 +164,8 @@ int RtpPlay(CmdArgs& args)
return -1;
}
}
while (vcm->DecodeDualFrame(0) == 1);
while (vcm->DecodeDualFrame(0) == 1) {
}
if (vcm->TimeUntilNextProcess() <= 0)
{
vcm->Process();

View File

@ -53,7 +53,8 @@ bool DecodeThread(void* obj)
{
SharedState* state = static_cast<SharedState*>(obj);
state->_vcm.Decode(10000);
while (state->_vcm.DecodeDualFrame(0) == 1);
while (state->_vcm.DecodeDualFrame(0) == 1) {
}
return true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -111,12 +111,13 @@ TEST_F(PacketReaderTest, NormalLargeData) {
// Test with empty data.
TEST_F(PacketReaderTest, EmptyData) {
const int kDataLengthInBytes = 0;
WebRtc_UWord8* data = new WebRtc_UWord8[kDataLengthInBytes];
// But don't really try to allocate a zero-length array...
WebRtc_UWord8 data[kPacketSizeInBytes];
WebRtc_UWord8* data_pointer = data;
reader_->InitializeReading(data, kDataLengthInBytes, kPacketSizeInBytes);
EXPECT_EQ(kDataLengthInBytes, reader_->NextPacket(&data));
EXPECT_EQ(kDataLengthInBytes, reader_->NextPacket(&data_pointer));
// Do it again to make sure nothing changes
EXPECT_EQ(kDataLengthInBytes, reader_->NextPacket(&data));
delete[] data;
EXPECT_EQ(kDataLengthInBytes, reader_->NextPacket(&data_pointer));
}
} // namespace test

View File

@ -86,7 +86,8 @@ void RunHarness() {
ASSERT_EQ(0, base->StartSend(channel));
// Run forever...
while (1);
while (1) {
}
}
} // namespace