diff --git a/lib/master.pike.in b/lib/master.pike.in index d94b6d7ba56123b0e303722684f1c9063f1e2517..aa5fc2f8dad1b9e79a673cd0e5f73352cfcd1a3f 100644 --- a/lib/master.pike.in +++ b/lib/master.pike.in @@ -5532,13 +5532,11 @@ class Version //! The version object can be casted into a string. protected mixed cast(string type) - { - switch(type) - { - case "string": - return sprintf("%d.%d",major,minor); - } - } + { + if( type=="string" ) + return sprintf("%d.%d",major,minor); + return UNDEFINED; + } } //! Version information about the current Pike version. diff --git a/lib/modules/ADT.pmod/Interval.pike b/lib/modules/ADT.pmod/Interval.pike index 76db53ce797332b6eb060959e980b4076c399576..3bdf6e43df879dfa482fbd4a25bdd9164be7d43b 100644 --- a/lib/modules/ADT.pmod/Interval.pike +++ b/lib/modules/ADT.pmod/Interval.pike @@ -246,9 +246,10 @@ int(0..1) contains(mixed x) { mixed beginning() { return start; } mixed end() { return stop; } -mixed cast(string type) { - switch (type) { - case "array": - return ({ start, stop }); - } +protected mixed cast(string type) { + switch (type) { + case "array": + return ({ start, stop }); + } + return UNDEFINED; } diff --git a/lib/modules/ADT.pmod/Queue.pike b/lib/modules/ADT.pmod/Queue.pike index 5bcbd3f584d1f7ee6f09978a93a2ba788f9cb54c..fe5e8cb8a92b2d28f2cb28fc19f010af155c2ff4 100644 --- a/lib/modules/ADT.pmod/Queue.pike +++ b/lib/modules/ADT.pmod/Queue.pike @@ -79,7 +79,7 @@ protected mixed cast(string to) { case "object": return this; case "array": return l+({}); } - error("Can not cast ADT.Queue to %s.\n", to); + return UNDEFINED; } protected string _sprintf(int t) { diff --git a/lib/modules/ADT.pmod/Relation.pmod/Binary.pike b/lib/modules/ADT.pmod/Relation.pmod/Binary.pike index f9967036ae883d1ca5d42d3c0f0d4902d693034b..bb525b8237146ba8cbdf2833df7b31baa950587c 100644 --- a/lib/modules/ADT.pmod/Relation.pmod/Binary.pike +++ b/lib/modules/ADT.pmod/Relation.pmod/Binary.pike @@ -314,6 +314,6 @@ mixed cast(string to) { case "mapping": return copy_value(val); default: - error("Can not cast ADT.Relation.Binary to %O.\n", to); + return UNDEFINED; } } diff --git a/lib/modules/ADT.pmod/Set.pike b/lib/modules/ADT.pmod/Set.pike index 4bf910458dfa2e543914f13a37dbcf0be5a3ae6b..97eb408ef4178fbfdb411c8ab40596d856ad66bd 100644 --- a/lib/modules/ADT.pmod/Set.pike +++ b/lib/modules/ADT.pmod/Set.pike @@ -244,7 +244,7 @@ array(mixed) _values() //! An ADT.Set can be cast to an array or a multiset. -mixed cast(string to) +protected mixed cast(string to) { switch(to) { @@ -258,7 +258,7 @@ mixed cast(string to) return copy_value(set); default: - error("Cannot cast ADT.Set to %s.\n", to); + return UNDEFINED; } } diff --git a/lib/modules/ADT.pmod/Stack.pike b/lib/modules/ADT.pmod/Stack.pike index 28f0f927fb2af1591649d3b8d426c0a96ff06925..4de3ce6c3f0a56822f1404223d8b02d05081a9b2 100644 --- a/lib/modules/ADT.pmod/Stack.pike +++ b/lib/modules/ADT.pmod/Stack.pike @@ -141,12 +141,12 @@ this_program `+(this_program s) { return ns; } -mixed cast(string to) { +protected mixed cast(string to) { switch(to) { case "array": return _values(); default: - error("Cannot cast to %s.\n", to); + return UNDEFINED; } } diff --git a/lib/modules/ADT.pmod/Struct.pike b/lib/modules/ADT.pmod/Struct.pike index 6a478700a09ce3532276da5d8b1afb01f52fc2e5..2ed01bfdb0394056cb935ea8beda159e3116a020 100644 --- a/lib/modules/ADT.pmod/Struct.pike +++ b/lib/modules/ADT.pmod/Struct.pike @@ -130,6 +130,7 @@ protected mixed cast(string to) { case "string": return encode(); case "array": return items->encode(); } + return UNDEFINED; } diff --git a/lib/modules/ADT.pmod/Table.pmod b/lib/modules/ADT.pmod/Table.pmod index 5f3fa5f3a0e25f2bfe6f95d69bf21bd35618db68..f2494846f5953edf0a89c42ed96b208c2e079b11 100644 --- a/lib/modules/ADT.pmod/Table.pmod +++ b/lib/modules/ADT.pmod/Table.pmod @@ -54,7 +54,7 @@ class table { return copy(m->table, m->fields, m->types); } - mixed cast(string type) + protected mixed cast(string type) { switch(type) { case "array": @@ -62,6 +62,7 @@ class table { case "string": return ASCII->encode(this); } + return UNDEFINED; } //! This method returns the column names for the table. The case used when diff --git a/lib/modules/Calendar.pmod/Event.pmod b/lib/modules/Calendar.pmod/Event.pmod index 62dcd6709ba0c7a9788ace3493daa486cd0b87d4..baaef6e2dd6714bbd5645671ae9df6b0db6d7037 100644 --- a/lib/modules/Calendar.pmod/Event.pmod +++ b/lib/modules/Calendar.pmod/Event.pmod @@ -87,12 +87,11 @@ class Event return (t!='O')?0:sprintf("Event(%s:%O)",id,name); } - array(Event) cast(string to) + protected array(Event) cast(string to) { - if (to[..4]=="array") - return ({this}); - else - error("Can't cast to %O\n",to); + if (to[..4]=="array") + return ({this}); + return UNDEFINED; } //! Returns a description of the event. @@ -1404,12 +1403,11 @@ class SuperEvent return SuperEvent(res,flags&res,"?"); } - array(Event) cast(string to) + protected array(Event) cast(string to) { - if (to[..4]=="array") - return events; - else - error("Can't cast to %O\n",to); + if (to[..4]=="array") + return events; + return UNDEFINED; } protected string _sprintf(int t) diff --git a/lib/modules/GLUE.pmod/Events.pmod b/lib/modules/GLUE.pmod/Events.pmod index 58cfb363c2e95e437ac83b700a98b84b9d8c93b1..5d9d597cb608dbc8c984e401d225643e3a06801e 100644 --- a/lib/modules/GLUE.pmod/Events.pmod +++ b/lib/modules/GLUE.pmod/Events.pmod @@ -273,9 +273,10 @@ class Event return hash( sprintf( "%d %d %d", press, key, modifiers ) ); } - string cast(string to) { + protected string cast(string to) + { if(to=="string") return data; - error("Can not cast to %s.\n", to); + return UNDEFINED; } void update_modifiers(int _modifiers) { diff --git a/lib/modules/Geography.pmod/Countries.pmod b/lib/modules/Geography.pmod/Countries.pmod index a66b8d14b5a3c3a4f0d029557e41dac9675a620b..cc8494f5dd2cf1c00fd0a302ad08224653e75f8b 100644 --- a/lib/modules/Geography.pmod/Countries.pmod +++ b/lib/modules/Geography.pmod/Countries.pmod @@ -376,10 +376,10 @@ class Country //! It is possible to cast a country to a string, //! which will be the same as performing //! @expr{country->name;@}. - string cast(string to) + protected string cast(string to) { if (to[..5]=="string") return name; - error("can't cast to %O\n",to); + return UNDEFINED; } string _sprintf(int t) diff --git a/lib/modules/Geography.pmod/Position.pike b/lib/modules/Geography.pmod/Position.pike index 29950c094a03a0525f2da773ed27aaa9c303eb9d..9c0d5f08af0343a5ebba4022acb23021d5401ee9 100644 --- a/lib/modules/Geography.pmod/Position.pike +++ b/lib/modules/Geography.pmod/Position.pike @@ -576,7 +576,7 @@ protected string|array cast(string to) if (to[..5]=="string") return latitude()+" "+longitude(); - error("can't cast to %O\n",to); + return UNDEFINED; } //! diff --git a/lib/modules/Int.pmod b/lib/modules/Int.pmod index 5bfa4a77730246554c061dc7086ebe1e8e0aed26..484aa3669a42b4798da46c72e9aea462c07c0968 100644 --- a/lib/modules/Int.pmod +++ b/lib/modules/Int.pmod @@ -162,7 +162,7 @@ class Inf { case "float": return Math.inf; default: - error("Can not cast to %O.\n", to); + return UNDEFINED; } } protected string _sprintf(int t) { diff --git a/lib/modules/Locale.pmod/module.pmod b/lib/modules/Locale.pmod/module.pmod index 4495f028f790167879ffcaad44f478bb0130a28c..5392de336ef26fa18231247e33b9139ca874014d 100644 --- a/lib/modules/Locale.pmod/module.pmod +++ b/lib/modules/Locale.pmod/module.pmod @@ -564,7 +564,7 @@ class DeferredLocale( protected string project, { if(to=="string") return lookup(); if(to=="mixed" || to=="object") return this; - error( "Cannot cast DeferredLocale to "+to+".\n" ); + return UNDEFINED; } protected int _is_type(string type) { diff --git a/lib/modules/MIME.pmod/ext_to_media_type.pmod b/lib/modules/MIME.pmod/ext_to_media_type.pmod index 7b54884bbbc7e15f8132cd68664c7ae256b23eaf..bbdc3462d63e6a030ad68ec39c45c5c654c407e9 100644 --- a/lib/modules/MIME.pmod/ext_to_media_type.pmod +++ b/lib/modules/MIME.pmod/ext_to_media_type.pmod @@ -1661,4 +1661,5 @@ string `()(string ext) { protected mixed cast(string to) { if(to=="mapping") return small_ext2type + ext2type; + return UNDEFINED; } diff --git a/lib/modules/MIME.pmod/module.pmod b/lib/modules/MIME.pmod/module.pmod index 0693f0623d14c5eabe8e187882b38151a6b4f669..ec3a986383c97623e55b57c23e3c8f5fc7cd3c97 100644 --- a/lib/modules/MIME.pmod/module.pmod +++ b/lib/modules/MIME.pmod/module.pmod @@ -141,7 +141,7 @@ protected class StringRange case "object": return this_object(); default: - error("StringRange: Unsupported cast to %s.\n", type); + return UNDEFINED; } } protected int _search(string frag, int|void pos) @@ -1190,13 +1190,13 @@ class Message { //! //! @seealso //! @[create()] - string cast( string dest_type ) + protected string cast( string dest_type ) { string data; object body_part; if (dest_type != "string") - error( "Can't cast Message to %s.\n", dest_type); + return UNDEFINED; data = getencoded( ); diff --git a/lib/modules/Mapping.pmod b/lib/modules/Mapping.pmod index 60a25367c5d94034436d1d9f7eb14814d01c1f8d..a34ebcbde043d77e22fb1ca6f8871d1d71166458 100644 --- a/lib/modules/Mapping.pmod +++ b/lib/modules/Mapping.pmod @@ -169,7 +169,7 @@ class ShadowedMapping(protected mapping|ShadowedMapping parent) case "mapping": return joined + ([]); case "array": return (array)joined; } - return joined + ([]); + return UNDEFINED; } protected mixed _search(mixed val) diff --git a/lib/modules/NetUtils.pmod b/lib/modules/NetUtils.pmod index 0aac99ed5b5ed14ef51f0df502f15dbfbdcf20ab..8ff63a039bfe988ed3e23f7175c7c8159457a682 100644 --- a/lib/modules/NetUtils.pmod +++ b/lib/modules/NetUtils.pmod @@ -260,7 +260,7 @@ class NetMask case "array": return ({ net, mask }); default: - error("Can not cast to %O\n", type ); + return UNDEFINED; } } diff --git a/lib/modules/Parser.pmod/C.pmod b/lib/modules/Parser.pmod/C.pmod index d09792bfc1f9bbeeb97068d22d6a9b357b36b9cf..a2a1c7267e8fe441ed6cd94707ea1e3205e5a619 100644 --- a/lib/modules/Parser.pmod/C.pmod +++ b/lib/modules/Parser.pmod/C.pmod @@ -137,6 +137,7 @@ class Token protected mixed cast(string to) { if(to=="string") return text; + return UNDEFINED; } //! Characters and ranges may be indexed from the text contents of the token. diff --git a/lib/modules/Parser.pmod/LR.pmod/module.pmod b/lib/modules/Parser.pmod/LR.pmod/module.pmod index 1afc9158b669f01182bac183f22b251273402449..a9157e979390f1a462c1e03a922bd9b517d89105 100644 --- a/lib/modules/Parser.pmod/LR.pmod/module.pmod +++ b/lib/modules/Parser.pmod/LR.pmod/module.pmod @@ -629,11 +629,11 @@ class Parser //! //! @param type //! Type to cast to. - mixed cast(string type) + protected mixed cast(string type) { if (type == "string") return _sprintf(); - error("Cast to %s not supported\n", type); + return UNDEFINED; } /* Here come the functions that actually do some work */ diff --git a/lib/modules/Parser.pmod/XML.pmod/DOM.pmod b/lib/modules/Parser.pmod/XML.pmod/DOM.pmod index 0be1615297883d6eb79ce9ecfc6d27074c3d7235..b9eee78e7f93dd709c80c08672310bb51b7eb996 100644 --- a/lib/modules/Parser.pmod/XML.pmod/DOM.pmod +++ b/lib/modules/Parser.pmod/XML.pmod/DOM.pmod @@ -94,8 +94,11 @@ class NodeList } protected Node `[](int index) { return item(index); } protected int _sizeof() { return get_length(); } - protected array(Node) cast(string to) { - return to[..4] == "array" && values(this); + protected array(Node) cast(string to) + { + if(to[..4] == "array") + return values(this); + return UNDEFINED; } Node item(int index) @@ -160,8 +163,11 @@ class NamedNodeMap } protected int _sizeof() { return get_length(); } - protected mapping(string:Node) cast(string to) { - return to[..6] == "mapping" && copy_value(map); + protected mapping(string:Node) cast(string to) + { + if(to[..6] == "mapping") + return copy_value(map); + return UNDEFINED; } Node item(int index) @@ -542,7 +548,12 @@ class CharacterData substring_data(offset+count, get_length())); } - string cast(string to) { return to == "string" && get_data(); } + protected string cast(string to) + { + if(to == "string") + return get_data(); + return UNDEFINED; + } } class Attr @@ -873,9 +884,11 @@ class Entity string get_notation_name() { return notation_name; } protected int is_readonly() { return name != 0; } - string cast(string to) + protected string cast(string to) { - return to == "string" && ((array(string))get_child_nodes())*""; + if(to == "string") + return ((array(string))get_child_nodes())*""; + return UNDEFINED; } protected int child_is_allowed(Node child) @@ -913,11 +926,11 @@ class EntityReference return owner_document->create_entity_reference(name); } - string cast(string to) + protected string cast(string to) { - return to == "string" && - (entity? (string)entity : - "&"+name+";"); + if(to == "string") + return (entity? (string)entity : "&"+name+";"); + return UNDEFINED; } NodeList get_child_nodes() { return entity && entity->get_child_nodes(); } diff --git a/lib/modules/Parser.pmod/XML.pmod/Tree.pmod b/lib/modules/Parser.pmod/XML.pmod/Tree.pmod index 31fc02f6b44037f373b4be6253983bda76946280..d5fed645fda15f54ecf39d6c8e053a4c0bf45427 100644 --- a/lib/modules/Parser.pmod/XML.pmod/Tree.pmod +++ b/lib/modules/Parser.pmod/XML.pmod/Tree.pmod @@ -1027,10 +1027,10 @@ protected class VirtualNode { //! It is possible to cast a node to a string, which will return //! @[render_xml()] for that node. - mixed cast(string to) { + protected mixed cast(string to) { if(to=="object") return this; if(to=="string") return render_xml(); - error( "Can not case Node to "+to+".\n" ); + return UNDEFINED; } // FIXME: Consider moving this to the corresponding base node classes? diff --git a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike index b6976365e724bd04a9160107fd00e493cc91d062..2eafd390bc2b99e1cddbb88ea228dd0e00ea0c80 100644 --- a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike +++ b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike @@ -1063,7 +1063,7 @@ int total_bytes() //! @decl string cast("string") //! Gives back the answer as a string. -array|mapping|string cast(string to) +protected array|mapping|string cast(string to) { switch (to) { @@ -1079,7 +1079,7 @@ array|mapping|string cast(string to) data(); return buf; } - error("HTTP.Query: can't cast to "+to+"\n"); + return UNDEFINED; } //! Minimal simulation of a @[Stdio.File] object. diff --git a/lib/modules/Protocols.pmod/LysKOM.pmod/Raw.pike b/lib/modules/Protocols.pmod/LysKOM.pmod/Raw.pike index 12c8cc157cabb8c074f67518553b363e735803cb..03327e11956c1841718cd5f617f1994a51a2dffb 100644 --- a/lib/modules/Protocols.pmod/LysKOM.pmod/Raw.pike +++ b/lib/modules/Protocols.pmod/LysKOM.pmod/Raw.pike @@ -70,7 +70,12 @@ class Send request=r; callback=c; } - int cast(string i) { return ref; } + protected int cast(string type) + { + if( type=="int" ) + return ref; + return UNDEFINED; + } void write() { out_req++; diff --git a/lib/modules/Protocols.pmod/WebSocket.pmod b/lib/modules/Protocols.pmod/WebSocket.pmod index 2cb5f0044740c873052bb08e9095d047a932da55..e44c4d69368e47345c307436ccfbb69c58bef4ef 100644 --- a/lib/modules/Protocols.pmod/WebSocket.pmod +++ b/lib/modules/Protocols.pmod/WebSocket.pmod @@ -231,12 +231,11 @@ class Frame { return b->get(); } - protected string cast(string to) { - if (to == "string") { - return encode(); - } - - error("Cannot cast %O to %O\n", this, to); + protected string cast(string to) + { + if (to == "string") + return encode(); + return UNDEFINED; } } diff --git a/lib/modules/Search.pmod/Utils.pmod b/lib/modules/Search.pmod/Utils.pmod index 72622fa7d0bba64123d1d395df936f44c6b38761..07691e2ad56964c271d183f7abbab51dc0b69491 100644 --- a/lib/modules/Search.pmod/Utils.pmod +++ b/lib/modules/Search.pmod/Utils.pmod @@ -147,13 +147,13 @@ class ProfileEntry { return this_object(); } - mixed cast(string to) { + protected mixed cast(string to) { switch(to) { case "object": return this_object(); case "array": return indices(vals); case "multiset": return (multiset)indices(vals); default: - error("Can not cast ADTSet to "+to+".\n"); + return UNDEFINED; } } } diff --git a/lib/modules/Sql.pmod/tds.pike b/lib/modules/Sql.pmod/tds.pike index a2b180e47e35ae0c96dc6088db796228f6a079a4..5b1d584b8fca7c171c1a258d3f6e5d19a29890d8 100644 --- a/lib/modules/Sql.pmod/tds.pike +++ b/lib/modules/Sql.pmod/tds.pike @@ -420,8 +420,10 @@ protected { strings += ({ raw }); } - mixed cast(string s) + protected string cast(string type) { + if( type!="string" ) return UNDEFINED; + int trailer_start = flags && 4; foreach(segments, string|int seg) { trailer_start += stringp(seg)?sizeof(seg):(seg<0)?8:4; diff --git a/lib/modules/Standards.pmod/BSON.pmod/Binary.pike b/lib/modules/Standards.pmod/BSON.pmod/Binary.pike index 419246e13f362ab83c2a12ea22ea779504b85c4e..6147de1b9590d36f21deebe66ee8c4b52b9ef058 100644 --- a/lib/modules/Standards.pmod/BSON.pmod/Binary.pike +++ b/lib/modules/Standards.pmod/BSON.pmod/Binary.pike @@ -46,5 +46,6 @@ return sprintf("%-4H", data); else return data; } + return UNDEFINED; } diff --git a/lib/modules/Standards.pmod/BSON.pmod/Javascript.pike b/lib/modules/Standards.pmod/BSON.pmod/Javascript.pike index e2bfaf68f0357ef7971f186b2abba680a2c1500b..9d3ffad7b3aa6f911e60eca0b34dba83a507237d 100644 --- a/lib/modules/Standards.pmod/BSON.pmod/Javascript.pike +++ b/lib/modules/Standards.pmod/BSON.pmod/Javascript.pike @@ -19,5 +19,6 @@ { if(type == "string") return data; + return UNDEFINED; } diff --git a/lib/modules/Standards.pmod/BSON.pmod/ObjectId.pike b/lib/modules/Standards.pmod/BSON.pmod/ObjectId.pike index c3817bc3b41111e6c95df405d21bc5b70e2d3c8d..a47a42e37257994fc2e4cde51c49c1bfa3f37ab0 100644 --- a/lib/modules/Standards.pmod/BSON.pmod/ObjectId.pike +++ b/lib/modules/Standards.pmod/BSON.pmod/ObjectId.pike @@ -59,6 +59,5 @@ protected mixed cast(string t) { if(t == "string") return String.string2hex(get_id()); - else - throw(Error.Generic("invalid cast of ObjectId to " + t + "\n")); + return UNDEFINED; } diff --git a/lib/modules/Standards.pmod/BSON.pmod/Symbol.pike b/lib/modules/Standards.pmod/BSON.pmod/Symbol.pike index 462a34ce666129804e41965da45e092c8d0ab942..9e2964c9cd9ec2b0f7abd22d300be26282d16488 100644 --- a/lib/modules/Standards.pmod/BSON.pmod/Symbol.pike +++ b/lib/modules/Standards.pmod/BSON.pmod/Symbol.pike @@ -19,5 +19,6 @@ { if(type == "string") return data; + return UNDEFINED; } diff --git a/lib/modules/Standards.pmod/BSON.pmod/module.pmod b/lib/modules/Standards.pmod/BSON.pmod/module.pmod index 39d7c434f6e7cc30d2ee40bf21e914df58ce8b85..490bbbc56368816988b94e6bc7136f2107880329 100644 --- a/lib/modules/Standards.pmod/BSON.pmod/module.pmod +++ b/lib/modules/Standards.pmod/BSON.pmod/module.pmod @@ -382,6 +382,7 @@ object MinKey = class { if(type == "string") return "MinKey"; + return UNDEFINED; } }(); @@ -395,6 +396,7 @@ object MaxKey = class { if(type == "string") return "MinKey"; + return UNDEFINED; } }(); diff --git a/lib/modules/Standards.pmod/URI.pike b/lib/modules/Standards.pmod/URI.pike index e7fdf1b2a8767bcf122d99987ead2e18110cd576..b67e7146687a5500abbf846cc64690dcd7aa07e5 100644 --- a/lib/modules/Standards.pmod/URI.pike +++ b/lib/modules/Standards.pmod/URI.pike @@ -452,7 +452,7 @@ mixed `[]=(string property, mixed value) //! When cast to mapping, return a mapping with scheme, authority, //! user, password, host, port, path, query, fragment, raw_uri, //! base_uri as documented above. -string|mapping cast(string to) +protected string|mapping cast(string to) { switch(to) { @@ -465,6 +465,7 @@ string|mapping cast(string to) "raw_uri", "base_uri", }); return mkmapping(i, rows(this, i)); } + return UNDEFINED; } //! Returns path and query part of the URI if present. diff --git a/lib/modules/Standards.pmod/UUID.pmod b/lib/modules/Standards.pmod/UUID.pmod index 8a0905dd35f9afb42c63a9bc43fd0a8f7a8c6cc8..692f25d2cb63358edd102c3da35afa7244e0a401 100644 --- a/lib/modules/Standards.pmod/UUID.pmod +++ b/lib/modules/Standards.pmod/UUID.pmod @@ -231,7 +231,7 @@ class UUID { validate(); } - mixed cast(string to) { + protected mixed cast(string to) { switch(to) { case "string": return str(); case "mapping": return ([ @@ -240,6 +240,7 @@ class UUID { "time_hi_and_version" : time_hi_and_version(), ]); } + return UNDEFINED; } } diff --git a/lib/modules/Standards.pmod/X509.pmod b/lib/modules/Standards.pmod/X509.pmod index 6add1cd27d772087ca077e20a946ad83c728af18..4ff17f2c121c726f8b14736a965c9ca5fdadb8b9 100644 --- a/lib/modules/Standards.pmod/X509.pmod +++ b/lib/modules/Standards.pmod/X509.pmod @@ -706,7 +706,7 @@ class TBSCertificate ]); break; default: - error("Can't case %O to %O\n", this_program, to); + return UNDEFINED; break; } } diff --git a/lib/modules/Stdio.pmod/FakeFile.pike b/lib/modules/Stdio.pmod/FakeFile.pike index 744ac4b9184c2cc12a113346d376e01687d99baa..ac676a12a1a1a979263ac86c406f11c1d85f2bc7 100644 --- a/lib/modules/Stdio.pmod/FakeFile.pike +++ b/lib/modules/Stdio.pmod/FakeFile.pike @@ -319,12 +319,12 @@ string _sprintf(int t) { // FakeFile specials. //! A FakeFile can be casted to a string. -mixed cast(string to) { +protected mixed cast(string to) { switch(to) { case "string": return data; case "object": return this; } - error("Can not cast object to %O.\n", to); + return UNDEFINED; } //! Sizeof on a FakeFile returns the size of its contents. diff --git a/lib/modules/String.pmod/HTML.pmod b/lib/modules/String.pmod/HTML.pmod index 96ca459d4ff497f7600df3c40fe63eae576f8907..4cfdb3439d7bcbc2e37b60e72b699a9897be3e6b 100644 --- a/lib/modules/String.pmod/HTML.pmod +++ b/lib/modules/String.pmod/HTML.pmod @@ -259,6 +259,6 @@ class OBox { return rows; if(to=="string") return render(); - error("Could not cast OBox object to %s.\n", to); + return UNDEFINED; } } diff --git a/lib/modules/Tools.pmod/Hilfe.pmod b/lib/modules/Tools.pmod/Hilfe.pmod index 6b7de25cac3a200ba9a519b01cf468170e656ee0..4aff71cfb1e69eff205b98f7ee9caac0849af853 100644 --- a/lib/modules/Tools.pmod/Hilfe.pmod +++ b/lib/modules/Tools.pmod/Hilfe.pmod @@ -1153,7 +1153,7 @@ class Expression { case "array": return tokens; case "string": return code(); } - error("Can not cast to %O\n", to); + return UNDEFINED; } protected string _sprintf(int t) {