diff --git a/Examples/lua/arrays/example.c b/Examples/lua/arrays/example.c index 40ed12c79..56c7b19d9 100644 --- a/Examples/lua/arrays/example.c +++ b/Examples/lua/arrays/example.c @@ -16,7 +16,7 @@ void sort_int(int* arr, int len) // ditto doubles int compare_double(const void * a, const void * b) { - return ( *(double*)a - *(double*)b ); + return (int)( *(double*)a - *(double*)b ); } void sort_double(double* arr, int len) diff --git a/Examples/lua/embed2/embed2.c b/Examples/lua/embed2/embed2.c index 07b7a44d2..dac527eb4 100644 --- a/Examples/lua/embed2/embed2.c +++ b/Examples/lua/embed2/embed2.c @@ -11,6 +11,17 @@ We will be using the luaL_dostring()/lua_dostring() function to call into lua */ +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + #include #include @@ -108,7 +119,7 @@ int call_va (lua_State *L,const char *func, const char *sig, ...) { endwhile: /* do the call */ - nres = strlen(sig); /* number of expected results */ + nres = (int)strlen(sig); /* number of expected results */ if (lua_pcall(L, narg, nres, 0) != 0) /* do the call */ { printf("error running function `%s': %s\n",func, lua_tostring(L, -1)); diff --git a/Examples/lua/embed3/embed3.cpp b/Examples/lua/embed3/embed3.cpp index e42401cda..c2424f9af 100644 --- a/Examples/lua/embed3/embed3.cpp +++ b/Examples/lua/embed3/embed3.cpp @@ -5,6 +5,17 @@ passing C++ objects to this function. */ +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + #include #include #include @@ -70,9 +81,6 @@ int call_onEvent(lua_State *L, Event e) { int main(int argc, char* argv[]) { - int ok; - int res; - char str[80]; printf("[C++] Welcome to the simple embedded Lua example v3\n"); printf("[C++] We are in C++\n"); printf("[C++] opening a Lua state & loading the libraries\n"); diff --git a/Examples/lua/owner/example.cxx b/Examples/lua/owner/example.cxx index 6e4091327..d6caeef15 100644 --- a/Examples/lua/owner/example.cxx +++ b/Examples/lua/owner/example.cxx @@ -54,14 +54,14 @@ void ShapeOwner::add(Shape* ptr) // this method takes ownership of the object Shape* ShapeOwner::get(int idx) // this pointer is still owned by the class (assessor) { - if (idx<0 || idx>=shapes.size()) + if (idx < 0 || idx >= static_cast(shapes.size())) return NULL; return shapes[idx]; } Shape* ShapeOwner::remove(int idx) // this method returns memory which must be deleted { - if (idx<0 || idx>=shapes.size()) + if (idx < 0 || idx >= static_cast(shapes.size())) return NULL; Shape* ptr=shapes[idx]; shapes.erase(shapes.begin()+idx);