Build fix for tst_qprinter with c++11
authorJędrzej Nowacki <jedrzej.nowacki@nokia.com>
Thu, 22 Dec 2011 14:44:28 +0000 (15:44 +0100)
committerQt by Nokia <qt-info@nokia.com>
Sun, 25 Dec 2011 19:16:55 +0000 (20:16 +0100)
GCC 4.6 fails to build the test because of narrowing conversion.

Change-Id: I927693789be7f3df7bd1a96c8924fc04716a03f0
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
tests/auto/gui/painting/qprinter/tst_qprinter.cpp

index 88c2a3e..d7b0ccb 100644 (file)
@@ -975,7 +975,8 @@ void tst_QPrinter::testPdfTitle()
         QPainter painter;
         QPrinter printer;
         // This string is just the UTF-8 encoding of the string: \()f &oslash; hiragana o
-        const char title[]={0x5c, 0x28, 0x29, 0x66, 0xc3, 0xb8, 0xe3, 0x81, 0x8a, 0x00};
+        const unsigned char titleBuf[]={0x5c, 0x28, 0x29, 0x66, 0xc3, 0xb8, 0xe3, 0x81, 0x8a, 0x00};
+        const char *title = reinterpret_cast<const char*>(titleBuf);
         printer.setOutputFileName("file.pdf");
         printer.setDocName(QString::fromUtf8(title));
         painter.begin(&printer);
@@ -986,10 +987,11 @@ void tst_QPrinter::testPdfTitle()
     // The we expect the title to appear in the PDF as:
     // ASCII('\title (') UTF16(\\\(\)f &oslash; hiragana o) ASCII(')').
     // which has the following binary representation
-    const char expected[] = {
+    const unsigned char expectedBuf[] = {
         0x2f, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x20, 0x28, 0xfe,
         0xff, 0x00, 0x5c, 0x5c, 0x00, 0x5c, 0x28, 0x00, 0x5c,
         0x29, 0x00, 0x66, 0x00, 0xf8, 0x30, 0x4a, 0x29};
+    const char *expected = reinterpret_cast<const char*>(expectedBuf);
     QVERIFY(file.readAll().contains(QByteArray(expected, 26)));
 }