diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2011-03-25 10:56:55 +0100 |
---|---|---|
committer | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2011-03-25 10:56:55 +0100 |
commit | ee3a40319a4f8a03cfb8e4b2dcb2df9c45b387c0 (patch) | |
tree | 7287a0e7db373a3ab4d7a7d17e16a5a986de18c2 | |
parent | dr80: #i117511# remove some assertions in xlsx/xlsb import filters (diff) | |
parent | CWS-TOOLING: integrate CWS tkr38 (diff) | |
download | core-ee3a40319a4f8a03cfb8e4b2dcb2df9c45b387c0.tar.gz core-ee3a40319a4f8a03cfb8e4b2dcb2df9c45b387c0.zip |
dr80: rebase to DEV300_m104
-rw-r--r-- | cppu/source/typelib/typelib.cxx | 14 | ||||
-rw-r--r-- | io/source/TextInputStream/TextInputStream.cxx | 4 | ||||
-rw-r--r-- | offapi/com/sun/star/security/CertAltNameEntry.idl | 59 | ||||
-rw-r--r-- | offapi/com/sun/star/security/ExtAltNameType.idl | 110 | ||||
-rw-r--r-- | offapi/com/sun/star/security/XSanExtension.idl | 57 | ||||
-rw-r--r-- | offapi/com/sun/star/security/makefile.mk | 8 | ||||
-rw-r--r-- | offapi/com/sun/star/sheet/DataPilotDescriptor.idl | 17 | ||||
-rw-r--r-- | sal/cppunittester/cppunittester.cxx | 102 | ||||
-rw-r--r-- | sal/inc/cppunittester/protectorfactory.hxx | 45 | ||||
-rw-r--r-- | sal/osl/os2/diagnose.c | 3 | ||||
-rw-r--r-- | sal/osl/unx/diagnose.c | 14 | ||||
-rwxr-xr-x | sal/osl/w32/diagnose.c | 50 | ||||
-rw-r--r-- | sal/osl/w32/file_dirvol.cxx | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | sal/osl/w32/module.cxx | 23 | ||||
-rwxr-xr-x[-rw-r--r--] | sal/osl/w32/procimpl.cxx | 35 | ||||
-rw-r--r-- | sal/prj/d.lst | 2 |
16 files changed, 484 insertions, 63 deletions
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index aa0d18589a89..935a64397505 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -330,20 +330,6 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) delete pWeakMap; pWeakMap = 0; } -#if OSL_DEBUG_LEVEL > 1 - OSL_ASSERT( nTypeDescriptionCount == 0 ); - OSL_ASSERT( nCompoundTypeDescriptionCount == 0 ); - OSL_ASSERT( nUnionTypeDescriptionCount == 0 ); - OSL_ASSERT( nIndirectTypeDescriptionCount == 0 ); - OSL_ASSERT( nArrayTypeDescriptionCount == 0 ); - OSL_ASSERT( nEnumTypeDescriptionCount == 0 ); - OSL_ASSERT( nInterfaceMethodTypeDescriptionCount == 0 ); - OSL_ASSERT( nInterfaceAttributeTypeDescriptionCount == 0 ); - OSL_ASSERT( nInterfaceTypeDescriptionCount == 0 ); - OSL_ASSERT( nTypeDescriptionReferenceCount == 0 ); - - OSL_ASSERT( !pCallbacks || pCallbacks->empty() ); -#endif delete pCallbacks; pCallbacks = 0; diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx index bb91337fc40a..5829fe43cce3 100644 --- a/io/source/TextInputStream/TextInputStream.cxx +++ b/io/source/TextInputStream/TextInputStream.cxx @@ -171,10 +171,10 @@ OUString OTextInputStream::readLine( ) return implReadString( aDummySeq, sal_True, sal_True ); } -OUString OTextInputStream::readString( const Sequence< sal_Unicode >& Delimiters, sal_Bool ) +OUString OTextInputStream::readString( const Sequence< sal_Unicode >& Delimiters, sal_Bool bRemoveDelimiter ) throw(IOException, RuntimeException) { - return implReadString( Delimiters, sal_True, sal_False ); + return implReadString( Delimiters, bRemoveDelimiter, sal_False ); } sal_Bool OTextInputStream::isEOF() diff --git a/offapi/com/sun/star/security/CertAltNameEntry.idl b/offapi/com/sun/star/security/CertAltNameEntry.idl new file mode 100644 index 000000000000..1ef827b77f89 --- /dev/null +++ b/offapi/com/sun/star/security/CertAltNameEntry.idl @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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 __com_sun_star_security_CertAltNameEntry_idl__ +#define __com_sun_star_security_CertAltNameEntry_idl__ + +#include <com/sun/star/security/ExtAltNameType.idl> + +//============================================================================= + + module com { module sun { module star { module security { + +//============================================================================= +/** + * struct contains a single entry within a Subject Alternative Name Extension of a + * X509 certificate. + */ +struct CertAltNameEntry +{ + /** + * defines the type of the value . With this information you can determine how to interprete the Any value. + * @see com::sun::star::security::ExtAltNameType + */ + com::sun::star::security::ExtAltNameType Type; + + /** + * stores the value of entry. + */ + any Value; +}; + + +}; }; }; }; +#endif diff --git a/offapi/com/sun/star/security/ExtAltNameType.idl b/offapi/com/sun/star/security/ExtAltNameType.idl new file mode 100644 index 000000000000..3910772c28c8 --- /dev/null +++ b/offapi/com/sun/star/security/ExtAltNameType.idl @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +/** -- idl definition -- **/ + +#ifndef __com_sun_star_security_ExtAltNameType_idl_ +#define __com_sun_star_security_ExtAltNameType_idl_ + +#include <com/sun/star/uno/XInterface.idl> + +module com { module sun { module star { module security { + +/** + * Constant definiton of a certificate container status. + */ +enum ExtAltNameType +{ + /** + * Cutomize name/value pair + * The value of CertAltNameEntry contains a NamedValue. + * + * @see com::sun::star::security::CertAltNameEntry + */ + OTHER_NAME, + + /** + * The entry contains rfc822 name. + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry + */ + RFC822_NAME, + + /** + * The entry contains a dns name. + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry + */ + DNS_NAME, + + /** + * Currently unsupported. + */ + DIRECTORY_NAME, + + /** + * The entry contains an url. + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry + */ + URL, + + /** + * The entry contains a ip address. + * The value of CertAltNameEntry contains a Sequence of sal_Int8. + * + * @see com::sun::star::security::CertAltNameEntry + */ + IP_ADDRESS, + + /** + * The entry contains a registered id. + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry + */ + REGISTERED_ID, + + /** + * Currently unsupported. + */ + EDI_PARTY_NAME, + + /** + * Currently unsupported. + */ + X400_ADDRESS + +}; + +} ; } ; } ; } ; + +#endif + diff --git a/offapi/com/sun/star/security/XSanExtension.idl b/offapi/com/sun/star/security/XSanExtension.idl new file mode 100644 index 000000000000..e378e1b0817e --- /dev/null +++ b/offapi/com/sun/star/security/XSanExtension.idl @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +//i20156 - new file for xmlsecurity module + +/** -- idl definition -- **/ + +#ifndef __com_sun_star_security_XSanExtension_idl_ +#define __com_sun_star_security_XSanExtension_idl_ + +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/security/XCertificateExtension.idl> +#include <com/sun/star/security/CertAltNameEntry.idl> + +module com { module sun { module star { module security { + +/** + * Interface of a X509 Subject Alternative Name Certificate Extension + * + * <p>This interface represents a x509 certificate extension.</p> + */ +interface XSanExtension : com::sun::star::security::XCertificateExtension +{ + /** + * Contains the alternative names of a certificate + */ + [attribute, readonly] sequence< com::sun::star::security::CertAltNameEntry > AlternativeNames; +}; + +} ; } ; } ; } ; + +#endif + diff --git a/offapi/com/sun/star/security/makefile.mk b/offapi/com/sun/star/security/makefile.mk index 21667da10972..2064e9fb4bea 100644 --- a/offapi/com/sun/star/security/makefile.mk +++ b/offapi/com/sun/star/security/makefile.mk @@ -59,7 +59,13 @@ IDLFILES=\ XSerialNumberAdapter.idl \ SerialNumberAdapter.idl \ CertificateContainer.idl \ - CertificateContainerStatus.idl + CertificateContainerStatus.idl \ + ExtAltNameType.idl \ + XSanExtension.idl \ + CertAltNameEntry.idl + + + # ------------------------------------------------------------------ diff --git a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl index 939ff469b674..c01f450676dc 100644 --- a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl +++ b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl @@ -107,25 +107,26 @@ published service DataPilotDescriptor //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if empty rows in the source data are ignored. */ [optional, property] boolean IgnoreEmptyRows; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if empty category cells in the source data should be treated + as repetition of the content from the previous row. */ [optional, property] boolean RepeatIfEmpty; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if columns for grand total results are created. */ [optional, property] boolean ColumnGrand; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if rows for grand total results are created. */ [optional, property] boolean RowGrand; @@ -142,6 +143,14 @@ published service DataPilotDescriptor [optional, property] boolean DrillDownOnDoubleClick; //------------------------------------------------------------------------- + + /** specifies a label for grand total results. + + @since OOo 3.4 + */ + [optional, property] string GrandTotalName; + + //------------------------------------------------------------------------- }; //============================================================================= diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index ac99601f5ce5..c89a350d6708 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -30,6 +30,20 @@ #include <cstdlib> #include <iostream> +#include <limits> +#include <string> + +#include "cppunittester/protectorfactory.hxx" +#include "osl/module.h" +#include "osl/module.hxx" +#include "osl/thread.h" +#include "rtl/process.h" +#include "rtl/string.h" +#include "rtl/string.hxx" +#include "rtl/textcvt.h" +#include "rtl/ustring.hxx" +#include "sal/main.h" +#include "sal/types.h" #include "preextstl.h" #include "cppunit/CompilerOutputter.h" @@ -40,25 +54,87 @@ #include "cppunit/plugin/PlugInManager.h" #include "cppunit/portability/Stream.h" #include "postextstl.h" -#include "osl/thread.h" -#include "rtl/process.h" -#include "rtl/string.hxx" -#include "rtl/ustring.hxx" -#include "sal/main.h" + +namespace { + +void usageFailure() { + std::cerr + << ("Usage: cppunittester (--protector <shared-library-path>" + " <function-symbol>)* <shared-library-path>") + << std::endl; + std::exit(EXIT_FAILURE); +} + +rtl::OUString getArgument(sal_Int32 index) { + rtl::OUString arg; + rtl_getAppCommandArg(index, &arg.pData); + return arg; +} + +std::string convertLazy(rtl::OUString const & s16) { + rtl::OString s8(rtl::OUStringToOString(s16, osl_getThreadTextEncoding())); + return std::string( + s8.getStr(), + ((static_cast< sal_uInt32 >(s8.getLength()) + > std::numeric_limits< std::string::size_type >::max()) + ? std::numeric_limits< std::string::size_type >::max() + : static_cast< std::string::size_type >(s8.getLength()))); +} + +std::string convertStrict(rtl::OUString const & s16) { + rtl::OString s8; + if (!s16.convertToString( + &s8, osl_getThreadTextEncoding(), + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR + | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)) + || (static_cast< sal_uInt32 >(s8.getLength()) + > std::numeric_limits< std::string::size_type >::max())) + { + std::cerr + << "Failure converting argument from UTF-16 back to system encoding" + << std::endl; + std::exit(EXIT_FAILURE); + } + return std::string( + s8.getStr(), static_cast< std::string::size_type >(s8.getLength())); +} + +} SAL_IMPLEMENT_MAIN() { - if (rtl_getAppCommandArgCount() != 1) { - std::cerr << "Usage: cppunittester <shared-library-path>" << std::endl; - return EXIT_FAILURE; + CppUnit::TestResult result; + sal_uInt32 index = 0; + for (; index < rtl_getAppCommandArgCount(); index += 3) { + if (!getArgument(index).equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("--protector"))) + { + break; + } + if (rtl_getAppCommandArgCount() - index < 3) { + usageFailure(); + } + rtl::OUString lib(getArgument(index + 1)); + rtl::OUString sym(getArgument(index + 2)); + oslGenericFunction fn = (new osl::Module(lib, SAL_LOADMODULE_GLOBAL)) + ->getFunctionSymbol(sym); + CppUnit::Protector * p = fn == 0 + ? 0 + : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))(); + if (p == 0) { + std::cerr + << "Failure instantiating protector \"" << convertLazy(lib) + << "\", \"" << convertLazy(sym) << '"' << std::endl; + std::exit(EXIT_FAILURE); + } + result.pushProtector(p); + } + if (rtl_getAppCommandArgCount() - index != 1) { + usageFailure(); } - rtl::OUString path; - rtl_getAppCommandArg(0, &path.pData); CppUnit::PlugInManager manager; - manager.load( - rtl::OUStringToOString(path, osl_getThreadTextEncoding()).getStr()); + manager.load(convertStrict(getArgument(index))); CppUnit::TestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); - CppUnit::TestResult result; CppUnit::TestResultCollector collector; result.addListener(&collector); runner.run(result); diff --git a/sal/inc/cppunittester/protectorfactory.hxx b/sal/inc/cppunittester/protectorfactory.hxx new file mode 100644 index 000000000000..c309dbe8aa85 --- /dev/null +++ b/sal/inc/cppunittester/protectorfactory.hxx @@ -0,0 +1,45 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_CPPUNITTESTER_PROTECTORFACTORY_HXX +#define INCLUDED_CPPUNITTESTER_PROTECTORFACTORY_HXX + +#include "sal/config.h" + +#include "sal/types.h" + +namespace CppUnit { class Protector; } + +namespace cppunittester { + +// The type of CppUnit::Protector factory functions that can be plugged into +// cppunittester: +extern "C" typedef CppUnit::Protector * SAL_CALL ProtectorFactory(); + +} + +#endif diff --git a/sal/osl/os2/diagnose.c b/sal/osl/os2/diagnose.c index b105e0b78c29..b412a65ff090 100644 --- a/sal/osl/os2/diagnose.c +++ b/sal/osl/os2/diagnose.c @@ -124,7 +124,8 @@ sal_Bool SAL_CALL osl_assertFailedLine( const sal_Char* pszFileName, sal_Int32 n fputs(szMessage, stderr); - return sal_True; /* abort */ + char const * env = getenv( "SAL_DIAGNOSE_ABORT" ); + return ( ( env != NULL ) && ( *env != '\0' ) ); } /*----------------------------------------------------------------------------*/ diff --git a/sal/osl/unx/diagnose.c b/sal/osl/unx/diagnose.c index 02967b3ad7f7..5d9a4f31a40e 100644 --- a/sal/osl/unx/diagnose.c +++ b/sal/osl/unx/diagnose.c @@ -218,6 +218,11 @@ sal_Bool SAL_CALL osl_assertFailedLine ( oslDebugMessageFunc f = g_pDebugMessageFunc; char szMessage[1024]; + // after reporting the assertion, abort if told so by SAL_DIAGNOSE_ABORT, but *not* if + // assertions are routed to some external instance + char const * env = getenv( "SAL_DIAGNOSE_ABORT" ); + sal_Bool const doAbort = ( ( env != NULL ) && ( *env != '\0' ) && ( f == NULL ) ); + /* If there's a callback for detailed messages, use it */ if ( g_pDetailedDebugMessageFunc != NULL ) { @@ -227,7 +232,7 @@ sal_Bool SAL_CALL osl_assertFailedLine ( /* if SAL assertions are disabled in general, stop here */ if ( getenv("DISABLE_SAL_DBGBOX") ) - return sal_False; + return doAbort; /* format message into buffer */ if (pszMessage != 0) @@ -252,9 +257,10 @@ sal_Bool SAL_CALL osl_assertFailedLine ( /* output backtrace */ osl_diagnose_backtrace_Impl(f); - /* release lock and leave, w/o calling osl_breakDebug() */ + /* release lock and leave */ pthread_mutex_unlock(&g_mutex); - return sal_False; + + return doAbort; } /************************************************************************/ @@ -262,7 +268,7 @@ sal_Bool SAL_CALL osl_assertFailedLine ( /************************************************************************/ void SAL_CALL osl_breakDebug() { - exit(0); + abort(); } /************************************************************************/ diff --git a/sal/osl/w32/diagnose.c b/sal/osl/w32/diagnose.c index 9c75e4502743..1feab6ded8da 100755 --- a/sal/osl/w32/diagnose.c +++ b/sal/osl/w32/diagnose.c @@ -93,6 +93,7 @@ sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nL /* get app name or NULL if unknown (don't call assert) */ LPCSTR lpszAppName = "Error"; sal_Char szMessage[512]; + char const * env = getenv( "SAL_DIAGNOSE_ABORT" ); /* format message into buffer */ szMessage[sizeof(szMessage)-1] = '\0'; /* zero terminate always */ @@ -105,39 +106,44 @@ sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nL _pPrintDetailedDebugMessage( pszFileName, nLine, pszMessage ); else if ( _pPrintDebugMessage ) _pPrintDebugMessage( szMessage ); - else if ( !getenv( "DISABLE_SAL_DBGBOX" ) ) + else { - TCHAR szBoxMessage[1024]; + if ( !getenv( "DISABLE_SAL_DBGBOX" ) ) + { + TCHAR szBoxMessage[1024]; - /* active popup window for the current thread */ - hWndParent = GetActiveWindow(); - if (hWndParent != NULL) - hWndParent = GetLastActivePopup(hWndParent); + /* active popup window for the current thread */ + hWndParent = GetActiveWindow(); + if (hWndParent != NULL) + hWndParent = GetLastActivePopup(hWndParent); - /* set message box flags */ - nFlags = MB_TASKMODAL | MB_ICONWARNING | MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_SETFOREGROUND; - if (hWndParent == NULL) - nFlags |= MB_SERVICE_NOTIFICATION; + /* set message box flags */ + nFlags = MB_TASKMODAL | MB_ICONWARNING | MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_SETFOREGROUND; + if (hWndParent == NULL) + nFlags |= MB_SERVICE_NOTIFICATION; - /* display the assert */ + /* display the assert */ - szBoxMessage[sizeof(szBoxMessage)-1] = 0; - _snprintf(szBoxMessage, sizeof(szBoxMessage)-1, "%s\n( Yes=Abort / No=Ignore / Cancel=Debugger )", - szMessage); + szBoxMessage[sizeof(szBoxMessage)-1] = 0; + _snprintf(szBoxMessage, sizeof(szBoxMessage)-1, "%s\n( Yes=Abort / No=Ignore / Cancel=Debugger )", + szMessage); - nCode = MessageBox(hWndParent, szBoxMessage, "Assertion Failed!", nFlags); + nCode = MessageBox(hWndParent, szBoxMessage, "Assertion Failed!", nFlags); - if (nCode == IDYES) - FatalExit(-1); + if (nCode == IDYES) + FatalExit(-1); - if (nCode == IDNO) - return sal_False; /* ignore */ + if (nCode == IDNO) + return sal_False; /* ignore */ - if (nCode == IDCANCEL) - return sal_True; /* will cause oslDebugBreak */ + if (nCode == IDCANCEL) + return sal_True; /* will cause oslDebugBreak */ + } + return ( ( env != NULL ) && ( *env != '\0' ) ); } + + return sal_False; #endif /* NO_DEBUG_CRT */ - return sal_False; /* not shure, not care */ } sal_Int32 SAL_CALL osl_reportError(sal_uInt32 nType, const sal_Char* pszMessage) diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index 09bdec7988c3..549f42861f94 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -155,7 +155,7 @@ namespace /* private */ void parse_UNC_path(const sal_Unicode* path, UNCComponents* puncc) { OSL_PRECOND(is_UNC_path(path), "Precondition violated: No UNC path"); - OSL_PRECOND(rtl_ustr_indexOfChar(path, SLASH) != -1, "Path must not contain slashes"); + OSL_PRECOND(rtl_ustr_indexOfChar(path, SLASH) == -1, "Path must not contain slashes"); const sal_Unicode* pend = path + rtl_ustr_getLength(path); const sal_Unicode* ppos = path + 2; @@ -691,7 +691,7 @@ static int path_make_parent(sal_Unicode* path) If there are no more parents 0 will be returned, e.g. 'c:\' or '\\Share' have no more parents */ - OSL_PRECOND(rtl_ustr_indexOfChar(path, SLASH) != -1, "Path must not contain slashes"); + OSL_PRECOND(rtl_ustr_indexOfChar(path, SLASH) == -1, "Path must not contain slashes"); OSL_PRECOND(has_path_parent(path), "Path must have a parent"); sal_Unicode* pos_last_backslash = path + rtl_ustr_lastIndexOfChar(path, BACKSLASH); diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx index b730bd3347df..65a17eb1352d 100644..100755 --- a/sal/osl/w32/module.cxx +++ b/sal/osl/w32/module.cxx @@ -36,6 +36,7 @@ #include <osl/thread.h> #include <osl/file.h> #include <rtl/logfile.h> +#include <vector> /* under WIN32, we use the void* oslModule @@ -65,10 +66,32 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod rtl_uString_assign(&Module, strModuleName); hInstance = LoadLibraryW(reinterpret_cast<LPCWSTR>(Module->buffer)); + if (hInstance == NULL) hInstance = LoadLibraryExW(reinterpret_cast<LPCWSTR>(Module->buffer), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + //In case of long path names (\\?\c:\...) try to shorten the filename. + //LoadLibrary cannot handle file names which exceed 260 letters. + //In case the path is to long, the function will fail. However, the error + //code can be different. For example, it returned ERROR_FILENAME_EXCED_RANGE + //on Windows XP and ERROR_INSUFFICIENT_BUFFER on Windows 7 (64bit) + if (hInstance == NULL && Module->length > 260) + { + std::vector<sal_Unicode, rtl::Allocator<sal_Unicode> > vec(Module->length + 1); + DWORD len = GetShortPathNameW(reinterpret_cast<LPCWSTR>(Module->buffer), + &vec[0], Module->length + 1); + if (len ) + { + hInstance = LoadLibraryW(&vec[0]); + + if (hInstance == NULL) + hInstance = LoadLibraryExW(&vec[0], NULL, + LOAD_WITH_ALTERED_SEARCH_PATH); + } + } + + if (hInstance <= (HINSTANCE)HINSTANCE_ERROR) hInstance = 0; diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx index fc04d5b84a8f..a2f86422df2a 100644..100755 --- a/sal/osl/w32/procimpl.cxx +++ b/sal/osl/w32/procimpl.cxx @@ -300,6 +300,39 @@ namespace /* private */ return quoted.makeStringAndClear(); } + //The parameter path must be a system path. If it is longer than 260 characters + //then it is shortened using the GetShortPathName function. This function only + //works if the path exists. Because "path" can be the path to an executable, it + //may not have the file extension ".exe". However, if the file on disk has the + //".exe" extension, then the function will fail. In this case a second attempt + //is started by adding the parameter "extension" to "path". + rtl::OUString getShortPath(rtl::OUString const & path, rtl::OUString const & extension) + { + rtl::OUString ret(path); + if (path.getLength() > 260) + { + std::vector<sal_Unicode, rtl::Allocator<sal_Unicode> > vec(path.getLength() + 1); + //GetShortPathNameW only works if the file can be found! + const DWORD len = GetShortPathNameW( + path.getStr(), &vec[0], path.getLength() + 1); + + if (!len && GetLastError() == ERROR_FILE_NOT_FOUND + && extension.getLength()) + { + const rtl::OUString extPath(path + extension); + std::vector<sal_Unicode, rtl::Allocator<sal_Unicode> > vec2( + extPath.getLength() + 1); + const DWORD len2 = GetShortPathNameW( + extPath.getStr(), &vec2[0], extPath.getLength() + 1); + ret = rtl::OUString(&vec2[0], len2); + } + else + { + ret = rtl::OUString(&vec[0], len); + } + } + return ret; + } //########################################################## // Returns the system path of the executable which can either // be provided via the strImageName parameter or as first @@ -326,6 +359,8 @@ namespace /* private */ if (osl_File_E_None != osl::FileBase::getSystemPathFromFileURL(exe_url, exe_path)) return rtl::OUString(); + exe_path = getShortPath(exe_path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".exe"))); + if (exe_path.indexOf(' ') != -1) exe_path = quote_string(exe_path); diff --git a/sal/prj/d.lst b/sal/prj/d.lst index 3ce270bbbfc4..253d7ea7f718 100644 --- a/sal/prj/d.lst +++ b/sal/prj/d.lst @@ -1,9 +1,11 @@ +mkdir: %_DEST%\inc%_EXT%\cppunittester mkdir: %_DEST%\inc%_EXT%\sal mkdir: %_DEST%\inc%_EXT%\osl mkdir: %_DEST%\inc%_EXT%\rtl mkdir: %_DEST%\inc%_EXT%\systools mkdir: %_DEST%\inc%_EXT%\systools\win32 +..\inc\cppunittester\protectorfactory.hxx %_DEST%\inc%_EXT%\protectorfactory.hxx ..\%__SRC%\inc\rtlbootstrap.mk %_DEST%\inc%_EXT%\rtlbootstrap.mk ..\inc\sal\*.h %_DEST%\inc%_EXT%\sal\*.h ..\%__SRC%\inc\sal\typesizes.h %_DEST%\inc%_EXT%\sal\typesizes.h |