forked from mirrors/linphone-iphone
Utils.m: properly handle UTF8 logging
This commit is contained in:
parent
f48e8122c5
commit
20fcf449fc
1 changed files with 4 additions and 2 deletions
|
|
@ -28,15 +28,17 @@
|
|||
va_list args;
|
||||
va_start(args, format);
|
||||
NSString *str = [[NSString alloc] initWithFormat:format arguments:args];
|
||||
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(CFStringGetSystemEncoding());
|
||||
const char *utf8str = [str cStringUsingEncoding:enc];
|
||||
int filesize = 20;
|
||||
const char *filename = strchr(file, '/') ? strrchr(file, '/') + 1 : file;
|
||||
if (severity <= ORTP_DEBUG) {
|
||||
// lol: ortp_debug(XXX) can be disabled at compile time, but ortp_log(ORTP_DEBUG, xxx) will always be valid even
|
||||
// not in debug build...
|
||||
ortp_debug("%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line, str.UTF8String);
|
||||
ortp_debug("%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str);
|
||||
} else {
|
||||
ortp_log(severity, "%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line,
|
||||
str.UTF8String);
|
||||
utf8str);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue