Unicode compilation issues and fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've noticed that PJSIP 1.4 compiles fine as an Unicode application
under Windows, save for portaudio (but the issues seem to be mostly
cosmetic anyway) and a few issues in PJSIP itself. I attached a patch
with my PJSIP fixes; I doubt I need to sign a submission agreement for
such trivial fixes, but I have no problem signing one. An explaination
of the fixes:
 * set PJ_NATIVE_STRING_IS_UNICODE to 1 if UNICODE is defined, which
takes care of most issues
 * GetProcAddress always takes a char *, even if UNICODE is defined, so
use char * instead of pj_char_t * (and accordingly omit PJ_T on string
literals)

Here is the patch:

Index: pjlib/include/pj/compat/os_win32.h
===================================================================
@@ -110,7 +110,11 @@
 #ifndef PJ_OS_HAS_CHECK_STACK
 #   define PJ_OS_HAS_CHECK_STACK    1
 #endif
+#ifdef UNICODE
+#define PJ_NATIVE_STRING_IS_UNICODE    1
+#else
 #define PJ_NATIVE_STRING_IS_UNICODE    0
+#endif
 
 #define PJ_ATOMIC_VALUE_TYPE        long
 
Index: pjlib/src/pj/ip_helper_win32.c
===================================================================
@@ -77,7 +77,7 @@
 #endif
 }
 
-static FARPROC GetIpHlpApiProc(pj_char_t *lpProcName)
+static FARPROC GetIpHlpApiProc(char *lpProcName)
 {
     if(NULL == s_hDLL) {
     s_hDLL = LoadLibrary(PJ_T("IpHlpApi"));
@@ -98,7 +98,7 @@
 {
     if(NULL == s_pfnGetIpAddrTable) {
     s_pfnGetIpAddrTable = (PFN_GetIpAddrTable)
-        GetIpHlpApiProc(PJ_T("GetIpAddrTable"));
+        GetIpHlpApiProc("GetIpAddrTable");
     }
    
     if(NULL != s_pfnGetIpAddrTable) {
@@ -117,7 +117,7 @@
 {
     if(NULL == s_pfnGetAdapterAddresses) {
     s_pfnGetAdapterAddresses = (PFN_GetAdapterAddresses)
-        GetIpHlpApiProc(PJ_T("GetAdapterAddresses"));
+        GetIpHlpApiProc("GetAdapterAddresses");
     }
    
     if(NULL != s_pfnGetAdapterAddresses) {
@@ -134,7 +134,7 @@
 {
     if(NULL == s_pfnGetIfEntry) {
     s_pfnGetIfEntry = (PFN_GetIfEntry)
-        GetIpHlpApiProc(PJ_T("GetIfEntry"));
+        GetIpHlpApiProc("GetIfEntry");
     }
    
     if(NULL != s_pfnGetIfEntry) {
@@ -152,7 +152,7 @@
 {
     if(NULL == s_pfnGetIpForwardTable) {
     s_pfnGetIpForwardTable = (PFN_GetIpForwardTable)
-        GetIpHlpApiProc(PJ_T("GetIpForwardTable"));
+        GetIpHlpApiProc("GetIpForwardTable");
     }
    
     if(NULL != s_pfnGetIpForwardTable) {




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux