Fix:Android:Corrected and added keycodes
[navit-package] / navit / coord.c
index e482974..af16946 100644 (file)
@@ -192,8 +192,10 @@ coord_parse(const char *c_str, enum projection pro, struct coord *c_ret)
                        goto out;
                }
        }
-       if (! s)
-               return 0;
+       if (! s) {
+               ret=0;
+               goto out;
+       }
        while (*s == ' ') {
                s++;
        }
@@ -220,6 +222,7 @@ coord_parse(const char *c_str, enum projection pro, struct coord *c_ret)
                dbg(1,"lat=%f %c lon=%f %c\n", lat, ns, lng, ew);
                if (args < 4)
                        goto out;
+               dbg(1,"projection=%d str_pro=%d projection_none=%d\n", pro, str_pro, projection_none);
                if (str_pro == projection_none) {
                        g.lat=floor(lat/100);
                        lat-=g.lat*100;
@@ -231,7 +234,9 @@ coord_parse(const char *c_str, enum projection pro, struct coord *c_ret)
                                g.lat=-g.lat;
                        if (ew == 'w' || ew == 'W')
                                g.lng=-g.lng;
+                       dbg(1,"transform_from_geo(%f,%f)",g.lat,g.lng);
                        transform_from_geo(pro, &g, c_ret);
+                       dbg(1,"result 0x%x,0x%x\n", c_ret->x,c_ret->y);
                }
                dbg(3,"str='%s' x=%f ns=%c y=%f ew=%c c=%d\n", str, lng, ns, lat, ew, ret);
                dbg(3,"rest='%s'\n", str+ret);
@@ -251,7 +256,7 @@ coord_parse(const char *c_str, enum projection pro, struct coord *c_ret)
        ret+=str-c_str;
        if (debug) {
                printf("args=%d\n", args);
-               printf("ret=%d delta=%d ret_str='%s'\n", ret, str-c_str, c_str+ret);
+               printf("ret=%d delta=%d ret_str='%s'\n", ret, GPOINTER_TO_INT(str-c_str), c_str+ret);
        }
 out:
        if (proj)
@@ -299,7 +304,7 @@ coord_print(enum projection pro, struct coord *c, FILE *out) {
                y = c->y;
        }
        fprintf( out, "%s: %s0x%x %s0x%x\n",
-                projection_to_name( pro ),
+                projection_to_name( pro , NULL),
                 sign_x, x,
                 sign_y, y );
        return;
@@ -359,4 +364,20 @@ void coord_format(float lat,float lng, enum coord_format fmt, char * buffer, int
        
 }
 
+unsigned int 
+coord_hash(const void *key)
+{
+        const struct coord *c=key;
+       return c->x^c->y;
+}
+
+int
+coord_equal(const void *a, const void *b)
+{
+        const struct coord *c_a=a;
+        const struct coord *c_b=b;
+       if (c_a->x == c_b->x && c_a->y == c_b->y)
+                return TRUE;
+        return FALSE;
+}
 /** @} */