0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 10:08:56 +02:00

ircd::fmt: Fix specifier escaping.

This commit is contained in:
Jason Volk 2019-06-01 02:30:29 -07:00
parent 483d3da64f
commit fc9ed2e87e
3 changed files with 20 additions and 6 deletions

View file

@ -125,12 +125,14 @@ struct ircd::fmt::parser
});
spec %= specsym
>> !specsym
>> -(char_('+') | char_('-'))
>> (-char_('0') | attr(' '))
>> -ushort_
>> -(lit('.') >> ushort_)
>> name[is_valid]
>> -specterm;
>> -specterm
;
}
}
const ircd::fmt::parser;
@ -398,8 +400,21 @@ ircd::fmt::snprintf::argument(const arg &val)
if(qi::parse(start, stop, parser, spec))
handle_specifier(this->out, idx++, spec, val);
const string_view fmt(start, stop);
const auto nextpos(fmt.find(SPECIFIER));
string_view fmt
{
start, stop
};
if(size(fmt) >= 2 && fmt[0] == SPECIFIER && fmt[1] == SPECIFIER)
{
append({&SPECIFIER, 1});
fmt = string_view
{
start + 2, stop
};
}
auto nextpos(fmt.find(SPECIFIER));
append(fmt.substr(0, nextpos));
this->fmt = const_buffer
{

View file

@ -69,10 +69,9 @@ ircd::m::events::dump__file(const string_view &filename)
log::info
{
"dump[%s] %0.2lf$%c @ seq %zu of %zu; %zu events; %zu bytes; %zu writes; %zu errors",
"dump[%s] %0.2lf%% @ seq %zu of %zu; %zu events; %zu bytes; %zu writes; %zu errors",
filename,
pct,
'%', //TODO: fix gram
seq,
m::vm::sequence::retired,
ecount,

View file

@ -480,7 +480,7 @@ noexcept try
#ifdef IRCD_MAGICK_DEBUG_PROGRESS
log::debug
{
log, "job:%lu progress %2.2lf pct (%ld/%ld) :%s",
log, "job:%lu progress %2.2lf%% (%ld/%ld) :%s",
job_ctr,
(quantum / double(span) * 100.0),
quantum,