1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

allow space in format string for %H to allow spaces in output

svn path=/icecast/trunk/log/; revision=18900
This commit is contained in:
Philipp Schafft 2013-04-02 12:17:43 +00:00
parent 9f9164c4b9
commit ad1543557e

View File

@ -423,6 +423,7 @@ static void __vsnprintf(char *str, size_t size, const char *format, va_list ap)
int in_block = 0; int in_block = 0;
int block_size = 0; int block_size = 0;
int block_len; int block_len;
int block_space = 0;
const char * arg; const char * arg;
char buf[80]; char buf[80];
@ -434,6 +435,7 @@ static void __vsnprintf(char *str, size_t size, const char *format, va_list ap)
in_block = 1; in_block = 1;
block_size = 0; block_size = 0;
block_len = 0; block_len = 0;
block_space = 0;
} }
else else
{ {
@ -456,6 +458,9 @@ static void __vsnprintf(char *str, size_t size, const char *format, va_list ap)
case '*': case '*':
block_len = va_arg(ap, int); block_len = va_arg(ap, int);
break; break;
case ' ':
block_space = 1;
break;
case '1': case '1':
case '2': case '2':
case '3': case '3':
@ -519,7 +524,7 @@ static void __vsnprintf(char *str, size_t size, const char *format, va_list ap)
{ {
for (; *arg && block_len && size; arg++, size--, block_len--) for (; *arg && block_len && size; arg++, size--, block_len--)
{ {
if (*arg <= '"' || *arg == '`' || *arg == '\\') if ((*arg <= '"' || *arg == '`' || *arg == '\\') && !(block_space && *arg == ' '))
*(str++) = '.'; *(str++) = '.';
else else
*(str++) = *arg; *(str++) = *arg;