GNOME Bugzilla – Bug 780923
Various combined-flag #defines are not C++ friendly
Last modified: 2017-04-05 11:46:30 UTC
In core, the following at least. A C++ compiler will complain that the result of the |-combination is not part of the enum (correctly!). Some other cases of such #defines are explicitly casting to the target type because of that (e.g. GST_BUFFER_COPY_ALL). I would suggest to do the same for the other ones (and we should also check -base and -bad libs). gst/gstpad.c:#define _PAD_PROBE_TYPE_ALL_BOTH_AND_FLUSH (GST_PAD_PROBE_TYPE_ALL_BOTH | GST_PAD_PROBE_TYPE_EVENT_FLUSH) gst/gstminiobject.h:#define GST_LOCK_FLAG_READWRITE (GST_LOCK_FLAG_READ | GST_LOCK_FLAG_WRITE) gst/gstmemory.h:#define GST_MAP_READWRITE (GST_MAP_READ | GST_MAP_WRITE) gst/gstbuffer.h:#define GST_BUFFER_COPY_METADATA (GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS |\ gst/gstelementfactory.h:#define GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER (GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE) gst/gstelementfactory.h:#define GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER (GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO) gst/gstelementfactory.h:#define GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS (GST_ELEMENT_FACTORY_TYPE_SINK | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE)
Any opinions?
Seeing that we already do that elsewhere, I just went ahead with it: commit 42a8ffcd39e0f39d94c950d377b1482b5fb145ec Author: Sebastian Dröge <sebastian@centricular.com> Date: Wed Apr 5 14:45:00 2017 +0300 gst: Cast combined-flags constants to their respective target types This makes C++ compilers a bit more happy without having the user of the constants cast. It also provides the correct type information to GI. https://bugzilla.gnome.org/show_bug.cgi?id=780923