khtml crashes on win32/msvc

Alexander Neundorf neundorf at kde.org
Wed Feb 28 17:12:09 GMT 2007


Hi,

here my unimportant opinion:

On Wednesday 28 February 2007 13:35, Ch.Ehrlicher at gmx.de wrote:
> Hi,
>
> I've two problems with khtml on win32/msvc:
>
> 1) msvc can't handle structs with boolean bitfields:
>
> struct InheritedFlags {
>  ...
>       bool _border_collapse : 1 ;
> };
>
> -> needs to be
>
> struct InheritedFlags {
>  ...
>       unsigned _border_collapse : 1 ;
> };

Sounds good IMO.

> 2) msvc can't handle structs with enum bitfields (when count(bits) > 1):
>
> - setting a value works fine
> - reading does not work because an enum is defined as a signed int -> I get
> negative values the workaround for this is to perform a bitwise and ->
>
> #ifdef Q_CC_MSVC
>  #define KHTML_ENUM_MSVC_FIX(v, t, s)  ((t)(v & 1<<(s-1)))
> #else
>  #define KHTML_ENUM_MSVC_FIX(v, t, s)  t
> #endif
>
> EUserInput userInput(InheritedFlags it) {
>     return KHTML_ENUM_MSVC_FIX(it.f._user_input, EUserInput, 2);
> }

This looks a bit ugly.
Maybe there is a compiler switch where you can changed how enums are handled ?

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net




More information about the kfm-devel mailing list