Re: A problem compiling 0.4.4 on ubunty hardy



So, I' trying to find the problem for the error I've described. I guess one of them comes from gio-sharp/gio/generated/DriveAdapter.cs

static bool EjectFinishCallback (IntPtr drive, IntPtr result, out IntPtr error)
        {
            try {
GLib.DriveImplementor __obj = GLib.Object.GetObject (drive, false) as GLib.DriveImplementor;
                error = IntPtr.Zero;
bool result = __obj.EjectFinish (GLib.AsyncResultAdapter.GetObject (result, false));
                return result;
            } catch (Exception e) {
                GLib.ExceptionManager.RaiseUnhandledException (e, true);
                // NOTREACHED: above call does not return.
                throw e;
            }
        }



result is redeclared as bool without including it into parentheses and the code is trying to return it as IntPtr.

After changing the code to

static bool EjectFinishCallback (IntPtr drive, IntPtr result, out IntPtr error)
        {
            try {
GLib.DriveImplementor __obj = GLib.Object.GetObject (drive, false) as GLib.DriveImplementor;
                error = IntPtr.Zero;
bool result1 = __obj.EjectFinish (GLib.AsyncResultAdapter.GetObject (result, false));
                return result1;
            } catch (Exception e) {
                GLib.ExceptionManager.RaiseUnhandledException (e, true);
                // NOTREACHED: above call does not return.
                throw e;
            }
        }

That part of make passed after making several similar corrections to FileAdapter, VolumeAdapter, MountAdapter.


Another problem appeared to be in generated/DataInputStream.cs :

generated/DataInputStream.cs(157,42): error CS1502: The best overloaded method match for `GLib.DataInputStream.g_data_input_stream_read_until(System.IntPtr, System.IntPtr, out System.UIntPtr, System.IntPtr, out System.IntPtr)' has some invalid arguments generated/DataInputStream.cs(151,45): (Location of the symbol related to previous error) generated/DataInputStream.cs(157,42): error CS1620: Argument `3' must be passed with the `out' keyword generated/DataInputStream.cs(160,42): error CS0165: Use of unassigned local variable `native_length'

After correction the function looks:

public unsafe string ReadUntil(string stop_chars, GLib.Cancellable cancellable) { IntPtr native_stop_chars = GLib.Marshaller.StringToPtrGStrdup (stop_chars);
            //UIntPtr native_length;
            IntPtr error = IntPtr.Zero;
UIntPtr length = new UIntPtr ((ulong) System.Text.Encoding.UTF8.GetByteCount (stop_chars)); IntPtr raw_ret = g_data_input_stream_read_until(Handle, native_stop_chars, out length, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
            string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
            GLib.Marshaller.Free (native_stop_chars);
            //length = (ulong) native_length;
            if (error != IntPtr.Zero) throw new GLib.GException (error);
            return ret;
        }

And now I came to the next problem: DriveAdapter.cs has in its string #210:

__obj.Eject ((GLib.MountUnmountFlags) flags, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler, user_data);

while GLib.Eject is defined in Drive.cs as

void Eject (GLib.MountUnmountFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb);

Changing it to

void Eject (GLib.MountUnmountFlags flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb, IntPtr user_data);

makes compiler to complain that the method itself isn't implemented while is defined.

Can dear developers tell me what should I do to compile the program? :)

---
With respect
Alexander Rabtchevich


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]