# HG changeset patch # User reimar # Date 1145645177 0 # Node ID 01ca8a5fb8a62b8d9365fde445fda24d2a0854c4 # Parent 0f897ffb95bc4344180bf3086f851d4babbf9d8a minor fixes: get rid of pointless inline attributes and some additional checks fo ppm reading diff -r 0f897ffb95bc -r 01ca8a5fb8a6 libvo/gl_common.c --- a/libvo/gl_common.c Fri Apr 21 18:42:55 2006 +0000 +++ b/libvo/gl_common.c Fri Apr 21 18:46:17 2006 +0000 @@ -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: diff -r 0f897ffb95bc -r 01ca8a5fb8a6 libvo/gl_common.h --- a/libvo/gl_common.h Fri Apr 21 18:42:55 2006 +0000 +++ b/libvo/gl_common.h Fri Apr 21 18:46:17 2006 +0000 @@ -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 * \{ */