Statements without effect in UserPropsDestination

Bug #855370 reported by Thomas Fischer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
RTF-Qt
Fix Committed
Undecided
Brad Hards

Bug Description

When compiling rtf-qt, I get a lot of warnings. Some of those point to actual bugs. For example, in UserPropsDestination::handleControlWord, there are statements like:

        } else if (value == 3) {
            m_propertyType == QVariant::Int;
        } else if (value == 5) {
            m_propertyType == QVariant::Double;
        } else if (value == 64) {
            m_propertyType == QVariant::Date;
        } else if (value == 11) {
            m_propertyType == QVariant::Bool;

Most likely, there should be real assignments, such as
 m_propertyType = QVariant::Bool;

Please confirm, test, and fix.

Revision history for this message
Brad Hards (bradh) wrote :

Hi,

Thanks for your interest in qt-rtf.

If you'd like to see this fixed, please provide the warnings / errors (i.e. cut-n-paste the compiler results), and ideally a patch.

Brad

Revision history for this message
Thomas Fischer (fischer-u) wrote :
Download full text (25.0 KiB)

Hello,
I missed to mention that I have enabled warnings during compilation, so I saw warnings you may not be aware of.
Attached is a patch touching three files: First, it enables warnings during compilation. Second, it changes the comparison operations in UserPropsDestination.cpp to assignments, and finally, it fixes a small problem I had where the compiler did not find include files (I guess it would not hurt to include them even if it compiles on your system without it).

The output I get from a compilation is as follows. You may want to look into the warnings if you can do anything about it.

[ 1%] Generating moc_quazipfile.cxx
Scanning dependencies of target RTFQUAZIP
[ 3%] Building CXX object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/JlCompress.cpp.o
[ 5%] Building CXX object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/qioapi.cpp.o
[ 6%] Building CXX object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/quaadler32.cpp.o
[ 8%] Building CXX object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/quacrc32.cpp.o
[ 10%] Building CXX object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/quazip.cpp.o
[ 11%] Building CXX object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/quazipfile.cpp.o
[ 13%] Building CXX object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/quazipnewinfo.cpp.o
[ 15%] Building C object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/unzip.c.o
[ 16%] Building C object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/zip.c.o
[ 18%] Building CXX object thirdparty/quazip/quazip/CMakeFiles/RTFQUAZIP.dir/moc_quazipfile.cxx.o
Linking CXX shared library libRTFQUAZIP.so
[ 18%] Built target RTFQUAZIP
[ 20%] Generating rtfreader.moc
Scanning dependencies of target RtfReader
[ 21%] Building CXX object src/CMakeFiles/RtfReader.dir/rtfreader.cpp.o
In file included from /tmp/rtf-qt-patched/src/rtfreader.h:31,
                 from /tmp/rtf-qt-patched/src/rtfreader.cpp:18:
/tmp/rtf-qt-patched/src/RtfGroupState.h: In constructor ‘RtfReader::RtfGroupState::RtfGroupState()’:
/tmp/rtf-qt-patched/src/RtfGroupState.h:29: warning: ‘RtfReader::RtfGroupState::endOfFile’ will be initialized after
/tmp/rtf-qt-patched/src/RtfGroupState.h:28: warning: ‘bool RtfReader::RtfGroupState::didChangeDestination’
/tmp/rtf-qt-patched/src/RtfGroupState.h:26: warning: when initialized here
[ 23%] Building CXX object src/CMakeFiles/RtfReader.dir/controlword.cpp.o
[ 25%] Building CXX object src/CMakeFiles/RtfReader.dir/AbstractRtfOutput.cpp.o
[ 26%] Building CXX object src/CMakeFiles/RtfReader.dir/AuthorPcdataDestination.cpp.o
In file included from /tmp/rtf-qt-patched/src/rtfreader.h:31,
                 from /tmp/rtf-qt-patched/src/AuthorPcdataDestination.cpp:20:
/tmp/rtf-qt-patched/src/RtfGroupState.h: In constructor ‘RtfReader::RtfGroupState::RtfGroupState()’:
/tmp/rtf-qt-patched/src/RtfGroupState.h:29: warning: ‘RtfReader::RtfGroupState::endOfFile’ will be initialized after
/tmp/rtf-qt-patched/src/RtfGroupState.h:28: warning: ‘bool RtfReader::RtfGroupState::didChangeDestination’
/tmp/rtf-qt-patched/src/RtfGroupState.h:26: warning: when initialized here
[ 28%] Building CXX object src/CMakeFiles/RtfReader.dir/CategoryPcda...

Revision history for this message
Brad Hards (bradh) wrote :

Which compiler (product and version) and which warning flags are you using?

Revision history for this message
Thomas Fischer (fischer-u) wrote :

Compiler:
gcc (Gentoo 4.4.5 p1.2, pie-0.4.5) 4.4.5

Flags: -Wall (as seen in the supplied patch)

Revision history for this message
Brad Hards (bradh) wrote :

Thanks for the patch and fix. Your patch is applied (in two parts as r30 and 31).

Brad Hards (bradh)
Changed in rtf-qt:
assignee: nobody → Brad Hards (bradh)
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.