git-svn: trunk@2701
Tomasz Kojm authored on 2007/02/11 09:41:13... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Sun Feb 11 01:38:26 CET 2007 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * remove part of warnings from gcc, patch from Edwin |
|
4 |
+ |
|
1 | 5 |
Sat Feb 10 18:44:52 CET 2007 (tk) |
2 | 6 |
--------------------------------- |
3 | 7 |
* clamdscan/client.c: fix "clamdcan /" mode, reported by Luca |
... | ... |
@@ -32,7 +32,7 @@ |
32 | 32 |
#define _GNU_SOURCE |
33 | 33 |
#include "getopt.h" |
34 | 34 |
|
35 |
-void printopt(const struct cfgoption *opt, const struct cfgstruct *cpt) |
|
35 |
+static void printopt(const struct cfgoption *opt, const struct cfgstruct *cpt) |
|
36 | 36 |
{ |
37 | 37 |
if(!cpt->enabled) { |
38 | 38 |
printf("%s not set\n", opt->name); |
... | ... |
@@ -65,7 +65,7 @@ void printopt(const struct cfgoption *opt, const struct cfgstruct *cpt) |
65 | 65 |
} |
66 | 66 |
} |
67 | 67 |
|
68 |
-void printcfg(const char *cfgfile) |
|
68 |
+static void printcfg(const char *cfgfile) |
|
69 | 69 |
{ |
70 | 70 |
const struct cfgoption *opt; |
71 | 71 |
const struct cfgstruct *cpt; |
... | ... |
@@ -167,7 +167,7 @@ void printcfg(const char *cfgfile) |
167 | 167 |
freecfg(cfg); |
168 | 168 |
} |
169 | 169 |
|
170 |
-void help(void) |
|
170 |
+static void help(void) |
|
171 | 171 |
{ |
172 | 172 |
printf("\n"); |
173 | 173 |
printf(" Clam AntiVirus: Configuration Tool "VERSION"\n"); |
... | ... |
@@ -195,7 +195,7 @@ threadpool_t *thrmgr_new(int max_threads, int idle_timeout, void (*handler)(void |
195 | 195 |
return threadpool; |
196 | 196 |
} |
197 | 197 |
|
198 |
-void *thrmgr_worker(void *arg) |
|
198 |
+static void *thrmgr_worker(void *arg) |
|
199 | 199 |
{ |
200 | 200 |
threadpool_t *threadpool = (threadpool_t *) arg; |
201 | 201 |
void *job_data; |
... | ... |
@@ -51,7 +51,7 @@ int main(int argc, char **argv) |
51 | 51 |
struct timezone tz; |
52 | 52 |
time_t starttime; |
53 | 53 |
struct optstruct *opt; |
54 |
- char *clamdscan_accepted[] = { "help", "version", "verbose", "quiet", |
|
54 |
+ const char *clamdscan_accepted[] = { "help", "version", "verbose", "quiet", |
|
55 | 55 |
"stdout", "log", "move", "copy", "remove", |
56 | 56 |
"config-file", "no-summary", |
57 | 57 |
"disable-summary", "multiscan", NULL }; |
... | ... |
@@ -515,7 +515,7 @@ static void move_infected(const char *filename, const struct optstruct *opt) |
515 | 515 |
} |
516 | 516 |
|
517 | 517 |
if(!(tmp = strrchr(filename, '/'))) |
518 |
- tmp = (char *) filename; |
|
518 |
+ tmp = (const char *) filename; |
|
519 | 519 |
|
520 | 520 |
movefilename_size = sizeof(char) * (strlen(movedir) + strlen(tmp) + sizeof(numext) + 2); |
521 | 521 |
|
... | ... |
@@ -115,7 +115,7 @@ static void writepid(char *pidfile) |
115 | 115 |
umask(old_umask); |
116 | 116 |
} |
117 | 117 |
|
118 |
-void help(void) |
|
118 |
+static void help(void) |
|
119 | 119 |
{ |
120 | 120 |
mprintf_stdout = 1; |
121 | 121 |
|
... | ... |
@@ -150,7 +150,7 @@ void help(void) |
150 | 150 |
mprintf("\n"); |
151 | 151 |
} |
152 | 152 |
|
153 |
-int download(const struct cfgstruct *copt, const struct optstruct *opt, const char *datadir) |
|
153 |
+static int download(const struct cfgstruct *copt, const struct optstruct *opt, const char *datadir) |
|
154 | 154 |
{ |
155 | 155 |
int ret = 0, try = 0, maxattempts = 0; |
156 | 156 |
struct cfgstruct *cpt; |
... | ... |
@@ -205,7 +205,7 @@ int download(const struct cfgstruct *copt, const struct optstruct *opt, const ch |
205 | 205 |
int main(int argc, char **argv) |
206 | 206 |
{ |
207 | 207 |
int ret = 52; |
208 |
- char *newdir, *cfgfile; |
|
208 |
+ const char *newdir, *cfgfile; |
|
209 | 209 |
char *pidfile = NULL; |
210 | 210 |
struct cfgstruct *copt, *cpt; |
211 | 211 |
#ifndef C_WINDOWS |
... | ... |
@@ -93,7 +93,7 @@ static int wwwconnect(const char *server, const char *proxy, int pport, char *ip |
93 | 93 |
|
94 | 94 |
if(localip) { |
95 | 95 |
if((he = gethostbyname(localip)) == NULL) { |
96 |
- char *herr; |
|
96 |
+ const char *herr; |
|
97 | 97 |
switch(h_errno) { |
98 | 98 |
case HOST_NOT_FOUND: |
99 | 99 |
herr = "Host not found"; |
... | ... |
@@ -156,7 +156,7 @@ static int wwwconnect(const char *server, const char *proxy, int pport, char *ip |
156 | 156 |
} |
157 | 157 |
|
158 | 158 |
if((host = gethostbyname(hostpt)) == NULL) { |
159 |
- char *herr; |
|
159 |
+ const char *herr; |
|
160 | 160 |
switch(h_errno) { |
161 | 161 |
case HOST_NOT_FOUND: |
162 | 162 |
herr = "Host not found"; |
... | ... |
@@ -97,7 +97,7 @@ struct cab_block_hdr |
97 | 97 |
uint16_t cbUncomp; /* number of uncompressed bytes */ |
98 | 98 |
}; |
99 | 99 |
|
100 |
-char *cab_readstr(int fd, int *ret) |
|
100 |
+static char *cab_readstr(int fd, int *ret) |
|
101 | 101 |
{ |
102 | 102 |
int i, bread, found = 0; |
103 | 103 |
char buff[256], *str; |
... | ... |
@@ -136,7 +136,7 @@ char *cab_readstr(int fd, int *ret) |
136 | 136 |
return str; |
137 | 137 |
} |
138 | 138 |
|
139 |
-int cab_chkname(const char *name) |
|
139 |
+static int cab_chkname(const char *name) |
|
140 | 140 |
{ |
141 | 141 |
size_t i, len = strlen(name); |
142 | 142 |
|
... | ... |
@@ -47,6 +47,7 @@ |
47 | 47 |
#include "others.h" |
48 | 48 |
#include "mspack.h" |
49 | 49 |
#include "cltypes.h" |
50 |
+#include "chmunpack.h" |
|
50 | 51 |
|
51 | 52 |
#ifndef HAVE_ATTRIB_PACKED |
52 | 53 |
#define __attribute__(x) |
... | ... |
@@ -155,7 +156,7 @@ typedef struct lzx_content_tag { |
155 | 155 |
#define chm_endian_convert_64(x) le64_to_host(x) |
156 | 156 |
|
157 | 157 |
/* Read in a block of data from either the mmap area or the given fd */ |
158 |
-int chm_read_data(int fd, unsigned char *dest, off_t offset, off_t len, |
|
158 |
+static int chm_read_data(int fd, unsigned char *dest, off_t offset, off_t len, |
|
159 | 159 |
unsigned char *m_area, off_t m_length) |
160 | 160 |
{ |
161 | 161 |
if ((offset < 0) || (len < 0) || ((offset+len) < 0)) { |
... | ... |
@@ -177,7 +178,7 @@ int chm_read_data(int fd, unsigned char *dest, off_t offset, off_t len, |
177 | 177 |
return TRUE; |
178 | 178 |
} |
179 | 179 |
|
180 |
-uint64_t chm_copy_file_data(int ifd, int ofd, uint64_t len) |
|
180 |
+static uint64_t chm_copy_file_data(int ifd, int ofd, uint64_t len) |
|
181 | 181 |
{ |
182 | 182 |
unsigned char data[8192]; |
183 | 183 |
uint64_t count, rem; |
... | ... |
@@ -359,7 +359,7 @@ int cli_cvdload(FILE *fs, struct cl_engine **engine, unsigned int *signo, short |
359 | 359 |
char *dir; |
360 | 360 |
struct cl_cvd cvd; |
361 | 361 |
int ret, fd; |
362 |
- time_t stime; |
|
362 |
+ time_t s_time; |
|
363 | 363 |
|
364 | 364 |
|
365 | 365 |
cli_dbgmsg("in cli_cvdload()\n"); |
... | ... |
@@ -370,8 +370,8 @@ int cli_cvdload(FILE *fs, struct cl_engine **engine, unsigned int *signo, short |
370 | 370 |
return ret; |
371 | 371 |
|
372 | 372 |
if(cvd.stime && warn) { |
373 |
- time(&stime); |
|
374 |
- if((int) stime - cvd.stime > 604800) { |
|
373 |
+ time(&s_time); |
|
374 |
+ if((int) s_time - cvd.stime > 604800) { |
|
375 | 375 |
cli_warnmsg("**************************************************\n"); |
376 | 376 |
cli_warnmsg("*** The virus database is older than 7 days. ***\n"); |
377 | 377 |
cli_warnmsg("*** Please update it IMMEDIATELY! ***\n"); |
... | ... |
@@ -297,10 +297,10 @@ cli_file_t cli_filetype2(int desc, const struct cl_engine *engine) |
297 | 297 |
if(cli_ac_initdata(&mdata, root->ac_partsigs, AC_DEFAULT_TRACKLEN)) |
298 | 298 |
return ret; |
299 | 299 |
|
300 |
- decoded = (char*) encoding_norm_readline(&conv, NULL, &area, bread); |
|
300 |
+ decoded = encoding_norm_readline(&conv, NULL, &area, bread); |
|
301 | 301 |
|
302 | 302 |
if(decoded) { |
303 |
- sret = cli_ac_scanbuff(decoded, strlen(decoded), NULL, engine->root[0], &mdata, 1, 0, 0, -1, NULL); |
|
303 |
+ sret = cli_ac_scanbuff(decoded, strlen((const char *) decoded), NULL, engine->root[0], &mdata, 1, 0, 0, -1, NULL); |
|
304 | 304 |
free(decoded); |
305 | 305 |
if(sret == CL_TYPE_HTML) { |
306 | 306 |
ret = CL_TYPE_HTML; |
... | ... |
@@ -83,13 +83,13 @@ typedef enum { |
83 | 83 |
HTML_RFC2397_DATA, |
84 | 84 |
HTML_RFC2397_FINISH, |
85 | 85 |
HTML_RFC2397_ESC, |
86 |
- HTML_ESCAPE_CHAR, |
|
86 |
+ HTML_ESCAPE_CHAR |
|
87 | 87 |
} html_state; |
88 | 88 |
|
89 | 89 |
typedef enum { |
90 | 90 |
SINGLE_QUOTED, |
91 | 91 |
DOUBLE_QUOTED, |
92 |
- NOT_QUOTED, |
|
92 |
+ NOT_QUOTED |
|
93 | 93 |
} quoted_state; |
94 | 94 |
|
95 | 95 |
|
... | ... |
@@ -257,7 +257,7 @@ static void html_output_c(file_buff_t *fbuff1, file_buff_t *fbuff2, unsigned cha |
257 | 257 |
} |
258 | 258 |
} |
259 | 259 |
|
260 |
-static void html_output_str(file_buff_t *fbuff, unsigned char *str, int len) |
|
260 |
+static void html_output_str(file_buff_t *fbuff, const unsigned char *str, int len) |
|
261 | 261 |
{ |
262 | 262 |
if (fbuff) { |
263 | 263 |
if ((fbuff->length + len) >= HTML_FILE_BUFF_LEN) { |
... | ... |
@@ -273,7 +273,7 @@ static void html_output_str(file_buff_t *fbuff, unsigned char *str, int len) |
273 | 273 |
} |
274 | 274 |
} |
275 | 275 |
|
276 |
-static char *html_tag_arg_value(tag_arguments_t *tags, char *tag) |
|
276 |
+static char *html_tag_arg_value(tag_arguments_t *tags, const char *tag) |
|
277 | 277 |
{ |
278 | 278 |
int i; |
279 | 279 |
|
... | ... |
@@ -285,7 +285,7 @@ static char *html_tag_arg_value(tag_arguments_t *tags, char *tag) |
285 | 285 |
return NULL; |
286 | 286 |
} |
287 | 287 |
|
288 |
-static void html_tag_arg_set(tag_arguments_t *tags, char *tag, char *value) |
|
288 |
+static void html_tag_arg_set(tag_arguments_t *tags, const char *tag, const char *value) |
|
289 | 289 |
{ |
290 | 290 |
int i; |
291 | 291 |
|
... | ... |
@@ -299,7 +299,7 @@ static void html_tag_arg_set(tag_arguments_t *tags, char *tag, char *value) |
299 | 299 |
return; |
300 | 300 |
} |
301 | 301 |
static void html_tag_arg_add(tag_arguments_t *tags, |
302 |
- unsigned char *tag, unsigned char *value) |
|
302 |
+ const unsigned char *tag, unsigned char *value) |
|
303 | 303 |
{ |
304 | 304 |
int len, i; |
305 | 305 |
tags->count++; |
... | ... |
@@ -614,6 +614,9 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag |
614 | 614 |
continue; |
615 | 615 |
} |
616 | 616 |
switch (state) { |
617 |
+ case HTML_SPECIAL_CHAR: |
|
618 |
+ cli_dbgmsg("Impossible, special_char can't occur here\n"); |
|
619 |
+ break; |
|
617 | 620 |
case HTML_BAD_STATE: |
618 | 621 |
/* An engine error has occurred */ |
619 | 622 |
cli_dbgmsg("HTML Engine Error\n"); |
... | ... |
@@ -962,25 +965,24 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag |
962 | 962 |
const unsigned char* http_equiv = html_tag_arg_value(&tag_args, "http-equiv"); |
963 | 963 |
const unsigned char* http_content = html_tag_arg_value(&tag_args, "content"); |
964 | 964 |
if(http_equiv && http_content && strcasecmp(http_equiv,"content-type") == 0) { |
965 |
- const size_t len = strlen((const char*)http_content); |
|
965 |
+ size_t len = strlen((const char*)http_content); |
|
966 | 966 |
unsigned char* http_content2 = cli_malloc( len + 1); |
967 | 967 |
unsigned char* charset; |
968 | 968 |
size_t i; |
969 | 969 |
|
970 | 970 |
if(!http_content2) |
971 | 971 |
return CL_EMEM; |
972 |
- for(i = 0; i < strlen((const char*)http_content); i++) |
|
972 |
+ for(i = 0; i < len; i++) |
|
973 | 973 |
http_content2[i] = tolower(http_content[i]); |
974 | 974 |
http_content2[len] = '\0'; |
975 | 975 |
charset = (unsigned char*) strstr((char*)http_content2,"charset"); |
976 | 976 |
if(charset) { |
977 |
- size_t length; |
|
978 | 977 |
while(*charset && *charset != '=') |
979 | 978 |
charset++; |
980 | 979 |
charset++;/* skip = */ |
981 |
- length = strcspn((const char*)charset," \"'"); |
|
982 |
- charset[length] = '\0'; |
|
983 |
- if(length) |
|
980 |
+ len = strcspn((const char*)charset," \"'"); |
|
981 |
+ charset[len] = '\0'; |
|
982 |
+ if(len) |
|
984 | 983 |
process_encoding_set(&conv, charset, META); |
985 | 984 |
} |
986 | 985 |
free(http_content2); |
... | ... |
@@ -5,7 +5,7 @@ |
5 | 5 |
* |
6 | 6 |
* Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu. |
7 | 7 |
* |
8 |
- * $Id: is_tar.h,v 1.1 2005/03/22 21:26:25 kojm Exp $ # checkin only |
|
8 |
+ * $Id: is_tar.h,v 1.2 2007/02/11 00:41:13 tkojm Exp $ # checkin only |
|
9 | 9 |
*/ |
10 | 10 |
|
11 | 11 |
/* |
... | ... |
@@ -43,3 +43,5 @@ union record { |
43 | 43 |
|
44 | 44 |
/* The magic field is filled with this if uname and gname are valid. */ |
45 | 45 |
#define TMAGIC "ustar " /* 7 chars and a null */ |
46 |
+ |
|
47 |
+int is_tar(unsigned char *buf, unsigned int nbytes); |
... | ... |
@@ -49,16 +49,16 @@ |
49 | 49 |
*/ |
50 | 50 |
#if defined(__i386__) || defined(__x86_64__) || defined(__vax__) |
51 | 51 |
#define SET(n) \ |
52 |
- (*(MD5_u32plus *)&ptr[(n) * 4]) |
|
52 |
+ (*(const MD5_u32plus *)&ptr[(n) * 4]) |
|
53 | 53 |
#define GET(n) \ |
54 | 54 |
SET(n) |
55 | 55 |
#else |
56 | 56 |
#define SET(n) \ |
57 | 57 |
(ctx->block[(n)] = \ |
58 |
- (MD5_u32plus)ptr[(n) * 4] | \ |
|
59 |
- ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ |
|
60 |
- ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ |
|
61 |
- ((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) |
|
58 |
+ (const MD5_u32plus)ptr[(n) * 4] | \ |
|
59 |
+ (const (MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ |
|
60 |
+ (const (MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ |
|
61 |
+ (const (MD5_u32plus)ptr[(n) * 4 + 3] << 24)) |
|
62 | 62 |
#define GET(n) \ |
63 | 63 |
(ctx->block[(n)]) |
64 | 64 |
#endif |
... | ... |
@@ -67,9 +67,9 @@ |
67 | 67 |
* This processes one or more 64-byte data blocks, but does NOT update |
68 | 68 |
* the bit counters. There are no alignment requirements. |
69 | 69 |
*/ |
70 |
-static void *body(MD5_CTX *ctx, void *data, unsigned long size) |
|
70 |
+static const void *body(MD5_CTX *ctx, const void *data, unsigned long size) |
|
71 | 71 |
{ |
72 |
- unsigned char *ptr; |
|
72 |
+ const unsigned char *ptr; |
|
73 | 73 |
MD5_u32plus a, b, c, d; |
74 | 74 |
MD5_u32plus saved_a, saved_b, saved_c, saved_d; |
75 | 75 |
|
... | ... |
@@ -185,7 +185,7 @@ void MD5_Init(MD5_CTX *ctx) |
185 | 185 |
ctx->hi = 0; |
186 | 186 |
} |
187 | 187 |
|
188 |
-void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) |
|
188 |
+void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size) |
|
189 | 189 |
{ |
190 | 190 |
MD5_u32plus saved_lo; |
191 | 191 |
unsigned long used, free; |
... | ... |
@@ -206,7 +206,7 @@ void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) |
206 | 206 |
} |
207 | 207 |
|
208 | 208 |
memcpy(&ctx->buffer[used], data, free); |
209 |
- data = (unsigned char *)data + free; |
|
209 |
+ data = (const unsigned char *)data + free; |
|
210 | 210 |
size -= free; |
211 | 211 |
body(ctx, ctx->buffer, 64); |
212 | 212 |
} |
... | ... |
@@ -22,7 +22,7 @@ typedef struct { |
22 | 22 |
} MD5_CTX; |
23 | 23 |
|
24 | 24 |
extern void MD5_Init(MD5_CTX *ctx); |
25 |
-extern void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size); |
|
25 |
+extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size); |
|
26 | 26 |
extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); |
27 | 27 |
|
28 | 28 |
#endif |
... | ... |
@@ -63,7 +63,7 @@ |
63 | 63 |
/* northfox does this shitty way, |
64 | 64 |
* this should be done with just a bswap |
65 | 65 |
*/ |
66 |
-char *lzma_bswap_4861dc(struct lzmastate *p, char *old_edx) |
|
66 |
+static char *lzma_bswap_4861dc(struct lzmastate *p, char *old_edx) |
|
67 | 67 |
{ |
68 | 68 |
/* dumb_dump_start |
69 | 69 |
* |
... | ... |
@@ -98,7 +98,7 @@ char *lzma_bswap_4861dc(struct lzmastate *p, char *old_edx) |
98 | 98 |
return p->p0; |
99 | 99 |
} |
100 | 100 |
|
101 |
-uint32_t lzma_486248 (struct lzmastate *p, char **old_ecx, char *src, uint32_t size) |
|
101 |
+static uint32_t lzma_486248 (struct lzmastate *p, char **old_ecx, char *src, uint32_t size) |
|
102 | 102 |
{ |
103 | 103 |
uint32_t loc_esi, loc_edi, loc_eax, loc_ecx, ret; |
104 | 104 |
if (!CLI_ISCONTAINED(src, size, *old_ecx, 4) || !CLI_ISCONTAINED(src, size, p->p0, 1)) |
... | ... |
@@ -151,7 +151,7 @@ uint32_t lzma_486248 (struct lzmastate *p, char **old_ecx, char *src, uint32_t s |
151 | 151 |
|
152 | 152 |
} |
153 | 153 |
|
154 |
-uint32_t lzma_48635C(uint8_t znaczek, char **old_ecx, struct lzmastate *p, uint32_t *retval, char *src, uint32_t size) |
|
154 |
+static uint32_t lzma_48635C(uint8_t znaczek, char **old_ecx, struct lzmastate *p, uint32_t *retval, char *src, uint32_t size) |
|
155 | 155 |
{ |
156 | 156 |
uint32_t loc_esi = (znaczek&0xff) >> 7, /* msb */ |
157 | 157 |
loc_ebx, ret; |
... | ... |
@@ -195,7 +195,7 @@ uint32_t lzma_48635C(uint8_t znaczek, char **old_ecx, struct lzmastate *p, uint3 |
195 | 195 |
return 0; |
196 | 196 |
} |
197 | 197 |
|
198 |
-uint32_t lzma_4862e0 (struct lzmastate *p, char **old_ecx, uint32_t *old_edx, uint32_t *retval, char *src, uint32_t size) |
|
198 |
+static uint32_t lzma_4862e0 (struct lzmastate *p, char **old_ecx, uint32_t *old_edx, uint32_t *retval, char *src, uint32_t size) |
|
199 | 199 |
{ |
200 | 200 |
uint32_t loc_ebx, loc_esi, stack_ecx, ret; |
201 | 201 |
char *loc_edi; |
... | ... |
@@ -228,7 +228,7 @@ uint32_t lzma_4862e0 (struct lzmastate *p, char **old_ecx, uint32_t *old_edx, ui |
228 | 228 |
} |
229 | 229 |
|
230 | 230 |
/* old_edx - write only */ |
231 |
-uint32_t lzma_4863da (uint32_t var0, struct lzmastate *p, char **old_ecx, uint32_t *old_edx, uint32_t *retval, char *src, uint32_t size) |
|
231 |
+static uint32_t lzma_4863da (uint32_t var0, struct lzmastate *p, char **old_ecx, uint32_t *old_edx, uint32_t *retval, char *src, uint32_t size) |
|
232 | 232 |
{ |
233 | 233 |
uint32_t ret; |
234 | 234 |
char *loc_esi = *old_ecx; |
... | ... |
@@ -270,7 +270,7 @@ uint32_t lzma_4863da (uint32_t var0, struct lzmastate *p, char **old_ecx, uint3 |
270 | 270 |
return 0; |
271 | 271 |
} |
272 | 272 |
|
273 |
-uint32_t lzma_486204 (struct lzmastate *p, uint32_t old_edx, uint32_t *retval, char *src, uint32_t size) |
|
273 |
+static uint32_t lzma_486204 (struct lzmastate *p, uint32_t old_edx, uint32_t *retval, char *src, uint32_t size) |
|
274 | 274 |
{ |
275 | 275 |
uint32_t loc_esi, loc_edi, loc_ebx, loc_eax; |
276 | 276 |
char *loc_edx; |
... | ... |
@@ -310,7 +310,7 @@ uint32_t lzma_486204 (struct lzmastate *p, uint32_t old_edx, uint32_t *retval, c |
310 | 310 |
return 0; |
311 | 311 |
} |
312 | 312 |
|
313 |
-uint32_t lzma_48631a (struct lzmastate *p, char **old_ecx, uint32_t *old_edx, uint32_t *retval, char *src, uint32_t size) |
|
313 |
+static uint32_t lzma_48631a (struct lzmastate *p, char **old_ecx, uint32_t *old_edx, uint32_t *retval, char *src, uint32_t size) |
|
314 | 314 |
{ |
315 | 315 |
uint32_t copy1, copy2; |
316 | 316 |
uint32_t loc_esi, loc_edi, ret; |
... | ... |
@@ -308,7 +308,7 @@ static char *cli_md5buff(const char *buffer, unsigned int len, unsigned char *di |
308 | 308 |
|
309 | 309 |
|
310 | 310 |
MD5_Init(&ctx); |
311 |
- MD5_Update(&ctx, (unsigned char *) buffer, len); |
|
311 |
+ MD5_Update(&ctx, (const unsigned char *) buffer, len); |
|
312 | 312 |
MD5_Final(digest, &ctx); |
313 | 313 |
|
314 | 314 |
if(dig) |
... | ... |
@@ -791,7 +791,7 @@ int32_t cli_readint32(const char *buff) |
791 | 791 |
int32_t ret; |
792 | 792 |
|
793 | 793 |
#if WORDS_BIGENDIAN == 0 |
794 |
- ret = *(int32_t *) buff; |
|
794 |
+ ret = *(const int32_t *) buff; |
|
795 | 795 |
#else |
796 | 796 |
ret = buff[0] & 0xff; |
797 | 797 |
ret |= (buff[1] & 0xff) << 8; |
... | ... |
@@ -19,6 +19,9 @@ |
19 | 19 |
* MA 02110-1301, USA. |
20 | 20 |
* |
21 | 21 |
* $Log: phishcheck.c,v $ |
22 |
+ * Revision 1.21 2007/02/11 00:41:13 tkojm |
|
23 |
+ * remove some gcc warnings |
|
24 |
+ * |
|
22 | 25 |
* Revision 1.20 2007/01/30 18:29:21 tkojm |
23 | 26 |
* fix some includes |
24 | 27 |
* |
... | ... |
@@ -296,6 +299,12 @@ static const char adonet[] = "ado.net"; |
296 | 296 |
static const char aspnet[] = "asp.net"; |
297 | 297 |
static const char lt[]="<"; |
298 | 298 |
static const char gt[]=">"; |
299 |
+static const char cid[] = "cid:"; |
|
300 |
+static const char src_text[] = "src"; |
|
301 |
+static const char href_text[] = "href"; |
|
302 |
+static const size_t href_text_len = sizeof(href_text); |
|
303 |
+static const size_t src_text_len = sizeof(src_text); |
|
304 |
+static const size_t cid_len = sizeof(cid)-1; |
|
299 | 305 |
static const size_t dotnet_len = sizeof(dotnet)-1; |
300 | 306 |
static const size_t adonet_len = sizeof(adonet)-1; |
301 | 307 |
static const size_t aspnet_len = sizeof(aspnet)-1; |
... | ... |
@@ -385,8 +394,11 @@ static inline void string_init_c(struct string* dest,char* data); |
385 | 385 |
static void string_assign_null(struct string* dest); |
386 | 386 |
static char *rfind(char *start, char c, size_t len); |
387 | 387 |
static inline char hex2int(const unsigned char* src); |
388 |
+static int isTLD(const struct phishcheck* pchk,const char* str,int len); |
|
389 |
+static enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check* urls); |
|
390 |
+static const char* phishing_ret_toString(enum phish_status rc); |
|
388 | 391 |
|
389 |
-void url_check_init(struct url_check* urls) |
|
392 |
+static void url_check_init(struct url_check* urls) |
|
390 | 393 |
{ |
391 | 394 |
urls->realLink.refcount=0; |
392 | 395 |
urls->realLink.data=empty_string; |
... | ... |
@@ -400,7 +412,7 @@ void url_check_init(struct url_check* urls) |
400 | 400 |
* so that: we don't have to keep in mind who allocated what, and when needs to be freed, |
401 | 401 |
* and thus we won't leak memory*/ |
402 | 402 |
|
403 |
-void string_free(struct string* str) |
|
403 |
+static void string_free(struct string* str) |
|
404 | 404 |
{ |
405 | 405 |
for(;;){ |
406 | 406 |
str->refcount--; |
... | ... |
@@ -418,7 +430,7 @@ void string_free(struct string* str) |
418 | 418 |
} |
419 | 419 |
|
420 | 420 |
/* always use the string_assign when assigning to a string, this makes sure the old one's refcount is decremented*/ |
421 |
-void string_assign(struct string* dest,struct string* src) |
|
421 |
+static void string_assign(struct string* dest,struct string* src) |
|
422 | 422 |
{ |
423 | 423 |
string_free(dest); |
424 | 424 |
src->refcount++; |
... | ... |
@@ -428,15 +440,7 @@ void string_assign(struct string* dest,struct string* src) |
428 | 428 |
} |
429 | 429 |
|
430 | 430 |
/* data will be freed when string freed */ |
431 |
-void string_assign_c(struct string* dest,char* data) |
|
432 |
-{ |
|
433 |
- string_free(dest); |
|
434 |
- dest->data=data; |
|
435 |
- dest->ref=NULL; |
|
436 |
- dest->refcount=1; |
|
437 |
-} |
|
438 |
- |
|
439 |
-/* same as above, but it doesn't free old string, use only for initialization |
|
431 |
+/* it doesn't free old string, use only for initialization |
|
440 | 432 |
* Doesn't allow NULL pointers, they are replaced by pointer to empty string |
441 | 433 |
* */ |
442 | 434 |
static inline void string_init_c(struct string* dest,char* data) |
... | ... |
@@ -447,7 +451,7 @@ static inline void string_init_c(struct string* dest,char* data) |
447 | 447 |
} |
448 | 448 |
|
449 | 449 |
/* make a copy of the string between start -> end*/ |
450 |
-int string_assign_dup(struct string* dest,const char* start,const char* end) |
|
450 |
+static int string_assign_dup(struct string* dest,const char* start,const char* end) |
|
451 | 451 |
{ |
452 | 452 |
char* ret = cli_malloc(end-start+1); |
453 | 453 |
if(!ret) |
... | ... |
@@ -471,7 +475,7 @@ static inline void string_assign_null(struct string* dest) |
471 | 471 |
} |
472 | 472 |
|
473 | 473 |
/* this string uses portion of another string*/ |
474 |
-void string_assign_ref(struct string* dest,struct string* ref,char* data) |
|
474 |
+static void string_assign_ref(struct string* dest,struct string* ref,char* data) |
|
475 | 475 |
{ |
476 | 476 |
string_free(dest); |
477 | 477 |
ref->refcount++; |
... | ... |
@@ -480,7 +484,7 @@ void string_assign_ref(struct string* dest,struct string* ref,char* data) |
480 | 480 |
dest->ref=ref; |
481 | 481 |
} |
482 | 482 |
|
483 |
-void free_if_needed(struct url_check* url) |
|
483 |
+static void free_if_needed(struct url_check* url) |
|
484 | 484 |
{ |
485 | 485 |
string_free(&url->realLink); |
486 | 486 |
string_free(&url->displayLink); |
... | ... |
@@ -515,7 +519,7 @@ static int build_regex(regex_t* preg,const char* regex,int nosub) |
515 | 515 |
static const char* host_regex="cid:.+|mailto:(.+)|([[:alpha:]]+://)?(([^:/?]+@)+([^:/?]+)([:/?].+)?|([^@:/?]+)([:/?].+)?)"; <- this is slower than the function below |
516 | 516 |
*/ |
517 | 517 |
/* allocates memory */ |
518 |
-int get_host(const struct phishcheck* s,struct string* dest,const char* URL,int isReal,int* phishy) |
|
518 |
+static int get_host(const struct phishcheck* s,struct string* dest,const char* URL,int isReal,int* phishy) |
|
519 | 519 |
{ |
520 | 520 |
const char mailto[] = "mailto:"; |
521 | 521 |
int rc,ismailto = 0; |
... | ... |
@@ -595,12 +599,12 @@ int get_host(const struct phishcheck* s,struct string* dest,const char* URL,int |
595 | 595 |
return 0; |
596 | 596 |
} |
597 | 597 |
|
598 |
-int isCountryCode(const struct phishcheck* s,const char* str) |
|
598 |
+static int isCountryCode(const struct phishcheck* s,const char* str) |
|
599 | 599 |
{ |
600 | 600 |
return str ? !regexec(&s->preg_cctld,str,0,NULL,0) : 0; |
601 | 601 |
} |
602 | 602 |
|
603 |
-int isTLD(const struct phishcheck* pchk,const char* str,int len) |
|
603 |
+static int isTLD(const struct phishcheck* pchk,const char* str,int len) |
|
604 | 604 |
{ |
605 | 605 |
if (!str) |
606 | 606 |
return 0; |
... | ... |
@@ -634,7 +638,7 @@ rfind(char *start, char c, size_t len) |
634 | 634 |
return (p < start) ? NULL : p; |
635 | 635 |
} |
636 | 636 |
|
637 |
-void get_domain(const struct phishcheck* pchk,struct string* dest,struct string* host) |
|
637 |
+static void get_domain(const struct phishcheck* pchk,struct string* dest,struct string* host) |
|
638 | 638 |
{ |
639 | 639 |
char* domain; |
640 | 640 |
char* tld = strrchr(host->data,'.'); |
... | ... |
@@ -702,7 +706,7 @@ void reverse_lookup(struct url_check* url,int isReal) |
702 | 702 |
ip_reverse(url,isReal); |
703 | 703 |
} |
704 | 704 |
*/ |
705 |
-int isNumeric(const char* host) |
|
705 |
+static int isNumeric(const char* host) |
|
706 | 706 |
{ |
707 | 707 |
int len = strlen(host); |
708 | 708 |
int a,b,c,d,n=0; |
... | ... |
@@ -717,7 +721,7 @@ int isNumeric(const char* host) |
717 | 717 |
return 0; |
718 | 718 |
} |
719 | 719 |
|
720 |
-int isSSL(const char* URL) |
|
720 |
+static int isSSL(const char* URL) |
|
721 | 721 |
{ |
722 | 722 |
const char https[]="https://"; |
723 | 723 |
return URL ? !strncmp(https,URL,sizeof(https)-1) : 0; |
... | ... |
@@ -872,7 +876,7 @@ str_fixup_spaces(char **begin, const char **end) |
872 | 872 |
} |
873 | 873 |
|
874 | 874 |
/* allocates memory */ |
875 |
-int |
|
875 |
+static int |
|
876 | 876 |
cleanupURL(struct string *URL, int isReal) |
877 | 877 |
{ |
878 | 878 |
char *begin = URL->data; |
... | ... |
@@ -930,11 +934,6 @@ cleanupURL(struct string *URL, int isReal) |
930 | 930 |
return 0; |
931 | 931 |
} |
932 | 932 |
|
933 |
-void get_redirected_URL(struct string* URL) |
|
934 |
-{ |
|
935 |
- /*TODO: see if URL redirects sowhere, if so, then follow |
|
936 |
- returns redirected URL*/ |
|
937 |
-} |
|
938 | 933 |
|
939 | 934 |
/* ---- runtime disable ------*/ |
940 | 935 |
void phish_disable(struct cl_engine* engine, const char* reason) |
... | ... |
@@ -946,10 +945,6 @@ void phish_disable(struct cl_engine* engine, const char* reason) |
946 | 946 |
|
947 | 947 |
int phishingScan(message* m,const char* dir,cli_ctx* ctx,tag_arguments_t* hrefs) |
948 | 948 |
{ |
949 |
- const char src_text[]="src"; |
|
950 |
- const char href_text[]="href"; |
|
951 |
- const size_t href_text_len = sizeof(href_text); |
|
952 |
- const size_t src_text_len = sizeof(src_text); |
|
953 | 949 |
int i; |
954 | 950 |
struct phishcheck* pchk = (struct phishcheck*) ctx->engine->phishcheck; |
955 | 951 |
if(!pchk || pchk->is_disabled) |
... | ... |
@@ -1171,12 +1166,12 @@ void phishing_done(struct cl_engine* engine) |
1171 | 1171 |
* Only those URLs are identified as URLs for which phishing detection can be performed. |
1172 | 1172 |
* This means that no attempt is made to properly recognize 'cid:' URLs |
1173 | 1173 |
*/ |
1174 |
-int isURL(const struct phishcheck* pchk,const char* URL) |
|
1174 |
+static int isURL(const struct phishcheck* pchk,const char* URL) |
|
1175 | 1175 |
{ |
1176 | 1176 |
return URL ? !regexec(&pchk->preg,URL,0,NULL,0) : 0; |
1177 | 1177 |
} |
1178 | 1178 |
|
1179 |
-int isNumericURL(const struct phishcheck* pchk,const char* URL) |
|
1179 |
+static int isNumericURL(const struct phishcheck* pchk,const char* URL) |
|
1180 | 1180 |
{ |
1181 | 1181 |
return URL ? !regexec(&pchk->preg_numeric,URL,0,NULL,0) : 0; |
1182 | 1182 |
} |
... | ... |
@@ -1184,7 +1179,7 @@ int isNumericURL(const struct phishcheck* pchk,const char* URL) |
1184 | 1184 |
/* Cleans up @urls |
1185 | 1185 |
* If URLs are identical after cleanup it will return CL_PHISH_CLEANUP_OK. |
1186 | 1186 |
* */ |
1187 |
-enum phish_status cleanupURLs(struct url_check* urls) |
|
1187 |
+static enum phish_status cleanupURLs(struct url_check* urls) |
|
1188 | 1188 |
{ |
1189 | 1189 |
if(urls->flags&CLEANUP_URL) { |
1190 | 1190 |
cleanupURL(&urls->realLink,1); |
... | ... |
@@ -1197,7 +1192,7 @@ enum phish_status cleanupURLs(struct url_check* urls) |
1197 | 1197 |
return CL_PHISH_NODECISION; |
1198 | 1198 |
} |
1199 | 1199 |
|
1200 |
-int url_get_host(const struct phishcheck* pchk, struct url_check* url,struct url_check* host_url,int isReal,int* phishy) |
|
1200 |
+static int url_get_host(const struct phishcheck* pchk, struct url_check* url,struct url_check* host_url,int isReal,int* phishy) |
|
1201 | 1201 |
{ |
1202 | 1202 |
struct string* host = isReal ? &host_url->realLink : &host_url->displayLink; |
1203 | 1203 |
get_host(pchk, host, isReal ? url->realLink.data : url->displayLink.data, isReal, phishy); |
... | ... |
@@ -1224,14 +1219,14 @@ int url_get_host(const struct phishcheck* pchk, struct url_check* url,struct url |
1224 | 1224 |
return CL_PHISH_NODECISION; |
1225 | 1225 |
} |
1226 | 1226 |
|
1227 |
-void url_get_domain(const struct phishcheck* pchk, struct url_check* url,struct url_check* domains) |
|
1227 |
+static void url_get_domain(const struct phishcheck* pchk, struct url_check* url,struct url_check* domains) |
|
1228 | 1228 |
{ |
1229 | 1229 |
get_domain(pchk, &domains->realLink, &url->realLink); |
1230 | 1230 |
get_domain(pchk, &domains->displayLink, &url->displayLink); |
1231 | 1231 |
domains->flags = url->flags; |
1232 | 1232 |
} |
1233 | 1233 |
|
1234 |
-enum phish_status phishy_map(int phishy,enum phish_status fallback) |
|
1234 |
+static enum phish_status phishy_map(int phishy,enum phish_status fallback) |
|
1235 | 1235 |
{ |
1236 | 1236 |
if(phishy&PHISHY_USERNAME_IN_URL) |
1237 | 1237 |
return CL_PHISH_CLOAKED_UIU; |
... | ... |
@@ -1241,7 +1236,7 @@ enum phish_status phishy_map(int phishy,enum phish_status fallback) |
1241 | 1241 |
return fallback; |
1242 | 1242 |
} |
1243 | 1243 |
|
1244 |
-int isEncoded(const char* url) |
|
1244 |
+static int isEncoded(const char* url) |
|
1245 | 1245 |
{ |
1246 | 1246 |
const char* start=url; |
1247 | 1247 |
size_t cnt=0; |
... | ... |
@@ -1255,18 +1250,16 @@ int isEncoded(const char* url) |
1255 | 1255 |
return (cnt-1 >strlen(url)*7/10);/*more than 70% made up of &#;*/ |
1256 | 1256 |
} |
1257 | 1257 |
|
1258 |
-int whitelist_check(const struct cl_engine* engine,struct url_check* urls,int hostOnly) |
|
1258 |
+static int whitelist_check(const struct cl_engine* engine,struct url_check* urls,int hostOnly) |
|
1259 | 1259 |
{ |
1260 | 1260 |
return whitelist_match(engine,urls->realLink.data,urls->displayLink.data,hostOnly); |
1261 | 1261 |
} |
1262 | 1262 |
|
1263 | 1263 |
|
1264 | 1264 |
/* urls can't contain null pointer, caller must ensure this */ |
1265 |
-enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check* urls) |
|
1265 |
+static enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check* urls) |
|
1266 | 1266 |
{ |
1267 | 1267 |
struct url_check host_url; |
1268 |
- const char cid[] = "cid:"; |
|
1269 |
- const size_t cid_len = sizeof(cid)-1; |
|
1270 | 1268 |
enum phish_status rc=CL_PHISH_NODECISION; |
1271 | 1269 |
int phishy=0; |
1272 | 1270 |
const struct phishcheck* pchk = (const struct phishcheck*) engine->phishcheck; |
... | ... |
@@ -1463,7 +1456,7 @@ enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check* |
1463 | 1463 |
return phishy_map(phishy,CL_PHISH_NOMATCH); |
1464 | 1464 |
} |
1465 | 1465 |
|
1466 |
-const char* phishing_ret_toString(enum phish_status rc) |
|
1466 |
+static const char* phishing_ret_toString(enum phish_status rc) |
|
1467 | 1467 |
{ |
1468 | 1468 |
switch(rc) { |
1469 | 1469 |
case CL_PHISH_CLEAN: |
... | ... |
@@ -76,34 +76,9 @@ struct url_check { |
76 | 76 |
unsigned short link_type; |
77 | 77 |
}; |
78 | 78 |
|
79 |
+#ifdef _MESSAGE_H |
|
79 | 80 |
int phishingScan(message* m,const char* dir,cli_ctx* ctx,tag_arguments_t* hrefs); |
80 |
-enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check* urls); |
|
81 |
- |
|
82 |
-int whitelist_check(const struct cl_engine* engine,struct url_check* urls,int hostOnly); |
|
83 |
-void url_check_init(struct url_check* urls); |
|
84 |
-void string_free(struct string* str); |
|
85 |
-void string_assign(struct string* dest,struct string* src); |
|
86 |
-void string_assign_c(struct string* dest,char* data); |
|
87 |
-int string_assign_dup(struct string* dest,const char* start,const char* end); |
|
88 |
-void string_assign_ref(struct string* dest,struct string* ref,char* data); |
|
89 |
-void free_if_needed(struct url_check* url); |
|
90 |
-int get_host(const struct phishcheck* pchk,struct string* dest,const char* URL,int isReal,int* phishy); |
|
91 |
-int isCountryCode(const struct phishcheck* s,const char* str); |
|
92 |
-int isTLD(const struct phishcheck* s,const char* str,int len); |
|
93 |
-void get_domain(const struct phishcheck* pchk,struct string* dest,struct string* host); |
|
94 |
-int ip_reverse(struct url_check* urls,int isReal); |
|
95 |
-void reverse_lookup(struct url_check* url,int isReal); |
|
96 |
-int isNumeric(const char* host); |
|
97 |
-int isSSL(const char* URL); |
|
98 |
-int cleanupURL(struct string* URL,int isReal); |
|
99 |
-void get_redirected_URL(struct string* URL); |
|
100 |
-int isURL(const struct phishcheck* pchk,const char* URL); |
|
101 |
-enum phish_status cleanupURLs(struct url_check* urls); |
|
102 |
-int isNumericURL(const struct phishcheck* pchk, const char* URL); |
|
103 |
-int url_get_host(const struct phishcheck* pchk, struct url_check* url,struct url_check* host_url,int isReal,int* phishy); |
|
104 |
-void url_get_domain(const struct phishcheck* pchk, struct url_check* url,struct url_check* domains); |
|
105 |
-enum phish_status phishy_map(int phishy,enum phish_status fallback); |
|
106 |
-int isEncoded(const char* url); |
|
81 |
+#endif |
|
107 | 82 |
|
108 | 83 |
void phish_disable(struct cl_engine* engine,const char* reason); |
109 | 84 |
/* Global, non-thread-safe functions, call only once! */ |
... | ... |
@@ -142,7 +117,6 @@ static inline int isPhishing(enum phish_status rc) |
142 | 142 |
return 1; |
143 | 143 |
} |
144 | 144 |
} |
145 |
-const char* phishing_ret_toString(enum phish_status rc); |
|
146 | 145 |
#endif |
147 | 146 |
|
148 | 147 |
#endif |
... | ... |
@@ -70,7 +70,7 @@ static const uint32_t K[64] = { |
70 | 70 |
} while (0) |
71 | 71 |
|
72 | 72 |
#ifndef EXTRACT_UCHAR |
73 |
-#define EXTRACT_UCHAR(p) (*(unsigned char *)(p)) |
|
73 |
+#define EXTRACT_UCHAR(p) (*(const unsigned char *)(p)) |
|
74 | 74 |
#endif |
75 | 75 |
|
76 | 76 |
#define STRING2INT(s) ((((((EXTRACT_UCHAR(s) << 8) \ |
... | ... |
@@ -79,7 +79,7 @@ static const uint32_t K[64] = { |
79 | 79 |
| EXTRACT_UCHAR(s+3)) |
80 | 80 |
|
81 | 81 |
#ifndef EXTRACT_UCHAR |
82 |
-#define EXTRACT_UCHAR(p) (*(mutils_word8 *)(p)) |
|
82 |
+#define EXTRACT_UCHAR(p) (*(const mutils_word8 *)(p)) |
|
83 | 83 |
#endif |
84 | 84 |
|
85 | 85 |
#define STRING2INT(s) ((((((EXTRACT_UCHAR(s) << 8) \ |
... | ... |
@@ -53,7 +53,7 @@ |
53 | 53 |
|
54 | 54 |
extern short cli_leavetemps_flag; |
55 | 55 |
|
56 |
-static char *langcodes[] = { |
|
56 |
+static const char *langcodes[] = { |
|
57 | 57 |
"", "EN", "FR", "GE", "SP", "IT", "SW", "DA", "NO", "FI", "AM", |
58 | 58 |
"SF", "SG", "PO", "TU", "IC", "RU", "HU", "DU", "BL", "AU", "BG", |
59 | 59 |
"AS", "NZ", "IF", "CS", "SK", "PL", "SL", "TC", "HK", "ZH", "JA", |
... | ... |
@@ -200,7 +200,7 @@ char *cli_utf16toascii(const char *str, unsigned int length) |
200 | 200 |
|
201 | 201 |
int cli_strbcasestr(const char *haystack, const char *needle) |
202 | 202 |
{ |
203 |
- char *pt = (char *) haystack; |
|
203 |
+ const char *pt = haystack; |
|
204 | 204 |
int i, j; |
205 | 205 |
|
206 | 206 |
i = strlen(haystack); |
... | ... |
@@ -22,6 +22,7 @@ |
22 | 22 |
*/ |
23 | 23 |
|
24 | 24 |
#include "unrar.h" |
25 |
+#include "unrar15.h" |
|
25 | 26 |
#include <string.h> |
26 | 27 |
|
27 | 28 |
#define STARTL1 2 |
... | ... |
@@ -423,7 +424,7 @@ static void long_lz(unpack_data_t *unpack_data) |
423 | 423 |
if (distance <= 256) { |
424 | 424 |
length += 8; |
425 | 425 |
} |
426 |
- if (old_avr3 > 0xb0 || unpack_data->avr_plc >= 0x2a00 && old_avr2 < 0x40) { |
|
426 |
+ if (old_avr3 > 0xb0 || (unpack_data->avr_plc >= 0x2a00 && old_avr2 < 0x40)) { |
|
427 | 427 |
unpack_data->max_dist3 = 0x7f00; |
428 | 428 |
} else { |
429 | 429 |
unpack_data->max_dist3 = 0x2001; |
... | ... |
@@ -31,7 +31,7 @@ |
31 | 31 |
#ifdef RAR_HIGH_DEBUG |
32 | 32 |
#define rar_dbgmsg printf |
33 | 33 |
#else |
34 |
-static void rar_dbgmsg(){}; |
|
34 |
+static void rar_dbgmsg(const char* fmt,...){} |
|
35 | 35 |
#endif |
36 | 36 |
|
37 | 37 |
#define MAX(a,b) (((a) > (b)) ? (a) : (b)) |
... | ... |
@@ -164,7 +164,7 @@ static void rar_mem_blk_insertAt(rar_mem_blk_t *a, rar_mem_blk_t *p) |
164 | 164 |
p->next = a->next->prev = a; |
165 | 165 |
} |
166 | 166 |
|
167 |
-static int rar_mem_blk_remove(rar_mem_blk_t *a) |
|
167 |
+static void rar_mem_blk_remove(rar_mem_blk_t *a) |
|
168 | 168 |
{ |
169 | 169 |
a->prev->next = a->next; |
170 | 170 |
a->next->prev = a->prev; |
... | ... |
@@ -56,7 +56,7 @@ inline static void __fixup_rootseek(off_t offset_of_trailer, struct zip_disk_tra |
56 | 56 |
trailer->z_rootseek = (uint32_t) (offset_of_trailer - EC32(trailer->z_rootsize)); |
57 | 57 |
} |
58 | 58 |
|
59 |
-int __zip_find_disk_trailer(int fd, off_t filesize, struct zip_disk_trailer *trailer, off_t *start) |
|
59 |
+static int __zip_find_disk_trailer(int fd, off_t filesize, struct zip_disk_trailer *trailer, off_t *start) |
|
60 | 60 |
{ |
61 | 61 |
char *buf, *end, *tail; |
62 | 62 |
off_t offset = 0, bufsize; |
... | ... |
@@ -165,7 +165,7 @@ int __zip_find_disk_trailer(int fd, off_t filesize, struct zip_disk_trailer *tra |
165 | 165 |
return CL_EFORMAT; |
166 | 166 |
} |
167 | 167 |
|
168 |
-int __zip_parse_root_directory(int fd, struct zip_disk_trailer *trailer, zip_dir_hdr **hdr_return, off_t start) |
|
168 |
+static int __zip_parse_root_directory(int fd, struct zip_disk_trailer *trailer, zip_dir_hdr **hdr_return, off_t start) |
|
169 | 169 |
{ |
170 | 170 |
struct zip_root_dirent dirent, *d; |
171 | 171 |
zip_dir_hdr *hdr, *hdr0, *prev_hdr; |
... | ... |
@@ -48,6 +48,7 @@ |
48 | 48 |
|
49 | 49 |
#include "cltypes.h" |
50 | 50 |
#include "others.h" |
51 |
+#include "upx.h" |
|
51 | 52 |
|
52 | 53 |
#define PEALIGN(o,a) (((a))?(((o)/(a))*(a)):(o)) |
53 | 54 |
#define PESALIGN(o,a) (((a))?(((o)/(a)+((o)%(a)!=0))*(a)):(o)) |
... | ... |
@@ -70,7 +71,7 @@ |
70 | 70 |
|
71 | 71 |
/* PE from UPX */ |
72 | 72 |
|
73 |
-int pefromupx (char *src, char *dst, uint32_t *dsize, uint32_t ep, uint32_t upx0, uint32_t upx1, uint32_t magic) |
|
73 |
+static int pefromupx (char *src, char *dst, uint32_t *dsize, uint32_t ep, uint32_t upx0, uint32_t upx1, uint32_t magic) |
|
74 | 74 |
{ |
75 | 75 |
char *imports, *sections, *pehdr, *newbuf; |
76 | 76 |
int sectcnt, upd=1; |
... | ... |
@@ -59,7 +59,7 @@ struct cdiff_ctx { |
59 | 59 |
}; |
60 | 60 |
|
61 | 61 |
struct cdiff_cmd { |
62 |
- char *name; |
|
62 |
+ const char *name; |
|
63 | 63 |
unsigned short argc; |
64 | 64 |
int (*handler)(const char *, struct cdiff_ctx *); |
65 | 65 |
}; |
... | ... |
@@ -97,7 +97,7 @@ static struct cdiff_cmd commands[] = { |
97 | 97 |
{ NULL, 0, NULL } |
98 | 98 |
}; |
99 | 99 |
|
100 |
-void cdiff_ctx_free(struct cdiff_ctx *ctx) |
|
100 |
+static void cdiff_ctx_free(struct cdiff_ctx *ctx) |
|
101 | 101 |
{ |
102 | 102 |
struct cdiff_node *pt; |
103 | 103 |
|
... | ... |
@@ -122,7 +122,7 @@ struct cfgoption cfg_options[] = { |
122 | 122 |
{NULL, 0, 0, NULL, 0, 0} |
123 | 123 |
}; |
124 | 124 |
|
125 |
-static int regcfg(struct cfgstruct **copt, char *optname, char *strarg, int numarg, short multiple); |
|
125 |
+static int regcfg(struct cfgstruct **copt, const char *optname, char *strarg, int numarg, short multiple); |
|
126 | 126 |
|
127 | 127 |
struct cfgstruct *getcfg(const char *cfgfile, int verbose) |
128 | 128 |
{ |
... | ... |
@@ -435,7 +435,7 @@ struct cfgstruct *cfgopt(const struct cfgstruct *copt, const char *optname) |
435 | 435 |
return NULL; |
436 | 436 |
} |
437 | 437 |
|
438 |
-static int regcfg(struct cfgstruct **copt, char *optname, char *strarg, int numarg, short multiple) |
|
438 |
+static int regcfg(struct cfgstruct **copt, const char *optname, char *strarg, int numarg, short multiple) |
|
439 | 439 |
{ |
440 | 440 |
struct cfgstruct *newnode, *pt; |
441 | 441 |
|
... | ... |
@@ -196,7 +196,7 @@ struct optstruct *opt_parse(int argc, char * const *argv, const char *getopt_sho |
196 | 196 |
return opt; |
197 | 197 |
} |
198 | 198 |
|
199 |
-int opt_check(const struct optstruct *opt, char *optlong) |
|
199 |
+int opt_check(const struct optstruct *opt, const char *optlong) |
|
200 | 200 |
{ |
201 | 201 |
struct optnode *handler; |
202 | 202 |
|
... | ... |
@@ -217,7 +217,7 @@ int opt_check(const struct optstruct *opt, char *optlong) |
217 | 217 |
return 0; |
218 | 218 |
} |
219 | 219 |
|
220 |
-char *opt_arg(const struct optstruct *opt, char *optlong) |
|
220 |
+char *opt_arg(const struct optstruct *opt, const char *optlong) |
|
221 | 221 |
{ |
222 | 222 |
struct optnode *handler; |
223 | 223 |
|
... | ... |
@@ -39,9 +39,9 @@ void opt_free(struct optstruct *opt); |
39 | 39 |
|
40 | 40 |
struct optstruct *opt_parse(int argc, char * const *argv, const char *getopt_short, const struct option *options_long, const char * const *accepted_long); |
41 | 41 |
|
42 |
-int opt_check(const struct optstruct *opt, char *optlong); |
|
42 |
+int opt_check(const struct optstruct *opt, const char *optlong); |
|
43 | 43 |
|
44 |
-char *opt_arg(const struct optstruct *opt, char *optlong); |
|
44 |
+char *opt_arg(const struct optstruct *opt, const char *optlong); |
|
45 | 45 |
|
46 | 46 |
char *opt_firstarg(const struct optstruct *opt, const char *optlong, const struct optnode **optnode); |
47 | 47 |
|
... | ... |
@@ -36,13 +36,13 @@ |
36 | 36 |
typedef struct mac_token_tag |
37 | 37 |
{ |
38 | 38 |
unsigned char token; |
39 |
- unsigned char *str; |
|
39 |
+ const unsigned char *str; |
|
40 | 40 |
} mac_token_t; |
41 | 41 |
|
42 | 42 |
typedef struct mac_token2_tag |
43 | 43 |
{ |
44 | 44 |
uint16_t token; |
45 |
- unsigned char *str; |
|
45 |
+ const unsigned char *str; |
|
46 | 46 |
|
47 | 47 |
} mac_token2_t; |
48 | 48 |
|