Commit 3490c5d8 authored by Pekka Pessi's avatar Pekka Pessi

su_configure.h.in, sac-su2.m4: added compatibility types for size parameters.

Sofia-SIP 1.12 API passes size in int or unsigned int in numerous places.
Now use typedes isize_t (used instead of int), usize_t (used instead of
unsigned) and issize_t (used instead of int when returning signed size).

With --disable-size-compat, make API to use size_t or ssize_t instead of
int/unsigned int.

win32/sofia-sip/su_configure.h: define suitable values for isize_t, usize_t
and issize_t.

darcs-hash:20060906224131-65a35-78c83038c5adaa9e7a9a2905c6086b372e8017fc.gz
parent 1d5116ac
......@@ -93,6 +93,30 @@
#define SU_S8_C(i) (SU_S8_T)(i)
#define SU_U8_C(i) (SU_U8_T)(i ## U)
/** Define this as ssize_t. */
#undef SOFIA_SSIZE_T
/** Define this as size_t
(int when compatible with sofia-sip-ua 1.12.0 binaries). */
#undef SOFIA_ISIZE_T
/** Maximum value of isize_t */
#undef ISIZE_MAX
/** Define this as ssize_t
(int when compatible with sofia-sip-ua 1.12.0 binaries). */
#undef SOFIA_ISSIZE_T
/** Maximum value of issize_t */
#undef ISSIZE_MAX
/** Define this as size_t
(unsigned int when compatible with sofia-sip-ua 1.12.0 binaries). */
#undef SOFIA_USIZE_T
/** Maximum value of usize_t */
#undef USIZE_MAX
/**On Solaris define this in order to get POSIX extensions. */
#undef __EXTENSIONS__
......
......@@ -71,6 +71,10 @@ SOFIA_BEGIN_DECLS
#ifndef _INTPTR_T_DEFINED
typedef SU_INTPTR_T intptr_t;
#endif
#ifndef _UINTPTR_T_DEFINED
typedef unsigned SU_INTPTR_T uintptr_t;
#endif
/** 64-bit unsigned integer */
typedef SU_U64_T uint64_t;
/** 64-bit signed integer */
......@@ -100,6 +104,31 @@ typedef SU_LEAST8_T int_least8_t;
#error "no integer types available."
#endif
/* ---------------------------------------------------------------------- */
/* size_t types for binary compatibility */
#ifdef SOFIA_SSIZE_T
typedef SOFIA_SSIZE_T ssize_t;
#endif
#ifdef SOFIA_ISIZE_T
typedef SOFIA_ISIZE_T isize_t;
#else
typedef size_t isize_t;
#endif
#ifdef SOFIA_ISSIZE_T
typedef SOFIA_ISSIZE_T issize_t;
#else
typedef ssize_t issize_t;
#endif
#ifdef SOFIA_USIZE_T
typedef SOFIA_USIZE_T usize_t;
#else
typedef size_t usize_t;
#endif
SOFIA_END_DECLS
#endif /* SU_TYPES_H */
......@@ -91,6 +91,26 @@ case "$ac_cv_c_inline" in
;;
esac
AC_ARG_ENABLE(size-compat,
[ --disable-size-compat use compatibility size_t types (enabled)],
, enable_size_compat=yes)
if test X$enable_size_compat != Xyes; then
SAC_SU_DEFINE(SOFIA_ISIZE_T, size_t)dnl
SAC_SU_DEFINE(ISIZE_MAX, SIZE_MAX)dnl
SAC_SU_DEFINE(SOFIA_ISSIZE_T, ssize_t)dnl
SAC_SU_DEFINE(ISSIZE_MAX, SSIZE_MAX)dnl
SAC_SU_DEFINE(SOFIA_USIZE_T, size_t)dnl
SAC_SU_DEFINE(USIZE_MAX, SIZE_MAX)dnl
else
SAC_SU_DEFINE(SOFIA_ISIZE_T, int)dnl
SAC_SU_DEFINE(ISIZE_MAX, INT_MAX)dnl
SAC_SU_DEFINE(SOFIA_ISSIZE_T, int)dnl
SAC_SU_DEFINE(ISSIZE_MAX, INT_MAX)dnl
SAC_SU_DEFINE(SOFIA_USIZE_T, unsigned)dnl
SAC_SU_DEFINE(USIZE_MAX, UINT_MAX)dnl
fi
AC_REQUIRE([AC_SYS_SA_LEN])
if test "$ac_cv_sa_len" = yes ;then
SAC_SU_DEFINE([SU_HAVE_SOCKADDR_SA_LEN], 1,
......
......@@ -65,7 +65,8 @@
#define su_inline static __inline
#define SU_HAVE_INLINE (1)
#define SU_INTPTR_T unsigned __int32
#define SU_INTPTR_T size_t
#define SU_S64_T __int64
#define SU_U64_T unsigned __int64
#define SU_S32_T __int32
......@@ -105,4 +106,19 @@
#define srandom(x) srand((x))
#define random() rand()
#define ssize_t SSIZE_T
#ifdef _WIN64
#define SOFIA_ISIZE_T size_t
#define SOFIA_ISSIZE_T ssize_t
#define SOFIA_USIZE_T size_t
#define ISIZE_MAX SIZE_MAX
#define ISSIZE_MAX SSIZE_MAX
#define USIZE_MAX USIZE_MAX
#else
#define SOFIA_ISIZE_T int
#define SOFIA_ISSIZE_T int
#define SOFIA_USIZE_T unsigned
#define SOFIA_SSIZE_T long
#define ISIZE_MAX INT_MAX
#define ISSIZE_MAX INT_MAX
#define USIZE_MAX UINT_MAX
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment