Remove conversion compiler warning
When compiling with g++8, I get the following two errors:
include/fmt/format-inl.h:400:29: error: conversion from ‘int’ to ‘char’ may change value [-Werror=conversion]
buffer[size++] = zero + static_cast<char>(digit);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/fmt/format-inl.h:416:28: error: conversion from ‘int’ to ‘char’ may change value [-Werror=conversion]
buffer[size++] = '0' + digit;
~~~~^~~~~~~
With this change, the errors are gone.
This commit is contained in:
parent
f0d0a1ebd7
commit
22cfa65a3f
@ -395,7 +395,7 @@ FMT_FUNC void grisu2_gen_digits(
|
||||
FMT_ASSERT(false, "invalid number of digits");
|
||||
}
|
||||
if (digit != 0 || size != 0)
|
||||
buffer[size++] = '0' + static_cast<char>(digit);
|
||||
buffer[size++] = static_cast<char>('0' + static_cast<char>(digit));
|
||||
--kappa;
|
||||
uint64_t remainder = (static_cast<uint64_t>(hi) << -one.e) + lo;
|
||||
if (remainder <= delta) {
|
||||
@ -410,7 +410,7 @@ FMT_FUNC void grisu2_gen_digits(
|
||||
delta *= 10;
|
||||
char digit = static_cast<char>(lo >> -one.e);
|
||||
if (digit != 0 || size != 0)
|
||||
buffer[size++] = '0' + digit;
|
||||
buffer[size++] = static_cast<char>('0' + digit);
|
||||
lo &= one.f - 1;
|
||||
--kappa;
|
||||
if (lo < delta) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user