fixed mem leak in XFreeFontInfo() call
[mesa.git] / src / mesa / drivers / x11 / xfonts.c
index 2dcd2690a02ed7415f6578044be2430c4771de2e..3aa17fec849409a3750490d13983aa6b9555dcb2 100644 (file)
@@ -1,8 +1,8 @@
-/* $Id: xfonts.c,v 1.7 2000/08/13 03:44:08 brianp Exp $ */
+/* $Id: xfonts.c,v 1.14 2001/04/26 19:28:02 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.3
+ * Version:  3.5
  *
  * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
  *
@@ -29,6 +29,9 @@
  * Copyright (C) 1995 Thorsten.Ohl @ Physik.TH-Darmstadt.de
  */
 
+#ifdef __VMS
+#include <GL/vms_x_fix.h>
+#endif
 
 #ifdef HAVE_CONFIG_H
 #include "conf.h"
 #include <X11/Xutil.h>
 #include "GL/gl.h"
 #include "GL/glx.h"
-#include "GL/xmesa.h"
 #include "context.h"
 #include "mem.h"
 #include "xfonts.h"
-#include "xmesaP.h"
 
 
 /* Some debugging info.  */
@@ -179,10 +180,10 @@ fill_bitmap (Display *dpy, Window win, GC gc,
  * determine if a given glyph is valid and return the
  * corresponding XCharStruct.
  */
-static XCharStruct *isvalid(XFontStruct *fs, int which)
+static XCharStruct *isvalid(XFontStruct *fs, unsigned int which)
 {
   unsigned int  rows,pages;
-  int           byte1,byte2;
+  unsigned int byte1 = 0,byte2 = 0;
   int           i,valid = 1;
 
   rows = fs->max_byte1 - fs->min_byte1 + 1;
@@ -223,7 +224,6 @@ static XCharStruct *isvalid(XFontStruct *fs, int which)
 
 void Fake_glXUseXFont( Font font, int first, int count, int listbase )
 {
-  XMesaContext CC;
   Display *dpy;
   Window win;
   Pixmap pixmap;
@@ -244,8 +244,8 @@ void Fake_glXUseXFont( Font font, int first, int count, int listbase )
 
   fs = XQueryFont (dpy, font);
   if (!fs) {
-      gl_error (CC->gl_ctx, GL_INVALID_VALUE,
-                "Couldn't get font structure information");
+      _mesa_error(NULL, GL_INVALID_VALUE,
+               "Couldn't get font structure information");
       return;
   }
 
@@ -258,8 +258,8 @@ void Fake_glXUseXFont( Font font, int first, int count, int listbase )
   bm = (GLubyte *) MALLOC((max_bm_width * max_bm_height) * sizeof 
 (GLubyte));
   if (!bm) {
-      XFreeFontInfo( NULL, fs, 0 );
-      gl_error (CC->gl_ctx, GL_OUT_OF_MEMORY,
+      XFreeFontInfo( NULL, fs, 1 );
+      _mesa_error(NULL, GL_OUT_OF_MEMORY,
                 "Couldn't allocate bitmap in glXUseXFont()");
       return;
   }
@@ -373,7 +373,7 @@ bm_height);
     }
 
   FREE(bm);
-  XFreeFontInfo( NULL, fs, 0 );
+  XFreeFontInfo( NULL, fs, 1 );
   XFreeGC (dpy, gc);
 
   /* Restore saved packing modes.  */
@@ -384,16 +384,3 @@ bm_height);
   glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
   glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
 }
-
-
-extern void xmesa_xfonts_dummy( void );
-void xmesa_xfonts_dummy( void )
-{
-   /* silence unused var warnings */
-   (void) kernel8;
-   (void) DitherValues;
-   (void) HPCR_DRGB;
-   (void) kernel1;
-}
-
-/* The End. */