From 1c0cd42fd0965fe2856235f5ddd40ad16d40ab17 Mon Sep 17 00:00:00 2001 From: martin-s Date: Thu, 3 Jan 2008 22:55:51 +0000 Subject: [PATCH] Fix:Core:Replaced index with more standard strchr git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@695 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/src/coord.c | 6 +++--- navit/src/navit.c | 6 +++--- navit/src/osm2navit.c | 12 ++++++------ navit/src/xmlconfig.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/navit/src/coord.c b/navit/src/coord.c index 614b017..0d800fc 100644 --- a/navit/src/coord.c +++ b/navit/src/coord.c @@ -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")) diff --git a/navit/src/navit.c b/navit/src/navit.c index e7e6e3a..df1d92f 100644 --- a/navit/src/navit.c +++ b/navit/src/navit.c @@ -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'; } diff --git a/navit/src/osm2navit.c b/navit/src/osm2navit.c index f6ee46c..d17a2a6 100644 --- a/navit/src/osm2navit.c +++ b/navit/src/osm2navit.c @@ -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; diff --git a/navit/src/xmlconfig.c b/navit/src/xmlconfig.c index 0905df0..120fbbb 100644 --- a/navit/src/xmlconfig.c +++ b/navit/src/xmlconfig.c @@ -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; -- 2.7.4