Re: strange behavior of DVDFileStat

Bj|rn Englund <[email protected]> Sat, 4 Nov 2006 14:16:08 +0100
Newsgroups gmane.comp.video.ogle.devel
Message-ID <[email protected]>
Thu Oct 26 2006, Vincent Torri wrote:


Hi.

> I fear a corruption of the memory, but I don't know where. There might be 
> a bug in my program too.
> 
> 
> Can someone tell me if there's a bug in my implementation, or if there's a 
> known bug with libdvdread / gtk, or something else ?
> 

The problem is that libdvdread is compiled with large file support
(CFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
and your program is not so off_t/size_t and so on may have different sizes.

You also use the size values in the dvd_stat_t as int when they infact
are off_t.

Your get_size() function returns an int but the size of buf.size is off_t.

Set your CFLAGS to largefile support as above.
Handle the sizes as off_t not int (off_t is probably 64 bit when compiled for
largefile).
Change your treestore to support off_t or use some type that can handle 64bit
gint64 perhaps.
And change your printfs to print 64bit numbers instead of 32 (%ld -> %lld
depending on your platform).
Now everything should work.

Hope this helps.

/Bj|rn