[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sal/osl
sal/osl/unx/nlsupport.c |1 + 1 file changed, 1 insertion(+) New commits: commit 2a8c9c8197a8ca209ba42aa95fce0b0736ae41f1 Author: Jim Jagielski AuthorDate: Fri Jan 25 13:42:54 2019 + Commit: Jim Jagielski CommitDate: Fri Jan 25 13:42:54 2019 + save some cycles diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c index 4832e1874b5c..dc640a38ce7c 100644 --- a/sal/osl/unx/nlsupport.c +++ b/sal/osl/unx/nlsupport.c @@ -883,7 +883,8 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale ) slen = strlen( "/usr/local/bin" ) + 1; if ( opath != NULL ) slen += strlen( ":" ) + strlen( opath ); -npath = calloc( slen ); +npath = malloc( slen ); +*npath = '\0'; if ( opath != NULL ) { strcat( npath, opath ); strcat( npath, ":" ); commit 004f5594fb4f54494eab3991c34c43c70a9521d7 Author: Jim Jagielski AuthorDate: Fri Jan 25 13:17:40 2019 + Commit: Jim Jagielski CommitDate: Fri Jan 25 13:17:40 2019 + ensure NULL diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c index 0f3dd7f17747..4832e1874b5c 100644 --- a/sal/osl/unx/nlsupport.c +++ b/sal/osl/unx/nlsupport.c @@ -883,7 +883,7 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale ) slen = strlen( "/usr/local/bin" ) + 1; if ( opath != NULL ) slen += strlen( ":" ) + strlen( opath ); -npath = malloc( slen ); +npath = calloc( slen ); if ( opath != NULL ) { strcat( npath, opath ); strcat( npath, ":" ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sal/osl
sal/osl/unx/backtrace.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) New commits: commit 7d41b0a9559a388fe558cf7e8d81e4909a785af3 Author: Damjan Jovanovic Date: Sun Dec 13 23:55:35 2015 + Use %tx to print ptrdiff_t. Patch by: me diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c index b8a2726..fadd07b 100644 --- a/sal/osl/unx/backtrace.c +++ b/sal/osl/unx/backtrace.c @@ -116,12 +116,12 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) if ( dli.dli_fname && dli.dli_fbase ) { offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase; -fprintf( fp, "%s+0x%x", dli.dli_fname, offset ); +fprintf( fp, "%s+0x%" SAL_PRI_PTRDIFFT "x", dli.dli_fname, offset ); } if ( dli.dli_sname && dli.dli_saddr ) { offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr; -fprintf( fp, "(%s+0x%x)", dli.dli_sname, offset ); +fprintf( fp, "(%s+0x%" SAL_PRI_PTRDIFFT "x)", dli.dli_sname, offset ); } } fprintf( fp, "[%p]\n", *pFramePtr ); @@ -270,12 +270,12 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) if ( dli.dli_fname && dli.dli_fbase ) { offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase; -fprintf( fp, "%s+0x%x", dli.dli_fname, offset ); +fprintf( fp, "%s+0x%" SAL_PRI_PTRDIFFT "x", dli.dli_fname, offset ); } if ( dli.dli_sname && dli.dli_saddr ) { offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr; -fprintf( fp, "(%s+0x%x)", dli.dli_sname, offset ); +fprintf( fp, "(%s+0x%" SAL_PRI_PTRDIFFT "x)", dli.dli_sname, offset ); } } fprintf( fp, "[%p]\n", *pFramePtr ); @@ -336,12 +336,12 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) if ( dli.dli_fname && dli.dli_fbase ) { offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase; -fprintf( fp, "%s+0x%x", dli.dli_fname, offset ); +fprintf( fp, "%s+0x%" SAL_PRI_PTRDIFFT "x", dli.dli_fname, offset ); } if ( dli.dli_sname && dli.dli_saddr ) { offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr; -fprintf( fp, "(%s+0x%x)", dli.dli_sname, offset ); +fprintf( fp, "(%s+0x%" SAL_PRI_PTRDIFFT "x)", dli.dli_sname, offset ); } } fprintf( fp, "[%p]\n", *pFramePtr ); commit 25f185144085ebe06405a5d8f19a11544ed7f794 Author: Damjan Jovanovic Date: Sun Dec 13 23:35:09 2015 + Use %p to print pointers in sal backtraces instead of 0x%x + conversion to integer. Patch by: me diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c index 4ba05cc..b8a2726 100644 --- a/sal/osl/unx/backtrace.c +++ b/sal/osl/unx/backtrace.c @@ -124,7 +124,7 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) fprintf( fp, "(%s+0x%x)", dli.dli_sname, offset ); } } -fprintf( fp, "[0x%x]\n", *pFramePtr ); +fprintf( fp, "[%p]\n", *pFramePtr ); } fflush( fp ); @@ -192,7 +192,7 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) fprintf( fp, "(%s+0x%" SAL_PRI_PTRDIFFT "x)", dli.dli_sname, offset ); } } -fprintf( fp, "[0x%p]\n", *pFramePtr ); +fprintf( fp, "[%p]\n", *pFramePtr ); } fflush( fp ); fclose( fp ); @@ -278,7 +278,7 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) fprintf( fp, "(%s+0x%x)", dli.dli_sname, offset ); } } -fprintf( fp, "[0x%x]\n", *pFramePtr ); +fprintf( fp, "[%p]\n", *pFramePtr ); } fflush( fp ); @@ -344,7 +344,7 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) fprintf( fp, "(%s+0x%x)", dli.dli_sname, offset ); } } -fprintf( fp, "[0x%x]\n", (unsigned int)*pFramePtr ); +fprintf( fp, "[%p]\n", *pFramePtr ); } fflush( fp ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sal/osl
sal/osl/unx/backtrace.c |2 +- sal/osl/unx/backtrace.h |2 -- sal/osl/unx/diagnose.c | 42 +- 3 files changed, 38 insertions(+), 8 deletions(-) New commits: commit 87451f66edfa425e51289ac6f12ee110d7109a02 Author: Damjan Jovanovic Date: Thu Nov 26 19:02:59 2015 + Implement osl_diagnose_backtrace_Impl() on FreeBSD. Also fix the value of FRAME_PTR_OFFSET in both backtrace.c and diagnose.c - it's 3 because of the EBP/RBP register's position in the jmp_buf (https://github.com/freebsd/freebsd/blob/master/lib/libc/amd64/gen/_setjmp.S and https://github.com/freebsd/freebsd/blob/master/lib/libc/i386/gen/_setjmp.S). This gets backtracing to fully work on FreeBSD. Patch by: me diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c index 2e57fb6..1b0b8a8 100644 --- a/sal/osl/unx/backtrace.c +++ b/sal/osl/unx/backtrace.c @@ -143,7 +143,7 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) #include #include "backtrace.h" -#define FRAME_PTR_OFFSET 1 +#define FRAME_PTR_OFFSET 3 #define FRAME_OFFSET 0 int backtrace( void **buffer, int max_frames ) diff --git a/sal/osl/unx/diagnose.c b/sal/osl/unx/diagnose.c index b1bcb0d..0f05fbe 100644 --- a/sal/osl/unx/diagnose.c +++ b/sal/osl/unx/diagnose.c @@ -26,9 +26,9 @@ #ifndef HAVE_DLFCN_H -#if defined(LINUX) || defined(SOLARIS) +#if defined(LINUX) || defined(SOLARIS) || defined(FREEBSD) #define HAVE_DLFCN_H -#endif /* LINUX || SOLARIS */ +#endif /* LINUX || SOLARIS || FREEBSD */ #endif /* HAVE_DLFCN_H */ @@ -73,7 +73,7 @@ static void osl_diagnose_backtrace_Impl ( #define OSL_DIAGNOSE_OUTPUTMESSAGE(f, s) \ ((f != 0) ? (*(f))((s)) : (void)fprintf(stderr, "%s", (s))) -#if defined (LINUX) || defined (SOLARIS) +#if defined (LINUX) || defined (SOLARIS) || defined(FREEBSD) // /* osl_diagnose_frame_Impl */ // @@ -194,14 +194,46 @@ static void osl_diagnose_backtrace_Impl (oslDebugMessageFunc f) } } -#else /* (LINUX || SOLARIS) */ +#elif defined(FREEBSD) + +#include +#include "backtrace.h" /* for struct frame */ + +#if defined(X86) || defined(X86_64) + +#define FRAME_PTR_OFFSET 3 +#define FRAME_OFFSET 0 + +#endif /* (X86 || X86_64) */ + +static void osl_diagnose_backtrace_Impl (oslDebugMessageFunc f) +{ +struct frame * fp; +jmp_bufctx; +inti; + +setjmp (ctx); +fp = (struct frame*)(((long*)(ctx))[FRAME_PTR_OFFSET]); + +for (i = 0; (i < FRAME_OFFSET) && (fp != 0); i++) +fp = fp->fr_savfp; + +for (i = 0; (fp != 0) && (fp->fr_savpc != 0); i++) +{ +struct frame * prev = fp->fr_savfp; +osl_diagnose_frame_Impl (f, i, (void*)(fp->fr_savpc)); +fp = (prev > fp) ? prev : 0; +} +} + +#else /* (LINUX || SOLARIS || FREEBSD) */ static void osl_diagnose_backtrace_Impl (oslDebugMessageFunc f) { /* not yet implemented */ } -#endif /* (LINUX || SOLARIS) */ +#endif /* (LINUX || SOLARIS || FREEBSD) */ // /* osl_assertFailedLine */ commit 0faee39deac292694d036d753b7dc1c4513e045f Author: Damjan Jovanovic Date: Thu Nov 26 18:33:01 2015 + Fix the stack frame layout for backtraces on FreeBSD. Patch by: me diff --git a/sal/osl/unx/backtrace.h b/sal/osl/unx/backtrace.h index 29bf3e0..a3667e6 100644 --- a/sal/osl/unx/backtrace.h +++ b/sal/osl/unx/backtrace.h @@ -37,8 +37,6 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ); /* no frame.h on FreeBSD */ #if defined FREEBSD struct frame { -longarg0[8]; -longarg1[6]; struct frame *fr_savfp; longfr_savpc; }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sal/osl
sal/osl/unx/socket.c | 26 +- sal/osl/unx/sockimpl.h |8 +++- 2 files changed, 20 insertions(+), 14 deletions(-) New commits: commit d3600c128fd32804283e6c4d7c55767ae49a2270 Author: Damjan Jovanovic Date: Tue Oct 13 18:54:59 2015 + #i126586# don't break on non-Linux non-FreeBSD non-NetBSD *nix systems ... diff --git a/sal/osl/unx/sockimpl.h b/sal/osl/unx/sockimpl.h index 8ab86e7..904190f 100644 --- a/sal/osl/unx/sockimpl.h +++ b/sal/osl/unx/sockimpl.h @@ -36,6 +36,8 @@ typedef void* (*oslCloseCallback) (void*); #if defined(LINUX) || defined(FREEBSD) || defined(NETBSD) #define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 1 +#else +#define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 0 #endif struct oslSocketImpl { commit 4c7bfe32168912844a50059b2a901f6434c0f86f Author: Damjan Jovanovic Date: Tue Oct 13 18:22:30 2015 + #i126586# FreeBSD automation deadlock: osl_closeSocket() doesn't wake up thread stuck in accept(). Generalize the "#if defined(LINUX)" workarounds to the *BSDs. diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index a55d759..9bd877a 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -490,7 +490,7 @@ oslSocket __osl_createSocketImpl(int Socket) pSocket->m_CallbackArg = 0; pSocket->m_nRefCount = 1; -#if defined(LINUX) +#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT pSocket->m_bIsAccepting = sal_False; #endif @@ -1824,13 +1824,13 @@ void SAL_CALL osl_releaseSocket( oslSocket pSocket ) { if( pSocket && 0 == osl_decrementInterlockedCount( &(pSocket->m_nRefCount) ) ) { -#if defined(LINUX) +#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT if ( pSocket->m_bIsAccepting == sal_True ) { OSL_ENSURE(0, "osl_destroySocket : attempt to destroy socket while accepting\n"); return; } -#endif /* LINUX */ +#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */ osl_closeSocket( pSocket ); __osl_destroySocketImpl( pSocket ); } @@ -1858,7 +1858,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket) pSocket->m_Socket = OSL_INVALID_SOCKET; -#if defined(LINUX) +#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT pSocket->m_bIsInShutdown = sal_True; if ( pSocket->m_bIsAccepting == sal_True ) @@ -1904,7 +1904,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket) } pSocket->m_bIsAccepting = sal_False; } -#endif /* LINUX */ +#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */ /* registrierten Callback ausfuehren */ if (pSocket->m_CloseCallback != NULL) @@ -2185,9 +2185,9 @@ oslSocket SAL_CALL osl_acceptConnectionOnSocket(oslSocket pSocket, } pSocket->m_nLastError=0; -#if defined(LINUX) +#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT pSocket->m_bIsAccepting = sal_True; -#endif /* LINUX */ +#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */ if( ppAddr && *ppAddr ) { @@ -2208,23 +2208,23 @@ oslSocket SAL_CALL osl_acceptConnectionOnSocket(oslSocket pSocket, pSocket->m_nLastError=errno; OSL_TRACE("osl_acceptConnectionOnSocket : accept error '%s'\n",strerror(errno)); -#if defined(LINUX) +#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT pSocket->m_bIsAccepting = sal_False; -#endif /* LINUX */ +#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */ return 0; } OSL_ASSERT(AddrLen == sizeof(struct sockaddr)); -#if defined(LINUX) +#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT if ( pSocket->m_bIsInShutdown == sal_True ) { close(Connection); OSL_TRACE("osl_acceptConnectionOnSocket : close while accept\n"); return 0; } -#endif /* LINUX */ +#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */ if(ppAddr) @@ -2253,11 +2253,11 @@ oslSocket SAL_CALL osl_acceptConnectionOnSocket(oslSocket pSocket, pConnectionSockImpl->m_nLastError = 0; pConnectionSockImpl->m_CloseCallback= NULL; pConnectionSockImpl->m_CallbackArg = NULL; -#if defined(LINUX) +#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT pConnectionSockImpl->m_bIsAccepting = sal_False; pSocket->m_bIsAccepting = sal_False; -#endif /* LINUX */ +#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */ return pConnectionSockImpl; } diff --git a/sal/osl/unx/sockimpl.h b/sal/osl/unx/sockimpl.h index f148b9d..8ab86e7 100644 --- a/sal/osl/unx/sockimpl.h +++ b/sal/osl/unx/sockimpl.h @@ -34,13 +34,17 @@ extern "C" { typedef void* (*oslCloseCallback) (void*); +#if defined(LINUX) || defined(FREEBSD) || defined(NETBSD) +#define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 1 +#endif + struct oslSocketImpl { int m_Socket; int m_nLastError; oslCloseCallbackm_CloseCallback; void* m_CallbackArg; oslInterlockedCount m_nRefCount; -#if defined(LINUX) +#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT sal_Boolm_bIsAccepting; sal_Boolm_bIsInShutdown; #endif ___ Libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sal/osl
sal/osl/unx/backtrace.h |2 +- sal/osl/unx/file.cxx|2 +- sal/osl/w32/profile.cxx |6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 6c12a27867dc7df6196e74a0409c21072601bb79 Author: Pedro Giffuni Date: Wed Oct 7 21:37:01 2015 + Bring back the casts for Win32. Our old version of MSVC doesn't understand CERT secure C coding standard MEM 02-A. Reported by:damjan (through pescetti) diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx index 3c7ef52..ba11b16 100644 --- a/sal/osl/w32/profile.cxx +++ b/sal/osl/w32/profile.cxx @@ -1584,7 +1584,7 @@ static const sal_Char* addLine(osl_TProfileImpl* pProfile, const sal_Char* Line) if (pProfile->m_Lines == NULL) { pProfile->m_MaxLines = LINES_INI; -pProfile->m_Lines = calloc(pProfile->m_MaxLines, sizeof(sal_Char *)); +pProfile->m_Lines = (sal_Char **)calloc(pProfile->m_MaxLines, sizeof(sal_Char *)); } else { @@ -1625,7 +1625,7 @@ static const sal_Char* insertLine(osl_TProfileImpl* pProfile, const sal_Char* Li if (pProfile->m_Lines == NULL) { pProfile->m_MaxLines = LINES_INI; -pProfile->m_Lines = calloc(pProfile->m_MaxLines, sizeof(sal_Char *)); +pProfile->m_Lines = (sal_Char **)calloc(pProfile->m_MaxLines, sizeof(sal_Char *)); } else { @@ -1799,7 +1799,7 @@ static sal_Bool addSection(osl_TProfileImpl* pProfile, int Line, const sal_Char* if (pProfile->m_Sections == NULL) { pProfile->m_MaxSections = SECTIONS_INI; -pProfile->m_Sections = calloc(pProfile->m_MaxSections, sizeof(osl_TProfileSection)); +pProfile->m_Sections = (osl_TProfileSection *)calloc(pProfile->m_MaxSections, sizeof(osl_TProfileSection)); } else { commit d52c7f2946fe867b89057796a4b109c7ef95c73a Author: Pedro Giffuni Date: Wed Oct 7 20:30:12 2015 + FreeBSD: Small cleanup and enhancement. Reviewed by:Don Lewis diff --git a/sal/osl/unx/backtrace.h b/sal/osl/unx/backtrace.h index c836ee0..29bf3e0 100644 --- a/sal/osl/unx/backtrace.h +++ b/sal/osl/unx/backtrace.h @@ -22,7 +22,7 @@ -#if defined (SOLARIS) || (FREEBSD) +#if defined (FREEBSD) || defined (SOLARIS) #ifdef __cplusplus extern "C" { diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index f7aff4c..31373b0 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -1085,7 +1085,7 @@ SAL_CALL osl_mapFile ( // OS simultaneously pages in the rest); on other platforms, it remains // to be evaluated whether madvise or equivalent is available and // actually useful: -#if defined MACOSX +#if defined (FREEBSD) || defined (MACOSX) int e = posix_madvise(p, nLength, POSIX_MADV_WILLNEED); if (e != 0) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sal/osl
sal/osl/os2/module.c | 187 +++ 1 file changed, 100 insertions(+), 87 deletions(-) New commits: commit 48eb121f9925583304f59cee2a1f217257f970d5 Author: Yuri Dario Date: Sat Feb 22 15:17:20 2014 + #i118923# OS/2 port, ignore ENOENT errors on dlopen() failure. diff --git a/sal/osl/os2/module.c b/sal/osl/os2/module.c index efd6719..ee6dd26 100644 --- a/sal/osl/os2/module.c +++ b/sal/osl/os2/module.c @@ -73,7 +73,6 @@ oslModule SAL_CALL osl_loadAsciiModule(const sal_Char *pszModuleName, sal_Int32 char buffer[PATH_MAX]; char* dot; void* hModule; -oslModule pModule = NULL; if (!pszModuleName) return NULL; @@ -102,25 +101,32 @@ oslModule SAL_CALL osl_loadAsciiModule(const sal_Char *pszModuleName, sal_Int32 hModule = dlopen( buffer, RTLD_LOCAL); if (hModule != NULL) -pModule = (oslModule)hModule; -else -{ -sal_Char szError[ PATH_MAX*2 ]; -sprintf( szError, "Module: %s;\n error: %s;\n\n" - "Please contact technical support and report above informations.\n\n", - buffer, dlerror() ); +return (oslModule)hModule; + +// do not show in case rc=2 ENOENT, we must parse dlerror +// string to detect it +char* err = dlerror(); +if (!err) +return NULL; + +if (strstr( err, "rc=2") != NULL) +return NULL; + +sal_Char szError[ PATH_MAX*2 ]; +sprintf( szError, "Module: %s;\n error: %s;\n\n" + "Please contact technical support and report above informations.\n\n", + buffer, err); #if OSL_DEBUG_LEVEL>0 -debug_printf("osl_loadModule error %s", szError); +debug_printf("osl_loadModule error %s", szError); #endif #if (OSL_DEBUG_LEVEL==0) || !defined(OSL_DEBUG_LEVEL) -WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, - szError, "Critical error: DosLoadModule failed", - 0, MB_ERROR | MB_OK | MB_MOVEABLE); +WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, + szError, "Critical error: DosLoadModule failed", + 0, MB_ERROR | MB_OK | MB_MOVEABLE); #endif -} -return pModule; +return NULL; } /*/ commit 28f97ab153a3226a5206a53937849bcc287682da Author: Yuri Dario Date: Sat Feb 22 14:29:08 2014 + #i118923# OS/2 port, report correct error string in case of dlopen() failure, rewrote code to use more dl* functions. diff --git a/sal/osl/os2/module.c b/sal/osl/os2/module.c index d383db8..efd6719 100644 --- a/sal/osl/os2/module.c +++ b/sal/osl/os2/module.c @@ -22,8 +22,6 @@ -#include "system.h" - #include #include #include @@ -32,105 +30,96 @@ #include #include -int UnicodeToText(char *, size_t, const sal_Unicode *, sal_Int32); +#include "system.h" -// static data for holding SAL dll module and full path -static HMODULE hModSal; -static char szSalDir[ _MAX_PATH]; -static char szSalDrive[ _MAX_PATH]; +/* implemented in file.cxx */ +int UnicodeToText(char *, size_t, const sal_Unicode *, sal_Int32); /*/ /* osl_loadModule */ /*/ -ULONG APIENTRY _DosLoadModule (PSZ pszObject, ULONG uObjectLen, PCSZ pszModule, -PHMODULE phmod) -{ -APIRET rc; -rc = DosLoadModule( pszObject, uObjectLen, pszModule, phmod); -// YD 22/05/06 issue again if first call fails (why?) -if (rc == ERROR_INVALID_PARAMETER) -rc = DosLoadModule( pszObject, uObjectLen, pszModule, phmod); -return rc; -} - -oslModule SAL_CALL osl_loadAsciiModule( const sal_Char* pModuleName, sal_Int32 nRtldMode ) -{ -rtl_uString* pUniName = NULL; -rtl_uString_newFromAscii( &pUniName, pModuleName ); -oslModule aModule = osl_loadModule( pUniName, nRtldMode ); -rtl_uString_release( pUniName ); -return aModule; -} - oslModule SAL_CALL osl_loadModule(rtl_uString *ustrModuleName, sal_Int32 nRtldMode) { -HMODULE hModule; -BYTE szErrorMessage[256]; -APIRET rc; oslModule pModule=0; rtl_uString* ustrTmp = NULL; OSL_ENSURE(ustrModuleName,"osl_loadModule : string is not valid"); /* ensure ustrTmp hold valid string */ -if( osl_File_E_None != osl_getSystemPathFromFileURL( ustrModuleName, &ustrTmp ) ) -rtl_uString_assign( &ustrTmp, ustrModuleName ); +if (osl_File_E_None != osl_getSystemPathFromFileURL(ustrModuleName, &ustrTmp)) +rtl_uString_assign(&ustrTmp, ustrModuleName); -if( ustrTmp ) +if (ustrTmp) { char buffer[PATH_MAX]; -if( UnicodeToText( buffer, PATH_MAX, ustrTmp->buffer, ustrTmp->length ) ) -{ -char drive[_MAX_DRIVE], dir[_MAX_DIR]; -char fname[_MAX_FNAME], ext[_MAX_EXT]; -char* dot; -// 21/02/2