Re: [Vala] [Fwd: Binary File is not seekable ?!?]

2013-10-28 Thread raum
from http://valadoc.org/#!api=gio-2.0/GLib.Seekable
seek on FileIOStream run without error but seeking with DataInputStream
throw an error but none on Windows... :-?
I will try to change my source code to test.

code sample.vala
public static int main (string[] args) {
File file = File.new_for_path (my-test.txt);

try {
FileIOStream ios =  file.open_readwrite();

// no error
assert (ios.can_seek ());
// no error
ios.seek (11, SeekType.SET);

InputStream @is = ios.input_stream;
DataInputStream dis = new DataInputStream (@is);

string line;
while ((line = dis.read_line ()) != null) {
stdout.puts (line);
stdout.putc ('\n');
}

// display error
dis.seek(0,SeekType.SET);

} catch (Error e) {
stdout.printf (Error: %s\n, e.message);
}

return 0;
}


OUTPUT

$ cat my-test.txt
My first line
My second line

$ valac --pkg gio-2.0 sample.vala
cyriac@arche:~/src$ ./sample
ne
My second line

(process:29159): GLib-GIO-CRITICAL **: g_seekable_seek: assertion
`G_IS_SEEKABLE (seekable)' failed

 I've downloaded source tarball of Vala 0.22, compiled and install it but
 no effect... :-/

 I was wondering if it was not a system problem. But I can not admit that I
 would have to reinstall linux to make it work. I'll search for reinstall
 only glib

 Thanks

 Raum

 Seems like it is problem with glib2 package, try to reinstall it, I
 can't
 say how it exactly called in Ubuntu, because I'm not an Ubuntu user.
  
  
  
   From:
 raum@no-log.orgSent:
 ??,
 26
 ??
 2013
 ?.
 22:17To:
 vala-list@gnome.orgSubject:
 Re:
 [Vala]
 [Fwd:
 Binary
 File
 is
 not
 seekable
 ?!?]
 Hello,

 Let me explain. I want to create a tool for Linux and Windows.

 I need to open a binary file and seek to a position... With MingW on
 Windows, it runs without error but on Linux, I've a seekable error
 with
 the same code, same compile options, etc.

 I dont understand why...

 # Code

  public void main() {
 try {
File file = File.new_for_path (test.pcap);
DataInputStream dis = new DataInputStream (file.read ());
stdout.printf(seekable: %s\n,(dis.can_seek())?true:false);
 } catch (Error e) {
 }
  }

 # WINDOWS 32bits / MingW32

 $ valac --pkg gio-2.0 seek.vala
 $ ./seek
 seekable: true

 ## LINUX -Ubuntu 13.03- 64 bits

 $ valac --pkg gio-2.0 seek.vala
 $ ./seek
 (process:8097): GLib-GIO-CRITICAL **: g_seekable_can_seek: assertion
 `G_IS_SEEKABLE (seekable)' failed
 seekable: false


 Do you have an idea why it's running on Windows but not on Linux ?

 Thanks

 Raum
 ___
 vala-list mailing list

 https://mail.gnome.org/mailman/listinfo/vala-list


 ___
 vala-list mailing list
 vala-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/vala-list


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Fwd: Binary File is not seekable ?!?]

2013-10-27 Thread raum
I've downloaded source tarball of Vala 0.22, compiled and install it but
no effect... :-/

I was wondering if it was not a system problem. But I can not admit that I
would have to reinstall linux to make it work. I'll search for reinstall
only glib

Thanks

Raum

 Seems like it is problem with glib2 package, try to reinstall it, I can't
 say how it exactly called in Ubuntu, because I'm not an Ubuntu user.
   
   
  
 From:
 raum@no-log.orgSent:
 ??,
 26
 ??
 2013
 ?.
 22:17To:
 vala-list@gnome.orgSubject:
 Re:
 [Vala]
 [Fwd:
 Binary
 File
 is
 not
 seekable
 ?!?]
 Hello,

 Let me explain. I want to create a tool for Linux and Windows.

 I need to open a binary file and seek to a position... With MingW on
 Windows, it runs without error but on Linux, I've a seekable error with
 the same code, same compile options, etc.

 I dont understand why...

 # Code

  public void main() {
 try {
File file = File.new_for_path (test.pcap);
DataInputStream dis = new DataInputStream (file.read ());
stdout.printf(seekable: %s\n,(dis.can_seek())?true:false);
 } catch (Error e) {
 }
  }

 # WINDOWS 32bits / MingW32

 $ valac --pkg gio-2.0 seek.vala
 $ ./seek
 seekable: true

 ## LINUX -Ubuntu 13.03- 64 bits

 $ valac --pkg gio-2.0 seek.vala
 $ ./seek
 (process:8097): GLib-GIO-CRITICAL **: g_seekable_can_seek: assertion
 `G_IS_SEEKABLE (seekable)' failed
 seekable: false


 Do you have an idea why it's running on Windows but not on Linux ?

 Thanks

 Raum
 ___
 vala-list mailing list

 https://mail.gnome.org/mailman/listinfo/vala-list


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Fwd: Binary File is not seekable ?!?]

2013-10-26 Thread raum
Hello,

Let me explain. I want to create a tool for Linux and Windows.

I need to open a binary file and seek to a position... With MingW on
Windows, it runs without error but on Linux, I've a seekable error with
the same code, same compile options, etc.

I dont understand why...

# Code

 public void main() {
try {
   File file = File.new_for_path (test.pcap);
   DataInputStream dis = new DataInputStream (file.read ());
   stdout.printf(seekable: %s\n,(dis.can_seek())?true:false);
} catch (Error e) {
}
 }

# WINDOWS 32bits / MingW32

$ valac --pkg gio-2.0 seek.vala
$ ./seek
seekable: true

## LINUX -Ubuntu 13.03- 64 bits

$ valac --pkg gio-2.0 seek.vala
$ ./seek
(process:8097): GLib-GIO-CRITICAL **: g_seekable_can_seek: assertion
`G_IS_SEEKABLE (seekable)' failed
seekable: false


Do you have an idea why it's running on Windows but not on Linux ?

Thanks

Raum
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Fwd: Binary File is not seekable ?!?]

2013-10-26 Thread Jonathan Hudson
On Sat, 26 Oct 2013 21:17:04 +0200,
r...@no-log.org wrote:

Do you have an idea why it's running on Windows but not on Linux ?

Your linux installation appears strangely broken. The example code
runs fine on Arch ia32, x86_64, arm7 and Ubuntu 13.04 (ia32, x86_64)
for me.

-jh




___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [Fwd: Binary File is not seekable ?!?]

2013-10-25 Thread raum
Hello

Under MingW / Windows, I've this :

$ valac --pkg gio-2.0 seek.vala
(...)/seek.vala.c: In function 'main':
(...)/seek.vala.c:80:2: warning: 'g_type_init' is deprecated (declared at
D:/cross-compile/opt/include/glib-2.0/gobject
/gtype.h:669) [-Wdeprecated-declarations]

$ ./seek
seekable: true

What's going wrong ? o_O

Thanks

raum

 Message original 
Objet:   [Fwd: Binary File is not seekable ?!?]
De:  r...@no-log.org
Date:Ven 25 octobre 2013 8:51
À:   vala-list@gnome.org
--

ps: the mailing list seems to have a problem. I've posted this message
three times, I hope it appears ;) Sorry if you received it earlier.

Hello,

I'm trying to seek in a binary file...  Under MingW / Windows, I've no
problem but with linux I've a G_IS_SEEKABLE failed error :

Example of code seek.vala :
public void main() {
   try {
  File file = File.new_for_path (test.pcap);
  DataInputStream dis = new DataInputStream (file.read ());
  stdout.printf(seekable: %s\n,(dis.can_seek())?true:false);
   } catch (Error e) {
   }
}

Output :
$ ./seek

(process:8097): GLib-GIO-CRITICAL **: g_seekable_can_seek: assertion
`G_IS_SEEKABLE (seekable)' failed
seekable: false

Where am I wrong ? DataIntputStream has seekable interface...

Thanks

Regards

Raum



___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list