summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-02-25 19:23:04 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-02-25 19:29:19 -0300
commit27c848c35a0fbe2efa9f83e057313a74327b2047 (patch)
treea103f1dc4a3d22fd98f27fa86e619f181dc6a3ec
parent401f69564481ecd13dbe959ba700117766da7c85 (diff)
efl-csharp: Use proper conversion functions.
Summary: PtrToStringAuto may switch between ANSI and UTF16 encodings in a not so clear way, leading to decoding errors when getting messages from DBus. Reviewers: vitor.sousa Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8023
-rw-r--r--src/bindings/mono/eldbus_mono/eldbus_connection.cs2
-rw-r--r--src/bindings/mono/eldbus_mono/eldbus_message.cs34
-rw-r--r--src/bindings/mono/eldbus_mono/eldbus_object.cs4
-rw-r--r--src/bindings/mono/eldbus_mono/eldbus_pending.cs8
-rw-r--r--src/bindings/mono/eldbus_mono/eldbus_proxy.cs2
5 files changed, 25 insertions, 25 deletions
diff --git a/src/bindings/mono/eldbus_mono/eldbus_connection.cs b/src/bindings/mono/eldbus_mono/eldbus_connection.cs
index 099582ede5..bef7f29acb 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_connection.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_connection.cs
@@ -205,7 +205,7 @@ public class Connection : IDisposable
205 var ptr = eldbus_connection_unique_name_get(Handle); 205 var ptr = eldbus_connection_unique_name_get(Handle);
206 if (ptr == IntPtr.Zero) 206 if (ptr == IntPtr.Zero)
207 return null; 207 return null;
208 return Marshal.PtrToStringAuto(ptr); 208 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
209 } 209 }
210 210
211 public eldbus.Pending NameRequest(string bus, uint flags, eldbus.MessageDelegate dlgt = null) 211 public eldbus.Pending NameRequest(string bus, uint flags, eldbus.MessageDelegate dlgt = null)
diff --git a/src/bindings/mono/eldbus_mono/eldbus_message.cs b/src/bindings/mono/eldbus_mono/eldbus_message.cs
index b3826d6e13..a8c96ffe7a 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_message.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_message.cs
@@ -279,42 +279,42 @@ public class Message : IDisposable
279 { 279 {
280 CheckHandle(); 280 CheckHandle();
281 var ptr = eldbus_message_path_get(Handle); 281 var ptr = eldbus_message_path_get(Handle);
282 return Marshal.PtrToStringAuto(ptr); 282 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
283 } 283 }
284 284
285 public string GetInterface() 285 public string GetInterface()
286 { 286 {
287 CheckHandle(); 287 CheckHandle();
288 var ptr = eldbus_message_interface_get(Handle); 288 var ptr = eldbus_message_interface_get(Handle);
289 return Marshal.PtrToStringAuto(ptr); 289 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
290 } 290 }
291 291
292 public string GetMember() 292 public string GetMember()
293 { 293 {
294 CheckHandle(); 294 CheckHandle();
295 var ptr = eldbus_message_member_get(Handle); 295 var ptr = eldbus_message_member_get(Handle);
296 return Marshal.PtrToStringAuto(ptr); 296 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
297 } 297 }
298 298
299 public string GetDestination() 299 public string GetDestination()
300 { 300 {
301 CheckHandle(); 301 CheckHandle();
302 var ptr = eldbus_message_destination_get(Handle); 302 var ptr = eldbus_message_destination_get(Handle);
303 return Marshal.PtrToStringAuto(ptr); 303 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
304 } 304 }
305 305
306 public string GetSender() 306 public string GetSender()
307 { 307 {
308 CheckHandle(); 308 CheckHandle();
309 var ptr = eldbus_message_sender_get(Handle); 309 var ptr = eldbus_message_sender_get(Handle);
310 return Marshal.PtrToStringAuto(ptr); 310 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
311 } 311 }
312 312
313 public string GetSignature() 313 public string GetSignature()
314 { 314 {
315 CheckHandle(); 315 CheckHandle();
316 var ptr = eldbus_message_signature_get(Handle); 316 var ptr = eldbus_message_signature_get(Handle);
317 return Marshal.PtrToStringAuto(ptr); 317 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
318 } 318 }
319 319
320 public eldbus.Message NewError(string error_name, string error_msg) 320 public eldbus.Message NewError(string error_name, string error_msg)
@@ -341,8 +341,8 @@ public class Message : IDisposable
341 IntPtr name_ptr; 341 IntPtr name_ptr;
342 IntPtr text_ptr; 342 IntPtr text_ptr;
343 bool r = eldbus_message_error_get(Handle, out name_ptr, out text_ptr); 343 bool r = eldbus_message_error_get(Handle, out name_ptr, out text_ptr);
344 name = Marshal.PtrToStringAuto(name_ptr); 344 name = Eina.StringConversion.NativeUtf8ToManagedString(name_ptr);
345 text = Marshal.PtrToStringAuto(text_ptr); 345 text = Eina.StringConversion.NativeUtf8ToManagedString(text_ptr);
346 return r; 346 return r;
347 } 347 }
348 348
@@ -408,7 +408,7 @@ public class Message : IDisposable
408 CheckHandle(); 408 CheckHandle();
409 IntPtr aux; 409 IntPtr aux;
410 var r = eldbus_message_arguments_get(Handle, Argument.StringType.Signature, out aux); 410 var r = eldbus_message_arguments_get(Handle, Argument.StringType.Signature, out aux);
411 val = Marshal.PtrToStringAuto(aux); 411 val = Eina.StringConversion.NativeUtf8ToManagedString(aux);
412 return r; 412 return r;
413 } 413 }
414 414
@@ -417,7 +417,7 @@ public class Message : IDisposable
417 CheckHandle(); 417 CheckHandle();
418 IntPtr aux; 418 IntPtr aux;
419 var r = eldbus_message_arguments_get(Handle, Argument.ObjectPathType.Signature, out aux); 419 var r = eldbus_message_arguments_get(Handle, Argument.ObjectPathType.Signature, out aux);
420 val = Marshal.PtrToStringAuto(aux); 420 val = Eina.StringConversion.NativeUtf8ToManagedString(aux);
421 return r; 421 return r;
422 } 422 }
423 423
@@ -426,7 +426,7 @@ public class Message : IDisposable
426 CheckHandle(); 426 CheckHandle();
427 IntPtr aux; 427 IntPtr aux;
428 var r = eldbus_message_arguments_get(Handle, Argument.SignatureType.Signature, out aux); 428 var r = eldbus_message_arguments_get(Handle, Argument.SignatureType.Signature, out aux);
429 val = Marshal.PtrToStringAuto(aux); 429 val = Eina.StringConversion.NativeUtf8ToManagedString(aux);
430 return r; 430 return r;
431 } 431 }
432 432
@@ -617,7 +617,7 @@ public class MessageIterator
617 CheckHandle(); 617 CheckHandle();
618 IntPtr aux; 618 IntPtr aux;
619 bool r = eldbus_message_iter_get_and_next(Handle, Argument.StringType.Code, out aux); 619 bool r = eldbus_message_iter_get_and_next(Handle, Argument.StringType.Code, out aux);
620 val = Marshal.PtrToStringAuto(aux); 620 val = Eina.StringConversion.NativeUtf8ToManagedString(aux);
621 return r; 621 return r;
622 } 622 }
623 623
@@ -626,7 +626,7 @@ public class MessageIterator
626 CheckHandle(); 626 CheckHandle();
627 IntPtr aux; 627 IntPtr aux;
628 bool r = eldbus_message_iter_get_and_next(Handle, Argument.ObjectPathType.Code, out aux); 628 bool r = eldbus_message_iter_get_and_next(Handle, Argument.ObjectPathType.Code, out aux);
629 val = Marshal.PtrToStringAuto(aux); 629 val = Eina.StringConversion.NativeUtf8ToManagedString(aux);
630 return r; 630 return r;
631 } 631 }
632 632
@@ -635,7 +635,7 @@ public class MessageIterator
635 CheckHandle(); 635 CheckHandle();
636 IntPtr aux; 636 IntPtr aux;
637 bool r = eldbus_message_iter_get_and_next(Handle, Argument.SignatureType.Code, out aux); 637 bool r = eldbus_message_iter_get_and_next(Handle, Argument.SignatureType.Code, out aux);
638 val = Marshal.PtrToStringAuto(aux); 638 val = Eina.StringConversion.NativeUtf8ToManagedString(aux);
639 return r; 639 return r;
640 } 640 }
641 641
@@ -732,7 +732,7 @@ public class MessageIterator
732 CheckHandle(); 732 CheckHandle();
733 IntPtr aux; 733 IntPtr aux;
734 eldbus_message_iter_basic_get(Handle, out aux); 734 eldbus_message_iter_basic_get(Handle, out aux);
735 val = Marshal.PtrToStringAuto(aux); 735 val = Eina.StringConversion.NativeUtf8ToManagedString(aux);
736 } 736 }
737 737
738 public void Get(out eldbus.ObjectPath val) 738 public void Get(out eldbus.ObjectPath val)
@@ -740,7 +740,7 @@ public class MessageIterator
740 CheckHandle(); 740 CheckHandle();
741 IntPtr aux; 741 IntPtr aux;
742 eldbus_message_iter_basic_get(Handle, out aux); 742 eldbus_message_iter_basic_get(Handle, out aux);
743 val = Marshal.PtrToStringAuto(aux); 743 val = Eina.StringConversion.NativeUtf8ToManagedString(aux);
744 } 744 }
745 745
746 public void Get(out eldbus.SignatureString val) 746 public void Get(out eldbus.SignatureString val)
@@ -748,7 +748,7 @@ public class MessageIterator
748 CheckHandle(); 748 CheckHandle();
749 IntPtr aux; 749 IntPtr aux;
750 eldbus_message_iter_basic_get(Handle, out aux); 750 eldbus_message_iter_basic_get(Handle, out aux);
751 val = Marshal.PtrToStringAuto(aux); 751 val = Eina.StringConversion.NativeUtf8ToManagedString(aux);
752 } 752 }
753 753
754 public void Get(out eldbus.UnixFd val) 754 public void Get(out eldbus.UnixFd val)
diff --git a/src/bindings/mono/eldbus_mono/eldbus_object.cs b/src/bindings/mono/eldbus_mono/eldbus_object.cs
index 44888532ef..7b48743dd3 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_object.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_object.cs
@@ -175,14 +175,14 @@ public class Object : System.IDisposable
175 { 175 {
176 CheckHandle(); 176 CheckHandle();
177 var ptr = eldbus_object_bus_name_get(Handle); 177 var ptr = eldbus_object_bus_name_get(Handle);
178 return Marshal.PtrToStringAuto(ptr); 178 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
179 } 179 }
180 180
181 public string GetPath() 181 public string GetPath()
182 { 182 {
183 CheckHandle(); 183 CheckHandle();
184 var ptr = eldbus_object_path_get(Handle); 184 var ptr = eldbus_object_path_get(Handle);
185 return Marshal.PtrToStringAuto(ptr); 185 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
186 } 186 }
187 187
188 public void Ref() 188 public void Ref()
diff --git a/src/bindings/mono/eldbus_mono/eldbus_pending.cs b/src/bindings/mono/eldbus_mono/eldbus_pending.cs
index f5afa05700..906630ecbb 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_pending.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_pending.cs
@@ -82,28 +82,28 @@ public class Pending
82 { 82 {
83 CheckHandle(); 83 CheckHandle();
84 var ptr = eldbus_pending_destination_get(Handle); 84 var ptr = eldbus_pending_destination_get(Handle);
85 return Marshal.PtrToStringAuto(ptr); 85 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
86 } 86 }
87 87
88 public string GetPath() 88 public string GetPath()
89 { 89 {
90 CheckHandle(); 90 CheckHandle();
91 var ptr = eldbus_pending_path_get(Handle); 91 var ptr = eldbus_pending_path_get(Handle);
92 return Marshal.PtrToStringAuto(ptr); 92 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
93 } 93 }
94 94
95 public string GetInterface() 95 public string GetInterface()
96 { 96 {
97 CheckHandle(); 97 CheckHandle();
98 var ptr = eldbus_pending_interface_get(Handle); 98 var ptr = eldbus_pending_interface_get(Handle);
99 return Marshal.PtrToStringAuto(ptr); 99 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
100 } 100 }
101 101
102 public string GetMethod() 102 public string GetMethod()
103 { 103 {
104 CheckHandle(); 104 CheckHandle();
105 var ptr = eldbus_pending_method_get(Handle); 105 var ptr = eldbus_pending_method_get(Handle);
106 return Marshal.PtrToStringAuto(ptr); 106 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
107 } 107 }
108} 108}
109 109
diff --git a/src/bindings/mono/eldbus_mono/eldbus_proxy.cs b/src/bindings/mono/eldbus_mono/eldbus_proxy.cs
index fa34ce307b..ea44ca5db5 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_proxy.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_proxy.cs
@@ -141,7 +141,7 @@ public class Proxy : IDisposable
141 { 141 {
142 CheckHandle(); 142 CheckHandle();
143 var ptr = eldbus_proxy_interface_get(Handle); 143 var ptr = eldbus_proxy_interface_get(Handle);
144 return Marshal.PtrToStringAuto(ptr); 144 return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
145 } 145 }
146 146
147 eldbus.Message NewMethodCall(string member) 147 eldbus.Message NewMethodCall(string member)