MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / snprintf

Function snprintf

src/common/utils.cpp:348–366  ·  view source on GitHub ↗

s n p r i n t f Provide a single place to deal with vsnprintf and error detection.

Source from the content-addressed store, hash-verified

346// ***************
347// Provide a single place to deal with vsnprintf and error detection.
348int snprintf(char* buffer, size_t count, const char* format...)
349{
350 va_list args;
351 va_start(args, format);
352 const int rc = VSNPRINTF(buffer, count, format, args);
353 buffer[count - 1] = 0;
354 va_end(args);
355#if defined(DEV_BUILD) && !defined(HAVE_VSNPRINTF)
356 // We don't have the safe functions, then check if we overflowed the buffer.
357 // I would prefer to make this functionality available in prod build, too.
358 // If the docs are right, the null terminator is not counted => rc < count.
359#if defined(fb_assert_continue)
360 fb_assert_continue(rc >= 0 && rc < count);
361#else
362 fb_assert(rc >= 0 && rc < count);
363#endif
364#endif
365 return rc;
366}
367
368// *******************
369// c l e a n u p _ p a s s w d

Callers 15

make_object_nameFunction · 0.70
float_to_textFunction · 0.70
initMethod · 0.70
formatMethod · 0.70
make_obj_nameMethod · 0.50
make_map_nameMethod · 0.50
make_event_nameMethod · 0.50
alloc_portFunction · 0.50
connect_clientMethod · 0.50
GlobalPortLockMethod · 0.50
CLIB_ROUTINE mainFunction · 0.50
WinMainFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected