Closed Bug 1167995 Opened 6 years ago Closed 3 years ago

B2G Build warning: MediaCodecProxy.h:48:23: warning: multi-character character constant [-Wmultichar], for enum kKeyBufferIndex = 'bfin'


(Core :: Audio/Video: Playback, defect)

Not set



Tracking Status
firefox41 --- affected


(Reporter: dholbert, Unassigned)


(Blocks 1 open bug)


Noticed while building B2G:
In file included from ../../dist/include/MediaCodecReader.h:23:0,
                 from ../../../gecko/dom/media/DecoderTraits.cpp:48:
../../dist/include/MediaCodecProxy.h:48:23: warning: multi-character character constant [-Wmultichar]

That's pointing to this code:
> 47   enum {
> 48     kKeyBufferIndex = 'bfin',
> 49   };

Note the single-quotes there (which are normally used for single characters).

According to the top answer here...
...this is technically valid, but not really portable (and the actual value of the constant is up to the compiler).

Unless we actually need this enum value to have this multi-character value for some reason (which I doubt we do), we should probably just drop the explicit value...?
Flags: needinfo?(bwu)
The reason I use this multi-character value is Android use it in a Keyed Vector in storing MetaData[1] and I add one more key for some purpose. If I just assign a number instead of using multi-character, there is a chance that my assigned value might be conflict with those values defined by multi-character in MetaData. 

Flags: needinfo?(bwu)
Component: Audio/Video → Audio/Video: Playback
Using multi-character constants for enum values is the coding style of Android's Stagefright API. I think we should permit these multi-character constants in Gecko code that interfaces with Stagefright and OMX code.

We can "fix" this warning by suppressing it in or globally in I suppressed some other -Wmultichar warnings in Stagefright code in bug 861601.
Closed: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.