Coverage Report

Created: 2023-03-26 07:33

/src/giflib-code/qprintf.c
Line
Count
Source (jump to first uncovered line)
1
/*****************************************************************************
2
3
 qprintf.c - module to emulate a printf with a possible quiet (disable mode.)
4
5
 A global variable GifNoisyPrint controls the printing of this routine
6
 
7
SPDX-License-Identifier: MIT
8
9
*****************************************************************************/
10
11
12
#include <stdio.h>
13
#include <stdbool.h>
14
#include <stdarg.h>
15
16
#include "gif_lib.h"
17
18
bool GifNoisyPrint = false;
19
20
/*****************************************************************************
21
 Same as fprintf to stderr but with optional print.
22
******************************************************************************/
23
void
24
0
GifQprintf(char *Format, ...) {
25
0
    va_list ArgPtr;
26
27
0
    va_start(ArgPtr, Format);
28
29
0
    if (GifNoisyPrint) {
30
0
  char Line[128];
31
0
  (void)vsnprintf(Line, sizeof(Line), Format, ArgPtr);
32
0
  (void)fputs(Line, stderr);
33
0
    }
34
35
0
    va_end(ArgPtr);
36
0
}
37
38
void
39
0
PrintGifError(int ErrorCode) {
40
0
    const char *Err = GifErrorString(ErrorCode);
41
42
0
    if (Err != NULL)
43
0
        fprintf(stderr, "GIF-LIB error: %s.\n", Err);
44
0
    else
45
0
        fprintf(stderr, "GIF-LIB undefined error %d.\n", ErrorCode);
46
0
}
47
48
/* end */