Advertisement
Forage

Created vs generated

Sep 20th, 2011
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.20 KB | None | 0 0
  1. --- /home/forage/Projects/gstreamer-sharp/gstreamer-sharp/GstSharp.PadQueryTypeFunctionNative.cs
  2. +++ /home/forage/Projects/gstreamer-sharp/gstreamer-sharp/generated/GstSharp.PadQueryTypeFunctionNative.cs
  3. @@ -5,11 +5,10 @@
  4.  
  5.     using System;
  6.     using System.Runtime.InteropServices;
  7. -   using System.Collections;
  8.  
  9.  #region Autogenerated code
  10.     [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  11. -   internal delegate IntPtr PadQueryTypeFunctionNative (IntPtr pad);
  12. +   internal delegate int PadQueryTypeFunctionNative(IntPtr pad);
  13.  
  14.     internal class PadQueryTypeFunctionInvoker {
  15.  
  16. @@ -41,47 +40,22 @@
  17.             }
  18.         }
  19.  
  20. -       Gst.QueryType[] InvokeNative (Gst.Pad pad)
  21. +       Gst.QueryType InvokeNative (Gst.Pad pad)
  22.         {
  23. -           IntPtr raw_ret = native_cb (pad == null ? IntPtr.Zero : pad.Handle);
  24. -           if (raw_ret == IntPtr.Zero)
  25. -               return new Gst.QueryType[] {};
  26. -
  27. -           ArrayList result = new ArrayList ();
  28. -           bool term = false;
  29. -           int ofs = 0;
  30. -           while (!term) {
  31. -           Gst.QueryType t = (Gst.QueryType) Marshal.ReadInt32 (raw_ret, ofs);
  32. -               if (t == Gst.QueryType.None) {
  33. -                   term = true;
  34. -               } else {
  35. -                   result.Add (t);
  36. -                   ofs += 4;
  37. -               }
  38. -           }
  39. -
  40. -           return (Gst.QueryType[]) result.ToArray (typeof (Gst.QueryType));
  41. +           Gst.QueryType __result = (Gst.QueryType) native_cb (pad == null ? IntPtr.Zero : pad.Handle);
  42. +           return __result;
  43.         }
  44.     }
  45.  
  46.     internal class PadQueryTypeFunctionWrapper {
  47. -       IntPtr raw_ret = IntPtr.Zero;
  48.  
  49. -       public IntPtr NativeCallback (IntPtr pad)
  50. +       public int NativeCallback (IntPtr pad)
  51.         {
  52.             try {
  53. -               if (raw_ret != IntPtr.Zero)
  54. -                   return raw_ret;
  55. -
  56. -               Gst.QueryType[] __ret = managed (GLib.Object.GetObject (pad) as Gst.Pad);
  57. +               Gst.QueryType __ret = managed (GLib.Object.GetObject(pad) as Gst.Pad);
  58.                 if (release_on_call)
  59.                     gch.Free ();
  60. -               raw_ret = Marshal.AllocHGlobal (4 * __ret.Length + 4);
  61. -               for (int i = 0; i < __ret.Length; i++)
  62. -                   Marshal.WriteInt32 (raw_ret, i * 4, (int) __ret[i]);
  63. -               Marshal.WriteInt32 (raw_ret, __ret.Length * 4, 0);
  64. -
  65. -               return raw_ret;
  66. +               return (int) __ret;
  67.             } catch (Exception e) {
  68.                 GLib.ExceptionManager.RaiseUnhandledException (e, true);
  69.                 // NOTREACHED: Above call does not return.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement