summaryrefslogtreecommitdiff
path: root/src/export/extract_version_1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/export/extract_version_1.c')
-rw-r--r--src/export/extract_version_1.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/export/extract_version_1.c b/src/export/extract_version_1.c
index 987c38f..bbe900a 100644
--- a/src/export/extract_version_1.c
+++ b/src/export/extract_version_1.c
@@ -7,7 +7,7 @@
7 7
8#include "mystdlib.h" 8#include "mystdlib.h"
9 9
10static char xlat_table[] = { 10static uint8_t xlat_table[] = {
11 0x00, 0x09, 0x02, 0x03, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 11 0x00, 0x09, 0x02, 0x03, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
12 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 12 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
13 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 13 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
@@ -18,7 +18,7 @@ static char xlat_table[] = {
18 0xfb, 0xf9, 0xff, 0xd6, 0xdc, 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xdf, 0x5b, 0x5c, 0x5d, 0x60 18 0xfb, 0xf9, 0xff, 0xd6, 0xdc, 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xdf, 0x5b, 0x5c, 0x5d, 0x60
19}; 19};
20 20
21static char cp437_to_iso8859_1_table[] = { 21static uint8_t cp437_to_iso8859_1_table[] = {
22 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 22 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
23 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 23 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
24 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 24 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
@@ -42,7 +42,7 @@ static struct {
42 char * zip; 42 char * zip;
43} g_state; 43} g_state;
44 44
45void decode_7bit_string( uint8_t const *source, uint8_t *dest ) 45static void decode_7bit_string( uint8_t const *source, uint8_t *dest )
46{ 46{
47 uint16_t acc = 0, acc_bits = 0; 47 uint16_t acc = 0, acc_bits = 0;
48 while( 1 ) 48 while( 1 )
@@ -55,7 +55,7 @@ again:
55 } 55 }
56} 56}
57 57
58void split_to_files( uint8_t *entries, int num_entries ) 58static void split_to_files( uint8_t *entries, int num_entries )
59{ 59{
60 int entry = 0, column; 60 int entry = 0, column;
61 char *e = (char*)entries; 61 char *e = (char*)entries;
@@ -74,7 +74,7 @@ void split_to_files( uint8_t *entries, int num_entries )
74 if( end ) { 74 if( end ) {
75 *end = '\n'; 75 *end = '\n';
76 if( column == 9 && *e >= '0' && *e <= '9' ) write( g_state.outfiles[column+1], "0", 1 ); /* Augment Vorwahl */ 76 if( column == 9 && *e >= '0' && *e <= '9' ) write( g_state.outfiles[column+1], "0", 1 ); /* Augment Vorwahl */
77 write( g_state.outfiles[column+1], e, end - e + 1); 77 write( g_state.outfiles[column+1], e, (size_t)(end - e + 1) );
78 e = end + 1; 78 e = end + 1;
79 } else 79 } else
80 dprintf( g_state.outfiles[column+1], "%s\n", e); 80 dprintf( g_state.outfiles[column+1], "%s\n", e);
@@ -82,7 +82,7 @@ void split_to_files( uint8_t *entries, int num_entries )
82 } 82 }
83} 83}
84 84
85void act_on_record( uint8_t *file, int flag, uint8_t *page, uint16_t record_off ) 85static void act_on_record( uint8_t *file, int flag, uint8_t *page, uint16_t record_off )
86{ 86{
87 uint8_t outbuf[8192], *out_dest = outbuf, *record; 87 uint8_t outbuf[8192], *out_dest = outbuf, *record;
88 int num_entries; 88 int num_entries;
@@ -116,7 +116,7 @@ void act_on_record( uint8_t *file, int flag, uint8_t *page, uint16_t record_off
116} 116}
117 117
118/* Page is always 0x2000 */ 118/* Page is always 0x2000 */
119void act_on_page( uint8_t *file, uint8_t *page, int page_nr ) 119static void act_on_page( uint8_t *file, uint8_t *page, int page_nr )
120{ 120{
121 int record, flag = page[0]; 121 int record, flag = page[0];
122 int blob_len = *(uint16_t*)(page + 0x2); 122 int blob_len = *(uint16_t*)(page + 0x2);
@@ -131,17 +131,17 @@ void act_on_page( uint8_t *file, uint8_t *page, int page_nr )
131 act_on_record( file, flag, page + 0xe, recs[record] ); 131 act_on_record( file, flag, page + 0xe, recs[record] );
132} 132}
133 133
134void act_on_file( uint8_t *file ) 134static void act_on_file( uint8_t *file )
135{ 135{
136 int page, num_pages = *(uint16_t*)(file+0x40); 136 int page, num_pages = *(uint16_t*)(file+0x40);
137 int num_records = *(uint32_t*)(file+0x42); 137 uint32_t num_records= *(uint32_t*)(file+0x42);
138 char *gasse = (char *)file + 0x8e; 138 char *gasse = (char *)file + 0x8e;
139 char *ort = gasse + 1 + strlen(gasse); 139 char *ort = gasse + 1 + strlen(gasse);
140 char *zip = ort + 1 + strlen(ort); 140 char *zip = ort + 1 + strlen(ort);
141 char *vorwahl = zip + 1 + strlen(zip); 141 char *vorwahl = zip + 1 + strlen(zip);
142 char ort_conv[1024]; int i; 142 char ort_conv[1024]; int i;
143 143
144 for(i=0; ort[i]; ++i ) ort_conv[i] = cp437_to_iso8859_1_table[((uint8_t*)ort)[i]]; ort_conv[i] = 0; 144 for(i=0; ort[i]; ++i ) ort_conv[i] = (char)cp437_to_iso8859_1_table[((uint8_t*)ort)[i]]; ort_conv[i] = 0;
145 /* printf( "Working on a %04d page and %06d records file, city: %4s %-32s with prefix %s\n", num_pages, num_records, zip, ort_conv, vorwahl ); */ 145 /* printf( "Working on a %04d page and %06d records file, city: %4s %-32s with prefix %s\n", num_pages, num_records, zip, ort_conv, vorwahl ); */
146 (void)num_records; /* silence warning about unused variable */ 146 (void)num_records; /* silence warning about unused variable */
147 147