Make all color values work
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 12 Aug 2009 07:04:32 +0000 (09:04 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 12 Aug 2009 07:04:32 +0000 (09:04 +0200)
Note to self: shifting an uint without explicit typecast might well end up
in a signed int.

src/uisupport/qssparser.cpp
src/uisupport/uistyle.cpp

index 1262be7..48a1a06 100644 (file)
@@ -289,9 +289,9 @@ quint64 QssParser::parseFormatType(const QString &decl) {
           return UiStyle::Invalid;
         }
         if(condName == "fg-color")
           return UiStyle::Invalid;
         }
         if(condName == "fg-color")
-          fmtType |= 0x00400000 | (col << 24);
+          fmtType |= 0x00400000 | (quint32)(col << 24);
         else
         else
-          fmtType |= 0x00800000 | (col << 28);
+          fmtType |= 0x00800000 | (quint32)(col << 28);
       } else {
         qWarning() << Q_FUNC_INFO << tr("Unhandled condition: %1").arg(condName);
         return UiStyle::Invalid;
       } else {
         qWarning() << Q_FUNC_INFO << tr("Unhandled condition: %1").arg(condName);
         return UiStyle::Invalid;
index 0ebdf06..f0c7e9f 100644 (file)
@@ -457,10 +457,10 @@ UiStyle::StyledString UiStyle::styleString(const QString &s_, quint32 baseFormat
         color &= 0x0f;
         if(s[pos+3] == 'f') {
           curfmt &= 0xf0ffffff;
         color &= 0x0f;
         if(s[pos+3] == 'f') {
           curfmt &= 0xf0ffffff;
-          curfmt |= (color << 24) | 0x00400000;
+          curfmt |= (quint32)(color << 24) | 0x00400000;
         } else {
           curfmt &= 0x0fffffff;
         } else {
           curfmt &= 0x0fffffff;
-          curfmt |= (color << 28) | 0x00800000;
+          curfmt |= (quint32)(color << 28) | 0x00800000;
         }
         length = 6;
       }
         }
         length = 6;
       }