Diverse kaputte Casts repariert.
Unwirksame und ueberfluessige Casts entfernt,
etwas Code-Cleanup.
Change-Id: I92f01e6391c432cd0881a5faac580f6d0b40c323
diff --git a/std/shells/magier/admin.c b/std/shells/magier/admin.c
index 7e86dc9..64f3168 100644
--- a/std/shells/magier/admin.c
+++ b/std/shells/magier/admin.c
@@ -45,7 +45,7 @@
if (member(({"commands","email","hosts","inetd","list","mud_port","time",
"version"}),type)==-1)
write("TYPEs: commands, email, hosts, inetd, list, mud_port, time, version\n");
- if (ret=(string)INETD->_send_udp(mud,([SENDER:getuid(), REQUEST:QUERY, DATA:type]),1))
+ if (ret=({string})INETD->_send_udp(mud,([SENDER:getuid(), REQUEST:QUERY, DATA:type]),1))
write(ret);
else
write("Anfrage abgeschickt.\n");
@@ -189,7 +189,7 @@
}
if ( arg=="*" )
{
- More((string)call_other("/secure/sinmaster","Dump",1));
+ More(({string})call_other("/secure/sinmaster","Dump",1));
return 1;
}
@@ -267,7 +267,7 @@
_notify_fail( "Syntax: mbanish <name> [<grund>]\n" );
if ( !str || !stringp(str) || !sizeof(str) ){
- if ( !mappingp(list = (mapping)"/secure/merlin"->MBanishList()) ||
+ if ( !mappingp(list = ({mapping})"/secure/merlin"->MBanishList()) ||
!(i = sizeof(list)) ){
write( "Momentan ist kein Spieler auf der mbanish-Liste.\n" );
return 1;
@@ -357,14 +357,21 @@
{
string ip;
int days;
- mapping sites;
// Mindestens L26 fuer diesen Befehl
if ( secure_level() <= DOMAINMEMBER_LVL )
return 0;
- if ( !str || !stringp(str) || !sizeof(str) ){
- if ( !sizeof(sites = (mapping)MASTER->SiteBanish( 0, 0 )) ){
+ if ( !str || !stringp(str) || !sizeof(str) )
+ {
+ mapping|int sites = ({mapping|int})MASTER->SiteBanish( 0, 0 );
+ if ( !mappingp(sites) )
+ {
+ write("Du darfst (noch) keine gesperrten Adressen abfragen!\n");
+ return 1;
+ }
+ if ( !sizeof(sites) )
+ {
write( "Es sind zur Zeit keine Adressen gesperrt!\n" );
return 1;
}
@@ -396,8 +403,11 @@
// _notify_fail( "Ungueltiges Adress-Format!\n" );
- if ( !days ){
- int res=(int)MASTER->SiteBanish(ip, 0);
+ if ( !days )
+ {
+ // Eigentlich ist SiteBanish() int|mapping. Bei diesem Aufruf kommt
+ // jedoch nur int zurueck. Fall sichs das mal aendert, soll es buggen.
+ int res=({int})MASTER->SiteBanish(ip, 0);
if ( res == 1 )
printf( "Die Adresse '%s' ist jetzt nicht mehr gesperrt.\n",
ip );
@@ -407,17 +417,23 @@
else
printf( "Du darfst nur eigene Sperrungen wieder aufheben!\n" );
}
- else {
- int res;
+ else
+ {
if ( days != 1 && !IS_DEPUTY(secure_euid()) )
+ {
write( "Du darfst Adressen nur fuer einen Tag sperren!\n" );
- else if ( (res = (int)MASTER->SiteBanish(ip, days)) == 1 )
+ return 1;
+ }
+ // Eigentlich ist SiteBanish() int|mapping. Bei diesem Aufruf kommt
+ // jedoch nur int zurueck. Fall sichs das mal aendert, soll es buggen.
+ int res = ({int})MASTER->SiteBanish(ip, days);
+ if ( res == 1 )
printf( "Die Adresse '%s' ist jetzt fuer %s gesperrt.\n",
ip, (days > 1 ? sprintf( "%d Tage", days ) :
(days > 0 ? "einen Tag" : "immer")) );
else if ( res == -1 )
write( "Du darfst " + (LORD_SECURITY ? "255 IP-Adressen"
- : "nur einzelne IP-Adressen") + " sperren!\n" );
+ : "nur einzelne IP-Adressen") + " sperren!\n" );
else if ( res == -2 )
write( "Du hast schon genug Adressen gesperrt!\n" );
}
diff --git a/std/shells/magier/fileedit.c b/std/shells/magier/fileedit.c
index b558585..b0bfeb0 100644
--- a/std/shells/magier/fileedit.c
+++ b/std/shells/magier/fileedit.c
@@ -95,8 +95,8 @@
static mixed cp_file(mixed filedata,int move,int flags, mixed *do_delete)
{
string source,dest;
- source=(string)filedata[FULLNAME];
- dest=(string)filedata[DESTNAME];
+ source=filedata[FULLNAME];
+ dest=filedata[DESTNAME];
if (source==dest) return ERROR(SAME_FILE,source,RET_FAIL);
if (!MAY_READ(source)) return ERROR(NO_READ,source,RET_JUMP);
if (!MAY_WRITE(dest)) return ERROR(NO_WRITE,dest,RET_JUMP);
diff --git a/std/shells/magier/fileview.c b/std/shells/magier/fileview.c
index f96d6e3..ca0aa20 100644
--- a/std/shells/magier/fileview.c
+++ b/std/shells/magier/fileview.c
@@ -161,7 +161,7 @@
string group="";
if (flags&LS_U)
{
- creator=(string)call_other(master(),"creator_file", full);
+ creator=({string})call_other(master(),"creator_file", full);
switch(creator)
{
case ROOTID: creator="root"; break;
@@ -445,10 +445,10 @@
!regexp(({""}),args[0]))
return printf("man: Ungueltiger Ausdruck in Maske.\n"),1;
}
- tmp=(string *)call_other(MAND,"locate",args[0],flags&(MAN_M|MAN_R));
+ tmp=({string *})call_other(MAND,"locate",args[0],flags&(MAN_M|MAN_R));
}
- oldman_result=(mapping)0;
+ oldman_result=0;
if(i && sizeof(tmp)>2 && sizeof(tmp)>=(i<<1))
tmp=tmp[((i<<1)-2)..((i<<1)-1)];
switch(sizeof(tmp))
@@ -500,7 +500,7 @@
if (flags==-1||sizeof(args)!=2)
return USAGE("rman <hilfeseite> <mudname>");
write("man: " +
- (string)call_other(UDP_CMD_DIR+"man","send_request",args[1],args[0]));
+ ({string})call_other(UDP_CMD_DIR+"man","send_request",args[1],args[0]));
return 1;
}
diff --git a/std/shells/magier/magier_ext.c b/std/shells/magier/magier_ext.c
index 9660015..365ac63 100644
--- a/std/shells/magier/magier_ext.c
+++ b/std/shells/magier/magier_ext.c
@@ -356,7 +356,7 @@
printf("Du hoerst auf zu snoopen.\n");
// evtl. irgendetwas loggen ... sollte eigentlich nicht passieren.
}
- snoopee=(object)0;
+ snoopee=0;
return 1;
}
SetProp(P_SNOOPFLAGS,flags); // FUNKTIONIERT NUR, WENN magier.h und
diff --git a/std/shells/magier/objects.c b/std/shells/magier/objects.c
index 1968de6..1a51ba5 100644
--- a/std/shells/magier/objects.c
+++ b/std/shells/magier/objects.c
@@ -119,7 +119,7 @@
else
ob=args[0];
cmdline=capitalize(to_string(ob->name(WER)));
- flags=(int)ob->QueryProp(P_PLURAL); // Missbrauch von flags :o)
+ flags=({int})ob->QueryProp(P_PLURAL); // Missbrauch von flags :o)
if (query_verb()=="destruct")
{
if (!ob->remove())
diff --git a/std/shells/magier/parsing.c b/std/shells/magier/parsing.c
index d719550..a38210a 100644
--- a/std/shells/magier/parsing.c
+++ b/std/shells/magier/parsing.c
@@ -33,7 +33,7 @@
// Rueckgabe: Dateiname
//
-static mixed to_filename(string str)
+static string to_filename(string str)
{
string *tmp,p,newfn;
int i;
@@ -88,7 +88,7 @@
}
if (build_fn)
{
- if (str=(string)to_filename(str)) line+=({ str });
+ if (str=to_filename(str)) line+=({ str });
}
else
line+= ({ str });
diff --git a/std/shells/magier/upd.c b/std/shells/magier/upd.c
index cd86d33..f48d73c 100644
--- a/std/shells/magier/upd.c
+++ b/std/shells/magier/upd.c
@@ -370,7 +370,7 @@
// mittels Configure()
if ( ! (flags & UPD_C ) )
{
- catch(restore_config=(mixed)call_resolved(&configdata,obj,
+ catch(restore_config=call_resolved(&configdata,obj,
"Configure",0);
publish);
// Wenn UPD_CONF gesetzt wird, _muss_ das Objekt ein oeffentliches
@@ -388,7 +388,7 @@
mixed items;
// Herausbekommen, ob hier Items existieren, die per AddItem
// erzeugt werden. Die duerfen nicht gesichert werden.
- items=(mixed)obj->QueryProp(P_ITEMS); // mixed, da array of arrays
+ items=({mixed})obj->QueryProp(P_ITEMS); // mixed, da array of arrays
if (pointerp(items)&&sizeof(items))
{
items=transpose_array(items)[0];
@@ -407,7 +407,7 @@
env = environment(obj);
if ( flags & UPD_C )
{
- pro = (mapping)(obj->QueryProperties());
+ pro = ({mapping})(obj->QueryProperties());
}
}
else inv = ({});
@@ -461,7 +461,7 @@
else if (restore_config)
{
int conf_res;
- if (!catch(conf_res=(int)obj->Configure(configdata); publish)
+ if (!catch(conf_res=({int})obj->Configure(configdata); publish)
&& conf_res == 1)
{
msg += ", (re-)konfiguriert";