[FFmpeg-devel] [PATCH v7 1/1] avformat: Add IPFS protocol support.

Tomas Härdin tjoppen at acc.umu.se
Thu Feb 17 15:56:54 EET 2022


> +    IPFSGatewayContext *c = h->priv_data;
> +    char ipfs_full_data_folder[PATH_MAX];
> +    char ipfs_gateway_file[PATH_MAX];
> +    struct stat st;
> +    int stat_ret = 0;
> +    int ret = AVERROR(EINVAL);
> +    FILE *gateway_file = NULL;
> +
> +    // Set the first character of c->gateway_buffer to 0.
> +    c->gateway_buffer[0] = '\0';

unnecessary

> +
> +    // Test $IPFS_GATEWAY.
> +    if (getenv("IPFS_GATEWAY") != NULL) {
> +        if (snprintf(c->gateway_buffer, sizeof(c->gateway_buffer),
> "%s",
> +                     getenv("IPFS_GATEWAY")) >= sizeof(c-
> >gateway_buffer)) {
> +            av_log(h, AV_LOG_ERROR, "The IPFS_GATEWAY environment
> variable exceeds the maximum length. We allow a max of %li
> characters\n", sizeof(c->gateway_buffer));

nit: seems a bit weird to break the if but not the av_log()
Also this should be %zu not %li

/Tomas



More information about the ffmpeg-devel mailing list