mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fixed a couple of places where 'int' was used where 'long'
should have been used.
This commit is contained in:
parent
49b0c3bafe
commit
85cc4d8940
1 changed files with 7 additions and 7 deletions
|
@ -1063,7 +1063,7 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s,
|
||||||
end = s + size;
|
end = s + size;
|
||||||
while (s < end) {
|
while (s < end) {
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
unsigned int x;
|
unsigned long x;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Non-escape characters are interpreted as Unicode ordinals */
|
/* Non-escape characters are interpreted as Unicode ordinals */
|
||||||
|
@ -1372,7 +1372,7 @@ PyObject *PyUnicode_DecodeRawUnicodeEscape(const char *s,
|
||||||
end = s + size;
|
end = s + size;
|
||||||
while (s < end) {
|
while (s < end) {
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
unsigned int x;
|
unsigned long x;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Non-escape characters are interpreted as Unicode ordinals */
|
/* Non-escape characters are interpreted as Unicode ordinals */
|
||||||
|
@ -1852,7 +1852,7 @@ PyObject *PyUnicode_DecodeCharmap(const char *s,
|
||||||
|
|
||||||
/* Apply mapping */
|
/* Apply mapping */
|
||||||
if (PyInt_Check(x)) {
|
if (PyInt_Check(x)) {
|
||||||
int value = PyInt_AS_LONG(x);
|
long value = PyInt_AS_LONG(x);
|
||||||
if (value < 0 || value > 65535) {
|
if (value < 0 || value > 65535) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"character mapping must be in range(65536)");
|
"character mapping must be in range(65536)");
|
||||||
|
@ -1971,7 +1971,7 @@ PyObject *PyUnicode_EncodeCharmap(const Py_UNICODE *p,
|
||||||
|
|
||||||
/* Apply mapping */
|
/* Apply mapping */
|
||||||
if (PyInt_Check(x)) {
|
if (PyInt_Check(x)) {
|
||||||
int value = PyInt_AS_LONG(x);
|
long value = PyInt_AS_LONG(x);
|
||||||
if (value < 0 || value > 255) {
|
if (value < 0 || value > 255) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"character mapping must be in range(256)");
|
"character mapping must be in range(256)");
|
||||||
|
@ -3070,7 +3070,7 @@ unicode_compare(PyUnicodeObject *str1, PyUnicodeObject *str2)
|
||||||
|
|
||||||
while (len1 > 0 && len2 > 0) {
|
while (len1 > 0 && len2 > 0) {
|
||||||
unsigned short c1, c2; /* 16 bits */
|
unsigned short c1, c2; /* 16 bits */
|
||||||
int diff; /* 32 bits */
|
long diff; /* >=32 bits */
|
||||||
|
|
||||||
c1 = *s1++;
|
c1 = *s1++;
|
||||||
c2 = *s2++;
|
c2 = *s2++;
|
||||||
|
@ -3080,7 +3080,7 @@ unicode_compare(PyUnicodeObject *str1, PyUnicodeObject *str2)
|
||||||
c2 += utf16Fixup[c2>>11];
|
c2 += utf16Fixup[c2>>11];
|
||||||
|
|
||||||
/* now c1 and c2 are in UTF-32-compatible order */
|
/* now c1 and c2 are in UTF-32-compatible order */
|
||||||
diff = (int)c1 - (int)c2;
|
diff = (long)c1 - (long)c2;
|
||||||
if (diff)
|
if (diff)
|
||||||
return (diff < 0) ? -1 : (diff != 0);
|
return (diff < 0) ? -1 : (diff != 0);
|
||||||
len1--; len2--;
|
len1--; len2--;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue