summaryrefslogtreecommitdiffstats
path: root/datatrak.c
diff options
context:
space:
mode:
authorGravatar Salvador Cuñat <salvador.cunat@gmail.com>2015-03-20 00:14:07 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-23 08:40:48 -0700
commitc8583fcea3e25de7164f63cce7e7eb93cce4b059 (patch)
tree674becb057621fb509257bcc1c3665b7e4467c0d /datatrak.c
parent120088fd16902abd386248eb53e59f88c7591e61 (diff)
downloadsubsurface-c8583fcea3e25de7164f63cce7e7eb93cce4b059.tar.gz
Improve error management
Show error messages in main window, instead of stdout. Use translated strings. Remove redundant error message. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'datatrak.c')
-rw-r--r--datatrak.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/datatrak.c b/datatrak.c
index 573796cfe..7357b053f 100644
--- a/datatrak.c
+++ b/datatrak.c
@@ -140,7 +140,7 @@ static dtrakheader read_file_header(FILE *archivo)
fread(lector, 1, headerbytes, archivo);
if (two_bytes_to_int(lector[0], lector[1]) != 0xA100) {
- puts("Error: the file does not appear to be a DATATRAK divelog");
+ report_error(translate("gettextFromC", "Error: the file does not appear to be a DATATRAK divelog"));
return fileheader;
}
fileheader.header = (lector[0] << 8) + lector[1];
@@ -652,7 +652,7 @@ void datatrak_import(const char *file, struct dive_table *table)
int i = 0;
if ((archivo = subsurface_fopen(file, "rb")) == NULL) {
- puts("Error: couldn't open the file");
+ report_error(translate("gettextFromC", "Error: couldn't open the file %s"), file);
return;
}
@@ -660,14 +660,11 @@ void datatrak_import(const char *file, struct dive_table *table)
* Verify fileheader, get number of dives in datatrak divelog
*/
*fileheader = read_file_header(archivo);
-
- if (fileheader->header == 0)
- puts("Error: not a DATATRAK/WLOG file\n");
while (i < fileheader->divesNum) {
struct dive *ptdive = alloc_dive();
*ptdive = dt_dive_parser(archivo, ptdive);
if (!ptdive)
- puts("Error: no dive\n");
+ report_error(translate("gettextFromC", "Error: no dive"));
i++;
record_dive(ptdive);
}