static int parse_site_entry(git_repository *repo, const git_tree_entry *entry, const char *suffix) { if (*suffix == '\0') return report_error("Dive site without uuid"); uint32_t uuid = strtoul(suffix, NULL, 16); struct dive_site *ds = alloc_or_get_dive_site(uuid); git_blob *blob = git_tree_entry_blob(repo, entry); if (!blob) return report_error("Unable to read dive site file"); for_each_line(blob, site_parser, ds); git_blob_free(blob); return 0; }
int TestParse::parseDivingLog() { // Parsing of DivingLog import from SQLite database struct dive_site *ds = alloc_or_get_dive_site(0xdeadbeef); ds->name = copy_string("Suomi - - Hälvälä"); int ret = sqlite3_open(SUBSURFACE_TEST_DATA "/dives/TestDivingLog4.1.1.sql", &_sqlite3_handle); if (ret == 0) ret = parse_divinglog_buffer(_sqlite3_handle, 0, 0, 0, &dive_table); else fprintf(stderr, "Can't open sqlite3 db: " SUBSURFACE_TEST_DATA "/dives/TestDivingLog4.1.1.sql"); return ret; }