From 5c1a78b7a85d23ad1358b34d03a0002a19483655 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Jun 2008 13:12:41 +0900 Subject: [PATCH] mesa: More signed/unsigned float/integer fixes. --- src/mesa/main/mm.c | 20 +++++++++---------- src/mesa/main/mm.h | 16 +++++++-------- src/mesa/state_tracker/st_cb_bitmap.c | 16 +++++++-------- src/mesa/state_tracker/st_cb_drawpixels.c | 24 +++++++++++------------ 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c index 9f3aa00aff3..6f381b02a7f 100644 --- a/src/mesa/main/mm.c +++ b/src/mesa/main/mm.c @@ -53,11 +53,11 @@ mmDumpMemInfo(const struct mem_block *heap) } struct mem_block * -mmInit(unsigned int ofs, int size) +mmInit(unsigned ofs, unsigned size) { struct mem_block *heap, *block; - if (size <= 0) + if (!size) return NULL; heap = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block)); @@ -91,8 +91,8 @@ mmInit(unsigned int ofs, int size) static struct mem_block * SliceBlock(struct mem_block *p, - unsigned int startofs, int size, - int reserved, int alignment) + unsigned startofs, unsigned size, + unsigned reserved, unsigned alignment) { struct mem_block *newblock; @@ -160,14 +160,14 @@ SliceBlock(struct mem_block *p, struct mem_block * -mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) +mmAllocMem(struct mem_block *heap, unsigned size, unsigned align2, unsigned startSearch) { struct mem_block *p; - const int mask = (1 << align2)-1; - int startofs = 0; - int endofs; + const unsigned mask = (1 << align2)-1; + unsigned startofs = 0; + unsigned endofs; - if (!heap || align2 < 0 || size <= 0) + if (!heap || !align2 || !size) return NULL; for (p = heap->next_free; p != heap; p = p->next_free) { @@ -193,7 +193,7 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) struct mem_block * -mmFindBlock(struct mem_block *heap, int start) +mmFindBlock(struct mem_block *heap, unsigned start) { struct mem_block *p; diff --git a/src/mesa/main/mm.h b/src/mesa/main/mm.h index 5ad3ffd6d15..df340808ac9 100644 --- a/src/mesa/main/mm.h +++ b/src/mesa/main/mm.h @@ -39,10 +39,10 @@ struct mem_block { struct mem_block *next, *prev; struct mem_block *next_free, *prev_free; struct mem_block *heap; - unsigned int ofs; - int size; - unsigned int free:1; - unsigned int reserved:1; + unsigned ofs; + unsigned size; + unsigned free:1; + unsigned reserved:1; }; @@ -51,7 +51,7 @@ struct mem_block { * input: total size in bytes * return: a heap pointer if OK, NULL if error */ -extern struct mem_block *mmInit(unsigned int ofs, int size); +extern struct mem_block *mmInit(unsigned ofs, unsigned size); /** * Allocate 'size' bytes with 2^align2 bytes alignment, @@ -63,8 +63,8 @@ extern struct mem_block *mmInit(unsigned int ofs, int size); * startSearch = linear offset from start of heap to begin search * return: pointer to the allocated block, 0 if error */ -extern struct mem_block *mmAllocMem(struct mem_block *heap, int size, int align2, - int startSearch); +extern struct mem_block *mmAllocMem(struct mem_block *heap, unsigned size, + unsigned align2, unsigned startSearch); /** * Free block starts at offset @@ -78,7 +78,7 @@ extern int mmFreeMem(struct mem_block *b); * input: pointer to a heap, start offset * return: pointer to a block */ -extern struct mem_block *mmFindBlock(struct mem_block *heap, int start); +extern struct mem_block *mmFindBlock(struct mem_block *heap, unsigned start); /** * destroy MM diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 9e32ee2eb40..6fa3cbd533c 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -494,14 +494,14 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, const GLfloat width = (GLfloat)fb->Width; const GLfloat height = (GLfloat)fb->Height; struct pipe_viewport_state vp; - vp.scale[0] = 0.5 * width; - vp.scale[1] = (GLfloat)(height * (invert ? -0.5 : 0.5)); - vp.scale[2] = 1.0; - vp.scale[3] = 1.0; - vp.translate[0] = (GLfloat)(0.5 * width); - vp.translate[1] = (GLfloat)(0.5 * height); - vp.translate[2] = 0.0; - vp.translate[3] = 0.0; + vp.scale[0] = 0.5f * width; + vp.scale[1] = height * (invert ? -0.5f : 0.5f); + vp.scale[2] = 1.0f; + vp.scale[3] = 1.0f; + vp.translate[0] = 0.5f * width; + vp.translate[1] = 0.5f * height; + vp.translate[2] = 0.0f; + vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 8fdeb5c3804..d8f1d2367c1 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -425,12 +425,12 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z, const struct gl_framebuffer *fb = st->ctx->DrawBuffer; const GLfloat fb_width = fb->Width; const GLfloat fb_height = fb->Height; - const GLfloat clip_x0 = x0 / fb_width * 2.0 - 1.0; - const GLfloat clip_y0 = y0 / fb_height * 2.0 - 1.0; - const GLfloat clip_x1 = x1 / fb_width * 2.0 - 1.0; - const GLfloat clip_y1 = y1 / fb_height * 2.0 - 1.0; - const GLfloat sLeft = 0.0F, sRight = 1.0F; - const GLfloat tTop = invertTex, tBot = 1.0 - tTop; + const GLfloat clip_x0 = x0 / fb_width * 2.0f - 1.0f; + const GLfloat clip_y0 = y0 / fb_height * 2.0f - 1.0f; + const GLfloat clip_x1 = x1 / fb_width * 2.0f - 1.0f; + const GLfloat clip_y1 = y1 / fb_height * 2.0f - 1.0f; + const GLfloat sLeft = 0.0f, sRight = 1.0f; + const GLfloat tTop = invertTex, tBot = 1.0f - tTop; GLuint tex, i; /* upper-left */ @@ -463,21 +463,21 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z, if (color) { for (i = 0; i < 4; i++) { verts[i][0][2] = z; /*Z*/ - verts[i][0][3] = 1.0; /*W*/ + verts[i][0][3] = 1.0f; /*W*/ verts[i][1][0] = color[0]; verts[i][1][1] = color[1]; verts[i][1][2] = color[2]; verts[i][1][3] = color[3]; - verts[i][2][2] = 0.0; /*R*/ - verts[i][2][3] = 1.0; /*Q*/ + verts[i][2][2] = 0.0f; /*R*/ + verts[i][2][3] = 1.0f; /*Q*/ } } else { for (i = 0; i < 4; i++) { verts[i][0][2] = z; /*Z*/ - verts[i][0][3] = 1.0; /*W*/ - verts[i][1][2] = 0.0; /*R*/ - verts[i][1][3] = 1.0; /*Q*/ + verts[i][0][3] = 1.0f; /*W*/ + verts[i][1][2] = 0.0f; /*R*/ + verts[i][1][3] = 1.0f; /*Q*/ } } } -- 2.30.2