warning: overflow in implicit constant conversion in KoShape.cpp

Boudewijn Rempt boud at valdyas.org
Sun Aug 19 10:38:52 BST 2012


On Saturday 18 August 2012 Aug, André Wöbbeking wrote:
> Hi,
> 
> when compiling Calligra I get:
> 
> calligra/libs/flake/KoShape.cpp: In constructor 'KoShapePrivate::KoShapePrivate(KoShape*)':
> calligra/libs/flake/KoShape.cpp:105:48: warning: overflow in implicit constant conversion [-Woverflow]
> calligra/libs/flake/KoShape.cpp:105:48: warning: overflow in implicit constant conversion [-Woverflow]
> calligra/libs/flake/KoShape.cpp:105:48: warning: overflow in implicit constant conversion [-Woverflow]
> calligra/libs/flake/KoShape.cpp: In member function 'void KoShape::copySettings(const KoShape*)':
> calligra/libs/flake/KoShape.cpp:668:24: warning: overflow in implicit constant conversion [-Woverflow]
> 
> This is caused by bit fiddling in KoShape_p.h where int : 1 is used for bools.
> IMO this should be changed to uint : 1 like Qt is doing it to be more portable.
> 
> 
> Cheers,
> André
> 
> 
> P.S.: Please CC me.

Like this? I don't get the warnings myself so I am not sure.

diff --git a/libs/flake/KoShape_p.h b/libs/flake/KoShape_p.h
index c32a165..36a6f9b 100644
--- a/libs/flake/KoShape_p.h
+++ b/libs/flake/KoShape_p.h
@@ -80,16 +80,16 @@ public:
     qreal transparency; ///< the shapes transparency
     QString hyperLink; //hyperlink for this shape
 
-    static const int MaxZIndex = 32767;
-    int zIndex : 16; // keep maxZIndex in sync!
-    int runThrough : 16;
-    int visible : 1;
-    int printable : 1;
-    int geometryProtected : 1;
-    int keepAspect : 1;
-    int selectable : 1;
-    int detectCollision : 1;
-    int protectContent : 1;
+    static const uint MaxZIndex = 32767;
+    uint zIndex : 16; // keep maxZIndex in sync!
+    uint runThrough : 16;
+    uint visible : 1;
+    uint printable : 1;
+    uint geometryProtected : 1;
+    uint keepAspect : 1;
+    uint selectable : 1;
+    uint detectCollision : 1;
+    uint protectContent : 1;
 
     KoShape::TextRunAroundSide textRunAroundSide;
     qreal textRunAroundDistanceLeft;
lines 1-31/31 (END)



-- 
Boudewijn Rempt
http://www.valdyas.org, http://www.krita.org, http://www.boudewijnrempt.nl



More information about the calligra-devel mailing list