git-svn: trunk@1385
Nigel Horne authored on 2005/03/10 17:53:33... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: binhex.c,v $ |
20 |
+ * Revision 1.14 2005/03/10 08:51:30 nigelhorne |
|
21 |
+ * Tidy |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.13 2005/01/19 05:29:41 nigelhorne |
21 | 24 |
* tidy |
22 | 25 |
* |
... | ... |
@@ -54,7 +57,7 @@ |
54 | 54 |
* First draft of binhex.c |
55 | 55 |
* |
56 | 56 |
*/ |
57 |
-static char const rcsid[] = "$Id: binhex.c,v 1.13 2005/01/19 05:29:41 nigelhorne Exp $"; |
|
57 |
+static char const rcsid[] = "$Id: binhex.c,v 1.14 2005/03/10 08:51:30 nigelhorne Exp $"; |
|
58 | 58 |
|
59 | 59 |
#include "clamav.h" |
60 | 60 |
|
... | ... |
@@ -108,7 +111,7 @@ cli_binhex(const char *dir, int desc) |
108 | 108 |
if(fstat(desc, &statb) < 0) |
109 | 109 |
return CL_EOPEN; |
110 | 110 |
|
111 |
- size = statb.st_size; |
|
111 |
+ size = (size_t)statb.st_size; |
|
112 | 112 |
|
113 | 113 |
if(size == 0) |
114 | 114 |
return CL_CLEAN; |
... | ... |
@@ -141,7 +144,7 @@ cli_binhex(const char *dir, int desc) |
141 | 141 |
|
142 | 142 |
/*printf("%d: ", length);*/ |
143 | 143 |
|
144 |
- line = cli_realloc(line, length + 1); |
|
144 |
+ line = cli_realloc(line, (size_t)(length + 1)); |
|
145 | 145 |
|
146 | 146 |
memcpy(line, buf, length); |
147 | 147 |
line[length] = '\0'; |
... | ... |
@@ -16,6 +16,9 @@ |
16 | 16 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | 17 |
* |
18 | 18 |
* $Log: line.c,v $ |
19 |
+ * Revision 1.9 2005/03/10 08:53:33 nigelhorne |
|
20 |
+ * Tidy |
|
21 |
+ * |
|
19 | 22 |
* Revision 1.8 2005/03/01 11:38:11 nigelhorne |
20 | 23 |
* Fix typo |
21 | 24 |
* |
... | ... |
@@ -42,7 +45,7 @@ |
42 | 42 |
* |
43 | 43 |
*/ |
44 | 44 |
|
45 |
-static char const rcsid[] = "$Id: line.c,v 1.8 2005/03/01 11:38:11 nigelhorne Exp $"; |
|
45 |
+static char const rcsid[] = "$Id: line.c,v 1.9 2005/03/10 08:53:33 nigelhorne Exp $"; |
|
46 | 46 |
|
47 | 47 |
#if HAVE_CONFIG_H |
48 | 48 |
#include "clamav-config.h" |
... | ... |
@@ -111,7 +114,7 @@ lineCreate(const char *data) |
111 | 111 |
line_t *ret = (line_t *)cli_malloc(size + 2); |
112 | 112 |
|
113 | 113 |
if(ret == NULL) |
114 |
- return NULL; |
|
114 |
+ return (line_t *)NULL; |
|
115 | 115 |
|
116 | 116 |
ret[0] = (char)1; |
117 | 117 |
/*strcpy(&ret[1], data);*/ |
... | ... |
@@ -125,7 +128,7 @@ line_t * |
125 | 125 |
lineLink(line_t *line) |
126 | 126 |
{ |
127 | 127 |
assert(line != NULL); |
128 |
- if((unsigned char)line[0] == 255) { |
|
128 |
+ if((unsigned char)line[0] == (unsigned char)255) { |
|
129 | 129 |
cli_dbgmsg("lineLink: linkcount too large (%s)\n", lineGetData(line)); |
130 | 130 |
return lineCreate(lineGetData(line)); |
131 | 131 |
} |
... | ... |
@@ -155,6 +158,6 @@ lineGetData(const line_t *line) |
155 | 155 |
unsigned char |
156 | 156 |
lineGetRefCount(const line_t *line) |
157 | 157 |
{ |
158 |
- return line[0]; |
|
158 |
+ return (unsigned char)line[0]; |
|
159 | 159 |
} |
160 | 160 |
#endif |
... | ... |
@@ -16,6 +16,9 @@ |
16 | 16 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | 17 |
* |
18 | 18 |
* $Log: text.c,v $ |
19 |
+ * Revision 1.15 2005/03/10 08:50:49 nigelhorne |
|
20 |
+ * Tidy |
|
21 |
+ * |
|
19 | 22 |
* Revision 1.14 2005/01/19 05:31:55 nigelhorne |
20 | 23 |
* Added textIterate |
21 | 24 |
* |
... | ... |
@@ -51,7 +54,7 @@ |
51 | 51 |
* |
52 | 52 |
*/ |
53 | 53 |
|
54 |
-static char const rcsid[] = "$Id: text.c,v 1.14 2005/01/19 05:31:55 nigelhorne Exp $"; |
|
54 |
+static char const rcsid[] = "$Id: text.c,v 1.15 2005/03/10 08:50:49 nigelhorne Exp $"; |
|
55 | 55 |
|
56 | 56 |
#if HAVE_CONFIG_H |
57 | 57 |
#include "clamav-config.h" |
... | ... |
@@ -95,7 +98,7 @@ textDestroy(text *t_head) |
95 | 95 |
while(t_head) { |
96 | 96 |
text *t_next = t_head->t_next; |
97 | 97 |
if(t_head->t_line) |
98 |
- lineUnlink(t_head->t_line); |
|
98 |
+ (void)lineUnlink(t_head->t_line); |
|
99 | 99 |
free(t_head); |
100 | 100 |
t_head = t_next; |
101 | 101 |
} |
... | ... |
@@ -127,7 +130,11 @@ textCopy(const text *t_head) |
127 | 127 |
last = last->t_next; |
128 | 128 |
} |
129 | 129 |
|
130 |
- assert(last != NULL); |
|
130 |
+ if(last == NULL) { |
|
131 |
+ if(first) |
|
132 |
+ textDestroy(first); |
|
133 |
+ return NULL; |
|
134 |
+ } |
|
131 | 135 |
|
132 | 136 |
if(t_head->t_line) |
133 | 137 |
last->t_line = lineLink(t_head->t_line); |
... | ... |
@@ -221,7 +228,7 @@ textToBlob(const text *t, blob *b) |
221 | 221 |
|
222 | 222 |
s = 0; |
223 | 223 |
|
224 |
- textIterate(t, getLength, &s); |
|
224 |
+ (void)textIterate(t, getLength, &s); |
|
225 | 225 |
|
226 | 226 |
if(s == 0) |
227 | 227 |
return b; |
... | ... |
@@ -235,7 +242,7 @@ textToBlob(const text *t, blob *b) |
235 | 235 |
|
236 | 236 |
blobGrow(b, s); |
237 | 237 |
|
238 |
- textIterate(t, addToBlob, b); |
|
238 |
+ (void)textIterate(t, addToBlob, b); |
|
239 | 239 |
|
240 | 240 |
blobClose(b); |
241 | 241 |
|
... | ... |
@@ -21,6 +21,9 @@ |
21 | 21 |
* |
22 | 22 |
* Change History: |
23 | 23 |
* $Log: untar.c,v $ |
24 |
+ * Revision 1.22 2005/03/10 08:52:10 nigelhorne |
|
25 |
+ * Tidy |
|
26 |
+ * |
|
24 | 27 |
* Revision 1.21 2005/02/16 22:19:21 nigelhorne |
25 | 28 |
* Check file close |
26 | 29 |
* |
... | ... |
@@ -85,7 +88,7 @@ |
85 | 85 |
* First draft |
86 | 86 |
* |
87 | 87 |
*/ |
88 |
-static char const rcsid[] = "$Id: untar.c,v 1.21 2005/02/16 22:19:21 nigelhorne Exp $"; |
|
88 |
+static char const rcsid[] = "$Id: untar.c,v 1.22 2005/03/10 08:52:10 nigelhorne Exp $"; |
|
89 | 89 |
|
90 | 90 |
#include <stdio.h> |
91 | 91 |
#include <errno.h> |
... | ... |
@@ -127,7 +130,7 @@ octal(const char *str) |
127 | 127 |
{ |
128 | 128 |
int ret = -1; |
129 | 129 |
|
130 |
- sscanf(str, "%o", (unsigned int *)&ret); |
|
130 |
+ (void)sscanf(str, "%o", (unsigned int *)&ret); |
|
131 | 131 |
return ret; |
132 | 132 |
} |
133 | 133 |
|
... | ... |
@@ -143,7 +146,7 @@ cli_untar(const char *dir, int desc) |
143 | 143 |
|
144 | 144 |
for(;;) { |
145 | 145 |
char block[BLOCKSIZE]; |
146 |
- const int nread = cli_readn(desc, block, sizeof(block)); |
|
146 |
+ const int nread = cli_readn(desc, block, (unsigned int)sizeof(block)); |
|
147 | 147 |
|
148 | 148 |
if(!in_block && nread == 0) |
149 | 149 |
break; |