Kaydet (Commit) 1c3069ae authored tarafından Victor Stinner's avatar Victor Stinner

Rework _Py_DumpASCII() to make Coverity happy

üst 928ad285
......@@ -545,23 +545,23 @@ _Py_DumpASCII(int fd, PyObject *text)
size = ascii->length;
kind = ascii->state.kind;
if (ascii->state.compact) {
if (kind == PyUnicode_WCHAR_KIND) {
wstr = ((PyASCIIObject *)text)->wstr;
if (wstr == NULL)
return;
size = ((PyCompactUnicodeObject *)text)->wstr_length;
}
else if (ascii->state.compact) {
if (ascii->state.ascii)
data = ((PyASCIIObject*)text) + 1;
else
data = ((PyCompactUnicodeObject*)text) + 1;
}
else if (kind != PyUnicode_WCHAR_KIND) {
else {
data = ((PyUnicodeObject *)text)->data.any;
if (data == NULL)
return;
}
else {
wstr = ((PyASCIIObject *)text)->wstr;
if (wstr == NULL)
return;
size = ((PyCompactUnicodeObject *)text)->wstr_length;
}
if (MAX_STRING_LENGTH < size) {
size = MAX_STRING_LENGTH;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment