mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-09-01 03:54:15 -04:00
Feature: Allow %z[ui] in logging format strings
This commit is contained in:
parent
308e73134c
commit
fca416b126
10
log/log.c
10
log/log.c
@ -473,6 +473,9 @@ static void __vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
case 'l':
|
||||
block_size++;
|
||||
break;
|
||||
case 'z':
|
||||
block_size = 'z';
|
||||
break;
|
||||
case '.':
|
||||
// just ignore '.'. If somebody cares: fix it.
|
||||
break;
|
||||
@ -523,6 +526,13 @@ static void __vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%lli", (long long int)va_arg(ap, long long int));
|
||||
break;
|
||||
case 'z':
|
||||
/* We do not use 'z' type of snprintf() here as it is not safe to use on a few outdated platforms. */
|
||||
if (*format == 'u')
|
||||
snprintf(buf, sizeof(buf), "%llu", (unsigned long long int)va_arg(ap, size_t));
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%lli", (long long int)va_arg(ap, ssize_t));
|
||||
break;
|
||||
default:
|
||||
snprintf(buf, sizeof(buf), "<<<invalid>>>");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user