fix for type mismatch with SWAP() macro.

This commit is contained in:
Campbell Barton 2012-08-25 19:43:15 +00:00
parent 7caff79a1a
commit 699b23ecdb
5 changed files with 25 additions and 21 deletions

@ -3094,11 +3094,11 @@ void BKE_nurb_direction_switch(Nurb *nu)
swapdata(bezt2->vec[0], bezt2->vec[2], 12);
SWAP(char, bezt1->h1, bezt1->h2);
SWAP(short, bezt1->f1, bezt1->f3);
SWAP(char, bezt1->f1, bezt1->f3);
if (bezt1 != bezt2) {
SWAP(char, bezt2->h1, bezt2->h2);
SWAP(short, bezt2->f1, bezt2->f3);
SWAP(char, bezt2->f1, bezt2->f3);
bezt1->alfa = -bezt1->alfa;
bezt2->alfa = -bezt2->alfa;
}

@ -2702,13 +2702,13 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
#endif
{
/* sort loop indices to ensure winding is correct */
if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
if (mf->v2 > mf->v3) SWAP(int, mf->v2, mf->v3);
if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
if (mf->v1 > mf->v2) SWAP(unsigned int, mf->v1, mf->v2);
if (mf->v2 > mf->v3) SWAP(unsigned int, mf->v2, mf->v3);
if (mf->v1 > mf->v2) SWAP(unsigned int, mf->v1, mf->v2);
if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
if (mf->v2 > mf->v3) SWAP(int, mf->v2, mf->v3);
if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
if (mf->v1 > mf->v2) SWAP(unsigned int, mf->v1, mf->v2);
if (mf->v2 > mf->v3) SWAP(unsigned int, mf->v2, mf->v3);
if (mf->v1 > mf->v2) SWAP(unsigned int, mf->v1, mf->v2);
}
/* end abusing the edcode */

@ -3627,8 +3627,8 @@ int BKE_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
SWAP(float, seq_a->blend_opacity, seq_b->blend_opacity);
SWAP(void *, seq_a->prev, seq_b->prev);
SWAP(void *, seq_a->next, seq_b->next);
SWAP(Sequence *, seq_a->prev, seq_b->prev);
SWAP(Sequence *, seq_a->next, seq_b->next);
SWAP(int, seq_a->start, seq_b->start);
SWAP(int, seq_a->startofs, seq_b->startofs);
SWAP(int, seq_a->endofs, seq_b->endofs);

@ -1938,7 +1938,7 @@ static void adduplicateflagNurb(Object *obedit, short flag)
}
else {
if (newu == 1) SWAP(short, newu, newv);
if (newu == 1) SWAP(int, newu, newv);
newnu = (Nurb *)MEM_mallocN(sizeof(Nurb), "adduplicateN5");
memcpy(newnu, nu, sizeof(Nurb));

@ -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);