[PATCH] Associate existing dive site to current dive

Miika Turkia miika.turkia at gmail.com
Sat Feb 14 11:25:43 PST 2015


On Sat, Feb 14, 2015 at 8:46 PM, Dirk Hohndel <dirk at hohndel.org> wrote:

> oops, this messages got stuck in my outbox...
>
> /D
>
> On Sat, Feb 14, 2015 at 11:33:56AM +0200, Miika Turkia wrote:
> > If the dive site exists, we need to associate the uuid to current dive.
> >
> > Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
> > ---
> >  parse-xml.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/parse-xml.c b/parse-xml.c
> > index cfe3459..97d0c09 100644
> > --- a/parse-xml.c
> > +++ b/parse-xml.c
> > @@ -1226,6 +1226,10 @@ static void add_dive_site(char *buffer, struct
> dive *dive)
> >                       } else if (!same_string(ds->name, buffer)) {
> >                               // coin toss, let's just keep the first
> name we found
> >                               fprintf(stderr, "which means the dive
> already links to dive site of different name {%s} / {%s}\n", ds->name,
> buffer);
> > +                     } else {
> > +                             // add the existing dive site to the
> current dive
> > +                             fprintf(stderr, "we have an existing
> location, using {%s}\n", ds->name);
> > +                             dive->dive_site_uuid = uuid;
>
> Read the beginning of the function... if I'm not mistaken, ds is created
> from dive->dive_site_uuid... so there should be no reason to set it again.
> Am I missing something?
>

The attached log (2 dives) has same sites for both of the dives, but
opening it with current master does loose one of the locations. This occurs
during the conversion from old format, thus there is no uuid for the dive
currently being parsed. So we get the uuid by the site name, but never
assign that to the dive in case of duplicate location.

miika
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150214/7ea9b607/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.xml
Type: text/xml
Size: 18072 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150214/7ea9b607/attachment-0001.xml>


More information about the subsurface mailing list