From 06e4c858a0bfc1acb4ce51687e7bf2aecdd3c264 Mon Sep 17 00:00:00 2001 From: Jon Ringle Date: Fri, 1 Dec 2017 00:41:09 -0500 Subject: [PATCH] BNER: Make OCTET_STRING_print a weak function This will allow a bacnet library to override this function and be able to pretty print the BNER primitives: Double CharacterString Date Time BACnetObjectIdentifier --- skeletons/OCTET_STRING.c | 10 ++++++++-- skeletons/OCTET_STRING.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c index cb5029f86..fd9441116 100644 --- a/skeletons/OCTET_STRING.c +++ b/skeletons/OCTET_STRING.c @@ -1653,8 +1653,8 @@ OCTET_STRING_encode_uper(const asn_TYPE_descriptor_t *td, #endif /* ASN_DISABLE_PER_SUPPORT */ int -OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +OCTET_STRING_print_impl(const asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const char * const h2c = "0123456789ABCDEF"; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; char scratch[16 * 3 + 4]; @@ -1694,6 +1694,12 @@ OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr, return 0; } +__attribute__((weak)) int +OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + return OCTET_STRING_print_impl(td, sptr, ilevel, cb, app_key); +} + int OCTET_STRING_print_utf8(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, diff --git a/skeletons/OCTET_STRING.h b/skeletons/OCTET_STRING.h index e07a1d842..1ccd2d9db 100644 --- a/skeletons/OCTET_STRING.h +++ b/skeletons/OCTET_STRING.h @@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_OCTET_STRING; asn_struct_free_f OCTET_STRING_free; asn_struct_print_f OCTET_STRING_print; +asn_struct_print_f OCTET_STRING_print_impl; asn_struct_print_f OCTET_STRING_print_utf8; asn_struct_compare_f OCTET_STRING_compare; ber_type_decoder_f OCTET_STRING_decode_ber;