[FFmpeg-cvslog] r9808 - trunk/libavformat/utils.c
Alex Beregszaszi
alex
Fri Jul 27 13:54:55 CEST 2007
Hi,
> enum CodecID codec_get_id(const AVCodecTag *tags, unsigned int tag)
> {
> - while (tags->id != CODEC_ID_NONE) {
> - if( toupper((tag >> 0)&0xFF) == toupper((tags->tag >> 0)&0xFF)
> - && toupper((tag >> 8)&0xFF) == toupper((tags->tag >> 8)&0xFF)
> - && toupper((tag >>16)&0xFF) == toupper((tags->tag >>16)&0xFF)
> - && toupper((tag >>24)&0xFF) == toupper((tags->tag >>24)&0xFF))
> - return tags->id;
> - tags++;
> + int i;
> + for(i=0; tags[i].id != CODEC_ID_NONE;i++) {
> + if(tag == tags[i].tag)
> + return tags[i].id;
> + }
> + for(i=0; tags[i].id != CODEC_ID_NONE; i++) {
> + if( toupper((tag >> 0)&0xFF) == toupper((tags[i].tag >> 0)&0xFF)
> + && toupper((tag >> 8)&0xFF) == toupper((tags[i].tag >> 8)&0xFF)
> + && toupper((tag >>16)&0xFF) == toupper((tags[i].tag >>16)&0xFF)
> + && toupper((tag >>24)&0xFF) == toupper((tags[i].tag >>24)&0xFF))
> + return tags[i].id;
Why did you cosmetic while -> for change? You go from i=0 thus the while
and for cycles are the same.
--
Alex
More information about the ffmpeg-cvslog
mailing list