MCPcopy Create free account
hub / github.com/blender/blender / string_printf

Function string_printf

intern/cycles/util/string.cpp:21–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#endif /* _WIN32 */
20
21CCL_NAMESPACE_BEGIN
22
23string string_printf(const char *format, ...)
24{
25 vector<char> str(128, 0);
26
27 while (true) {
28 va_list args;
29 int result;
30
31 va_start(args, format);
32 result = vsnprintf(str.data(), str.size(), format, args);
33 va_end(args);
34
35 if (result == -1) {
36 /* not enough space or formatting error */
37 if (str.size() > 65536) {
38 assert(0);
39 return string("");
40 }
41
42 str.resize(str.size() * 2, 0);
43 continue;
44 }
45 if (result >= (int)str.size()) {
46 /* not enough space */
47 str.resize(result + 1, 0);
48 continue;
49 }
50
51 return string(str.data());
52 }
53}
54
55bool string_iequals(const string &a, const string &b)
56{

Callers 15

compute_bvhMethod · 0.85
device_updateMethod · 0.85
full_reportMethod · 0.85
add_imageMethod · 0.85
device_load_imageMethod · 0.85
device_update_postMethod · 0.85
parameter_textureMethod · 0.85
parameter_texture_iesMethod · 0.85

Calls 4

stringFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by 1

TESTFunction · 0.68