aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Comstedt2003-08-03 16:49:33 +0000
committerMarcus Comstedt2003-08-03 16:49:33 +0000
commit0ca4df05b82ff373cf4e8352ca61da8ab855ed6c (patch)
tree1624804efaea453c390f4fab8deb1088717a2265
parent3b5d44ff511f18b22314e980eaa26ea8391cc791 (diff)
downloadscummvm-rg350-0ca4df05b82ff373cf4e8352ca61da8ab855ed6c.tar.gz
scummvm-rg350-0ca4df05b82ff373cf4e8352ca61da8ab855ed6c.tar.bz2
scummvm-rg350-0ca4df05b82ff373cf4e8352ca61da8ab855ed6c.zip
More const.
svn-id: r9437
-rw-r--r--backends/dc/icon.cpp20
-rw-r--r--backends/dc/icon.h6
2 files changed, 13 insertions, 13 deletions
diff --git a/backends/dc/icon.cpp b/backends/dc/icon.cpp
index f1a33be31d..7b21b78c08 100644
--- a/backends/dc/icon.cpp
+++ b/backends/dc/icon.cpp
@@ -132,7 +132,7 @@ int Icon::find_unused_pixel()
return -1;
}
-bool Icon::load_image2(void *data, int len)
+bool Icon::load_image2(const void *data, int len)
{
struct {
int size, w, h;
@@ -156,16 +156,16 @@ bool Icon::load_image2(void *data, int len)
return false;
if(hdr.w != 32 || hdr.h != 32 || hdr.bitcnt != 4 || hdr.used > 16)
return false;
- memcpy(palette, ((char *)data)+hdr.size, hdr.used<<2);
- memcpy(bitmap, ((char *)data)+hdr.size+(hdr.used<<2), 32*32/2);
+ memcpy(palette, ((const char *)data)+hdr.size, hdr.used<<2);
+ memcpy(bitmap, ((const char *)data)+hdr.size+(hdr.used<<2), 32*32/2);
for(int i=0; i<16; i++)
palette[i] |= 0xff000000;
for(int i=hdr.used; i<16; i++)
palette[i] = 0;
int unused = find_unused_pixel();
if(unused >= 0) {
- unsigned char *mask =
- ((unsigned char *)data)+hdr.size+(hdr.used<<2)+32*32/2;
+ const unsigned char *mask =
+ ((const unsigned char *)data)+hdr.size+(hdr.used<<2)+32*32/2;
unsigned char *pix = bitmap;
for(int y=0; y<32; y++)
for(int x=0; x<32/8; x++) {
@@ -183,7 +183,7 @@ bool Icon::load_image2(void *data, int len)
return true;
}
-bool Icon::load_image1(void *data, int len, int offs)
+bool Icon::load_image1(const void *data, int len, int offs)
{
struct {
char w, h, colors, rsrv;
@@ -192,14 +192,14 @@ bool Icon::load_image1(void *data, int len, int offs)
} hdr;
if(len < offs+16)
return false;
- memcpy(&hdr, ((char *)data)+offs, 16);
+ memcpy(&hdr, ((const char *)data)+offs, 16);
if(hdr.bytes > 0 && hdr.offs >= 0 && hdr.offs+hdr.bytes <= len)
- return load_image2(((char *)data)+hdr.offs, hdr.bytes);
+ return load_image2(((const char *)data)+hdr.offs, hdr.bytes);
else
return false;
}
-bool Icon::load(void *data, int len, int offs)
+bool Icon::load(const void *data, int len, int offs)
{
struct { short rsrv, type, cnt; } hdr;
memset(bitmap, 0, sizeof(bitmap));
@@ -207,7 +207,7 @@ bool Icon::load(void *data, int len, int offs)
texture = NULL;
if(len < offs+6)
return false;
- memcpy(&hdr, ((char *)data)+offs, 6);
+ memcpy(&hdr, ((const char *)data)+offs, 6);
if(hdr.type != 1 || hdr.cnt < 1 || offs+6+(hdr.cnt<<4) > len)
return false;
for(int i=0; i<hdr.cnt; i++)
diff --git a/backends/dc/icon.h b/backends/dc/icon.h
index b9cf344bab..d1e9ae1a0c 100644
--- a/backends/dc/icon.h
+++ b/backends/dc/icon.h
@@ -7,11 +7,11 @@ class Icon
void *texture;
int find_unused_pixel();
- bool load_image1(void *data, int len, int offs);
- bool load_image2(void *data, int len);
+ bool load_image1(const void *data, int len, int offs);
+ bool load_image2(const void *data, int len);
public:
- bool load(void *data, int len, int offs = 0);
+ bool load(const void *data, int len, int offs = 0);
bool load(const char *filename);
void create_texture();
void set_palette(int pal);