[eggheads-patches] PATCH1.5: const_setvar_fix_1.5.patch

Fabian Knittel fknittel at gmx.de
Sun Oct 29 08:02:00 CST 2000


[ const_setvar_fix_1.5.patch ]

This patch gets rid of the compile-time warnings on systems using
tcl libraries where Tcl_SetVar is not declared as taking constant
strings.

Fabian

--
Fabian Knittel <fknittel at gmx.de> -- http://www.esc-web.de/fabian/
Signed or encrypted mail preferred.    PGP DSA key ID: 0x838B4D20
-------------- next part --------------
diff -urN --exclude-from=/home/fabian/.diffex eggdrop1.5~/doc/UPDATES1.5 eggdrop1.5/doc/UPDATES1.5
--- eggdrop1.5~/doc/UPDATES1.5	Fri Oct 27 22:10:49 2000
+++ eggdrop1.5/doc/UPDATES1.5	Sun Oct 29 11:42:31 2000
@@ -4,6 +4,8 @@
 
 1.5.5
 Found by  Fixed by  What...
+Abraham   Fabian    Fixed compiler warnings about 'const' for tcl libraries
+                    that don't declare Tcl_SetVar as taking const strings.
 Tothwolf  Fabian    Could not remove joining channel from procs called by
                     JOIN bind.
 fabulous  Fabian    The filesys module did not support remotely linked files.
diff -urN --exclude-from=/home/fabian/.diffex eggdrop1.5~/src/dcc.c eggdrop1.5/src/dcc.c
--- eggdrop1.5~/src/dcc.c	Fri Oct 27 21:50:28 2000
+++ eggdrop1.5/src/dcc.c	Sat Oct 28 23:32:14 2000
@@ -1794,7 +1794,7 @@
     }
     if (dcc[idx].type == &DCC_CHAT) {
       if (dcc[idx].u.chat->channel >= 0) {
-	chanout_but(-1, dcc[idx].u.chat->channel,DCC_JOIN, dcc[idx].nick);
+	chanout_but(-1, dcc[idx].u.chat->channel, DCC_JOIN, dcc[idx].nick);
 	Context;
 	if (dcc[idx].u.chat->channel < 10000)
 	  botnet_send_join_idx(idx, -1);
diff -urN --exclude-from=/home/fabian/.diffex eggdrop1.5~/src/tclhash.c eggdrop1.5/src/tclhash.c
--- eggdrop1.5~/src/tclhash.c	Fri Oct 27 21:49:37 2000
+++ eggdrop1.5/src/tclhash.c	Sun Oct 29 11:41:13 2000
@@ -764,13 +764,13 @@
 	  cnt++;
 	  tc->hits++;
 	  tm_p = tm_last;
-	  Tcl_SetVar(interp, "lastbind", tm->mask, TCL_GLOBAL_ONLY);
+	  Tcl_SetVar(interp, "lastbind", (char *) tm->mask, TCL_GLOBAL_ONLY);
 	  x = trigger_bind(tc->func_name, param);
 	  if (match_type & BIND_ALTER_ARGS) {
 	    if (interp->result == NULL || !interp->result[0])
 	      return x;
 	    /* This is such an amazingly ugly hack: */
-	    Tcl_SetVar(interp, "_a", interp->result, 0);
+	    Tcl_SetVar(interp, "_a", (char *) interp->result, 0);
 	    /* Note: If someone knows what the above tries to
 	       achieve, please tell me! (Fabian, 2000-10-14) */
 	  } else if ((match_type & BIND_WANTRET) && x == BIND_EXEC_LOG)
@@ -840,7 +840,7 @@
 
   if (cnt > 1)
     return BIND_AMBIGUOUS;
-  Tcl_SetVar(interp, "lastbind", fullmatch, TCL_GLOBAL_ONLY);
+  Tcl_SetVar(interp, "lastbind", (char *) fullmatch, TCL_GLOBAL_ONLY);
   return trigger_bind(proc, param);
 }
 
@@ -856,9 +856,9 @@
   Context;
   get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.chat->con_chan);
   sprintf(s, "%ld", dcc[idx].sock);
-  Tcl_SetVar(interp, "_dcc1", dcc[idx].nick, 0);
-  Tcl_SetVar(interp, "_dcc2", s, 0);
-  Tcl_SetVar(interp, "_dcc3", args, 0);
+  Tcl_SetVar(interp, "_dcc1", (char *) dcc[idx].nick, 0);
+  Tcl_SetVar(interp, "_dcc2", (char *) s, 0);
+  Tcl_SetVar(interp, "_dcc3", (char *) args, 0);
   Context;
   x = check_tcl_bind(H_dcc, cmd, &fr, " $_dcc1 $_dcc2 $_dcc3",
 		     MATCH_PARTIAL | BIND_USE_ATTR | BIND_HAS_BUILTINS);
