summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-02-17 15:17:52 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-02-17 15:17:52 -0600
commitc3a9a7d2c584a7651426b3516f4e9991c8063e02 (patch)
tree6a7748588d90d3d9e0032903548b3411d7277dd6 /src/amount.cc
parentc6b51a2635bdf7da803dd2fc8251d6c290f134a4 (diff)
downloadfork-ledger-c3a9a7d2c584a7651426b3516f4e9991c8063e02.tar.gz
fork-ledger-c3a9a7d2c584a7651426b3516f4e9991c8063e02.tar.bz2
fork-ledger-c3a9a7d2c584a7651426b3516f4e9991c8063e02.zip
Fixed many Clang type conversion warnings with static_cast
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/amount.cc b/src/amount.cc
index 9a84a457..85afc3d8 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -129,7 +129,8 @@ namespace {
// Convert the rational number to a floating-point, extending the
// floating-point to a large enough size to get a precise answer.
- mp_prec_t num_prec = mpz_sizeinbase(mpq_numref(quant), 2);
+ mp_prec_t num_prec =
+ static_cast<mpfr_prec_t>(mpz_sizeinbase(mpq_numref(quant), 2));
num_prec += amount_t::extend_by_digits*64;
if (num_prec < MPFR_PREC_MIN)
num_prec = MPFR_PREC_MIN;
@@ -138,7 +139,8 @@ namespace {
mpfr_set_prec(tempfnum, num_prec);
mpfr_set_z(tempfnum, mpq_numref(quant), rnd);
- mp_prec_t den_prec = mpz_sizeinbase(mpq_denref(quant), 2);
+ mp_prec_t den_prec =
+ static_cast<mpfr_prec_t>(mpz_sizeinbase(mpq_denref(quant), 2));
den_prec += amount_t::extend_by_digits*64;
if (den_prec < MPFR_PREC_MIN)
den_prec = MPFR_PREC_MIN;
@@ -168,9 +170,11 @@ namespace {
}
}
if (point > 0) {
- while (--index >= (point + 1 + zeros_prec) && buf[index] == '0')
+ while (--index >= (point + 1 + static_cast<std::size_t>(zeros_prec)) &&
+ buf[index] == '0')
buf[index] = '\0';
- if (index >= (point + zeros_prec) && buf[index] == '.')
+ if (index >= (point + static_cast<std::size_t>(zeros_prec)) &&
+ buf[index] == '.')
buf[index] = '\0';
}
}