fix for type mismatch with SWAP() macro.
[blender.git] / source / blender / editors / sculpt_paint / paint_image.c
index d916ee299b6448fd21f1c147f06dd2bc23bc4811..953215b83aa2d2adafa0dda1f81265fa32da113d 100644 (file)
@@ -388,7 +388,11 @@ typedef struct UndoImageTile {
        char idname[MAX_ID_NAME];  /* name instead of pointer*/
        char ibufname[IB_FILENAME_SIZE];
 
-       void *rect;
+       union {
+               float        *fp;
+               unsigned int *uint;
+               void         *pt;
+       } rect;
        int x, y;
 
        short source, use_float;
@@ -406,10 +410,10 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, int
                    tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
 
        if (ibuf->rect_float) {
-               SWAP(void *, tmpibuf->rect_float, tile->rect);
+               SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
        }
        else {
-               SWAP(void *, tmpibuf->rect, tile->rect);
+               SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
        }
        
        if (restore)
@@ -428,7 +432,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
                if (tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source)
                        if (tile->use_float == use_float)
                                if (strcmp(tile->idname, ima->id.name) == 0 && strcmp(tile->ibufname, ibuf->name) == 0)
-                                       return tile->rect;
+                                       return tile->rect.pt;
        
        if (*tmpibuf == NULL)
                *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat | IB_rect);
@@ -440,7 +444,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
 
        allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
        allocsize *= (ibuf->rect_float) ? sizeof(float) : sizeof(char);
-       tile->rect = MEM_mapallocN(allocsize, "UndeImageTile.rect");
+       tile->rect.pt = MEM_mapallocN(allocsize, "UndeImageTile.rect");
 
        BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname));
 
@@ -453,7 +457,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
 
        BLI_addtail(lb, tile);
        
-       return tile->rect;
+       return tile->rect.pt;
 }
 
 static void image_undo_restore(bContext *C, ListBase *lb)
@@ -517,7 +521,7 @@ static void image_undo_free(ListBase *lb)
        UndoImageTile *tile;
 
        for (tile = lb->first; tile; tile = tile->next)
-               MEM_freeN(tile->rect);
+               MEM_freeN(tile->rect.pt);
 }
 
 /* get active image for face depending on old/new shading system */
@@ -4545,15 +4549,15 @@ static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
 
                /* temporarily add float rect for cloning */
                if (s->canvas->rect_float && !s->clonecanvas->rect_float) {
-                       int profile = IB_PROFILE_NONE;
+                       short profile = IB_PROFILE_NONE;
                        
                        /* Don't want to color manage, but don't disturb existing profiles */
-                       SWAP(int, s->clonecanvas->profile, profile);
+                       SWAP(short, s->clonecanvas->profile, profile);
 
                        IMB_float_from_rect(s->clonecanvas);
                        s->clonefreefloat = 1;
                        
-                       SWAP(int, s->clonecanvas->profile, profile);
+                       SWAP(short, s->clonecanvas->profile, profile);
                }
                else if (!s->canvas->rect_float && !s->clonecanvas->rect)
                        IMB_rect_from_float(s->clonecanvas);