From aa2069586d434dd0487b0daa2b583efe801a0d51 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 16 Sep 2005 18:14:24 +0000 Subject: use mesa import wrappers, bug 4468 --- src/mesa/main/imports.c | 13 +++++++++++++ src/mesa/main/imports.h | 2 ++ src/mesa/main/texcompress_fxt1.c | 4 ++-- src/mesa/main/texenvprogram.c | 8 ++++---- src/mesa/main/texobj.c | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index fec0d33844..8d39f77b41 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -259,6 +259,19 @@ _mesa_bzero( void *dst, size_t n ) #endif } +/** Wrapper around either memcmp() or xf86memcmp() */ +int +_mesa_memcmp( const void *s1, const void *s2, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86memcmp( s1, s2, n ); +#elif defined(SUNOS4) + return memcmp( (char *) s1, (char *) s2, (int) n ); +#else + return memcmp(s1, s2, n); +#endif +} + /*@}*/ diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 27cc1a57f7..134eff84b3 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -613,6 +613,8 @@ _mesa_memset16( unsigned short *dst, unsigned short val, size_t n ); extern void _mesa_bzero( void *dst, size_t n ); +extern int +_mesa_memcmp( const void *s1, const void *s2, size_t n ); extern double _mesa_sin(double a); diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 748824194c..5fc41fa6bc 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -474,7 +474,7 @@ fxt1_choose (GLfloat vec[][MAX_COMP], GLint nv, } hist[N_TEXELS]; GLint lenh = 0; - memset(hist, 0, sizeof(hist)); + _mesa_memset(hist, 0, sizeof(hist)); for (k = 0; k < n; k++) { GLint l; @@ -1268,7 +1268,7 @@ fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps) if (comps == 3) { /* make the whole block opaque */ - memset(input, -1, sizeof(input)); + _mesa_memset(input, -1, sizeof(input)); } /* 8 texels each line */ diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 68dcc51b4c..2ffb1774a3 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -480,7 +480,7 @@ emit_op(struct texenv_fragment_program *p, GLuint nr = p->program->Base.NumInstructions++; struct fp_instruction *inst = &p->program->Instructions[nr]; - memset(inst, 0, sizeof(*inst)); + _mesa_memset(inst, 0, sizeof(*inst)); inst->Opcode = op; emit_arg( &inst->SrcReg[0], src0 ); @@ -792,7 +792,7 @@ static struct ureg emit_combine( struct texenv_fragment_program *p, emit_arith( p, FP_OPCODE_MAD, tmp0, WRITEMASK_XYZW, 0, two, src[0], neg1); - if (memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0) + if (_mesa_memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0) tmp1 = tmp0; else emit_arith( p, FP_OPCODE_MAD, tmp1, WRITEMASK_XYZW, 0, @@ -1039,7 +1039,7 @@ static void create_new_program(struct state_key *key, GLcontext *ctx, emit_arith( &p, FP_OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef ); emit_arith( &p, FP_OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef ); } - else if (memcmp(&cf, &out, sizeof(cf)) != 0) { + else if (_mesa_memcmp(&cf, &out, sizeof(cf)) != 0) { /* Will wind up in here if no texture enabled or a couple of * other scenarios (GL_REPLACE for instance). */ @@ -1093,7 +1093,7 @@ static void *search_cache( struct texenvprog_cache *cache, struct texenvprog_cache *c; for (c = cache; c; c = c->next) { - if (c->hash == hash && memcmp(c->key, key, keysize) == 0) + if (c->hash == hash && _mesa_memcmp(c->key, key, keysize) == 0) return c->data; } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 5594cd9382..3c74e74872 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -246,7 +246,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Always need the base level image */ if (!t->Image[0][baseLevel]) { char s[100]; - sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL", + _mesa_sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL", (void *) t, t->Name, baseLevel); incomplete(t, s); t->Complete = GL_FALSE; -- cgit v1.2.3