aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
AgeCommit message (Collapse)Author
2012-01-27Add some initial cochran CAN file parsingGravatar Linus Torvalds
It's broken, and currently only writes out a debug output file per dive. I'm not sure I'll ever really be able to decode the mess that is the Cochran ANalyst stuff, but I have a few test files, along with separate depth info from a couple of the dives in question, so in case this ever works I can at least validate it to some degree. The file format is definitely very intentionally obscured, though. Annoying. It's not like the Cochran software is actually all that good (it's really quite a horribly nasty Windows-only app, I'm told). Cochran Analyst is very much not the reason why people would buy those computers. So Cochran making their computers harder to use with other software is just stupid. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>