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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
Index: tuxpuck-0.8.2/utils/Makefile
===================================================================
--- tuxpuck-0.8.2.orig/utils/Makefile
+++ tuxpuck-0.8.2/utils/Makefile
@@ -1,18 +1,18 @@
# Makefile for TuxPuck Utils , Copyright Jacob Kroon 2001-2002
-CC = gcc
+CC_FOR_BUILD = gcc
CFLAGS += -g -Wall -Werror
#############################################################
all : ttf2font data2c anim
ttf2font : ttf2font.c
- $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) ttf2font.c `pkg-config --cflags --libs freetype2` -o ttf2font
+ $(CC_FOR_BUILD) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) ttf2font.c `pkg-config --cflags --libs freetype2` -o ttf2font
data2c : data2c.c
- $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) data2c.c `sdl-config --cflags --libs` -o data2c
+ $(CC_FOR_BUILD) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) data2c.c -o data2c
anim : anim.c
- $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) anim.c `sdl-config --cflags --libs` -o anim
+ $(CC_FOR_BUILD) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) anim.c -o anim
clean :
rm -f *~ data2c ttf2font anim
Index: tuxpuck-0.8.2/utils/anim.c
===================================================================
--- tuxpuck-0.8.2.orig/utils/anim.c
+++ tuxpuck-0.8.2/utils/anim.c
@@ -1,11 +1,10 @@
/* anim.c - Copyright (C) 2001-2002 Jacob Kroon, see COPYING for details */
+#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
-#include <SDL_endian.h>
-#include <SDL_types.h>
void errorc(char *msg)
{
@@ -23,15 +22,15 @@
{
FILE *in = NULL;
struct stat theStat;
- Uint8 *data;
- Uint32 size;
+ uint8_t *data;
+ uint32_t size;
if ((in = fopen(filename, "rb")) == NULL)
errorcc("Couldn't open file, ", filename);
stat(filename, &theStat);
- data = (Uint8 *) malloc(theStat.st_size);
+ data = (uint8_t *) malloc(theStat.st_size);
size = theStat.st_size;
- fwrite(&size, sizeof(Uint32), 1, out);
+ fwrite(&size, sizeof(uint32_t), 1, out);
if (fread(data, theStat.st_size, 1, in) != 1)
errorcc("Error reading from file, ", filename);
fwrite(data, theStat.st_size, 1, out);
@@ -45,8 +44,8 @@
char buffer1[100];
char buffer2[100];
char *ptr;
- Uint8 nbrOfFrames, nbrOfAnimations;
- Uint32 uint32;
+ uint8_t nbrOfFrames, nbrOfAnimations;
+ uint32_t uint32;
int j = 0, i = 0;
if (argc != 3)
@@ -57,7 +56,7 @@
errorcc("Couldn't open file for writing: ", argv[2]);
if (fscanf(in, "NbrOfFrames: %d\n", &uint32) != 1)
errorc("Wrong number of frames!");
- nbrOfFrames = (Uint8) uint32;
+ nbrOfFrames = (uint8_t) uint32;
fwrite(&nbrOfFrames, 1, 1, out);
ptr = strrchr(argv[1], '/');
if (ptr)
@@ -72,26 +71,26 @@
}
if (fscanf(in, "NbrOfAnimations: %d\n", &uint32) != 1)
errorc("Wrong number of animations!");
- nbrOfAnimations = (Uint8) uint32;
+ nbrOfAnimations = (uint8_t) uint32;
fwrite(&nbrOfAnimations, 1, 1, out);
for (i = 0; i < nbrOfAnimations; i++) {
- Uint32 n;
- Uint8 n2;
+ uint32_t n;
+ uint8_t n2;
if (fscanf(in, "%d\n", &n) != 1)
errorc("Couldnt read number of frames in animation!");
- n2 = (Uint8) n;
+ n2 = (uint8_t) n;
fwrite(&n2, 1, 1, out);
for (j = 0; j < n2; j++) {
- Uint32 frame;
- Uint32 time;
- Uint8 frame2;
- Uint16 time2;
+ uint32_t frame;
+ uint32_t time;
+ uint8_t frame2;
+ uint16_t time2;
if (fscanf(in, "%d %d\n", &frame, &time) != 2)
errorc("Error reading frames");
- frame2 = (Uint8) frame;
- time2 = (Uint16) time;
+ frame2 = (uint8_t) frame;
+ time2 = (uint16_t) time;
fwrite(&frame2, 1, 1, out);
fwrite(&time2, sizeof(time2), 1, out);
}
Index: tuxpuck-0.8.2/utils/data2c.c
===================================================================
--- tuxpuck-0.8.2.orig/utils/data2c.c
+++ tuxpuck-0.8.2/utils/data2c.c
@@ -1,10 +1,9 @@
/* data2c - Copyright (C) 2001-2002 Jacob Kroon, see COPYING for details */
+#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
-#include <SDL_types.h>
-#include <SDL_endian.h>
void errorc(char *msg)
{
@@ -24,7 +23,7 @@
char buffer[100];
unsigned char ch;
int i = 0;
- Uint32 size;
+ uint32_t size;
struct stat theStat;
if (argc != 3)
@@ -39,7 +38,7 @@
fprintf(out, "/* %s */\n", buffer);
fprintf(out, "unsigned char %s[] = {\n", argv[2]);
for (i = 0; i < 4; i++)
- fprintf(out, "%d,", ((Uint8 *) & size)[i]);
+ fprintf(out, "%d,", ((uint8_t *) & size)[i]);
while (fread(&ch, 1, 1, in) != 0)
fprintf(out, "%d,", ch);
fseek(out, -1, SEEK_CUR);
|