]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
common/strtol.cc: refactor strict_si_cast() to silence warnings 32605/head
authorKefu Chai <kchai@redhat.com>
Sat, 11 Jan 2020 14:41:59 +0000 (22:41 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 11 Jan 2020 17:23:08 +0000 (01:23 +0800)
commit3916a1bef7a6c3dd1fc00ec3a2ae75a5af02d204
treedd4c179ab13e0c18ada9a19704cf2d053e76adf7
parent81f915565669ab5a7e84159c1b4ceb53ef5ef0c6
common/strtol.cc: refactor strict_si_cast() to silence warnings

to silence warnings like

../src/common/strtol.cc:286:7: warning: implicit conversion from 'promoted_t' (aka 'long long') to 'double' changes value from 9223372036854775807 to 9223372036854775808
[-Wimplicit-int-float-conversion]
      static_cast<promoted_t>(std::numeric_limits<T>::max()) / pow (10, m)) {
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
../src/common/strtol.cc:294:15: note: in instantiation of function template specialization 'strict_si_cast<long>' requested here
template long strict_si_cast<long>(std::string_view str, std::string *err);
              ^

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/strtol.cc