Skip to content

Commit b71f9db

Browse files
committed
MSVC Fixes
1 parent c584c29 commit b71f9db

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/chaiscript/language/chaiscript_engine.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ namespace chaiscript
150150
return std::string(t_str.begin(), t_str.end());
151151
}
152152

153-
#ifdef _UNICODE
154-
template<typename T>
153+
#if defined(_UNICODE) || defined(UNICODE)
154+
template<typename T>
155155
static std::wstring to_proper_string(const T &t_str)
156156
{
157157
return to_wstring(t_str);
@@ -166,7 +166,7 @@ namespace chaiscript
166166

167167
static std::string get_error_message(DWORD t_err)
168168
{
169-
#ifdef _UNICODE
169+
#if defined(_UNICODE) || defined(UNICODE)
170170
typedef LPWSTR StringType;
171171
std::wstring retval = L"Unknown Error";
172172
#else

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ char *mystrdup (const char *s) {
2424
char *d = static_cast<char*>(malloc (len+1));
2525
if (d == nullptr) return nullptr; // No memory
2626
#ifdef CHAISCRIPT_MSVC
27-
strcpy_s(d, len, s); // Copy the characters
27+
strcpy_s(d, len+1, s); // Copy the characters
2828
#else
2929
strncpy(d,s,len); // Copy the characters
3030
#endif

0 commit comments

Comments
 (0)