Skip to content

Commit

Permalink
BNER: Make OCTET_STRING_print a weak function
Browse files Browse the repository at this point in the history
This will allow a bacnet library to override this function and be able to
pretty print the BNER primitives:
  Double
  CharacterString
  Date
  Time
  BACnetObjectIdentifier
  • Loading branch information
ringlej committed Dec 1, 2017
1 parent caf37bc commit 2788662
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions skeletons/OCTET_STRING.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ OS__add_stack_el(struct _stack *st) {
nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el));
if(nel == NULL)
return NULL;

if(st->tail) {
/* Increase a subcontainment depth */
nel->cont_level = st->tail->cont_level + 1;
Expand Down Expand Up @@ -748,7 +748,7 @@ OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size
return 0;
}
}

return -1; /* No, it's not */
}

Expand Down Expand Up @@ -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(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];
Expand Down Expand Up @@ -1693,6 +1693,7 @@ OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr,

return 0;
}
CC_WEAK_ALIAS(__OCTET_STRING_print, OCTET_STRING_print);

int
OCTET_STRING_print_utf8(const asn_TYPE_descriptor_t *td, const void *sptr,
Expand Down
1 change: 1 addition & 0 deletions skeletons/OCTET_STRING.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING;
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;
asn_struct_print_f OCTET_STRING_print_utf8;
asn_struct_compare_f OCTET_STRING_compare;
Expand Down

0 comments on commit 2788662

Please sign in to comment.