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
|
diff -aur ./bitmap.c ../garglevel9/bitmap.c
--- ./bitmap.c 2011-05-29 09:35:49.000000000 +0200
+++ ../garglevel9/bitmap.c 2011-10-06 10:11:15.000000000 +0200
@@ -761,7 +761,7 @@
L9BYTE data[6];
int x, y;
- fread(data,1,sizeof data,f);
+ if(fread(data,1,sizeof data,f) != sizeof data && !feof(f)) return NO_BITMAPS;
fclose(f);
x = data[2]+data[3]*256;
@@ -911,7 +911,7 @@
L9BYTE data[72];
int x, y;
- fread(data,1,sizeof data,f);
+ if(fread(data,1,sizeof data,f) != sizeof data && !feof(f)) return NO_BITMAPS;
fclose(f);
x = data[67]+data[66]*256;
@@ -1436,7 +1436,7 @@
/* Seek to the offset of the pixPat data and read in the data */
fseek(f,filelength(f)-32,SEEK_SET);
- fread(patRowData,sizeof (L9BYTE),32,f);
+ if(fread(patRowData,sizeof (L9BYTE),32,f) != 32 && !feof(f)) return FALSE;
fclose(f);
/* Extract the patterns */
diff -aur ./generic.c ../garglevel9/generic.c
--- ./generic.c 2011-05-29 09:36:11.000000000 +0200
+++ ../garglevel9/generic.c 2011-10-06 10:11:15.000000000 +0200
@@ -18,7 +18,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
\***********************************************************************/
diff -aur ./level9.c ../garglevel9/level9.c
--- ./level9.c 2011-05-29 09:35:49.000000000 +0200
+++ ../garglevel9/level9.c 2011-10-06 10:11:15.000000000 +0200
@@ -18,7 +18,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The input routine will repond to the following 'hash' commands
* #save saves position file directly (bypasses any
diff -aur ./level9.h ../garglevel9/level9.h
--- ./level9.h 2011-05-29 09:35:49.000000000 +0200
+++ ../garglevel9/level9.h 2012-10-11 23:59:07.066326054 +0200
@@ -18,13 +18,34 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
\***********************************************************************/
-typedef unsigned char L9BYTE;
-typedef unsigned short L9UINT16;
-typedef unsigned long L9UINT32;
+#include <limits.h>
+
+#if UCHAR_MAX==0xff
+typedef unsigned char L9BYTE;
+#else
+#error "Can't find an 8-bit integer type"
+#endif
+
+#if SHRT_MAX==0x7fff
+typedef unsigned short L9UINT16;
+#elif INT_MAX==0x7fff
+typedef unsigned int L9UINT16;
+#else
+#error "Can't find a 16-bit integer type"
+#endif
+
+#if INT_MAX==0x7fffffff
+typedef unsigned int L9UINT32;
+#elif LONG_MAX==0x7fffffff
+typedef unsigned long L9UINT32;
+#else
+#error "Can't find a 32-bit integer type"
+#endif
+
typedef int L9BOOL;
#ifndef FALSE
|