Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b7e2d1

Browse files
committed
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.
1 parent ecccc4f commit 9b7e2d1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

PC/winreg.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,7 @@ PyEnumValue(PyObject *self, PyObject *args)
11291129
int index;
11301130
long rc;
11311131
wchar_t *retValueBuf;
1132+
wchar_t *tmpBuf;
11321133
BYTE *retDataBuf;
11331134
DWORD retValueSize, bufValueSize;
11341135
DWORD retDataSize, bufDataSize;
@@ -1161,7 +1162,6 @@ PyEnumValue(PyObject *self, PyObject *args)
11611162
}
11621163

11631164
while (1) {
1164-
wchar_t *tmp;
11651165
Py_BEGIN_ALLOW_THREADS
11661166
rc = RegEnumValueW(hKey,
11671167
index,
@@ -1177,13 +1177,13 @@ PyEnumValue(PyObject *self, PyObject *args)
11771177
break;
11781178

11791179
bufDataSize *= 2;
1180-
tmp = (char *)PyMem_Realloc(retDataBuf, bufDataSize);
1181-
if (tmp == NULL) {
1180+
tmpBuf = (wchar_t *)PyMem_Realloc(retDataBuf, bufDataSize);
1181+
if (tmpBuf == NULL) {
11821182
PyErr_NoMemory();
11831183
retVal = NULL;
11841184
goto fail;
11851185
}
1186-
retDataBuf = tmp;
1186+
retDataBuf = tmpBuf;
11871187
retDataSize = bufDataSize;
11881188
retValueSize = bufValueSize;
11891189
}

0 commit comments

Comments
 (0)