From d7aa4332dae06ae890053dd13239ddabee46b86c Mon Sep 17 00:00:00 2001 From: Riza Sulistyo Date: Wed, 19 Jun 2013 06:47:43 +0000 Subject: Re #1680: Add initial support for Win64 git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4537 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/include/pj/compat/errno.h | 3 ++- pjlib/include/pj/compat/socket.h | 3 ++- pjlib/include/pj/config.h | 13 +++++++++---- pjlib/include/pj/config_site_sample.h | 2 +- pjlib/include/pj/except.h | 4 ++-- pjlib/include/pj/pool.h | 2 +- pjlib/include/pj/string_i.h | 6 +++--- pjlib/include/pj/types.h | 12 ++++++++++-- pjlib/include/pj/unicode.h | 8 ++++---- 9 files changed, 34 insertions(+), 19 deletions(-) (limited to 'pjlib/include') diff --git a/pjlib/include/pj/compat/errno.h b/pjlib/include/pj/compat/errno.h index ebc7b6dd..7bbd4889 100644 --- a/pjlib/include/pj/compat/errno.h +++ b/pjlib/include/pj/compat/errno.h @@ -21,7 +21,8 @@ #define __PJ_COMPAT_ERRNO_H__ #if defined(PJ_WIN32) && PJ_WIN32 != 0 || \ - defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE != 0 + defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE != 0 || \ + defined(PJ_WIN64) && PJ_WIN64 != 0 typedef unsigned long pj_os_err_type; # define pj_get_native_os_error() GetLastError() diff --git a/pjlib/include/pj/compat/socket.h b/pjlib/include/pj/compat/socket.h index 8a011c1a..23f46af2 100644 --- a/pjlib/include/pj/compat/socket.h +++ b/pjlib/include/pj/compat/socket.h @@ -152,7 +152,8 @@ * Define common errors. */ #if (defined(PJ_WIN32) && PJ_WIN32!=0) || \ - (defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0) + (defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0) || \ + (defined(PJ_WIN64) && PJ_WIN64!=0) # define OSERR_EWOULDBLOCK WSAEWOULDBLOCK # define OSERR_EINPROGRESS WSAEINPROGRESS # define OSERR_ECONNRESET WSAECONNRESET diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h index 1d593eee..1f787150 100644 --- a/pjlib/include/pj/config.h +++ b/pjlib/include/pj/config.h @@ -77,10 +77,15 @@ # define PJ_WIN32 1 #elif defined(PJ_WIN32) || defined(_WIN32) || defined(__WIN32__) || \ - defined(_WIN64) || defined(WIN32) || defined(__TOS_WIN__) - /* - * Win32 - */ + defined(WIN32) || defined(PJ_WIN64) || defined(_WIN64) || \ + defined(WIN64) || defined(__TOS_WIN__) +# if defined(PJ_WIN64) || defined(_WIN64) || defined(WIN64) + /* + * Win64 + */ +# undef PJ_WIN64 +# define PJ_WIN64 1 +# endif # undef PJ_WIN32 # define PJ_WIN32 1 # include diff --git a/pjlib/include/pj/config_site_sample.h b/pjlib/include/pj/config_site_sample.h index 559f74ad..c48ea8ea 100644 --- a/pjlib/include/pj/config_site_sample.h +++ b/pjlib/include/pj/config_site_sample.h @@ -475,7 +475,7 @@ # define PJ_HASH_USE_OWN_TOLOWER 1 # define PJSIP_UNESCAPE_IN_PLACE 1 -# ifdef PJ_WIN32 +# if defined(PJ_WIN32) || defined(PJ_WIN64) # define PJSIP_MAX_NET_EVENTS 10 # endif diff --git a/pjlib/include/pj/except.h b/pjlib/include/pj/except.h index efe42e7b..9369825c 100644 --- a/pjlib/include/pj/except.h +++ b/pjlib/include/pj/except.h @@ -339,9 +339,9 @@ public: * stack. */ struct pj_exception_state_t -{ - struct pj_exception_state_t *prev; /**< Previous state in the list. */ +{ pj_jmp_buf state; /**< jmp_buf. */ + struct pj_exception_state_t *prev; /**< Previous state in the list. */ }; /** diff --git a/pjlib/include/pj/pool.h b/pjlib/include/pj/pool.h index 3e9c76d5..9adaeca9 100644 --- a/pjlib/include/pj/pool.h +++ b/pjlib/include/pj/pool.h @@ -856,7 +856,7 @@ struct pj_caching_pool /** * Internal pool. */ - char pool_buf[256 * (sizeof(long) / 4)]; + char pool_buf[256 * (sizeof(size_t) / 4)]; /** * Mutex. diff --git a/pjlib/include/pj/string_i.h b/pjlib/include/pj/string_i.h index 98b97dc6..53794864 100644 --- a/pjlib/include/pj/string_i.h +++ b/pjlib/include/pj/string_i.h @@ -145,7 +145,7 @@ PJ_IDEF(int) pj_strcmp( const pj_str_t *str1, const pj_str_t *str2) } else if (str2->slen == 0) { return 1; } else { - int min = (str1->slen < str2->slen)? str1->slen : str2->slen; + pj_size_t min = (str1->slen < str2->slen)? str1->slen : str2->slen; int res = pj_memcmp(str1->ptr, str2->ptr, min); if (res == 0) { return (str1->slen < str2->slen) ? -1 : @@ -213,7 +213,7 @@ PJ_IDEF(int) pj_stricmp( const pj_str_t *str1, const pj_str_t *str2) } else if (str2->slen == 0) { return 1; } else { - int min = (str1->slen < str2->slen)? str1->slen : str2->slen; + pj_size_t min = (str1->slen < str2->slen)? str1->slen : str2->slen; int res = pj_ansi_strnicmp(str1->ptr, str2->ptr, min); if (res == 0) { return (str1->slen < str2->slen) ? -1 : @@ -355,7 +355,7 @@ PJ_IDEF(void) pj_strcat(pj_str_t *dst, const pj_str_t *src) PJ_IDEF(void) pj_strcat2(pj_str_t *dst, const char *str) { - unsigned len = str? pj_ansi_strlen(str) : 0; + pj_size_t len = str? pj_ansi_strlen(str) : 0; if (len) { pj_memcpy(dst->ptr + dst->slen, str, len); dst->slen += len; diff --git a/pjlib/include/pj/types.h b/pjlib/include/pj/types.h index 04e426b5..420ddd9b 100644 --- a/pjlib/include/pj/types.h +++ b/pjlib/include/pj/types.h @@ -58,7 +58,11 @@ typedef unsigned char pj_uint8_t; typedef size_t pj_size_t; /** Large signed integer. */ -typedef long pj_ssize_t; +#if defined(PJ_WIN64) && PJ_WIN64!=0 + typedef pj_int64_t pj_ssize_t; +#else + typedef long pj_ssize_t; +#endif /** Status code. */ typedef int pj_status_t; @@ -250,7 +254,11 @@ typedef struct pj_pipe_t pj_pipe_t; typedef void *pj_oshandle_t; /** Socket handle. */ -typedef long pj_sock_t; +#if defined(PJ_WIN64) && PJ_WIN64!=0 + typedef pj_int64_t pj_sock_t; +#else + typedef long pj_sock_t; +#endif /** Generic socket address. */ typedef void pj_sockaddr_t; diff --git a/pjlib/include/pj/unicode.h b/pjlib/include/pj/unicode.h index 47e5fe2b..503bc240 100644 --- a/pjlib/include/pj/unicode.h +++ b/pjlib/include/pj/unicode.h @@ -47,8 +47,8 @@ PJ_BEGIN_DECL * * @return The Unicode string, NULL terminated. */ -PJ_DECL(wchar_t*) pj_ansi_to_unicode(const char *str, pj_size_t len, - wchar_t *wbuf, pj_size_t wbuf_count); +PJ_DECL(wchar_t*) pj_ansi_to_unicode(const char *str, int len, + wchar_t *wbuf, int wbuf_count); /** @@ -61,8 +61,8 @@ PJ_DECL(wchar_t*) pj_ansi_to_unicode(const char *str, pj_size_t len, * * @return The ANSI string, NULL terminated. */ -PJ_DECL(char*) pj_unicode_to_ansi(const wchar_t *wstr, pj_size_t len, - char *buf, pj_size_t buf_size); +PJ_DECL(char*) pj_unicode_to_ansi(const wchar_t *wstr, pj_ssize_t len, + char *buf, int buf_size); #if defined(PJ_NATIVE_STRING_IS_UNICODE) && PJ_NATIVE_STRING_IS_UNICODE!=0 -- cgit v1.2.3