int url_open(URLContext **puc, const char *filename, int flags)

{

    URLProtocol *up;

    const char *p;

    char proto_str[128], *q;



    p = filename;

    q = proto_str;

    while (*p != '\0' && *p != ':') {

        /* protocols can only contain alphabetic chars */

        if (!isalpha(*p))

            goto file_proto;

        if ((q - proto_str) < sizeof(proto_str) - 1)

            *q++ = *p;

        p++;

    }

    /* if the protocol has length 1, we consider it is a dos drive */

    if (*p == '\0' || (q - proto_str) <= 1) {

    file_proto:

        strcpy(proto_str, "file");

    } else {

        *q = '\0';

    }



    up = first_protocol;

    while (up != NULL) {

        if (!strcmp(proto_str, up->name))

            return url_open_protocol (puc, up, filename, flags);

        up = up->next;

    }

    *puc = NULL;

    return AVERROR(ENOENT);

}

int url_open(URLContext **puc, const char *filename, int flags)

{

    URLProtocol *up;

    const char *p;

    char proto_str[128], *q;



    p = filename;

    q = proto_str;

    while (*p != '\0' && *p != ':') {

        

        if (!isalpha(*p))

            goto file_proto;

        if ((q - proto_str) < sizeof(proto_str) - 1)

            *q++ = *p;

        p++;

    }

    

    if (*p == '\0' || (q - proto_str) <= 1) {

    file_proto:

        strcpy(proto_str, "file");

    } else {

        *q = '\0';

    }



    up = first_protocol;

    while (up != NULL) {

        if (!strcmp(proto_str, up->name))

            return url_open_protocol (puc, up, filename, flags);

        up = up->next;

    }

    *puc = NULL;

    return AVERROR(ENOENT);

}

    if (*p == '\0' || (q - proto_str) <= 1) {
int FUNC_0(URLContext **VAR_0, const char *VAR_1, int VAR_2)

{

    URLProtocol *up;

    const char *VAR_3;

    char VAR_4[128], *VAR_5;



    VAR_3 = VAR_1;

    VAR_5 = VAR_4;

    while (*VAR_3 != '\0' && *VAR_3 != ':') {

        

        if (!isalpha(*VAR_3))

            goto file_proto;

        if ((VAR_5 - VAR_4) < sizeof(VAR_4) - 1)

            *VAR_5++ = *VAR_3;

        VAR_3++;

    }

    

    if (*VAR_3 == '\0' || (VAR_5 - VAR_4) <= 1) {

    file_proto:

        strcpy(VAR_4, "file");

    } else {

        *VAR_5 = '\0';

    }



    up = first_protocol;

    while (up != NULL) {

        if (!strcmp(VAR_4, up->name))

            return url_open_protocol (VAR_0, up, VAR_1, VAR_2);

        up = up->next;

    }

    *VAR_0 = NULL;

    return AVERROR(ENOENT);

}

int FUNC_0(URLContext **VAR_0, const char *VAR_1, int VAR_2)
{ URLProtocol *up; const char *VAR_3; char VAR_4[128], *VAR_5; VAR_3 = VAR_1; VAR_5 = VAR_4; while (*VAR_3 != '\0' && *VAR_3 != ':') { if (!isalpha(*VAR_3))
goto file_proto; if ((VAR_5 - VAR_4) < sizeof(VAR_4) - 1)
*VAR_5++ = *VAR_3; VAR_3++; } if (*VAR_3 == '\0' || (VAR_5 - VAR_4) <= 1) { file_proto:
strcpy(VAR_4, "file"); } else { *VAR_5 = '\0'; } up = first_protocol; while (up != NULL) { if (!strcmp(VAR_4, up->name))
return url_open_protocol (VAR_0, up, VAR_1, VAR_2); up = up->next; } *VAR_0 = NULL; return AVERROR(ENOENT); }