summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-04-21 18:46:17 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-04-21 18:46:17 +0000
commit19935f69bd53ab35008d0a7359410609f882b9f7 (patch)
tree27f2e9b914b68eeac257b20aee68623a75634e55 /libvo
parentd9d16656b2d1a4f87d0e8511d2fa2f95dfbdb6b5 (diff)
downloadmpv-19935f69bd53ab35008d0a7359410609f882b9f7.tar.bz2
mpv-19935f69bd53ab35008d0a7359410609f882b9f7.tar.xz
minor fixes: get rid of pointless inline attributes and some additional checks
fo ppm reading git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18176 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/gl_common.c16
-rw-r--r--libvo/gl_common.h4
2 files changed, 12 insertions, 8 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 0c0c369395..4a8cf55090 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -359,6 +359,8 @@ static void ppm_skip(FILE *f) {
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 @@ static void ppm_skip(FILE *f) {
*/
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 @@ void glSetupYUVConversion(GLenum target, int type,
* \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 @@ void inline glEnableYUVConversion(GLenum target, int type) {
* \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 --git a/libvo/gl_common.h b/libvo/gl_common.h
index 2c84190fb8..7f7c1c8db6 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -228,8 +228,8 @@ void glSetupYUVConversion(GLenum target, int type,
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
* \{ */