@@ -881,9 +881,9 @@
 void check_tcl_bot(const char *nick, const char *code, const char *param)
 {
   Context;
-  Tcl_SetVar(interp, "_bot1", nick, 0);
-  Tcl_SetVar(interp, "_bot2", code, 0);
-  Tcl_SetVar(interp, "_bot3", param, 0);
+  Tcl_SetVar(interp, "_bot1", (char *) nick, 0);
+  Tcl_SetVar(interp, "_bot2", (char *) code, 0);
+  Tcl_SetVar(interp, "_bot3", (char *) param, 0);
   check_tcl_bind(H_bot, code, 0, " $_bot1 $_bot2 $_bot3", MATCH_EXACT);
 }
 
@@ -897,9 +897,9 @@
   u = get_user_by_handle(userlist, hand);
   touch_laston(u, "partyline", now);
   get_user_flagrec(u, &fr, NULL);
-  Tcl_SetVar(interp, "_chonof1", hand, 0);
+  Tcl_SetVar(interp, "_chonof1", (char *) hand, 0);
   simple_sprintf(s, "%d", sock);
-  Tcl_SetVar(interp, "_chonof2", s, 0);
+  Tcl_SetVar(interp, "_chonof2", (char *) s, 0);
   Context;
   check_tcl_bind(tl, hand, &fr, " $_chonof1 $_chonof2", MATCH_MASK |
 		 BIND_USE_ATTR | BIND_STACKABLE | BIND_WANTRET);
@@ -913,9 +913,9 @@
 
   Context;
   simple_sprintf(s, "%d", chan);
-  Tcl_SetVar(interp, "_cab1", from, 0);
-  Tcl_SetVar(interp, "_cab2", s, 0);
-  Tcl_SetVar(interp, "_cab3", text, 0);
+  Tcl_SetVar(interp, "_cab1", (char *) from, 0);
+  Tcl_SetVar(interp, "_cab2", (char *) s, 0);
+  Tcl_SetVar(interp, "_cab3", (char *) text, 0);
   check_tcl_bind(tl, text, 0, " $_cab1 $_cab2 $_cab3",
 		 MATCH_MASK | BIND_STACKABLE);
   Context;
