diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-10-09 21:50:16 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-10-09 21:50:16 +0900 |
commit | a2afe4128082b603add2b2be83f97ff78e0d0169 (patch) | |
tree | 7ffc495137a6c1179a67e107a671ce8e6f7abb9b /file.c | |
parent | ffd3b8591dcb4b22dc318b6a39bb4e2ac8140f42 (diff) | |
download | subsurface-a2afe4128082b603add2b2be83f97ff78e0d0169.tar.gz |
A file that we import should never become the default file we save to
Only files that are opened should be considered r/w. Files that are
imported should be treated as if they were r/o.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -71,7 +71,7 @@ static void suunto_read(struct zip_file *file, GError **error) size = read * 3 / 2; mem = realloc(mem, size); } - parse_xml_buffer("SDE file", mem, read, error); + parse_xml_buffer("SDE file", mem, read, error, FALSE); free(mem); } #endif @@ -239,16 +239,17 @@ static int open_by_filename(const char *filename, const char *fmt, struct memblo return 0; } -static void parse_file_buffer(const char *filename, struct memblock *mem, GError **error) +static void parse_file_buffer(const char *filename, struct memblock *mem, GError **error, + gboolean possible_default_filename) { char *fmt = strrchr(filename, '.'); if (fmt && open_by_filename(filename, fmt+1, mem, error)) return; - parse_xml_buffer(filename, mem->buffer, mem->size, error); + parse_xml_buffer(filename, mem->buffer, mem->size, error, possible_default_filename); } -void parse_file(const char *filename, GError **error) +void parse_file(const char *filename, GError **error, gboolean possible_default_filename) { struct memblock mem; @@ -267,6 +268,6 @@ void parse_file(const char *filename, GError **error) return; } - parse_file_buffer(filename, &mem, error); + parse_file_buffer(filename, &mem, error, possible_default_filename); free(mem.buffer); } |