comparison src/glyphs-shared.c @ 647:b39c14581166

[xemacs-hg @ 2001-08-13 04:45:47 by ben] removal of unsigned, size_t, etc.
author ben
date Mon, 13 Aug 2001 04:46:48 +0000
parents 38db05db9cb5
children 943eaba38521
comparison
equal deleted inserted replaced
646:00c54252fe4f 647:b39c14581166
186 * first and left-most bit first. If it doesn't return BitmapSuccess then 186 * first and left-most bit first. If it doesn't return BitmapSuccess then
187 * its arguments won't have been touched. This routine should look as much 187 * its arguments won't have been touched. This routine should look as much
188 * like the Xlib routine XReadBitmapfile as possible. 188 * like the Xlib routine XReadBitmapfile as possible.
189 */ 189 */
190 static int 190 static int
191 read_bitmap_data (FILE *fstream, unsigned int *width, 191 read_bitmap_data (FILE *fstream, int *width, int *height, UChar_Binary **datap,
192 unsigned int *height, UChar_Binary **datap,
193 int *x_hot, int *y_hot) 192 int *x_hot, int *y_hot)
194 { 193 {
195 UChar_Binary *data = NULL; /* working variable */ 194 UChar_Binary *data = NULL; /* working variable */
196 char line[MAX_SIZE]; /* input line from file */ 195 Char_ASCII line[MAX_SIZE]; /* input line from file */
197 int size; /* number of bytes of data */ 196 int size; /* number of bytes of data */
198 char name_and_type[MAX_SIZE]; /* an input line */ 197 Char_ASCII name_and_type[MAX_SIZE]; /* an input line */
199 char *type; /* for parsing */ 198 Char_ASCII *type; /* for parsing */
200 int value; /* from an input line */ 199 int value; /* from an input line */
201 int version10p; /* boolean, old format */ 200 int version10p; /* boolean, old format */
202 int padding; /* to handle alignment */ 201 int padding; /* to handle alignment */
203 int bytes_per_line; /* per scanline of data */ 202 int bytes_per_line; /* per scanline of data */
204 unsigned int ww = 0; /* width */ 203 int ww = 0; /* width */
205 unsigned int hh = 0; /* height */ 204 int hh = 0; /* height */
206 int hx = -1; /* x hotspot */ 205 int hx = -1; /* x hotspot */
207 int hy = -1; /* y hotspot */ 206 int hy = -1; /* y hotspot */
208 207
209 #ifndef Xmalloc 208 #ifndef Xmalloc
210 #define Xmalloc(size) malloc(size) 209 #define Xmalloc(size) malloc(size)
225 type = name_and_type; 224 type = name_and_type;
226 else 225 else
227 type++; 226 type++;
228 227
229 if (!strcmp("width", type)) 228 if (!strcmp("width", type))
230 ww = (unsigned int) value; 229 ww = value;
231 if (!strcmp("height", type)) 230 if (!strcmp("height", type))
232 hh = (unsigned int) value; 231 hh = value;
233 if (!strcmp("hot", type)) { 232 if (!strcmp("hot", type)) {
234 if (type-- == name_and_type || type-- == name_and_type) 233 if (type-- == name_and_type || type-- == name_and_type)
235 continue; 234 continue;
236 if (!strcmp("x_hot", type)) 235 if (!strcmp("x_hot", type))
237 hx = value; 236 hx = value;
313 312
314 313
315 int 314 int
316 read_bitmap_data_from_file (const char *filename, 315 read_bitmap_data_from_file (const char *filename,
317 /* Remaining args are RETURNED */ 316 /* Remaining args are RETURNED */
318 unsigned int *width, 317 int *width,
319 unsigned int *height, 318 int *height,
320 UChar_Binary **datap, 319 UChar_Binary **datap,
321 int *x_hot, int *y_hot) 320 int *x_hot, int *y_hot)
322 { 321 {
323 FILE *fstream; 322 FILE *fstream;
324 int status; 323 int status;
325 324
326 if ((fstream = fopen (filename, "r")) == NULL) { 325 if ((fstream = fopen (filename, "r")) == NULL)
327 return BitmapOpenFailed; 326 return BitmapOpenFailed;
328 }
329 status = read_bitmap_data (fstream, width, height, datap, x_hot, y_hot); 327 status = read_bitmap_data (fstream, width, height, datap, x_hot, y_hot);
330 fclose (fstream); 328 fclose (fstream);
331 return status; 329 return status;
332 } 330 }
333 331