Re: [Vala] unexpected error while compiling a vala file



On 20 August 2010 08:30, Mildred Ki'Lya <ml mildred593 gmail com> wrote:
Hi,

I'm having troubles to compile the vala file attached to this e-mail.
The command line is:

   valac --pkg=gio-2.0 --pkg=glib-2.0 email.vala

When the lines containing `buffer += c` are commented out (lines 67 and
70), the program compiles.

I use vala 0.9.3 as packaged by the Fedora distribution.
The vala compiler gives me the following errors:

----------------------------------------------------------------------

email.vala:25.13-25.37: warning: unhandled error `GLib.Error'
       if (parent.read (&c, 1, null) == 0){
           ^^^^^^^^^^^^^^^^^^^^^^^^^
email.vala:41.5-41.32: warning: method
`Email.EmailInputStream.push_back_buffer' never used
   public void push_back_buffer (uint8[] buffer) {
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
email.vala:51.5-51.25: warning: method
`Email.EmailInputStream.read_line' never used
   public bool read_line(ref uint8[] buffer){
   ^^^^^^^^^^^^^^^^^^^^^
**
ERROR:valaccodearraymodule.c:1407:vala_ccode_array_module_real_get_array_size_cexpression:
code should not be reached
zsh: abort (core dumped)  valac --pkg=gio-2.0 --pkg=glib-2.0 email.vala

----------------------------------------------------------------------

Apparently, this is an assertion failure in the compiler code that
causes this error.

What do you think of this error? Am I doing wrong things?

By the way, I couldn't find any reference on the built-in operations
available on the vala arrays (buffer.length, buffer.resize(int), buffer
+=, ...)
Where do you think I could find documentation on that ?

Note: I'm using uint8[] instead of string because I just want to
manipulate a stream of bytes that very often looks like a string. I
don't want to deal with encoding problems. Is there a better solution?

Thanks.

Mildred


--
Mildred Ki'Lya
╭───────── mildred593@online.fr ──────────
│ Jabber, GoogleTalk: <mildred jabber fr>
│ Website: <http://ki.lya.online.fr>           GPG ID: 9A7D 2E2B
│ Fingerprint: 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 9A7D 2E2B

_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list



I'm just a noob but what about changing "uint8[] buffer " to
"ArrayList<uint8> buffer" and use buffer.add (c);? (--pkg gee-1.0)

You can still access an arraylist with buffer[i] later for convenience.

Also if you enclose line 26 in in a try/catch that first warning goes away.

try {
        if (parent.read (&c, 1, null) == 0){
          eof = true;
          return false;
        }
    } catch (Error e) {
        error ("%s", e.message);
    }



-- 
Sent from my Amiga



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