1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-18 05:37:04 +00:00

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
This commit is contained in:
reimar 2006-04-21 18:46:17 +00:00
parent d9d16656b2
commit 19935f69bd
2 changed files with 12 additions and 8 deletions

View File

@ -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:

View File

@ -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
* \{ */