*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++;
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;
}
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);
}
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;
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);
-static int sigsegv(void)
+static void sigsegv(int sig)
{
FILE *f;
time_t t;
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;
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);
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);
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;
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;
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
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;
p=(unsigned char *)(seg->blk_inf.block);
p+=sizeof(*seg->blk_inf.block);
- param_add_hex("Block Unknown", get_long(&p), ¶m, &count);
+ param_add_hex("Block Unknown", get_u32(&p), ¶m, &count);
p=seg->data[0];
param_add_hex("Address", p-seg->blk_inf.file->begin, ¶m, &count);
town_get(&town, &p);
}
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);