FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Explain why 'consumed' is initialized. · broncodans/python@ccc6359 · GitHub

forked from glix/python

Commit ccc6359

Browse files
martin.v.loewis
committed
Explain why 'consumed' is initialized.
git-svn-id: http://svn.python.org/projects/python/trunk@46433 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 76d7e1c commit ccc6359

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎Modules/_codecsmodule.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,11 @@ utf_16_decode(PyObject *self,
319319
if (!PyArg_ParseTuple(args, "t#|zi:utf_16_decode",
320320
&data, &size, &errors, &final))
321321
return NULL;
322-
/* XXX Why is consumed initialized to size? mvl */
323322
if (size < 0) {
324323
PyErr_SetString(PyExc_ValueError, "negative argument");
325324
return 0;
326325
}
327-
consumed = size;
326+
consumed = size; /* This is overwritten unless final is true. */
328327
decoded = PyUnicode_DecodeUTF16Stateful(data, size, errors, &byteorder,
329328
final ? NULL : &consumed);
330329
if (decoded == NULL)
@@ -348,12 +347,11 @@ utf_16_le_decode(PyObject *self,
348347
&data, &size, &errors, &final))
349348
return NULL;
350349

351-
/* XXX Why is consumed initialized to size? mvl */
352350
if (size < 0) {
353351
PyErr_SetString(PyExc_ValueError, "negative argument");
354352
return 0;
355353
}
356-
consumed = size;
354+
consumed = size; /* This is overwritten unless final is true. */
357355
decoded = PyUnicode_DecodeUTF16Stateful(data, size, errors,
358356
&byteorder, final ? NULL : &consumed);
359357
if (decoded == NULL)
@@ -377,12 +375,11 @@ utf_16_be_decode(PyObject *self,
377375
if (!PyArg_ParseTuple(args, "t#|zi:utf_16_be_decode",
378376
&data, &size, &errors, &final))
379377
return NULL;
380-
/* XXX Why is consumed initialized to size? mvl */
381378
if (size < 0) {
382379
PyErr_SetString(PyExc_ValueError, "negative argument");
383380
return 0;
384381
}
385-
consumed = size;
382+
consumed = size; /* This is overwritten unless final is true. */
386383
decoded = PyUnicode_DecodeUTF16Stateful(data, size, errors,
387384
&byteorder, final ? NULL : &consumed);
388385
if (decoded == NULL)
@@ -413,12 +410,11 @@ utf_16_ex_decode(PyObject *self,
413410
if (!PyArg_ParseTuple(args, "t#|zii:utf_16_ex_decode",
414411
&data, &size, &errors, &byteorder, &final))
415412
return NULL;
416-
/* XXX Why is consumed initialized to size? mvl */
417413
if (size < 0) {
418414
PyErr_SetString(PyExc_ValueError, "negative argument");
419415
return 0;
420416
}
421-
consumed = size;
417+
consumed = size; /* This is overwritten unless final is true. */
422418
unicode = PyUnicode_DecodeUTF16Stateful(data, size, errors, &byteorder,
423419
final ? NULL : &consumed);
424420
if (unicode == NULL)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL