Fix gcc warnings triggered by -Wextra.

TEST=build and audio_coding_unittests and audio_coding_module_test on Linux

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1445 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org
2012-01-17 19:27:33 +00:00
parent 4259fd725c
commit 975e4a33c6
3 changed files with 18 additions and 14 deletions

View File

@ -198,14 +198,15 @@ bool Receiver::IncomingPacket() {
_firstTime = false;
_realPayloadSizeBytes = _rtpStream->Read(&_rtpInfo, _incomingPayload,
_payloadSizeBytes, &_nextTime);
if (_realPayloadSizeBytes < 0) {
printf("Error in reading incoming payload.\n");
return false;
if (_realPayloadSizeBytes == 0) {
if (_rtpStream->EndOfFile()) {
_firstTime = true;
return true;
} else {
printf("Error in reading incoming payload.\n");
return false;
}
}
if (_realPayloadSizeBytes == 0 && _rtpStream->EndOfFile()) {
_firstTime = true;
return true;
}
}
WebRtc_Word32 ok = _acm->IncomingPacket(_incomingPayload,

View File

@ -106,7 +106,7 @@ RTPBuffer::Write(const WebRtc_UWord8 payloadType, const WebRtc_UWord32 timeStamp
WebRtc_UWord16
RTPBuffer::Read(WebRtcRTPHeader* rtpInfo,
WebRtc_Word8* payloadData,
WebRtc_Word8* payloadData,
WebRtc_UWord16 payloadSize,
WebRtc_UWord32* offset)
{
@ -125,7 +125,7 @@ RTPBuffer::Read(WebRtcRTPHeader* rtpInfo,
}
else
{
return -1;
return 0;
}
*offset = (packet->timeStamp/(packet->frequency/1000));
@ -248,11 +248,11 @@ WebRtc_UWord16 RTPFile::Read(WebRtcRTPHeader* rtpInfo,
{
return -1;
}
lengthBytes -= 20;
if (lengthBytes < 0)
if (lengthBytes < 20)
{
return -1;
}
lengthBytes -= 20;
EXPECT_EQ(lengthBytes, fread(payloadData, 1, lengthBytes, _rtpFile));
return lengthBytes;
}

View File

@ -24,12 +24,15 @@ class RTPStream
{
public:
virtual ~RTPStream(){}
virtual void Write(const WebRtc_UWord8 payloadType, const WebRtc_UWord32 timeStamp,
const WebRtc_Word16 seqNo, const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize, WebRtc_UWord32 frequency) = 0;
// Returns the packet's payload size. Zero should be treated as an
// end-of-stream (in the case that EndOfFile() is true) or an error.
virtual WebRtc_UWord16 Read(WebRtcRTPHeader* rtpInfo,
WebRtc_Word8* payloadData,
WebRtc_Word8* payloadData,
WebRtc_UWord16 payloadSize,
WebRtc_UWord32* offset) = 0;
virtual bool EndOfFile() const = 0;
@ -65,7 +68,7 @@ public:
const WebRtc_Word16 seqNo, const WebRtc_UWord8* payloadData,
const WebRtc_UWord16 payloadSize, WebRtc_UWord32 frequency);
WebRtc_UWord16 Read(WebRtcRTPHeader* rtpInfo,
WebRtc_Word8* payloadData,
WebRtc_Word8* payloadData,
WebRtc_UWord16 payloadSize,
WebRtc_UWord32* offset);
virtual bool EndOfFile() const;