summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhorwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220>2006-09-25 10:43:54 +0000
committerhorwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220>2006-09-25 10:43:54 +0000
commit3eaac43cff4a07fefa3568ec91cb2cec63f619b7 (patch)
treeb5842ea7d3a49f9b96c1ad442190003e4e2ab5f5 /src
parent002a8b51293331a58a9d12d3b971e68744f8fcc6 (diff)
downloadnavit-3eaac43cff4a07fefa3568ec91cb2cec63f619b7.tar.gz
Change get_* to get_u8, get_u16, get_u24, get_u32. Fix some compile warnings.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@105 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'src')
-rw-r--r--src/block.c14
-rw-r--r--src/data.h14
-rw-r--r--src/debug.c2
-rw-r--r--src/street.c32
-rw-r--r--src/street_name.c30
-rw-r--r--src/town.c24
-rw-r--r--src/tree.c2
7 files changed, 59 insertions, 59 deletions
diff --git a/src/block.c b/src/block.c
index 8081e92fa..3e77431ba 100644
--- a/src/block.c
+++ b/src/block.c
@@ -72,8 +72,8 @@ block_binarytree_walk(struct block **block, unsigned char **p, struct coord *c,
*block=block_get_byindex(blk_inf->file, (*block)->next, p);
*p-=20;
}
- blk_num=get_long(p);
- val=get_long(p);
+ blk_num=get_u32(p);
+ val=get_u32(p);
if (blk_num != -1)
ret++;
@@ -122,10 +122,10 @@ block_file_private_setup(struct file *file)
p=file->begin+0x0c;
while (*p) {
str=get_string(&p);
- len=get_long(&p);
+ len=get_u32(&p);
t=p;
if (! strcmp(str,"binaryTree")) {
- file_priv->binarytree=get_long(&t);
+ file_priv->binarytree=get_u32(&t);
}
p+=len;
}
@@ -173,7 +173,7 @@ block_foreach_visible(struct block_info *blk_inf, struct transformation *t, int
int dummy1,dummy2,xy,i,count;
struct block *block=block_get_byindex(blk_inf->file, file_priv->binarytree, &p);
p2=p;
- dummy1=get_long(&p2);
+ dummy1=get_u32(&p2);
if (block->count != -1 || dummy1 != -1) {
printf("ERROR2 0x%x\n", block->count);
}
@@ -181,8 +181,8 @@ block_foreach_visible(struct block_info *blk_inf, struct transformation *t, int
p=p2;
for (i = 0 ; i < limit ; i++) {
p2=p;
- dummy1=get_long(&p2);
- dummy2=get_long(&p2);
+ dummy1=get_u32(&p2);
+ dummy2=get_u32(&p2);
assert((dummy1 == -1 && dummy2 == -1) || i < 32) ;
if (block->c[0].x > block->c[1].x || block->c[1].y > block->c[0].y)
break;
diff --git a/src/data.h b/src/data.h
index 075eaa6e0..8d4b1b70d 100644
--- a/src/data.h
+++ b/src/data.h
@@ -1,28 +1,28 @@
static inline unsigned char
-get_char(unsigned char **p)
+get_u8(unsigned char **p)
{
return *((*p)++);
}
static inline unsigned short
-get_short(unsigned char **p) {
+get_u16(unsigned char **p) {
unsigned long ret;
ret=*((unsigned short *)*p);
*p+=sizeof(unsigned short);
return ret;
}
-static inline unsigned long
-get_triple(unsigned char **p) {
+static inline unsigned int
+get_u24(unsigned char **p) {
unsigned long ret;
- ret=get_short(p);
+ ret=get_u16(p);
ret|=*((*p)++) << 16;
return ret;
}
-static inline unsigned long
-get_long(unsigned char **p) {
+static inline unsigned int
+get_u32(unsigned char **p) {
unsigned long ret;
ret=*((unsigned int *)*p);
*p+=sizeof(unsigned int);
diff --git a/src/debug.c b/src/debug.c
index 3c19218e1..5fbe60353 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -7,7 +7,7 @@
-static int sigsegv(void)
+static void sigsegv(int sig)
{
FILE *f;
time_t t;
diff --git a/src/street.c b/src/street.c
index c695e64a5..85633d3ef 100644
--- a/src/street.c
+++ b/src/street.c
@@ -507,29 +507,29 @@ street_get_param(struct segment *seg, struct param_list *param, int count, int v
int tag;
int k, segs;
printf("\n");
- printf("Len 0x%x\n",get_short(&stn));
+ printf("Len 0x%x\n",get_u16(&stn));
tag=*stn++;
printf("Tag 0x%x\n",tag);
if (tag == 0xc0 || tag == 0xd0 || tag == 0xe0) {
- printf("DistAssoc 0x%lx\n",get_long(&stn));
- printf("Country 0x%lx\n",get_long(&stn));
- printf("X 0x%lx\n",get_long(&stn));
- printf("Y 0x%lx\n",get_long(&stn));
- printf("First %ld\n",get_triple(&stn));
- printf("Last %ld\n",get_triple(&stn));
- segs=get_long(&stn);
+ printf("DistAssoc 0x%lx\n",get_u32(&stn));
+ printf("Country 0x%lx\n",get_u32(&stn));
+ printf("X 0x%lx\n",get_u32(&stn));
+ printf("Y 0x%lx\n",get_u32(&stn));
+ printf("First %ld\n",get_u24(&stn));
+ printf("Last %ld\n",get_u24(&stn));
+ segs=get_u32(&stn);
printf("Segs 0x%x\n",segs);
for (k = 0 ; k < 0 ; k++) {
- printf("SegId 0x%lx\n", get_long(&stn));
- printf("Country 0x%lx\n",get_long(&stn));
+ printf("SegId 0x%lx\n", get_u32(&stn));
+ printf("Country 0x%lx\n",get_u32(&stn));
}
} else if (tag == 0x8f || tag == 0xaa || tag == 0xab || tag == 0xae || tag == 0xaf || tag == 0x9a || tag == 0x9e || tag == 0x9f) {
- printf("X 0x%lx\n",get_long(&stn));
- printf("Y 0x%lx\n",get_long(&stn));
- printf("First %ld\n",get_triple(&stn));
- printf("Last %ld\n",get_triple(&stn));
- printf("SegId 0x%lx\n",get_long(&stn));
- printf("Country 0x%lx\n",get_long(&stn));
+ printf("X 0x%lx\n",get_u32(&stn));
+ printf("Y 0x%lx\n",get_u32(&stn));
+ printf("First %ld\n",get_u24(&stn));
+ printf("Last %ld\n",get_u24(&stn));
+ printf("SegId 0x%lx\n",get_u32(&stn));
+ printf("Country 0x%lx\n",get_u32(&stn));
} else {
printf("Unknown tag 0x%x\n", tag);
break;
diff --git a/src/street_name.c b/src/street_name.c
index 48fc1eb34..4fa1046ef 100644
--- a/src/street_name.c
+++ b/src/street_name.c
@@ -22,12 +22,12 @@ void
street_name_get(struct street_name *name, unsigned char **p)
{
unsigned char *start=*p;
- name->len=get_short(p);
- name->country=get_short(p);
- name->townassoc=get_long(p);
+ name->len=get_u16(p);
+ name->country=get_u16(p);
+ name->townassoc=get_u32(p);
name->name1=get_string(p);
name->name2=get_string(p);
- name->segment_count=get_long(p);
+ name->segment_count=get_u32(p);
name->segments=(struct street_name_segment *)(*p);
(*p)+=(sizeof (struct street_name_segment))*name->segment_count;
name->aux_len=name->len-(*p-start);
@@ -122,9 +122,9 @@ street_name_tree_process(int version, int leaf, unsigned char **s2, struct map_d
blk_off=(struct block_offset *)(*s2);
if (debug)
- printf("0x%lx\n", get_long(s2));
+ printf("0x%x\n", get_u32(s2));
else
- get_long(s2);
+ get_u32(s2);
struct street_name_index *i1=priv_data->search;
struct street_name_index *i2=(struct street_name_index *)(*s2);
@@ -220,14 +220,14 @@ street_name_get_info(struct street_name_info *inf, struct street_name *name)
if (name->tmp_len <= 0)
return 0;
- inf->len=get_short(&p);
+ inf->len=get_u16(&p);
inf->tag=*p++;
- inf->dist=get_long(&p);
- inf->country=get_long(&p);
+ inf->dist=get_u32(&p);
+ inf->country=get_u32(&p);
inf->c=coord_get(&p);
- inf->first=get_triple(&p);
- inf->last=get_triple(&p);
- inf->segment_count=get_long(&p);
+ inf->first=get_u24(&p);
+ inf->last=get_u24(&p);
+ inf->segment_count=get_u32(&p);
inf->segments=(struct street_segment *)p;
p+=sizeof(struct street_name_segment)*inf->segment_count;
inf->aux_len=name->tmp_data+name->tmp_len-p;
@@ -247,11 +247,11 @@ street_name_get_number_info(struct street_name_number_info *num, struct street_n
if (inf->tmp_len <= 0)
return 0;
- num->len=get_short(&p);
+ num->len=get_u16(&p);
num->tag=*p++;
num->c=coord_get(&p);
- num->first=get_triple(&p);
- num->last=get_triple(&p);
+ num->first=get_u24(&p);
+ num->last=get_u24(&p);
num->segment=(struct street_name_segment *)p;
inf->tmp_data+=num->len;
inf->tmp_len-=num->len;
diff --git a/src/town.c b/src/town.c
index c619ef5f3..d58718bd1 100644
--- a/src/town.c
+++ b/src/town.c
@@ -17,20 +17,20 @@
static void
town_get(struct town *town, unsigned char **p)
{
- town->id=get_long(p);
+ town->id=get_u32(p);
town->c=coord_get(p);
town->name=get_string(p);
town->district=get_string(p);
town->postal_code1=get_string(p);
- town->order=get_char(p);
- town->country=get_short(p);
- town->type=get_char(p);
- town->unknown2=get_long(p);
- town->size=get_char(p);
- town->street_assoc=get_long(p);
- town->unknown3=get_char(p);
+ town->order=get_u8(p);
+ town->country=get_u16(p);
+ town->type=get_u8(p);
+ town->unknown2=get_u32(p);
+ town->size=get_u8(p);
+ town->street_assoc=get_u32(p);
+ town->unknown3=get_u8(p);
town->postal_code2=get_string(p);
- town->unknown4=get_long(p);
+ town->unknown4=get_u32(p);
}
void
@@ -85,13 +85,13 @@ town_tree_process(int version, int leaf, unsigned char **s2, struct map_data *md
char *name;
int ret,i,debug=0;
- country=get_short(s2);
+ country=get_u16(s2);
name=get_string(s2);
if (debug) {
printf("Country: 0x%x ", country);
printf("Town: '%s' ", name);
}
- len=get_long(s2);
+ len=get_u32(s2);
blk_off=(struct block_offset *)(*s2);
*s2+=len*4;
@@ -237,7 +237,7 @@ town_get_param(struct segment *seg, struct param_list *param, int count)
p=(unsigned char *)(seg->blk_inf.block);
p+=sizeof(*seg->blk_inf.block);
- param_add_hex("Block Unknown", get_long(&p), &param, &count);
+ param_add_hex("Block Unknown", get_u32(&p), &param, &count);
p=seg->data[0];
param_add_hex("Address", p-seg->blk_inf.file->begin, &param, &count);
town_get(&town, &p);
diff --git a/src/tree.c b/src/tree.c
index 8a09beddd..67274947c 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -192,7 +192,7 @@ tree_search(int version, struct file *file, unsigned char *p, int (*tree_func)(i
}
while (p < end) {
psav=p;
- high=get_long(&p);
+ high=get_u32(&p);
if (high == -1)
leaf=1;
res=tree_func(version, leaf, &p, mdat, data);