diff options
author | James Willcox <snopr@snorp.net> | 2005-11-17 21:11:13 +0000 |
---|---|---|
committer | James Willcox <snopr@snorp.net> | 2005-11-17 21:11:13 +0000 |
commit | 9a589e1f5221d1bd995b6c4fa73e3a074d4c2da4 (patch) | |
tree | 10b4bf2a914fa421474e6e895331d3cb4b07c9d9 /avahi-sharp/Utility.cs | |
parent | 84e07c25895dd6a8f706499a867afa44b9444ce2 (diff) |
* add byte[] overloads for EntryGroup methods
* cleanup string marshalling
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@999 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-sharp/Utility.cs')
-rw-r--r-- | avahi-sharp/Utility.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/avahi-sharp/Utility.cs b/avahi-sharp/Utility.cs index f8b4ffd..b15161c 100644 --- a/avahi-sharp/Utility.cs +++ b/avahi-sharp/Utility.cs @@ -60,12 +60,20 @@ namespace Avahi return ret; } - public static IntPtr StringToPtr (string str) + public static byte[] StringToBytes (string str) + { + if (str == null) + return null; + + return Encoding.UTF8.GetBytes (str); + } + + private static IntPtr StringToPtr (string str) { if (str == null) return IntPtr.Zero; - byte[] bytes = Encoding.UTF8.GetBytes (str); + byte[] bytes = Utility.StringToBytes (str); IntPtr buf = Stdlib.malloc ((uint) bytes.Length + 1); Marshal.Copy (bytes, 0, buf, bytes.Length); Marshal.WriteByte (buf, bytes.Length, 0); |