Eliminate warnings on MSVC 2013
Note that this required ignoring a few warnings with pragmas, changing the parameter type and return types of std::string::find functions to size_t from int and a new global warning disable on MSVC. I've managed to avoid global warning disables up to this point in the code, but I don't see a way around the "decorated name too long (C4503)" warning. Closes #100
This commit is contained in:
13
src/main.cpp
13
src/main.cpp
@@ -17,10 +17,15 @@
|
||||
#else
|
||||
|
||||
char *mystrdup (const char *s) {
|
||||
char *d = static_cast<char*>(malloc (strlen (s) + 1)); // Space for length plus nul
|
||||
if (d == nullptr) return nullptr; // No memory
|
||||
strcpy (d,s); // Copy the characters
|
||||
return d; // Return the new string
|
||||
size_t len = strlen(s) + 1; // Space for length plus nul
|
||||
char *d = static_cast<char*>(malloc (len));
|
||||
if (d == nullptr) return nullptr; // No memory
|
||||
#ifdef CHAISCRIPT_MSVC
|
||||
strcpy_s(d, len, s); // Copy the characters
|
||||
#else
|
||||
strcpy(d,s); // Copy the characters
|
||||
#endif
|
||||
return d; // Return the new string
|
||||
}
|
||||
|
||||
char* readline(const char* p)
|
||||
|
Reference in New Issue
Block a user