summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-10-30 20:24:45 +0000
committerBrian Paul <[email protected]>2002-10-30 20:24:45 +0000
commit2ad5921cf3c9737796c3485bd5b9f738fb4a3cb9 (patch)
treea513b0edc8c67b122a78ad3d9c2de7519b6e4a57 /src/mesa
parente1e867c3b250506f7497dd8ecd1e3960d4d76354 (diff)
use wrappers from imports.h rather than stdio, stdlib, etc functions.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/x11/fakeglx.c21
-rw-r--r--src/mesa/drivers/x11/xm_api.c64
-rw-r--r--src/mesa/drivers/x11/xm_dd.c5
-rw-r--r--src/mesa/drivers/x11/xm_tri.c86
4 files changed, 77 insertions, 99 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index d4ad6975b5a..489ba77c6bb 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1,4 +1,4 @@
-/* $Id: fakeglx.c,v 1.72 2002/10/29 23:53:22 brianp Exp $ */
+/* $Id: fakeglx.c,v 1.73 2002/10/30 20:24:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -588,12 +588,8 @@ static XVisualInfo *get_env_visual(Display *dpy, int scr, const char *varname)
}
}
- {
- char s[1000];
- sprintf(s, "Mesa: GLX unable to find visual class=%s, depth=%d.\n",
- type, depth );
- _mesa_warning(NULL, s);
- }
+ _mesa_warning(NULL, "GLX unable to find visual class=%s, depth=%d.",
+ type, depth);
return NULL;
}
@@ -1081,7 +1077,8 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list )
default:
/* undefined attribute */
- printf("unexpected attrib 0x%x\n", *parselist);
+ _mesa_warning(NULL, "unexpected attrib 0x%x in choose_visual()",
+ *parselist);
return NULL;
}
}
@@ -1768,8 +1765,8 @@ static const char *
Fake_glXQueryServerString( Display *dpy, int screen, int name )
{
static char version[1000];
- sprintf(version, "%d.%d %s", SERVER_MAJOR_VERSION, SERVER_MINOR_VERSION,
- MESA_GLX_VERSION);
+ _mesa_sprintf(version, "%d.%d %s",
+ SERVER_MAJOR_VERSION, SERVER_MINOR_VERSION, MESA_GLX_VERSION);
(void) dpy;
(void) screen;
@@ -1793,8 +1790,8 @@ static const char *
Fake_glXGetClientString( Display *dpy, int name )
{
static char version[1000];
- sprintf(version, "%d.%d %s", CLIENT_MAJOR_VERSION, CLIENT_MINOR_VERSION,
- MESA_GLX_VERSION);
+ _mesa_sprintf(version, "%d.%d %s", CLIENT_MAJOR_VERSION,
+ CLIENT_MINOR_VERSION, MESA_GLX_VERSION);
(void) dpy;
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index db5603205ac..6dbb3f38567 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.49 2002/10/29 23:53:22 brianp Exp $ */
+/* $Id: xm_api.c,v 1.50 2002/10/30 20:24:46 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -161,18 +161,6 @@ static short hpcr_rgbTbl[3][256] = {
/*
- * X/Mesa error reporting function:
- */
-static void error( const char *msg )
-{
- (void)DitherValues; /* Muffle compiler */
-
- if (_mesa_getenv("MESA_DEBUG"))
- fprintf( stderr, "X/Mesa error: %s\n", msg );
-}
-
-
-/*
* Return the host's byte order as LSBFirst or MSBFirst ala X.
*/
#ifndef XFree86Server
@@ -496,7 +484,7 @@ static GLboolean alloc_shm_back_buffer( XMesaBuffer b )
ZPixmap, NULL, &b->shminfo,
b->width, b->height );
if (b->backimage == NULL) {
- error("alloc_back_buffer: Shared memory error (XShmCreateImage), disabling.");
+ _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (XShmCreateImage), disabling.");
b->shm = 0;
return GL_FALSE;
}
@@ -504,11 +492,10 @@ 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 (_mesa_getenv("MESA_DEBUG"))
- perror("alloc_back_buffer");
+ _mesa_warning(NULL, "shmget failed while allocating back buffer");
XDestroyImage( b->backimage );
b->backimage = NULL;
- error("alloc_back_buffer: Shared memory error (shmget), disabling.");
+ _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmget), disabling.");
b->shm = 0;
return GL_FALSE;
}
@@ -516,12 +503,11 @@ 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 (_mesa_getenv("MESA_DEBUG"))
- perror("alloc_back_buffer");
+ _mesa_warning(NULL, "shmat() failed while allocating back buffer");
XDestroyImage( b->backimage );
shmctl( b->shminfo.shmid, IPC_RMID, 0 );
b->backimage = NULL;
- error("alloc_back_buffer: Shared memory error (shmat), disabling.");
+ _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmat), disabling.");
b->shm = 0;
return GL_FALSE;
}
@@ -634,12 +620,12 @@ void xmesa_alloc_back_buffer( XMesaBuffer b )
8, 0 ); /* pad, bytes_per_line */
#endif
if (!b->backimage) {
- error("alloc_back_buffer: XCreateImage failed.");
+ _mesa_warning(NULL, "alloc_back_buffer: XCreateImage failed.");
}
b->backimage->data = (char *) MALLOC( b->backimage->height
* b->backimage->bytes_per_line );
if (!b->backimage->data) {
- error("alloc_back_buffer: MALLOC failed.");
+ _mesa_warning(NULL, "alloc_back_buffer: MALLOC failed.");
XMesaDestroyImage( b->backimage );
b->backimage = NULL;
}
@@ -873,7 +859,7 @@ static GLboolean setup_grayscale( int client, XMesaVisual v,
}
if (colorsfailed && _mesa_getenv("MESA_DEBUG")) {
- fprintf( stderr,
+ _mesa_warning(NULL,
"Note: %d out of 256 needed colors do not match exactly.\n",
colorsfailed );
}
@@ -953,7 +939,7 @@ static GLboolean setup_dithered_color( int client, XMesaVisual v,
}
if (colorsfailed && _mesa_getenv("MESA_DEBUG")) {
- fprintf( stderr,
+ _mesa_warning(NULL,
"Note: %d out of %d needed colors do not match exactly.\n",
colorsfailed, _R*_G*_B );
}
@@ -1237,7 +1223,7 @@ static GLboolean initialize_visual_and_buffer( int client,
}
}
else {
- error("XMesa: RGB mode rendering not supported in given visual.");
+ _mesa_warning(NULL, "XMesa: RGB mode rendering not supported in given visual.");
return GL_FALSE;
}
v->index_bits = 0;
@@ -1254,12 +1240,12 @@ static GLboolean initialize_visual_and_buffer( int client,
* reports bugs.
*/
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);
- fprintf(stderr, "X/Mesa level = %d\n", v->level);
- fprintf(stderr, "X/Mesa depth = %d\n", GET_VISUAL_DEPTH(v));
- fprintf(stderr, "X/Mesa bits per pixel = %d\n", v->BitsPerPixel);
+ _mesa_printf("X/Mesa visual = %p\n", (void *) v);
+ _mesa_printf("X/Mesa dithered pf = %u\n", v->dithered_pf);
+ _mesa_printf("X/Mesa undithered pf = %u\n", v->undithered_pf);
+ _mesa_printf("X/Mesa level = %d\n", v->level);
+ _mesa_printf("X/Mesa depth = %d\n", GET_VISUAL_DEPTH(v));
+ _mesa_printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel);
}
if (b && window) {
@@ -1732,9 +1718,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
if (GET_VISUAL_DEPTH(v) != attr.depth) {
#endif
- if (_mesa_getenv("MESA_DEBUG")) {
- fprintf(stderr, "XMesaCreateWindowBuffer: depth mismatch between visual and window!\n");
- }
+ _mesa_warning(NULL, "XMesaCreateWindowBuffer: depth mismatch between visual and window!\n");
return NULL;
}
@@ -1748,9 +1732,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
b->cmap = attr.colormap;
}
else {
- if (_mesa_getenv("MESA_DEBUG")) {
- fprintf(stderr, "Window %u has no colormap!\n", (unsigned int) w);
- }
+ _mesa_warning(NULL, "Window %u has no colormap!\n", (unsigned int) w);
/* this is weird, a window w/out a colormap!? */
/* OK, let's just allocate a new one and hope for the best */
b->cmap = XCreateColormap(v->display, w, attr.visual, AllocNone);
@@ -1843,10 +1825,10 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
}
}
else {
- fprintf(stderr,"WARNING: This Mesa Library includes the Glide driver but\n");
- fprintf(stderr," you have not defined the MESA_GLX_FX env. var.\n");
- fprintf(stderr," (check the README.3DFX file for more information).\n\n");
- fprintf(stderr," you can disable this message with a 'export MESA_GLX_FX=disable'.\n");
+ _mesa_warning(NULL, "WARNING: This Mesa Library includes the Glide driver but\n");
+ _mesa_warning(NULL, " you have not defined the MESA_GLX_FX env. var.\n");
+ _mesa_warning(NULL, " (check the README.3DFX file for more information).\n\n");
+ _mesa_warning(NULL, " you can disable this message with a 'export MESA_GLX_FX=disable'.\n");
}
#endif
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index 67c7c441531..c0a71ff4b1e 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -1,4 +1,4 @@
-/* $Id: xm_dd.c,v 1.40 2002/10/24 23:57:23 brianp Exp $ */
+/* $Id: xm_dd.c,v 1.41 2002/10/30 20:24:47 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -158,8 +158,7 @@ set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
}
}
else {
- _mesa_problem(ctx, "invalid buffer in set_buffer() in xm_dd.c");
- printf("bufferBit = 0x%x\n", bufferBit);
+ _mesa_problem(ctx, "invalid buffer 0x%x in set_buffer() in xm_dd.c");
return;
}
xmesa_update_span_funcs(ctx);
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index b83b7502790..17bbc27a5c5 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -1,4 +1,4 @@
-/* $Id: xm_tri.c,v 1.28 2002/10/24 23:57:23 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.29 2002/10/30 20:24:47 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1406,89 +1406,89 @@ static void flat_LOOKUP8_triangle( GLcontext *ctx,
extern void _xmesa_print_triangle_func( swrast_tri_func triFunc );
void _xmesa_print_triangle_func( swrast_tri_func triFunc )
{
- printf("XMesa tri func = ");
+ _mesa_printf("XMesa tri func = ");
if (triFunc ==smooth_TRUECOLOR_z_triangle)
- printf("smooth_TRUECOLOR_z_triangle\n");
+ _mesa_printf("smooth_TRUECOLOR_z_triangle\n");
else if (triFunc ==smooth_8A8B8G8R_z_triangle)
- printf("smooth_8A8B8G8R_z_triangle\n");
+ _mesa_printf("smooth_8A8B8G8R_z_triangle\n");
else if (triFunc ==smooth_8R8G8B_z_triangle)
- printf("smooth_8R8G8B_z_triangle\n");
+ _mesa_printf("smooth_8R8G8B_z_triangle\n");
else if (triFunc ==smooth_8R8G8B24_z_triangle)
- printf("smooth_8R8G8B24_z_triangle\n");
+ _mesa_printf("smooth_8R8G8B24_z_triangle\n");
else if (triFunc ==smooth_TRUEDITHER_z_triangle)
- printf("smooth_TRUEDITHER_z_triangle\n");
+ _mesa_printf("smooth_TRUEDITHER_z_triangle\n");
else if (triFunc ==smooth_5R6G5B_z_triangle)
- printf("smooth_5R6G5B_z_triangle\n");
+ _mesa_printf("smooth_5R6G5B_z_triangle\n");
else if (triFunc ==smooth_DITHER_5R6G5B_z_triangle)
- printf("smooth_DITHER_5R6G5B_z_triangle\n");
+ _mesa_printf("smooth_DITHER_5R6G5B_z_triangle\n");
else if (triFunc ==smooth_HPCR_z_triangle)
- printf("smooth_HPCR_z_triangle\n");
+ _mesa_printf("smooth_HPCR_z_triangle\n");
else if (triFunc ==smooth_DITHER8_z_triangle)
- printf("smooth_DITHER8_z_triangle\n");
+ _mesa_printf("smooth_DITHER8_z_triangle\n");
else if (triFunc ==smooth_LOOKUP8_z_triangle)
- printf("smooth_LOOKUP8_z_triangle\n");
+ _mesa_printf("smooth_LOOKUP8_z_triangle\n");
else if (triFunc ==flat_TRUECOLOR_z_triangle)
- printf("flat_TRUECOLOR_z_triangle\n");
+ _mesa_printf("flat_TRUECOLOR_z_triangle\n");
else if (triFunc ==flat_8A8B8G8R_z_triangle)
- printf("flat_8A8B8G8R_z_triangle\n");
+ _mesa_printf("flat_8A8B8G8R_z_triangle\n");
else if (triFunc ==flat_8R8G8B_z_triangle)
- printf("flat_8R8G8B_z_triangle\n");
+ _mesa_printf("flat_8R8G8B_z_triangle\n");
else if (triFunc ==flat_8R8G8B24_z_triangle)
- printf("flat_8R8G8B24_z_triangle\n");
+ _mesa_printf("flat_8R8G8B24_z_triangle\n");
else if (triFunc ==flat_TRUEDITHER_z_triangle)
- printf("flat_TRUEDITHER_z_triangle\n");
+ _mesa_printf("flat_TRUEDITHER_z_triangle\n");
else if (triFunc ==flat_5R6G5B_z_triangle)
- printf("flat_5R6G5B_z_triangle\n");
+ _mesa_printf("flat_5R6G5B_z_triangle\n");
else if (triFunc ==flat_DITHER_5R6G5B_z_triangle)
- printf("flat_DITHER_5R6G5B_z_triangle\n");
+ _mesa_printf("flat_DITHER_5R6G5B_z_triangle\n");
else if (triFunc ==flat_HPCR_z_triangle)
- printf("flat_HPCR_z_triangle\n");
+ _mesa_printf("flat_HPCR_z_triangle\n");
else if (triFunc ==flat_DITHER8_z_triangle)
- printf("flat_DITHER8_z_triangle\n");
+ _mesa_printf("flat_DITHER8_z_triangle\n");
else if (triFunc ==flat_LOOKUP8_z_triangle)
- printf("flat_LOOKUP8_z_triangle\n");
+ _mesa_printf("flat_LOOKUP8_z_triangle\n");
else if (triFunc ==smooth_TRUECOLOR_triangle)
- printf("smooth_TRUECOLOR_triangle\n");
+ _mesa_printf("smooth_TRUECOLOR_triangle\n");
else if (triFunc ==smooth_8A8B8G8R_triangle)
- printf("smooth_8A8B8G8R_triangle\n");
+ _mesa_printf("smooth_8A8B8G8R_triangle\n");
else if (triFunc ==smooth_8R8G8B_triangle)
- printf("smooth_8R8G8B_triangle\n");
+ _mesa_printf("smooth_8R8G8B_triangle\n");
else if (triFunc ==smooth_8R8G8B24_triangle)
- printf("smooth_8R8G8B24_triangle\n");
+ _mesa_printf("smooth_8R8G8B24_triangle\n");
else if (triFunc ==smooth_TRUEDITHER_triangle)
- printf("smooth_TRUEDITHER_triangle\n");
+ _mesa_printf("smooth_TRUEDITHER_triangle\n");
else if (triFunc ==smooth_5R6G5B_triangle)
- printf("smooth_5R6G5B_triangle\n");
+ _mesa_printf("smooth_5R6G5B_triangle\n");
else if (triFunc ==smooth_DITHER_5R6G5B_triangle)
- printf("smooth_DITHER_5R6G5B_triangle\n");
+ _mesa_printf("smooth_DITHER_5R6G5B_triangle\n");
else if (triFunc ==smooth_HPCR_triangle)
- printf("smooth_HPCR_triangle\n");
+ _mesa_printf("smooth_HPCR_triangle\n");
else if (triFunc ==smooth_DITHER8_triangle)
- printf("smooth_DITHER8_triangle\n");
+ _mesa_printf("smooth_DITHER8_triangle\n");
else if (triFunc ==smooth_LOOKUP8_triangle)
- printf("smooth_LOOKUP8_triangle\n");
+ _mesa_printf("smooth_LOOKUP8_triangle\n");
else if (triFunc ==flat_TRUECOLOR_triangle)
- printf("flat_TRUECOLOR_triangle\n");
+ _mesa_printf("flat_TRUECOLOR_triangle\n");
else if (triFunc ==flat_TRUEDITHER_triangle)
- printf("flat_TRUEDITHER_triangle\n");
+ _mesa_printf("flat_TRUEDITHER_triangle\n");
else if (triFunc ==flat_8A8B8G8R_triangle)
- printf("flat_8A8B8G8R_triangle\n");
+ _mesa_printf("flat_8A8B8G8R_triangle\n");
else if (triFunc ==flat_8R8G8B_triangle)
- printf("flat_8R8G8B_triangle\n");
+ _mesa_printf("flat_8R8G8B_triangle\n");
else if (triFunc ==flat_8R8G8B24_triangle)
- printf("flat_8R8G8B24_triangle\n");
+ _mesa_printf("flat_8R8G8B24_triangle\n");
else if (triFunc ==flat_5R6G5B_triangle)
- printf("flat_5R6G5B_triangle\n");
+ _mesa_printf("flat_5R6G5B_triangle\n");
else if (triFunc ==flat_DITHER_5R6G5B_triangle)
- printf("flat_DITHER_5R6G5B_triangle\n");
+ _mesa_printf("flat_DITHER_5R6G5B_triangle\n");
else if (triFunc ==flat_HPCR_triangle)
- printf("flat_HPCR_triangle\n");
+ _mesa_printf("flat_HPCR_triangle\n");
else if (triFunc ==flat_DITHER8_triangle)
- printf("flat_DITHER8_triangle\n");
+ _mesa_printf("flat_DITHER8_triangle\n");
else if (triFunc ==flat_LOOKUP8_triangle)
- printf("flat_LOOKUP8_triangle\n");
+ _mesa_printf("flat_LOOKUP8_triangle\n");
else
- printf("???\n");
+ _mesa_printf("???\n");
}
#endif