MCPcopy Create free account
hub / github.com/UPBGE/upbge / string_printf

Function string_printf

intern/cycles/util/string.cpp:33–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#endif /* _WIN32 */
32
33CCL_NAMESPACE_BEGIN
34
35string string_printf(const char *format, ...)
36{
37 vector<char> str(128, 0);
38
39 while (1) {
40 va_list args;
41 int result;
42
43 va_start(args, format);
44 result = vsnprintf(&str[0], str.size(), format, args);
45 va_end(args);
46
47 if (result == -1) {
48 /* not enough space or formatting error */
49 if (str.size() > 65536) {
50 assert(0);
51 return string("");
52 }
53
54 str.resize(str.size() * 2, 0);
55 continue;
56 }
57 else if (result >= (int)str.size()) {
58 /* not enough space */
59 str.resize(result + 1, 0);
60 continue;
61 }
62
63 return string(&str[0]);
64 }
65}
66
67bool string_iequals(const string &a, const string &b)
68{

Callers 15

compute_bvhMethod · 0.85
device_updateMethod · 0.85
full_reportMethod · 0.85
foreachFunction · 0.85
foreachFunction · 0.85
device_load_imageMethod · 0.85
parameter_textureMethod · 0.85
parameter_texture_iesMethod · 0.85

Calls 2

sizeMethod · 0.45
resizeMethod · 0.45

Tested by 1

TESTFunction · 0.68