summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-01-15 00:29:51 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-01-15 00:29:51 +0000
commit3663c0f82527d972a7e5b85937d8da60253eb6f3 (patch)
tree6a571530e63a97a1ffb643af83474e63d7ea7229
parent5bae6b90f93bb1bc2d85efe3de963fb49a38fed1 (diff)
Cosmetic changes.
Added a bunch of const qualifiers. Use _mesa_memcpy() instead of memcpy(), etc.
-rw-r--r--src/mesa/main/arbparse.c2
-rw-r--r--src/mesa/tnl/t_save_api.c28
-rw-r--r--src/mesa/tnl/t_save_api.h2
-rw-r--r--src/mesa/tnl/t_save_loopback.c14
-rw-r--r--src/mesa/tnl/t_save_playback.c24
-rw-r--r--src/mesa/tnl/t_vertex.c8
-rw-r--r--src/mesa/tnl/t_vtx_api.c20
-rw-r--r--src/mesa/tnl/t_vtx_exec.c16
8 files changed, 55 insertions, 59 deletions
diff --git a/src/mesa/main/arbparse.c b/src/mesa/main/arbparse.c
index d1ea9d4984..ddffbc2b14 100644
--- a/src/mesa/main/arbparse.c
+++ b/src/mesa/main/arbparse.c
@@ -2638,7 +2638,7 @@ grammar_check (dict * di, const GLubyte * text, GLubyte ** production,
return 0;
}
- memcpy (*production, ba->data, ba->len * sizeof (GLubyte));
+ _mesa_memcpy(*production, ba->data, ba->len * sizeof (GLubyte));
*size = ba->len;
barray_destroy (&ba);
diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c
index 8901741ffe..9bf884e047 100644
--- a/src/mesa/tnl/t_save_api.c
+++ b/src/mesa/tnl/t_save_api.c
@@ -83,13 +83,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* wrong-footed on replay.
*/
static GLuint _save_copy_vertices( GLcontext *ctx,
- struct tnl_vertex_list *node )
+ const struct tnl_vertex_list *node )
{
TNLcontext *tnl = TNL_CONTEXT( ctx );
- struct tnl_prim *prim = &node->prim[node->prim_count-1];
+ const struct tnl_prim *prim = &node->prim[node->prim_count-1];
GLuint nr = prim->count;
GLuint sz = tnl->save.vertex_size;
- GLfloat *src = node->buffer + prim->start * sz;
+ const GLfloat *src = node->buffer + prim->start * sz;
GLfloat *dst = tnl->save.copied.buffer;
GLuint ovf, i;
@@ -103,23 +103,23 @@ static GLuint _save_copy_vertices( GLcontext *ctx,
case GL_LINES:
ovf = nr&1;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
return i;
case GL_TRIANGLES:
ovf = nr%3;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
return i;
case GL_QUADS:
ovf = nr&3;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
return i;
case GL_LINE_STRIP:
if (nr == 0)
return 0;
else {
- memcpy( dst, src+(nr-1)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+(nr-1)*sz, sz*sizeof(GLfloat) );
return 1;
}
case GL_LINE_LOOP:
@@ -128,11 +128,11 @@ static GLuint _save_copy_vertices( GLcontext *ctx,
if (nr == 0)
return 0;
else if (nr == 1) {
- memcpy( dst, src+0, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) );
return 1;
} else {
- memcpy( dst, src+0, sz*sizeof(GLfloat) );
- memcpy( dst+sz, src+(nr-1)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz*sizeof(GLfloat) );
return 2;
}
case GL_TRIANGLE_STRIP:
@@ -143,7 +143,7 @@ static GLuint _save_copy_vertices( GLcontext *ctx,
default: ovf = 2 + (nr&1); break;
}
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
return i;
default:
assert(0);
@@ -237,7 +237,7 @@ static void _save_compile_vertex_list( GLcontext *ctx )
/* Duplicate our template, increment refcounts to the storage structs:
*/
- memcpy(node->attrsz, tnl->save.attrsz, sizeof(node->attrsz));
+ _mesa_memcpy(node->attrsz, tnl->save.attrsz, sizeof(node->attrsz));
node->vertex_size = tnl->save.vertex_size;
node->buffer = tnl->save.buffer;
node->wrap_count = tnl->save.copied.nr;
@@ -295,7 +295,7 @@ static void _save_compile_vertex_list( GLcontext *ctx )
/* Deal with GL_COMPILE_AND_EXECUTE:
*/
if (ctx->ExecuteFlag) {
- _tnl_playback_vertex_list( ctx, (void *)node );
+ _tnl_playback_vertex_list( ctx, (void *) node );
}
}
@@ -350,7 +350,7 @@ static void _save_wrap_filled_vertex( GLcontext *ctx )
assert(tnl->save.counter > tnl->save.copied.nr);
for (i = 0 ; i < tnl->save.copied.nr ; i++) {
- memcpy( tnl->save.vbptr, data, tnl->save.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->save.vbptr, data, tnl->save.vertex_size * sizeof(GLfloat));
data += tnl->save.vertex_size;
tnl->save.vbptr += tnl->save.vertex_size;
tnl->save.counter--;
diff --git a/src/mesa/tnl/t_save_api.h b/src/mesa/tnl/t_save_api.h
index a6a8cd011b..eec2d685b0 100644
--- a/src/mesa/tnl/t_save_api.h
+++ b/src/mesa/tnl/t_save_api.h
@@ -51,7 +51,7 @@ extern void _tnl_save_init( GLcontext *ctx );
extern void _tnl_save_destroy( GLcontext *ctx );
extern void _tnl_loopback_vertex_list( GLcontext *ctx,
- struct tnl_vertex_list *list );
+ const struct tnl_vertex_list *list );
extern void _tnl_playback_vertex_list( GLcontext *ctx, void *data );
diff --git a/src/mesa/tnl/t_save_loopback.c b/src/mesa/tnl/t_save_loopback.c
index fec0ea5b64..088b73609a 100644
--- a/src/mesa/tnl/t_save_loopback.c
+++ b/src/mesa/tnl/t_save_loopback.c
@@ -183,8 +183,8 @@ struct loopback_attr {
* precalculated wrapping is wrong.
*/
static void loopback_prim( GLcontext *ctx,
- struct tnl_vertex_list *list, GLuint i,
- struct loopback_attr *la, GLuint nr )
+ const struct tnl_vertex_list *list, GLuint i,
+ const struct loopback_attr *la, GLuint nr )
{
struct tnl_prim *prim = &list->prim[i];
GLint begin = prim->start;
@@ -195,7 +195,8 @@ static void loopback_prim( GLcontext *ctx,
if (prim->mode & PRIM_BEGIN) {
glBegin( prim->mode & PRIM_MODE_MASK );
- } else {
+ }
+ else {
assert(i == 0);
assert(begin == 0);
begin += list->wrap_count;
@@ -231,8 +232,8 @@ static void loopback_prim( GLcontext *ctx,
* primitives.
*/
static void loopback_weak_prim( GLcontext *ctx,
- struct tnl_vertex_list *list, GLuint i,
- struct loopback_attr *la, GLuint nr )
+ const struct tnl_vertex_list *list, GLuint i,
+ const struct loopback_attr *la, GLuint nr )
{
if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END)
loopback_prim( ctx, list, i, la, nr );
@@ -255,7 +256,8 @@ static void loopback_weak_prim( GLcontext *ctx,
-void _tnl_loopback_vertex_list( GLcontext *ctx, struct tnl_vertex_list *list )
+void _tnl_loopback_vertex_list( GLcontext *ctx,
+ const struct tnl_vertex_list *list )
{
struct loopback_attr la[_TNL_ATTRIB_MAX];
GLuint i, nr = 0;
diff --git a/src/mesa/tnl/t_save_playback.c b/src/mesa/tnl/t_save_playback.c
index 37258c0a9f..8d353b3f7b 100644
--- a/src/mesa/tnl/t_save_playback.c
+++ b/src/mesa/tnl/t_save_playback.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.0
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -50,7 +50,7 @@ static GLint get_size( const GLfloat *f )
* TODO - remove VB->ColorPtr, etc and just use the AttrPtr's.
*/
static void _tnl_bind_vertex_list( GLcontext *ctx,
- struct tnl_vertex_list *node )
+ const struct tnl_vertex_list *node )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
@@ -118,10 +118,10 @@ static void _tnl_bind_vertex_list( GLcontext *ctx,
}
static void _playback_copy_to_current( GLcontext *ctx,
- struct tnl_vertex_list *node )
+ const struct tnl_vertex_list *node )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLfloat *data;
+ const GLfloat *data;
GLuint i;
if (node->count)
@@ -170,13 +170,12 @@ static void _playback_copy_to_current( GLcontext *ctx,
*/
void _tnl_playback_vertex_list( GLcontext *ctx, void *data )
{
- struct tnl_vertex_list *node = (struct tnl_vertex_list *)data;
+ const struct tnl_vertex_list *node = (const struct tnl_vertex_list *) data;
TNLcontext *tnl = TNL_CONTEXT(ctx);
FLUSH_CURRENT(ctx, 0);
- if (node->prim_count &&
- node->count) {
+ if (node->prim_count > 0 && node->count > 0) {
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END &&
(node->prim[0].mode & PRIM_BEGIN)) {
@@ -185,7 +184,7 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data )
* includes operations such as glBegin or glDrawArrays.
*/
_mesa_error( ctx, GL_INVALID_OPERATION, "displaylist recursive begin");
- _tnl_loopback_vertex_list( ctx, (struct tnl_vertex_list *) data );
+ _tnl_loopback_vertex_list( ctx, node );
return;
}
else if (tnl->LoopbackDListCassettes ||
@@ -193,7 +192,7 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data )
/* Degenerate case: list references current data and would
* require fixup. Take the easier option & loop it back.
*/
- _tnl_loopback_vertex_list( ctx, (struct tnl_vertex_list *) data );
+ _tnl_loopback_vertex_list( ctx, node );
return;
}
@@ -216,8 +215,3 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data )
*/
_playback_copy_to_current( ctx, node );
}
-
-
-
-
-
diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c
index a798f3e149..1e0616324e 100644
--- a/src/mesa/tnl/t_vertex.c
+++ b/src/mesa/tnl/t_vertex.c
@@ -765,9 +765,9 @@ static void generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
if (a[j].attrib == VERT_ATTRIB_COLOR0 ||
a[j].attrib == VERT_ATTRIB_COLOR1) {
- memcpy( vdst + a[j].vertoffset,
- vsrc + a[j].vertoffset,
- a[j].vertattrsize );
+ _mesa_memcpy( vdst + a[j].vertoffset,
+ vsrc + a[j].vertoffset,
+ a[j].vertattrsize );
}
}
}
@@ -931,7 +931,7 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin,
/* Else return the value from ctx->Current
*/
- memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat));
+ _mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat));
}
void *_tnl_get_vertex( GLcontext *ctx, GLuint nr )
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c
index d77a538ade..3dbef2add0 100644
--- a/src/mesa/tnl/t_vtx_api.c
+++ b/src/mesa/tnl/t_vtx_api.c
@@ -98,7 +98,7 @@ static void _tnl_wrap_filled_vertex( GLcontext *ctx )
assert(tnl->vtx.counter > tnl->vtx.copied.nr);
for (i = 0 ; i < tnl->vtx.copied.nr ; i++) {
- memcpy( tnl->vtx.vbptr, data, tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.vbptr, data, tnl->vtx.vertex_size * sizeof(GLfloat));
tnl->vtx.vbptr += tnl->vtx.vertex_size;
data += tnl->vtx.vertex_size;
tnl->vtx.counter--;
@@ -275,7 +275,7 @@ static void _tnl_wrap_upgrade_vertex( GLcontext *ctx,
static void _tnl_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- static float id[4] = { 0, 0, 0, 1 };
+ static const GLfloat id[4] = { 0, 0, 0, 1 };
int i;
if (tnl->vtx.attrsz[attr] < sz) {
@@ -893,13 +893,13 @@ static void GLAPIENTRY _tnl_EvalCoord1f( GLfloat u )
}
- memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex,
- tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex,
+ tnl->vtx.vertex_size * sizeof(GLfloat));
_tnl_do_EvalCoord1f( ctx, u );
- memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer,
- tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer,
+ tnl->vtx.vertex_size * sizeof(GLfloat));
}
static void GLAPIENTRY _tnl_EvalCoord2f( GLfloat u, GLfloat v )
@@ -924,13 +924,13 @@ static void GLAPIENTRY _tnl_EvalCoord2f( GLfloat u, GLfloat v )
_tnl_fixup_vertex( ctx, _TNL_ATTRIB_NORMAL, 3 );
}
- memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex,
- tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex,
+ tnl->vtx.vertex_size * sizeof(GLfloat));
_tnl_do_EvalCoord2f( ctx, u, v );
- memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer,
- tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer,
+ tnl->vtx.vertex_size * sizeof(GLfloat));
}
static void GLAPIENTRY _tnl_EvalCoord1fv( const GLfloat *u )
diff --git a/src/mesa/tnl/t_vtx_exec.c b/src/mesa/tnl/t_vtx_exec.c
index 06879bdc2c..4a36ed917f 100644
--- a/src/mesa/tnl/t_vtx_exec.c
+++ b/src/mesa/tnl/t_vtx_exec.c
@@ -202,23 +202,23 @@ static GLuint _tnl_copy_vertices( GLcontext *ctx )
case GL_LINES:
ovf = nr&1;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
return i;
case GL_TRIANGLES:
ovf = nr%3;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
return i;
case GL_QUADS:
ovf = nr&3;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
return i;
case GL_LINE_STRIP:
if (nr == 0)
return 0;
else {
- memcpy( dst, src+(nr-1)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+(nr-1)*sz, sz * sizeof(GLfloat) );
return 1;
}
case GL_LINE_LOOP:
@@ -227,11 +227,11 @@ static GLuint _tnl_copy_vertices( GLcontext *ctx )
if (nr == 0)
return 0;
else if (nr == 1) {
- memcpy( dst, src+0, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) );
return 1;
} else {
- memcpy( dst, src+0, sz * sizeof(GLfloat) );
- memcpy( dst+sz, src+(nr-1)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz * sizeof(GLfloat) );
return 2;
}
case GL_TRIANGLE_STRIP:
@@ -242,7 +242,7 @@ static GLuint _tnl_copy_vertices( GLcontext *ctx )
default: ovf = 2 + (nr&1); break;
}
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
return i;
case GL_POLYGON+1:
return 0;