Add some initial cochran CAN file parsing

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>
This commit is contained in:
Linus Torvalds 2012-01-27 12:43:40 -08:00
parent bea6637c03
commit b1a747f537
4 changed files with 174 additions and 7 deletions

10
file.c
View file

@ -6,11 +6,7 @@
#include <errno.h>
#include "dive.h"
struct memblock {
void *buffer;
size_t size;
};
#include "file.h"
static int readfile(const char *filename, struct memblock *mem)
{
@ -104,6 +100,10 @@ static int open_by_filename(const char *filename, const char *fmt, struct memblo
if (!strcasecmp(fmt, "SDE"))
return try_to_open_suunto(filename, mem, error);
/* Truly nasty intentionally obfuscated Cochran Anal software */
if (!strcasecmp(fmt, "CAN"))
return try_to_open_cochran(filename, mem, error);
return 0;
}