git-svn: trunk@1385
This commit is contained in:
Nigel Horne 2005-03-10 08:53:33 +00:00
parent 7089d180bb
commit 9c10719039
4 changed files with 31 additions and 15 deletions

View file

@ -17,6 +17,9 @@
* *
* Change History: * Change History:
* $Log: binhex.c,v $ * $Log: binhex.c,v $
* Revision 1.14 2005/03/10 08:51:30 nigelhorne
* Tidy
*
* Revision 1.13 2005/01/19 05:29:41 nigelhorne * Revision 1.13 2005/01/19 05:29:41 nigelhorne
* tidy * tidy
* *
@ -54,7 +57,7 @@
* First draft of binhex.c * First draft of binhex.c
* *
*/ */
static char const rcsid[] = "$Id: binhex.c,v 1.13 2005/01/19 05:29:41 nigelhorne Exp $"; static char const rcsid[] = "$Id: binhex.c,v 1.14 2005/03/10 08:51:30 nigelhorne Exp $";
#include "clamav.h" #include "clamav.h"
@ -108,7 +111,7 @@ cli_binhex(const char *dir, int desc)
if(fstat(desc, &statb) < 0) if(fstat(desc, &statb) < 0)
return CL_EOPEN; return CL_EOPEN;
size = statb.st_size; size = (size_t)statb.st_size;
if(size == 0) if(size == 0)
return CL_CLEAN; return CL_CLEAN;
@ -141,7 +144,7 @@ cli_binhex(const char *dir, int desc)
/*printf("%d: ", length);*/ /*printf("%d: ", length);*/
line = cli_realloc(line, length + 1); line = cli_realloc(line, (size_t)(length + 1));
memcpy(line, buf, length); memcpy(line, buf, length);
line[length] = '\0'; line[length] = '\0';

View file

@ -16,6 +16,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log: line.c,v $ * $Log: line.c,v $
* Revision 1.9 2005/03/10 08:53:33 nigelhorne
* Tidy
*
* Revision 1.8 2005/03/01 11:38:11 nigelhorne * Revision 1.8 2005/03/01 11:38:11 nigelhorne
* Fix typo * Fix typo
* *
@ -42,7 +45,7 @@
* *
*/ */
static char const rcsid[] = "$Id: line.c,v 1.8 2005/03/01 11:38:11 nigelhorne Exp $"; static char const rcsid[] = "$Id: line.c,v 1.9 2005/03/10 08:53:33 nigelhorne Exp $";
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include "clamav-config.h" #include "clamav-config.h"
@ -111,7 +114,7 @@ lineCreate(const char *data)
line_t *ret = (line_t *)cli_malloc(size + 2); line_t *ret = (line_t *)cli_malloc(size + 2);
if(ret == NULL) if(ret == NULL)
return NULL; return (line_t *)NULL;
ret[0] = (char)1; ret[0] = (char)1;
/*strcpy(&ret[1], data);*/ /*strcpy(&ret[1], data);*/
@ -125,7 +128,7 @@ line_t *
lineLink(line_t *line) lineLink(line_t *line)
{ {
assert(line != NULL); assert(line != NULL);
if((unsigned char)line[0] == 255) { if((unsigned char)line[0] == (unsigned char)255) {
cli_dbgmsg("lineLink: linkcount too large (%s)\n", lineGetData(line)); cli_dbgmsg("lineLink: linkcount too large (%s)\n", lineGetData(line));
return lineCreate(lineGetData(line)); return lineCreate(lineGetData(line));
} }
@ -155,6 +158,6 @@ lineGetData(const line_t *line)
unsigned char unsigned char
lineGetRefCount(const line_t *line) lineGetRefCount(const line_t *line)
{ {
return line[0]; return (unsigned char)line[0];
} }
#endif #endif

View file

@ -16,6 +16,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log: text.c,v $ * $Log: text.c,v $
* Revision 1.15 2005/03/10 08:50:49 nigelhorne
* Tidy
*
* Revision 1.14 2005/01/19 05:31:55 nigelhorne * Revision 1.14 2005/01/19 05:31:55 nigelhorne
* Added textIterate * Added textIterate
* *
@ -51,7 +54,7 @@
* *
*/ */
static char const rcsid[] = "$Id: text.c,v 1.14 2005/01/19 05:31:55 nigelhorne Exp $"; static char const rcsid[] = "$Id: text.c,v 1.15 2005/03/10 08:50:49 nigelhorne Exp $";
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include "clamav-config.h" #include "clamav-config.h"
@ -95,7 +98,7 @@ textDestroy(text *t_head)
while(t_head) { while(t_head) {
text *t_next = t_head->t_next; text *t_next = t_head->t_next;
if(t_head->t_line) if(t_head->t_line)
lineUnlink(t_head->t_line); (void)lineUnlink(t_head->t_line);
free(t_head); free(t_head);
t_head = t_next; t_head = t_next;
} }
@ -127,7 +130,11 @@ textCopy(const text *t_head)
last = last->t_next; last = last->t_next;
} }
assert(last != NULL); if(last == NULL) {
if(first)
textDestroy(first);
return NULL;
}
if(t_head->t_line) if(t_head->t_line)
last->t_line = lineLink(t_head->t_line); last->t_line = lineLink(t_head->t_line);
@ -221,7 +228,7 @@ textToBlob(const text *t, blob *b)
s = 0; s = 0;
textIterate(t, getLength, &s); (void)textIterate(t, getLength, &s);
if(s == 0) if(s == 0)
return b; return b;
@ -235,7 +242,7 @@ textToBlob(const text *t, blob *b)
blobGrow(b, s); blobGrow(b, s);
textIterate(t, addToBlob, b); (void)textIterate(t, addToBlob, b);
blobClose(b); blobClose(b);

View file

@ -21,6 +21,9 @@
* *
* Change History: * Change History:
* $Log: untar.c,v $ * $Log: untar.c,v $
* Revision 1.22 2005/03/10 08:52:10 nigelhorne
* Tidy
*
* Revision 1.21 2005/02/16 22:19:21 nigelhorne * Revision 1.21 2005/02/16 22:19:21 nigelhorne
* Check file close * Check file close
* *
@ -85,7 +88,7 @@
* First draft * First draft
* *
*/ */
static char const rcsid[] = "$Id: untar.c,v 1.21 2005/02/16 22:19:21 nigelhorne Exp $"; static char const rcsid[] = "$Id: untar.c,v 1.22 2005/03/10 08:52:10 nigelhorne Exp $";
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
@ -127,7 +130,7 @@ octal(const char *str)
{ {
int ret = -1; int ret = -1;
sscanf(str, "%o", (unsigned int *)&ret); (void)sscanf(str, "%o", (unsigned int *)&ret);
return ret; return ret;
} }
@ -143,7 +146,7 @@ cli_untar(const char *dir, int desc)
for(;;) { for(;;) {
char block[BLOCKSIZE]; char block[BLOCKSIZE];
const int nread = cli_readn(desc, block, sizeof(block)); const int nread = cli_readn(desc, block, (unsigned int)sizeof(block));
if(!in_block && nread == 0) if(!in_block && nread == 0)
break; break;