From 8eae1cfb5a544cc0803a46c1dc58705916d5a921 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 14 Nov 2007 21:42:31 +0000 Subject: [PATCH] Fix warnings git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10121 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/r/copy_struct.i | 2 +- Examples/test-suite/r/legacy.i | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Examples/test-suite/r/copy_struct.i b/Examples/test-suite/r/copy_struct.i index 7883da523..db6223303 100644 --- a/Examples/test-suite/r/copy_struct.i +++ b/Examples/test-suite/r/copy_struct.i @@ -48,7 +48,7 @@ getA() return a; } -static struct A fixed = {20, 3.010101, 42}; +static struct A fixed = {20, 3, 42.0}; struct A * getARef() diff --git a/Examples/test-suite/r/legacy.i b/Examples/test-suite/r/legacy.i index 0c82fcbe2..ed6e5e331 100644 --- a/Examples/test-suite/r/legacy.i +++ b/Examples/test-suite/r/legacy.i @@ -17,12 +17,14 @@ Obj * getObject(int i, double d) { + const char *test_string = "a test string"; Obj *obj; obj = (Obj *) calloc(1, sizeof(Obj)); obj->i = i; obj->d = d; - obj->str = strdup("a test string"); + obj->str = (char *)malloc(strlen(test_string)); + strcpy(obj->str, test_string); return(obj); } @@ -48,7 +50,7 @@ extern float *MyFloatRef; #define PI 3.14159265358979 unsigned long MyULong = 20; -static float MyFloat = 1.05; +static float MyFloat = 1.05f; float *MyFloatRef = &MyFloat; const double PiSquared = PI * PI; @@ -73,7 +75,7 @@ getDouble() float getFloat() { - return PI/2; + return (float)PI/2; } long getLong()