mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
ffd3b8591d
commit
a2afe41280
5 changed files with 18 additions and 14 deletions
11
file.c
11
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue