Add suit field for CSV import

Fixes #853

[Dirk Hohndel: fixed test compile]

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2015-04-24 08:39:20 -04:00 committed by Dirk Hohndel
parent 415abeea66
commit c80d1879b7
5 changed files with 22 additions and 7 deletions

12
file.c
View file

@ -1016,18 +1016,18 @@ int parse_seabear_csv_file(const char *filename, int timef, int depthf, int temp
int parse_manual_file(const char *filename, int sepidx, int units, int dateformat, int durationformat,
int numberf, int datef, int timef, int durationf, int locationf, int gpsf, int maxdepthf, int meandepthf,
int divemasterf, int buddyf, int notesf, int weightf, int tagsf, int cylsizef, int startpresf, int endpresf,
int divemasterf, int buddyf, int suitf, int notesf, int weightf, int tagsf, int cylsizef, int startpresf, int endpresf,
int o2f, int hef, int airtempf, int watertempf)
{
if (verbose > 4) {
fprintf(stderr, "filename %s, sepidx %d, units %d, dateformat %d, durationformat %d\n", filename, sepidx, units, dateformat, durationformat);
fprintf(stderr, "numberf %d, datef %d, timef %d, durationf %d, locationf %d, gpsf %d, maxdepthf %d, meandepthf %d\n", numberf, datef, timef, durationf, locationf, gpsf, maxdepthf, meandepthf);
fprintf(stderr, "divemasterf %d, buddyf %d, notesf %d, weightf %d, tagsf %d, cylsizef %d, startpresf %d, endpresf %d\n", divemasterf, buddyf, notesf, weightf, tagsf, cylsizef, startpresf, endpresf);
fprintf(stderr, "divemasterf %d, buddyf %d, suitf %d, notesf %d, weightf %d, tagsf %d, cylsizef %d, startpresf %d, endpresf %d\n", divemasterf, buddyf, suitf, notesf, weightf, tagsf, cylsizef, startpresf, endpresf);
fprintf(stderr, "o2f %d, hef %d, airtempf %d, watertempf %d\n", o2f, hef, airtempf, watertempf);
}
struct memblock mem;
int pnr = 0;
char *params[53];
char *params[55];
char numberbuf[MAXCOLDIGITS];
char datebuf[MAXCOLDIGITS];
char timebuf[MAXCOLDIGITS];
@ -1038,6 +1038,7 @@ int parse_manual_file(const char *filename, int sepidx, int units, int dateforma
char meandepthbuf[MAXCOLDIGITS];
char divemasterbuf[MAXCOLDIGITS];
char buddybuf[MAXCOLDIGITS];
char suitbuf[MAXCOLDIGITS];
char notesbuf[MAXCOLDIGITS];
char weightbuf[MAXCOLDIGITS];
char tagsbuf[MAXCOLDIGITS];
@ -1058,7 +1059,7 @@ int parse_manual_file(const char *filename, int sepidx, int units, int dateforma
char curtime[6];
int ret;
if (numberf >= MAXCOLS || datef >= MAXCOLS || timef >= MAXCOLS || durationf >= MAXCOLS || locationf >= MAXCOLS || gpsf >= MAXCOLS || maxdepthf >= MAXCOLS || meandepthf >= MAXCOLS || buddyf >= MAXCOLS || notesf >= MAXCOLS || weightf >= MAXCOLS || tagsf >= MAXCOLS || cylsizef >= MAXCOLS || startpresf >= MAXCOLS || endpresf >= MAXCOLS || o2f >= MAXCOLS || hef >= MAXCOLS || airtempf >= MAXCOLS || watertempf >= MAXCOLS)
if (numberf >= MAXCOLS || datef >= MAXCOLS || timef >= MAXCOLS || durationf >= MAXCOLS || locationf >= MAXCOLS || gpsf >= MAXCOLS || maxdepthf >= MAXCOLS || meandepthf >= MAXCOLS || buddyf >= MAXCOLS || suitf >= MAXCOLS || notesf >= MAXCOLS || weightf >= MAXCOLS || tagsf >= MAXCOLS || cylsizef >= MAXCOLS || startpresf >= MAXCOLS || endpresf >= MAXCOLS || o2f >= MAXCOLS || hef >= MAXCOLS || airtempf >= MAXCOLS || watertempf >= MAXCOLS)
return report_error(translate("gettextFromC", "Maximum number of supported columns on CSV import is %d"), MAXCOLS);
snprintf(numberbuf, MAXCOLDIGITS, "%d", numberf);
@ -1071,6 +1072,7 @@ int parse_manual_file(const char *filename, int sepidx, int units, int dateforma
snprintf(meandepthbuf, MAXCOLDIGITS, "%d", meandepthf);
snprintf(divemasterbuf, MAXCOLDIGITS, "%d", divemasterf);
snprintf(buddybuf, MAXCOLDIGITS, "%d", buddyf);
snprintf(suitbuf, MAXCOLDIGITS, "%d", suitf);
snprintf(notesbuf, MAXCOLDIGITS, "%d", notesf);
snprintf(weightbuf, MAXCOLDIGITS, "%d", weightf);
snprintf(tagsbuf, MAXCOLDIGITS, "%d", tagsf);
@ -1113,6 +1115,8 @@ int parse_manual_file(const char *filename, int sepidx, int units, int dateforma
params[pnr++] = divemasterbuf;
params[pnr++] = "buddyField";
params[pnr++] = buddybuf;
params[pnr++] = "suitField";
params[pnr++] = suitbuf;
params[pnr++] = "notesField";
params[pnr++] = notesbuf;
params[pnr++] = "weightField";