From 238ffc43ddb068df49bb85f27943c0a5482f22e0 Mon Sep 17 00:00:00 2001 From: F1ssi0N Date: Tue, 13 Mar 2018 19:45:49 +0000 Subject: [PATCH] Fix compilation issues --- src/convar.cc | 7 +++++-- src/convar.hh | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/convar.cc b/src/convar.cc index 54f8869..bf561c7 100644 --- a/src/convar.cc +++ b/src/convar.cc @@ -288,10 +288,13 @@ void ConvarBase::tf_convar_changed(sdk::IConVar *iconvar, const char *old_string } } -ConvarBase::ConvarBase(const char *name, Convar_Type type, const ConvarBase *parent) : parent(parent), t(type), next(head), init_complete(false) { +ConvarBase::ConvarBase(const char *name, ConvarType type, const ConvarBase *parent) : parent(parent), t(type), next(head), init_complete(false) { head = this; - strcpy_s(internal_name, name); + if constexpr (doghook_platform_windows()) + strcpy_s(internal_name, name); + else if constexpr (doghook_platform_linux()) + strcpy(internal_name, name); // Create a tf convar based on this one tf_convar = new sdk::ConCommandBase; diff --git a/src/convar.hh b/src/convar.hh index ae47b66..b4a9871 100644 --- a/src/convar.hh +++ b/src/convar.hh @@ -106,10 +106,10 @@ public: auto from_string(const char *str) -> bool override final { assert(str); - if (_stricmp(str, "false") == 0) { + if (stricmp(str, "false") == 0) { value = false; return false; - } else if (_stricmp(str, "true") == 0) { + } else if (stricmp(str, "true") == 0) { value = true; return false; } @@ -279,7 +279,10 @@ public: Convar(const char *name, const char *value, const ConvarBase *parent) : Convar(name, parent) { auto size = strlen(value) + 1; this->value = new char[size]; - strcpy_s(this->value, size, value); + if constexpr (doghook_platform_windows()) + strcpy_s(this->value, size, value); + else if constexpr (doghook_platform_linux()) + strncpy(this->value, value, size); } ~Convar() {