MCPcopy Create free account
hub / github.com/OpenPrinting/cups / _cupsRasterAddError

Function _cupsRasterAddError

cups/raster-error.c:21–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 */
20
21void
22_cupsRasterAddError(const char *f, /* I - Printf-style error message */
23 ...) /* I - Additional arguments as needed */
24{
25 _cups_globals_t *cg = _cupsGlobals();
26 /* Thread globals */
27 _cups_raster_error_t *buf = &cg->raster_error;
28 /* Error buffer */
29 va_list ap; /* Pointer to additional arguments */
30 char s[2048]; /* Message string */
31 ssize_t bytes; /* Bytes in message string */
32
33
34 DEBUG_printf(("_cupsRasterAddError(f=\"%s\", ...)", f));
35
36 va_start(ap, f);
37 bytes = vsnprintf(s, sizeof(s), f, ap);
38 va_end(ap);
39
40 if (bytes <= 0)
41 return;
42
43 DEBUG_printf(("1_cupsRasterAddError: %s", s));
44
45 bytes ++;
46
47 if ((size_t)bytes >= sizeof(s))
48 return;
49
50 if (bytes > (ssize_t)(buf->end - buf->current))
51 {
52 /*
53 * Allocate more memory...
54 */
55
56 char *temp; /* New buffer */
57 size_t size; /* Size of buffer */
58
59 size = (size_t)(buf->end - buf->start + 2 * bytes + 1024);
60
61 if (buf->start)
62 temp = realloc(buf->start, size);
63 else
64 temp = malloc(size);
65
66 if (!temp)
67 return;
68
69 /*
70 * Update pointers...
71 */
72
73 buf->end = temp + size;
74 buf->current = temp + (buf->current - buf->start);
75 buf->start = temp;
76 }
77
78 /*

Callers 7

_cupsRasterInitPWGHeaderFunction · 0.85
_cupsRasterNewFunction · 0.85
cups_raster_updateFunction · 0.85
_cupsRasterInterpretPPDFunction · 0.85
_cupsRasterExecPSFunction · 0.85
error_objectFunction · 0.85
error_stackFunction · 0.85

Calls 1

_cupsGlobalsFunction · 0.85

Tested by

no test coverage detected