From 9a26b289c18f36c84397138d9862890bf4edde29 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Sat, 19 Jan 2013 22:26:51 +0100 Subject: [PATCH] Code cleaned --- tt-stations.c | 383 +++++++++++++++++++++++----------------------------------- 1 file changed, 148 insertions(+), 235 deletions(-) rewrite tt-stations.c (61%) diff --git a/tt-stations.c b/tt-stations.c dissimilarity index 61% index e4cd50b..0c1d57b 100755 --- a/tt-stations.c +++ b/tt-stations.c @@ -1,235 +1,148 @@ -/* - * IDOS Stations Extractor - * - * (c) 2013 Tomas Pokorny - * - * This software can be freely distributed and used according - * to the terms of the GNU General Public License. - */ - -#include -#include -#include -#include -#include -#include - - - -FILE * in; - -void print_stations(uint32_t offset) -{ - fseek(in,offset,SEEK_SET); - int32_t len; - int32_t count; - int32_t mincount; - - fread(&len,1,sizeof(len),in); - fread(&count,1,sizeof(count),in); - mincount=count; - printf("Will read %d stations\n",count); - - int32_t * indexes; - indexes = malloc(sizeof(int32_t)*(count+1)); - - - for (int i=0;i0;i--){ - fread(buf,1,rec_len,in); - for (int j=0;j630) scanf("%c",&key); - chunk_id++; - } -/* print_strings(next); - next=0xFB; - print_strings(next); - next=0x20B; - print_strings(next); - printf("At: %x\n",ftell(in)); - - //Banky - next=0x4E71C; - print_strings(next); - printf("At: %x\n",ftell(in)); - - //Bankomaty - next=0x59824; - print_strings(next); - printf("At: %x\n",ftell(in)); - - //Bezbariérové stanice - next=0x6184C; - print_strings(next); - printf("At: %x\n",ftell(in)); - - // Divadla - next=0x622CA; - print_strings(next); - printf("At: %x\n",ftell(in)); - - //Hotely - next=0x676AA; - print_strings(next); - printf("At: %x\n",ftell(in)); - - //Hotely - next=0x676AA; - print_strings(next); - printf("At: %x\n",ftell(in));*/ - - -} - - +/* + * IDOS Stations Extractor + * + * (c) 2013 Tomas Pokorny + * + * This software can be freely distributed and used according + * to the terms of the GNU General Public License. + */ + +#include +#include +#include +#include +#include +#include + + + +FILE * in; + +void print_stations(uint32_t offset) +{ + fseek(in,offset,SEEK_SET); + int32_t len; + int32_t count; + int32_t mincount; + + fread(&len,1,sizeof(len),in); + fread(&count,1,sizeof(count),in); + offset=ftell(in)+len; + mincount=count; + printf("Will read %d stations\n",count); + + int32_t * indexes; + indexes = malloc(sizeof(int32_t)*(count+1)); + + + for (int i=0;i