diff options
-rw-r--r-- | cppuhelper/source/tdmgr.cxx | 34 | ||||
-rw-r--r-- | jurt/com/sun/star/lib/uno/protocols/urp/Cache.java | 2 | ||||
-rw-r--r-- | jurt/prj/build.lst | 1 | ||||
-rw-r--r-- | jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java | 100 | ||||
-rw-r--r-- | jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java | 17 | ||||
-rw-r--r-- | jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java | 45 | ||||
-rw-r--r-- | jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk | 9 | ||||
-rw-r--r-- | offapi/com/sun/star/awt/grid/UnoControlGridModel.idl | 2 | ||||
-rw-r--r-- | sal/inc/sal/types.h | 2 | ||||
-rw-r--r-- | sal/osl/all/makefile.mk | 6 | ||||
-rw-r--r-- | sal/osl/all/printtrace.cxx | 65 | ||||
-rw-r--r-- | sal/osl/inc/printtrace.h | 46 | ||||
-rw-r--r-- | sal/osl/os2/diagnose.c | 26 | ||||
-rw-r--r-- | sal/osl/unx/diagnose.c | 32 | ||||
-rwxr-xr-x[-rw-r--r--] | sal/osl/w32/diagnose.c | 37 | ||||
-rw-r--r-- | sal/systools/win32/uwinapi/ResolveUnicows.cpp | 5 |
16 files changed, 272 insertions, 157 deletions
diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx index 903e9b0bf..7135a168d 100644 --- a/cppuhelper/source/tdmgr.cxx +++ b/cppuhelper/source/tdmgr.cxx @@ -27,6 +27,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cppuhelper.hxx" + +#include "sal/config.h" + +#include <vector> + #include <sal/alloca.h> #include <osl/diagnose.h> @@ -45,7 +50,7 @@ #include <com/sun/star/reflection/XEnumTypeDescription.hpp> #include <com/sun/star/reflection/XIndirectTypeDescription.hpp> #include <com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp> -#include <com/sun/star/reflection/XInterfaceAttributeTypeDescription.hpp> +#include <com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp> #include <com/sun/star/reflection/XMethodParameter.hpp> #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp> #include <com/sun/star/reflection/XInterfaceTypeDescription2.hpp> @@ -302,7 +307,7 @@ inline static typelib_TypeDescription * createCTD( } //================================================================================================== inline static typelib_TypeDescription * createCTD( - const Reference< XInterfaceAttributeTypeDescription > & xAttribute ) + const Reference< XInterfaceAttributeTypeDescription2 > & xAttribute ) { typelib_TypeDescription * pRet = 0; if (xAttribute.is()) @@ -310,14 +315,31 @@ inline static typelib_TypeDescription * createCTD( OUString aMemberName( xAttribute->getName() ); Reference< XTypeDescription > xType( xAttribute->getType() ); OUString aMemberTypeName( xType->getName() ); - - typelib_typedescription_newInterfaceAttribute( + std::vector< rtl_uString * > getExc; + Sequence< Reference< XCompoundTypeDescription > > getExcs( + xAttribute->getGetExceptions() ); + for (sal_Int32 i = 0; i != getExcs.getLength(); ++i) + { + OSL_ASSERT( getExcs[i].is() ); + getExc.push_back( getExcs[i]->getName().pData ); + } + std::vector< rtl_uString * > setExc; + Sequence< Reference< XCompoundTypeDescription > > setExcs( + xAttribute->getSetExceptions() ); + for (sal_Int32 i = 0; i != setExcs.getLength(); ++i) + { + OSL_ASSERT( setExcs[i].is() ); + setExc.push_back( setExcs[i]->getName().pData ); + } + typelib_typedescription_newExtendedInterfaceAttribute( (typelib_InterfaceAttributeTypeDescription **)&pRet, xAttribute->getPosition(), aMemberName.pData, // name (typelib_TypeClass)xType->getTypeClass(), aMemberTypeName.pData, // type name - xAttribute->isReadOnly() ); + xAttribute->isReadOnly(), + getExc.size(), getExc.empty() ? 0 : &getExc[0], + setExc.size(), setExc.empty() ? 0 : &setExc[0] ); } return pRet; } @@ -643,7 +665,7 @@ static typelib_TypeDescription * createCTD( pRet = createCTD( Reference< XInterfaceMethodTypeDescription >::query( xType ) ); break; case TypeClass_INTERFACE_ATTRIBUTE: - pRet = createCTD( Reference< XInterfaceAttributeTypeDescription >::query( xType ) ); + pRet = createCTD( Reference< XInterfaceAttributeTypeDescription2 >::query( xType ) ); break; default: break; diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java index 437b20062..ad4bdbcc1 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java @@ -52,7 +52,7 @@ final class Cache { if (e == null) { if (map.size() < maxSize) { // There is still room for a new entry at the front: - e = new Entry(content, map.size(), last, null); + e = new Entry(content, map.size(), null, first); if (first == null) { last = e; } else { diff --git a/jurt/prj/build.lst b/jurt/prj/build.lst index 9b9b722bc..6ba92a9ec 100644 --- a/jurt/prj/build.lst +++ b/jurt/prj/build.lst @@ -17,3 +17,4 @@ ju jurt\com\sun\star\comp\urlresolver nmake - all ju_urlres ju_co_loader NULL ju jurt\source\pipe nmake - all ju_src_pipe NULL ju jurt\source\pipe\wrapper nmake - w ju_src_pipe_wrapper NULL ju jurt\util nmake - all ju_ut ju_brid_jrm ju_co_bfactr ju_con ju_con_sock ju_con_pipe ju_cssl_uno ju_env_java ju_prot_urp ju_servman ju_urlres ju_src_pipe ju_libutil ju_uno NULL +ju jurt\test\com\sun\star\lib\uno\protocols\urp nmake - all ju_test_css_lib_uno_protocols_urp NULL diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java index 650b65f0e..a82c1aecc 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java @@ -27,80 +27,114 @@ package com.sun.star.lib.uno.protocols.urp; -import complexlib.ComplexTestCase; +import org.junit.Test; +import static org.junit.Assert.*; -public final class Cache_Test extends ComplexTestCase { - public String[] getTestMethodNames() { - return new String[] { "test0", "test1", "test2", "test3" }; - } - - public void test0() { +public final class Cache_Test { + @Test public void test0() { Cache c = new Cache(0); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assure("1", i == Cache.NOT_CACHED && !f[0]); + assertTrue(i == Cache.NOT_CACHED && !f[0]); i = c.add(f, "a"); - assure("2", i == Cache.NOT_CACHED && !f[0]); + assertTrue(i == Cache.NOT_CACHED && !f[0]); i = c.add(f, "b"); - assure("3", i == Cache.NOT_CACHED && !f[0]); + assertTrue(i == Cache.NOT_CACHED && !f[0]); i = c.add(f, "a"); - assure("4", i == Cache.NOT_CACHED && !f[0]); + assertTrue(i == Cache.NOT_CACHED && !f[0]); } - public void test1() { + @Test public void test1() { Cache c = new Cache(1); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assure("1", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); i = c.add(f, "a"); - assure("2", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "b"); - assure("3", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); i = c.add(f, "b"); - assure("4", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "a"); - assure("5", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); } - public void test2() { + @Test public void test2() { Cache c = new Cache(2); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assure("1", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); i = c.add(f, "a"); - assure("2", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "b"); - assure("3", i == 1 && !f[0]); + assertTrue(i == 1 && !f[0]); i = c.add(f, "b"); - assure("4", i == 1 && f[0]); + assertTrue(i == 1 && f[0]); i = c.add(f, "a"); - assure("5", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "c"); - assure("6", i == 1 && !f[0]); + assertTrue(i == 1 && !f[0]); i = c.add(f, "b"); - assure("7", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); } - public void test3() { + @Test public void test3() { Cache c = new Cache(3); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assure("1", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); i = c.add(f, "a"); - assure("3", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "b"); - assure("5", i == 1 && !f[0]); + assertTrue(i == 1 && !f[0]); i = c.add(f, "a"); - assure("3", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "c"); - assure("7", i == 2 && !f[0]); + assertTrue(i == 2 && !f[0]); i = c.add(f, "d"); - assure("9", i == 1 && !f[0]); + assertTrue(i == 1 && !f[0]); i = c.add(f, "d"); - assure("11", i == 1 && f[0]); + assertTrue(i == 1 && f[0]); + } + + @Test public void testNothingLostFromLruList() { + // Regardless in what order arbitrary values from 0, ..., 3 are inserted + // into a size-4 cache, afterwards adding -1, ..., -4 must return each + // possible index in the range from 0, ..., 3 exactly once (so their sum + // must be 6); this code systematically tests all such arbitrary ways up + // to length 8 (the code arguably violates recommendations for writing + // good tests, but actually helped track down an error in the Cache + // implementation): + int[] a = new int[8]; + for (int i = 0; i < a.length; ++i) { + for (int j = 0; j < i; ++j) { + a[j] = 0; + } + for (;;) { + Cache c = new Cache(4); + for (int k = 0; k < i; ++k) { + c.add(new boolean[1], a[k]); + } + assertEquals( + 6, + (c.add(new boolean[1], -1) + c.add(new boolean[1], -2) + + c.add(new boolean[1], -3) + c.add(new boolean[1], -4))); + int j = i - 1; + while (j >= 0 && a[j] == 3) { + --j; + } + if (j < 0) { + break; + } + ++a[j]; + for (int k = j + 1; k < i; ++k) { + a[k] = 0; + } + } + } } } diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java index 20bc5bca3..edd567c50 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java @@ -32,21 +32,14 @@ import com.sun.star.uno.IBridge; import com.sun.star.uno.Type; import com.sun.star.uno.TypeClass; import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import org.junit.Test; +import static org.junit.Assert.*; -public final class Marshaling_Test extends ComplexTestCase { - public String getTestObjectName() { - return getClass().getName(); - } - - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { +public final class Marshaling_Test { + @Test public void test() throws Exception { short cacheSize = (short)256; TestBridge testBridge = new TestBridge(); Marshal marshal = new Marshal(testBridge, cacheSize); @@ -239,7 +232,7 @@ public final class Marshaling_Test extends ComplexTestCase { if(op1 instanceof Any) op1 = ((Any)op1).getObject(); - assure("", compareObjects(op1, op2)); + assertTrue(compareObjects(op1, op2)); } } diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java index d9da63b5a..3da9c9f3a 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java @@ -34,20 +34,17 @@ import com.sun.star.uno.Any; import com.sun.star.uno.IBridge; import com.sun.star.uno.Type; import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PipedInputStream; import java.io.PipedOutputStream; import java.util.LinkedList; +import org.junit.Test; +import static org.junit.Assert.*; -public final class Protocol_Test extends ComplexTestCase { - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { +public final class Protocol_Test { + @Test public void test() throws Exception { IBridge iBridge = new TestBridge(); PipedInputStream inA = new PipedInputStream(); PipedOutputStream outA = new PipedOutputStream(inA); @@ -93,7 +90,7 @@ public final class Protocol_Test extends ComplexTestCase { new Object[] { "hallo" }); Message iMessage = iReceiver.readMessage(); Object[] t_params = iMessage.getArguments(); - assure("", "hallo".equals((String)t_params[0])); + assertEquals("hallo", (String)t_params[0]); // send a reply iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null); @@ -118,7 +115,7 @@ public final class Protocol_Test extends ComplexTestCase { iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null); iSender.readMessage(); - assure("", "testString".equals(((String [])params[0])[0])); + assertEquals("testString", ((String [])params[0])[0]); } public void testCallWithInOutParameter( @@ -133,7 +130,7 @@ public final class Protocol_Test extends ComplexTestCase { Object[] t_params = iMessage.getArguments(); - assure("", "inString".equals(((String [])t_params[0])[0])); + assertEquals("inString", ((String [])t_params[0])[0]); // provide reply ((String [])t_params[0])[0] = "outString"; @@ -142,7 +139,7 @@ public final class Protocol_Test extends ComplexTestCase { iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null); iSender.readMessage(); - assure("", "outString".equals(((String [])params[0])[0])); + assertEquals("outString", ((String [])params[0])[0]); } public void testCallWithResult( @@ -161,7 +158,7 @@ public final class Protocol_Test extends ComplexTestCase { Message iMessage = iSender.readMessage(); Object result = iMessage.getResult(); - assure("", "resultString".equals(result)); + assertEquals("resultString", result); } public void testCallWhichRaisesException( @@ -181,7 +178,7 @@ public final class Protocol_Test extends ComplexTestCase { Object result = iMessage.getResult(); - assure("", result instanceof com.sun.star.uno.RuntimeException); + assertTrue(result instanceof com.sun.star.uno.RuntimeException); } public void testCallWithIn_Out_InOut_Paramters_and_result( @@ -196,9 +193,9 @@ public final class Protocol_Test extends ComplexTestCase { Object[] t_params = iMessage.getArguments(); - assure("", "hallo".equals((String)t_params[0])); + assertEquals("hallo", (String)t_params[0]); - assure("", "inOutString".equals(((String [])t_params[2])[0])); + assertEquals("inOutString", ((String [])t_params[2])[0]); ((String [])t_params[1])[0] = "outString"; ((String [])t_params[2])[0] = "inOutString_res"; @@ -209,11 +206,11 @@ public final class Protocol_Test extends ComplexTestCase { iMessage = iSender.readMessage(); Object result = iMessage.getResult(); - assure("", "outString".equals(((String [])params[1])[0])); + assertEquals("outString", ((String [])params[1])[0]); - assure("", "inOutString_res".equals(((String [])params[2])[0])); + assertEquals("inOutString_res", ((String [])params[2])[0]); - assure("", "resultString".equals(result)); + assertEquals("resultString", result); } public void testCallWhichReturnsAny( @@ -229,9 +226,11 @@ public final class Protocol_Test extends ComplexTestCase { false, new ThreadId(new byte[] { 0, 1 }), Any.VOID); Message iMessage = iSender.readMessage(); Object result = iMessage.getResult(); - assure("", result instanceof Any - && (TypeDescription.getTypeDescription(((Any) result).getType()). - getZClass() == void.class)); + assertTrue( + result instanceof Any && + ((TypeDescription.getTypeDescription(((Any) result).getType()). + getZClass()) == + void.class)); // send an ordinary request iSender.writeRequest( @@ -244,7 +243,7 @@ public final class Protocol_Test extends ComplexTestCase { new Any(XInterface.class, null)); iMessage = iSender.readMessage(); result = iMessage.getResult(); - assure("", result == null); + assertNull(result); // send an ordinary request iSender.writeRequest( @@ -256,7 +255,7 @@ public final class Protocol_Test extends ComplexTestCase { false, new ThreadId(new byte[] { 0, 1 }), new Integer(501)); iMessage = iSender.readMessage(); result = iMessage.getResult(); - assure("", result.equals(new Integer(501))); + assertEquals(501, result); } private static final class Endpoint { diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk b/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk index c6e66558b..8403b2bd7 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk @@ -24,10 +24,16 @@ # for a copy of the LGPLv3 License. # #************************************************************************* + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + PRJ := ..$/..$/..$/..$/..$/..$/..$/.. PRJNAME := jurt TARGET := test_com_sun_star_lib_uno_protocols_urp +.IF "$(OOO_JUNIT_JAR)" != "" PACKAGE := com$/sun$/star$/lib$/uno$/protocols$/urp JAVATESTFILES := \ Cache_Test.java \ @@ -38,5 +44,8 @@ JAVAFILES := \ TestObject.java JARFILES := ridl.jar IDLTESTFILES := interfaces.idl +.END .INCLUDE: javaunittest.mk + +.END diff --git a/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl b/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl index ce2c8d5eb..b61d8b568 100644 --- a/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl +++ b/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl @@ -80,7 +80,7 @@ service UnoControlGridModel <p>You can implement your own instance of <type>XGridDataModel</type> or use the <type>DefaultGridDataModel</type>. */ - [property] XGridDataModel DataModel; + [property] XGridDataModel GridDataModel; /** Specifies the vertical scrollbar mode. <p>The default value is <FALSE/></p> diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h index 5a4e8485f..82c7c55ce 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 0d105906e..5da61e8b2 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 000000000..5d79d9b1d --- /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 000000000..9e1d514b0 --- /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 32e00db76..eabb3eae5 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 e98910da9..07341e1ec 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 129f579c4..97fe8d275 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 3a8e8cdbb..3077e925b 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) ) |