| 28 | } |
| 29 | |
| 30 | std::string StdStringFromFormatV(const char* format, std::va_list ap) |
| 31 | { |
| 32 | std::va_list ap_copy; |
| 33 | va_copy(ap_copy, ap); |
| 34 | |
| 35 | #ifdef _WIN32 |
| 36 | int len = _vscprintf(format, ap_copy); |
| 37 | #else |
| 38 | int len = std::vsnprintf(nullptr, 0, format, ap_copy); |
| 39 | #endif |
| 40 | va_end(ap_copy); |
| 41 | |
| 42 | std::string ret; |
| 43 | |
| 44 | // If an encoding error occurs, len is -1. Which we definitely don't want to resize to. |
| 45 | if (len > 0) |
| 46 | { |
| 47 | ret.resize(len); |
| 48 | std::vsnprintf(ret.data(), ret.size() + 1, format, ap); |
| 49 | } |
| 50 | |
| 51 | return ret; |
| 52 | } |
| 53 | |
| 54 | bool WildcardMatch(const char* subject, const char* mask, bool case_sensitive /*= true*/) |
| 55 | { |
no test coverage detected