Fix a compile warning missed during porting (wchar_t/char) and move a

variable declaration outside of a loop. #2810 was when this first went in.
This commit is contained in:
Brian Curtin 2010-06-08 20:57:52 +00:00
parent ecccc4f9b8
commit 9b7e2d1e54

View file

@ -1129,6 +1129,7 @@ PyEnumValue(PyObject *self, PyObject *args)
int index; int index;
long rc; long rc;
wchar_t *retValueBuf; wchar_t *retValueBuf;
wchar_t *tmpBuf;
BYTE *retDataBuf; BYTE *retDataBuf;
DWORD retValueSize, bufValueSize; DWORD retValueSize, bufValueSize;
DWORD retDataSize, bufDataSize; DWORD retDataSize, bufDataSize;
@ -1161,7 +1162,6 @@ PyEnumValue(PyObject *self, PyObject *args)
} }
while (1) { while (1) {
wchar_t *tmp;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
rc = RegEnumValueW(hKey, rc = RegEnumValueW(hKey,
index, index,
@ -1177,13 +1177,13 @@ PyEnumValue(PyObject *self, PyObject *args)
break; break;
bufDataSize *= 2; bufDataSize *= 2;
tmp = (char *)PyMem_Realloc(retDataBuf, bufDataSize); tmpBuf = (wchar_t *)PyMem_Realloc(retDataBuf, bufDataSize);
if (tmp == NULL) { if (tmpBuf == NULL) {
PyErr_NoMemory(); PyErr_NoMemory();
retVal = NULL; retVal = NULL;
goto fail; goto fail;
} }
retDataBuf = tmp; retDataBuf = tmpBuf;
retDataSize = bufDataSize; retDataSize = bufDataSize;
retValueSize = bufValueSize; retValueSize = bufValueSize;
} }