Skip to content

Commit

Permalink
removed superfluous constraints duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
vlm committed Sep 7, 2017
1 parent b7a202e commit 154519a
Show file tree
Hide file tree
Showing 45 changed files with 13 additions and 50 deletions.
2 changes: 1 addition & 1 deletion libasn1compiler/asn1c_C.c
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
// OUT("td->check_constraints "
// "= asn_DEF_%s.check_constraints;\n",
// asn1c_type_name(arg, expr, TNF_SAFE));
OUT("return td->op->check_constraints"
OUT("return td->check_constraints"
"(td, sptr, ctfailcb, app_key);\n");
}
INDENT(-1);
Expand Down
2 changes: 1 addition & 1 deletion libasn1compiler/asn1c_constraint.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
case ASN_CONSTR_SEQUENCE_OF:
case ASN_CONSTR_SET_OF:
OUT("/* Perform validation of the inner elements */\n");
OUT("return td->op->check_constraints(td, sptr, ctfailcb, app_key);\n");
OUT("return td->check_constraints(td, sptr, ctfailcb, app_key);\n");
break;
default:
OUT("/* Constraint check succeeded */\n");
Expand Down
1 change: 0 additions & 1 deletion skeletons/ANY.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ asn_TYPE_operation_t asn_OP_ANY = {
OCTET_STRING_free,
OCTET_STRING_print,
OCTET_STRING_compare,
asn_generic_no_constraint,
OCTET_STRING_decode_ber,
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
Expand Down
1 change: 0 additions & 1 deletion skeletons/BIT_STRING.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ asn_TYPE_operation_t asn_OP_BIT_STRING = {
OCTET_STRING_free, /* Implemented in terms of OCTET STRING */
BIT_STRING_print,
BIT_STRING_compare,
BIT_STRING_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
OCTET_STRING_decode_xer_binary,
Expand Down
1 change: 0 additions & 1 deletion skeletons/BMPString.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ asn_TYPE_operation_t asn_OP_BMPString = {
OCTET_STRING_free, /* Implemented in terms of OCTET STRING */
BMPString_print,
OCTET_STRING_compare,
BMPString_constraint,
OCTET_STRING_decode_ber,
OCTET_STRING_encode_der,
BMPString_decode_xer, /* Convert from UTF-8 */
Expand Down
1 change: 0 additions & 1 deletion skeletons/BMPString.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ xer_type_encoder_f BMPString_encode_xer;
#define BMPString_free OCTET_STRING_free
#define BMPString_print BMPString_print
#define BMPString_compare OCTET_STRING_compare
#define BMPString_constraint asn_generic_no_constraint
#define BMPString_decode_ber OCTET_STRING_decode_ber
#define BMPString_encode_der OCTET_STRING_encode_der
#define BMPString_decode_uper OCTET_STRING_decode_uper
Expand Down
1 change: 0 additions & 1 deletion skeletons/BOOLEAN.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ asn_TYPE_operation_t asn_OP_BOOLEAN = {
BOOLEAN_free,
BOOLEAN_print,
BOOLEAN_compare,
asn_generic_no_constraint,
BOOLEAN_decode_ber,
BOOLEAN_encode_der,
BOOLEAN_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/ENUMERATED.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ asn_TYPE_operation_t asn_OP_ENUMERATED = {
ASN__PRIMITIVE_TYPE_free,
INTEGER_print, /* Implemented in terms of INTEGER */
INTEGER_compare, /* Implemented in terms of INTEGER */
asn_generic_no_constraint,
ber_decode_primitive,
INTEGER_encode_der, /* Implemented in terms of INTEGER */
INTEGER_decode_xer, /* This is temporary! */
Expand Down
1 change: 0 additions & 1 deletion skeletons/GeneralString.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ asn_TYPE_operation_t asn_OP_GeneralString = {
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
OCTET_STRING_compare,
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
Expand Down
1 change: 0 additions & 1 deletion skeletons/GeneralizedTime.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ asn_TYPE_operation_t asn_OP_GeneralizedTime = {
OCTET_STRING_free,
GeneralizedTime_print,
OCTET_STRING_compare, /* Does not normalize time zones! */
GeneralizedTime_constraint, /* Check validity of time */
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
GeneralizedTime_encode_der,
OCTET_STRING_decode_xer_utf8,
Expand Down
1 change: 0 additions & 1 deletion skeletons/GraphicString.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ asn_TYPE_operation_t asn_OP_GraphicString = {
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
OCTET_STRING_compare,
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
Expand Down
1 change: 0 additions & 1 deletion skeletons/IA5String.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ asn_TYPE_operation_t asn_OP_IA5String = {
OCTET_STRING_free,
OCTET_STRING_print_utf8, /* ASCII subset */
OCTET_STRING_compare,
IA5String_constraint, /* Constraint on the alphabet */
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
Expand Down
1 change: 0 additions & 1 deletion skeletons/INTEGER.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ asn_TYPE_operation_t asn_OP_INTEGER = {
INTEGER_free,
INTEGER_print,
INTEGER_compare,
asn_generic_no_constraint,
ber_decode_primitive,
INTEGER_encode_der,
INTEGER_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/ISO646String.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ asn_TYPE_operation_t asn_OP_ISO646String = {
OCTET_STRING_free,
OCTET_STRING_print_utf8, /* ASCII subset */
OCTET_STRING_compare,
VisibleString_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
Expand Down
1 change: 0 additions & 1 deletion skeletons/NULL.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ asn_TYPE_operation_t asn_OP_NULL = {
BOOLEAN_free,
NULL_print,
NULL_compare,
asn_generic_no_constraint,
BOOLEAN_decode_ber, /* Implemented in terms of BOOLEAN */
NULL_encode_der, /* Special handling of DER encoding */
NULL_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/NativeEnumerated.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ asn_TYPE_operation_t asn_OP_NativeEnumerated = {
NativeInteger_free,
NativeInteger_print,
NativeInteger_compare,
asn_generic_no_constraint,
NativeInteger_decode_ber,
NativeInteger_encode_der,
NativeInteger_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/NativeInteger.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ asn_TYPE_operation_t asn_OP_NativeInteger = {
NativeInteger_free,
NativeInteger_print,
NativeInteger_compare,
asn_generic_no_constraint,
NativeInteger_decode_ber,
NativeInteger_encode_der,
NativeInteger_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/NativeReal.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ asn_TYPE_operation_t asn_OP_NativeReal = {
NativeReal_free,
NativeReal_print,
NativeReal_compare,
asn_generic_no_constraint,
NativeReal_decode_ber,
NativeReal_encode_der,
NativeReal_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/NumericString.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ asn_TYPE_operation_t asn_OP_NumericString = {
OCTET_STRING_free,
OCTET_STRING_print_utf8, /* ASCII subset */
OCTET_STRING_compare,
NumericString_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
Expand Down
1 change: 0 additions & 1 deletion skeletons/OBJECT_IDENTIFIER.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ asn_TYPE_operation_t asn_OP_OBJECT_IDENTIFIER = {
ASN__PRIMITIVE_TYPE_free,
OBJECT_IDENTIFIER_print,
OCTET_STRING_compare, /* Implemented in terms of a string comparison */
OBJECT_IDENTIFIER_constraint,
ber_decode_primitive,
der_encode_primitive,
OBJECT_IDENTIFIER_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/OCTET_STRING.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ asn_TYPE_operation_t asn_OP_OCTET_STRING = {
OCTET_STRING_free,
OCTET_STRING_print, /* OCTET STRING generally means a non-ascii sequence */
OCTET_STRING_compare,
asn_generic_no_constraint,
OCTET_STRING_decode_ber,
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
Expand Down
1 change: 0 additions & 1 deletion skeletons/OPEN_TYPE.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ asn_TYPE_operation_t asn_OP_OPEN_TYPE = {
OPEN_TYPE_free,
OPEN_TYPE_print,
OPEN_TYPE_compare,
OPEN_TYPE_constraint,
OPEN_TYPE_decode_ber,
OPEN_TYPE_encode_der,
OPEN_TYPE_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/ObjectDescriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ asn_TYPE_operation_t asn_OP_ObjectDescriptor = {
OCTET_STRING_free,
OCTET_STRING_print_utf8, /* Treat as ASCII subset (it's not) */
OCTET_STRING_compare,
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
Expand Down
1 change: 0 additions & 1 deletion skeletons/PrintableString.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ asn_TYPE_operation_t asn_OP_PrintableString = {
OCTET_STRING_free,
OCTET_STRING_print_utf8, /* ASCII subset */
OCTET_STRING_compare,
PrintableString_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
Expand Down
1 change: 0 additions & 1 deletion skeletons/REAL.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ asn_TYPE_operation_t asn_OP_REAL = {
ASN__PRIMITIVE_TYPE_free,
REAL_print,
REAL_compare,
asn_generic_no_constraint,
ber_decode_primitive,
der_encode_primitive,
REAL_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/RELATIVE-OID.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ asn_TYPE_operation_t asn_OP_RELATIVE_OID = {
ASN__PRIMITIVE_TYPE_free,
RELATIVE_OID_print,
OCTET_STRING_compare, /* Implemented in terms of opaque comparison */
asn_generic_no_constraint,
ber_decode_primitive,
der_encode_primitive,
RELATIVE_OID_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/T61String.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ asn_TYPE_operation_t asn_OP_T61String = {
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
OCTET_STRING_compare,
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
Expand Down
1 change: 0 additions & 1 deletion skeletons/TeletexString.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ asn_TYPE_operation_t asn_OP_TeletexString = {
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
OCTET_STRING_compare,
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
Expand Down
1 change: 0 additions & 1 deletion skeletons/UTCTime.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ asn_TYPE_operation_t asn_OP_UTCTime = {
OCTET_STRING_free,
UTCTime_print,
OCTET_STRING_compare, /* Does not deal with time zones. */
UTCTime_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
OCTET_STRING_decode_xer_utf8,
Expand Down
1 change: 0 additions & 1 deletion skeletons/UTF8String.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ asn_TYPE_operation_t asn_OP_UTF8String = {
OCTET_STRING_free,
UTF8String_print,
OCTET_STRING_compare,
UTF8String_constraint, /* Check for invalid codes, etc. */
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
Expand Down
1 change: 0 additions & 1 deletion skeletons/UniversalString.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ asn_TYPE_operation_t asn_OP_UniversalString = {
OCTET_STRING_free,
UniversalString_print, /* Convert into UTF8 and print */
OCTET_STRING_compare,
UniversalString_constraint,
OCTET_STRING_decode_ber,
OCTET_STRING_encode_der,
UniversalString_decode_xer, /* Convert from UTF-8 */
Expand Down
1 change: 0 additions & 1 deletion skeletons/VideotexString.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ asn_TYPE_operation_t asn_OP_VideotexString = {
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
OCTET_STRING_compare,
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
Expand Down
1 change: 0 additions & 1 deletion skeletons/VisibleString.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ asn_TYPE_operation_t asn_OP_VisibleString = {
OCTET_STRING_free,
OCTET_STRING_print_utf8, /* ASCII subset */
OCTET_STRING_compare,
VisibleString_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
Expand Down
1 change: 0 additions & 1 deletion skeletons/constr_CHOICE.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,6 @@ asn_TYPE_operation_t asn_OP_CHOICE = {
CHOICE_free,
CHOICE_print,
CHOICE_compare,
CHOICE_constraint,
CHOICE_decode_ber,
CHOICE_encode_der,
CHOICE_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/constr_SEQUENCE.c
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,6 @@ asn_TYPE_operation_t asn_OP_SEQUENCE = {
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_compare,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/constr_SEQUENCE_OF.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ asn_TYPE_operation_t asn_OP_SEQUENCE_OF = {
SEQUENCE_OF_free,
SEQUENCE_OF_print,
SEQUENCE_OF_compare,
SEQUENCE_OF_constraint,
SEQUENCE_OF_decode_ber,
SEQUENCE_OF_encode_der,
SEQUENCE_OF_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/constr_SET.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,6 @@ asn_TYPE_operation_t asn_OP_SET = {
SET_free,
SET_print,
SET_compare,
SET_constraint,
SET_decode_ber,
SET_encode_der,
SET_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/constr_SET_OF.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,6 @@ asn_TYPE_operation_t asn_OP_SET_OF = {
SET_OF_free,
SET_OF_print,
SET_OF_compare,
SET_OF_constraint,
SET_OF_decode_ber,
SET_OF_encode_der,
SET_OF_decode_xer,
Expand Down
1 change: 0 additions & 1 deletion skeletons/constr_TYPE.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ typedef struct asn_TYPE_operation_s {
asn_struct_free_f *free_struct; /* Free the structure */
asn_struct_print_f *print_struct; /* Human readable output */
asn_struct_compare_f *compare_struct; /* Compare two structures */
asn_constr_check_f *check_constraints; /* Constraints validator */
ber_type_decoder_f *ber_decoder; /* Generic BER decoder */
der_type_encoder_f *der_encoder; /* Canonical DER encoder */
xer_type_decoder_f *xer_decoder; /* Generic XER decoder */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ T_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
}

/* Replace with underlying type checker */
return td->op->check_constraints(td, sptr, ctfailcb, app_key);
return td->check_constraints(td, sptr, ctfailcb, app_key);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions tests/tests-asn1c-compiler/42-real-life-OK.asn1.-PR
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ memb_varsets_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,

if((size >= 1)) {
/* Perform validation of the inner elements */
return td->op->check_constraints(td, sptr, ctfailcb, app_key);
return td->check_constraints(td, sptr, ctfailcb, app_key);
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
Expand Down Expand Up @@ -405,7 +405,7 @@ memb_vset_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,

if((size >= 1)) {
/* Perform validation of the inner elements */
return td->op->check_constraints(td, sptr, ctfailcb, app_key);
return td->check_constraints(td, sptr, ctfailcb, app_key);
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
Expand Down
2 changes: 1 addition & 1 deletion tests/tests-asn1c-compiler/90-cond-int-type-OK.asn1.-P
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
}

/* Replace with underlying type checker */
return td->op->check_constraints(td, sptr, ctfailcb, app_key);
return td->check_constraints(td, sptr, ctfailcb, app_key);
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
}

/* Replace with underlying type checker */
return td->op->check_constraints(td, sptr, ctfailcb, app_key);
return td->check_constraints(td, sptr, ctfailcb, app_key);
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
}

/* Replace with underlying type checker */
return td->op->check_constraints(td, sptr, ctfailcb, app_key);
return td->check_constraints(td, sptr, ctfailcb, app_key);
}

/*
Expand Down
Loading

0 comments on commit 154519a

Please sign in to comment.