Skip to content

Commit

Permalink
[plugin] use getenv instead of getenv_s
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkentim committed Mar 25, 2022
1 parent 1d74c22 commit 4863805
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/SampSharp/SampSharp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SAMPGDK_AMALGAMATION;SAMPGDK_CPP_WRAPPERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SAMPGDK_AMALGAMATION;SAMPGDK_CPP_WRAPPERS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>includes;includes/sdk;includes/sdk/amx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
<BrowseInformation>true</BrowseInformation>
Expand All @@ -82,7 +82,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SAMPGDK_AMALGAMATION;SAMPGDK_CPP_WRAPPERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SAMPGDK_AMALGAMATION;SAMPGDK_CPP_WRAPPERS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>includes;includes/sdk;includes/sdk/amx</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
Expand Down
6 changes: 2 additions & 4 deletions src/SampSharp/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,10 @@ bool plugin::detect_coreclr(std::string &value, fs::path path) {
}

bool plugin::detect_coreclr(std::string &value) {
char runtime[256];
size_t runtime_len;
getenv_s(&runtime_len, runtime, 256, "SAMPSHARP_RUNTIME");
const auto runtime = getenv("SAMPSHARP_RUNTIME");

return
runtime_len > 0 && runtime_len < 256 && detect_coreclr(value, runtime) ||
runtime && strlen(runtime) > 0 && detect_coreclr(value, runtime) ||
detect_coreclr(value, "runtime") ||
detect_coreclr(value, "dotnet");
}
Expand Down

0 comments on commit 4863805

Please sign in to comment.