From 367d308b8267ad86cd7623590b7bfd4737b5fbf5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 25 Oct 2002 21:06:26 +0000 Subject: wrapped a few more C library functions --- src/mesa/drivers/x11/fakeglx.c | 32 ++++++++++++++++---------------- src/mesa/drivers/x11/xm_api.c | 38 +++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 35 deletions(-) (limited to 'src/mesa/drivers/x11') diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 99361b4d1a..2cb45df70a 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1,4 +1,4 @@ -/* $Id: fakeglx.c,v 1.70 2002/10/24 23:57:23 brianp Exp $ */ +/* $Id: fakeglx.c,v 1.71 2002/10/25 21:06:34 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -271,7 +271,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, if (dbFlag) { /* Check if the MESA_BACK_BUFFER env var is set */ - char *backbuffer = getenv("MESA_BACK_BUFFER"); + char *backbuffer = _mesa_getenv("MESA_BACK_BUFFER"); if (backbuffer) { if (backbuffer[0]=='p' || backbuffer[0]=='P') { ximageFlag = GL_FALSE; @@ -287,7 +287,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, /* Comparing IDs uses less memory but sometimes fails. */ /* XXX revisit this after 3.0 is finished. */ - if (getenv("MESA_GLX_VISUAL_HACK")) + if (_mesa_getenv("MESA_GLX_VISUAL_HACK")) comparePointers = GL_TRUE; else comparePointers = GL_FALSE; @@ -366,7 +366,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) ); } else if (is_usable_visual( visinfo )) { - if (getenv("MESA_GLX_FORCE_CI")) { + if (_mesa_getenv("MESA_GLX_FORCE_CI")) { /* Configure this visual as a COLOR INDEX visual. */ return save_glx_visual( dpy, visinfo, GL_FALSE, /* rgb */ @@ -565,21 +565,21 @@ static XVisualInfo *get_env_visual(Display *dpy, int scr, const char *varname) int depth, xclass = -1; XVisualInfo *vis; - if (!getenv( varname )) { + if (!_mesa_getenv( varname )) { return NULL; } - strncpy( value, getenv(varname), 100 ); + _mesa_strncpy( value, _mesa_getenv(varname), 100 ); value[99] = 0; sscanf( value, "%s %d", type, &depth ); - if (strcmp(type,"TrueColor")==0) xclass = TrueColor; - else if (strcmp(type,"DirectColor")==0) xclass = DirectColor; - else if (strcmp(type,"PseudoColor")==0) xclass = PseudoColor; - else if (strcmp(type,"StaticColor")==0) xclass = StaticColor; - else if (strcmp(type,"GrayScale")==0) xclass = GrayScale; - else if (strcmp(type,"StaticGray")==0) xclass = StaticGray; + if (_mesa_strcmp(type,"TrueColor")==0) xclass = TrueColor; + else if (_mesa_strcmp(type,"DirectColor")==0) xclass = DirectColor; + else if (_mesa_strcmp(type,"PseudoColor")==0) xclass = PseudoColor; + else if (_mesa_strcmp(type,"StaticColor")==0) xclass = StaticColor; + else if (_mesa_strcmp(type,"GrayScale")==0) xclass = GrayScale; + else if (_mesa_strcmp(type,"StaticGray")==0) xclass = StaticGray; if (xclass>-1 && depth>0) { vis = get_visual( dpy, scr, depth, xclass ); @@ -1383,7 +1383,7 @@ Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ) if (b) { XMesaDestroyBuffer(b); } - else if (getenv("MESA_DEBUG")) { + else if (_mesa_getenv("MESA_DEBUG")) { _mesa_warning(NULL, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n"); } } @@ -1457,7 +1457,7 @@ Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable ) if (buffer) { XMesaSwapBuffers(buffer); } - else if (getenv("MESA_DEBUG")) { + else if (_mesa_getenv("MESA_DEBUG")) { _mesa_warning(NULL, "Mesa: glXSwapBuffers: invalid drawable\n"); } } @@ -1474,7 +1474,7 @@ Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, if (buffer) { XMesaCopySubBuffer(buffer, x, y, width, height); } - else if (getenv("MESA_DEBUG")) { + else if (_mesa_getenv("MESA_DEBUG")) { _mesa_warning(NULL, "Mesa: glXCopySubBufferMESA: invalid drawable\n"); } } @@ -1742,7 +1742,7 @@ static const char * get_extensions( void ) { #ifdef FX - const char *fx = getenv("MESA_GLX_FX"); + const char *fx = _mesa_getenv("MESA_GLX_FX"); if (fx && fx[0] != 'd') { return EXTENSIONS; } diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 9ea50fb8bc..c991779433 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1,4 +1,4 @@ -/* $Id: xm_api.c,v 1.46 2002/10/24 23:57:23 brianp Exp $ */ +/* $Id: xm_api.c,v 1.47 2002/10/25 21:06:34 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -167,7 +167,7 @@ static void error( const char *msg ) { (void)DitherValues; /* Muffle compiler */ - if (getenv("MESA_DEBUG")) + if (_mesa_getenv("MESA_DEBUG")) fprintf( stderr, "X/Mesa error: %s\n", msg ); } @@ -266,7 +266,7 @@ static GLint gamma_adjust( GLfloat gamma, GLint value, GLint max ) } else { double x = (double) value / (double) max; - return IROUND_POS((GLfloat) max * pow(x, 1.0F/gamma)); + return IROUND_POS((GLfloat) max * _mesa_pow(x, 1.0F/gamma)); } } @@ -504,7 +504,7 @@ static GLboolean alloc_shm_back_buffer( XMesaBuffer b ) b->shminfo.shmid = shmget( IPC_PRIVATE, b->backimage->bytes_per_line * b->backimage->height, IPC_CREAT|0777 ); if (b->shminfo.shmid < 0) { - if (getenv("MESA_DEBUG")) + if (_mesa_getenv("MESA_DEBUG")) perror("alloc_back_buffer"); XDestroyImage( b->backimage ); b->backimage = NULL; @@ -516,7 +516,7 @@ static GLboolean alloc_shm_back_buffer( XMesaBuffer b ) b->shminfo.shmaddr = b->backimage->data = (char*)shmat( b->shminfo.shmid, 0, 0 ); if (b->shminfo.shmaddr == (char *) -1) { - if (getenv("MESA_DEBUG")) + if (_mesa_getenv("MESA_DEBUG")) perror("alloc_back_buffer"); XDestroyImage( b->backimage ); shmctl( b->shminfo.shmid, IPC_RMID, 0 ); @@ -872,7 +872,7 @@ static GLboolean setup_grayscale( int client, XMesaVisual v, buffer->pixel_to_b[xcol.pixel] = gray; } - if (colorsfailed && getenv("MESA_DEBUG")) { + if (colorsfailed && _mesa_getenv("MESA_DEBUG")) { fprintf( stderr, "Note: %d out of 256 needed colors do not match exactly.\n", colorsfailed ); @@ -952,7 +952,7 @@ static GLboolean setup_dithered_color( int client, XMesaVisual v, } } - if (colorsfailed && getenv("MESA_DEBUG")) { + if (colorsfailed && _mesa_getenv("MESA_DEBUG")) { fprintf( stderr, "Note: %d out of %d needed colors do not match exactly.\n", colorsfailed, _R*_G*_B ); @@ -986,19 +986,19 @@ static void setup_8bit_hpcr( XMesaVisual v ) g = 1.0 / v->RedGamma; for (i=0; i<256; i++) { - GLint red = IROUND_POS(255.0 * pow( hpcr_rgbTbl[0][i]/255.0, g )); + GLint red = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[0][i]/255.0, g )); v->hpcr_rgbTbl[0][i] = CLAMP( red, 16, 239 ); } g = 1.0 / v->GreenGamma; for (i=0; i<256; i++) { - GLint green = IROUND_POS(255.0 * pow( hpcr_rgbTbl[1][i]/255.0, g )); + GLint green = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[1][i]/255.0, g )); v->hpcr_rgbTbl[1][i] = CLAMP( green, 16, 239 ); } g = 1.0 / v->BlueGamma; for (i=0; i<256; i++) { - GLint blue = IROUND_POS(255.0 * pow( hpcr_rgbTbl[2][i]/255.0, g )); + GLint blue = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[2][i]/255.0, g )); v->hpcr_rgbTbl[2][i] = CLAMP( blue, 32, 223 ); } v->undithered_pf = PF_HPCR; /* can't really disable dithering for now */ @@ -1007,7 +1007,7 @@ static void setup_8bit_hpcr( XMesaVisual v ) /* which method should I use to clear */ /* GL_FALSE: keep the ordinary method */ /* GL_TRUE : clear with dither pattern */ - v->hpcr_clear_flag = getenv("MESA_HPCR_CLEAR") ? GL_TRUE : GL_FALSE; + v->hpcr_clear_flag = _mesa_getenv("MESA_HPCR_CLEAR") ? GL_TRUE : GL_FALSE; if (v->hpcr_clear_flag) { v->hpcr_clear_pixmap = XMesaCreatePixmap(v->display, @@ -1242,7 +1242,7 @@ static GLboolean initialize_visual_and_buffer( int client, } v->index_bits = 0; - if (getenv("MESA_NO_DITHER")) { + if (_mesa_getenv("MESA_NO_DITHER")) { v->dithered_pf = v->undithered_pf; } } @@ -1253,7 +1253,7 @@ static GLboolean initialize_visual_and_buffer( int client, * which can help Brian figure out what's going on when a user * reports bugs. */ - if (getenv("MESA_INFO")) { + if (_mesa_getenv("MESA_INFO")) { fprintf(stderr, "X/Mesa visual = %p\n", (void *) v); fprintf(stderr, "X/Mesa dithered pf = %u\n", v->dithered_pf); fprintf(stderr, "X/Mesa undithered pf = %u\n", v->undithered_pf); @@ -1471,7 +1471,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, GLint red_bits, green_bits, blue_bits, alpha_bits; /* For debugging only */ - if (getenv("MESA_XSYNC")) { + if (_mesa_getenv("MESA_XSYNC")) { /* This makes debugging X easier. * In your debugger, set a breakpoint on _XError to stop when an * X protocol error is generated. @@ -1529,7 +1529,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, #endif /* check for MESA_GAMMA environment variable */ - gamma = getenv("MESA_GAMMA"); + gamma = _mesa_getenv("MESA_GAMMA"); if (gamma) { v->RedGamma = v->GreenGamma = v->BlueGamma = 0.0; sscanf( gamma, "%f %f %f", &v->RedGamma, &v->GreenGamma, &v->BlueGamma ); @@ -1732,7 +1732,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, if (GET_VISUAL_DEPTH(v) != attr.depth) { #endif - if (getenv("MESA_DEBUG")) { + if (_mesa_getenv("MESA_DEBUG")) { fprintf(stderr, "XMesaCreateWindowBuffer: depth mismatch between visual and window!\n"); } return NULL; @@ -1748,7 +1748,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, b->cmap = attr.colormap; } else { - if (getenv("MESA_DEBUG")) { + if (_mesa_getenv("MESA_DEBUG")) { fprintf(stderr, "Window %u has no colormap!\n", (unsigned int) w); } /* this is weird, a window w/out a colormap!? */ @@ -1784,7 +1784,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, } #ifdef FX - fxEnvVar = getenv("MESA_GLX_FX"); + fxEnvVar = _mesa_getenv("MESA_GLX_FX"); if (fxEnvVar) { if (fxEnvVar[0]!='d') { int attribs[100]; @@ -2181,7 +2181,7 @@ GLboolean XMesaLoseCurrent(XMesaContext c) GLboolean XMesaSetFXmode( GLint mode ) { #ifdef FX - const char *fx = getenv("MESA_GLX_FX"); + const char *fx = _mesa_getenv("MESA_GLX_FX"); if (fx && fx[0] != 'd') { GET_CURRENT_CONTEXT(ctx); GrHwConfiguration hw; -- cgit v1.2.3