Fix:Core:Replaced index with more standard strchr
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 3 Jan 2008 22:55:51 +0000 (22:55 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 3 Jan 2008 22:55:51 +0000 (22:55 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@695 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/src/coord.c
navit/src/navit.c
navit/src/osm2navit.c
navit/src/xmlconfig.c

index 614b017..0d800fc 100644 (file)
@@ -137,15 +137,15 @@ coord_parse(const char *c_str, enum projection pro, struct coord *c_ret)
        enum projection str_pro=projection_none;
 
        dbg(1,"enter('%s',%d,%p)\n", c_str, pro, c_ret);
-       s=index(str,' ');
-       co=index(str,':');
+       s=strchr(str,' ');
+       co=strchr(str,':');
        if (co && co < s) {
                proj=malloc(co-str+1);
                strncpy(proj, str, co-str);
                proj[co-str]='\0';
                dbg(1,"projection=%s\n", proj);
                str=co+1;
-               s=index(str,' ');
+               s=strchr(str,' ');
                if (!strcmp(proj, "mg"))
                        str_pro = projection_mg;
                else if (!strcmp(proj, "garmin"))
index e7e6e3a..df1d92f 100644 (file)
@@ -442,7 +442,7 @@ navit_add_menu_destinations(struct navit *this_, char *name, struct menu *rmen,
                i=name;
                n=name;
                men=rmen;
-               while (h && (i=index(n, '/'))) {
+               while (h && (i=strchr(n, '/'))) {
                        strcpy(buffer2, name);
                        buffer2[i-name]='\0';
                        if (!(nmen=g_hash_table_lookup(h, buffer2))) {
@@ -516,10 +516,10 @@ parse_line(FILE *f, char *buffer, char **name, struct pcoord *c)
        cp[strlen(cp)-1]='\0';
        s=cp+pos+1;
        if (!strncmp(s,"type=", 5)) {
-               i=index(s, '"');
+               i=strchr(s, '"');
                if (i) {
                        s=i+1;
-                       i=index(s, '"');
+                       i=strchr(s, '"');
                        if (i) 
                                *i='\0';
                }
index f6ee46c..d17a2a6 100644 (file)
@@ -148,18 +148,18 @@ build_attrmap_line(char *line)
        gpointer *data;
        GHashTable *key_hash,*value_hash;
        t=line;
-       p=index(t,'\t');
+       p=strchr(t,'\t');
        if (p) {
                while (*p == '\t')
                        *p++='\0';
                k=p;
-               p=index(k,'\t');
+               p=strchr(k,'\t');
        }
        if (p) {
                while (*p == '\t')
                        *p++='\0';
                v=p;
-               p=index(v,'\t');
+               p=strchr(v,'\t');
        }
        if (p) {
                while (*p == '\t')
@@ -196,7 +196,7 @@ build_attrmap(char *map)
        way_key_hash=g_hash_table_new(g_str_hash, g_str_equal);
        node_key_hash=g_hash_table_new(g_str_hash, g_str_equal);
        while (map) {
-               p=index(map,'\n');
+               p=strchr(map,'\n');
                if (p)
                        *p++='\0';
                if (strlen(map))
@@ -276,7 +276,7 @@ xml_get_attribute(char *xml, char *attribute, char *buffer, int buffer_size)
        s=*pos++;
        if (! s)
                return 0;
-       i=index(pos, s);
+       i=strchr(pos, s);
        if (! i)
                return 0;
        if (i - pos > buffer_size)
@@ -751,7 +751,7 @@ phase1(FILE *in, FILE *out_ways, FILE *out_nodes)
        char *p;
        sig_alrm(0);
        while (fgets(buffer, size, in)) {
-               p=index(buffer,'<');
+               p=strchr(buffer,'<');
                if (! p) {
                        fprintf(stderr,"WARNING: wrong line %s\n", buffer);
                        continue;
index 0905df0..120fbbb 100644 (file)
@@ -113,7 +113,7 @@ find_order(struct xmlstate *state, int required, int *min, int *max)
        value=find_attribute(state, "order", required);
        if (! value)
                return 0;
-       pos=index(value, '-');
+       pos=strchr(value, '-');
        if (! pos) {
                ret=sscanf(value,"%d",min);
                *max=*min;