summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-05-12 15:03:23 +0000
committerBenny Prijono <bennylp@teluu.com>2007-05-12 15:03:23 +0000
commitfd5aade84080ce74df1622958ea2c56c3e827703 (patch)
treeba9d237790fd514955f4e716afc162b7d7091d31 /pjlib
parent3727cae28c3f725ff6f909955718523737a597fa (diff)
Symbian fixes to compile on GCCE (nested callbacks etc)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1269 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/include/pj/compat/cc_armcc.h6
-rw-r--r--pjlib/include/pj/compat/os_symbian.h2
-rw-r--r--pjlib/include/pj/errno.h4
-rw-r--r--pjlib/include/pj/except.h10
-rw-r--r--pjlib/include/pj/types.h3
-rw-r--r--pjlib/src/pj/addr_resolv_symbian.cpp4
-rw-r--r--pjlib/src/pj/errno.c3
-rw-r--r--pjlib/src/pj/exception_symbian.cpp1
-rw-r--r--pjlib/src/pj/os_core_symbian.cpp8
-rw-r--r--pjlib/src/pj/sock_symbian.cpp12
-rw-r--r--pjlib/src/pjlib-test/main_symbian.cpp2
11 files changed, 35 insertions, 20 deletions
diff --git a/pjlib/include/pj/compat/cc_armcc.h b/pjlib/include/pj/compat/cc_armcc.h
index 504ca889..52fe74c0 100644
--- a/pjlib/include/pj/compat/cc_armcc.h
+++ b/pjlib/include/pj/compat/cc_armcc.h
@@ -33,8 +33,12 @@
#define PJ_CC_VER_2 __ARMCC_MINOR__
#define PJ_CC_VER_3 __ARMCC_PATCHLEVEL__
+#ifdef __cplusplus
+# define PJ_INLINE_SPECIFIER inline
+#else
+# define PJ_INLINE_SPECIFIER static __inline
+#endif
-#define PJ_INLINE_SPECIFIER static // why is not inline accepted?
#define PJ_THREAD_FUNC
#define PJ_NORETURN
#define PJ_ATTR_NORETURN __attribute__ ((noreturn))
diff --git a/pjlib/include/pj/compat/os_symbian.h b/pjlib/include/pj/compat/os_symbian.h
index b1b1cd1a..f6787b06 100644
--- a/pjlib/include/pj/compat/os_symbian.h
+++ b/pjlib/include/pj/compat/os_symbian.h
@@ -144,7 +144,9 @@
#define PJ_HAS_SOCKLEN_T 1
typedef unsigned int socklen_t;
+#ifndef __GCCE__
#include <e32def.h>
+#endif
/*
#if defined(PJ_EXPORTING)
diff --git a/pjlib/include/pj/errno.h b/pjlib/include/pj/errno.h
index cd5d9164..df6c1b02 100644
--- a/pjlib/include/pj/errno.h
+++ b/pjlib/include/pj/errno.h
@@ -111,6 +111,7 @@ PJ_DECL(void) pj_set_netos_error(pj_status_t code);
PJ_DECL(pj_str_t) pj_strerror( pj_status_t statcode,
char *buf, pj_size_t bufsize);
+typedef pj_str_t (*pjsip_error_callback)(pj_status_t, char*, pj_size_t);
/**
* Register strerror message handler for the specified error space.
* Application can register its own handler to supply the error message
@@ -132,8 +133,7 @@ PJ_DECL(pj_str_t) pj_strerror( pj_status_t statcode,
*/
PJ_DECL(pj_status_t) pj_register_strerror(pj_status_t start_code,
pj_status_t err_space,
- pj_str_t (*f)(pj_status_t,char*,
- pj_size_t));
+ pjsip_error_callback f);
/**
* @hideinitializer
diff --git a/pjlib/include/pj/except.h b/pjlib/include/pj/except.h
index 610f4626..509b01be 100644
--- a/pjlib/include/pj/except.h
+++ b/pjlib/include/pj/except.h
@@ -26,6 +26,7 @@
#include <pj/types.h>
#include <pj/compat/setjmp.h>
+#include <pj/log.h>
PJ_BEGIN_DECL
@@ -265,6 +266,15 @@ public:
while (0)
#define PJ_GET_EXCEPTION() pj_excp_.code_
+#else
+
+#define PJ_USE_EXCEPTION
+#define PJ_TRY
+#define PJ_CATCH_ANY if (0)
+#define PJ_END
+#define PJ_THROW(x_id) do { PJ_LOG(1,("PJ_THROW"," error code = %d",x_id)); } while (0)
+#define PJ_GET_EXCEPTION() 0
+
#endif /* __cplusplus */
#else
diff --git a/pjlib/include/pj/types.h b/pjlib/include/pj/types.h
index 7b7598b1..e9095524 100644
--- a/pjlib/include/pj/types.h
+++ b/pjlib/include/pj/types.h
@@ -302,6 +302,7 @@ PJ_DECL(pj_status_t) pj_init(void);
*/
PJ_DECL(void) pj_shutdown(void);
+typedef void (*pj_exit_callback)(void);
/**
* Register cleanup function to be called by PJLIB when pj_shutdown() is
* called.
@@ -310,7 +311,7 @@ PJ_DECL(void) pj_shutdown(void);
*
* @return PJ_SUCCESS on success.
*/
-PJ_DECL(pj_status_t) pj_atexit(void (*func)(void));
+PJ_DECL(pj_status_t) pj_atexit(pj_exit_callback func);
diff --git a/pjlib/src/pj/addr_resolv_symbian.cpp b/pjlib/src/pj/addr_resolv_symbian.cpp
index c9a776c8..95da5cdd 100644
--- a/pjlib/src/pj/addr_resolv_symbian.cpp
+++ b/pjlib/src/pj/addr_resolv_symbian.cpp
@@ -35,7 +35,7 @@ PJ_DEF(pj_status_t) pj_gethostbyname(const pj_str_t *name, pj_hostent *he)
// Convert name to Unicode
wchar_t name16[PJ_MAX_HOSTNAME];
pj_ansi_to_unicode(name->ptr, name->slen, name16, PJ_ARRAY_SIZE(name16));
- TPtrC16 data(name16);
+ TPtrC16 data((const TUint16*)name16);
// Resolve!
TNameEntry nameEntry;
@@ -65,7 +65,7 @@ PJ_DEF(pj_status_t) pj_gethostbyname(const pj_str_t *name, pj_hostent *he)
static pj_sockaddr_in resolved_addr;
// Convert the official address to ANSI.
- pj_unicode_to_ansi(nameEntry().iName.Ptr(), nameEntry().iName.Length(),
+ pj_unicode_to_ansi((const wchar_t*)nameEntry().iName.Ptr(), nameEntry().iName.Length(),
resolved_name, sizeof(resolved_name));
// Convert IP address
diff --git a/pjlib/src/pj/errno.c b/pjlib/src/pj/errno.c
index f82c22d6..f7273a42 100644
--- a/pjlib/src/pj/errno.c
+++ b/pjlib/src/pj/errno.c
@@ -103,8 +103,7 @@ static int pjlib_error(pj_status_t code, char *buf, pj_size_t size)
/* Register strerror handle. */
PJ_DECL(pj_status_t) pj_register_strerror(pj_status_t start,
pj_status_t space,
- pj_str_t (*f)(pj_status_t,char*,
- pj_size_t))
+ pjsip_error_callback f)
{
unsigned i;
diff --git a/pjlib/src/pj/exception_symbian.cpp b/pjlib/src/pj/exception_symbian.cpp
index 1d475335..6f2e0803 100644
--- a/pjlib/src/pj/exception_symbian.cpp
+++ b/pjlib/src/pj/exception_symbian.cpp
@@ -22,7 +22,6 @@
#include <pj/log.h>
#include <pj/errno.h>
-static long thread_local_id = -1;
#if defined(PJ_HAS_EXCEPTION_NAMES) && PJ_HAS_EXCEPTION_NAMES != 0
static const char *exception_id_names[PJ_MAX_EXCEPTION_ID];
diff --git a/pjlib/src/pj/os_core_symbian.cpp b/pjlib/src/pj/os_core_symbian.cpp
index 742fe5ab..a3ec3c04 100644
--- a/pjlib/src/pj/os_core_symbian.cpp
+++ b/pjlib/src/pj/os_core_symbian.cpp
@@ -301,7 +301,7 @@ on_error:
}
-PJ_DEF(pj_status_t) pj_atexit(void (*func)(void))
+PJ_DEF(pj_status_t) pj_atexit(pj_exit_callback func)
{
if (atexit_count >= PJ_ARRAY_SIZE(atexit_func))
return PJ_ETOOMANY;
@@ -459,7 +459,7 @@ PJ_DEF(pj_status_t) pj_thread_local_alloc(long *index)
*/
PJ_DEF(void) pj_thread_local_free(long index)
{
- PJ_ASSERT_ON_FAIL(index >= 0 && index < PJ_ARRAY_SIZE(tls_vars) &&
+ PJ_ASSERT_ON_FAIL(index >= 0 && index < (int)PJ_ARRAY_SIZE(tls_vars) &&
tls_vars[index] != 0, return);
tls_vars[index] = 0;
@@ -473,7 +473,7 @@ PJ_DEF(pj_status_t) pj_thread_local_set(long index, void *value)
{
pj_thread_t *rec = pj_thread_this();
- PJ_ASSERT_RETURN(index >= 0 && index < PJ_ARRAY_SIZE(tls_vars) &&
+ PJ_ASSERT_RETURN(index >= 0 && index < (int)PJ_ARRAY_SIZE(tls_vars) &&
tls_vars[index] != 0, PJ_EINVAL);
rec->tls_values[index] = value;
@@ -487,7 +487,7 @@ PJ_DEF(void*) pj_thread_local_get(long index)
{
pj_thread_t *rec = pj_thread_this();
- PJ_ASSERT_RETURN(index >= 0 && index < PJ_ARRAY_SIZE(tls_vars) &&
+ PJ_ASSERT_RETURN(index >= 0 && index < (int)PJ_ARRAY_SIZE(tls_vars) &&
tls_vars[index] != 0, NULL);
return rec->tls_values[index];
diff --git a/pjlib/src/pj/sock_symbian.cpp b/pjlib/src/pj/sock_symbian.cpp
index ae691bae..38960917 100644
--- a/pjlib/src/pj/sock_symbian.cpp
+++ b/pjlib/src/pj/sock_symbian.cpp
@@ -271,7 +271,7 @@ PJ_DEF(char*) pj_inet_ntoa(pj_in_addr inaddr)
TInetAddr temp_addr((TUint32)pj_ntohl(inaddr.s_addr), (TUint)0);
temp_addr.Output(str16);
- return pj_unicode_to_ansi(str16.PtrZ(), str16.Length(),
+ return pj_unicode_to_ansi((const wchar_t*)str16.PtrZ(), str16.Length(),
str8, sizeof(str8));
}
@@ -307,7 +307,7 @@ PJ_DEF(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp)
pj_ansi_to_unicode(tempaddr8, pj_ansi_strlen(tempaddr8),
tempaddr16, sizeof(tempaddr16));
- TBuf<MAXIPLEN> ip_addr(tempaddr16);
+ TBuf<MAXIPLEN> ip_addr((const TText*)tempaddr16);
TInetAddr addr;
addr.Init(KAfInet);
@@ -418,7 +418,7 @@ PJ_DEF(const pj_str_t*) pj_gethostname(void)
resv.GetHostName(tmpName, reqStatus);
User::WaitForRequest(reqStatus);
- hostname.ptr = pj_unicode_to_ansi(tmpName.Ptr(), tmpName.Length(),
+ hostname.ptr = pj_unicode_to_ansi((const wchar_t*)tmpName.Ptr(), tmpName.Length(),
buf, sizeof(buf));
hostname.slen = tmpName.Length();
}
@@ -551,7 +551,7 @@ PJ_DEF(pj_status_t) pj_sock_getpeername( pj_sock_t sock,
PJ_CHECK_STACK();
PJ_ASSERT_RETURN(sock && addr && namelen &&
- *namelen>=sizeof(pj_sockaddr_in), PJ_EINVAL);
+ *namelen>=(int)sizeof(pj_sockaddr_in), PJ_EINVAL);
CPjSocket *pjSock = (CPjSocket*)sock;
RSocket &rSock = pjSock->Socket();
@@ -578,7 +578,7 @@ PJ_DEF(pj_status_t) pj_sock_getsockname( pj_sock_t sock,
PJ_CHECK_STACK();
PJ_ASSERT_RETURN(sock && addr && namelen &&
- *namelen>=sizeof(pj_sockaddr_in), PJ_EINVAL);
+ *namelen>=(int)sizeof(pj_sockaddr_in), PJ_EINVAL);
CPjSocket *pjSock = (CPjSocket*)sock;
RSocket &rSock = pjSock->Socket();
@@ -728,7 +728,7 @@ PJ_DEF(pj_status_t) pj_sock_recvfrom(pj_sock_t sock,
PJ_ASSERT_RETURN(sock && buf && len && from && fromlen, PJ_EINVAL);
PJ_ASSERT_RETURN(*len > 0, PJ_EINVAL);
- PJ_ASSERT_RETURN(*fromlen >= sizeof(pj_sockaddr_in), PJ_EINVAL);
+ PJ_ASSERT_RETURN(*fromlen >= (int)sizeof(pj_sockaddr_in), PJ_EINVAL);
CPjSocket *pjSock = (CPjSocket*)sock;
RSocket &rSock = pjSock->Socket();
diff --git a/pjlib/src/pjlib-test/main_symbian.cpp b/pjlib/src/pjlib-test/main_symbian.cpp
index c2c808b8..e57b080d 100644
--- a/pjlib/src/pjlib-test/main_symbian.cpp
+++ b/pjlib/src/pjlib-test/main_symbian.cpp
@@ -51,7 +51,7 @@ LOCAL_C void MainL()
//
// add your program code here, example code below
//
- int rc = test_main();
+ test_main();
console->Printf(_L(" [press any key]\n"));
console->Getch();