forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cdogs-sdl-0.4-64bit.patch
48 lines (40 loc) · 1.02 KB
/
cdogs-sdl-0.4-64bit.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--- src/grafx.c
+++ src/grafx.c
@@ -216,12 +216,6 @@
SDL_VideoQuit();
}
-typedef struct _Pic {
- short int w;
- short int h;
- char *data;
-} Pic;
-
int ReadPics(const char *filename, void **pics, int maxPics,
color * palette)
{
@@ -241,12 +235,12 @@
fread(&size, sizeof(size), 1, f);
swap16(&size);
if (size) {
- Pic *p = sys_mem_alloc(size);
+ unsigned char *p = sys_mem_alloc(size);
- f_read16(f, &p->w, 2);
- f_read16(f, &p->h, 2);
+ f_read16(f, &p[0], 2); // w
+ f_read16(f, &p[2], 2); // h
- f_read(f, &p->data, size - 4);
+ f_read(f, &p[4], size - 4); // data
pics[i] = p;
@@ -278,11 +272,11 @@
fread(&size, sizeof(size), 1, f);
swap16(&size);
if (size) {
- Pic *p = sys_mem_alloc(size);
+ unsigned char *p = sys_mem_alloc(size);
- f_read16(f, &p->w, 2);
- f_read16(f, &p->h, 2);
- f_read(f, &p->data, size - 4);
+ f_read16(f, &p[0], 2); // w
+ f_read16(f, &p[2], 2); // h
+ f_read(f, &p[4], size - 4); // data
pics[i] = p;