static int open_by_filename(const char *filename, const char *fmt, struct memblock *mem, char **error) { /* Suunto Dive Manager files: SDE */ if (!strcasecmp(fmt, "SDE")) return try_to_open_zip(filename, mem, error); /* divelogs.de files: DLD */ if (!strcasecmp(fmt, "DLD")) return try_to_open_zip(filename, mem, error); #if ONCE_COCHRAN_IS_SUPPORTED /* Truly nasty intentionally obfuscated Cochran Anal software */ if (!strcasecmp(fmt, "CAN")) return try_to_open_cochran(filename, mem, error); #endif /* Cochran export comma-separated-value files */ if (!strcasecmp(fmt, "DPT")) return try_to_open_csv(filename, mem, CSV_DEPTH); if (!strcasecmp(fmt, "TMP")) return try_to_open_csv(filename, mem, CSV_TEMP); if (!strcasecmp(fmt, "HP1")) return try_to_open_csv(filename, mem, CSV_PRESSURE); return 0; }
static int open_by_filename(const char *filename, const char *fmt, struct memblock *mem) { // hack to be able to provide a comment for the translated string static char *csv_warning = QT_TRANSLATE_NOOP3("gettextFromC", "Cannot open CSV file %s; please use Import log file dialog", "'Import log file' should be the same text as corresponding label in Import menu"); /* Suunto Dive Manager files: SDE, ZIP; divelogs.de files: DLD */ if (!strcasecmp(fmt, "SDE") || !strcasecmp(fmt, "ZIP") || !strcasecmp(fmt, "DLD")) return try_to_open_zip(filename, mem); /* CSV files */ if (!strcasecmp(fmt, "CSV")) return report_error(translate("gettextFromC", csv_warning), filename); /* Truly nasty intentionally obfuscated Cochran Anal software */ if (!strcasecmp(fmt, "CAN")) return try_to_open_cochran(filename, mem); /* Cochran export comma-separated-value files */ if (!strcasecmp(fmt, "DPT")) return try_to_open_csv(filename, mem, CSV_DEPTH); if (!strcasecmp(fmt, "LVD")) return try_to_open_liquivision(filename, mem); if (!strcasecmp(fmt, "TMP")) return try_to_open_csv(filename, mem, CSV_TEMP); if (!strcasecmp(fmt, "HP1")) return try_to_open_csv(filename, mem, CSV_PRESSURE); return 0; }
void TestParse::testParseDLD() { struct memblock mem; QString filename = SUBSURFACE_TEST_DATA "/dives/TestDiveDivelogsDE.DLD"; QVERIFY(readfile(filename.toLatin1().data(), &mem) > 0); QVERIFY(try_to_open_zip(filename.toLatin1().data(), &dive_table) > 0); fprintf(stderr, "number of dives from DLD: %d \n", dive_table.nr); // Compare output /* * DC is not cleared from previous tests with the * clear_dive_file_data(), so we do have an additional DC nick * name field on the log. */ QCOMPARE(save_dives("./testdldout.ssrf"), 0); FILE_COMPARE("./testdldout.ssrf", SUBSURFACE_TEST_DATA "/dives/TestDiveDivelogsDE.xml") }