From ea7e02e5cccfd388ac77301b7b108a12012eafc1 Mon Sep 17 00:00:00 2001 From: Martin Nilsson <mani@lysator.liu.se> Date: Sun, 17 Mar 2002 19:24:54 +0100 Subject: [PATCH] throw -> error Rev: lib/modules/Standards.pmod/ASN1.pmod/Encode.pmod:1.7 Rev: lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:1.18 Rev: lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod:1.9 --- .../Standards.pmod/ASN1.pmod/Encode.pmod | 9 +++------ .../Standards.pmod/ASN1.pmod/Types.pmod | 19 ++++++------------- .../Standards.pmod/PKCS.pmod/Certificate.pmod | 9 +++------ 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/lib/modules/Standards.pmod/ASN1.pmod/Encode.pmod b/lib/modules/Standards.pmod/ASN1.pmod/Encode.pmod index 0f52d329dc..50b183e6ff 100644 --- a/lib/modules/Standards.pmod/ASN1.pmod/Encode.pmod +++ b/lib/modules/Standards.pmod/ASN1.pmod/Encode.pmod @@ -59,8 +59,7 @@ class asn1_object return sprintf("%c", len); string s = Gmp.mpz(len)->digits(256); if (strlen(s) >= 0x80) - throw( ({ "asn1.encode.asn1_object->encode_length: Max length exceeded.\n", - backtrace() }) ); + error( "asn1.encode.asn1_object->encode_length: Max length exceeded.\n" ); return sprintf("%c%s", strlen(s) | 0x80, s); } @@ -85,8 +84,7 @@ class asn1_compound elements = args; foreach(elements, mixed o) if (!o || !objectp(o)) - throw( ({ "asn1_compound: Non-object argument!\n", - backtrace() }) ); + error( "asn1_compound: Non-object argument!\n" ); WERROR(sprintf("asn1_compound: %O\n", elements)); } } @@ -183,8 +181,7 @@ class asn1_identifier if ( (sizeof(args) < 2) || (args[0] > 2) || (args[1] >= ( (args[0] < 2) ? 40 : 176) )) - throw( ({ "asn1.encode.asn1_identifier->create: Invalid object identifier.\n", - backtrace() }) ); + error( "asn1.encode.asn1_identifier->create: Invalid object identifier.\n" ); id = args; } diff --git a/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod b/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod index 563fabd4b3..4b888933a4 100644 --- a/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod +++ b/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod @@ -1,5 +1,5 @@ /* - * $Id: Types.pmod,v 1.17 2000/11/20 01:28:23 mast Exp $ + * $Id: Types.pmod,v 1.18 2002/03/17 18:23:58 nilsson Exp $ * * Encodes various asn.1 objects according to the Distinguished * Encoding Rules (DER) */ @@ -14,8 +14,6 @@ #define WERROR(x) #endif -#define error(msg) throw( ({ msg, backtrace() }) ) - /* Combines tag and class as a single integer, in a somewhat arbitrary * way. This works also for tags beyond 31 (although not for tags @@ -93,8 +91,7 @@ class asn1_object return sprintf("%c", len); string s = Gmp.mpz(len)->digits(256); if (strlen(s) >= 0x80) - throw( ({ "asn1.encode.asn1_object->encode_length: Max length exceeded.\n", - backtrace() }) ); + error( "asn1.encode.asn1_object->encode_length: Max length exceeded.\n" ); return sprintf("%c%s", strlen(s) | 0x80, s); } @@ -142,8 +139,7 @@ class asn1_compound elements = args; foreach(elements, mixed o) if (!o || !objectp(o)) - throw( ({ "asn1_compound: Non-object argument!\n", - backtrace() }) ); + error( "asn1_compound: Non-object argument!\n" ); WERROR(sprintf("asn1_compound: %O\n", elements)); return this_object(); } @@ -387,8 +383,7 @@ class asn1_identifier if ( (sizeof(args) < 2) || (args[0] > 2) || (args[1] >= ( (args[0] < 2) ? 40 : 176) )) - throw( ({ "asn1.encode.asn1_identifier->init: Invalid object identifier.\n", - backtrace() }) ); + error( "asn1.encode.asn1_identifier->init: Invalid object identifier.\n" ); id = args; return this_object(); } @@ -1006,14 +1001,12 @@ class asn1_universal_string string der_encode() { - throw (({"asn1_universal_string: Encoding not implemented\n", - backtrace()})); + error( "asn1_universal_string: Encoding not implemented\n" ); } object decode_primitive (string contents) { - throw (({"asn1_universal_string: Decoding not implemented\n", - backtrace()})); + error( "asn1_universal_string: Decoding not implemented\n" ); } } diff --git a/lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod b/lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod index 64cc95ccc3..1b3fbea776 100644 --- a/lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod +++ b/lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod @@ -144,9 +144,8 @@ class AttributeValueAssertion object value) { if (!types[type]) - throw( ({ sprintf("AttributeValueAssertion: " - "Unknown attribute type '%s'\n", - type), backtrace() }) ); + error( "AttributeValueAssertion: " + "Unknown attribute type '%s'\n", type ); ::create( ({ types[type], value }) ); } } @@ -186,9 +185,7 @@ class Attribute array(object) v) { if (!types[type]) - throw( ({ sprintf("Attribute: " - "Unknown attribute type '%s'\n", - type), backtrace() }) ); + error( "Attribute: Unknown attribute type '%s'\n", type); ::create( ({ types[type], asn1_set(v) }) ); } } -- GitLab