Skip to content

Commit

Permalink
fix qztest build error.
Browse files Browse the repository at this point in the history
If int is bigger than quint16 then you will get the following
linker error:

.obj/testquazip.o: In function `TestQuaZip::setOsCode()':
testquazip.cpp:(.text+0x42bd): undefined reference to `bool QTest::qCompare<int, unsigned short>(int const&, unsigned short const&, char const*, char const*, char const*, int)'
collect2: error: ld returned 1 exit status

This error indicates the two parameters of QCOMPARE do not have the same type.

This occurs because integral promotions can be applied to fi.versionCreated.
  • Loading branch information
tsteven4 authored and stachenov committed Jul 11, 2019
1 parent 3d69581 commit df8a2c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion qztest/testquazip.cpp
Expand Up @@ -233,7 +233,7 @@ void TestQuaZip::setOsCode()
checkZip.goToFirstFile();
QuaZipFileInfo64 fi;
QVERIFY(checkZip.getCurrentFileInfo(&fi));
QCOMPARE(fi.versionCreated >> 8, static_cast<quint16>(osCode));
QCOMPARE(static_cast<uint>(fi.versionCreated) >> 8, osCode);
}

void TestQuaZip::setDataDescriptorWritingEnabled()
Expand Down

0 comments on commit df8a2c4

Please sign in to comment.