aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
AgeCommit message (Collapse)Author
2012-01-27Import: always open and read the file before checking the filename extensionGravatar Linus Torvalds
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>
2012-01-27Fix typo ('suundo' instead of 'suunto')Gravatar Linus Torvalds
I apparently was so congested that it affected my typing too when I wrote that, and then copy-paste meant that the use and declaration matched despite the misspelling. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-26Add "native" Suunto SDE zip file readingGravatar Linus Torvalds
You need to have libzip-devel installed, and pkg-config needs to know about it for the build to pick up on it. On at least Fedora, a simple "yum install libzip-devel" will make things work, although you may need to force a rebuild of subsurface too (the "file.o" file in particular - the Makefile doesn't track system dependencies). Then, you can just do subsurface my-dives.SDE to read the data directly from the SDE file. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-26Split up file reading from 'parse-xml.c' into 'file.c'Gravatar Linus Torvalds
We're going to eventually import non-xml files too, so let's begin splitting the logic up. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>