static int cookie_string(AVDictionary *dict, char **cookies)

{

    AVDictionaryEntry *e = NULL;

    int len = 1;



    // determine how much memory is needed for the cookies string

    while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))

        len += strlen(e->key) + strlen(e->value) + 1;



    // reallocate the cookies

    e = NULL;

    if (*cookies) av_free(*cookies);

    *cookies = av_malloc(len);

    if (!cookies) return AVERROR(ENOMEM);

    *cookies[0] = '\0';



    // write out the cookies

    while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))

        av_strlcatf(*cookies, len, "%s%s\n", e->key, e->value);



    return 0;

}

static int cookie_string(AVDictionary *dict, char **cookies)

{

    AVDictionaryEntry *e = NULL;

    int len = 1;



    

    while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))

        len += strlen(e->key) + strlen(e->value) + 1;



    

    e = NULL;

    if (*cookies) av_free(*cookies);

    *cookies = av_malloc(len);

    if (!cookies) return AVERROR(ENOMEM);

    *cookies[0] = '\0';



    

    while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))

        av_strlcatf(*cookies, len, "%s%s\n", e->key, e->value);



    return 0;

}

static int FUNC_0(AVDictionary *VAR_0, char **VAR_1)

{

    AVDictionaryEntry *e = NULL;

    int VAR_2 = 1;



    

    while (e = av_dict_get(VAR_0, "", e, AV_DICT_IGNORE_SUFFIX))

        VAR_2 += strlen(e->key) + strlen(e->value) + 1;



    

    e = NULL;

    if (*VAR_1) av_free(*VAR_1);

    *VAR_1 = av_malloc(VAR_2);

    if (!VAR_1) return AVERROR(ENOMEM);

    *VAR_1[0] = '\0';



    

    while (e = av_dict_get(VAR_0, "", e, AV_DICT_IGNORE_SUFFIX))

        av_strlcatf(*VAR_1, VAR_2, "%s%s\n", e->key, e->value);



    return 0;

}

static int FUNC_0(AVDictionary *VAR_0, char **VAR_1)
{ AVDictionaryEntry *e = NULL; int VAR_2 = 1; while (e = av_dict_get(VAR_0, "", e, AV_DICT_IGNORE_SUFFIX))
VAR_2 += strlen(e->key) + strlen(e->value) + 1; e = NULL; if (*VAR_1) av_free(*VAR_1); *VAR_1 = av_malloc(VAR_2); if (!VAR_1) return AVERROR(ENOMEM); *VAR_1[0] = '\0'; while (e = av_dict_get(VAR_0, "", e, AV_DICT_IGNORE_SUFFIX))
av_strlcatf(*VAR_1, VAR_2, "%s%s\n", e->key, e->value); return 0; }