git-svn: trunk@1136
remotes/push_mirror/metadata
Nigel Horne 21 years ago
parent c464b15fe5
commit 496e11161f
  1. 8
      clamav-devel/libclamav/message.c
  2. 6
      clamav-devel/libclamav/table.c
  3. 68
      clamav-devel/libclamav/text.c

@ -17,6 +17,9 @@
* *
* Change History: * Change History:
* $Log: message.c,v $ * $Log: message.c,v $
* Revision 1.123 2004/11/27 21:54:27 nigelhorne
* Tidy
*
* Revision 1.122 2004/11/27 13:16:54 nigelhorne * Revision 1.122 2004/11/27 13:16:54 nigelhorne
* uuencode failures no longer fatal * uuencode failures no longer fatal
* *
@ -363,7 +366,7 @@
* uuencodebegin() no longer static * uuencodebegin() no longer static
* *
*/ */
static char const rcsid[] = "$Id: message.c,v 1.122 2004/11/27 13:16:54 nigelhorne Exp $"; static char const rcsid[] = "$Id: message.c,v 1.123 2004/11/27 21:54:27 nigelhorne Exp $";
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include "clamav-config.h" #include "clamav-config.h"
@ -1024,12 +1027,11 @@ messageSetEncoding(message *m, const char *enctype)
int j; int j;
encoding_type *et; encoding_type *et;
for(j = 0; j < m->numberOfEncTypes; j++) { for(j = 0; j < m->numberOfEncTypes; j++)
if(m->encodingTypes[j] == e->type) { if(m->encodingTypes[j] == e->type) {
cli_dbgmsg("Ignoring duplicate encoding mechanism\n"); cli_dbgmsg("Ignoring duplicate encoding mechanism\n");
break; break;
} }
}
et = (encoding_type *)cli_realloc(m->encodingTypes, (m->numberOfEncTypes + 1) * sizeof(encoding_type)); et = (encoding_type *)cli_realloc(m->encodingTypes, (m->numberOfEncTypes + 1) * sizeof(encoding_type));
if(et == NULL) if(et == NULL)

@ -75,10 +75,10 @@ tableInsert(table_t *table, const char *key, int value)
assert(value != -1); /* that would confuse us */ assert(value != -1); /* that would confuse us */
if(table->tableHead == NULL) if(table->tableHead == NULL)
table->tableLast = table->tableHead = (tableEntry *)cli_calloc(1, sizeof(tableEntry)); table->tableLast = table->tableHead = (tableEntry *)cli_malloc(sizeof(tableEntry));
else else
table->tableLast = table->tableLast->next = table->tableLast = table->tableLast->next =
(tableEntry *)cli_calloc(1, sizeof(tableEntry)); (tableEntry *)cli_malloc(sizeof(tableEntry));
if(table->tableLast == NULL) if(table->tableLast == NULL)
return -1; return -1;
@ -121,7 +121,7 @@ tableFind(const table_t *table, const char *key)
#ifdef CL_DEBUG #ifdef CL_DEBUG
cli_dbgmsg("tableFind: Cost of '%s' = %d\n", key, cost); cli_dbgmsg("tableFind: Cost of '%s' = %d\n", key, cost);
#endif #endif
return(tableItem->value); return tableItem->value;
} }
} }

@ -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.11 2004/11/27 21:54:26 nigelhorne
* Tidy
*
* Revision 1.10 2004/08/22 10:34:24 nigelhorne * Revision 1.10 2004/08/22 10:34:24 nigelhorne
* Use fileblob * Use fileblob
* *
@ -39,7 +42,7 @@
* *
*/ */
static char const rcsid[] = "$Id: text.c,v 1.10 2004/08/22 10:34:24 nigelhorne Exp $"; static char const rcsid[] = "$Id: text.c,v 1.11 2004/11/27 21:54:26 nigelhorne Exp $";
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include "clamav-config.h" #include "clamav-config.h"
@ -81,71 +84,14 @@ textDestroy(text *t_head)
/* /*
* Remove trailing spaces from the lines and trailing blank lines * Remove trailing spaces from the lines and trailing blank lines
* This could be used to remove trailing blank lines, empty lines etc.,
* but it probably isn't worth the time taken given that it won't reclaim
* much memory
*/ */
text * text *
textClean(text *t_head) textClean(text *t_head)
{ {
#if 0 /* not needed in ClamAV */
text *t_lastnonempty = NULL, *t_ret;
while(t_head) {
char *line = t_head->t_text;
const size_t len = strlen(line);
int uuencoded = 0;
if((len > 0) && !uuencoded) {
int last = len;
if((strncasecmp(line, "begin ", 6) == 0) &&
(isdigit(line[6])) &&
(isdigit(line[7])) &&
(isdigit(line[8])) &&
(line[9] == ' '))
uuencoded = 1;
else
/*
* Don't remove trailing spaces since that may
* break uuencoded files
*/
while((--last >= 0) && isspace(line[last]))
;
if(++last > 0) {
t_lastnonempty = t_head;
if(last < len) {
line[last] = '\0';
t_head->t_text = cli_realloc(line, ++last);
}
} else {
t_head->t_text = cli_realloc(line, 1);
t_head->t_text[0] = '\0';
}
}
t_head = t_head->t_next;
}
if(t_lastnonempty == NULL)
return(NULL); /* empty message I presume */
t_ret = t_lastnonempty;
t_lastnonempty = t_lastnonempty->t_next;
while(t_lastnonempty) {
text *t_next = t_lastnonempty->t_next;
assert(strlen(t_lastnonempty->t_text) == 0);
free(t_lastnonempty->t_text);
free(t_lastnonempty);
t_lastnonempty = t_next;
}
t_ret->t_next = NULL;
return t_ret;
#else
return t_head; return t_head;
#endif
} }
/* Clone the current object */ /* Clone the current object */

Loading…
Cancel
Save