felipealmeida pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6ded80a9b5e49da2eed0208983f918016c41d818
commit 6ded80a9b5e49da2eed0208983f918016c41d818 Author: Felipe Magno de Almeida <fel...@expertisesolutions.com.br> Date: Fri Sep 15 14:53:19 2017 -0300 eo-cxx: Fix conversion from char* to std::string --- src/bindings/cxx/eo_cxx/eo_cxx_interop.hh | 35 +++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh index 47b11db1d8..0bf92b55aa 100644 --- a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh +++ b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh @@ -749,7 +749,9 @@ inline eina::string_view convert_to_return(const char** value, tag<const char**, { return {*value}; } -inline std::string convert_to_return(const char* value, tag<const char*, std::string>) +template <typename S> +inline std::string convert_to_return(const char* value, tag<const char*, S> + , typename std::enable_if<std::is_same<typename std::remove_cv<S>::type, std::string>::value>::type* = 0) { if(value) { @@ -760,7 +762,36 @@ inline std::string convert_to_return(const char* value, tag<const char*, std::st else return {}; } -inline std::string convert_to_return(const char** value, tag<const char**, std::string>) +template <typename S> +inline std::string convert_to_return(const char** value, tag<const char**, S> + , typename std::enable_if<std::is_same<typename std::remove_cv<S>::type, std::string>::value>::type* = 0) +{ + if(value) + { + std::string r{*value}; + free((void*)*value); + free((void*)value); + return r; + } + else + return {}; +} +template <typename S> +inline std::string convert_to_return(char* value, tag<char*, S> + , typename std::enable_if<std::is_same<typename std::remove_cv<S>::type, std::string>::value>::type* = 0) +{ + if(value) + { + std::string r{value}; + free((void*)value); + return r; + } + else + return {}; +} +template <typename S> +inline std::string convert_to_return(char** value, tag<char**, S> + , typename std::enable_if<std::is_same<typename std::remove_cv<S>::type, std::string>::value>::type* = 0) { if(value) { --