MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / TSprintfV

Method TSprintfV

src/StringUtils.cpp:276–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276int SU::TSprintfV(TCHAR * buffer, size_t bufferSize, const TCHAR * format, va_list vaList) {
277 TCHAR * msgTchar = new TCHAR[lstrlen(format)+1];
278 lstrcpy(msgTchar, format);
279 TCHAR * current = msgTchar;
280 while(*current != 0) {
281 if (*current == TEXT('%')) {
282 switch(*(current+1)) {
283 case TEXT('T'):
284 #ifdef UNICODE
285 *(current+1) = 's';
286 #else
287 *(current+1) = 'S';
288 #endif
289 break;
290 case TEXT('s'):
291 #ifdef UNICODE
292 *(current+1) = 'S';
293 #else
294 *(current+1) = 's';
295 #endif
296 break;
297 case TEXT('S'):
298 #ifdef UNICODE
299 *(current+1) = 's';
300 #else
301 *(current+1) = 'S';
302 #endif
303 break;
304 default:
305 break;
306 }
307 }
308 current++;
309 }
310
311 int ret = 0;
312 if (!buffer || bufferSize < 1) {
313 ret = 1024;//_vsctprintf(msgTchar, vaList); //TODO: update mingw and get this damned function
314 } else {
315 ret = _vsntprintf(buffer, bufferSize, msgTchar, vaList);
316 }
317
318 delete [] msgTchar;
319 return ret;
320}
321
322char* SU::DataToHex(const char * data_, int len) {
323 static const char * table = "0123456789ABCDEF";

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected