[Date Prev][Date Next] [Chronological] [Thread] [Top]

int vs long in ldapext-ldap-c-api-01



There are a number of places in the draft uses 'int' instead of a
sized data type, including:
	ber_printf 'i' format character, p49
	ber_scanf 'i' format character, p53.

I believe the encoding/decoding examples would fail on platforms
where sizeof(int) < 4.  

I would recommend requiring implementations to define the
following types:
	typedef unsigned impl_int4 LDAP_UINT4  /* unsigned four octet integer */
	typedef signed impl_int4 LDAP_SINT4    /* signed four octet integer */

(where impl_int4 would be replaced by the implementation with the
appropriate platform specific type)  AND that these two types be
used throughout the API where 4 octet integers are required
by the underlying protocol.

I would not recommend using 'long' as a substitute for appropriately
sized typed.  'long' is often too long (impacts performance).

Kurt