Commit aca49379 authored by Victor Zverovich's avatar Victor Zverovich

Fix a few minor issues detected by CppCheck

Thanks to Dmitry Andriyankov for reporting.
parent 615c1eef
...@@ -474,9 +474,8 @@ void fmt::internal::format_system_error( ...@@ -474,9 +474,8 @@ void fmt::internal::format_system_error(
FMT_TRY { FMT_TRY {
MemoryBuffer<char, INLINE_BUFFER_SIZE> buffer; MemoryBuffer<char, INLINE_BUFFER_SIZE> buffer;
buffer.resize(INLINE_BUFFER_SIZE); buffer.resize(INLINE_BUFFER_SIZE);
char *system_message = 0;
for (;;) { for (;;) {
system_message = &buffer[0]; char *system_message = &buffer[0];
int result = safe_strerror(error_code, system_message, buffer.size()); int result = safe_strerror(error_code, system_message, buffer.size());
if (result == 0) { if (result == 0) {
out << message << ": " << system_message; out << message << ": " << system_message;
...@@ -888,7 +887,6 @@ template <typename Char> ...@@ -888,7 +887,6 @@ template <typename Char>
const Char *fmt::BasicFormatter<Char>::format( const Char *fmt::BasicFormatter<Char>::format(
const Char *&format_str, const Arg &arg) { const Char *&format_str, const Arg &arg) {
const Char *s = format_str; const Char *s = format_str;
const char *error = 0;
FormatSpec spec; FormatSpec spec;
if (*s == ':') { if (*s == ':') {
if (arg.type == Arg::CUSTOM) { if (arg.type == Arg::CUSTOM) {
...@@ -962,8 +960,6 @@ const Char *fmt::BasicFormatter<Char>::format( ...@@ -962,8 +960,6 @@ const Char *fmt::BasicFormatter<Char>::format(
// Zero may be parsed again as a part of the width, but it is simpler // Zero may be parsed again as a part of the width, but it is simpler
// and more efficient than checking if the next char is a digit. // and more efficient than checking if the next char is a digit.
spec.width_ = parse_nonnegative_int(s); spec.width_ = parse_nonnegative_int(s);
if (error)
FMT_THROW(FormatError(error));
} }
// Parse precision. // Parse precision.
...@@ -972,8 +968,6 @@ const Char *fmt::BasicFormatter<Char>::format( ...@@ -972,8 +968,6 @@ const Char *fmt::BasicFormatter<Char>::format(
spec.precision_ = 0; spec.precision_ = 0;
if ('0' <= *s && *s <= '9') { if ('0' <= *s && *s <= '9') {
spec.precision_ = parse_nonnegative_int(s); spec.precision_ = parse_nonnegative_int(s);
if (error)
FMT_THROW(FormatError(error));
} else if (*s == '{') { } else if (*s == '{') {
++s; ++s;
const Arg &precision_arg = parse_arg_index(s); const Arg &precision_arg = parse_arg_index(s);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment