Browse code

Removed textClean - not needed in clamAV

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@536 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/05/05 18:40:45
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Wed May  5 10:39:58 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/text.c:	Removed the functionality of textClean, it isn't needed
4
+  	in clamAV
5
+
1 6
 Sun May  2 02:48:04 CEST 2004 (tk)
2 7
 ----------------------------------
3 8
   * libclamav: support files compressed with compress.exe (test/test1.msc)
... ...
@@ -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.6  2004/05/05 09:37:52  nigelhorne
20
+ * Removed textClean - not needed in clamAV
21
+ *
19 22
  * Revision 1.5  2004/03/25 22:40:46  nigelhorne
20 23
  * Removed even more calls to realloc and some duplicated code
21 24
  *
... ...
@@ -24,7 +27,7 @@
24 24
  *
25 25
  */
26 26
 
27
-static	char	const	rcsid[] = "$Id: text.c,v 1.5 2004/03/25 22:40:46 nigelhorne Exp $";
27
+static	char	const	rcsid[] = "$Id: text.c,v 1.6 2004/05/05 09:37:52 nigelhorne Exp $";
28 28
 
29 29
 #if HAVE_CONFIG_H
30 30
 #include "clamav-config.h"
... ...
@@ -65,22 +68,30 @@ textDestroy(text *t_head)
65 65
 text *
66 66
 textClean(text *t_head)
67 67
 {
68
+#if	0	/* not needed in ClamAV */
68 69
 	text *t_lastnonempty = NULL, *t_ret;
69 70
 
70 71
 	while(t_head) {
71 72
 		char *line = t_head->t_text;
72 73
 		const size_t len = strlen(line);
74
+		int uuencoded = 0;
73 75
 
74
-		if(len > 0) {
76
+		if((len > 0) && !uuencoded) {
75 77
 			int last = len;
76 78
 
77
-			/*
78
-			 * Don't remove trailing spaces since that
79
-			 * may break uuencoded files
80
-			 */
81
-			/*while((--last >= 0) && isspace(line[last]))
82
-				;*/
83
-
79
+			if((strncasecmp(line, "begin ", 6) == 0) &&
80
+			   (isdigit(line[6])) &&
81
+			   (isdigit(line[7])) &&
82
+			   (isdigit(line[8])) &&
83
+			   (line[9] == ' '))
84
+				uuencoded = 1;
85
+			else
86
+				/*
87
+				 * Don't remove trailing spaces since that may
88
+				 * break uuencoded files
89
+				 */
90
+				while((--last >= 0) && isspace(line[last]))
91
+					;
84 92
 			if(++last > 0) {
85 93
 				t_lastnonempty = t_head;
86 94
 				if(last < len) {
... ...
@@ -115,6 +126,9 @@ textClean(text *t_head)
115 115
 	t_ret->t_next = NULL;
116 116
 
117 117
 	return t_ret;
118
+#else
119
+	return t_head;
120
+#endif
118 121
 }
119 122
 
120 123
 /* Clone the current object */
... ...
@@ -234,5 +248,5 @@ textToBlob(const text *t, blob *b)
234 234
 
235 235
 	blobClose(b);
236 236
 
237
-	return(b);
237
+	return b;
238 238
 }