|
|
1 | /** |
|
|
2 | * ZANavi, Zoff Android Navigation system. |
|
|
3 | * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc> |
|
|
4 | * |
|
|
5 | * This program is free software; you can redistribute it and/or |
|
|
6 | * modify it under the terms of the GNU General Public License |
|
|
7 | * version 2 as published by the Free Software Foundation. |
|
|
8 | * |
|
|
9 | * This program is distributed in the hope that it will be useful, |
|
|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
12 | * GNU General Public License for more details. |
|
|
13 | * |
|
|
14 | * You should have received a copy of the GNU General Public License |
|
|
15 | * along with this program; if not, write to the |
|
|
16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
|
17 | * Boston, MA 02110-1301, USA. |
|
|
18 | */ |
|
|
19 | |
1 | /** |
20 | /** |
2 | * Navit, a modular navigation system. |
21 | * Navit, a modular navigation system. |
3 | * Copyright (C) 2005-2008 Navit Team |
22 | * Copyright (C) 2005-2008 Navit Team |
4 | * |
23 | * |
5 | * This program is free software; you can redistribute it and/or |
24 | * This program is free software; you can redistribute it and/or |
… | |
… | |
19 | |
38 | |
20 | #ifndef NAVIT_FILE_H |
39 | #ifndef NAVIT_FILE_H |
21 | #define NAVIT_FILE_H |
40 | #define NAVIT_FILE_H |
22 | |
41 | |
23 | #ifdef __cplusplus |
42 | #ifdef __cplusplus |
24 | extern "C" { |
43 | extern "C" |
|
|
44 | { |
25 | #endif |
45 | #endif |
26 | |
46 | |
27 | #ifndef PATH_MAX |
47 | #ifndef PATH_MAX |
28 | #define PATH_MAX 4096 |
48 | #define PATH_MAX 4096 |
29 | #endif |
49 | #endif |
… | |
… | |
31 | #include <time.h> |
51 | #include <time.h> |
32 | #endif |
52 | #endif |
33 | #include "param.h" |
53 | #include "param.h" |
34 | #include <stdio.h> |
54 | #include <stdio.h> |
35 | |
55 | |
|
|
56 | #define MAX_SPLIT_FILES 50 |
|
|
57 | |
|
|
58 | #define CACHE_SIZE 1 |
|
|
59 | |
36 | struct file { |
60 | struct file |
|
|
61 | { |
37 | struct file *next; |
62 | struct file *next; |
38 | unsigned char *begin; |
63 | unsigned char *begin; |
39 | unsigned char *end; |
64 | unsigned char *end; |
40 | unsigned char *mmap_end; |
65 | unsigned char *mmap_end; |
41 | long long size; |
66 | long long size; |
42 | int name_id; |
67 | int name_id; |
43 | int fd; |
68 | int fd; |
44 | #ifndef __CEGCC__ |
69 | #ifndef __CEGCC__ |
45 | time_t mtime; |
70 | time_t mtime; |
46 | time_t ctime; |
71 | time_t ctime; |
47 | int version; |
72 | int version; |
48 | #endif |
73 | #endif |
49 | #if defined(_WIN32) || defined(__CEGCC__) |
74 | #if defined(_WIN32) || defined(__CEGCC__) |
50 | long map_handle; |
75 | long map_handle; |
51 | long map_file; |
76 | long map_file; |
52 | #endif |
77 | #endif |
… | |
… | |
55 | int cache; |
80 | int cache; |
56 | int requests; |
81 | int requests; |
57 | unsigned char *buffer; |
82 | unsigned char *buffer; |
58 | int buffer_len; |
83 | int buffer_len; |
59 | GHashTable *headers; |
84 | GHashTable *headers; |
|
|
85 | /* 0-> only orig file, >0 -> we have also some split files ".1" -> ".50" */ |
|
|
86 | int num_splits; |
|
|
87 | long long split_size_in_bytes; |
|
|
88 | long long last_splitter_size_in_bytes; |
|
|
89 | int current_splitter; // 0 -> orig file opened, >0 -> splitter X opened |
60 | }; |
90 | }; |
61 | |
91 | |
62 | struct attr; |
92 | struct attr; |
63 | |
93 | |
64 | /* prototypes */ |
94 | /* prototypes */ |
… | |
… | |
93 | int file_get_param(struct file *file, struct param_list *param, int count); |
123 | int file_get_param(struct file *file, struct param_list *param, int count); |
94 | int file_version(struct file *file, int byname); |
124 | int file_version(struct file *file, int byname); |
95 | void *file_get_os_handle(struct file *file); |
125 | void *file_get_os_handle(struct file *file); |
96 | void file_init(void); |
126 | void file_init(void); |
97 | int file_is_reg(char *name); |
127 | int file_is_reg(char *name); |
|
|
128 | void file_cache_init(void); |
98 | /* end of prototypes */ |
129 | /* end of prototypes */ |
99 | |
130 | |
100 | #ifdef __cplusplus |
131 | #ifdef __cplusplus |
101 | } |
132 | } |
102 | #endif |
133 | #endif |
103 | |
134 | |
104 | #endif |
135 | #endif |
105 | |
|
|
106 | void file_cache_init(void); |
|
|
107 | |
|
|