[4.0] Modify CSharp_Dali_Application_New_SWIG_1~3 71/164371/3
authorhuiyu,eun <huiyu.eun@samsung.com>
Tue, 19 Dec 2017 01:55:37 +0000 (10:55 +0900)
committerhuiyu,eun <huiyu.eun@samsung.com>
Tue, 19 Dec 2017 02:32:37 +0000 (11:32 +0900)
Change-Id: Id8d7bc97d76281da7c48bc68a951e4a9845faa04
Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
dali-csharp-binder/src/application.cpp

index 2c7e1aa..0f7775a 100755 (executable)
@@ -137,36 +137,25 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_0() {
 
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_1(int jarg1) {
   void * jresult ;
-  int *arg1 = (int *) 0 ;
-  char ***arg2 ;
-  Dali::Application result;
+  int arg1 = 1;
+  char **arg2 = new char*[arg1 + 1];
 
+  Dali::Application result;
   {
-    // Todo generate argv data from the C# args
-    char **array;         // two dimensional array
-    int numStrings = 1;     // number of strings
-    int stringLength = 30;      // max string length.
-    array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
-    argV = array;
+    std::string app_name = "dali-csharp-app";
+    int stringLength = app_name.length();
+    char* array = new char[stringLength + 1];
 
-    // allocate the string data
-    for( int i=0; i < numStrings; i++)
-    {
-      array[i]=(char *)malloc( stringLength * sizeof(char) );
-    }
-    array[ numStrings ] =  NULL; // we allocated +1 for hold the NULL part
+    strncpy(array, app_name.c_str(), stringLength);
+    array[stringLength] = '\0';
 
-    std::string temp = "dali-csharp-app"; 
-    char* copy;
-    asprintf(&copy, "%s", temp.c_str() );
-    array[0] = copy;
-
-    arg1 = &argC;
-    arg2 = &argV;
+    argV = &array;
+    arg2[0] = array;
+    arg2[1] = NULL;
   }
   {
     try {
-      result = Dali::Application::New(arg1,arg2);
+      result = Dali::Application::New(&arg1, &arg2);
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -193,43 +182,34 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_1(int jarg1) {
 
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_2(int jarg1, char * jarg3) {
   void * jresult ;
-  int *arg1 = (int *) 0 ;
-  char ***arg2 ;
-  std::string *arg3 = 0 ;
-  Dali::Application result;
+  int arg1 = 1;
+  char **arg2 = new char*[arg1 + 1];
+  std::string *arg3 = 0;
 
+  Dali::Application result;
   {
-    // Todo generate argv data from the C# args
-    char **array;         // two dimensional array
-    int numStrings = 1;     // number of strings
-    int stringLength = 30;      // max string length.
-    array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
-    argV = array;
-
-    // allocate the string data
-    for( int i=0; i < numStrings; i++)
-    {
-      array[i]=(char *)malloc( stringLength * sizeof(char) );
-    }
-    array[ numStrings ] =  NULL; // we allocated +1 for hold the NULL part
+    std::string app_name = "dali-csharp-app";
+    int stringLength = app_name.length();
+    char* array = new char[stringLength + 1];
 
-    std::string temp = "dali-csharp-app"; 
-    char* copy;
-    asprintf(&copy, "%s", temp.c_str() );
-    array[0] = copy;
+    strncpy(array, app_name.c_str(), stringLength);
+    array[stringLength] = '\0';
 
-    arg1 = &argC;
-    arg2 = &argV;
+    argV = &array;
+    arg2[0] = array;
+    arg2[1] = NULL;
   }
   if (!jarg3) {
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+    delete []arg2[0];
+    delete []arg2;
     return 0;
   }
   std::string arg3_str(jarg3);
   arg3 = &arg3_str;
   {
     try {
-      result = Dali::Application::New(arg1,arg2,(std::string const &)*arg3);
+      result = Dali::Application::New(&arg1, &arg2,(std::string const &)*arg3);
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -259,37 +239,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_2(int jarg1, cha
 
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_3(int jarg1, char * jarg3, int jarg4) {
   void * jresult ;
-  int *arg1 = (int *) 0 ;
-  char ***arg2 ;
-  std::string *arg3 = 0 ;
-  Dali::Application::WINDOW_MODE arg4 ;
-  Dali::Application result;
+  int arg1 = 1;
+  char **arg2 = new char*[arg1 + 1];
+  std::string *arg3 = 0;
+  Dali::Application::WINDOW_MODE arg4;
 
+  Dali::Application result;
   {
-    // Todo generate argv data from the C# args
-    char **array;         // two dimensional array
-    int numStrings = 1;     // number of strings
-    int stringLength = 30;      // max string length.
-    array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
-    argV = array;
+    std::string app_name = "dali-csharp-app";
+    int stringLength = app_name.length();
+    char* array = new char[stringLength + 1];
 
-    // allocate the string data
-    for( int i=0; i < numStrings; i++)
-    {
-      array[i]=(char *)malloc( stringLength * sizeof(char) );
-    }
-    array[ numStrings ] =  NULL; // we allocated +1 for hold the NULL part
-
-    std::string temp = "dali-csharp-app";
-    char* copy;
-    asprintf(&copy, "%s", temp.c_str() );
-    array[0] = copy;
+    strncpy(array, app_name.c_str(), stringLength);
+    array[stringLength] = '\0';
 
-    arg1 = &argC;
-    arg2 = &argV;
+    argV = &array;
+    arg2[0] = array;
+    arg2[1] = NULL;
   }
   if (!jarg3) {
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+    delete []arg2[0];
+    delete []arg2;
     return 0;
   }
   std::string arg3_str(jarg3);
@@ -297,7 +268,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Application_New__SWIG_3(int jarg1, cha
   arg4 = (Dali::Application::WINDOW_MODE)jarg4;
   {
     try {
-      result = Dali::Application::New(arg1,arg2,(std::string const &)*arg3,arg4);
+      result = Dali::Application::New(&arg1, &arg2,(std::string const &)*arg3,arg4);
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;