(glslang) use strtok_r instead of strtok

This commit is contained in:
libretroadmin 2024-06-26 15:36:31 +02:00
parent 6319fa30c3
commit 5a2a6db589

View File

@ -1,6 +1,6 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2016 - Hans-Kristian Arntzen
*
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
@ -46,8 +46,8 @@ struct SlangProcess
};
/* We don't use glslang from multiple threads, but to be sure.
* Initializing TLS and freeing it for glslang works around
* a really bizarre issue where the TLS key is suddenly
* Initializing TLS and freeing it for glslang works around
* a really bizarre issue where the TLS key is suddenly
* corrupted *somehow*.
*/
static std::mutex glslang_global_lock;
@ -69,6 +69,7 @@ struct SlangProcessHolder
SlangProcess::SlangProcess()
{
char *save = NULL;
char DefaultConfig[] =
"MaxLights 32\n"
"MaxClipPlanes 6\n"
@ -101,7 +102,7 @@ SlangProcess::SlangProcess()
"MaxComputeImageUniforms 8\n"
"MaxComputeAtomicCounters 8\n"
"MaxComputeAtomicCounterBuffers 1\n"
"MaxVaryingComponents 60\n"
"MaxVaryingComponents 60\n"
"MaxVertexOutputComponents 64\n"
"MaxGeometryInputComponents 64\n"
"MaxGeometryOutputComponents 128\n"
@ -165,11 +166,11 @@ SlangProcess::SlangProcess()
"generalConstantMatrixVectorIndexing 1\n";
const char *delims = " \t\n\r";
char *token = strtok(DefaultConfig, delims);
char *token = strtok_r(DefaultConfig, delims, &save);
while (token)
{
const char *value_str = strtok(0, delims);
const char *value_str = strtok_r(0, delims, &save);
int value = (int)strtoul(value_str, nullptr, 0);
if (string_starts_with_size(token, "Max", STRLEN_CONST("Max")))
@ -384,7 +385,7 @@ SlangProcess::SlangProcess()
else if (string_is_equal(token, "doWhileLoops"))
Resources.limits.doWhileLoops = (value != 0);
token = strtok(0, delims);
token = strtok_r(0, delims, &save);
}
}
@ -427,7 +428,7 @@ bool glslang::compile_spirv(const string &source, Stage stage,
EShMessages messages = static_cast<EShMessages>(EShMsgDefault | EShMsgVulkanRules | EShMsgSpvRules);
glslang::TShader::ForbidIncluder forbid_include =
glslang::TShader::ForbidIncluder forbid_include =
glslang::TShader::ForbidIncluder();
if (!shader.preprocess(&process.GetResources(),