Q(UrlTwo)Flags: avoid undefined behavior
authorMarc Mutz <marc.mutz@kdab.com>
Mon, 16 Sep 2013 20:24:45 +0000 (22:24 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 7 Nov 2013 02:06:06 +0000 (03:06 +0100)
commit1248b1cbe238616ab3a1dd79f65f76f92d256a6e
treebce2da8d691128b2861cb16e947d84d2d5ca60dc
parent6272a816d192b3c9b363164216bfd7a13e7370e9
Q(UrlTwo)Flags: avoid undefined behavior

Loading an enum with a value that isn't in the enum is undefined,
according to Clang's usan.

So when doing logical operations on QFlags<E>, don't go through
the QFlags(E) constructor, but via QFlags(QFlag) (=int) instead.

Apply the same change to QUrlTwoFlags.

Change-Id: I5f27e22c4d831482fcbba88b97cb124fb005e3fd
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/corelib/global/qflags.h
src/corelib/io/qurl.h