diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2021-01-30 18:59:54 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2021-02-08 04:51:41 +0300 |
commit | b346cd1760dfad560d89cb797be2cf6f9f77bb77 (patch) | |
tree | d5a8ab6889d72e8090cd5198905db8635fe37008 /src/base64.h | |
parent | 907d6b6b40a62c5ae831bbd7551e7c57c3a27b6b (diff) |
src: avoid implicit type conversions
This fixes a bunch of C4244 ('conversion' conversion from 'type1' to
'type2', possible loss of data) MSVC warnings in the code base.
PR-URL: https://github.com/nodejs/node/pull/37149
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/base64.h')
-rw-r--r-- | src/base64.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/base64.h b/src/base64.h index cf6e82539a5..0db096810cd 100644 --- a/src/base64.h +++ b/src/base64.h @@ -36,9 +36,9 @@ static inline const char* base64_select_table(Base64Mode mode) { static inline constexpr size_t base64_encoded_size( size_t size, Base64Mode mode = Base64Mode::NORMAL) { - return mode == Base64Mode::NORMAL - ? ((size + 2) / 3 * 4) - : std::ceil(static_cast<double>(size * 4) / 3); + return mode == Base64Mode::NORMAL ? ((size + 2) / 3 * 4) + : static_cast<size_t>(std::ceil( + static_cast<double>(size * 4) / 3)); } // Doesn't check for padding at the end. Can be 1-2 bytes over. |