Skip to content

Commit

Permalink
Merge commit '5bf6a55912986320c6106459852d8269aed3b0d1'
Browse files Browse the repository at this point in the history
  • Loading branch information
soramimi committed Jun 27, 2024
2 parents f88220b + 5bf6a55 commit 1937de1
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/common/strformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -752,20 +752,24 @@ class string_formatter {
{
return format_pointer(val);
}
void reset_format_params()
{
upper_ = false;
zero_padding_ = false;
align_left_ = false;
plus_ = false;
width_ = -1;
precision_ = -1;
lflag_ = 0;
}
void format(std::function<Part *(int)> const &callback, int width, int precision)
{
if (advance(false)) {
if (*next_ == '%') {
next_++;
}

upper_ = false;
zero_padding_ = false;
align_left_ = false;
plus_ = false;
width_ = -1;
precision_ = -1;
lflag_ = 0;
reset_format_params();

while (1) {
int c = (unsigned char)*next_;
Expand Down Expand Up @@ -851,6 +855,10 @@ class string_formatter {
}

head_ = next_;
} else {
reset_format_params();
Part *p = callback('s');
add_part(&list_, p);
}
}
int length()
Expand Down

0 comments on commit 1937de1

Please sign in to comment.