--On Sunday, August 11, 2002 6:31 PM +0200 Stipe Tolj 
<[EMAIL PROTECTED]> wrote:
> BTW, we should not #define constants of SMPP that are explicitely
> 'defined' by the .def file anyway. So the 21 length for source and
> destination number is already a #define in this semantical way and
> hence we should *not* use #defined things in .def again.

Hm, I am not so in favour of doing length definitions this hardcoded
way. But it seems, that many thing get all the time done via
MACROs and depending on the use the marco results in different code.

This is more coding style, I guess.

> RCS file: /home/cvs/gateway/gw/smsc/smpp_pdu.c,v
> retrieving revision 1.1
> diff -r1.1 smpp_pdu.c
> 136,138c136,147
> <             gw_assert(octstr_len(p->name) < max_octets); \
> <     if (p->name != NULL) octstr_append(os, p->name); \
> <     octstr_append_char(os, '\0');
> ---
>>         if (p->name != NULL) { \
>>             if (octstr_len(p->name) >= max_octets) { \
>>                 warning(0, "SMPP: PDU element <%s> to long " \
>>                         "(length is %d, should be %d)", \
>>                         # name, octstr_len(p->name), max_octets); \
>>                 temp = octstr_copy(p->name, 0, max_octets-1); \
>>             } else \
>>                 temp = octstr_duplicate(p->name); \
>>             octstr_append(os, temp); \
>>             octstr_destroy(temp); \
>>         } \
>>         octstr_append_char(os, '\0');

This also means that you ignore the address part which goes beyond the
maximum length. Somehow, this feels not right, or do I miss something??




Harrie

Internet Management Consulting
mailto: [EMAIL PROTECTED]                   http://www.lisanza.net/
--------------------------------------------------------------------
Author of MOD-SNMP, enabling SNMP management the Apache HTTP server

Reply via email to