summaryrefslogtreecommitdiff
path: root/Examples/lua
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2008-06-21 15:21:29 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2008-06-21 15:21:29 +0000
commit7a68c5c003d08c7e276e12a883be0c17a2824a3f (patch)
tree0382be2983ed6426ff68e6209e45da84f99d8f52 /Examples/lua
parenta1e23610d60f3bf1085e5ca114557ebabb8bbfb4 (diff)
downloadswig-7a68c5c003d08c7e276e12a883be0c17a2824a3f.tar.gz
Lua example warning removal fixes for vc++
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10539 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/lua')
-rw-r--r--Examples/lua/arrays/example.c2
-rw-r--r--Examples/lua/embed2/embed2.c13
-rw-r--r--Examples/lua/embed3/embed3.cpp14
-rw-r--r--Examples/lua/owner/example.cxx4
4 files changed, 26 insertions, 7 deletions
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 <stdlib.h>
#include <stdio.h>
@@ -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 <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -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<int>(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<int>(shapes.size()))
return NULL;
Shape* ptr=shapes[idx];
shapes.erase(shapes.begin()+idx);