cjkcodecs: Fix compiler warning (GH-10651)

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.
This commit is contained in:
Victor Stinner 2018-11-22 10:25:46 +01:00 committed by GitHub
parent a42de742e7
commit cdbcb773f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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;