From eb82959d6688f9e58be4b67670afba3649f1f799 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 2 May 2015 10:44:37 -0700 Subject: [PATCH] Fix undefined behavior in left-shifting into negative It's undefined behavior to left or right-shift a signed integer such that the sign changes. Since SymbolCsbBit is 31, make sure we use unsigned numbers. Found by ICC qplatformfontdatabase.cpp(614): error #68: integer conversion resulted in a change of sign Change-Id: Idf715b895bac4d56b4afffff13da78d294b1248e Reviewed-by: Konstantin Ritt --- src/gui/text/qplatformfontdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 5fa43948aa..502348a79a 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -611,7 +611,7 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q hasScript = true; //qDebug("font %s supports Korean", familyName.latin1()); } - if (codePageRange[0] & (1 << SymbolCsbBit)) { + if (codePageRange[0] & (1U << SymbolCsbBit)) { writingSystems = QSupportedWritingSystems(); hasScript = false; }