From ca0e9bd20df27bb62875130a0db513256c92e75a Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sat, 22 Jul 2006 13:42:56 +0000 Subject: Changed all public header files to compile correctly when -ansi and -pedantic is used, also when g++ is used git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@622 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/include/pj/compat/cc_gcc.h | 16 ++++++++++++---- pjlib/include/pj/ctype.h | 2 +- pjlib/include/pj/file_io.h | 4 ++-- pjlib/include/pj/ioqueue.h | 2 +- pjlib/include/pj/log.h | 4 ++-- pjlib/include/pj/os.h | 26 +++++++++++++------------- pjlib/include/pj/pool.h | 4 ++-- pjlib/include/pj/sock.h | 6 +++--- pjlib/include/pj/types.h | 12 ++++++------ 9 files changed, 42 insertions(+), 34 deletions(-) (limited to 'pjlib') diff --git a/pjlib/include/pj/compat/cc_gcc.h b/pjlib/include/pj/compat/cc_gcc.h index 46b6afc0..1cbc3534 100644 --- a/pjlib/include/pj/compat/cc_gcc.h +++ b/pjlib/include/pj/compat/cc_gcc.h @@ -34,15 +34,23 @@ #define PJ_CC_VER_3 __GNUC_PATCHLEVEL__ -#define PJ_INLINE_SPECIFIER static inline #define PJ_THREAD_FUNC #define PJ_NORETURN -#define PJ_ATTR_NORETURN __attribute__ ((noreturn)) #define PJ_HAS_INT64 1 -typedef long long pj_int64_t; -typedef unsigned long long pj_uint64_t; +#ifdef __STRICT_ANSI__ + #include + typedef int64_t pj_int64_t; + typedef uint64_t pj_uint64_t; + #define PJ_INLINE_SPECIFIER static __inline + #define PJ_ATTR_NORETURN +#else + typedef long long pj_int64_t; + typedef unsigned long long pj_uint64_t; + #define PJ_INLINE_SPECIFIER static inline + #define PJ_ATTR_NORETURN __attribute__ ((noreturn)) +#endif #define PJ_INT64(val) val##LL #define PJ_UINT64(val) val##LLU diff --git a/pjlib/include/pj/ctype.h b/pjlib/include/pj/ctype.h index 0319cfdb..6b8df9f5 100644 --- a/pjlib/include/pj/ctype.h +++ b/pjlib/include/pj/ctype.h @@ -62,7 +62,7 @@ PJ_INLINE(int) pj_isalpha(int c) { return isalpha(c); } * @return Non-zero value if c is a particular representation of * an ASCII character. */ -PJ_INLINE(int) pj_isascii(int c) { return isascii(c); } +PJ_INLINE(int) pj_isascii(int c) { return c<128 && c>=0; } /** * Returns a non-zero value if c is a particular representation of diff --git a/pjlib/include/pj/file_io.h b/pjlib/include/pj/file_io.h index ea0e207c..d71ac55d 100644 --- a/pjlib/include/pj/file_io.h +++ b/pjlib/include/pj/file_io.h @@ -61,7 +61,7 @@ enum pj_file_access PJ_O_WRONLY = 0x1102, /**< Open file for writing. */ PJ_O_RDWR = 0x1103, /**< Open file for reading and writing. File will be truncated. */ - PJ_O_APPEND = 0x1108, /**< Append to existing file. */ + PJ_O_APPEND = 0x1108 /**< Append to existing file. */ }; /** @@ -71,7 +71,7 @@ enum pj_file_seek_type { PJ_SEEK_SET = 0x1201, /**< Offset from beginning of the file. */ PJ_SEEK_CUR = 0x1202, /**< Offset from current position. */ - PJ_SEEK_END = 0x1203, /**< Size of the file plus offset. */ + PJ_SEEK_END = 0x1203 /**< Size of the file plus offset. */ }; /** diff --git a/pjlib/include/pj/ioqueue.h b/pjlib/include/pj/ioqueue.h index 62bca309..0f77f6f6 100644 --- a/pjlib/include/pj/ioqueue.h +++ b/pjlib/include/pj/ioqueue.h @@ -219,7 +219,7 @@ typedef enum pj_ioqueue_operation_e PJ_IOQUEUE_OP_SEND_TO = 32, /**< sendto() operation. */ #if defined(PJ_HAS_TCP) && PJ_HAS_TCP != 0 PJ_IOQUEUE_OP_ACCEPT = 64, /**< accept() operation. */ - PJ_IOQUEUE_OP_CONNECT = 128, /**< connect() operation. */ + PJ_IOQUEUE_OP_CONNECT = 128 /**< connect() operation. */ #endif /* PJ_HAS_TCP */ } pj_ioqueue_operation_e; diff --git a/pjlib/include/pj/log.h b/pjlib/include/pj/log.h index eeb90006..48ac8d3f 100644 --- a/pjlib/include/pj/log.h +++ b/pjlib/include/pj/log.h @@ -77,7 +77,7 @@ enum pj_log_decoration PJ_LOG_HAS_MICRO_SEC = 32, /**< Include microseconds [yes] */ PJ_LOG_HAS_SENDER = 64, /**< Include sender in the log [yes]. */ PJ_LOG_HAS_NEWLINE = 128, /**< Terminate each call with newline [yes].*/ - PJ_LOG_HAS_CR = 256, /**< Include carriage return [no]. */ + PJ_LOG_HAS_CR = 256 /**< Include carriage return [no]. */ }; /** @@ -249,7 +249,7 @@ PJ_DECL(unsigned) pj_log_get_decor(void); * @} */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /* * Log functions implementation prototypes. * These functions are called by PJ_LOG macros according to verbosity diff --git a/pjlib/include/pj/os.h b/pjlib/include/pj/os.h index 2a57ab87..e87d5ad6 100644 --- a/pjlib/include/pj/os.h +++ b/pjlib/include/pj/os.h @@ -33,7 +33,7 @@ PJ_BEGIN_DECL */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @defgroup PJ_THREAD Threads * @ingroup PJ_OS @@ -226,7 +226,7 @@ PJ_DECL(pj_status_t) pj_thread_get_stack_info(pj_thread_t *thread, * @} */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @defgroup PJ_TLS Thread Local Storage. * @ingroup PJ_OS @@ -271,7 +271,7 @@ PJ_DECL(void*) pj_thread_local_get(long index); */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @defgroup PJ_ATOMIC Atomic Variables * @ingroup PJ_OS @@ -382,7 +382,7 @@ PJ_DECL(pj_atomic_value_t) pj_atomic_add_and_get( pj_atomic_t *atomic_var, * @} */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @defgroup PJ_MUTEX Mutexes. * @ingroup PJ_OS @@ -403,7 +403,7 @@ typedef enum pj_mutex_type_e { PJ_MUTEX_DEFAULT, PJ_MUTEX_SIMPLE, - PJ_MUTEX_RECURSE, + PJ_MUTEX_RECURSE } pj_mutex_type_e; @@ -500,7 +500,7 @@ PJ_DECL(pj_status_t) pj_mutex_destroy(pj_mutex_t *mutex); * @} */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @defgroup PJ_RW_MUTEX Reader/Writer Mutex * @ingroup PJ_OS @@ -576,7 +576,7 @@ PJ_DECL(pj_status_t) pj_rwmutex_destroy(pj_rwmutex_t *mutex); */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @defgroup PJ_CRIT_SEC Critical sections. * @ingroup PJ_OS @@ -610,7 +610,7 @@ PJ_DECL(void) pj_leave_critical_section(void); * @} */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ #if defined(PJ_HAS_SEMAPHORE) && PJ_HAS_SEMAPHORE != 0 /** * @defgroup PJ_SEM Semaphores. @@ -679,7 +679,7 @@ PJ_DECL(pj_status_t) pj_sem_destroy(pj_sem_t *sem); #endif /* PJ_HAS_SEMAPHORE */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ #if defined(PJ_HAS_EVENT_OBJ) && PJ_HAS_EVENT_OBJ != 0 /** * @defgroup PJ_EVENT Event Object. @@ -771,7 +771,7 @@ PJ_DECL(pj_status_t) pj_event_destroy(pj_event_t *event); */ #endif /* PJ_HAS_EVENT_OBJ */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @addtogroup PJ_TIME Time Data Type and Manipulation. * @ingroup PJ_OS @@ -836,7 +836,7 @@ PJ_DECL(pj_status_t) pj_time_gmt_to_local(pj_time_val *tv); * @} */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ #if defined(PJ_TERM_HAS_COLOR) && PJ_TERM_HAS_COLOR != 0 /** @@ -867,7 +867,7 @@ PJ_DECL(pj_color_t) pj_term_get_color(void); #endif /* PJ_TERM_HAS_COLOR */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @defgroup PJ_TIMESTAMP High Resolution Timestamp * @ingroup PJ_OS @@ -1046,7 +1046,7 @@ PJ_DECL(pj_uint32_t) pj_elapsed_cycle( const pj_timestamp *start, /** @} */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * Internal PJLIB function to initialize the threading subsystem. * @return PJ_SUCCESS or the appropriate error code. diff --git a/pjlib/include/pj/pool.h b/pjlib/include/pj/pool.h index 7f7fd2b3..34076099 100644 --- a/pjlib/include/pj/pool.h +++ b/pjlib/include/pj/pool.h @@ -312,7 +312,7 @@ PJ_IDECL(void*) pj_pool_calloc( pj_pool_t *pool, pj_size_t count, * @} // PJ_POOL */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @defgroup PJ_POOL_FACTORY Pool Factory and Policy. * @ingroup PJ_POOL_GROUP @@ -526,7 +526,7 @@ PJ_INLINE(void) pj_pool_factory_dump( pj_pool_factory *pf, * @} // PJ_POOL_FACTORY */ -/////////////////////////////////////////////////////////////////////////////// +/* **************************************************************************/ /** * @defgroup PJ_CACHING_POOL Caching Pool Factory. diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h index b5a9dcf5..a6e760aa 100644 --- a/pjlib/include/pj/sock.h +++ b/pjlib/include/pj/sock.h @@ -109,7 +109,7 @@ typedef enum pj_sock_msg_flag { PJ_MSG_OOB = 0x01, /**< Out-of-band messages. */ PJ_MSG_PEEK = 0x02, /**< Peek, don't remove from buffer. */ - PJ_MSG_DONTROUTE = 0x04, /**< Don't route. */ + PJ_MSG_DONTROUTE = 0x04 /**< Don't route. */ } pj_sock_msg_flag; @@ -123,7 +123,7 @@ typedef enum pj_socket_sd_type PJ_SD_SEND = 1, /**< No more sending. */ PJ_SHUT_WR = 1, /**< Alias for SD_SEND. */ PJ_SD_BOTH = 2, /**< No more send and receive. */ - PJ_SHUT_RDWR = 2, /**< Alias for SD_BOTH. */ + PJ_SHUT_RDWR = 2 /**< Alias for SD_BOTH. */ } pj_socket_sd_type; @@ -379,7 +379,7 @@ PJ_INLINE(pj_in_addr) pj_sockaddr_in_get_addr(const pj_sockaddr_in *addr) pj_in_addr in_addr; in_addr.s_addr = pj_ntohl(addr->sin_addr.s_addr); return in_addr; -}; +} /** * Set the IP address of an Internet socket address. diff --git a/pjlib/include/pj/types.h b/pjlib/include/pj/types.h index 5a275514..cae418af 100644 --- a/pjlib/include/pj/types.h +++ b/pjlib/include/pj/types.h @@ -36,7 +36,7 @@ PJ_BEGIN_DECL -/////////////////////////////////////////////////////////////////////////////// +/* ************************************************************************* */ /** Unsigned 32bit integer. */ typedef int pj_int32_t; @@ -103,7 +103,7 @@ typedef pj_int64_t pj_off_t; typedef pj_ssize_t pj_off_t; #endif -/////////////////////////////////////////////////////////////////////////////// +/* ************************************************************************* */ /* * Data structure types. */ @@ -230,7 +230,7 @@ typedef struct pj_atomic_t pj_atomic_t; */ typedef PJ_ATOMIC_VALUE_TYPE pj_atomic_value_t; -/////////////////////////////////////////////////////////////////////////////// +/* ************************************************************************* */ /** Thread handle. */ typedef struct pj_thread_t pj_thread_t; @@ -268,7 +268,7 @@ typedef unsigned int pj_color_t; /** Exception id. */ typedef int pj_exception_id_t; -/////////////////////////////////////////////////////////////////////////////// +/* ************************************************************************* */ /** Utility macro to compute the number of elements in static array. */ #define PJ_ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) @@ -281,7 +281,7 @@ typedef int pj_exception_id_t; */ #define PJ_MAX_OBJ_NAME 16 -/////////////////////////////////////////////////////////////////////////////// +/* ************************************************************************* */ /* * General. */ @@ -497,7 +497,7 @@ typedef struct pj_parsed_time * @} // Time Management */ -/////////////////////////////////////////////////////////////////////////////// +/* ************************************************************************* */ /* * Terminal. */ -- cgit v1.2.3