[PATCH 2/5] Fix warnings from visual studio compiler

unknown (none) AlexanderLarsson at .
Thu Feb 25 23:55:36 PST 2010


---
 common/lines.c        |   20 ++++++++++----------
 common/pixman_utils.c |   10 +++++-----
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/common/lines.c b/common/lines.c
index 8e44ac3..e02f3d6 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -77,7 +77,7 @@ SOFTWARE.
 #define xrealloc(a,b) realloc(a,b)
 #define xfree(i) free(i)
 
-typedef uint32_t CARD32;
+typedef unsigned int CARD32;
 typedef int Boolean;
 typedef pixman_rectangle32_t xRectangle;
 typedef SpicePoint DDXPointRec;
@@ -89,7 +89,7 @@ typedef struct lineGC *GCPtr;
  * a signed type.
  */
 #define MAX_COORDINATE 2147483647
-#define MIN_COORDINATE -2147483648
+#define MIN_COORDINATE -2147483647
 
 #define miZeroLine spice_canvas_zero_line
 #define miZeroDashLine spice_canvas_zero_dash_line
@@ -99,7 +99,7 @@ typedef struct lineGC *GCPtr;
 static int inline
 ICEIL (double x)
 {
-    int _cTmp = x;
+    int _cTmp = (int)x;
     return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp + 1;
 }
 
@@ -1420,7 +1420,7 @@ miZeroClipLine (int xmin, int ymin, int xmax, int ymax,
                 utmp++;
 
             if (negslope)
-                utmp = -utmp;
+                utmp = (uint32_t)(-(int32_t)utmp);
 
             if (eqn & T_2NDX)   /* We are calculating X steps */
                 x1 = anchorval + utmp;
@@ -2114,8 +2114,8 @@ miLineJoin (GCPtr pGC, Boolean foreground, SpanDataPtr spanData, LineFacePtr pLe
         scale = ady;
         if (adx > ady)
             scale = adx;
-        slopes[2].dx = (dx * 65536) / scale;
-        slopes[2].dy = (dy * 65536) / scale;
+        slopes[2].dx = (int) ((dx * 65536) / scale);
+        slopes[2].dy = (int) ((dy * 65536) / scale);
         slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy -
                        (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0;
         edgecount = 3;
@@ -2217,7 +2217,7 @@ miLineArcD (GCPtr pGC,
 
     pts = points;
     wids = widths;
-    xbase = floor (xorg);
+    xbase = (int)floor (xorg);
     x0 = xorg - xbase;
     ybase = ICEIL (yorg);
     y0 = yorg - ybase;
@@ -2225,7 +2225,7 @@ miLineArcD (GCPtr pGC,
     xrk = x0 + x0 - 1.0;
     yk = y0 + y0 - 1.0;
     radius = ((double) pGC->lineWidth) / 2.0;
-    y = floor (radius - y0 + 1.0);
+    y = (int)floor (radius - y0 + 1.0);
     ybase -= y;
     ymin = ybase;
     ymax = 65536;
@@ -2303,7 +2303,7 @@ miLineArcD (GCPtr pGC,
     }
     er = xrk - (xr << 1) - er;
     el = (xl << 1) - xlk - el;
-    boty = floor (-y0 - radius + 1.0);
+    boty = (int)floor (-y0 - radius + 1.0);
     if (ybase + y - boty > ymax)
         boty = ymax - ybase - y;
     while (y > boty) {
@@ -3251,7 +3251,7 @@ miWideDashSegment (GCPtr pGC,
                        &lcapFace, (LineFacePtr) NULL, rcenterx, rcentery, FALSE);
         }
     }
-    dashRemain = ((double) dashRemain) - LRemain;
+    dashRemain = (int)(((double) dashRemain) - LRemain);
     if (dashRemain == 0) {
         dashIndex++;
         if (dashIndex == pGC->numInDashList)
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index 27257f7..30e8919 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -43,7 +43,7 @@ solid_rop_ ## _name ## _ ## _size (_type *ptr, int len, _type src)  \
 {                                                  \
     while (len--) {                                \
         _type dst = *ptr;                          \
-        if (dst) /* avoid unused warning */;       \
+        if (dst) /* avoid unused warning */{};       \
         *ptr = (_type)(_equation);                 \
         ptr++;                                     \
     }                                              \
@@ -56,8 +56,8 @@ tiled_rop_ ## _name ## _ ## _size (_type *ptr, int len, _type *tile, _type *tile
     while (len--) {                                \
         _type src = *tile;                         \
         _type dst = *ptr;                          \
-        if (src) /* avoid unused warning */;       \
-        if (dst) /* avoid unused warning */;       \
+        if (src) /* avoid unused warning */{};       \
+        if (dst) /* avoid unused warning */{};       \
         *ptr = (_type)(_equation);                 \
         ptr++;                                     \
         tile++;                                    \
@@ -73,8 +73,8 @@ static void                                        \
     while (len--) {                                \
         _type src = *src_line;                     \
         _type dst = *ptr;                          \
-        if (src) /* avoid unused warning */;       \
-        if (dst) /* avoid unused warning */;       \
+        if (src) /* avoid unused warning */ {};       \
+        if (dst) /* avoid unused warning */{};       \
         *ptr = (_type)(_equation);                 \
         ptr++;                                     \
         src_line++;                                \
-- 
1.6.4.msysgit.0


--=-C/urJLXRf5ZTBGTwlhnK
Content-Disposition: attachment; filename*0=0003-Always-include-spice-types.h-before-pixman-so-standa.pat; filename*1=ch
Content-Type: text/x-patch; name="0003-Always-include-spice-types.h-before-pixman-so-standa.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit



More information about the Spice-devel mailing list