From c787ae8b85f3f0a272cf306b6e35c3c601d1d5cd Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 3 Apr 2001 19:17:05 +0000 Subject: [PATCH] updates. --- CHANGES | 6 +++++ TODO | 10 ------- acconfig.h | 8 ++++++ apps/silc/clientconfig.c | 2 +- configure.in.pre | 13 ++++++++++ includes/silcincludes.h | 56 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 84 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index 7976d137..6f092368 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Tue Apr 3 21:52:42 EEST 2001 Pekka Riikonen + + * Defined uint8, int8, uint16, int16, uint32, int32, uint64 and + int64 of at least the xintXX size. If void * is less that 4 + bytes uint32 * will be used. Defined bool as boolean. + Tue Apr 3 16:39:19 EEST 2001 Pekka Riikonen * Implemented the sending of the SERVER_SIGNOFF notify in the diff --git a/TODO b/TODO index f0871b35..f69b4ef6 100644 --- a/TODO +++ b/TODO @@ -1,13 +1,3 @@ -TODO General -============ - - o We should replace all short, int, long, unsigned short, unsigned int, - unsigned long with some pre-defined datatypes that really are what - we want on all platforms. int16, uint16, int32, uint32 etc. are - what we could use or maybe SilcInt16, SilcUInt16 etc. Also, boolean - datatype should be defined. - - TODO/bugs In SILC Client Library ================================ diff --git a/acconfig.h b/acconfig.h index 17c67b0e..76a52fb3 100644 --- a/acconfig.h +++ b/acconfig.h @@ -15,6 +15,14 @@ #undef HAVE_RTLD_NOW #undef HAVE_RTLD_LAZY +/* Types */ +#undef SILC_SIZEOF_LONG_LONG +#undef SILC_SIZEOF_LONG +#undef SILC_SIZEOF_INT +#undef SILC_SIZEOF_SHORT +#undef SILC_SIZEOF_CHAR +#undef SILC_SIZEOF_VOID_P + /* Redefs for SOCKS5 library */ #undef SOCKS #undef SOCKS5 diff --git a/apps/silc/clientconfig.c b/apps/silc/clientconfig.c index ed7e4b7a..6834ddb3 100644 --- a/apps/silc/clientconfig.c +++ b/apps/silc/clientconfig.c @@ -97,7 +97,7 @@ int silc_client_config_parse(SilcClientConfig config, SilcBuffer buffer, SilcClientConfigParse *return_config) { int i, begin; - unsigned int linenum; + int linenum; char line[1024], *cp; SilcClientConfigSection *cptr = NULL; SilcClientConfigParse parse = *return_config, first = NULL; diff --git a/configure.in.pre b/configure.in.pre index f8d93555..ef6b11a0 100644 --- a/configure.in.pre +++ b/configure.in.pre @@ -80,6 +80,19 @@ AC_TYPE_MODE_T AC_TYPE_UID_T AC_TYPE_PID_T +AC_CHECK_SIZEOF(long long, 0) +AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long) +AC_CHECK_SIZEOF(long, 0) +AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG, $ac_cv_sizeof_long) +AC_CHECK_SIZEOF(int, 0) +AC_DEFINE_UNQUOTED(SILC_SIZEOF_INT, $ac_cv_sizeof_int) +AC_CHECK_SIZEOF(short, 0) +AC_DEFINE_UNQUOTED(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short) +AC_CHECK_SIZEOF(char, 0) +AC_DEFINE_UNQUOTED(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char) +AC_CHECK_SIZEOF(void *, 0) +AC_DEFINE_UNQUOTED(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p) + # Function checking AC_CHECK_FUNCS(chmod stat fstat getenv putenv strerror ctime gettimeofday) AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid) diff --git a/includes/silcincludes.h b/includes/silcincludes.h index 09da825b..224525d5 100644 --- a/includes/silcincludes.h +++ b/includes/silcincludes.h @@ -128,6 +128,62 @@ #define FALSE 0 #endif +/* Define types. The types must be at least of the specified size */ +#undef uint8 +#undef uint16 +#undef uint32 +#undef uin64 +#undef int8 +#undef int16 +#undef int32 +#undef int64 + +typedef unsigned char uint8; +typedef signed char int8; + +#if SILC_SIZEOF_SHORT > 2 +#error "size of the short must be 2 bytes" +#endif + +typedef unsigned short uint16; +typedef signed short int16; + +#if SILC_SIZEOF_LONG == 4 +typedef unsigned long uint32; +typedef signed long int32; +#else +#if SILC_SIZEOF_INT == 4 +typedef unsigned long uint32; +typedef signed long int32; +#else +#if SILC_SIZEOF_LONG_LONG >= 4 +typedef unsigned long long uint32; +typedef signed long long int32; +#endif +#endif +#endif + +#if SILC_SIZEOF_LONG >= 8 +typedef unsigned long uint64; +typedef signed long int64; +#else +#if SILC_SIZEOF_LONG_LONG >= 8 +typedef unsigned long long uint64; +typedef signed long long int64; +#else +typedef uint32 uint64; +typedef int32 int64; +#endif +#endif + +#if SILC_SIZEOF_VOID_P < 4 +typedef uint32 * void *; +#endif + +#ifndef bool +#define bool unsigned char +#endif + /* Generic global SILC includes */ #include "bitmove.h" -- 2.43.0