[calligra/calligra/2.9] /: Fix warnings/bugs noted by André Wöbbeking

Boudewijn Rempt boud at valdyas.org
Fri Jan 9 09:06:42 GMT 2015


Git commit 3eacc21365ce8502a65a676bc56a6623f60bd7f1 by Boudewijn Rempt.
Committed on 09/01/2015 at 09:00.
Pushed by rempt into branch 'calligra/2.9'.

Fix warnings/bugs noted by  André Wöbbeking

CCMAIL:Woebbeking at kde.org
CCMAIL:calligra-devel at kde.org

warning: logical not is only applied to the left hand side of this comparison

calligra/krita/plugins/formats/psd/psd_image_data.cpp:310
calligra/krita/plugins/formats/psd/psd_layer_record.cpp:718
calligra/krita/plugins/formats/psd/psd_resource_block.cpp:83
calligra/krita/plugins/formats/psd/psd_resource_block.cpp:289
calligra/krita/plugins/formats/psd/psd_resource_block.cpp:303
calligra/sheets/dialogs/pivotmain.cpp:738
calligra/sheets/dialogs/pivotmain.cpp:757

warning: ignoring return value of function declared with warn_unused_result attribute

calligra/krita/image/krita_utils.cpp:131
calligra/krita/image/tests/kis_cage_transform_worker_test.cpp:99
calligra/krita/ui/flake/kis_shape_layer_canvas.cpp:118

I didn't touch:

calligra/3rdparty/kdchart/src/KDChartPieDiagram.cpp:583
calligra/filters/sheets/applixspread/applixspreadimport.cc:879
calligra/filters/sheets/applixspread/applixspreadimport.cc:896
calligra/filters/sheets/xlsx/XlsxXmlChartReader.cpp:3408
calligra/kexi/formeditor/container.cpp:136
calligra/sheets/functions/financial.cpp:1110

M  +1    -1    krita/image/krita_utils.cpp
M  +1    -1    krita/image/tests/kis_cage_transform_worker_test.cpp
M  +1    -1    krita/plugins/formats/psd/psd_image_data.cpp
M  +1    -1    krita/plugins/formats/psd/psd_layer_record.cpp
M  +3    -3    krita/plugins/formats/psd/psd_resource_block.cpp
M  +1    -1    krita/ui/flake/kis_shape_layer_canvas.cpp
M  +2    -2    sheets/dialogs/pivotmain.cpp

http://commits.kde.org/calligra/3eacc21365ce8502a65a676bc56a6623f60bd7f1

diff --git a/krita/image/krita_utils.cpp b/krita/image/krita_utils.cpp
index 14b9483..1f5d1f4 100644
--- a/krita/image/krita_utils.cpp
+++ b/krita/image/krita_utils.cpp
@@ -128,7 +128,7 @@ namespace KritaUtils
         QRect totalRect = path.boundingRect().toAlignedRect();
 
         // adjust the rect for antialiasing to work
-        totalRect.adjusted(-1,-1,1,1);
+        totalRect = totalRect.adjusted(-1,-1,1,1);
 
         const int step = 64;
         const int right = totalRect.x() + totalRect.width();
diff --git a/krita/image/tests/kis_cage_transform_worker_test.cpp b/krita/image/tests/kis_cage_transform_worker_test.cpp
index 526a93c..1406339 100644
--- a/krita/image/tests/kis_cage_transform_worker_test.cpp
+++ b/krita/image/tests/kis_cage_transform_worker_test.cpp
@@ -96,7 +96,7 @@ void testCage(bool clockwise, bool unityTransform, bool benchmarkPrepareOnly = f
             QPainter gc(&image);
             gc.drawImage(QPoint(), srcImage);
 
-            image.convertToFormat(QImage::Format_ARGB32);
+            image = image.convertToFormat(QImage::Format_ARGB32);
 
             KisCageTransformWorker qimageWorker(image,
                                                 srcQImageOffset,
diff --git a/krita/plugins/formats/psd/psd_image_data.cpp b/krita/plugins/formats/psd/psd_image_data.cpp
index 9aaa96b..b4da114 100644
--- a/krita/plugins/formats/psd/psd_image_data.cpp
+++ b/krita/plugins/formats/psd/psd_image_data.cpp
@@ -307,7 +307,7 @@ bool PSDImageData::write(QIODevice *io, KisPaintDeviceSP dev)
             channelLengthPos +=2;
             io->seek(channelStartPos);
 
-            if (!io->write(compressed) == compressed.size()) {
+            if (io->write(compressed) != compressed.size()) {
                 error = "Could not write image data";
                 return false;
             }
diff --git a/krita/plugins/formats/psd/psd_layer_record.cpp b/krita/plugins/formats/psd/psd_layer_record.cpp
index 6ded484..0dd42e3 100644
--- a/krita/plugins/formats/psd/psd_layer_record.cpp
+++ b/krita/plugins/formats/psd/psd_layer_record.cpp
@@ -715,7 +715,7 @@ bool PSDLayerRecord::writePixelData(QIODevice *io)
             channelRLESizePos +=2;
             io->seek(channelStartPos);
 
-            if (!io->write(compressed) == size) {
+            if (io->write(compressed) != size) {
                 error = "Could not write image data";
                 return false;
             }
diff --git a/krita/plugins/formats/psd/psd_resource_block.cpp b/krita/plugins/formats/psd/psd_resource_block.cpp
index 926354a..1888b8f 100644
--- a/krita/plugins/formats/psd/psd_resource_block.cpp
+++ b/krita/plugins/formats/psd/psd_resource_block.cpp
@@ -80,7 +80,7 @@ bool PSDResourceBlock::read(QIODevice* io)
     m_description = PSDResourceSection::idToString((PSDResourceSection::PSDResourceID)identifier);
 
     data = io->read(dataSize);
-    if (!data.size() == dataSize) {
+    if (data.size() != dataSize) {
         error = QString("Could not read data for resource block with name %1 of type %2").arg(name).arg(identifier);
         return false;
     }
@@ -286,7 +286,7 @@ bool PSDResourceBlock::write(QIODevice* io)
         buf.write(data);
         buf.close();
     }
-    if (!io->write(ba.constData(), ba.size()) == ba.size()) {
+    if (io->write(ba.constData(), ba.size()) != ba.size()) {
         error = QString("Could not write complete resource");
         return false;
     }
@@ -300,7 +300,7 @@ bool PSDResourceBlock::valid()
         error = QString("Unknown ID: %1").arg(identifier);
         return false;
     }
-    if (!data.size() == dataSize) {
+    if (data.size() != dataSize) {
         error = QString("Needed %1 bytes, got %2 bytes of data").arg(dataSize).arg(data.length());
         return false;
     }
diff --git a/krita/ui/flake/kis_shape_layer_canvas.cpp b/krita/ui/flake/kis_shape_layer_canvas.cpp
index 68ac1d5..d60f2e4 100644
--- a/krita/ui/flake/kis_shape_layer_canvas.cpp
+++ b/krita/ui/flake/kis_shape_layer_canvas.cpp
@@ -115,7 +115,7 @@ void KisShapeLayerCanvas::repaint()
 
     if (r.isEmpty()) return;
 
-    r.intersect(m_parentLayer->image()->bounds());
+    r = r.intersected(m_parentLayer->image()->bounds());
     QImage image(r.width(), r.height(), QImage::Format_ARGB32);
     image.fill(0);
     QPainter p(&image);
diff --git a/sheets/dialogs/pivotmain.cpp b/sheets/dialogs/pivotmain.cpp
index 1da640b..4aa152a 100644
--- a/sheets/dialogs/pivotmain.cpp
+++ b/sheets/dialogs/pivotmain.cpp
@@ -735,7 +735,7 @@ void PivotMain::clean(Sheet* sheet)
   for(int i=d->mainWidget.Rows->count()+1;i<=lastRow+1;i++){
     int temp=0;
     for(int j=d->mainWidget.Columns->count()+1;j<=lastColumn;j++){
-	if(!conv->toInteger(Cell(sheet,j,i).value())==0){
+    if(conv->toInteger(Cell(sheet,j,i).value()) != 0){
 	  temp=1;
 	  break;
 	}
@@ -754,7 +754,7 @@ void PivotMain::clean(Sheet* sheet)
   for(int i=d->mainWidget.Columns->count()+1;i<=lastColumn;i++){
     int temp=0;
     for(int j=d->mainWidget.Rows->count()+1;j<=lastRow;j++){
-	if(!conv->toInteger(Cell(sheet,i,j).value())==0){
+    if(conv->toInteger(Cell(sheet,i,j).value()) != 0){
 	  temp=1;
 	  break;
 	}



More information about the calligra-devel mailing list