MCPcopy Create free account
hub / github.com/BinomialLLC/basis_universal / error_vprintf

Function error_vprintf

encoder/basisu_enc.cpp:237–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235 }
236
237 void error_vprintf(const char* pFmt, va_list args)
238 {
239 const uint32_t BUF_SIZE = 256;
240 char buf[BUF_SIZE];
241
242 va_list args_copy;
243 va_copy(args_copy, args);
244 int total_chars = vsnprintf(buf, sizeof(buf), pFmt, args_copy);
245 va_end(args_copy);
246
247 if (total_chars < 0)
248 {
249 assert(0);
250 return;
251 }
252
253 fflush(stdout);
254
255 if (total_chars >= (int)BUF_SIZE)
256 {
257 basisu::vector<char> var_buf(total_chars + 1);
258
259 va_copy(args_copy, args);
260 int total_chars_retry = vsnprintf(var_buf.data(), var_buf.size(), pFmt, args_copy);
261 va_end(args_copy);
262
263 if (total_chars_retry < 0)
264 {
265 assert(0);
266 return;
267 }
268
269 fprintf(stderr, "ERROR: %s", var_buf.data());
270 }
271 else
272 {
273 fprintf(stderr, "ERROR: %s", buf);
274 }
275 }
276
277 void error_printf(const char *pFmt, ...)
278 {

Callers 2

error_printfFunction · 0.85
ocl_error_printfFunction · 0.85

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected