diff --git a/lib/modules/ADT.pmod/Interval.pike b/lib/modules/ADT.pmod/Interval.pike index 3bdf6e43df879dfa482fbd4a25bdd9164be7d43b..bd645f75fd59ad35c05486d4c05492f23643cc06 100644 --- a/lib/modules/ADT.pmod/Interval.pike +++ b/lib/modules/ADT.pmod/Interval.pike @@ -247,9 +247,7 @@ mixed beginning() { return start; } mixed end() { return stop; } protected mixed cast(string type) { - switch (type) { - case "array": + if( type=="array" ) return ({ start, stop }); - } return UNDEFINED; } diff --git a/lib/modules/ADT.pmod/Queue.pike b/lib/modules/ADT.pmod/Queue.pike index fe5e8cb8a92b2d28f2cb28fc19f010af155c2ff4..01c70a01ef9552b0145fd19c160b400315c5998b 100644 --- a/lib/modules/ADT.pmod/Queue.pike +++ b/lib/modules/ADT.pmod/Queue.pike @@ -74,11 +74,10 @@ void flush() } //! It is possible to cast ADT.Queue to an array. -protected mixed cast(string to) { - switch(to) { - case "object": return this; - case "array": return l+({}); - } +protected mixed cast(string to) +{ + if( to=="array" ) + return l+({}); return UNDEFINED; } diff --git a/lib/modules/ADT.pmod/Relation.pmod/Binary.pike b/lib/modules/ADT.pmod/Relation.pmod/Binary.pike index bb525b8237146ba8cbdf2833df7b31baa950587c..18d5142c9a806b69ee88c4108098f41c8cf41900 100644 --- a/lib/modules/ADT.pmod/Relation.pmod/Binary.pike +++ b/lib/modules/ADT.pmod/Relation.pmod/Binary.pike @@ -309,11 +309,9 @@ protected class _get_iterator { } } -mixed cast(string to) { - switch(to) { - case "mapping": +mixed cast(string to) +{ + if( to=="mapping" ) return copy_value(val); - default: - return UNDEFINED; - } + return UNDEFINED; } diff --git a/lib/modules/ADT.pmod/Set.pike b/lib/modules/ADT.pmod/Set.pike index 97eb408ef4178fbfdb411c8ab40596d856ad66bd..1c2d32bde1257610b37e5cd2cf9b0bd07e122cd4 100644 --- a/lib/modules/ADT.pmod/Set.pike +++ b/lib/modules/ADT.pmod/Set.pike @@ -248,9 +248,6 @@ protected mixed cast(string to) { switch(to) { - case "object": - return this; - case "array": return indices(set); diff --git a/lib/modules/ADT.pmod/Stack.pike b/lib/modules/ADT.pmod/Stack.pike index 4de3ce6c3f0a56822f1404223d8b02d05081a9b2..fe66b76b1b58c6ea8ef1a52f836488dc0e772210 100644 --- a/lib/modules/ADT.pmod/Stack.pike +++ b/lib/modules/ADT.pmod/Stack.pike @@ -141,13 +141,11 @@ this_program `+(this_program s) { return ns; } -protected mixed cast(string to) { - switch(to) { - case "array": - return _values(); - default: - return UNDEFINED; - } +protected mixed cast(string to) +{ + if( to=="array" ) + return _values(); + return UNDEFINED; } string _sprintf(int t) { diff --git a/lib/modules/Geography.pmod/Position.pike b/lib/modules/Geography.pmod/Position.pike index 9c0d5f08af0343a5ebba4022acb23021d5401ee9..b5ab7c0d5c18a584192bab569576fd6bc0405738 100644 --- a/lib/modules/Geography.pmod/Position.pike +++ b/lib/modules/Geography.pmod/Position.pike @@ -570,13 +570,14 @@ array(float) ECEF() { protected string|array cast(string to) { - if (to[..4]=="array") - return ({lat,long}); - - if (to[..5]=="string") - return latitude()+" "+longitude(); - - return UNDEFINED; + switch(to) + { + case "array": + return ({lat,long}); + case "string": + return latitude()+" "+longitude(); + } + return UNDEFINED; } //! diff --git a/lib/modules/Locale.pmod/module.pmod b/lib/modules/Locale.pmod/module.pmod index 5392de336ef26fa18231247e33b9139ca874014d..a1e61b9404b56b984810b6fadd252f45ae0b6052 100644 --- a/lib/modules/Locale.pmod/module.pmod +++ b/lib/modules/Locale.pmod/module.pmod @@ -563,7 +563,6 @@ class DeferredLocale( protected string project, protected mixed cast(string to) { if(to=="string") return lookup(); - if(to=="mixed" || to=="object") return this; return UNDEFINED; } diff --git a/lib/modules/MIME.pmod/module.pmod b/lib/modules/MIME.pmod/module.pmod index ec3a986383c97623e55b57c23e3c8f5fc7cd3c97..5ecbafef98368cdae2a63073f173b0730616344e 100644 --- a/lib/modules/MIME.pmod/module.pmod +++ b/lib/modules/MIME.pmod/module.pmod @@ -135,14 +135,9 @@ protected class StringRange } protected mixed cast(string type) { - switch(type) { - case "string": + if( type == "string" ) return data[start..end-1]; - case "object": - return this_object(); - default: - return UNDEFINED; - } + return UNDEFINED; } protected int _search(string frag, int|void pos) { diff --git a/lib/modules/Parser.pmod/XML.pmod/Tree.pmod b/lib/modules/Parser.pmod/XML.pmod/Tree.pmod index d5fed645fda15f54ecf39d6c8e053a4c0bf45427..0086ccc53c41fb62fe9a67dc6f76326f7e3d2c3a 100644 --- a/lib/modules/Parser.pmod/XML.pmod/Tree.pmod +++ b/lib/modules/Parser.pmod/XML.pmod/Tree.pmod @@ -1028,7 +1028,6 @@ protected class VirtualNode { //! It is possible to cast a node to a string, which will return //! @[render_xml()] for that node. protected mixed cast(string to) { - if(to=="object") return this; if(to=="string") return render_xml(); return UNDEFINED; } diff --git a/lib/modules/Search.pmod/Utils.pmod b/lib/modules/Search.pmod/Utils.pmod index 07691e2ad56964c271d183f7abbab51dc0b69491..2703349178522199fbba816431a026821add0f2a 100644 --- a/lib/modules/Search.pmod/Utils.pmod +++ b/lib/modules/Search.pmod/Utils.pmod @@ -149,7 +149,6 @@ class ProfileEntry { protected mixed cast(string to) { switch(to) { - case "object": return this_object(); case "array": return indices(vals); case "multiset": return (multiset)indices(vals); default: diff --git a/lib/modules/Stdio.pmod/FakeFile.pike b/lib/modules/Stdio.pmod/FakeFile.pike index ac676a12a1a1a979263ac86c406f11c1d85f2bc7..be870ca95d8a6891108131b7c3e671e7b30318ef 100644 --- a/lib/modules/Stdio.pmod/FakeFile.pike +++ b/lib/modules/Stdio.pmod/FakeFile.pike @@ -320,10 +320,8 @@ string _sprintf(int t) { //! A FakeFile can be casted to a string. protected mixed cast(string to) { - switch(to) { - case "string": return data; - case "object": return this; - } + if( to == "string" ) + return data; return UNDEFINED; }