Mercurial > mplayer.hg
changeset 18175:01ca8a5fb8a6
minor fixes: get rid of pointless inline attributes and some additional checks
fo ppm reading
author | reimar |
---|---|
date | Fri, 21 Apr 2006 18:46:17 +0000 |
parents | 0f897ffb95bc |
children | f72bc5754209 |
files | libvo/gl_common.c libvo/gl_common.h |
diffstat | 2 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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:
--- 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 * \{ */