Browse code

cosmetics (bb#2207)

Tomasz Kojm authored on 2011/03/12 04:30:45
Showing 12 changed files
... ...
@@ -146,9 +146,7 @@ int main(int argc, char **argv)
146 146
 
147 147
     if(optget(opts, "debug")->enabled) {
148 148
 #if defined(C_LINUX)
149
-	    /* njh@bandsman.co.uk: create a dump if needed */
150
-	    struct rlimit rlim;
151
-
149
+	/* njh@bandsman.co.uk: create a dump if needed */
152 150
 	rlim.rlim_cur = rlim.rlim_max = RLIM_INFINITY;
153 151
 	if(setrlimit(RLIMIT_CORE, &rlim) < 0)
154 152
 	    perror("setrlimit");
... ...
@@ -19,8 +19,8 @@
19 19
 
20 20
 #ifdef CLAMUKO
21 21
 
22
-#ifndef __CLAMUKO_H
23
-#define __CLAMUKO_H
22
+#ifndef __CLAMUKOFS_H
23
+#define __CLAMUKOFS_H
24 24
 
25 25
 extern void *clamukofsth(void *arg);
26 26
 
... ...
@@ -233,7 +233,6 @@ int command(client_conn_t *conn, int *virus)
233 233
 	    break;
234 234
 	case COMMAND_MULTISCAN: {
235 235
 	    int multiscan, max, alive;
236
-	    struct stat sb;
237 236
 
238 237
 	    /* use MULTISCAN only for directories (bb #1869) */
239 238
 	    if (stat(conn->filename, &sb) == 0 &&
... ...
@@ -82,7 +82,6 @@ extern struct optstruct *clamdopts;
82 82
 static int isremote(const struct optstruct *opts) {
83 83
     int s, ret;
84 84
     const struct optstruct *opt;
85
-    const char *clamd_conf = optget(opts, "config-file")->strarg;
86 85
     static struct sockaddr_in testsock;
87 86
 
88 87
 #ifndef _WIN32
... ...
@@ -190,7 +190,7 @@ static int ftw_chkpath(const char *path, struct cli_ftw_cbdata *data)
190 190
  * This is used only in non IDSESSION mode
191 191
  * Returns the number of infected files or -1 on error */
192 192
 int dsresult(int sockd, int scantype, const char *filename, int *printok, int *errors) {
193
-    int infected = 0, len, beenthere = 0;
193
+    int infected = 0, len = 0, beenthere = 0;
194 194
     char *bol, *eol;
195 195
     struct RCVLN rcv;
196 196
     struct stat sb;
... ...
@@ -455,7 +455,7 @@ static int dspresult(struct client_parallel_data *c) {
455 455
 static int parallel_callback(struct stat *sb, char *filename, const char *path, enum cli_ftw_reason reason, struct cli_ftw_cbdata *data) {
456 456
     struct client_parallel_data *c = (struct client_parallel_data *)data->data;
457 457
     struct SCANID *cid;
458
-    int res;
458
+    int res = CL_CLEAN;
459 459
 
460 460
     if(chkpath(path))
461 461
 	return CL_SUCCESS;
... ...
@@ -64,7 +64,7 @@ cli_events_t *cli_events_new(unsigned max_event)
64 64
 void cli_events_free(cli_events_t *ev)
65 65
 {
66 66
     if (ev) {
67
-	//TODO: free components
67
+	/* TODO: free components */
68 68
 	free(ev->events);
69 69
 	free(ev);
70 70
     }
... ...
@@ -133,7 +133,7 @@ static inline int hm_cmp(const uint8_t *itm, const uint8_t *ref, unsigned int ke
133 133
     return memcmp(&itm[4], &ref[4], keylen - 4);
134 134
 }
135 135
 
136
-void hm_sort(struct cli_sz_hash *szh, size_t l, size_t r, unsigned int keylen) {
136
+static void hm_sort(struct cli_sz_hash *szh, size_t l, size_t r, unsigned int keylen) {
137 137
     uint8_t piv[32], tmph[32];
138 138
     size_t l1, r1;
139 139
 
... ...
@@ -814,7 +814,7 @@ int cli_fmap_scandesc(cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struct cli
814 814
     return (acmode & AC_SCAN_FT) ? type : CL_CLEAN;
815 815
 }
816 816
 
817
-int cli_matchmeta(cli_ctx *ctx, const char *fname, size_t fsizec, size_t fsizer, int encrypted, int filepos, int res1, void *res2)
817
+int cli_matchmeta(cli_ctx *ctx, const char *fname, size_t fsizec, size_t fsizer, int encrypted, unsigned int filepos, int res1, void *res2)
818 818
 {
819 819
 	const struct cli_cdb *cdb;
820 820
 
... ...
@@ -171,6 +171,6 @@ int cli_caloff(const char *offstr, const struct cli_target_info *info, unsigned
171 171
 
172 172
 int cli_checkfp(unsigned char *digest, size_t size, cli_ctx *ctx);
173 173
 
174
-int cli_matchmeta(cli_ctx *ctx, const char *fname, size_t fsizec, size_t fsizer, int encrypted, int filepos, int res1, void *res2);
174
+int cli_matchmeta(cli_ctx *ctx, const char *fname, size_t fsizec, size_t fsizer, int encrypted, unsigned int filepos, int res1, void *res2);
175 175
 
176 176
 #endif
... ...
@@ -210,7 +210,7 @@ struct vinfo_list {
210 210
     unsigned int count;
211 211
 };
212 212
 
213
-int versioninfo_cb(void *opaque, uint32_t type, uint32_t name, uint32_t lang, uint32_t rva) {
213
+static int versioninfo_cb(void *opaque, uint32_t type, uint32_t name, uint32_t lang, uint32_t rva) {
214 214
     struct vinfo_list *vlist = (struct vinfo_list *)opaque;
215 215
 
216 216
     cli_dbgmsg("versioninfo_cb: type: %x, name: %x, lang: %x, rva: %x\n", type, name, lang, rva);
... ...
@@ -1326,7 +1326,7 @@ int cli_scanpe(cli_ctx *ctx)
1326 1326
 	    if(dirs[2].Size) {
1327 1327
 		    struct swizz_stats *stats = cli_calloc(1, sizeof(*stats));
1328 1328
 		    unsigned int m = 1000;
1329
-		    int ret = CL_CLEAN;
1329
+		    ret = CL_CLEAN;
1330 1330
 
1331 1331
 		    if (!stats)
1332 1332
 			    ret = CL_EMEM;
... ...
@@ -2211,11 +2211,11 @@ int cli_scanpe(cli_ctx *ctx)
2211 2211
 
2212 2212
     while (DCONF & PE_CONF_NSPACK) {
2213 2213
 	uint32_t eprva = vep;
2214
-	uint32_t start_of_stuff, ssize, dsize, rep = ep;
2214
+	uint32_t start_of_stuff, rep = ep;
2215 2215
 	unsigned int nowinldr;
2216 2216
 	char *nbuff;
2217
-	char *src=epbuff, *dest;
2218 2217
 
2218
+	src=epbuff;
2219 2219
 	if (*epbuff=='\xe9') { /* bitched headers */
2220 2220
 	    eprva = cli_readint32(epbuff+1)+vep+5;
2221 2221
 	    if (!(rep = cli_rawaddr(eprva, exe_sections, nsections, &err, fsize, hdr_size)) && err) break;
... ...
@@ -2466,7 +2466,6 @@ int cli_peheader(fmap_t *map, struct cli_exe_info *peinfo)
2466 2466
 	struct vinfo_list vlist;
2467 2467
 	uint8_t *vptr, *baseptr;
2468 2468
     	uint32_t rva, res_sz;
2469
-	unsigned int i;
2470 2469
 
2471 2470
 	memset(&vlist, 0, sizeof(vlist));
2472 2471
     	findres(0x10, 0xffffffff, EC32(dirs[2].VirtualAddress), map, peinfo->section, peinfo->nsections, hdr_size, versioninfo_cb, &vlist);
... ...
@@ -86,6 +86,7 @@
86 86
 #include "7z.h"
87 87
 #include "fmap.h"
88 88
 #include "cache.h"
89
+#include "events.h"
89 90
 
90 91
 #ifdef HAVE_BZLIB_H
91 92
 #include <bzlib.h>
... ...
@@ -291,7 +291,7 @@ static int cdiff_cmd_del(const char *cmdstr, struct cdiff_ctx *ctx, char *lbuf,
291 291
 static int cdiff_cmd_xchg(const char *cmdstr, struct cdiff_ctx *ctx, char *lbuf, unsigned int lbuflen)
292 292
 {
293 293
 	char *arg, *arg2;
294
-	struct cdiff_node *pt, *last, *new;
294
+	struct cdiff_node *new;
295 295
 	unsigned int lineno;
296 296
 
297 297