From 12f1eb15ca3fed6310402847559a7c99d3c77847 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 2 Apr 2022 17:14:10 -0400 Subject: Programmatically apply new formatting to code Run this: for i in **/*.cc **/*.c **/*.h **/*.hh; do clang-format < $i >| $i.new && mv $i.new $i done --- libqpdf/QPDF_Real.cc | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'libqpdf/QPDF_Real.cc') diff --git a/libqpdf/QPDF_Real.cc b/libqpdf/QPDF_Real.cc index 55f61b35..345f30b6 100644 --- a/libqpdf/QPDF_Real.cc +++ b/libqpdf/QPDF_Real.cc @@ -7,8 +7,8 @@ QPDF_Real::QPDF_Real(std::string const& val) : { } -QPDF_Real::QPDF_Real(double value, int decimal_places, - bool trim_trailing_zeroes) : +QPDF_Real::QPDF_Real( + double value, int decimal_places, bool trim_trailing_zeroes) : val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes)) { } @@ -30,23 +30,16 @@ QPDF_Real::getJSON() // converting from string to double and back, just handle this as a // special case for JSON. std::string result; - if (this->val.length() == 0) - { + if (this->val.length() == 0) { // Can't really happen... result = "0"; - } - else if (this->val.at(0) == '.') - { + } else if (this->val.at(0) == '.') { result = "0" + this->val; - } - else if ((this->val.length() >= 2) && - (this->val.at(0) == '-') && - (this->val.at(1) == '.')) - { + } else if ( + (this->val.length() >= 2) && (this->val.at(0) == '-') && + (this->val.at(1) == '.')) { result = "-0." + this->val.substr(2); - } - else - { + } else { result = this->val; } return JSON::makeNumber(result); -- cgit v1.2.3-70-g09d2