Parallel set of flag bit definitions: SFX_FILTER_FOO and FLAGVAL_FOO

Tor Lillqvist tml at iki.fi
Wed Apr 18 13:05:11 PDT 2012


I happened to notice that in
comphelper/inc/comphelper/documentconstants.hxx and
filter/source/config/cache/constant.hxx are a set of preprocessor
macros definiing flag bits apparently describing properties of
import/export filters. The SFX_FILTER_FOO values in the former match
the FLAGVAL_FOO values in the latter exactly, for each FOO.

Except for a couple of SFX_FILTER_FOO values that don't have any
corresponding FLAGVAL_FOO, and a few cases where the "FOO" part is
different (but still meaning the same, apparently). For instance the
mysterious SFX_FILTER_STARONEFILTER corresponds to the much less
obscure sounding FLAGVAL_3RDPARTYFILTER.

Clearly this is silly and bad practice. Just one set of symbolic names
for these flag bits should be enough, no? Or does the code *not*
assume they are the same? (I.e. would things work equally well if they
didn't match, and they happen to have matching values just out of
coincidence (ha ha)?)

BTW, what is "STARONEFILTER" / "3RDPARTYFILTER" flag is supposed to
mean? Also some of the filters included in LO codebase, presumably
present in the OOo codebase since approximately forever, have this
flag set (git grep 3RDPARTYFILTER filter/source/config), so in what
way are those "3rd-party"? Maybe a better name for this bit should be
invented that tells what it actually means... What does the mysterious
code in for instance sfx2/source/doc/objstor.cxx that checks the
SFX_FILTER_STARONEFILTER flag do? Sigh.

--tml


More information about the LibreOffice mailing list