summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2015-06-02 19:44:40 +0200
committerDirk Engling <erdgeist@erdgeist.org>2015-06-02 19:44:40 +0200
commitcd57e6da895a1d64f17cf0cf5ab87f8cc78bd765 (patch)
treebbffbd01ee8d886d17da97efe4d2949b875fb0c1
parentf784fc3b3356109aecd7b44486513f7f5a2dcce9 (diff)
parent9b783b53ee8543f7922b3adc496a04e9486983c6 (diff)
Merge remote-tracking branch 'refs/remotes/origin/master'
-rw-r--r--Makefile2
-rw-r--r--README8
-rw-r--r--src/export/extract_version_1.c4
-rw-r--r--src/export/extract_version_3.c8
-rw-r--r--src/export/extract_version_4.c2
-rw-r--r--src/export/split_version_2.c5
-rw-r--r--src/export/split_version_3.c2
7 files changed, 19 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 500c0ad..c2d04d4 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ bin/map_coords: src/export/map_coords.c src/export/mystdlib.c
25 $(CC) $(CFLAGS) -o $@ src/export/map_coords.c src/export/mystdlib.c 25 $(CC) $(CFLAGS) -o $@ src/export/map_coords.c src/export/mystdlib.c
26 26
27bin/convert_coords: src/export/convert_coords.c 27bin/convert_coords: src/export/convert_coords.c
28 $(CC) $(CFLAGS) -o $@ -lm src/export/convert_coords.c 28 $(CC) $(CFLAGS) -o $@ src/export/convert_coords.c -lm
29 29
30bin/join: src/postprocess/join.c src/export/mystdlib.c 30bin/join: src/postprocess/join.c src/export/mystdlib.c
31 $(CC) $(CFLAGS) -o $@ src/postprocess/join.c src/export/mystdlib.c -Isrc/export 31 $(CC) $(CFLAGS) -o $@ src/postprocess/join.c src/export/mystdlib.c -Isrc/export
diff --git a/README b/README
index ef9f374..744b020 100644
--- a/README
+++ b/README
@@ -53,4 +53,10 @@ Now we look at the continuation entry parts: A column_id of 0x4003 denotes a sta
53version 3 53version 3
54========= 54=========
55 55
56TBD. 56Some of the files on disc are obfuscated while others are plain. They consist of chunks of lha compressed data (as readable by the lha command). The obfuscation is a simple XOR of the first 32 (for streets: 34) bytes with a static 4 byte key that changes with every CD. Since lha headers do have a static signature (i.e. -lh5-), it's easy to derive the current key by xoring the static value with the bytes found in the file. Conveniently un-obfuscated files generate a all-zero key and don't need special treatment. The path name of each chunk is identical so it must be re-written and the header checksum must be re-calculated.
57
58After decompressing all files (quite a lot, it's split at 3k entries per file) from dat/teiln.dat (case insensitive), we get three kinds of files: one with all Vorname columns, one with all Nachname columns and one with the rest of the columns. Before 2000_Q1 files {0,3,6,...} were Nachname, {1,4,7,...} were Vorname and {2,5,8,...} were all the other tables. After 2000_Q1 (incl.) {0,3,6,...} were all other columns, while {1,4,7,...} were Nachname and {2,5,8,...} Vorname columns. The first char in each entry in the Nachname column contains a continuation flag, where "1" means single line entry, "3" is the first and "2" are the remaining lines in a continuation.
59
60If there is a dat/strassen.dat (case insensitive), the concatenated decompressed chunks are a list of all street names referenced in the street/hnr column.
61
62If there is a dat/karto.dat (case insensitive), the concatenated decompressed chunks are a sorted list of all zip/streetname(/hnr) combinations on that CD, each line finished by the geo coordinates of that address.
diff --git a/src/export/extract_version_1.c b/src/export/extract_version_1.c
index 0e03e1e..c727b4f 100644
--- a/src/export/extract_version_1.c
+++ b/src/export/extract_version_1.c
@@ -210,13 +210,13 @@ int main( )
210 /* Write out results */ 210 /* Write out results */
211 for( i=0; i<14; ++i ) { 211 for( i=0; i<14; ++i ) {
212 /* if( g_state.outfill[i] > 1024*1024*6 ) printf( "Large: %s %zd\n", g_state.ort, g_state.outfill[i] ); */ 212 /* if( g_state.outfill[i] > 1024*1024*6 ) printf( "Large: %s %zd\n", g_state.ort, g_state.outfill[i] ); */
213 write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] ); 213 (void)write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] );
214 g_state.outfill[i] = 0; 214 g_state.outfill[i] = 0;
215 } 215 }
216 } 216 }
217 217
218 for( i=0; i<14; ++i ) { 218 for( i=0; i<14; ++i ) {
219 write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] ); 219 (void)write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] );
220 close( g_state.outfiles[i] ); 220 close( g_state.outfiles[i] );
221 } 221 }
222 222
diff --git a/src/export/extract_version_3.c b/src/export/extract_version_3.c
index c4914a7..329c1a8 100644
--- a/src/export/extract_version_3.c
+++ b/src/export/extract_version_3.c
@@ -113,11 +113,11 @@ int main( int args, char **argv )
113 /* Open file and dump our de-"crypted" header and then rest of file */ 113 /* Open file and dump our de-"crypted" header and then rest of file */
114 fh = open( filename, O_CREAT | O_TRUNC | O_WRONLY, 0644 ); 114 fh = open( filename, O_CREAT | O_TRUNC | O_WRONLY, 0644 );
115 if( enc_len > header_len ) { 115 if( enc_len > header_len ) {
116 write( fh, df, enc_len ); 116 (void)write( fh, df, enc_len );
117 write( fh, mf + enc_len, offset - old_offset - enc_len ); 117 (void)write( fh, mf + enc_len, offset - old_offset - enc_len );
118 } else { 118 } else {
119 write( fh, df, header_len ); 119 (void)write( fh, df, header_len );
120 write( fh, mf + header_len, offset - old_offset - header_len ); 120 (void)write( fh, mf + header_len, offset - old_offset - header_len );
121 } 121 }
122 close( fh ); 122 close( fh );
123 } 123 }
diff --git a/src/export/extract_version_4.c b/src/export/extract_version_4.c
index 735cb3a..252831a 100644
--- a/src/export/extract_version_4.c
+++ b/src/export/extract_version_4.c
@@ -50,7 +50,7 @@ error_continue:
50 fprintf( stderr, "Could not open output file %s\n", respath ); 50 fprintf( stderr, "Could not open output file %s\n", respath );
51 exit(1); 51 exit(1);
52 } 52 }
53 write( resfile, output, z.total_out ); 53 (void)write( resfile, output, z.total_out );
54 close( resfile ); 54 close( resfile );
55 offs += z.total_in; 55 offs += z.total_in;
56 56
diff --git a/src/export/split_version_2.c b/src/export/split_version_2.c
index 54e2313..6eafe55 100644
--- a/src/export/split_version_2.c
+++ b/src/export/split_version_2.c
@@ -237,16 +237,17 @@ int main( int args, char **argv ) {
237 if( g_state.outfill[0] > limit ) 237 if( g_state.outfill[0] > limit )
238 for( i=0; i<g_outfiles; ++i ) { 238 for( i=0; i<g_outfiles; ++i ) {
239 if( g_state.outfill[i] > 1024*1024*6 ) printf( "Large: %zd\n", g_state.outfill[i] ); 239 if( g_state.outfill[i] > 1024*1024*6 ) printf( "Large: %zd\n", g_state.outfill[i] );
240 write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] ); 240 (void)write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] );
241 g_state.outfill[i] = 0; 241 g_state.outfill[i] = 0;
242 } 242 }
243 } 243 }
244 244
245 for( i=0; i<g_outfiles; ++i ) { 245 for( i=0; i<g_outfiles; ++i ) {
246 write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] ); 246 (void)write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] );
247 close( g_state.outfiles[i] ); 247 close( g_state.outfiles[i] );
248 } 248 }
249 unmap_file( &data ); 249 unmap_file( &data );
250 unmap_file( &index ); 250 unmap_file( &index );
251 251
252 return 0;
252} 253}
diff --git a/src/export/split_version_3.c b/src/export/split_version_3.c
index 2019762..853d95d 100644
--- a/src/export/split_version_3.c
+++ b/src/export/split_version_3.c
@@ -49,7 +49,7 @@ int main( int argc, char **args ) {
49 off = p[file+1]; 49 off = p[file+1];
50 /* Look for end of this chunk, which is <count> strings long */ 50 /* Look for end of this chunk, which is <count> strings long */
51 for( strnr=0; strnr < count; ++strnr ) { while( f[off++] ) {}; f[off-1] = '\n'; } 51 for( strnr=0; strnr < count; ++strnr ) { while( f[off++] ) {}; f[off-1] = '\n'; }
52 write( outfiles[file], f + p[file+1], off - p[file+1] ); 52 (void)write( outfiles[file], f + p[file+1], off - p[file+1] );
53 } 53 }
54 } 54 }
55 55