@@ -924,8 +924,8 @@
 void check_tcl_nkch(const char *ohand, const char *nhand)
 {
   Context;
-  Tcl_SetVar(interp, "_nkch1", ohand, 0);
-  Tcl_SetVar(interp, "_nkch2", nhand, 0);
+  Tcl_SetVar(interp, "_nkch1", (char *) ohand, 0);
+  Tcl_SetVar(interp, "_nkch2", (char *) nhand, 0);
   check_tcl_bind(H_nkch, ohand, 0, " $_nkch1 $_nkch2",
 		 MATCH_MASK | BIND_STACKABLE);
   Context;
@@ -934,8 +934,8 @@
 void check_tcl_link(const char *bot, const char *via)
 {
   Context;
-  Tcl_SetVar(interp, "_link1", bot, 0);
-  Tcl_SetVar(interp, "_link2", via, 0);
+  Tcl_SetVar(interp, "_link1", (char *) bot, 0);
+  Tcl_SetVar(interp, "_link2", (char *) via, 0);
   Context;
   check_tcl_bind(H_link, bot, 0, " $_link1 $_link2",
 		 MATCH_MASK | BIND_STACKABLE);
@@ -945,7 +945,7 @@
 void check_tcl_disc(const char *bot)
 {
   Context;
-  Tcl_SetVar(interp, "_disc1", bot, 0);
+  Tcl_SetVar(interp, "_disc1", (char *) bot, 0);
   Context;
   check_tcl_bind(H_disc, bot, 0, " $_disc1", MATCH_MASK | BIND_STACKABLE);
   Context;
@@ -954,7 +954,7 @@
 void check_tcl_loadunld(const char *mod, tcl_bind_list_t *tl)
 {
   Context;
-  Tcl_SetVar(interp, "_lu1", mod, 0);
+  Tcl_SetVar(interp, "_lu1", (char *) mod, 0);
   Context;
   check_tcl_bind(tl, mod, 0, " $_lu1", MATCH_MASK | BIND_STACKABLE);
   Context;
@@ -969,8 +969,8 @@
   Context;
   sprintf(s, "%ld", dcc[idx].sock);
   get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.chat->con_chan);
-  Tcl_SetVar(interp, "_filt1", s, 0);
-  Tcl_SetVar(interp, "_filt2", text, 0);
+  Tcl_SetVar(interp, "_filt1", (char *) s, 0);
+  Tcl_SetVar(interp, "_filt2", (char *) text, 0);
   Context;
   x = check_tcl_bind(H_filt, text, &fr, " $_filt1 $_filt2",
 		     MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE |
@@ -990,9 +990,9 @@
   int	x;
 
   Context;
-  Tcl_SetVar(interp, "_note1", from, 0);
-  Tcl_SetVar(interp, "_note2", to, 0);
-  Tcl_SetVar(interp, "_note3", text, 0);
+  Tcl_SetVar(interp, "_note1", (char *) from, 0);
+  Tcl_SetVar(interp, "_note2", (char *) to, 0);
+  Tcl_SetVar(interp, "_note3", (char *) text, 0);
   x = check_tcl_bind(H_note, to, 0, " $_note1 $_note2 $_note3", MATCH_EXACT);
   return (x == BIND_MATCHED || x == BIND_EXECUTED || x == BIND_EXEC_LOG);
 }
@@ -1004,7 +1004,7 @@
 
   Context;
   simple_sprintf(s, "%d", idx);
-  Tcl_SetVar(interp, "_n", s, 0);
+  Tcl_SetVar(interp, "_n", (char *) s, 0);
   Context;
   x = Tcl_VarEval(interp, cmd, " $_n", NULL);
   Context;
@@ -1036,12 +1036,12 @@
   }
   sprintf(s, "%d", chan);
   sprintf(u, "%d", sock);
-  Tcl_SetVar(interp, "_chjn1", bot, 0);
-  Tcl_SetVar(interp, "_chjn2", nick, 0);
-  Tcl_SetVar(interp, "_chjn3", s, 0);
-  Tcl_SetVar(interp, "_chjn4", t, 0);
-  Tcl_SetVar(interp, "_chjn5", u, 0);
-  Tcl_SetVar(interp, "_chjn6", host, 0);
+  Tcl_SetVar(interp, "_chjn1", (char *) bot, 0);
+  Tcl_SetVar(interp, "_chjn2", (char *) nick, 0);
+  Tcl_SetVar(interp, "_chjn3", (char *) s, 0);
+  Tcl_SetVar(interp, "_chjn4", (char *) t, 0);
+  Tcl_SetVar(interp, "_chjn5", (char *) u, 0);
+  Tcl_SetVar(interp, "_chjn6", (char *) host, 0);
   Context;
   check_tcl_bind(H_chjn, s, &fr,
 		 " $_chjn1 $_chjn2 $_chjn3 $_chjn4 $_chjn5 $_chjn6",
@@ -1056,10 +1056,10 @@
   Context;
   simple_sprintf(u, "%d", sock);
   simple_sprintf(v, "%d", chan);
-  Tcl_SetVar(interp, "_chpt1", bot, 0);
-  Tcl_SetVar(interp, "_chpt2", hand, 0);
-  Tcl_SetVar(interp, "_chpt3", u, 0);
-  Tcl_SetVar(interp, "_chpt4", v, 0);
+  Tcl_SetVar(interp, "_chpt1", (char *) bot, 0);
+  Tcl_SetVar(interp, "_chpt2", (char *) hand, 0);
+  Tcl_SetVar(interp, "_chpt3", (char *) u, 0);
+  Tcl_SetVar(interp, "_chpt4", (char *) v, 0);
   Context;
   check_tcl_bind(H_chpt, v, 0, " $_chpt1 $_chpt2 $_chpt3 $_chpt4",
 		 MATCH_MASK | BIND_STACKABLE);
@@ -1072,9 +1072,9 @@
 
   Context;
   simple_sprintf(u, "%d", idx);
-  Tcl_SetVar(interp, "_away1", bot, 0);
-  Tcl_SetVar(interp, "_away2", u, 0);
-  Tcl_SetVar(interp, "_away3", msg ? msg : "", 0);
+  Tcl_SetVar(interp, "_away1", (char *) bot, 0);
+  Tcl_SetVar(interp, "_away2", (char *) u, 0);
+  Tcl_SetVar(interp, "_away3", msg ? (char *) msg : "", 0);
   Context;
   check_tcl_bind(H_away, bot, 0, " $_away1 $_away2 $_away3",
 		 MATCH_MASK | BIND_STACKABLE);
@@ -1086,15 +1086,15 @@
 
   Context;
   sprintf(y, "%02d", tm->tm_min);
-  Tcl_SetVar(interp, "_time1", y, 0);
+  Tcl_SetVar(interp, "_time1", (char *) y, 0);
   sprintf(y, "%02d", tm->tm_hour);
-  Tcl_SetVar(interp, "_time2", y, 0);
+  Tcl_SetVar(interp, "_time2", (char *) y, 0);
   sprintf(y, "%02d", tm->tm_mday);
-  Tcl_SetVar(interp, "_time3", y, 0);
+  Tcl_SetVar(interp, "_time3", (char *) y, 0);
   sprintf(y, "%02d", tm->tm_mon);
-  Tcl_SetVar(interp, "_time4", y, 0);
+  Tcl_SetVar(interp, "_time4", (char *) y, 0);
   sprintf(y, "%04d", tm->tm_year + 1900);
-  Tcl_SetVar(interp, "_time5", y, 0);
+  Tcl_SetVar(interp, "_time5", (char *) y, 0);
   sprintf(y, "%02d %02d %02d %02d %04d", tm->tm_min, tm->tm_hour, tm->tm_mday,
 	  tm->tm_mon, tm->tm_year + 1900);
   Context;
@@ -1107,7 +1107,7 @@
 void check_tcl_event(const char *event)
 {
   Context;
-  Tcl_SetVar(interp, "_event1", event, 0);
+  Tcl_SetVar(interp, "_event1", (char *) event, 0);
   Context;
   check_tcl_bind(H_event, event, 0, " $_event1", MATCH_EXACT | BIND_STACKABLE);
   Context;




More information about the Patches mailing list