Browse code

s/BLOB/BLOBCLASS/

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

Nigel Horne authored on 2005/02/17 07:25:53
Showing 3 changed files
... ...
@@ -1,3 +1,12 @@
1
+Wed Feb 16 22:23:40 GMT 2005 (njh)
2
+----------------------------------
3
+  * libclamav:		s/BLOB/BLOBCLASS/ for Win32
4
+			Don't put suffixes back on files to be scanned - it's
5
+				no longer needed
6
+			New mbox code is now properly ifdefed NEW_WORLD
7
+				WARNING: it is still developers only code
8
+			untar: check file close
9
+
1 10
 Wed Feb 16 00:28:23 CET 2005 (tk)
2 11
 ---------------------------------
3 12
   * clamd/clamuko.c: properly unregister with Dazuko (patch by John Ogness
... ...
@@ -16,6 +16,9 @@
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  *
18 18
  * $Log: blob.c,v $
19
+ * Revision 1.32  2005/02/16 22:21:59  nigelhorne
20
+ * s/BLOB/BLOBCLASS/
21
+ *
19 22
  * Revision 1.31  2005/02/01 14:45:24  nigelhorne
20 23
  * sanities tab characters
21 24
  *
... ...
@@ -95,7 +98,7 @@
95 95
  * Change LOG to Log
96 96
  *
97 97
  */
98
-static	char	const	rcsid[] = "$Id: blob.c,v 1.31 2005/02/01 14:45:24 nigelhorne Exp $";
98
+static	char	const	rcsid[] = "$Id: blob.c,v 1.32 2005/02/16 22:21:59 nigelhorne Exp $";
99 99
 
100 100
 #if HAVE_CONFIG_H
101 101
 #include "clamav-config.h"
... ...
@@ -142,13 +145,17 @@ static	char	const	rcsid[] = "$Id: blob.c,v 1.31 2005/02/01 14:45:24 nigelhorne E
142 142
 
143 143
 #include <assert.h>
144 144
 
145
+#ifdef	C_MINGW
146
+#include <windows.h>
147
+#endif
148
+
145 149
 blob *
146 150
 blobCreate(void)
147 151
 {
148 152
 #ifdef	CL_DEBUG
149 153
 	blob *b = (blob *)cli_calloc(1, sizeof(blob));
150 154
 	if(b)
151
-		b->magic = BLOB;
155
+		b->magic = BLOBCLASS;
152 156
 	cli_dbgmsg("blobCreate\n");
153 157
 	return b;
154 158
 #else
... ...
@@ -166,14 +173,14 @@ blobDestroy(blob *b)
166 166
 #endif
167 167
 
168 168
 	assert(b != NULL);
169
-	assert(b->magic == BLOB);
169
+	assert(b->magic == BLOBCLASS);
170 170
 
171 171
 	if(b->name)
172 172
 		free(b->name);
173 173
 	if(b->data)
174 174
 		free(b->data);
175 175
 #ifdef	CL_DEBUG
176
-	b->magic = INVALID;
176
+	b->magic = INVALIDCLASS;
177 177
 #endif
178 178
 	free(b);
179 179
 }
... ...
@@ -197,7 +204,7 @@ void
197 197
 blobSetFilename(blob *b, const char *dir, const char *filename)
198 198
 {
199 199
 	assert(b != NULL);
200
-	assert(b->magic == BLOB);
200
+	assert(b->magic == BLOBCLASS);
201 201
 	assert(filename != NULL);
202 202
 
203 203
 	cli_dbgmsg("blobSetFilename: %s\n", filename);
... ...
@@ -215,7 +222,7 @@ const char *
215 215
 blobGetFilename(const blob *b)
216 216
 {
217 217
 	assert(b != NULL);
218
-	assert(b->magic == BLOB);
218
+	assert(b->magic == BLOBCLASS);
219 219
 
220 220
 	return b->name;
221 221
 }
... ...
@@ -229,7 +236,7 @@ blobAddData(blob *b, const unsigned char *data, size_t len)
229 229
 #endif
230 230
 
231 231
 	assert(b != NULL);
232
-	assert(b->magic == BLOB);
232
+	assert(b->magic == BLOBCLASS);
233 233
 	assert(data != NULL);
234 234
 
235 235
 	if(len == 0)
... ...
@@ -307,7 +314,7 @@ unsigned char *
307 307
 blobGetData(const blob *b)
308 308
 {
309 309
 	assert(b != NULL);
310
-	assert(b->magic == BLOB);
310
+	assert(b->magic == BLOBCLASS);
311 311
 
312 312
 	if(b->len == 0)
313 313
 		return NULL;
... ...
@@ -318,7 +325,7 @@ unsigned long
318 318
 blobGetDataSize(const blob *b)
319 319
 {
320 320
 	assert(b != NULL);
321
-	assert(b->magic == BLOB);
321
+	assert(b->magic == BLOBCLASS);
322 322
 
323 323
 	return(b->len);
324 324
 }
... ...
@@ -327,7 +334,7 @@ void
327 327
 blobClose(blob *b)
328 328
 {
329 329
 	assert(b != NULL);
330
-	assert(b->magic == BLOB);
330
+	assert(b->magic == BLOBCLASS);
331 331
 
332 332
 	if(b->isClosed) {
333 333
 		cli_dbgmsg("Attempt to close a previously closed blob\n");
... ...
@@ -390,7 +397,7 @@ void
390 390
 blobGrow(blob *b, size_t len)
391 391
 {
392 392
 	assert(b != NULL);
393
-	assert(b->magic == BLOB);
393
+	assert(b->magic == BLOBCLASS);
394 394
 
395 395
 	if(len == 0)
396 396
 		return;
... ...
@@ -426,7 +433,7 @@ fileblobCreate(void)
426 426
 #ifdef	CL_DEBUG
427 427
 	fileblob *fb = (fileblob *)cli_calloc(1, sizeof(fileblob));
428 428
 	if(fb)
429
-		fb->b.magic = BLOB;
429
+		fb->b.magic = BLOBCLASS;
430 430
 	cli_dbgmsg("blobCreate\n");
431 431
 	return fb;
432 432
 #else
... ...
@@ -528,6 +535,7 @@ fileblobSetFilename(fileblob *fb, const char *dir, const char *filename)
528 528
 		fb->b.len = fb->b.size = 0;
529 529
 	}
530 530
 
531
+#if	0
531 532
 	/*
532 533
 	 * Add the suffix back to the end of the filename. Tut-tut, filenames
533 534
 	 * should be independant of their usage on UNIX type systems.
... ...
@@ -536,16 +544,10 @@ fileblobSetFilename(fileblob *fb, const char *dir, const char *filename)
536 536
 		char stub[NAME_MAX + 1];
537 537
 
538 538
 		snprintf(stub, sizeof(stub), "%s%s", fullname, suffix);
539
-#ifdef	C_LINUX
540
-		rename(stub, fullname);
541
-#elif	defined(C_INTERIX) || defined(C_OS2)
542
-		if(cli_filecopy(stub, filename) == 0)
543
-			unlink(stub);
544
-#else
545
-		link(stub, fullname);
546
-		unlink(stub);
547
-#endif
539
+		if(rename(fullname, stub) < 0)
540
+			cli_errmsg("Can't rename %s to %s: %s\n", fullname, stub, strerror(errno));
548 541
 	}
542
+#endif
549 543
 }
550 544
 
551 545
 void
... ...
@@ -30,7 +30,7 @@ typedef enum {
30 30
 
31 31
 /* classes supported by this system */
32 32
 typedef enum {
33
-	INVALID, BLOB
33
+	INVALIDCLASS, BLOBCLASS
34 34
 } object_type;
35 35
 
36 36
 #ifdef C_BSD