[FFmpeg-devel] [PATCH 2/2] avformat/fitsenc: fill header line with spaces
James Almer
jamrial at gmail.com
Wed Sep 13 03:55:19 EEST 2017
On 9/2/2017 4:07 PM, Paras Chadha wrote:
> Signed-off-by: Paras Chadha <paraschadha18 at gmail.com>
> ---
> This fixes the failed fate tests on msvc12:
> http://fate.ffmpeg.org/report.cgi?time=20170901190511&slot=x86_32-msvc12-windows-native
> http://fate.ffmpeg.org/report.cgi?time=20170901211336&slot=x86_64-msvc12-windows-native
>
> Tests failed because snprintf was filling the buffer with '\0' chars
> after printing.
>
> libavformat/fitsenc.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/fitsenc.c b/libavformat/fitsenc.c
> index 0dcdcdf..1a4b7c2 100644
> --- a/libavformat/fitsenc.c
> +++ b/libavformat/fitsenc.c
> @@ -47,7 +47,7 @@ static int fits_write_header(AVFormatContext *s)
> */
> static int write_keyword_value(AVFormatContext *s, const char *keyword, int value, int *lines_written)
> {
> - int len, ret;
> + int len, ret, i;
> uint8_t header[80];
>
> len = strlen(keyword);
> @@ -58,7 +58,9 @@ static int write_keyword_value(AVFormatContext *s, const char *keyword, int valu
> header[9] = ' ';
>
> ret = snprintf(header + 10, 70, "%d", value);
> - header[ret + 10] = ' ';
> + for (i = ret + 10; i < 80; i++) {
> + header[i] = ' ';
> + }
>
> avio_write(s->pb, header, sizeof(header));
> *lines_written += 1;
Simplified it a bit and pushed.
Thanks!
More information about the ffmpeg-devel
mailing list