mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #10951: Fix compiler warnings in timemodule.c and unicodeobject.c
Thanks Jérémy Anger for the fix.
This commit is contained in:
commit
ab870218e3
2 changed files with 5 additions and 1 deletions
|
@ -515,14 +515,18 @@ time_strftime(PyObject *self, PyObject *args)
|
|||
* will be ahead of time...
|
||||
*/
|
||||
for (i = 1024; ; i += i) {
|
||||
#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
|
||||
int err;
|
||||
#endif
|
||||
outbuf = (time_char *)PyMem_Malloc(i*sizeof(time_char));
|
||||
if (outbuf == NULL) {
|
||||
PyErr_NoMemory();
|
||||
break;
|
||||
}
|
||||
buflen = format_time(outbuf, i, fmt, &buf);
|
||||
#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
|
||||
err = errno;
|
||||
#endif
|
||||
if (buflen > 0 || i >= 256 * fmtlen) {
|
||||
/* If the buffer is 256 times as long as the format,
|
||||
it's probably not failing for lack of room!
|
||||
|
|
|
@ -4832,7 +4832,7 @@ PyUnicode_DecodeUTF8Stateful(const char *s,
|
|||
if (maxchar < 128 && size == unicode_size) {
|
||||
if (consumed)
|
||||
*consumed = size;
|
||||
return unicode_fromascii(s, size);
|
||||
return unicode_fromascii((const unsigned char *)s, size);
|
||||
}
|
||||
|
||||
unicode = PyUnicode_New(unicode_size, maxchar);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue