[gst-devel] flag macro inconsistence of gstobjec and gstminiobject
Stefan Kost
ensonic at hora-obscura.de
Sat Oct 8 06:55:21 CEST 2005
hi,
was adding more macro docs here and there and notices that
gstobject treats flags as bit-numbers:
#define GST_FLAGS(obj) (GST_OBJECT_CAST (obj)->flags)
/* for the flags we double-not to make them comparable to TRUE and FALSE */
#define GST_FLAG_IS_SET(obj,flag) (!!(GST_FLAGS (obj) & (1<<(flag))))
#define GST_FLAG_SET(obj,flag) (GST_FLAGS (obj) |= (1<<(flag)))
#define GST_FLAG_UNSET(obj,flag) (GST_FLAGS (obj) &= ~(1<<(flag)))
gstminiobject treats them as masks:
#define GST_MINI_OBJECT_FLAGS(obj) (GST_MINI_OBJECT(obj)->flags)
#define GST_MINI_OBJECT_FLAG_IS_SET(obj,flag)
(GST_MINI_OBJECT_FLAGS(obj) & (flag))
#define GST_MINI_OBJECT_FLAG_SET(obj,flag)
(GST_MINI_OBJECT_FLAGS (obj) |= (flag))
#define GST_MINI_OBJECT_FLAG_UNSET(obj,flag)
(GST_MINI_OBJECT_FLAGS (obj) &= ~(flag))
A quick look at gtk shows that they have:
#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
#define GTK_WIDGET_SET_FLAGS(wid,flag) G_STMT_START{
(GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END
#define GTK_WIDGET_UNSET_FLAGS(wid,flag) G_STMT_START{
(GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END
Furthermore if an api break can still be done I vote to rename the
macros in gstobject from
GST_FLAG_* to GST_OBJECT_FLAG
Any conclusion?
Stefan
More information about the gstreamer-devel
mailing list