Ticket #922: vehicle_gypsy-fixes.diff

File vehicle_gypsy-fixes.diff, 1.6 KB (added by claudio bley, 8 years ago)
  • navit/vehicle/gypsy/vehicle_gypsy.c

     
    4747#include "item.h"
    4848#include "vehicle.h"
    4949
     50/* knots to km/h */
     51#define KNOTS_TO_KMPH (1.852)
     52
    5053static struct vehicle_priv {
    5154        char *source;
    5255        GypsyControl *control;
     
    230233
    231234        if (fields & GYPSY_COURSE_FIELDS_SPEED)
    232235        {
    233                 priv->speed = speed;
     236                priv->speed = speed * KNOTS_TO_KMPH; // Gypsy reports speed in knots, convert to km/h
    234237                cb = TRUE;
    235238        }
    236239        if (fields & GYPSY_COURSE_FIELDS_DIRECTION)
     
    263266        priv->control = gypsy_control_get_default();
    264267        priv->path = gypsy_control_create(priv->control, source+8, &error);
    265268        if (priv->path == NULL) {
    266                 g_warning ("Error creating gypsy conrtol path for %s: %s", source+8, error->message);
     269                g_warning ("Error creating gypsy control path for %s: %s", source+8, error->message);
    267270                return TRUE;
    268271        }
    269272       
     
    322325        if (priv->path)
    323326                g_free(priv->path);
    324327       
    325         if (priv->position)
    326                 g_free(priv->position);
    327        
    328         if (priv->satellite)
    329                 g_free(priv->satellite);
    330 
    331         if (priv->course)
    332                 g_free(priv->course);
    333 
    334         if (priv->device)
    335                 g_free(priv->device);
    336        
    337         if (priv->control)
    338                 g_object_unref(G_OBJECT (priv->control));
     328        if (priv->position)  g_object_unref(priv->position);
     329        if (priv->satellite) g_object_unref(priv->satellite);
     330        if (priv->course)    g_object_unref(priv->course);
     331        if (priv->device)    g_object_unref(priv->device);
     332        if (priv->control)   g_object_unref(priv->control);
    339333}
    340334
    341335/**