build: avoid integer length warnings

This commit is contained in:
Danny Robson 2017-01-05 19:49:07 +11:00
parent 449fd1d1ad
commit 98dc992473
4 changed files with 16 additions and 16 deletions

View File

@ -207,8 +207,8 @@ void
SHA256::finish (void)
{
// Append a single 1 bit followed by 0s.
size_t buffered = m_total % sizeof (M);
size_t used = m_total * 8;
auto buffered = m_total % sizeof (M);
auto used = m_total * 8u;
C[buffered++] = 0x80;
++m_total;

View File

@ -838,7 +838,7 @@ json::tree::number::clone (void) const
std::ostream&
json::tree::number::write (std::ostream &os) const
{
auto old = int (os.precision ());
auto old = os.precision ();
switch (m_repr) {
case REAL: return os << std::numeric_limits<real_t>::digits10 << m_value.r << std::setprecision (old);

View File

@ -36,9 +36,9 @@ main (void)
CHECK_RENDER ("%hi", "1", (signed short)1);
CHECK_RENDER ("%li", "1", (signed long)1);
CHECK_RENDER ("%lli", "1", (signed long long)1);
CHECK_RENDER ("%ji", "1", (intmax_t)1);
CHECK_RENDER ("%zi", "1", (ssize_t)1);
CHECK_RENDER ("%ti", "1", (ptrdiff_t)1);
CHECK_RENDER ("%ji", "1", intmax_t{1});
CHECK_RENDER ("%zi", "1", ssize_t{1});
CHECK_RENDER ("%ti", "1", ptrdiff_t{1});
CHECK_RENDER ("%u", "1", 1u);
CHECK_RENDER ("%03u", "001", 1u);
@ -52,9 +52,9 @@ main (void)
CHECK_RENDER ("%hu", "1", (unsigned short)1);
CHECK_RENDER ("%lu", "1", (unsigned long)1);
CHECK_RENDER ("%llu", "1", (unsigned long long)1);
CHECK_RENDER ("%ju", "1", (uintmax_t)1);
CHECK_RENDER ("%zu", "0", (size_t)0);
CHECK_RENDER ("%zu", "1", (size_t)1);
CHECK_RENDER ("%ju", "1", uintmax_t{1});
CHECK_RENDER ("%zu", "0", size_t{0});
CHECK_RENDER ("%zu", "1", size_t{1});
CHECK_RENDER ("%!", "1", 1u);
CHECK_RENDER ("%o", "1", 01u);

View File

@ -28,8 +28,8 @@ util::sleep (uint64_t ns)
{
struct timespec req, rem;
req.tv_sec = sign_cast<time_t> (ns / SECOND);
req.tv_nsec = sign_cast<long> (ns % SECOND);
req.tv_sec = trunc_cast<time_t> (ns / SECOND);
req.tv_nsec = trunc_cast<long > (ns % SECOND);
while (nanosleep (&req, &rem)) {
req = rem;