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

@ -716,7 +716,8 @@ int main(int argc, char* argv[])
free(msInfo);
for (std::vector<NETEQTEST_NetEQClass *>::iterator it = NetEQvector.begin();
it < NetEQvector.end(); delete *it++);
it < NetEQvector.end(); delete *it++) {
}
printf("\nSimulation done!\n");

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