@@ -1314,8 +1314,9 @@ ascii_new(Py_ssize_t size)
1314
1314
void * data ;
1315
1315
Py_ssize_t struct_size = sizeof (PyASCIIObject );
1316
1316
1317
- if (size > ((PY_SSIZE_T_MAX - struct_size ) - 1 ))
1317
+ if (size > ((PY_SSIZE_T_MAX - struct_size ) - 1 )) {
1318
1318
return PyErr_NoMemory ();
1319
+ }
1319
1320
1320
1321
/* Duplicated allocation code from _PyObject_New() instead of a call to
1321
1322
* PyObject_New() so we are able to allocate space for the object and
@@ -1339,7 +1340,7 @@ ascii_new(Py_ssize_t size)
1339
1340
((char * )data )[size ] = 0 ;
1340
1341
1341
1342
#ifdef Py_DEBUG
1342
- unicode_fill_invalid ((PyObject * )unicode , 0 );
1343
+ unicode_fill_invalid ((PyObject * )obj , 0 );
1343
1344
#endif
1344
1345
assert (_PyUnicode_CheckConsistency (obj , 0 ));
1345
1346
return obj ;
@@ -5092,12 +5093,16 @@ ascii_decode(const char *start, const char *end, Py_UCS1 *dest)
5092
5093
5093
5094
#if (defined(__clang__ ) || defined(__GNUC__ ))
5094
5095
#define HAS_CTZ 1
5095
- static inline unsigned int ctz (size_t v ) {
5096
+ static inline unsigned int
5097
+ ctz (size_t v )
5098
+ {
5096
5099
return __builtin_ctzll ((unsigned long long )v );
5097
5100
}
5098
5101
#elif defined(_MSC_VER )
5099
5102
#define HAS_CTZ 1
5100
- static inline unsigned int ctz (size_t v ) {
5103
+ static inline unsigned int
5104
+ ctz (size_t v )
5105
+ {
5101
5106
unsigned long pos ;
5102
5107
#if SIZEOF_SIZE_T == 4
5103
5108
_BitScanForward (& pos , v );
@@ -5410,10 +5415,10 @@ unicode_decode_utf8(const char *s, Py_ssize_t size,
5410
5415
if (error_handler == _Py_ERROR_STRICT && !consumed && ch >= 0xc2 ) {
5411
5416
maxsize = utf8_count_codepoints ((const unsigned char * )s , (const unsigned char * )end );
5412
5417
if (ch < 0xc4 ) { // latin1
5413
- maxchr = 255 ;
5418
+ maxchr = 0xff ;
5414
5419
}
5415
5420
else if (ch < 0xf0 ) { // ucs2
5416
- maxchr = 65535 ;
5421
+ maxchr = 0xffff ;
5417
5422
}
5418
5423
else { // ucs4
5419
5424
maxchr = 0x10ffff ;
@@ -5493,8 +5498,8 @@ PyUnicode_DecodeUTF8Stateful(const char *s,
5493
5498
Py_ssize_t * consumed )
5494
5499
{
5495
5500
return unicode_decode_utf8 (s , size ,
5496
- errors ? _Py_ERROR_UNKNOWN : _Py_ERROR_STRICT ,
5497
- errors , consumed );
5501
+ errors ? _Py_ERROR_UNKNOWN : _Py_ERROR_STRICT ,
5502
+ errors , consumed );
5498
5503
}
5499
5504
5500
5505
0 commit comments