aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-09 21:50:16 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-09 21:50:16 +0900
commita2afe4128082b603add2b2be83f97ff78e0d0169 (patch)
tree7ffc495137a6c1179a67e107a671ce8e6f7abb9b /file.c
parentffd3b8591dcb4b22dc318b6a39bb4e2ac8140f42 (diff)
downloadsubsurface-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.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/file.c b/file.c
index df00ea213..1e58a4afd 100644
--- a/file.c
+++ b/file.c
@@ -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);
}