[Tizen] Fix Set and Get InputPanelUserData() 32/147132/1
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 31 Aug 2017 11:18:59 +0000 (20:18 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Fri, 1 Sep 2017 06:00:55 +0000 (15:00 +0900)
- Fixed SetInputPanelUserData() and GetInputPanelUserData() code

Change-Id: I9bc9da2093ae86fbea0e343d6c489cfe848e4aa2
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp
adaptors/x11/imf-manager-impl-x.cpp

index 5764c3a..0f23a74 100644 (file)
@@ -763,7 +763,7 @@ void ImfManager::SetInputPanelUserData( const std::string& data )
   if( mIMFContext )
   {
     int length = data.length();
-    ecore_imf_context_input_panel_imdata_set( mIMFContext, &data, length );
+    ecore_imf_context_input_panel_imdata_set( mIMFContext, data.c_str(), length );
   }
 }
 
@@ -773,8 +773,14 @@ void ImfManager::GetInputPanelUserData( std::string& data )
 
   if( mIMFContext )
   {
-    int* length = NULL;
-    ecore_imf_context_input_panel_imdata_get( mIMFContext, &data, length );
+    int length = 256;
+    char* buffer = reinterpret_cast< char* >( calloc ( 1, length * sizeof ( char ) ) );
+    if( buffer != NULL )
+    {
+      ecore_imf_context_input_panel_imdata_get( mIMFContext, buffer, &length );
+      data = buffer;
+      free( buffer );
+    }
   }
 }
 
index e0fa762..f8c9811 100644 (file)
@@ -597,7 +597,7 @@ void ImfManager::SetInputPanelUserData( const std::string& data )
   if( mIMFContext )
   {
     int length = data.length();
-    ecore_imf_context_input_panel_imdata_set( mIMFContext, &data, length );
+    ecore_imf_context_input_panel_imdata_set( mIMFContext, data.c_str(), length );
   }
 }
 
@@ -607,8 +607,14 @@ void ImfManager::GetInputPanelUserData( std::string& data )
 
   if( mIMFContext )
   {
-    int* length = NULL;
-    ecore_imf_context_input_panel_imdata_get( mIMFContext, &data, length );
+    int length = 256;
+    char* buffer = reinterpret_cast< char* >( calloc ( 1, length * sizeof ( char ) ) );
+    if( buffer != NULL )
+    {
+      ecore_imf_context_input_panel_imdata_get( mIMFContext, buffer, &length );
+      data = buffer;
+      free( buffer );
+    }
   }
 }