mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
Back-out wcstok deprecation suppression and updates calls to use wcstok_s.
This commit is contained in:
parent
b3f51e3c44
commit
f63dab5a84
3 changed files with 8 additions and 7 deletions
|
|
@ -520,16 +520,16 @@ Py_Main(int argc, wchar_t **argv)
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
if (!Py_IgnoreEnvironmentFlag && (wp = _wgetenv(L"PYTHONWARNINGS")) &&
|
if (!Py_IgnoreEnvironmentFlag && (wp = _wgetenv(L"PYTHONWARNINGS")) &&
|
||||||
*wp != L'\0') {
|
*wp != L'\0') {
|
||||||
wchar_t *buf, *warning;
|
wchar_t *buf, *warning, *context = NULL;
|
||||||
|
|
||||||
buf = (wchar_t *)PyMem_RawMalloc((wcslen(wp) + 1) * sizeof(wchar_t));
|
buf = (wchar_t *)PyMem_RawMalloc((wcslen(wp) + 1) * sizeof(wchar_t));
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
Py_FatalError(
|
Py_FatalError(
|
||||||
"not enough memory to copy PYTHONWARNINGS");
|
"not enough memory to copy PYTHONWARNINGS");
|
||||||
wcscpy(buf, wp);
|
wcscpy(buf, wp);
|
||||||
for (warning = wcstok(buf, L",");
|
for (warning = wcstok_s(buf, L",", &context);
|
||||||
warning != NULL;
|
warning != NULL;
|
||||||
warning = wcstok(NULL, L",")) {
|
warning = wcstok_s(NULL, L",", &context)) {
|
||||||
PySys_AddWarnOption(warning);
|
PySys_AddWarnOption(warning);
|
||||||
}
|
}
|
||||||
PyMem_RawFree(buf);
|
PyMem_RawFree(buf);
|
||||||
|
|
|
||||||
|
|
@ -451,11 +451,12 @@ find_env_config_value(FILE * env_file, const wchar_t * key, wchar_t * value)
|
||||||
tmpbuffer, MAXPATHLEN * 2);
|
tmpbuffer, MAXPATHLEN * 2);
|
||||||
Py_DECREF(decoded);
|
Py_DECREF(decoded);
|
||||||
if (k >= 0) {
|
if (k >= 0) {
|
||||||
wchar_t * tok = wcstok(tmpbuffer, L" \t\r\n");
|
wchar_t * context = NULL;
|
||||||
|
wchar_t * tok = wcstok_s(tmpbuffer, L" \t\r\n", &context);
|
||||||
if ((tok != NULL) && !wcscmp(tok, key)) {
|
if ((tok != NULL) && !wcscmp(tok, key)) {
|
||||||
tok = wcstok(NULL, L" \t");
|
tok = wcstok_s(NULL, L" \t", &context);
|
||||||
if ((tok != NULL) && !wcscmp(tok, L"=")) {
|
if ((tok != NULL) && !wcscmp(tok, L"=")) {
|
||||||
tok = wcstok(NULL, L"\r\n");
|
tok = wcstok_s(NULL, L"\r\n", &context);
|
||||||
if (tok != NULL) {
|
if (tok != NULL) {
|
||||||
wcsncpy(value, tok, MAXPATHLEN);
|
wcsncpy(value, tok, MAXPATHLEN);
|
||||||
result = 1;
|
result = 1;
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalIncludeDirectories>$(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_CRT_NON_CONFORMING_WCSTOK;_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue