Closed Bug 1033192 Opened 5 years ago Closed 5 years ago

Fix gcc -Wpointer-arith warnings and MSVC macro redefinition warnings in media/libcubeb

Categories

(Core :: General, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla33
Tracking Status
firefox32 --- wontfix
firefox33 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I made struct cubeb_stream's queuebuf an array of pointers to bytes (uint8_t) instead of void to workaround the gcc warning about doing pointer math that assumes sizeof(void) == 1. Alternatively, we could keep queuebuf as an array of pointers to void, I can add a (uint_t*) cast to the memset().

Also #undef some redefined Windows macros and mark media/libcubeb as FAIL_ON_WARNINGS (because, in bug 986793 comment 1, you said cubeb is not really third-party code).


media/libcubeb/src/cubeb_opensl.c:122:16 [-Wpointer-arith] pointer of type 'void *' used in arithmetic

c:/builds/moz2_slave/m-cen-w32-00000000000000000000/build/media/libcubeb/src/cubeb_winmm.c(9) : warning C4005: 'WINVER' : macro redefinition
        c:\builds\moz2_slave\m-cen-w32-00000000000000000000\build\obj-firefox\media\libcubeb\src\../../../dist/include/mozilla-config.h(140) : see previous definition of 'WINVE

c:/builds/moz2_slave/m-cen-w32-00000000000000000000/build/media/libcubeb/src/cubeb_winmm.c(10) : warning C4005: 'WIN32_LEAN_AND_MEAN' : macro redefinition
        c:\builds\moz2_slave\m-cen-w32-00000000000000000000\build\obj-firefox\media\libcubeb\src\../../../dist/include/mozilla-config.h(139) : see previous definition of 'WIN32
Attachment #8449216 - Flags: review?(paul)
Comment on attachment 8449216 [details] [diff] [review]
fix-cubeb-warnings.patch

Review of attachment 8449216 [details] [diff] [review]:
-----------------------------------------------------------------

::: media/libcubeb/src/cubeb_opensl.c
@@ +570,5 @@
>    }
>  
>    int i;
>    for (i = 0; i < NBUFS; i++) {
> +    stm->queuebuf[i] = (uint8_t*) malloc(stm->queuebuf_len);

Don't cast the return of malloc.
Attachment #8449216 - Flags: review?(paul) → review+
As you recommended in comment 1, I landed the patch without the malloc cast.
https://hg.mozilla.org/mozilla-central/rev/b9006622fcec
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
I can no longer build locally and suspect this bug is the cause.  See bug 1034140.
You need to log in before you can comment on or make changes to this bug.