From: Linus Torvalds Date: Sun, 11 Sep 2011 18:36:33 +0000 (-0700) Subject: Fix up dive number naming X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=1cc62d581158d52252f2ad7ef076811129510141;p=ext%2Fsubsurface.git Fix up dive number naming Use "dive->number" instead of "dive->nr". And make the XML match too. Signed-off-by: Linus Torvalds --- diff --git a/dive.h b/dive.h index 3b5e5ab..3ed233d 100644 --- a/dive.h +++ b/dive.h @@ -128,7 +128,7 @@ struct sample { #define MAX_CYLINDERS (8) struct dive { - int nr; + int number; time_t when; char *location; char *notes; diff --git a/info.c b/info.c index 32b830d..b65a820 100644 --- a/info.c +++ b/info.c @@ -118,8 +118,8 @@ void show_dive_info(struct dive *dive) gtk_entry_set_text(location, text); len = 0; - if (dive->nr) - len = snprintf(buffer, sizeof(buffer), "%d. ", dive->nr); + if (dive->number) + len = snprintf(buffer, sizeof(buffer), "%d. ", dive->number); snprintf(buffer+len, sizeof(buffer)-len, "%s", text); gtk_label_set_text(GTK_LABEL(locationnote), buffer); diff --git a/parse-xml.c b/parse-xml.c index a71ff23..b5f86fa 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -609,8 +609,7 @@ static void divinglog_place(char *place, void *_location) static int divinglog_dive_match(struct dive *dive, const char *name, int len, char *buf) { - return MATCH(".id", get_index, &dive->nr) || - MATCH(".divedate", divedate, &dive->when) || + return MATCH(".divedate", divedate, &dive->when) || MATCH(".entrytime", divetime, &dive->when) || MATCH(".depth", depth, &dive->maxdepth) || MATCH(".tanksize", cylindersize, &dive->cylinder[0].type.size) || @@ -877,7 +876,7 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf) break; } - if (MATCH(".nr", get_index, &dive->nr)) + if (MATCH(".number", get_index, &dive->number)) return; if (MATCH(".date", divedate, &dive->when)) return; diff --git a/save-xml.c b/save-xml.c index e47092e..3ed67fe 100644 --- a/save-xml.c +++ b/save-xml.c @@ -206,8 +206,8 @@ static void save_dive(FILE *f, struct dive *dive) struct tm *tm = gmtime(&dive->when); fputs("nr) - fprintf(f, " nr='%d'", dive->nr); + if (dive->number) + fprintf(f, " number='%d'", dive->number); fprintf(f, " date='%04u-%02u-%02u'", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday); fprintf(f, " time='%02u:%02u:%02u'",