mirror of https://github.com/python/cpython.git
gcc is being stupid with if/else constructs
clean out some other warnings
This commit is contained in:
parent
1d3dd74574
commit
af36a3aa20
|
@ -421,13 +421,15 @@ PyObject *PyUnicode_FromEncodedObject(register PyObject *obj,
|
||||||
else
|
else
|
||||||
v = PyUnicode_Decode(s, len, encoding, errors);
|
v = PyUnicode_Decode(s, len, encoding, errors);
|
||||||
done:
|
done:
|
||||||
if (owned)
|
if (owned) {
|
||||||
Py_DECREF(obj);
|
Py_DECREF(obj);
|
||||||
|
}
|
||||||
return v;
|
return v;
|
||||||
|
|
||||||
onError:
|
onError:
|
||||||
if (owned)
|
if (owned) {
|
||||||
Py_DECREF(obj);
|
Py_DECREF(obj);
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,11 +634,11 @@ int utf8_decoding_error(const char **source,
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UTF8_ERROR(details) \
|
#define UTF8_ERROR(details) \
|
||||||
if (1) { \
|
do { \
|
||||||
if (utf8_decoding_error(&s, &p, errors, (details))) \
|
if (utf8_decoding_error(&s, &p, errors, (details))) \
|
||||||
goto onError; \
|
goto onError; \
|
||||||
continue; \
|
goto nextchar; \
|
||||||
} else
|
} while (0)
|
||||||
|
|
||||||
PyObject *PyUnicode_DecodeUTF8(const char *s,
|
PyObject *PyUnicode_DecodeUTF8(const char *s,
|
||||||
int size,
|
int size,
|
||||||
|
@ -732,6 +734,9 @@ PyObject *PyUnicode_DecodeUTF8(const char *s,
|
||||||
UTF8_ERROR("unsupported Unicode code range");
|
UTF8_ERROR("unsupported Unicode code range");
|
||||||
}
|
}
|
||||||
s += n;
|
s += n;
|
||||||
|
|
||||||
|
nextchar:
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust length */
|
/* Adjust length */
|
||||||
|
@ -747,6 +752,8 @@ PyObject *PyUnicode_DecodeUTF8(const char *s,
|
||||||
|
|
||||||
#undef UTF8_ERROR
|
#undef UTF8_ERROR
|
||||||
|
|
||||||
|
/* NOT USED */
|
||||||
|
#if 0
|
||||||
static
|
static
|
||||||
int utf8_encoding_error(const Py_UNICODE **source,
|
int utf8_encoding_error(const Py_UNICODE **source,
|
||||||
char **dest,
|
char **dest,
|
||||||
|
@ -776,6 +783,7 @@ int utf8_encoding_error(const Py_UNICODE **source,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* NOT USED */
|
||||||
|
|
||||||
PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s,
|
PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s,
|
||||||
int size,
|
int size,
|
||||||
|
@ -826,7 +834,7 @@ PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s,
|
||||||
ch = ((ch - 0xD800)<<10 | (ch2-0xDC00))+0x10000;
|
ch = ((ch - 0xD800)<<10 | (ch2-0xDC00))+0x10000;
|
||||||
|
|
||||||
*p++ = (char)((ch >> 18) | 0xf0);
|
*p++ = (char)((ch >> 18) | 0xf0);
|
||||||
*p++ = (char)(0x80 | (ch >> 12) & 0x3f);
|
*p++ = (char)(0x80 | ((ch >> 12) & 0x3f));
|
||||||
i++;
|
i++;
|
||||||
cbWritten += 4;
|
cbWritten += 4;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue