From: Moshe Zadka Date: Wed, 11 Apr 2001 08:01:24 +0000 (+0000) Subject: Checking the diff from PC/getpatchp.c 1.22 to 1.23 X-Git-Tag: v2.0.1c1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abbae5b3ccfbb5914a894fd9d9a0e1e1d900bd86;p=thirdparty%2FPython%2Fcpython.git Checking the diff from PC/getpatchp.c 1.22 to 1.23 This fixes many bugs, and was proposed by Thomas Heller. Original log message: ''' Checkin updated version of patch #103933 . As Thomas says, fixes the bugs #131064, #129584, #127722. See the discussion in bug #131064 ''' --- diff --git a/PC/getpathp.c b/PC/getpathp.c index d4366df4d9fd..760a5754fcfe 100644 --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -199,6 +199,10 @@ extern const char *PyWin_DLLVersionString; Ex family of functions so it also works with Windows CE. Returns NULL, or a pointer that should be freed. + + XXX - this code is pretty strange, as it used to also + work on Win16, where the buffer sizes werent available + in advance. It could be simplied now Win16/Win32s is dead! */ static char * @@ -279,6 +283,7 @@ getpythonregpath(HKEY keyBase, int skipcore) } RegCloseKey(subKey); } + /* original datasize from RegQueryInfo doesn't include the \0 */ dataBuf = malloc((dataSize+1) * sizeof(TCHAR)); if (dataBuf) { TCHAR *szCur = dataBuf; @@ -299,8 +304,11 @@ getpythonregpath(HKEY keyBase, int skipcore) if (skipcore) *szCur = '\0'; else { - *(szCur++) = _T(';'); - dataSize--; + /* If we have no values, we dont need a ';' */ + if (numKeys) { + *(szCur++) = _T(';'); + dataSize--; + } /* Now append the core path entries - this will include the NULL */