comparison png.c @ 2347:c6280d48be02 libavcodec

When bswap_32 is a macro, png images fail to decode properly, patch by (Milan Cutka <cutka>at<szm>dot<sk>)
author michael
date Fri, 12 Nov 2004 09:48:06 +0000
parents 8b6668325ff8
children 18b8b2dcc037
comparison
equal deleted inserted replaced
2346:424e6b29de74 2347:c6280d48be02
499 s->zstream.opaque = NULL; 499 s->zstream.opaque = NULL;
500 ret = inflateInit(&s->zstream); 500 ret = inflateInit(&s->zstream);
501 if (ret != Z_OK) 501 if (ret != Z_OK)
502 return -1; 502 return -1;
503 for(;;) { 503 for(;;) {
504 int tag32;
504 if (s->bytestream >= s->bytestream_end) 505 if (s->bytestream >= s->bytestream_end)
505 goto fail; 506 goto fail;
506 length = get32(&s->bytestream); 507 length = get32(&s->bytestream);
507 if (length > 0x7fffffff) 508 if (length > 0x7fffffff)
508 goto fail; 509 goto fail;
509 tag = bswap_32(get32(&s->bytestream)); 510 tag32 = get32(&s->bytestream);
511 tag = bswap_32(tag32);
510 #ifdef DEBUG 512 #ifdef DEBUG
511 printf("png: tag=%c%c%c%c length=%u\n", 513 printf("png: tag=%c%c%c%c length=%u\n",
512 (tag & 0xff), 514 (tag & 0xff),
513 ((tag >> 8) & 0xff), 515 ((tag >> 8) & 0xff),
514 ((tag >> 16) & 0xff), 516 ((tag >> 16) & 0xff),