[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 9c34f2a 12/16: Don't mix std::size_t with fix
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 9c34f2a 12/16: Don't mix std::size_t with fixed-width integer types |
Date: |
Thu, 15 Nov 2018 17:37:05 -0500 (EST) |
branch: master
commit 9c34f2ad5b7d3002f8b56d165b7cdfa6ab0accc4
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Don't mix std::size_t with fixed-width integer types
---
md5.cpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/md5.cpp b/md5.cpp
index 5a7f6a0..ef0216e 100644
--- a/md5.cpp
+++ b/md5.cpp
@@ -42,6 +42,8 @@
#include "pchfile.hpp"
+#include "bourn_cast.hpp"
+
// Suppress this because we wouldn't have glibc's 'config.h'.
//#if defined HAVE_CONFIG_H
//# include <config.h>
@@ -269,15 +271,16 @@ md5_buffer (char const* buffer, std::size_t len, void*
resblock)
* struct md5_ctx *ctx;
*/
void
-md5_process_bytes (void const* buffer, std::size_t len, struct md5_ctx* ctx)
+md5_process_bytes (void const* buffer, std::size_t a_len, struct md5_ctx* ctx)
{
+ md5_uint32 len = bourn_cast<md5_uint32>(a_len);
/* When we already have some bits in our internal buffer concatenate
* both inputs first.
*/
if (ctx->buflen != 0)
{
- std::size_t left_over = ctx->buflen;
- std::size_t add = 128 - left_over > len ? len : 128 - left_over;
+ md5_uint32 left_over = ctx->buflen;
+ md5_uint32 add = 128 - left_over > len ? len : 128 - left_over;
std::memcpy (&ctx->buffer[left_over], buffer, add);
ctx->buflen += add;
@@ -333,8 +336,9 @@ md5_process_bytes (void const* buffer, std::size_t len,
struct md5_ctx* ctx)
* struct md5_ctx *ctx;
*/
void
-md5_process_block (void const* buffer, std::size_t len, struct md5_ctx* ctx)
+md5_process_block (void const* buffer, std::size_t a_len, struct md5_ctx* ctx)
{
+ md5_uint32 len = bourn_cast<md5_uint32>(a_len);
md5_uint32 correct_words[16];
/* GWC: Conform to C++98.
* const md5_uint32 *words = buffer;
- [lmi-commits] [lmi] master updated (dd60056 -> 89e939b), Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master 08e2d4c 03/16: Truncate sizeof(char*), Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master 327d53c 06/16: Conditionally suppress selected x86_64-linux-gnu gcc-8 diagnostics, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master a1c1aa0 11/16: Avoid type 'long int', Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master 158c2a1 08/16: Suppress x86_64-linux-gnu gcc-8 diagnostics for xmlwrapp, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master db0c484 02/16: Improve default gcc warning options, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master d425a61 10/16: Suppress some 86_64-linux-gnu gcc-8 '-Wconversion' diagnostics, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master 9c34f2a 12/16: Don't mix std::size_t with fixed-width integer types,
Greg Chicares <=
- [lmi-commits] [lmi] master 89e939b 16/16: Prefer lmi::ssize() to member size(), Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master 0c4c5b6 01/16: Improve gcc dialect defaults, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master 96dc6f5 07/16: Suppress certain diagnostics for another old boost library, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master 5548922 14/16: Avoid gratuitous use of member size(), Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master fc8cf69 13/16: Prefer lmi::ssize() to member size(); rewrite a function out of line, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master f0fd0dc 15/16: Use bourn_cast to convert arithmetic types safely, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master c0a4dde 04/16: Reliably multiply suseconds_t by double, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master 0d09e74 05/16: Make a macro definition conditional, Greg Chicares, 2018/11/15
- [lmi-commits] [lmi] master a00f295 09/16: Avoid std::ptrdiff_t where it's excessively wide for 64-bit builds, Greg Chicares, 2018/11/15