comparison tiffenc.c @ 4786:95f58f0b70fc libavcodec

remove compound literals gcc 2.95 doesnt support taking an address of a compound literal and the current code was my fault as i suggested the student to use compound literals beliving gcc 2.95 supports them completely ...
author michael
date Thu, 05 Apr 2007 00:09:48 +0000
parents bca8924ed36c
children caafad01dec0
comparison
equal deleted inserted replaced
4785:4ae9ab738aec 4786:95f58f0b70fc
125 } 125 }
126 126
127 s->num_entries++; 127 s->num_entries++;
128 } 128 }
129 129
130 static void add_entry1(TiffEncoderContext * s,
131 enum TiffTags tag, enum TiffTypes type, int val){
132 uint16_t w = val;
133 uint32_t dw= val;
134 add_entry(s, tag, type, 1, type == TIFF_SHORT ? &w : &dw);
135 }
136
130 /** 137 /**
131 * Encode one strip in tiff file 138 * Encode one strip in tiff file
132 * 139 *
133 * @param s Tiff context 140 * @param s Tiff context
134 * @param src Input buffer 141 * @param src Input buffer
295 } 302 }
296 } 303 }
297 304
298 s->num_entries = 0; 305 s->num_entries = 0;
299 306
300 add_entry(s, TIFF_SUBFILE, TIFF_LONG, 1, (uint32_t[]) {0}); 307 add_entry1(s,TIFF_SUBFILE, TIFF_LONG, 0);
301 add_entry(s, TIFF_WIDTH, TIFF_LONG, 1, (uint32_t[]) {s->width}); 308 add_entry1(s,TIFF_WIDTH, TIFF_LONG, s->width);
302 add_entry(s, TIFF_HEIGHT, TIFF_LONG, 1, (uint32_t[]) {s->height}); 309 add_entry1(s,TIFF_HEIGHT, TIFF_LONG, s->height);
303 310
304 if (s->bpp_tab_size) 311 if (s->bpp_tab_size)
305 add_entry(s, TIFF_BPP, TIFF_SHORT, s->bpp_tab_size, bpp_tab); 312 add_entry(s, TIFF_BPP, TIFF_SHORT, s->bpp_tab_size, bpp_tab);
306 313
307 add_entry(s, TIFF_COMPR, TIFF_SHORT, 1, (uint16_t[]) {s->compr}); 314 add_entry1(s,TIFF_COMPR, TIFF_SHORT, s->compr);
308 add_entry(s, TIFF_INVERT, TIFF_SHORT, 1, (uint16_t[]) {s->invert}); 315 add_entry1(s,TIFF_INVERT, TIFF_SHORT, s->invert);
309 add_entry(s, TIFF_STRIP_OFFS, TIFF_LONG, strips, strip_offsets); 316 add_entry(s, TIFF_STRIP_OFFS, TIFF_LONG, strips, strip_offsets);
310 317
311 if (s->bpp_tab_size) 318 if (s->bpp_tab_size)
312 add_entry(s, TIFF_SAMPLES_PER_PIXEL, TIFF_SHORT, 1, (uint16_t[]) {s->bpp_tab_size}); 319 add_entry1(s,TIFF_SAMPLES_PER_PIXEL, TIFF_SHORT, s->bpp_tab_size);
313 320
314 add_entry(s, TIFF_ROWSPERSTRIP, TIFF_LONG, 1, (uint32_t[]) {s->rps}); 321 add_entry1(s,TIFF_ROWSPERSTRIP, TIFF_LONG, s->rps);
315 add_entry(s, TIFF_STRIP_SIZE, TIFF_LONG, strips, strip_sizes); 322 add_entry(s, TIFF_STRIP_SIZE, TIFF_LONG, strips, strip_sizes);
316 add_entry(s, TIFF_XRES, TIFF_RATIONAL, 1, res); 323 add_entry(s, TIFF_XRES, TIFF_RATIONAL, 1, res);
317 add_entry(s, TIFF_YRES, TIFF_RATIONAL, 1, res); 324 add_entry(s, TIFF_YRES, TIFF_RATIONAL, 1, res);
318 add_entry(s, TIFF_RES_UNIT, TIFF_SHORT, 1, (uint16_t[]) {2}); 325 add_entry1(s,TIFF_RES_UNIT, TIFF_SHORT, 2);
319 add_entry(s, TIFF_SOFTWARE_NAME, TIFF_STRING, 326 add_entry(s, TIFF_SOFTWARE_NAME, TIFF_STRING,
320 strlen(LIBAVCODEC_IDENT) + 1, LIBAVCODEC_IDENT); 327 strlen(LIBAVCODEC_IDENT) + 1, LIBAVCODEC_IDENT);
321 328
322 if (avctx->pix_fmt == PIX_FMT_PAL8) { 329 if (avctx->pix_fmt == PIX_FMT_PAL8) {
323 uint16_t pal[256 * 3]; 330 uint16_t pal[256 * 3];