Revision ab0287fc libavutil/parseutils.c

View differences:

libavutil/parseutils.c
608 608
    return 0;
609 609
}
610 610

  
611
int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
612
{
613
    const char *p;
614
    char tag[128], *q;
615

  
616
    p = info;
617
    if (*p == '?')
618
        p++;
619
    for(;;) {
620
        q = tag;
621
        while (*p != '\0' && *p != '=' && *p != '&') {
622
            if ((q - tag) < sizeof(tag) - 1)
623
                *q++ = *p;
624
            p++;
625
        }
626
        *q = '\0';
627
        q = arg;
628
        if (*p == '=') {
629
            p++;
630
            while (*p != '&' && *p != '\0') {
631
                if ((q - arg) < arg_size - 1) {
632
                    if (*p == '+')
633
                        *q++ = ' ';
634
                    else
635
                        *q++ = *p;
636
                }
637
                p++;
638
            }
639
        }
640
        *q = '\0';
641
        if (!strcmp(tag, tag1))
642
            return 1;
643
        if (*p != '&')
644
            break;
645
        p++;
646
    }
647
    return 0;
648
}
649

  
611 650
#ifdef TEST
612 651

  
613 652
#undef printf

Also available in: Unified diff