]> git.meshlink.io Git - catta/blobdiff - avahi-sharp/ServiceTypeBrowser.cs
l10n: Updated Slovenian translation
[catta] / avahi-sharp / ServiceTypeBrowser.cs
index dbfff7378058dd9fd12247ff05fd03e78def0426..e1356d00a4623cf1a2ddae808972273e6bebcafb 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of avahi.
 
 using System;
 using System.Collections;
 using System.Runtime.InteropServices;
+using System.Text;
 
 namespace Avahi
 {
     internal delegate void ServiceTypeBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
                                                        IntPtr type, IntPtr domain, LookupResultFlags flags,
                                                        IntPtr userdata);
-    
+
     public struct ServiceTypeInfo
     {
         public int NetworkInterface;
@@ -54,7 +53,7 @@ namespace Avahi
     }
 
     public delegate void ServiceTypeInfoHandler (object o, ServiceTypeInfoArgs args);
-    
+
     public class ServiceTypeBrowser : BrowserBase, IDisposable
     {
         private IntPtr handle;
@@ -68,10 +67,10 @@ namespace Avahi
 
         private ArrayList addListeners = new ArrayList ();
         private ArrayList removeListeners = new ArrayList ();
-        
+
         [DllImport ("avahi-client")]
         private static extern IntPtr avahi_service_type_browser_new (IntPtr client, int iface, int proto,
-                                                                     IntPtr domain, LookupFlags flags,
+                                                                     byte[] domain, LookupFlags flags,
                                                                      ServiceTypeBrowserCallback cb,
                                                                      IntPtr userdata);
 
@@ -89,7 +88,7 @@ namespace Avahi
                 Stop (false);
             }
         }
-        
+
         public event ServiceTypeInfoHandler ServiceTypeRemoved
         {
             add {
@@ -143,10 +142,12 @@ namespace Avahi
                 return;
 
             lock (client) {
-                IntPtr domainPtr = Utility.StringToPtr (domain);
-                handle = avahi_service_type_browser_new (client.Handle, iface, (int) proto, domainPtr, flags,
+                handle = avahi_service_type_browser_new (client.Handle, iface, (int) proto,
+                                                         Utility.StringToBytes (domain), flags,
                                                          cb, IntPtr.Zero);
-                Utility.Free (domainPtr);
+
+                if (handle == IntPtr.Zero)
+                    client.ThrowError ();
             }
         }