From b71f9db5c2e3527602cf88091c02da20b2eb260c Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Fri, 13 Mar 2015 22:27:51 -0600 Subject: [PATCH] MSVC Fixes --- include/chaiscript/language/chaiscript_engine.hpp | 6 +++--- src/main.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index 89b555e..77ce45a 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -150,8 +150,8 @@ namespace chaiscript return std::string(t_str.begin(), t_str.end()); } -#ifdef _UNICODE - template +#if defined(_UNICODE) || defined(UNICODE) + template static std::wstring to_proper_string(const T &t_str) { return to_wstring(t_str); @@ -166,7 +166,7 @@ namespace chaiscript static std::string get_error_message(DWORD t_err) { -#ifdef _UNICODE +#if defined(_UNICODE) || defined(UNICODE) typedef LPWSTR StringType; std::wstring retval = L"Unknown Error"; #else diff --git a/src/main.cpp b/src/main.cpp index 109a538..4ebc726 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,7 +24,7 @@ char *mystrdup (const char *s) { char *d = static_cast(malloc (len+1)); if (d == nullptr) return nullptr; // No memory #ifdef CHAISCRIPT_MSVC - strcpy_s(d, len, s); // Copy the characters + strcpy_s(d, len+1, s); // Copy the characters #else strncpy(d,s,len); // Copy the characters #endif