[MPlayer-cvslog] CVS: main/libvo gl_common.c, 1.41, 1.42 gl_common.h, 1.27, 1.28

Reimar Döffinger CVS syncmail at mplayerhq.hu
Fri Apr 21 20:46:20 CEST 2006


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv11814

Modified Files:
	gl_common.c gl_common.h 
Log Message:
minor fixes: get rid of pointless inline attributes and some additional checks
fo ppm reading


Index: gl_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- gl_common.c	9 Feb 2006 14:07:58 -0000	1.41
+++ gl_common.c	21 Apr 2006 18:46:17 -0000	1.42
@@ -359,6 +359,8 @@
     ungetc(c, f);
 }
 
+#define MAXDIM (16 * 1024)
+
 /**
  * \brief creates a texture from a PPM file
  * \param target texture taget, usually GL_TEXTURE_2D
@@ -373,23 +375,25 @@
  */
 int glCreatePPMTex(GLenum target, GLenum fmt, GLint filter,
                    FILE *f, int *width, int *height, int *maxval) {
-  int w, h, m, val;
+  unsigned w, h, m, val;
   char *data;
   ppm_skip(f);
   if (fgetc(f) != 'P' || fgetc(f) != '6')
     return 0;
   ppm_skip(f);
-  if (fscanf(f, "%i", &w) != 1)
+  if (fscanf(f, "%u", &w) != 1)
     return 0;
   ppm_skip(f);
-  if (fscanf(f, "%i", &h) != 1)
+  if (fscanf(f, "%u", &h) != 1)
     return 0;
   ppm_skip(f);
-  if (fscanf(f, "%i", &m) != 1)
+  if (fscanf(f, "%u", &m) != 1)
     return 0;
   val = fgetc(f);
   if (!isspace(val))
     return 0;
+  if (w > MAXDIM || h > MAXDIM)
+    return 0;
   data = (char *)malloc(w * h * 3);
   if (fread(data, w * 3, h, f) != h)
     return 0;
@@ -806,7 +810,7 @@
  * \param type type of YUV conversion
  * \ingroup glconversion
  */
-void inline glEnableYUVConversion(GLenum target, int type) {
+void glEnableYUVConversion(GLenum target, int type) {
   if (type <= 0) return;
   switch (type) {
     case YUV_CONVERSION_COMBINERS:
@@ -839,7 +843,7 @@
  * \param type type of YUV conversion
  * \ingroup glconversion
  */
-void inline glDisableYUVConversion(GLenum target, int type) {
+void glDisableYUVConversion(GLenum target, int type) {
   if (type <= 0) return;
   switch (type) {
     case YUV_CONVERSION_COMBINERS:

Index: gl_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- gl_common.h	26 Feb 2006 09:47:17 -0000	1.27
+++ gl_common.h	21 Apr 2006 18:46:17 -0000	1.28
@@ -228,8 +228,8 @@
                           float brightness, float contrast,
                           float hue, float saturation,
                           float rgamma, float ggamma, float bgamma);
-void inline glEnableYUVConversion(GLenum target, int type);
-void inline glDisableYUVConversion(GLenum target, int type);
+void glEnableYUVConversion(GLenum target, int type);
+void glDisableYUVConversion(GLenum target, int type);
 
 /** \addtogroup glcontext
   * \{ */




More information about the MPlayer-cvslog mailing list