diff options
author | John Wiegley <johnw@newartisans.com> | 2019-01-14 17:24:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-14 17:24:34 -0800 |
commit | 5a54f079c0f511b95777013288c335d11a7552aa (patch) | |
tree | 4e92dff18e4c43a6438c1a346a8c4ccdb555720a /src | |
parent | ae37b380a7538b680b97010594f3b0ea6675caa8 (diff) | |
parent | 2ef1fbd738577a2ea1eb332d4a777ec659366b7d (diff) | |
download | fork-ledger-5a54f079c0f511b95777013288c335d11a7552aa.tar.gz fork-ledger-5a54f079c0f511b95777013288c335d11a7552aa.tar.bz2 fork-ledger-5a54f079c0f511b95777013288c335d11a7552aa.zip |
Merge pull request #1718 from scfc/fix-prepend-width-warning
Fix warning about uninitialized variable prepend_width
Diffstat (limited to 'src')
-rw-r--r-- | src/output.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/output.cc b/src/output.cc index c2fa83ac..09d3ad9e 100644 --- a/src/output.cc +++ b/src/output.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2018, John Wiegley. All rights reserved. + * Copyright (c) 2003-2019, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -284,8 +284,9 @@ void report_accounts::flush() std::ostream& out(report.output_stream); format_t prepend_format; std::size_t prepend_width; + bool do_prepend_format; - if (report.HANDLED(prepend_format_)) { + if ((do_prepend_format = report.HANDLED(prepend_format_))) { prepend_format.parse_format(report.HANDLER(prepend_format_).str()); prepend_width = report.HANDLED(prepend_width_) ? lexical_cast<std::size_t>(report.HANDLER(prepend_width_).str()) @@ -293,7 +294,7 @@ void report_accounts::flush() } foreach (accounts_pair& entry, accounts) { - if (prepend_format) { + if (do_prepend_format) { bind_scope_t bound_scope(report, *entry.first); out.width(static_cast<std::streamsize>(prepend_width)); out << prepend_format(bound_scope); |