Closed Bug 915344 Opened 7 years ago Closed 7 years ago

mediaconduit_unittests.cpp:280:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Categories

(Core :: WebRTC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Build warning:
{
media/webrtc/signaling/test/mediaconduit_unittests.cpp:280:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
}

...for this line:
> 280    MOZ_ASSERT(SAMPLES <= PLAYOUT_SAMPLE_LENGTH);
http://mxr.mozilla.org/mozilla-central/source/media/webrtc/signaling/test/mediaconduit_unittests.cpp?rev=4fdd3cddee3a&mark=280-280#273

...since SAMPLES is an int, whereas PLAYOUT_SAMPLE_LENGTH is an unsigned int.

We can fix this by just changing SAMPLES to be unsigned too; it's set as (PLAYOUT_SAMPLE_FREQUENCY * 10), where PLAYOUT_SAMPLE_FREQUENCY is unsigned, and we only compare it to a signed integer in one spot.  (That one spot is a comparison tonumSamplesReadFromInput, which can be made unsigned as well, since it starts at 0 and only increases from there.)  So, there's no reason for SAMPLES to be signed.

Patch coming up to make both numSamplesReadFromInput and SAMPLES unsigned.
Attached patch fixSplinter Review
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #803234 - Flags: review?(rjesup)
Attachment #803234 - Flags: review?(rjesup) → review+
https://hg.mozilla.org/mozilla-central/rev/66356497565a
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.