Changed all public header files to compile correctly when -ansi and -pedantic is used, also when g++ is used
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@622 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/include/pj/compat/cc_gcc.h b/pjlib/include/pj/compat/cc_gcc.h
index 46b6afc..1cbc353 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 <inttypes.h>
+ 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 0319cfd..6b8df9f 100644
--- a/pjlib/include/pj/ctype.h
+++ b/pjlib/include/pj/ctype.h
@@ -62,7 +62,7 @@
* @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 ea0e207..d71ac55 100644
--- a/pjlib/include/pj/file_io.h
+++ b/pjlib/include/pj/file_io.h
@@ -61,7 +61,7 @@
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 @@
{
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 62bca30..0f77f6f 100644
--- a/pjlib/include/pj/ioqueue.h
+++ b/pjlib/include/pj/ioqueue.h
@@ -219,7 +219,7 @@
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 eeb9000..48ac8d3 100644
--- a/pjlib/include/pj/log.h
+++ b/pjlib/include/pj/log.h
@@ -77,7 +77,7 @@
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 @@
* @}
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/*
* 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 2a57ab8..e87d5ad 100644
--- a/pjlib/include/pj/os.h
+++ b/pjlib/include/pj/os.h
@@ -33,7 +33,7 @@
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* @defgroup PJ_THREAD Threads
* @ingroup PJ_OS
@@ -226,7 +226,7 @@
* @}
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* @defgroup PJ_TLS Thread Local Storage.
* @ingroup PJ_OS
@@ -271,7 +271,7 @@
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* @defgroup PJ_ATOMIC Atomic Variables
* @ingroup PJ_OS
@@ -382,7 +382,7 @@
* @}
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* @defgroup PJ_MUTEX Mutexes.
* @ingroup PJ_OS
@@ -403,7 +403,7 @@
{
PJ_MUTEX_DEFAULT,
PJ_MUTEX_SIMPLE,
- PJ_MUTEX_RECURSE,
+ PJ_MUTEX_RECURSE
} pj_mutex_type_e;
@@ -500,7 +500,7 @@
* @}
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* @defgroup PJ_RW_MUTEX Reader/Writer Mutex
* @ingroup PJ_OS
@@ -576,7 +576,7 @@
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* @defgroup PJ_CRIT_SEC Critical sections.
* @ingroup PJ_OS
@@ -610,7 +610,7 @@
* @}
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
#if defined(PJ_HAS_SEMAPHORE) && PJ_HAS_SEMAPHORE != 0
/**
* @defgroup PJ_SEM Semaphores.
@@ -679,7 +679,7 @@
#endif /* PJ_HAS_SEMAPHORE */
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
#if defined(PJ_HAS_EVENT_OBJ) && PJ_HAS_EVENT_OBJ != 0
/**
* @defgroup PJ_EVENT Event Object.
@@ -771,7 +771,7 @@
*/
#endif /* PJ_HAS_EVENT_OBJ */
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* @addtogroup PJ_TIME Time Data Type and Manipulation.
* @ingroup PJ_OS
@@ -836,7 +836,7 @@
* @}
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
#if defined(PJ_TERM_HAS_COLOR) && PJ_TERM_HAS_COLOR != 0
/**
@@ -867,7 +867,7 @@
#endif /* PJ_TERM_HAS_COLOR */
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* @defgroup PJ_TIMESTAMP High Resolution Timestamp
* @ingroup PJ_OS
@@ -1046,7 +1046,7 @@
/** @} */
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* 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 7f7fd2b..3407609 100644
--- a/pjlib/include/pj/pool.h
+++ b/pjlib/include/pj/pool.h
@@ -312,7 +312,7 @@
* @} // PJ_POOL
*/
-///////////////////////////////////////////////////////////////////////////////
+/* **************************************************************************/
/**
* @defgroup PJ_POOL_FACTORY Pool Factory and Policy.
* @ingroup PJ_POOL_GROUP
@@ -526,7 +526,7 @@
* @} // 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 b5a9dcf..a6e760a 100644
--- a/pjlib/include/pj/sock.h
+++ b/pjlib/include/pj/sock.h
@@ -109,7 +109,7 @@
{
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 @@
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_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 5a27551..cae418a 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_ssize_t pj_off_t;
#endif
-///////////////////////////////////////////////////////////////////////////////
+/* ************************************************************************* */
/*
* Data structure types.
*/
@@ -230,7 +230,7 @@
*/
typedef PJ_ATOMIC_VALUE_TYPE pj_atomic_value_t;
-///////////////////////////////////////////////////////////////////////////////
+/* ************************************************************************* */
/** Thread handle. */
typedef struct pj_thread_t pj_thread_t;
@@ -268,7 +268,7 @@
/** 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 @@
*/
#define PJ_MAX_OBJ_NAME 16
-///////////////////////////////////////////////////////////////////////////////
+/* ************************************************************************* */
/*
* General.
*/
@@ -497,7 +497,7 @@
* @} // Time Management
*/
-///////////////////////////////////////////////////////////////////////////////
+/* ************************************************************************* */
/*
* Terminal.
*/