summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/sal/types.h2
-rw-r--r--sal/osl/all/makefile.mk6
-rw-r--r--sal/osl/all/printtrace.cxx65
-rw-r--r--sal/osl/inc/printtrace.h46
-rw-r--r--sal/osl/os2/diagnose.c26
-rw-r--r--sal/osl/unx/diagnose.c32
-rwxr-xr-x[-rw-r--r--]sal/osl/w32/diagnose.c37
-rw-r--r--sal/systools/win32/uwinapi/ResolveUnicows.cpp5
8 files changed, 138 insertions, 81 deletions
diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index 14c24480d98b..2db057b2fa12 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -291,7 +291,7 @@ typedef void * sal_Handle;
These macros are used for inline declarations of exception classes, as in
rtl/malformeduriexception.hxx.
*/
-#if defined __GNUC__
+#if defined(__GNUC__) && ! defined(__MINGW32__)
#define SAL_EXCEPTION_DLLPUBLIC_EXPORT SAL_DLLPUBLIC_EXPORT
#define SAL_EXCEPTION_DLLPRIVATE SAL_DLLPRIVATE
#else
diff --git a/sal/osl/all/makefile.mk b/sal/osl/all/makefile.mk
index 0d105906effb..5da61e8b2ec3 100644
--- a/sal/osl/all/makefile.mk
+++ b/sal/osl/all/makefile.mk
@@ -55,7 +55,8 @@ SLOFILES= \
$(SLO)$/utility.obj\
$(SLO)$/filepath.obj\
$(SLO)$/debugbase.obj\
- $(SLO)$/loadmodulerelative.obj
+ $(SLO)$/loadmodulerelative.obj \
+ $(SLO)/printtrace.obj
# $(SLO)$/readline.obj\
@@ -64,7 +65,8 @@ OBJFILES= \
$(OBJ)$/utility.obj\
$(OBJ)$/filepath.obj\
$(OBJ)$/debugbase.obj\
- $(OBJ)$/loadmodulerelative.obj
+ $(OBJ)$/loadmodulerelative.obj \
+ $(OBJ)/printtrace.obj
# $(OBJ)$/readline.obj\
#.ENDIF
diff --git a/sal/osl/all/printtrace.cxx b/sal/osl/all/printtrace.cxx
new file mode 100644
index 000000000000..5d79d9b1de5a
--- /dev/null
+++ b/sal/osl/all/printtrace.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "precompiled_sal.hxx"
+
+#include "sal/config.h"
+
+#include <cstdarg>
+#include <cstdio>
+#include <cstring>
+
+#include <stdio.h> // snprintf, vsnprintf
+
+#include "osl/diagnose.h"
+#include "osl/thread.hxx"
+#include "rtl/string.h"
+#include "sal/types.h"
+
+#include "printtrace.h"
+
+void printTrace(unsigned long pid, char const * format, std::va_list arguments)
+{
+ char buf[1024];
+ int n1 = snprintf(
+ buf, sizeof buf, "Trace %lu/%" SAL_PRIuUINT32 ": \"", pid,
+ osl::Thread::getCurrentIdentifier());
+ OSL_ASSERT(
+ n1 >= 0 &&
+ (static_cast< unsigned int >(n1) <
+ sizeof buf - RTL_CONSTASCII_LENGTH("\"...\n")));
+ int n2 = sizeof buf - n1 - RTL_CONSTASCII_LENGTH("\"...\n");
+ int n3 = vsnprintf(buf + n1, n2, format, arguments);
+ if (n3 < 0) {
+ std::strcpy(buf + n1, "\"???\n");
+ } else if (n3 < n2) {
+ std::strcpy(buf + n1 + n3, "\"\n");
+ } else {
+ std::strcpy(buf + n1 + n2 - 1, "\"...\n");
+ }
+ std::fputs(buf, stderr);
+}
diff --git a/sal/osl/inc/printtrace.h b/sal/osl/inc/printtrace.h
new file mode 100644
index 000000000000..9e1d514b0d08
--- /dev/null
+++ b/sal/osl/inc/printtrace.h
@@ -0,0 +1,46 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_SAL_OSL_INC_PRINTTRACE_H
+#define INCLUDED_SAL_OSL_INC_PRINTTRACE_H
+
+#include "sal/config.h"
+
+#include <stdarg.h>
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+/* called internally by osl_trace */
+void printTrace(unsigned long pid, char const * format, va_list arguments);
+
+#if defined __cplusplus
+}
+#endif
+
+#endif
diff --git a/sal/osl/os2/diagnose.c b/sal/osl/os2/diagnose.c
index 4921e20fd5af..b105e0b78c29 100644
--- a/sal/osl/os2/diagnose.c
+++ b/sal/osl/os2/diagnose.c
@@ -35,6 +35,8 @@
#include <osl/diagnose.h>
#include <osl/thread.h>
+#include "printtrace.h"
+
BYTE oslTraceEnv[] = "OSL_TRACE_TO_FILE";
typedef pfunc_osl_printDebugMessage oslDebugMessageFunc;
@@ -53,29 +55,11 @@ void SAL_CALL osl_breakDebug()
/************************************************************************/
/* osl_trace */
/************************************************************************/
-/* comment this define to stop output thread identifier*/
-#define OSL_TRACE_THREAD 1
-void SAL_CALL osl_trace (
- const sal_Char* lpszFormat, ...)
-{
+void osl_trace(char const * pszFormat, ...) {
va_list args;
-
-#if defined(OSL_PROFILING)
- fprintf(stderr, "Time: %06lu : ", osl_getGlobalTimer() );
-#else
-#if defined(OSL_TRACE_THREAD)
- fprintf(stderr,"Thread: %6d :",osl_getThreadIdentifier(NULL));
-#else
- fprintf(stderr, "Trace Message: ");
-#endif
-#endif
-
- va_start(args, lpszFormat);
- vfprintf(stderr, lpszFormat, args);
+ va_start(args, pszFormat);
+ printTrace(0, pszFormat, args); /* TODO: pid */
va_end(args);
-
- fprintf(stderr,"\n");
- fflush(stderr);
}
/*----------------------------------------------------------------------------*/
diff --git a/sal/osl/unx/diagnose.c b/sal/osl/unx/diagnose.c
index bb8cbca406bd..02967b3ad7f7 100644
--- a/sal/osl/unx/diagnose.c
+++ b/sal/osl/unx/diagnose.c
@@ -28,7 +28,6 @@
#include "osl/diagnose.h"
#include "system.h"
-
#ifndef HAVE_DLFCN_H
#if defined(LINUX) || defined(SOLARIS)
@@ -58,6 +57,8 @@
#define INCLUDED_STDDEF_H
#endif
+#include "printtrace.h"
+
/************************************************************************/
/* Internal data structures and functions */
/************************************************************************/
@@ -301,32 +302,9 @@ pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc (
/************************************************************************/
/* osl_trace */
/************************************************************************/
-/* comment this define to stop output thread identifier*/
-#define OSL_TRACE_THREAD 1
-void SAL_CALL osl_trace (
- const sal_Char* lpszFormat, ...)
-{
+void osl_trace(char const * pszFormat, ...) {
va_list args;
-
-#if defined(OSL_PROFILING)
- fprintf(stderr, "Time: %06lu : ", osl_getGlobalTimer() );
-#else
-#if defined(OSL_TRACE_THREAD)
- fprintf(
- stderr, "Thread: %6lu :",
- SAL_INT_CAST(unsigned long, osl_getThreadIdentifier(NULL)));
-#else
- fprintf(stderr, "Trace Message: ");
-#endif
-#endif
-
- va_start(args, lpszFormat);
- vfprintf(stderr, lpszFormat, args);
+ va_start(args, pszFormat);
+ printTrace((unsigned long) getpid(), pszFormat, args);
va_end(args);
-
- fprintf(stderr,"\n");
- fflush(stderr);
}
-
-/************************************************************************/
-
diff --git a/sal/osl/w32/diagnose.c b/sal/osl/w32/diagnose.c
index b46bff44b73c..9c75e4502743 100644..100755
--- a/sal/osl/w32/diagnose.c
+++ b/sal/osl/w32/diagnose.c
@@ -32,6 +32,8 @@
#include <osl/diagnose.h>
#include <osl/thread.h>
+#include "printtrace.h"
+
#define NO_DEBUG_CRT
static pfunc_osl_printDebugMessage _pPrintDebugMessage = NULL;
@@ -61,46 +63,21 @@ void SAL_CALL osl_breakDebug(void)
DebugBreak();
}
-
-
-/* Uncomment this define to get profiling time output */
-/* #define OSL_PROFILING */
-/* comment this define to stop output thread identifier*/
-#define OSL_TRACE_THREAD 1
-void SAL_CALL osl_trace(const sal_Char* lpszFormat, ...)
-{
+void osl_trace(char const * pszFormat, ...) {
va_list args;
- int written = 0;
-
- va_start(args, lpszFormat);
-
-#if defined(OSL_PROFILING)
- fprintf(stderr, "time : %06lu : ", osl_getGlobalTimer() );
-#else
-#if defined(OSL_TRACE_THREAD)
- fprintf(stderr,"Thread: %6d :",osl_getThreadIdentifier(NULL));
-#else
- fprintf(stderr,"Trace Message : ");
-#endif
-#endif
-
+ va_start(args, pszFormat);
if ( IsDebuggerPresent() )
{
sal_Char szMessage[512];
- written = _vsnprintf( szMessage, sizeof(szMessage) - 2, lpszFormat, args );
+ int written = _vsnprintf(
+ szMessage, sizeof(szMessage) - 2, pszFormat, args );
if ( written == -1 )
written = sizeof(szMessage) - 2;
szMessage[ written++ ] = '\n';
szMessage[ written ] = 0;
OutputDebugString( szMessage );
}
-
- vfprintf(stderr,lpszFormat, args);
-
- fprintf(stderr,"\n");
-
- fflush(stderr);
-
+ printTrace((unsigned long) _getpid(), pszFormat, args);
va_end(args);
}
diff --git a/sal/systools/win32/uwinapi/ResolveUnicows.cpp b/sal/systools/win32/uwinapi/ResolveUnicows.cpp
index cd5943004f17..d2864d3413cb 100644
--- a/sal/systools/win32/uwinapi/ResolveUnicows.cpp
+++ b/sal/systools/win32/uwinapi/ResolveUnicows.cpp
@@ -1,6 +1,7 @@
#ifdef __MINGW32__
#define _GDI32_
#include "macros.h"
+#include <w32api.h>
#include <multimon.h>
extern "C" {
extern HMODULE hModuleUnicowsDLL;
@@ -461,7 +462,11 @@ DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, UpdateResourceW, (HANDLE,LPCWSTR,L
DEFINE_UNICOWS_THUNK( version, DWORD, WINAPI, VerFindFileW, (DWORD,LPWSTR,LPWSTR,LPWSTR,LPWSTR,PUINT,LPWSTR,PUINT) )
DEFINE_UNICOWS_THUNK( version, DWORD, WINAPI, VerInstallFileW, (DWORD,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,PUINT) )
DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, VerLanguageNameW, (DWORD,LPWSTR,DWORD) )
+#if ( __W32API_MAJOR_VERSION > 3 ) || ( __W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION > 13 )
+DEFINE_UNICOWS_THUNK( version, BOOL, WINAPI, VerQueryValueW, (const LPVOID,LPCWSTR,LPVOID*,PUINT) )
+#else
DEFINE_UNICOWS_THUNK( version, BOOL, WINAPI, VerQueryValueW, (const LPVOID,LPWSTR,LPVOID*,PUINT) )
+#endif
DEFINE_UNICOWS_THUNK( user32, SHORT, WINAPI, VkKeyScanExW, (WCHAR,HKL) )
DEFINE_UNICOWS_THUNK( user32, SHORT, WINAPI, VkKeyScanW, (WCHAR) )
DEFINE_UNICOWS_THUNK( user32, DWORD, WINAPI, SetupDecompressOrCopyFileW, (PCWSTR,PCWSTR,PUINT) )