diff options
author | Dongmei Wang <dongmei.wang@qt.io> | 2017-08-18 11:24:13 -0700 |
---|---|---|
committer | Dongmei Wang <dongmei.wang@qt.io> | 2017-12-05 07:29:25 +0000 |
commit | b8a6e2b6e8e4b5ea0734285f485c03c22022c30e (patch) | |
tree | 23cb81131bf4cb772151dfd96a71eaf134756d1c | |
parent | 29104c85db53e7c0c0aaf3fe78f84b737fce4886 (diff) |
QColor: write signed 64-bit integer in a platform-independent way
When building Qt 5.6.2 with gcc 4.1.2 on Fedora 8, a compilation error
happened when compiling the code below
QColor::name()
{
...
case HexArgb:
return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8);
...
}
qtbase/src/gui/painting/qcolor.cpp:527: error: integer constant is too large for ‘long’ type
gcc 4.1.2 was unable to handle 0x100000000. The patch is to use Q_INT64_C to
append "LL" to 0x100000000 to avoid the compilation error.
Change-Id: I000e65a5c897ef2d78fcfe4e212d832eb488a762
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
-rw-r--r-- | src/gui/painting/qcolor.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 9e1785c11d..6e0e348a67 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -853,7 +853,7 @@ QString QColor::name(NameFormat format) const return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6); case HexArgb: // it's called rgba() but it does return AARRGGBB - return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8); + return QLatin1Char('#') + QString::number(rgba() | Q_INT64_C(0x100000000), 16).rightRef(8); } return QString(); } |