From b95358fa30c6950aa816b45195def4b58975030e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 22 Nov 2018 09:57:56 +0100 Subject: [PATCH] cjkcodecs: Fix compiler warning Fixed the following compiler warning in multibytecodec.c: warning C4244: '=': conversion from 'Py_ssize_t' to 'unsigned char', possible loss of data Cast Py_ssize_t to unsigned char: the maximum value is checked on the previous line. --- Modules/cjkcodecs/multibytecodec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index 9409456c0d2749..8a0ac870f15efb 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -923,8 +923,8 @@ _multibytecodec_MultibyteIncrementalEncoder_getstate_impl(MultibyteIncrementalEn PyErr_SetString(PyExc_UnicodeError, "pending buffer too large"); return NULL; } - statebytes[0] = pendingsize; - memcpy(statebytes+1, pendingbuffer, pendingsize); + statebytes[0] = (unsigned char)pendingsize; + memcpy(statebytes + 1, pendingbuffer, pendingsize); statesize = 1 + pendingsize; } else { statebytes[0] = 0;