diff src/spamass.cpp.in @ 214:82886d4dd71f stable-6-0-19

Fixes to compile on Fedora 9 and for const correctness.
author Carl Byington <carl@five-ten-sg.com>
date Tue, 10 Jun 2008 08:58:42 -0700
parents 92a5c866bdfa
children 3fee608becbc
line wrap: on
line diff
--- a/src/spamass.cpp.in	Wed Apr 30 13:11:32 2008 -0700
+++ b/src/spamass.cpp.in	Tue Jun 10 08:58:42 2008 -0700
@@ -19,13 +19,13 @@
 #include <unistd.h>
 
 
-char *spamc = "@SPAMC@";
-char *spamc_empty = "";
+const char *spamc = "@SPAMC@";
+const char *spamc_empty = "";
 static bool warnedmacro = false;    // have we logged that we couldn't fetch a macro?
 const  int  maxlen = 1000;          // used for snprintf buffers
 
 
-SpamAssassin::SpamAssassin(mlfiPriv *priv_, int ip, char *helo_, char *from, char *qid)
+SpamAssassin::SpamAssassin(mlfiPriv *priv_, int ip, const char *helo_, const char *from, const char *qid)
 {
     error           = false;
     running         = false;
@@ -64,7 +64,7 @@
 }
 
 
-void SpamAssassin::mlfi_envrcpt(SMFICTX *ctx, char *envrcpt)
+void SpamAssassin::mlfi_envrcpt(SMFICTX *ctx, const char *envrcpt)
 {
     if (first_recipient) {
         first_recipient = false;
@@ -123,7 +123,7 @@
 }
 
 
-void SpamAssassin::mlfi_header(char* headerf, char* headerv)
+void SpamAssassin::mlfi_header(const char* headerf, const char* headerv)
 {
     if (!running) Connect();
     if (running) {
@@ -144,9 +144,9 @@
 }
 
 
-void SpamAssassin::mlfi_body(u_char *bodyp, size_t bodylen)
+void SpamAssassin::mlfi_body(const u_char *bodyp, size_t bodylen)
 {
-    output((char *)bodyp, bodylen);
+    output((const char *)bodyp, bodylen);
 }
 
 
@@ -200,8 +200,8 @@
 
             // execute spamc
             char* argv[3];
-            argv[0] = spamc;
-            argv[1] = "-c";
+            argv[0] = (char*)spamc;
+            argv[1] = (char*)"-c";
             argv[2] = NULL;
             execvp(argv[0] , argv); // does not return!
             _exit(1);               // exec failed
@@ -241,8 +241,8 @@
     }
 
     // send to SpamAssassin
-    long total = 0;
-    long wsize = 0;
+    size_t total = 0;
+    size_t wsize = 0;
     string reason;
     int status;
     do {
@@ -394,9 +394,9 @@
 }
 
 
-char *SpamAssassin::getorwarnmacro(SMFICTX *ctx, char *macro, char *def, char *scope)
+const char *SpamAssassin::getorwarnmacro(SMFICTX *ctx, const char *macro, const char *def, const char *scope)
 {
-    char *rc = smfi_getsymval(ctx, macro);
+    const char *rc = smfi_getsymval(ctx, (char*)macro);
     if (!rc) {
         rc = def;
         warnmacro(macro, scope);
@@ -405,7 +405,7 @@
 }
 
 
-void SpamAssassin::warnmacro(char *macro, char *scope)
+void SpamAssassin::warnmacro(const char *macro, const char *scope)
 {
     if (warnedmacro) return;
     char buf[maxlen];