File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -67,16 +67,17 @@ class Sink {
6767 if (*(++fmt) == ' {' ) {
6868 buffer << *fmt++;
6969 } else {
70- std::cerr
71- << error_prefix
72- << " No arguments provided and braces not escaped! " ;
70+ std::cerr << error_prefix
71+ << " No arguments provided and braces not escaped! "
72+ << std::endl ;
7373 }
7474 } else if (*fmt == ' }' ) {
7575 if (*(++fmt) == ' }' ) {
7676 buffer << *fmt++;
7777 } else {
7878 std::cerr << error_prefix
79- << " Closing curly brace not escaped!" ;
79+ << " Closing curly brace not escaped!"
80+ << std::endl;
8081 }
8182 }
8283 }
@@ -97,7 +98,7 @@ class Sink {
9798 buffer << *fmt++;
9899 } else if (*fmt != ' }' ) {
99100 std::cerr << error_prefix
100- << " Only empty braces are allowed!" ;
101+ << " Only empty braces are allowed!" << std::endl ;
101102 } else {
102103 buffer << arg;
103104 arg_printed = true ;
@@ -107,9 +108,17 @@ class Sink {
107108 buffer << *fmt++;
108109 } else {
109110 std::cerr << error_prefix
110- << " Closing curly brace not escaped!" ;
111+ << " Closing curly brace not escaped!"
112+ << std::endl;
111113 }
112114 }
115+
116+ if (*fmt == ' \0 ' ) {
117+ std::cerr << error_prefix << " Too many arguments!" << std::endl;
118+ // ignore all left arguments and finalize message
119+ format (buffer, fmt);
120+ return ;
121+ }
113122 }
114123
115124 format (buffer, ++fmt, std::forward<Args &&>(args)...);
You can’t perform that action at this time.
0 commit comments