aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Real.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-02 23:14:10 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-04 14:10:40 +0200
commit12f1eb15ca3fed6310402847559a7c99d3c77847 (patch)
tree8935675b623c6f3b4914b8b44f7fa5f2816a9241 /libqpdf/QPDF_Real.cc
parentf20fa61eb4c323eb1642c69c236b3d9a1f8b2cdb (diff)
downloadqpdf-12f1eb15ca3fed6310402847559a7c99d3c77847.tar.zst
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
Diffstat (limited to 'libqpdf/QPDF_Real.cc')
-rw-r--r--libqpdf/QPDF_Real.cc23
1 files changed, 8 insertions, 15 deletions
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);