bump

On Sat, Jan 30, 2016 at 12:57 PM, Miika Turkia <[email protected]> wrote:
> We used to mark CCR dives by having "SP change" event at time 0:00.
> As we nowadays mark CCR dives by setting dc->divemode appropriately,
> better to convert the old dives to this format as well. This way we do
> not have to take the special old format into account on multiple places
> in the source.
>
> Signed-off-by: Miika Turkia <[email protected]>
> ---
>  subsurface-core/load-git.c  | 11 +++++++++++
>  subsurface-core/parse-xml.c |  9 +++++++++
>  2 files changed, 20 insertions(+)
>
> diff --git a/subsurface-core/load-git.c b/subsurface-core/load-git.c
> index f6b9f73..de7af80 100644
> --- a/subsurface-core/load-git.c
> +++ b/subsurface-core/load-git.c
> @@ -9,6 +9,7 @@
>  #include <unistd.h>
>  #include <fcntl.h>
>  #include <git2.h>
> +#include <libdivecomputer/parser.h>
>
>  #include "gettext.h"
>
> @@ -744,6 +745,16 @@ static void parse_dc_event(char *line, struct membuffer 
> *str, void *_dc)
>         if (str->len)
>                 name = mb_cstring(str);
>         ev = add_event(dc, event.time.seconds, event.type, event.flags, 
> event.value, name);
> +
> +       /*
> +        * Older logs might mark the dive to be CCR by having an "SP change" 
> event at time 0:00.
> +        * Better to mark them being CCR on import so no need for special 
> treatments elsewhere on
> +        * the code.
> +        */
> +       if (ev && event.time.seconds == 0 && event.type == SAMPLE_EVENT_PO2 
> && dc->divemode==OC) {
> +               dc->divemode = CCR;
> +       }
> +
>         if (ev && event_is_gaschange(ev)) {
>                 /*
>                  * We subtract one here because "0" is "no index",
> diff --git a/subsurface-core/parse-xml.c b/subsurface-core/parse-xml.c
> index 93ce743..4cea435 100644
> --- a/subsurface-core/parse-xml.c
> +++ b/subsurface-core/parse-xml.c
> @@ -1651,6 +1651,15 @@ static void event_end(void)
>                         ev = add_event(dc, cur_event.time.seconds,
>                                        cur_event.type, cur_event.flags,
>                                        cur_event.value, cur_event.name);
> +
> +                       /*
> +                        * Older logs might mark the dive to be CCR by having 
> an "SP change" event at time 0:00. Better
> +                        * to mark them being CCR on import so no need for 
> special treatments elsewhere on the code.
> +                        */
> +                       if (ev && cur_event.time.seconds == 0 && 
> cur_event.type == SAMPLE_EVENT_PO2 && dc->divemode==OC) {
> +                               dc->divemode = CCR;
> +                       }
> +
>                         if (ev && event_is_gaschange(ev)) {
>                                 /* See try_to_fill_event() on why the 
> filled-in index is one too big */
>                                 ev->gas.index = cur_event.gas.index-1;
> --
> 2.5.0
>
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to