summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.c12
-rw-r--r--divelist.c7
2 files changed, 15 insertions, 4 deletions
diff --git a/dive.c b/dive.c
index dad0e237b..cd797d276 100644
--- a/dive.c
+++ b/dive.c
@@ -239,16 +239,26 @@ struct dive *fixup_dive(struct dive *dive)
int i;
double depthtime = 0;
int lasttime = 0;
+ int lastindex = -1;
int start = -1, end = -1;
int maxdepth = 0, mintemp = 0;
int lastdepth = 0;
- int lasttemp = 0;
+ int lasttemp = 0, lastpressure = 0;
for (i = 0; i < dive->samples; i++) {
struct sample *sample = dive->sample + i;
int time = sample->time.seconds;
int depth = sample->depth.mm;
int temp = sample->temperature.mkelvin;
+ int pressure = sample->cylinderpressure.mbar;
+ int index = sample->cylinderindex;
+
+ /* Remove duplicate redundant pressure information */
+ if (pressure == lastpressure && index == lastindex)
+ sample->cylinderpressure.mbar = 0;
+
+ lastindex = index;
+ lastpressure = pressure;
if (lastdepth)
end = time;
diff --git a/divelist.c b/divelist.c
index 81779f06d..60ad16a7f 100644
--- a/divelist.c
+++ b/divelist.c
@@ -351,8 +351,8 @@ static void get_string(char **str, const char *s)
if (!s)
s = "";
len = strlen(s);
- if (len > 40)
- len = 40;
+ if (len > 60)
+ len = 60;
n = malloc(len+1);
memcpy(n, s, len);
n[len] = 0;
@@ -457,7 +457,8 @@ static void fill_dive_list(void)
store = GTK_LIST_STORE(dive_list.model);
- for (i = 0; i < dive_table.nr; i++) {
+ i = dive_table.nr;
+ while (--i >= 0) {
struct dive *dive = dive_table.dives[i];
update_cylinder_related_info(dive);