X-Git-Url: http://git.maemo.org/git/?p=routino;a=blobdiff_plain;f=src%2Fways.c;h=f3c0d3c9eaffa2debb392c42a07fd0d4453aac88;hp=3142415a8bcfc5cea744731ed4041f6c53750f52;hb=HEAD;hpb=20283c6cf5c6951cc1f2787492c67a7fb72aee9a diff --git a/src/ways.c b/src/ways.c index 3142415..f3c0d3c 100644 --- a/src/ways.c +++ b/src/ways.c @@ -1,5 +1,5 @@ /*************************************** - $Header: /home/amb/routino/src/RCS/ways.c,v 1.44 2010/04/28 17:27:02 amb Exp $ + $Header: /home/amb/routino/src/RCS/ways.c,v 1.46 2010/07/24 10:09:07 amb Exp $ Way data type functions. @@ -24,9 +24,10 @@ #include -#include "functions.h" #include "ways.h" +#include "files.h" + /*++++++++++++++++++++++++++++++++++++++ Load in a way list from a file. @@ -38,22 +39,37 @@ Ways *LoadWayList(const char *filename) { - void *data; Ways *ways; ways=(Ways*)malloc(sizeof(Ways)); - data=MapFile(filename); +#if !SLIM + + ways->data=MapFile(filename); + + /* Copy the WaysFile structure from the loaded data */ + + ways->file=*((WaysFile*)ways->data); + + /* Set the pointers in the Ways structure. */ + + ways->ways =(Way *)(ways->data+sizeof(WaysFile)); + ways->names=(char*)(ways->data+sizeof(WaysFile)+ways->file.number*sizeof(Way)); + +#else + + ways->fd=ReOpenFile(filename); + + /* Copy the WaysFile header structure from the loaded data */ - /* Copy the Ways structure from the loaded data */ + ReadFile(ways->fd,&ways->file,sizeof(WaysFile)); - *ways=*((Ways*)data); + ways->namesoffset=sizeof(WaysFile)+ways->file.number*sizeof(Way); - /* Adjust the pointers in the Ways structure. */ + ways->nincache=~0; + ways->ncached=NULL; - ways->data =data; - ways->ways =(Way *)(data+sizeof(Ways)); - ways->names=(char*)(data+(sizeof(Ways)+ways->number*sizeof(Way))); +#endif return(ways); }