From 2b6adaa2d484e5defe802a608180e917c1d3c429 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 1 Feb 2012 17:44:55 +0900 Subject: [PATCH] Do some more const correctness. --- include/QF/GL/qf_textures.h | 6 +++--- include/QF/crc.h | 4 ++-- libs/util/crc.c | 4 ++-- libs/video/renderer/gl/gl_textures.c | 13 +++++++------ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/QF/GL/qf_textures.h b/include/QF/GL/qf_textures.h index b798e0a27..44cb3a158 100644 --- a/include/QF/GL/qf_textures.h +++ b/include/QF/GL/qf_textures.h @@ -47,9 +47,9 @@ extern int part_tex_smoke; extern int part_tex_spark; */ -void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha); -void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha); -int GL_LoadTexture (const char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel); +void GL_Upload8 (const byte *data, int width, int height, qboolean mipmap, qboolean alpha); +void GL_Upload8_EXT (const byte *data, int width, int height, qboolean mipmap, qboolean alpha); +int GL_LoadTexture (const char *identifier, int width, int height, const byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel); int GL_FindTexture (const char *identifier); void GL_TextureMode_f (void); diff --git a/include/QF/crc.h b/include/QF/crc.h index 30c97e7d9..e5988e7a8 100644 --- a/include/QF/crc.h +++ b/include/QF/crc.h @@ -38,9 +38,9 @@ void CRC_Init(unsigned short *crcvalue); void CRC_ProcessByte(unsigned short *crcvalue, byte data); -void CRC_ProcessBlock (byte *start, unsigned short *crcvalue, int count); +void CRC_ProcessBlock (const byte *start, unsigned short *crcvalue, int count); unsigned short CRC_Value(unsigned short crcvalue); -unsigned short CRC_Block (byte *start, int count); +unsigned short CRC_Block (const byte *start, int count); //@} diff --git a/libs/util/crc.c b/libs/util/crc.c index 97f10867b..add0c95e9 100644 --- a/libs/util/crc.c +++ b/libs/util/crc.c @@ -89,7 +89,7 @@ CRC_ProcessByte (unsigned short *crcvalue, byte data) } VISIBLE void -CRC_ProcessBlock (byte *start, unsigned short *crcvalue, int count) +CRC_ProcessBlock (const byte *start, unsigned short *crcvalue, int count) { unsigned short crc = *crcvalue; while (count--) @@ -104,7 +104,7 @@ CRC_Value (unsigned short crcvalue) } VISIBLE unsigned short -CRC_Block (byte *start, int count) +CRC_Block (const byte *start, int count) { unsigned short crc; diff --git a/libs/video/renderer/gl/gl_textures.c b/libs/video/renderer/gl/gl_textures.c index ba69b2f59..8d15ed347 100644 --- a/libs/video/renderer/gl/gl_textures.c +++ b/libs/video/renderer/gl/gl_textures.c @@ -284,11 +284,11 @@ GL_ResampleTexture (unsigned int *in, int inwidth, int inheight, } static void -GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight, +GL_Resample8BitTexture (const unsigned char *in, int inwidth, int inheight, unsigned char *out, int outwidth, int outheight) { // Improvements here should be mirrored in build_skin_8 in gl_skin.c - unsigned char *inrow; + const unsigned char *inrow; int i, j; unsigned int frac, fracstep; @@ -445,7 +445,7 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap, If we don't, this function does nothing. */ void -GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, +GL_Upload8_EXT (const byte *data, int width, int height, qboolean mipmap, qboolean alpha) { byte *scaled; @@ -516,7 +516,8 @@ GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, } void -GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha) +GL_Upload8 (const byte *data, int width, int height, qboolean mipmap, + qboolean alpha) { int i, s, p; unsigned int *trans; @@ -537,7 +538,7 @@ GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha) } } else { unsigned int *out = trans; - byte *in = data; + const byte *in = data; for (i = 0; i < s; i++) { *out++ = d_8to24table[*in++]; } @@ -553,7 +554,7 @@ GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha) } VISIBLE int -GL_LoadTexture (const char *identifier, int width, int height, byte *data, +GL_LoadTexture (const char *identifier, int width, int height, const byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel) { int crc, i;