[Top][All Lists]

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

Re: seekg calls in ls-mat5.cc

From: David Bateman
Subject: Re: seekg calls in ls-mat5.cc
Date: Fri, 22 Apr 2005 09:40:55 +0200
User-agent: Mozilla Thunderbird 0.8 (X11/20040923)

John W. Eaton wrote:

There are a number of places in ls-mat5.cc where we have things like

  is.seekg (tmp_pos + static_cast<std::streamoff> (PAD (len)));

This seems risky to me because I don't think there is any guarantee
that a cast from an integer type to a std::streamoff type is
guaranteed to work (std::streamoff might not be implemented with a
simple integer data type).

Is it really necessary to save and restore the file position when
reading MAT files or is there another way that we could implement
these functions to avoid all the calls to seekg?


The seekg's in ls-mat5.cc are all to seek to a particular byte position in a file, to either take into account the padding, to skip an unknown length header, or an element that could not be read. The padding might easily be handled since we know the length we read and can just read a block that we don't use. However, the other two cases are harder to see what might be done, and in fact I have no solution..

You'll note I removed all of the seekp's recently..


David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary

reply via email to

[Prev in Thread] Current Thread [Next in Thread]