static int add_string_metadata(int count, const char *name,

                               TiffContext *s)

{

    char *value;



    if (bytestream2_get_bytes_left(&s->gb) < count)

        return AVERROR_INVALIDDATA;



    value = av_malloc(count + 1);

    if (!value)

        return AVERROR(ENOMEM);



    bytestream2_get_bufferu(&s->gb, value, count);

    value[count] = 0;



    av_dict_set(&s->picture.metadata, name, value, AV_DICT_DONT_STRDUP_VAL);

    return 0;

}

static int add_string_metadata(int count, const char *name,

                               TiffContext *s)

{

    char *value;



    if (bytestream2_get_bytes_left(&s->gb) < count)

        return AVERROR_INVALIDDATA;



    value = av_malloc(count + 1);

    if (!value)

        return AVERROR(ENOMEM);



    bytestream2_get_bufferu(&s->gb, value, count);

    value[count] = 0;



    av_dict_set(&s->picture.metadata, name, value, AV_DICT_DONT_STRDUP_VAL);

    return 0;

}

static int FUNC_0(int VAR_0, const char *VAR_1,

                               TiffContext *VAR_2)

{

    char *VAR_3;



    if (bytestream2_get_bytes_left(&VAR_2->gb) < VAR_0)

        return AVERROR_INVALIDDATA;



    VAR_3 = av_malloc(VAR_0 + 1);

    if (!VAR_3)

        return AVERROR(ENOMEM);



    bytestream2_get_bufferu(&VAR_2->gb, VAR_3, VAR_0);

    VAR_3[VAR_0] = 0;



    av_dict_set(&VAR_2->picture.metadata, VAR_1, VAR_3, AV_DICT_DONT_STRDUP_VAL);

    return 0;

}

static int FUNC_0(int VAR_0, const char *VAR_1,
TiffContext *VAR_2)
{ char *VAR_3; if (bytestream2_get_bytes_left(&VAR_2->gb) < VAR_0)
return AVERROR_INVALIDDATA; VAR_3 = av_malloc(VAR_0 + 1); if (!VAR_3)
return AVERROR(ENOMEM); bytestream2_get_bufferu(&VAR_2->gb, VAR_3, VAR_0); VAR_3[VAR_0] = 0; av_dict_set(&VAR_2->picture.metadata, VAR_1, VAR_3, AV_DICT_DONT_STRDUP_VAL); return 0; }