]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Import: always open and read the file before checking the filename extension
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 27 Jan 2012 18:56:36 +0000 (10:56 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 27 Jan 2012 18:56:36 +0000 (10:56 -0800)
Most of the parsers will want the content in memory, so keep them
simple.  The fact that the Suunto parser uses "libzip" that has to
re-open the file is annoying and causes us to re-open the file etc.

But it's the odd man out, so don't design the "open_by_filename()"
function around it.  Pretty much everybody else will want to avoid
having to cook up their own IO routines.

Also, when reading the file, NUL-terminate the buffer.  This allows us
to just treat text files as large strings if we want to, and doesn't
matter for binary files (we still pass in the length explicitly).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

No differences found