]> granicus.if.org Git - python/commitdiff
Back-out wcstok deprecation suppression and updates calls to use wcstok_s.
authorSteve Dower <steve.dower@microsoft.com>
Thu, 26 Feb 2015 04:48:01 +0000 (20:48 -0800)
committerSteve Dower <steve.dower@microsoft.com>
Thu, 26 Feb 2015 04:48:01 +0000 (20:48 -0800)
Modules/main.c
PC/getpathp.c
PCbuild/pythoncore.vcxproj

index 83538c42e036320b9e7a0ac32c043e2d590674de..74e512bac008ce1de609abf5c244e3903b30f826 100644 (file)
@@ -520,16 +520,16 @@ Py_Main(int argc, wchar_t **argv)
 #ifdef MS_WINDOWS
     if (!Py_IgnoreEnvironmentFlag && (wp = _wgetenv(L"PYTHONWARNINGS")) &&
         *wp != L'\0') {
-        wchar_t *buf, *warning;
+        wchar_t *buf, *warning, *context = NULL;
 
         buf = (wchar_t *)PyMem_RawMalloc((wcslen(wp) + 1) * sizeof(wchar_t));
         if (buf == NULL)
             Py_FatalError(
                "not enough memory to copy PYTHONWARNINGS");
         wcscpy(buf, wp);
-        for (warning = wcstok(buf, L",");
+        for (warning = wcstok_s(buf, L",", &context);
              warning != NULL;
-             warning = wcstok(NULL, L",")) {
+             warning = wcstok_s(NULL, L",", &context)) {
             PySys_AddWarnOption(warning);
         }
         PyMem_RawFree(buf);
index deb40e76f3622191027fae4076bc3725a7b1596c..d4f457427263c4895c42890cfeb2c767fceda603 100644 (file)
@@ -451,11 +451,12 @@ find_env_config_value(FILE * env_file, const wchar_t * key, wchar_t * value)
                                      tmpbuffer, MAXPATHLEN * 2);
             Py_DECREF(decoded);
             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)) {
-                    tok = wcstok(NULL, L" \t");
+                    tok = wcstok_s(NULL, L" \t", &context);
                     if ((tok != NULL) && !wcscmp(tok, L"=")) {
-                        tok = wcstok(NULL, L"\r\n");
+                        tok = wcstok_s(NULL, L"\r\n", &context);
                         if (tok != NULL) {
                             wcsncpy(value, tok, MAXPATHLEN);
                             result = 1;
index 430d835c6e7d42f286ffc0fe4b1fcc937e7ef42b..479f68df554356db2c62aadc95e737b92327fbb1 100644 (file)
@@ -67,7 +67,7 @@
     <ClCompile>
       <AdditionalOptions>/Zm200  %(AdditionalOptions)</AdditionalOptions>
       <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>
     <Link>
       <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>