Thanks, will change before pushing. I will push this patch on Friday if there are no more comments?
> On 20 Jul 2016, at 7:34 PM, Anders Widell <anders.wid...@ericsson.com> wrote: > > Ack with minor comments: > > 1) In the short line commit message: change "libs/core:" to "base:" > 2) The scope of the variable "int i" in osaf_encode_sanamet() can be reduced > (i.e. move it into the two for-loops: for (int i = ...). > > thanks, > Anders Widell > > On 07/19/2016 03:34 AM, Gary Lee wrote: >> osaf/libs/core/include/ncsencdec_pub.h | 1 - >> osaf/libs/core/leap/hj_enc.c | 55 >> ++++++++++++--------------------- >> 2 files changed, 21 insertions(+), 35 deletions(-) >> >> >> modify osaf_encode_sanamet() so it does not assume the SaNameT varable being >> encoded >> is null terminated >> >> diff --git a/osaf/libs/core/include/ncsencdec_pub.h >> b/osaf/libs/core/include/ncsencdec_pub.h >> --- a/osaf/libs/core/include/ncsencdec_pub.h >> +++ b/osaf/libs/core/include/ncsencdec_pub.h >> @@ -153,7 +153,6 @@ void osaf_encode_uint64(NCS_UBAID *ub, u >> void osaf_decode_uint64(NCS_UBAID *ub, uint64_t *to); >> void osaf_encode_sanamet(NCS_UBAID *ub, const SaNameT *name); >> void osaf_decode_sanamet(NCS_UBAID *ub, SaNameT *name); >> -void osaf_encode_sanamet_o2(NCS_UBAID *ub, SaConstStringT name); >> void osaf_encode_saconststring(NCS_UBAID *ub, SaConstStringT str); >> void osaf_encode_satimet(NCS_UBAID *ub, SaTimeT time); >> void osaf_decode_satimet(NCS_UBAID *ub, SaTimeT *time); >> diff --git a/osaf/libs/core/leap/hj_enc.c b/osaf/libs/core/leap/hj_enc.c >> --- a/osaf/libs/core/leap/hj_enc.c >> +++ b/osaf/libs/core/leap/hj_enc.c >> @@ -378,13 +378,29 @@ void osaf_decode_uint64(NCS_UBAID *ub, u >> void osaf_encode_sanamet(NCS_UBAID *ub, const SaNameT *name) >> { >> - TRACE_ENTER(); >> + int i; >> + const size_t len = osaf_extended_name_length(name); >> + SaConstStringT str = osaf_extended_name_borrow(name); >> - SaConstStringT str = osaf_extended_name_borrow(name); >> - TRACE("str %s (%zu)", str, osaf_extended_name_length(name)); >> - osaf_encode_sanamet_o2(ub, str); >> + if (len < SA_MAX_UNEXTENDED_NAME_LENGTH) { >> + // encode a fixed 256 char string, to ensure >> + // we are backwards compatible >> + osaf_encode_uint16(ub, len); >> - TRACE_LEAVE(); >> + for (i = 0; i < len; i++) { >> + osaf_encode_uint8(ub, str[i]); >> + } >> + >> + // need to encode SA_MAX_UNEXTENDED_NAME_LENGTH characters to >> remain >> + // compatible with legacy osaf_decode_sanamet() [without long >> DN support] >> + for (i = len; i < SA_MAX_UNEXTENDED_NAME_LENGTH; i++) { >> + osaf_encode_uint8(ub, 0); >> + } >> + } else { >> + // encode as a variable string >> + SaConstStringT str = osaf_extended_name_borrow(name); >> + osaf_encode_saconststring(ub, str); >> + } >> } >> void osaf_decode_sanamet(NCS_UBAID *ub, SaNameT *name) >> @@ -443,35 +459,6 @@ void osaf_decode_saclmnodeaddresst(NCS_U >> } >> } >> -void osaf_encode_sanamet_o2(NCS_UBAID *ub, SaConstStringT name) >> -{ >> - TRACE_ENTER(); >> - >> - int i; >> - const size_t len = strlen(name); >> - >> - if (len < SA_MAX_UNEXTENDED_NAME_LENGTH) { >> - // encode a fixed 256 char string, to ensure >> - // we are backwards compatible >> - osaf_encode_uint16(ub, len); >> - >> - for (i = 0; i < len; i++) { >> - osaf_encode_uint8(ub, name[i]); >> - } >> - >> - // need to encode SA_MAX_UNEXTENDED_NAME_LENGTH characters to >> remain >> - // compatible with legacy osaf_decode_sanamet() [without long >> DN support] >> - for (i = len; i < SA_MAX_UNEXTENDED_NAME_LENGTH; i++) { >> - osaf_encode_uint8(ub, 0); >> - } >> - } else { >> - // encode as a variable string >> - osaf_encode_saconststring(ub, name); >> - } >> - >> - TRACE_LEAVE(); >> -} >> - >> void osaf_encode_saconststring(NCS_UBAID *ub, SaConstStringT str) >> { >> size_t len = strlen(str); > ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel