Rev 8425 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8425 | Rev 8492 | ||
---|---|---|---|
1 | enum { |
1 | enum { |
2 | PAGE=1, IMG |
2 | PAGE=1, IMG |
3 | }; |
3 | }; |
4 | 4 | ||
5 | struct _cache |
5 | struct _cache |
6 | { |
6 | { |
7 | dword current_buf; |
7 | dword current_buf; |
8 | dword current_size; |
8 | dword current_size; |
9 | dword current_type; |
9 | dword current_type; |
- | 10 | dword current_charset; |
|
10 | collection url; |
11 | collection url; |
11 | collection_int data; |
12 | collection_int data; |
12 | collection_int size; |
13 | collection_int size; |
13 | collection_int type; |
14 | collection_int type; |
- | 15 | collection_int charset; |
|
14 | void add(); |
16 | void add(); |
15 | bool has(); |
17 | bool has(); |
16 | void clear(); |
18 | void clear(); |
17 | } cache=0; |
19 | } cache=0; |
18 | 20 | ||
19 | void _cache::add(dword _url, _data, _size, _type) |
21 | void _cache::add(dword _url, _data, _size, _type, _charset) |
20 | { |
22 | { |
21 | dword data_pointer; |
23 | dword data_pointer; |
22 | data_pointer = malloc(_size); |
24 | data_pointer = malloc(_size); |
23 | memmov(data_pointer, _data, _size); |
25 | memmov(data_pointer, _data, _size); |
24 | data.add(data_pointer); |
26 | data.add(data_pointer); |
25 | 27 | ||
26 | url.add(_url); |
28 | url.add(_url); |
27 | size.add(_size); |
29 | size.add(_size); |
28 | type.add(_type); |
30 | type.add(_type); |
- | 31 | charset.add(_charset); |
|
29 | 32 | ||
30 | current_buf = data_pointer; |
33 | current_buf = data_pointer; |
31 | current_size = _size; |
34 | current_size = _size; |
32 | } |
35 | } |
33 | 36 | ||
34 | bool _cache::has(dword _link) |
37 | bool _cache::has(dword _link) |
35 | { |
38 | { |
36 | int pos; |
39 | int pos; |
37 | pos = url.get_pos_by_name(_link); |
40 | pos = url.get_pos_by_name(_link); |
38 | if (pos != -1) { |
41 | if (pos != -1) { |
39 | current_buf = data.get(pos); |
42 | current_buf = data.get(pos); |
40 | current_size = size.get(pos); |
43 | current_size = size.get(pos); |
41 | current_type = type.get(pos); |
44 | current_type = type.get(pos); |
- | 45 | current_charset = charset.get(pos); |
|
42 | return true; |
46 | return true; |
43 | } |
47 | } |
44 | return false; |
48 | return false; |
45 | } |
49 | } |
46 | 50 | ||
47 | void _cache::clear() |
51 | void _cache::clear() |
48 | { |
52 | { |
49 | int i; |
53 | int i; |
50 | for (i=0; i |
54 | for (i=0; i |
51 | url.drop(); |
55 | url.drop(); |
52 | data.drop(); |
56 | data.drop(); |
53 | size.drop(); |
57 | size.drop(); |
54 | type.drop(); |
58 | type.drop(); |
55 | current_buf = NULL; |
59 | current_buf = NULL; |
56 | current_size = NULL; |
60 | current_size = NULL; |
57 | } |
61 | } |