File: HBF.PATCH

package info (click to toggle)
xmbdfed 4.7patch1-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,728 kB
  • ctags: 2,508
  • sloc: ansic: 37,440; makefile: 105
file content (216 lines) | stat: -rw-r--r-- 4,837 bytes parent folder | download | duplicates (4)
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
*** hbf.h.orig	Tue Dec 30 10:26:18 1997
--- hbf.h	Sun Jan 19 18:27:27 1997
***************
*** 6,11 ****
--- 6,19 ----
  #ifndef _HBF_
  #define _HBF_
  
+ /*
+  * $Id: HBF.PATCH,v 1.1 1998/07/24 16:12:11 mleisher Exp $
+  */
+ 
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
  #ifndef __STDC__
  #	ifndef const
  #		define const
***************
*** 60,66 ****
  extern	void	hbfForEach(
  #ifdef __STDC__
  			HBF	*hbf,
! 			void	(*func)(HBF *sameHbf, HBF_CHAR code)
  #endif
  		);
  
--- 68,76 ----
  extern	void	hbfForEach(
  #ifdef __STDC__
  			HBF	*hbf,
! 			void	(*func)(HBF *sameHbf, HBF_CHAR code,
! 					void *callback_data),
! 			void	*callback_data
  #endif
  		);
  
***************
*** 161,165 ****
--- 171,179 ----
  		HBF_BytePtr ptrBitmapBuffer
  #endif
  );
+ 
+ #ifdef __cplusplus
+ }
+ #endif
  
  #endif /* ! _HBF_ */
*** hbf.c.orig	Tue Dec 30 10:26:21 1997
--- hbf.c	Wed Nov  5 00:36:18 1997
***************
*** 1,3 ****
--- 1,10 ----
+ #ifndef lint
+ #ifdef __GNUC__
+ static char rcsid[] __attribute__ ((unused)) = "$Id: HBF.PATCH,v 1.1 1998/07/24 16:12:11 mleisher Exp $";
+ #else
+ static char rcsid[] = "$Id: HBF.PATCH,v 1.1 1998/07/24 16:12:11 mleisher Exp $";
+ #endif
+ #endif
  /*
   * Copyright 1993,1994,1995 by Ross Paterson
   *
***************
*** 591,605 ****
  	BM_FILE	**fp;
  reg	BM_FILE	*file;
  	FILE	*f;
  #ifdef IN_MEMORY
  #ifdef unix
  	bool	from_pipe;
  #endif
  #endif
  
! 	for (fp = &(hbf->bm_file); *fp != NULL; fp = &((*fp)->bmf_next))
! 		if (strcmp((*fp)->bmf_name, filename) == 0)
! 			return *fp;
  
  	file = NEW(BM_FILE);
  	if (file == NULL) {
--- 598,616 ----
  	BM_FILE	**fp;
  reg	BM_FILE	*file;
  	FILE	*f;
+ 	char *bmfname;
  #ifdef IN_MEMORY
  #ifdef unix
  	bool	from_pipe;
  #endif
  #endif
  
! 	for (fp = &(hbf->bm_file); *fp != NULL; fp = &((*fp)->bmf_next)) {
!             bmfname = strrchr((*fp)->bmf_name, '/');
!             bmfname = (bmfname) ? bmfname + 1 : (*fp)->bmf_name;
!             if (strcmp(bmfname, filename) == 0)
!               return *fp;
!         }
  
  	file = NEW(BM_FILE);
  	if (file == NULL) {
***************
*** 615,631 ****
  #ifdef IN_MEMORY
  #ifdef unix
  	from_pipe = FALSE;
  	if (f == NULL) {
  		char	tmp[400];
  
  		sprintf(tmp, "%s.gz", file->bmf_name);
  		if ((f = fopen(tmp, "r")) != NULL) {
  			fclose(f);
! 			sprintf(tmp, "gzcat %s.gz", file->bmf_name);
  			if ((f = popen(tmp, "r")) != NULL)
  				from_pipe = TRUE;
  		}
  	}
  #endif /* unix */
  #endif /* IN_MEMORY */
  	if (f == NULL) {
--- 626,644 ----
  #ifdef IN_MEMORY
  #ifdef unix
  	from_pipe = FALSE;
+ #ifdef GUNZIP_CMD
  	if (f == NULL) {
  		char	tmp[400];
  
  		sprintf(tmp, "%s.gz", file->bmf_name);
  		if ((f = fopen(tmp, "r")) != NULL) {
  			fclose(f);
! 			sprintf(tmp, "%s %s.gz", GUNZIP_CMD, file->bmf_name);
  			if ((f = popen(tmp, "r")) != NULL)
  				from_pipe = TRUE;
  		}
  	}
+ #endif /* GUNZIP_CMD */
  #endif /* unix */
  #endif /* IN_MEMORY */
  	if (f == NULL) {
***************
*** 674,680 ****
  	cp = contents = (byte *)malloc((unsigned)GRAIN_SIZE);
  	if (contents == NULL) {
  		eprintf("not enough space for bitmap file");
! 		return NULL;
  	}
  	while ((c = getc(f)) != EOF) {
  		if (size%GRAIN_SIZE == 0) {
--- 687,693 ----
  	cp = contents = (byte *)malloc((unsigned)GRAIN_SIZE);
  	if (contents == NULL) {
  		eprintf("not enough space for bitmap file");
! 		return FALSE;
  	}
  	while ((c = getc(f)) != EOF) {
  		if (size%GRAIN_SIZE == 0) {
***************
*** 682,688 ****
  					(unsigned)(size + GRAIN_SIZE));
  			if (contents == NULL) {
  				eprintf("not enough space for bitmap file");
! 				return NULL;
  			}
  			cp = contents + size;
  		}
--- 695,701 ----
  					(unsigned)(size + GRAIN_SIZE));
  			if (contents == NULL) {
  				eprintf("not enough space for bitmap file");
! 				return FALSE;
  			}
  			cp = contents + size;
  		}
***************
*** 1397,1405 ****
   * Call function on each valid code in ascending order.
   */
  void
! hbfForEach(hbfFile, func)
  reg	HBF	*hbfFile;
! reg	void	(*func)_((HBF *sameHbfFile, HBF_CHAR code));
  {
  	HBF_STRUCT	*hbf;
  	CODE_RANGE	*cp;
--- 1410,1420 ----
   * Call function on each valid code in ascending order.
   */
  void
! hbfForEach(hbfFile, func, callback_data)
  reg	HBF	*hbfFile;
! reg	void	(*func)_((HBF *sameHbfFile, HBF_CHAR code,
! 			  void *callback_data));
! 	void	*callback_data;
  {
  	HBF_STRUCT	*hbf;
  	CODE_RANGE	*cp;
***************
*** 1423,1429 ****
  					finish = SecondByte(cp->code_finish);
  				while (byte2 <= finish) {
  					(*func)(hbfFile,
! 						MakeCode(byte1, byte2));
  					byte2++;
  				}
  			}
--- 1438,1445 ----
  					finish = SecondByte(cp->code_finish);
  				while (byte2 <= finish) {
  					(*func)(hbfFile,
! 						MakeCode(byte1, byte2),
! 						callback_data);
  					byte2++;
  				}
  			}