diff options
228 files changed, 4780 insertions, 4466 deletions
diff --git a/bridges/prj/build.lst b/bridges/prj/build.lst index c6e342520672..0e7979742562 100644 --- a/bridges/prj/build.lst +++ b/bridges/prj/build.lst @@ -12,16 +12,17 @@ br bridges\source\cpp_uno\gcc3_os2_intel nmake - p br_gcc3os br_cppuno_shared br br bridges\source\cpp_uno\gcc3_freebsd_intel nmake - u br_gcc3fi br_cppuno_shared br_unotypes br_inc NULL br bridges\source\cpp_uno\gcc3_linux_x86-64 nmake - u br_gcc3lx br_cppuno_shared br_unotypes br_inc NULL br bridges\source\cpp_uno\gcc3_freebsd_x86-64 nmake - u br_gcc3fx br_cppuno_shared br_unotypes br_inc NULL -br bridges\source\cpp_uno\gcc3_linux_powerpc nmake - u br_gcclp3 br_cppuno_shared br_unotypes br_inc NULL -br bridges\source\cpp_uno\gcc3_linux_powerpc64 nmake - u br_gcclp3_64 br_cppuno_shared br_unotypes br_inc NULL -br bridges\source\cpp_uno\gcc3_linux_mips nmake - u br_gcc3mips br_cppuno_shared br_unotypes br_inc NULL -br bridges\source\cpp_uno\gcc3_linux_m68k nmake - u br_gcc3m68k br_cppuno_shared br_unotypes br_inc NULL -br bridges\source\cpp_uno\gcc3_linux_s390 nmake - u br_gccl33 br_unotypes br_inc NULL -br bridges\source\cpp_uno\gcc3_linux_s390x nmake - u br_gccl3x br_unotypes br_inc NULL -br bridges\source\cpp_uno\gcc3_linux_sparc nmake - u br_gccl3s br_unotypes br_cppuno_shared br_inc NULL -br bridges\source\cpp_uno\gcc3_linux_arm nmake - u br_gccl3r br_unotypes NULL -br bridges\source\cpp_uno\gcc3_linux_ia64 nmake - u br_gccl3a br_unotypes NULL -br bridges\source\cpp_uno\gcc3_linux_hppa nmake - u br_gccl3h br_unotypes NULL +br bridges\source\cpp_uno\gcc3_linux_powerpc nmake - u br_gcc3lp br_cppuno_shared br_unotypes br_inc NULL +br bridges\source\cpp_uno\gcc3_linux_powerpc64 nmake - u br_gcc3lp_64 br_cppuno_shared br_unotypes br_inc NULL +br bridges\source\cpp_uno\gcc3_linux_mips nmake - u br_gcc3lmips br_cppuno_shared br_unotypes br_inc NULL +br bridges\source\cpp_uno\gcc3_linux_m68k nmake - u br_gcc3lm68k br_cppuno_shared br_unotypes br_inc NULL +br bridges\source\cpp_uno\gcc3_linux_s390 nmake - u br_gcc3l3 br_unotypes br_inc NULL +br bridges\source\cpp_uno\gcc3_linux_s390x nmake - u br_gcc3l3_64 br_unotypes br_inc NULL +br bridges\source\cpp_uno\gcc3_linux_sparc nmake - u br_gcc3ls br_unotypes br_cppuno_shared br_inc NULL +br bridges\source\cpp_uno\gcc3_linux_arm nmake - u br_gcc3lr br_unotypes NULL +br bridges\source\cpp_uno\gcc3_linux_ia64 nmake - u br_gcc3la br_unotypes NULL +br bridges\source\cpp_uno\gcc3_linux_hppa nmake - u br_gcc3lh br_unotypes NULL +br bridges\source\cpp_uno\gcc3_linux_alpha nmake - u br_gcc3ll br_unotypes NULL br bridges\source\cpp_uno\gcc3_macosx_intel nmake - u br_gcc3macoxi br_cppuno_shared br_unotypes br_inc NULL br bridges\source\cpp_uno\gcc3_macosx_powerpc nmake - u br_gcc3macoxp br_cppuno_shared br_unotypes br_inc NULL br bridges\source\cpp_uno\cc50_solaris_sparc nmake - u br_cc50sols br_unotypes br_cppuno_shared br_inc NULL diff --git a/bridges/source/cpp_uno/gcc3_freebsd_intel/makefile.mk b/bridges/source/cpp_uno/gcc3_freebsd_intel/makefile.mk index 1e00634bd6a3..87ff690dd653 100644 --- a/bridges/source/cpp_uno/gcc3_freebsd_intel/makefile.mk +++ b/bridges/source/cpp_uno/gcc3_freebsd_intel/makefile.mk @@ -77,8 +77,5 @@ SHL1STDLIBS= \ .INCLUDE : target.mk $(SLO)$/%.obj: %.s -#cmc: Ideally --noexecstack would be in operations, but with #i51385# pyuno -#remote bridgeing breaks -# $(CC) -Wa,--noexecstack -c -o $(SLO)$/$(@:b).o $< $(CC) -c -o $(SLO)$/$(@:b).o $< touch $@ diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx new file mode 100644 index 000000000000..abc5ce67e4b4 --- /dev/null +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx @@ -0,0 +1,676 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_bridges.hxx" + +#include <com/sun/star/uno/genfunc.hxx> +#include <uno/data.h> +#include <typelib/typedescription.hxx> + +#include "bridges/cpp_uno/shared/bridge.hxx" +#include "bridges/cpp_uno/shared/cppinterfaceproxy.hxx" +#include "bridges/cpp_uno/shared/types.hxx" +#include "bridges/cpp_uno/shared/vtablefactory.hxx" + +#include "share.hxx" +#include <stdio.h> + +//Calling Standards: +// "Calling Standard for Alpha Systems" +// (Tru64 UNIX Version 5.1 or higher, August 2000) +//http://www.tru64unix.compaq.com/docs/base_doc/DOCUMENTATION/V51_HTML/ARH9MBTE/TITLE.HTM + +using namespace ::com::sun::star::uno; + +namespace +{ +static typelib_TypeClass cpp2uno_call( + bridges::cpp_uno::shared::CppInterfaceProxy * pThis, + const typelib_TypeDescription * pMemberTypeDescr, + typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return + sal_Int32 nParams, typelib_MethodParameter * pParams, + void ** gpreg, void ** fpreg, void ** ovrflw, + sal_Int64 * pRegisterReturn /* space for register return */ ) +{ +#ifdef CMC_DEBUG + fprintf(stderr, "as far as cpp2uno_call\n"); +#endif + int nregs = 0; //number of words passed in registers + + // gpreg: [ret *], this, [gpr params] + // fpreg: [fpr params] + // ovrflw: [gpr or fpr params (properly aligned)] + + // return + typelib_TypeDescription * pReturnTypeDescr = 0; + if (pReturnTypeRef) + TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); + + void * pUnoReturn = 0; + void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need + + if (pReturnTypeDescr) + { + if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr )) + { + pUnoReturn = pRegisterReturn; // direct way for simple types + } + else // complex return via ptr (pCppReturn) + { + pCppReturn = *(void **)gpreg; + gpreg++; + fpreg++; + nregs++; + + pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr ) + ? alloca( pReturnTypeDescr->nSize ) + : pCppReturn); // direct way + } + } + // pop this + gpreg++; + fpreg++; + nregs++; + + // stack space + OSL_ENSURE( sizeof(void *) == sizeof(sal_Int64), "### unexpected size!" ); + // parameters + void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); + void ** pCppArgs = pUnoArgs + nParams; + // indizes of values this have to be converted (interface conversion cpp<=>uno) + sal_Int32 * pTempIndizes = (sal_Int32 *)(pUnoArgs + (2 * nParams)); + // type descriptions for reconversions + typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams)); + + sal_Int32 nTempIndizes = 0; + for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) + { + const typelib_MethodParameter & rParam = pParams[nPos]; + typelib_TypeDescription * pParamTypeDescr = 0; + TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ); + +#ifdef CMC_DEBUG + fprintf(stderr, "arg %d of %d\n", nPos, nParams); +#endif + + if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) // value + { +#ifdef CMC_DEBUG + fprintf(stderr, "simple type is %d\n", pParamTypeDescr->eTypeClass); +#endif + + switch (pParamTypeDescr->eTypeClass) + { + case typelib_TypeClass_FLOAT: + case typelib_TypeClass_DOUBLE: + if (nregs < axp::MAX_WORDS_IN_REGS) + { + if (pParamTypeDescr->eTypeClass == typelib_TypeClass_FLOAT) + { + float tmp = (float) (*((double *)fpreg)); + (*((float *) fpreg)) = tmp; + } + + pCppArgs[nPos] = pUnoArgs[nPos] = fpreg; + gpreg++; + fpreg++; + nregs++; + } + else + { + pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw; + ovrflw++; + } + break; + case typelib_TypeClass_BYTE: + case typelib_TypeClass_BOOLEAN: + if (nregs < axp::MAX_WORDS_IN_REGS) + { + pCppArgs[nPos] = pUnoArgs[nPos] = gpreg; + gpreg++; + fpreg++; + nregs++; + } + else + { + pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw; + ovrflw++; + } + break; + case typelib_TypeClass_CHAR: + case typelib_TypeClass_SHORT: + case typelib_TypeClass_UNSIGNED_SHORT: + if (nregs < axp::MAX_WORDS_IN_REGS) + { + pCppArgs[nPos] = pUnoArgs[nPos] = gpreg; + gpreg++; + fpreg++; + nregs++; + } + else + { + pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw; + ovrflw++; + } + break; + case typelib_TypeClass_ENUM: + case typelib_TypeClass_LONG: + case typelib_TypeClass_UNSIGNED_LONG: + if (nregs < axp::MAX_WORDS_IN_REGS) + { + pCppArgs[nPos] = pUnoArgs[nPos] = gpreg; + gpreg++; + fpreg++; + nregs++; + } + else + { + pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw; + ovrflw++; + } + break; + default: + if (nregs < axp::MAX_WORDS_IN_REGS) + { + pCppArgs[nPos] = pUnoArgs[nPos] = gpreg; + gpreg++; + fpreg++; + nregs++; + } + else + { + pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw; + ovrflw++; + } + break; + } + + // no longer needed + TYPELIB_DANGER_RELEASE( pParamTypeDescr ); + } + else // ptr to complex value | ref + { +#ifdef CMC_DEBUG + fprintf(stderr, "complex, nregs is %d\n", nregs); +#endif + + void *pCppStack; //temporary stack pointer + + if (nregs < axp::MAX_WORDS_IN_REGS) + { + pCppArgs[nPos] = pCppStack = *gpreg; + gpreg++; + fpreg++; + nregs++; + } + else + { + pCppArgs[nPos] = pCppStack = *ovrflw; + ovrflw++; + } + + if (! rParam.bIn) // is pure out + { + // uno out is unconstructed mem! + pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ); + pTempIndizes[nTempIndizes] = nPos; + // will be released at reconversion + ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr; + } + // is in/inout + else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr )) + { + uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ), + pCppStack, pParamTypeDescr, + pThis->getBridge()->getCpp2Uno() ); + pTempIndizes[nTempIndizes] = nPos; // has to be reconverted + // will be released at reconversion + ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr; + } + else // direct way + { + pUnoArgs[nPos] = pCppStack; + // no longer needed + TYPELIB_DANGER_RELEASE( pParamTypeDescr ); + } + } + } + +#ifdef CMC_DEBUG + fprintf(stderr, "end of params\n"); +#endif + + // ExceptionHolder + uno_Any aUnoExc; // Any will be constructed by callee + uno_Any * pUnoExc = &aUnoExc; + + // invoke uno dispatch call + (*pThis->getUnoI()->pDispatcher)( pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc ); + + // in case an exception occured... + if (pUnoExc) + { + // destruct temporary in/inout params + for ( ; nTempIndizes--; ) + { + sal_Int32 nIndex = pTempIndizes[nTempIndizes]; + + if (pParams[nIndex].bIn) // is in/inout => was constructed + uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], 0 ); + TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] ); + } + if (pReturnTypeDescr) + TYPELIB_DANGER_RELEASE( pReturnTypeDescr ); + + CPPU_CURRENT_NAMESPACE::raiseException( &aUnoExc, pThis->getBridge()->getUno2Cpp() ); // has to destruct the any + // is here for dummy + return typelib_TypeClass_VOID; + } + else // else no exception occured... + { + // temporary params + for ( ; nTempIndizes--; ) + { + sal_Int32 nIndex = pTempIndizes[nTempIndizes]; + typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes]; + + if (pParams[nIndex].bOut) // inout/out + { + // convert and assign + uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release ); + uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr, + pThis->getBridge()->getUno2Cpp() ); + } + // destroy temp uno param + uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); + + TYPELIB_DANGER_RELEASE( pParamTypeDescr ); + } + // return + if (pCppReturn) // has complex return + { + if (pUnoReturn != pCppReturn) // needs reconversion + { + uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr, + pThis->getBridge()->getUno2Cpp() ); + // destroy temp uno return + uno_destructData( pUnoReturn, pReturnTypeDescr, 0 ); + } + // complex return ptr is set to return reg + *(void **)pRegisterReturn = pCppReturn; + } + if (pReturnTypeDescr) + { + typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass; + TYPELIB_DANGER_RELEASE( pReturnTypeDescr ); + return eRet; + } + else + return typelib_TypeClass_VOID; + } +} + + +//============================================================================ +static typelib_TypeClass cpp_mediate( + sal_uInt64 nOffsetAndIndex, + void ** gpreg, void ** fpreg, void ** ovrflw, + sal_Int64 * pRegisterReturn /* space for register return */ ) +{ + OSL_ENSURE( sizeof(sal_Int64)==sizeof(void *), "### unexpected!" ); + + sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32); + sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF); + +#ifdef CMC_DEBUG + fprintf(stderr, "nVTableOffset, nFunctionIndex are %x %x\n", nVtableOffset, nFunctionIndex); +#endif + +#ifdef CMC_DEBUG + // Let's figure out what is really going on here + { + fprintf( stderr, "= cpp_mediate () =\nGPR's (%d): ", 6 ); + for ( unsigned int i = 0; i < 6; ++i ) + fprintf( stderr, "0x%lx, ", gpreg[i] ); + fprintf( stderr, "\n"); + fprintf( stderr, "\nFPR's (%d): ", 6 ); + for ( unsigned int i = 0; i < 6; ++i ) + fprintf( stderr, "0x%lx (%f), ", fpreg[i], fpreg[i] ); + fprintf( stderr, "\n"); + } +#endif + + + // gpreg: [ret *], this, [other gpr params] + // fpreg: [fpr params] + // ovrflw: [gpr or fpr params (properly aligned)] + + // _this_ ptr is patched cppu_XInterfaceProxy object + void * pThis; + if( nFunctionIndex & 0x80000000 ) + { + nFunctionIndex &= 0x7fffffff; + pThis = gpreg[1]; + } + else + { + pThis = gpreg[0]; + } + + pThis = static_cast< char * >(pThis) - nVtableOffset; + + bridges::cpp_uno::shared::CppInterfaceProxy * pCppI + = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy( + pThis); + + typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr(); + + + OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" ); + if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex) + { + throw RuntimeException( + rtl::OUString::createFromAscii("illegal vtable index!"), + (XInterface *)pCppI ); + } + + // determine called method + OSL_ENSURE( nVtableCall < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" ); + sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; + OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + + TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); + + typelib_TypeClass eRet; + switch (aMemberDescr.get()->eTypeClass) + { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + { + if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex) + { + // is GET method + eRet = cpp2uno_call( + pCppI, aMemberDescr.get(), + ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef, + 0, 0, // no params + gpreg, fpreg, ovrflw, pRegisterReturn ); + } + else + { + // is SET method + typelib_MethodParameter aParam; + aParam.pTypeRef = + ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef; + aParam.bIn = sal_True; + aParam.bOut = sal_False; + + eRet = cpp2uno_call( + pCppI, aMemberDescr.get(), + 0, // indicates void return + 1, &aParam, + gpreg, fpreg, ovrflw, pRegisterReturn ); + } + break; + } + case typelib_TypeClass_INTERFACE_METHOD: + { + // is METHOD + switch (nFunctionIndex) + { + case 1: // acquire() + pCppI->acquireProxy(); // non virtual call! + eRet = typelib_TypeClass_VOID; + break; + case 2: // release() + pCppI->releaseProxy(); // non virtual call! + eRet = typelib_TypeClass_VOID; + break; + case 0: // queryInterface() opt + { + typelib_TypeDescription * pTD = 0; + TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( gpreg[2] )->getTypeLibType() ); + if (pTD) + { + XInterface * pInterface = 0; + (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)( + pCppI->getBridge()->getCppEnv(), + (void **)&pInterface, pCppI->getOid().pData, + (typelib_InterfaceTypeDescription *)pTD ); + + if (pInterface) + { + ::uno_any_construct( + reinterpret_cast< uno_Any * >( gpreg[0] ), + &pInterface, pTD, cpp_acquire ); + pInterface->release(); + TYPELIB_DANGER_RELEASE( pTD ); + *(void **)pRegisterReturn = gpreg[0]; + eRet = typelib_TypeClass_ANY; + break; + } + TYPELIB_DANGER_RELEASE( pTD ); + } + } // else perform queryInterface() + default: + eRet = cpp2uno_call( + pCppI, aMemberDescr.get(), + ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef, + ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams, + ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams, + gpreg, fpreg, ovrflw, pRegisterReturn ); + } + break; + } + default: + { + throw RuntimeException( + rtl::OUString::createFromAscii("no member description found!"), + (XInterface *)pCppI ); + // is here for dummy + eRet = typelib_TypeClass_VOID; + } + } + + return eRet; +} + +long cpp_vtable_call(long r16, long r17, long r18, long r19, long r20, long r21, long firstonstack) +{ + register long r1 asm("$1"); + sal_uInt64 nOffsetAndIndex = r1; + + long sp = (long)&firstonstack; + + sal_uInt64 gpreg[axp::MAX_GPR_REGS]; + gpreg[0] = r16; + gpreg[1] = r17; + gpreg[2] = r18; + gpreg[3] = r19; + gpreg[4] = r20; + gpreg[5] = r21; + + double fpreg[axp::MAX_SSE_REGS]; + register double f16 asm("$f16"); fpreg[0] = f16; + register double f17 asm("$f17"); fpreg[1] = f17; + register double f18 asm("$f18"); fpreg[2] = f18; + register double f19 asm("$f19"); fpreg[3] = f19; + register double f20 asm("$f20"); fpreg[4] = f20; + register double f21 asm("$f21"); fpreg[5] = f21; + + volatile long nRegReturn[1]; +#ifdef CMC_DEBUG + fprintf(stderr, "before mediate with %lx\n",nOffsetAndIndex); + fprintf(stderr, "non-doubles are %x %x %x %x %x %x\n", gpreg[0], gpreg[1], gpreg[2], gpreg[3], gpreg[4], gpreg[5]); + fprintf(stderr, "doubles are %f %f %f %f %f %f\n", fpreg[0], fpreg[1], fpreg[2], fpreg[3], fpreg[4], fpreg[5]); +#endif + typelib_TypeClass aType = + cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, (void**)sp, + (sal_Int64*)nRegReturn ); +#ifdef CMC_DEBUG + fprintf(stderr, "after mediate ret is %lx %ld\n", nRegReturn[0], nRegReturn[0]); +#endif + + switch( aType ) + { + case typelib_TypeClass_BOOLEAN: + case typelib_TypeClass_BYTE: + nRegReturn[0] = (unsigned long)(*(unsigned char *)nRegReturn); + break; + case typelib_TypeClass_CHAR: + case typelib_TypeClass_UNSIGNED_SHORT: + case typelib_TypeClass_SHORT: + nRegReturn[0] = (unsigned long)(*(unsigned short *)nRegReturn); + break; + case typelib_TypeClass_ENUM: + case typelib_TypeClass_UNSIGNED_LONG: + case typelib_TypeClass_LONG: + nRegReturn[0] = (unsigned long)(*(unsigned int *)nRegReturn); + break; + case typelib_TypeClass_VOID: + default: + break; + case typelib_TypeClass_FLOAT: + { + double tmp = (double) (*((float *)nRegReturn)); + (*((double *) nRegReturn)) = tmp; + } + //deliberate fall through + case typelib_TypeClass_DOUBLE: + __asm__ ( "ldt $f0,%0\n\t" + : : "m" (*((double*)nRegReturn)) : "$f0"); + break; + } + return nRegReturn[0]; +} + +const int codeSnippetSize = 32; + +unsigned char *codeSnippet( unsigned char * code, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, bool simple_ret_type ) +{ + if (! simple_ret_type) + nFunctionIndex |= 0x80000000; + + unsigned char * p = code; + *(unsigned int*)&p[0] = 0x47fb0401; /* mov $27,$1 */ + *(unsigned int*)&p[4] = 0xa43b0010; /* ldq $1,16($27) */ + *(unsigned int*)&p[8] = 0xa77b0018; /* ldq $27,24($27) */ + *(unsigned int*)&p[12] = 0x6bfb0000; /* jmp $31,($27),0 */ + *(unsigned int*)&p[16] = nFunctionIndex; + *(unsigned int*)&p[20] = nVtableOffset; + *(unsigned long*)&p[24] = (unsigned long)cpp_vtable_call; + return (code + codeSnippetSize); +} +} + +void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const *, unsigned char const *) +{ + //http://www.gnu.org/software/lightning/manual/html_node/Standard-functions.html + __asm__ __volatile__("call_pal 0x86"); +} + +struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; }; + +bridges::cpp_uno::shared::VtableFactory::Slot * +bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block) +{ + return static_cast< Slot * >(block) + 2; +} + +sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( + sal_Int32 slotCount) +{ + return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize; +} + +bridges::cpp_uno::shared::VtableFactory::Slot * +bridges::cpp_uno::shared::VtableFactory::initializeBlock( + void * block, sal_Int32 slotCount) +{ + Slot * slots = mapBlockToVtable(block); + slots[-2].fn = 0; + slots[-1].fn = 0; + return slots + slotCount; +} + +unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( + Slot ** slots, unsigned char * code, sal_PtrDiff writetoexecdiff, + typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset, + sal_Int32 functionCount, sal_Int32 vtableOffset) +{ + (*slots) -= functionCount; + Slot * s = *slots; +#ifdef CMC_DEBUG + fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset); + fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset); +#endif + + for (sal_Int32 i = 0; i < type->nMembers; ++i) { + typelib_TypeDescription * member = 0; + TYPELIB_DANGER_GET(&member, type->ppMembers[i]); + OSL_ASSERT(member != 0); + switch (member->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + // Getter: + (s++)->fn = code + writetoexecdiff; + code = codeSnippet( + code, functionOffset++, vtableOffset, + bridges::cpp_uno::shared::isSimpleType( + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription * >( + member)->pAttributeTypeRef)); + + // Setter: + if (!reinterpret_cast< + typelib_InterfaceAttributeTypeDescription * >( + member)->bReadOnly) + { + (s++)->fn = code + writetoexecdiff; + code = codeSnippet(code, functionOffset++, vtableOffset, true); + } + break; + + case typelib_TypeClass_INTERFACE_METHOD: + (s++)->fn = code + writetoexecdiff; + code = codeSnippet( + code, functionOffset++, vtableOffset, + bridges::cpp_uno::shared::isSimpleType( + reinterpret_cast< + typelib_InterfaceMethodTypeDescription * >( + member)->pReturnTypeRef)); + break; + + default: + OSL_ASSERT(false); + break; + } + TYPELIB_DANGER_RELEASE(member); + } + return code; +} + +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx new file mode 100644 index 000000000000..3e666a11cdd0 --- /dev/null +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_bridges.hxx" + +#include <stdio.h> +#include <string.h> +#include <dlfcn.h> +#include <cxxabi.h> +#include <hash_map> + +#include <rtl/strbuf.hxx> +#include <rtl/ustrbuf.hxx> +#include <osl/diagnose.h> +#include <osl/mutex.hxx> + +#include <com/sun/star/uno/genfunc.hxx> +#include <typelib/typedescription.hxx> +#include <uno/any2.h> + +#include "share.hxx" + + +using namespace ::std; +using namespace ::osl; +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::__cxxabiv1; + + +namespace CPPU_CURRENT_NAMESPACE +{ + +void dummy_can_throw_anything( char const * ) +{ +} + +//================================================================================================== +static OUString toUNOname( char const * p ) SAL_THROW( () ) +{ +#if OSL_DEBUG_LEVEL > 1 + char const * start = p; +#endif + + // example: N3com3sun4star4lang24IllegalArgumentExceptionE + + OUStringBuffer buf( 64 ); + OSL_ASSERT( 'N' == *p ); + ++p; // skip N + + while ('E' != *p) + { + // read chars count + long n = (*p++ - '0'); + while ('0' <= *p && '9' >= *p) + { + n *= 10; + n += (*p++ - '0'); + } + buf.appendAscii( p, n ); + p += n; + if ('E' != *p) + buf.append( (sal_Unicode)'.' ); + } + +#if OSL_DEBUG_LEVEL > 1 + OUString ret( buf.makeStringAndClear() ); + OString c_ret( OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US ) ); + fprintf( stderr, "> toUNOname(): %s => %s\n", start, c_ret.getStr() ); + return ret; +#else + return buf.makeStringAndClear(); +#endif +} + +//================================================================================================== +class RTTI +{ + typedef hash_map< OUString, type_info *, OUStringHash > t_rtti_map; + + Mutex m_mutex; + t_rtti_map m_rttis; + t_rtti_map m_generatedRttis; + + void * m_hApp; + +public: + RTTI() SAL_THROW( () ); + ~RTTI() SAL_THROW( () ); + + type_info * getRTTI( typelib_CompoundTypeDescription * ) SAL_THROW( () ); +}; +//__________________________________________________________________________________________________ +RTTI::RTTI() SAL_THROW( () ) + : m_hApp( dlopen( 0, RTLD_LAZY ) ) +{ +} +//__________________________________________________________________________________________________ +RTTI::~RTTI() SAL_THROW( () ) +{ + dlclose( m_hApp ); +} + +//__________________________________________________________________________________________________ +type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THROW( () ) +{ + type_info * rtti; + + OUString const & unoName = *(OUString const *)&pTypeDescr->aBase.pTypeName; + + MutexGuard guard( m_mutex ); + t_rtti_map::const_iterator iRttiFind( m_rttis.find( unoName ) ); + if (iRttiFind == m_rttis.end()) + { + // RTTI symbol + OStringBuffer buf( 64 ); + buf.append( RTL_CONSTASCII_STRINGPARAM("_ZTIN") ); + sal_Int32 index = 0; + do + { + OUString token( unoName.getToken( 0, '.', index ) ); + buf.append( token.getLength() ); + OString c_token( OUStringToOString( token, RTL_TEXTENCODING_ASCII_US ) ); + buf.append( c_token ); + } + while (index >= 0); + buf.append( 'E' ); + + OString symName( buf.makeStringAndClear() ); + rtti = (type_info *)dlsym( m_hApp, symName.getStr() ); + + if (rtti) + { + pair< t_rtti_map::iterator, bool > insertion( + m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); + OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + } + else + { + // try to lookup the symbol in the generated rtti map + t_rtti_map::const_iterator iFind( m_generatedRttis.find( unoName ) ); + if (iFind == m_generatedRttis.end()) + { + // we must generate it ! + // symbol and rtti-name is nearly identical, + // the symbol is prefixed with _ZTI + char const * rttiName = symName.getStr() +4; +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr,"generated rtti for %s\n", rttiName ); +#endif + if (pTypeDescr->pBaseTypeDescription) + { + // ensure availability of base + type_info * base_rtti = getRTTI( + (typelib_CompoundTypeDescription *)pTypeDescr->pBaseTypeDescription ); + rtti = new __si_class_type_info( + strdup( rttiName ), (__class_type_info *)base_rtti ); + } + else + { + // this class has no base class + rtti = new __class_type_info( strdup( rttiName ) ); + } + + pair< t_rtti_map::iterator, bool > insertion( + m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); + OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + } + else // taking already generated rtti + { + rtti = iFind->second; + } + } + } + else + { + rtti = iRttiFind->second; + } + + return rtti; +} + +//-------------------------------------------------------------------------------------------------- +static void deleteException( void * pExc ) +{ + __cxa_exception const * header = ((__cxa_exception const *)pExc - 1); + typelib_TypeDescription * pTD = 0; + OUString unoName( toUNOname( header->exceptionType->name() ) ); + ::typelib_typedescription_getByName( &pTD, unoName.pData ); + OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + if (pTD) + { + ::uno_destructData( pExc, pTD, cpp_release ); + ::typelib_typedescription_release( pTD ); + } +} + +//================================================================================================== +void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) +{ + void * pCppExc; + type_info * rtti; + + { + // construct cpp exception object + typelib_TypeDescription * pTypeDescr = 0; + TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); + OSL_ASSERT( pTypeDescr ); + if (! pTypeDescr) + terminate(); + + pCppExc = __cxa_allocate_exception( pTypeDescr->nSize ); + ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp ); + + // destruct uno exception + ::uno_any_destruct( pUnoExc, 0 ); + // avoiding locked counts + static RTTI * s_rtti = 0; + if (! s_rtti) + { + MutexGuard guard( Mutex::getGlobalMutex() ); + if (! s_rtti) + { +#ifdef LEAK_STATIC_DATA + s_rtti = new RTTI(); +#else + static RTTI rtti_data; + s_rtti = &rtti_data; +#endif + } + } + rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + TYPELIB_DANGER_RELEASE( pTypeDescr ); + OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + if (! rtti) + terminate(); + } + + __cxa_throw( pCppExc, rtti, deleteException ); +} + +//================================================================================================== +void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) +{ + OSL_ENSURE( header, "### no exception header!!!" ); + if (! header) + terminate(); + + typelib_TypeDescription * pExcTypeDescr = 0; + OUString unoName( toUNOname( header->exceptionType->name() ) ); + ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); + OSL_ENSURE( pExcTypeDescr, "### can not get type description for exception!!!" ); + if (! pExcTypeDescr) + terminate(); + + // construct uno exception any + ::uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno ); + ::typelib_typedescription_release( pExcTypeDescr ); +} + +} +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/sal/qa/osl/semaphore/makefile.mk b/bridges/source/cpp_uno/gcc3_linux_alpha/makefile.mk index 3cab9d650477..2650c4376933 100644 --- a/sal/qa/osl/semaphore/makefile.mk +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/makefile.mk @@ -27,35 +27,51 @@ PRJ=..$/..$/.. -PRJNAME=sal -TARGET=qa_osl_semaphore - +PRJNAME=bridges +TARGET=gcc3_uno +LIBTARGET=no ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -CFLAGS+= $(LFS_CFLAGS) -CXXFLAGS+= $(LFS_CFLAGS) +# --- Files -------------------------------------------------------- + +.IF "$(COM)$(OS)$(CPU)" == "GCCLINUXL" + +.IF "$(cppu_no_leak)" == "" +CFLAGS += -DLEAK_STATIC_DATA +.ENDIF + +# In case someone enabled the non-standard -fomit-frame-pointer which does not +# work with the .cxx sources in this directory: +CFLAGSCXX += -fno-omit-frame-pointer -# BEGIN ---------------------------------------------------------------- -# auto generated Target:Semaphore by codegen.pl -SHL1OBJS= \ - $(SLO)$/osl_Semaphore.obj +CFLAGSNOOPT=-O0 -SHL1TARGET= osl_Semaphore -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) +SLOFILES= \ + $(SLO)$/except.obj \ + $(SLO)$/cpp2uno.obj \ + $(SLO)$/uno2cpp.obj -SHL1IMPLIB= i$(SHL1TARGET) +SHL1TARGET= $(TARGET) -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = $(PRJ)$/qa$/export.map +SHL1DEF=$(MISC)$/$(SHL1TARGET).def +SHL1IMPLIB=i$(TARGET) +SHL1VERSIONMAP=..$/..$/bridge_exports.map +SHL1RPATH=URELIB -# auto generated Target:Semaphore -# END ------------------------------------------------------------------ +SHL1OBJS = $(SLOFILES) +SHL1LIBS = $(SLB)$/cpp_uno_shared.lib + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(SALLIB) + +.ENDIF # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk + diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/share.hxx b/bridges/source/cpp_uno/gcc3_linux_alpha/share.hxx new file mode 100644 index 000000000000..c2f0189a2065 --- /dev/null +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/share.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * 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 "uno/mapping.h" + +#include <typeinfo> +#include <exception> +#include <cstddef> + +namespace CPPU_CURRENT_NAMESPACE +{ + + void dummy_can_throw_anything( char const * ); + + +// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h + +struct _Unwind_Exception +{ + unsigned exception_class __attribute__((__mode__(__DI__))); + void * exception_cleanup; + unsigned private_1 __attribute__((__mode__(__word__))); + unsigned private_2 __attribute__((__mode__(__word__))); +} __attribute__((__aligned__)); + +struct __cxa_exception +{ + ::std::type_info *exceptionType; + void (*exceptionDestructor)(void *); + + ::std::unexpected_handler unexpectedHandler; + ::std::terminate_handler terminateHandler; + + __cxa_exception *nextException; + + int handlerCount; + + int handlerSwitchValue; + const unsigned char *actionRecord; + const unsigned char *languageSpecificData; + void *catchTemp; + void *adjustedPtr; + + _Unwind_Exception unwindHeader; +}; + +extern "C" void *__cxa_allocate_exception( + std::size_t thrown_size ) throw(); +extern "C" void __cxa_throw ( + void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn)); + +struct __cxa_eh_globals +{ + __cxa_exception *caughtExceptions; + unsigned int uncaughtExceptions; +}; +extern "C" __cxa_eh_globals *__cxa_get_globals () throw(); + +// ----- + +//================================================================================================== +void raiseException( + uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); +//================================================================================================== +void fillUnoException( + __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +} + +namespace axp +{ + enum axplimits { MAX_WORDS_IN_REGS = 6, MAX_GPR_REGS = 6, MAX_SSE_REGS = 6 }; +} + +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx new file mode 100644 index 000000000000..7f51d425806c --- /dev/null +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx @@ -0,0 +1,532 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_bridges.hxx" + +#include <malloc.h> + +#include <com/sun/star/uno/genfunc.hxx> +#include <uno/data.h> + +#include "bridges/cpp_uno/shared/bridge.hxx" +#include "bridges/cpp_uno/shared/types.hxx" +#include "bridges/cpp_uno/shared/unointerfaceproxy.hxx" +#include "bridges/cpp_uno/shared/vtables.hxx" + +#include "share.hxx" + +#include <stdio.h> +#include <string.h> + + +using namespace ::rtl; +using namespace ::com::sun::star::uno; + +void MapReturn(long r0, typelib_TypeClass eTypeClass, sal_uInt64* pRegisterReturn) +{ + register float fret asm("$f0"); + register double dret asm("$f0"); + +#ifdef CMC_DEBUG + fprintf(stderr,"Mapping Return with %lx %ld %f\n", r0, r0, dret); +#endif + switch (eTypeClass) + { + case typelib_TypeClass_HYPER: + case typelib_TypeClass_UNSIGNED_HYPER: + *pRegisterReturn = r0; + break; + case typelib_TypeClass_LONG: + case typelib_TypeClass_UNSIGNED_LONG: + case typelib_TypeClass_ENUM: + *(unsigned int*)pRegisterReturn = (unsigned int)r0; + break; + case typelib_TypeClass_CHAR: + case typelib_TypeClass_SHORT: + case typelib_TypeClass_UNSIGNED_SHORT: + *(unsigned short*)pRegisterReturn = (unsigned short)r0; + break; + case typelib_TypeClass_BOOLEAN: + case typelib_TypeClass_BYTE: + *(unsigned char*)pRegisterReturn = (unsigned char)r0; + break; + case typelib_TypeClass_FLOAT: + *reinterpret_cast<float *>( pRegisterReturn ) = fret; + break; + case typelib_TypeClass_DOUBLE: + *reinterpret_cast<double *>( pRegisterReturn ) = dret; + break; + default: + break; + } +#ifdef CMC_DEBUG + fprintf(stderr, "end of MapReturn with %x\n", pRegisterReturn ? *pRegisterReturn : 0); +#endif +} + +#define INSERT_FLOAT( pSV, nr, pFPR, pDS ) \ + { \ + if ( nr < axp::MAX_WORDS_IN_REGS ) \ + { \ + pFPR[nr++] = *reinterpret_cast<float *>( pSV ); \ + } \ + else \ + *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); \ + } + +#define INSERT_DOUBLE( pSV, nr, pFPR, pDS ) \ + if ( nr < axp::MAX_WORDS_IN_REGS ) \ + pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \ + else \ + *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim! + +#define INSERT_INT64( pSV, nr, pGPR, pDS ) \ + if ( nr < axp::MAX_WORDS_IN_REGS ) \ + pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \ + else \ + *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); + +#define INSERT_INT32( pSV, nr, pGPR, pDS ) \ + if ( nr < axp::MAX_WORDS_IN_REGS ) \ + pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \ + else \ + *pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV ); + +#define INSERT_INT16( pSV, nr, pGPR, pDS ) \ + if ( nr < axp::MAX_WORDS_IN_REGS ) \ + pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \ + else \ + *pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV ); + +#define INSERT_INT8( pSV, nr, pGPR, pDS ) \ + if ( nr < axp::MAX_WORDS_IN_REGS ) \ + pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \ + else \ + *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV ); + +namespace +{ +//================================================================================================== +void callVirtualMethod( + void * pThis, sal_Int32 nVtableIndex, + void * pRegisterReturn, typelib_TypeDescription * pReturnTypeDescr, + sal_uInt64 *pStack, sal_uInt32 nStack, + sal_uInt64 *pGPR, sal_uInt32 nGPR, + double *pFPR, sal_uInt32 nFPR) +{ + // Should not happen, but... + if ( nFPR > axp::MAX_SSE_REGS ) + nFPR = axp::MAX_SSE_REGS; + if ( nGPR > axp::MAX_GPR_REGS ) + nGPR = axp::MAX_GPR_REGS; + +#ifdef CMC_DEBUG + // Let's figure out what is really going on here + { + fprintf( stderr, "= nStack is %d\n", nStack ); + fprintf( stderr, "= callVirtualMethod() =\nGPR's (%d): ", nGPR ); + for ( unsigned int i = 0; i < nGPR; ++i ) + fprintf( stderr, "0x%lx, ", pGPR[i] ); + fprintf( stderr, "\nFPR's (%d): ", nFPR ); + for ( unsigned int i = 0; i < nFPR; ++i ) + fprintf( stderr, "0x%lx (%f), ", pFPR[i], pFPR[i] ); + fprintf( stderr, "\nStack (%d): ", nStack ); + for ( unsigned int i = 0; i < nStack; ++i ) + fprintf( stderr, "0x%lx, ", pStack[i] ); + fprintf( stderr, "\n" ); + fprintf( stderr, "pRegisterReturn is %p\n", pRegisterReturn); + } +#endif + + // Load parameters to stack, if necessary + // Stack, if used, must be 8-bytes aligned + sal_uInt64 *stack = (sal_uInt64 *) __builtin_alloca( nStack * 8 ); + memcpy( stack, pStack, nStack * 8 ); + + // To get pointer to method + // a) get the address of the vtable + sal_uInt64 pMethod = *((sal_uInt64 *)pThis); + // b) get the address from the vtable entry at offset + pMethod += 8 * nVtableIndex; + pMethod = *((sal_uInt64 *)pMethod); + + typedef void (* FunctionCall )( sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64 ); + FunctionCall pFunc = (FunctionCall)pMethod; + + switch (nFPR) //deliberate fall through + { + case 6: + asm volatile("ldt $f16,%0" :: "m"(pFPR[5]) : "$f16"); + case 5: + asm volatile("ldt $f17,%0" :: "m"(pFPR[4]) : "$f17"); + case 4: + asm volatile("ldt $f18,%0" :: "m"(pFPR[3]) : "$f18"); + case 3: + asm volatile("ldt $f19,%0" :: "m"(pFPR[2]) : "$f19"); + case 2: + asm volatile("ldt $f20,%0" :: "m"(pFPR[1]) : "$f20"); + case 1: + asm volatile("ldt $f21,%0" :: "m"(pFPR[0]) : "$f21"); + default: + break; + } + + (*pFunc)(pGPR[0], pGPR[1], pGPR[2], pGPR[3], pGPR[4], pGPR[5]); + register sal_uInt64 r0 __asm__("$0"); + MapReturn(r0, pReturnTypeDescr->eTypeClass, (sal_uInt64*)pRegisterReturn); +} + + +//============================================================================ +static void cpp_call( + bridges::cpp_uno::shared::UnoInterfaceProxy * pThis, + bridges::cpp_uno::shared::VtableSlot aVtableSlot, + typelib_TypeDescriptionReference * pReturnTypeRef, + sal_Int32 nParams, typelib_MethodParameter * pParams, + void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc ) +{ + // max space for: [complex ret ptr], values|ptr ... + sal_uInt64 * pStack = (sal_uInt64 *)alloca( (nParams+3) * sizeof(sal_Int64) ); + sal_uInt64 * pStackStart = pStack; + + sal_uInt64 pGPR[axp::MAX_GPR_REGS]; + double pFPR[axp::MAX_SSE_REGS]; + sal_uInt32 nRegs = 0; + + // return + typelib_TypeDescription * pReturnTypeDescr = 0; + TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); + OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + + void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion + + if (pReturnTypeDescr) + { + if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr )) + { + pCppReturn = pUnoReturn; // direct way for simple types + } + else + { + // complex return via ptr + pCppReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr ) + ? alloca( pReturnTypeDescr->nSize ) + : pUnoReturn); // direct way + INSERT_INT64( &pCppReturn, nRegs, pGPR, pStack ); + } + } + // push "this" pointer + void * pAdjustedThisPtr = reinterpret_cast< void ** >( pThis->getCppI() ) + aVtableSlot.offset; + + INSERT_INT64( &pAdjustedThisPtr, nRegs, pGPR, pStack ); + + // stack space + OSL_ENSURE( sizeof(void *) == sizeof(sal_Int64), "### unexpected size!" ); + // args + void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); + // indizes of values this have to be converted (interface conversion cpp<=>uno) + sal_Int32 * pTempIndizes = (sal_Int32 *)(pCppArgs + nParams); + // type descriptions for reconversions + typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams)); + + sal_Int32 nTempIndizes = 0; + + for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) + { + const typelib_MethodParameter & rParam = pParams[nPos]; + typelib_TypeDescription * pParamTypeDescr = 0; + TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ); + + if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) + { + uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr, + pThis->getBridge()->getUno2Cpp() ); + + switch (pParamTypeDescr->eTypeClass) + { + case typelib_TypeClass_HYPER: + case typelib_TypeClass_UNSIGNED_HYPER: + INSERT_INT64( pCppArgs[nPos], nRegs, pGPR, pStack ); + break; + case typelib_TypeClass_LONG: + case typelib_TypeClass_UNSIGNED_LONG: + case typelib_TypeClass_ENUM: + INSERT_INT32( pCppArgs[nPos], nRegs, pGPR, pStack ); + break; + case typelib_TypeClass_SHORT: + case typelib_TypeClass_CHAR: + case typelib_TypeClass_UNSIGNED_SHORT: + INSERT_INT16( pCppArgs[nPos], nRegs, pGPR, pStack ); + break; + case typelib_TypeClass_BOOLEAN: + case typelib_TypeClass_BYTE: + INSERT_INT8( pCppArgs[nPos], nRegs, pGPR, pStack ); + break; + case typelib_TypeClass_FLOAT: + INSERT_FLOAT( pCppArgs[nPos], nRegs, pFPR, pStack ); + break; + case typelib_TypeClass_DOUBLE: + INSERT_DOUBLE( pCppArgs[nPos], nRegs, pFPR, pStack ); + break; + default: + break; + } + + // no longer needed + TYPELIB_DANGER_RELEASE( pParamTypeDescr ); + } + else // ptr to complex value | ref + { + if (! rParam.bIn) // is pure out + { + // cpp out is constructed mem, uno out is not! + uno_constructData( + pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ), + pParamTypeDescr ); + pTempIndizes[nTempIndizes] = nPos; // default constructed for cpp call + // will be released at reconversion + ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr; + } + // is in/inout + else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr )) + { + uno_copyAndConvertData( + pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ), + pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() ); + + pTempIndizes[nTempIndizes] = nPos; // has to be reconverted + // will be released at reconversion + ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr; + } + else // direct way + { + pCppArgs[nPos] = pUnoArgs[nPos]; + // no longer needed + TYPELIB_DANGER_RELEASE( pParamTypeDescr ); + } + INSERT_INT64( &(pCppArgs[nPos]), nRegs, pGPR, pStack ); + } + } + + try + { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr, + pStackStart, (pStack - pStackStart), + pGPR, nRegs, + pFPR, nRegs ); + // NO exception occured... + *ppUnoExc = 0; + + // reconvert temporary params + for ( ; nTempIndizes--; ) + { + sal_Int32 nIndex = pTempIndizes[nTempIndizes]; + typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes]; + + if (pParams[nIndex].bIn) + { + if (pParams[nIndex].bOut) // inout + { + uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value + uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr, + pThis->getBridge()->getCpp2Uno() ); + } + } + else // pure out + { + uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr, + pThis->getBridge()->getCpp2Uno() ); + } + // destroy temp cpp param => cpp: every param was constructed + uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release ); + + TYPELIB_DANGER_RELEASE( pParamTypeDescr ); + } + // return value + if (pCppReturn && pUnoReturn != pCppReturn) + { + uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr, + pThis->getBridge()->getCpp2Uno() ); + uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); + } + } + catch (...) + { + // fill uno exception + fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, + *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); + + + // temporary params + for ( ; nTempIndizes--; ) + { + sal_Int32 nIndex = pTempIndizes[nTempIndizes]; + // destroy temp cpp param => cpp: every param was constructed + uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], cpp_release ); + TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] ); + } + // return type + if (pReturnTypeDescr) + TYPELIB_DANGER_RELEASE( pReturnTypeDescr ); + } +} +} + +namespace bridges { namespace cpp_uno { namespace shared { + +void unoInterfaceProxyDispatch( + uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr, + void * pReturn, void * pArgs[], uno_Any ** ppException ) +{ +#ifdef CMC_DEBUG + fprintf(stderr, "unoInterfaceProxyDispatch\n"); +#endif + + + // is my surrogate + bridges::cpp_uno::shared::UnoInterfaceProxy * pThis + = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy *> (pUnoI); + + switch (pMemberDescr->eTypeClass) + { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + { + + VtableSlot aVtableSlot( + getVtableSlot( + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription const * >( + pMemberDescr))); + + if (pReturn) + { + // dependent dispatch + cpp_call( + pThis, aVtableSlot, + ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef, + 0, 0, // no params + pReturn, pArgs, ppException ); + } + else + { + // is SET + typelib_MethodParameter aParam; + aParam.pTypeRef = + ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef; + aParam.bIn = sal_True; + aParam.bOut = sal_False; + + typelib_TypeDescriptionReference * pReturnTypeRef = 0; + OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") ); + typelib_typedescriptionreference_new( + &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData ); + + // dependent dispatch + aVtableSlot.index += 1; //get then set method + cpp_call( + pThis, aVtableSlot, + pReturnTypeRef, + 1, &aParam, + pReturn, pArgs, ppException ); + + typelib_typedescriptionreference_release( pReturnTypeRef ); + } + + break; + } + case typelib_TypeClass_INTERFACE_METHOD: + { + + VtableSlot aVtableSlot( + getVtableSlot( + reinterpret_cast< + typelib_InterfaceMethodTypeDescription const * >( + pMemberDescr))); + switch (aVtableSlot.index) + { + // standard calls + case 1: // acquire uno interface + (*pUnoI->acquire)( pUnoI ); + *ppException = 0; + break; + case 2: // release uno interface + (*pUnoI->release)( pUnoI ); + *ppException = 0; + break; + case 0: // queryInterface() opt + { + typelib_TypeDescription * pTD = 0; + TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() ); + if (pTD) + { + uno_Interface * pInterface = 0; + (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)( + pThis->pBridge->getUnoEnv(), + (void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD ); + + if (pInterface) + { + ::uno_any_construct( + reinterpret_cast< uno_Any * >( pReturn ), + &pInterface, pTD, 0 ); + (*pInterface->release)( pInterface ); + TYPELIB_DANGER_RELEASE( pTD ); + *ppException = 0; + break; + } + TYPELIB_DANGER_RELEASE( pTD ); + } + } // else perform queryInterface() + default: + // dependent dispatch + cpp_call( + pThis, aVtableSlot, + ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef, + ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams, + ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams, + pReturn, pArgs, ppException ); + } + break; + } + default: + { + ::com::sun::star::uno::RuntimeException aExc( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type description!") ), + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); + + Type const & rExcType = ::getCppuType( &aExc ); + // binary identical null reference + ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 ); + } + } +} + +} } } +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx index 8b37b633f59e..959452b4d985 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx @@ -61,7 +61,7 @@ namespace long r8, void ** gpreg, double *fpreg, void ** ovrflw, sal_Int64 * pRegisterReturn /* space for register return */ ) { - void ** startovrflw; + void ** startovrflw = ovrflw; int nregs = 0; //number of words passed in registers #ifdef CMC_DEBUG @@ -143,7 +143,7 @@ namespace } else { - if ((startovrflw-ovrflw) & 4) + if ((startovrflw-ovrflw) & 1) ovrflw--; pCppArgs[nPos] = pUnoArgs[nPos] = ((char*)ovrflw - 4); bOverFlowUsed = true; @@ -182,7 +182,7 @@ namespace } else { - if ((startovrflw-ovrflw) & 4) + if ((startovrflw-ovrflw) & 1) ovrflw--; pCppArgs[nPos] = pUnoArgs[nPos] = ((char*)ovrflw - 4); bOverFlowUsed = true; diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk index 50cf80654a94..d5eb2dd6e1d9 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk +++ b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk @@ -77,8 +77,5 @@ SHL1STDLIBS= \ .INCLUDE : target.mk $(SLO)$/%.obj: %.s -#cmc: Ideally --noexecstack would be in operations, but with #i51385# pyuno -#remote bridgeing breaks -# $(CC) -Wa,--noexecstack -c -o $(SLO)$/$(@:b).o $< $(CC) -c -o $(SLO)$/$(@:b).o $< touch $@ diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx index c0166b720f0b..0483e86b7280 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx @@ -100,8 +100,6 @@ enum x86_64_reg_class #define MAX_CLASSES 4 -#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) - /* x86-64 register passing implementation. See x86-64 ABI for details. Goal of this code is to classify each 8bytes of incoming argument by the register class and assign registers accordingly. */ @@ -153,11 +151,8 @@ merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) See the x86-64 PS ABI for details. */ static int -classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_class classes[], int &rByteOffset ) +classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_class classes[], int byteOffset ) { - /* First, align to the right place. */ - rByteOffset = ALIGN( rByteOffset, pTypeRef->pType->nAlignment ); - switch ( pTypeRef->eTypeClass ) { case typelib_TypeClass_VOID: @@ -173,13 +168,13 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: case typelib_TypeClass_ENUM: - if ( ( rByteOffset % 8 + pTypeRef->pType->nSize ) <= 4 ) + if ( ( byteOffset % 8 + pTypeRef->pType->nSize ) <= 4 ) classes[0] = X86_64_INTEGERSI_CLASS; else classes[0] = X86_64_INTEGER_CLASS; return 1; case typelib_TypeClass_FLOAT: - if ( ( rByteOffset % 8 ) == 0 ) + if ( ( byteOffset % 8 ) == 0 ) classes[0] = X86_64_SSESF_CLASS; else classes[0] = X86_64_SSE_CLASS; @@ -226,9 +221,9 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c for ( sal_Int32 nMember = 0; nMember < pStruct->nMembers; ++nMember ) { typelib_TypeDescriptionReference *pTypeInStruct = pStruct->ppTypeRefs[ nMember ]; - rByteOffset = pStruct->pMemberOffsets[ nMember ]; + int offset = byteOffset + pStruct->pMemberOffsets[ nMember ]; - int num = classify_argument( pTypeInStruct, subclasses, rByteOffset ); + int num = classify_argument( pTypeInStruct, subclasses, offset ); if ( num == 0 ) { @@ -238,7 +233,7 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c for ( int i = 0; i < num; i++ ) { - int pos = rByteOffset / 8; + int pos = offset / 8; classes[i + pos] = merge_classes( subclasses[i], classes[i + pos] ); } } @@ -281,10 +276,9 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c bool x86_64::examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE ) { enum x86_64_reg_class classes[MAX_CLASSES]; - int offset = 0; int n; - n = classify_argument( pTypeRef, classes, offset ); + n = classify_argument( pTypeRef, classes, 0 ); if ( n == 0 ) return false; @@ -330,10 +324,9 @@ bool x86_64::return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64 *pGPR, const double *pSSE, void *pStruct ) { enum x86_64_reg_class classes[MAX_CLASSES]; - int offset = 0; int n; - n = classify_argument( pTypeRef, classes, offset ); + n = classify_argument( pTypeRef, classes, 0 ); sal_uInt64 *pStructAlign = reinterpret_cast<sal_uInt64 *>( pStruct ); for ( n--; n >= 0; n-- ) @@ -441,10 +434,10 @@ ffi_prep_args (stackLayout *stack, extended_cif *ecif) /* All easy cases are eliminated. Now fire the big guns. */ enum x86_64_reg_class classes[MAX_CLASSES]; - int offset = 0, j, num; + int j, num; void *a; - num = classify_argument (*p_arg, classes, &offset); + num = classify_argument (*p_arg, classes, 0); for (j=0, a=*p_argv; j<num; j++, a+=8) { switch (classes[j]) @@ -571,7 +564,7 @@ ffi_fill_return_value (return_value *rv, extended_cif *ecif) ; } - num = classify_argument (ecif->cif->rtype, classes, &i); + num = classify_argument (ecif->cif->rtype, classes, 0); if (num == 0) /* Return in memory. */ diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/makefile.mk b/bridges/source/cpp_uno/gcc3_macosx_intel/makefile.mk index 92d575a14dfb..7bca40bbaf97 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_intel/makefile.mk +++ b/bridges/source/cpp_uno/gcc3_macosx_intel/makefile.mk @@ -72,8 +72,5 @@ SHL1STDLIBS= \ .INCLUDE : target.mk $(SLO)$/%.obj: %.s -#cmc: Ideally --noexecstack would be in operations, but with #i51385# pyuno -#remote bridgeing breaks -# $(CC) -Wa,--noexecstack -c -o $(SLO)$/$(@:b).o $< $(CC) -c -o $(SLO)$/$(@:b).o $< touch $@ diff --git a/bridges/source/cpp_uno/mingw_intel/makefile.mk b/bridges/source/cpp_uno/mingw_intel/makefile.mk index a23288f9f677..2c7a8da48527 100644 --- a/bridges/source/cpp_uno/mingw_intel/makefile.mk +++ b/bridges/source/cpp_uno/mingw_intel/makefile.mk @@ -87,8 +87,5 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk $(SLO)$/%.obj: %.s -#cmc: Ideally --noexecstack would be in operations, but with #i51385# pyuno -#remote bridgeing breaks -# $(CC) -Wa,--noexecstack -c -o $(SLO)$/$(@:b).o $< $(CC) -c -o $(SLO)$/$(@:b).obj $< touch $@ diff --git a/bridges/source/remote/urp/urp_job.hxx b/bridges/source/remote/urp/urp_job.hxx index f0e338e4728c..ce58b1f3f779 100644 --- a/bridges/source/remote/urp/urp_job.hxx +++ b/bridges/source/remote/urp/urp_job.hxx @@ -76,9 +76,6 @@ public: ~Job(); - inline void setUnmarshal( Unmarshal *p ) - { m_pUnmarshal = p; } - public: remote_Context *m_pContext; Unmarshal *m_pUnmarshal; @@ -87,7 +84,7 @@ public: ::bridges_remote::RemoteThreadCounter m_counter; }; -class ClientJob : public Job +class ClientJob : private Job { public: // pContext is null for bridge-internal UrpProtocolProperties requests @@ -123,6 +120,9 @@ public: { return m_bBridgePropertyCall; } inline sal_Bool isOneway() { return m_bOneway; } + + inline void setUnmarshal( Unmarshal *p ) + { m_pUnmarshal = p; } public: typelib_InterfaceMethodTypeDescription *m_pMethodType; typelib_InterfaceAttributeTypeDescription *m_pAttributeType; @@ -172,7 +172,7 @@ struct ServerJobEntry sal_Bool m_bIgnoreCache; }; -class ServerMultiJob : public Job +class ServerMultiJob : private Job { public: ServerMultiJob( uno_Environment *pEnvRemote, diff --git a/bridges/test/java_uno/acquire/makefile.mk b/bridges/test/java_uno/acquire/makefile.mk index 96ee48f62889..def12dd53c49 100644 --- a/bridges/test/java_uno/acquire/makefile.mk +++ b/bridges/test/java_uno/acquire/makefile.mk @@ -43,7 +43,7 @@ SLOFILES = $(SLO)$/testacquire.obj SHL1TARGET = testacquire.uno SHL1OBJS = $(SLOFILES) SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) -SHL1VERSIONMAP = testacquire.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1IMPLIB = itestacquire JAVAFILES = TestAcquire.java @@ -52,10 +52,10 @@ JARFILES = OOoRunner.jar juh.jar jurt.jar ridl.jar .INCLUDE: target.mk ALLTAR: \ - $(BIN)$/testacquire-java-client$(SCRIPTEXT) \ - $(BIN)$/testacquire-java-server$(SCRIPTEXT) \ - $(BIN)$/testacquire-native-client$(SCRIPTEXT) \ - $(BIN)$/testacquire-native-server$(SCRIPTEXT) + $(BIN)$/testacquire-java-client \ + $(BIN)$/testacquire-java-server \ + $(BIN)$/testacquire-native-client \ + $(BIN)$/testacquire-native-server .IF "$(GUI)" == "WNT" GIVE_EXEC_RIGHTS = @echo @@ -86,7 +86,7 @@ $(SLOFILES) $(JAVACLASSFILES): $(BIN)$/$(TARGET).rdb TEST_JAVAUNO_ACQUIRE_UNO_URL := \ \"'uno:socket,host=127.0.0.1,port=2002;urp;test'\" -$(BIN)$/testacquire-java-client$(SCRIPTEXT): +$(BIN)$/testacquire-java-client: echo java -classpath \ ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)\ ..$/class$/java_uno.jar$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ @@ -94,7 +94,7 @@ $(BIN)$/testacquire-java-client$(SCRIPTEXT): $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@ $(GIVE_EXEC_RIGHTS) $@ -$(BIN)$/testacquire-java-server$(SCRIPTEXT): +$(BIN)$/testacquire-java-server: echo java -classpath \ ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)\ ..$/class$/java_uno.jar$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ @@ -102,14 +102,14 @@ $(BIN)$/testacquire-java-server$(SCRIPTEXT): $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@ $(GIVE_EXEC_RIGHTS) $@ -$(BIN)$/testacquire-native-client$(SCRIPTEXT): +$(BIN)$/testacquire-native-client: echo '$(AUGMENT_LIBRARY_PATH)' uno \ -c com.sun.star.test.bridges.testacquire.impl \ -l ../lib/$(SHL1TARGETN:f) -ro $(TARGET).rdb -- \ $(TEST_JAVAUNO_ACQUIRE_UNO_URL) > $@ $(GIVE_EXEC_RIGHTS) $@ -$(BIN)$/testacquire-native-server$(SCRIPTEXT): +$(BIN)$/testacquire-native-server: echo '$(AUGMENT_LIBRARY_PATH)' uno \ -c com.sun.star.test.bridges.testacquire.impl \ -l ../lib/$(SHL1TARGETN:f) -ro $(TARGET).rdb \ diff --git a/bridges/test/java_uno/acquire/testacquire.map b/bridges/test/java_uno/acquire/testacquire.map deleted file mode 100644 index 227274db922d..000000000000 --- a/bridges/test/java_uno/acquire/testacquire.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3.1 { - global: - component_getFactory; - component_getImplementationEnvironment; - component_writeInfo; - local: - *; -}; diff --git a/bridges/test/java_uno/any/makefile.mk b/bridges/test/java_uno/any/makefile.mk index 564ee80c2e80..888fae21d3d2 100644 --- a/bridges/test/java_uno/any/makefile.mk +++ b/bridges/test/java_uno/any/makefile.mk @@ -100,16 +100,16 @@ $(SLOFILES) : $(MISC)$/gen_files.flag $(JAVACLASSFILES) : $(MISC)$/gen_files.flag ALLTAR : \ - $(OUT)$/bin$/TestRemote$(SCRIPTEXT) \ - $(OUT)$/bin$/TestJni$(SCRIPTEXT) + $(OUT)$/bin$/TestRemote \ + $(OUT)$/bin$/TestJni -$(OUT)$/bin$/TestRemote$(SCRIPTEXT) : $(JAVACLASSFILES) +$(OUT)$/bin$/TestRemote : $(JAVACLASSFILES) -rm -f $@ echo java -classpath ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ test.java_uno.anytest.TestRemote > $@ $(GIVE_EXEC_RIGHTS) $@ -$(OUT)$/bin$/TestJni$(SCRIPTEXT) : $(JAVACLASSFILES) +$(OUT)$/bin$/TestJni : $(JAVACLASSFILES) -rm -f $@ echo '$(AUGMENT_LIBRARY_PATH)' java -classpath \ .$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ diff --git a/bridges/test/java_uno/any/test_javauno_any.map b/bridges/test/java_uno/any/test_javauno_any.map index 4959db8fccc8..c50f7b162db7 100644 --- a/bridges/test/java_uno/any/test_javauno_any.map +++ b/bridges/test/java_uno/any/test_javauno_any.map @@ -1,4 +1,4 @@ -UDK_3.1 { +UDK_3_0_0 { global: Java_test_java_1uno_anytest_TestJni_create_1jni_1transport; local: diff --git a/bridges/test/java_uno/equals/makefile.mk b/bridges/test/java_uno/equals/makefile.mk index 3b71858498fb..9ac266f80ff5 100644 --- a/bridges/test/java_uno/equals/makefile.mk +++ b/bridges/test/java_uno/equals/makefile.mk @@ -50,7 +50,7 @@ SLOFILES = $(SLO)$/testequals.obj SHL1TARGET = testequals.uno SHL1OBJS = $(SLOFILES) SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) -SHL1VERSIONMAP = testequals.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1IMPLIB = itestequals JAVAFILES = TestEquals.java @@ -58,7 +58,7 @@ JARFILES = juh.jar jurt.jar ridl.jar .INCLUDE: target.mk -ALLTAR: $(BIN)$/testequals$(SCRIPTEXT) +ALLTAR: $(BIN)$/testequals .IF "$(GUI)" == "WNT" GIVE_EXEC_RIGHTS = @echo @@ -81,7 +81,7 @@ $(MISC)$/$(TARGET).rdb: types.idl $(SLOFILES) $(JAVACLASSFILES): $(MISC)$/$(TARGET).rdb -$(BIN)$/testequals$(SCRIPTEXT): $(BIN)$/testequals_services.rdb +$(BIN)$/testequals: $(BIN)$/testequals_services.rdb echo '$(AUGMENT_LIBRARY_PATH)' java -classpath \ ..$/class$/test$(PATH_SEPERATOR)..$/class$(PATH_SEPERATOR)\ ..$/class$/java_uno.jar$(PATH_SEPERATOR)$(EXEC_CLASSPATH) \ diff --git a/bridges/test/java_uno/equals/testequals.map b/bridges/test/java_uno/equals/testequals.map deleted file mode 100644 index 227274db922d..000000000000 --- a/bridges/test/java_uno/equals/testequals.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3.1 { - global: - component_getFactory; - component_getImplementationEnvironment; - component_writeInfo; - local: - *; -}; diff --git a/bridges/test/java_uno/nativethreadpool/makefile.mk b/bridges/test/java_uno/nativethreadpool/makefile.mk index 162c5c225175..d4926e07307b 100644 --- a/bridges/test/java_uno/nativethreadpool/makefile.mk +++ b/bridges/test/java_uno/nativethreadpool/makefile.mk @@ -97,7 +97,7 @@ $(BIN)$/$(TARGET).rdb .ERRREMOVE: $(MISC)$/$(TARGET)$/types.rdb \ $(REGCOMP) -register -r $(MISC)$/$(TARGET)$/bootstrap.rdb \ -c javaloader.uno$(DLLPOST) -c javavm.uno$(DLLPOST) \ -c stocservices.uno$(DLLPOST) -.IF "$(GUI)" == "WNT" || "$(USE_SHELL)" != "bash" +.IF "$(GUI)" == "WNT" ERROR -- missing platform .ELSE # GUI, WNT + export OO_JAVA_PROPERTIES='RuntimeLib=$(JVM_LIB_URL)' && \ @@ -107,7 +107,7 @@ $(BIN)$/$(TARGET).rdb .ERRREMOVE: $(MISC)$/$(TARGET)$/types.rdb \ .ENDIF # GUI, WNT test .PHONY: $(SHL1TARGETN) $(BIN)$/$(TARGET).uno.jar $(BIN)$/$(TARGET).rdb -.IF "$(GUI)" == "WNT" || "$(USE_SHELL)" != "bash" +.IF "$(GUI)" == "WNT" ERROR -- missing platform .ELSE # GUI, WNT $(AUGMENT_LIBRARY_PATH) uno -c test.javauno.nativethreadpool.server \ diff --git a/cli_ure/source/basetypes/makefile.mk b/cli_ure/source/basetypes/makefile.mk index 83269c4193a3..5547c32de0df 100644 --- a/cli_ure/source/basetypes/makefile.mk +++ b/cli_ure/source/basetypes/makefile.mk @@ -37,13 +37,6 @@ TARGET = basetypes .INCLUDE : $(PRJ)$/util$/target.pmk .INCLUDE : target.mk - -.IF "$(USE_SHELL)"!="4nt" -ECHOQUOTE=' -.ELSE -ECHOQUOTE= -.ENDIF - .IF "$(BUILD_FOR_CLI)" != "" .INCLUDE : $(BIN)$/cliureversion.mk @@ -73,15 +66,15 @@ CSFILES = \ .IF "$(CCNUMVER)" <= "001399999999" $(ASSEMBLY_ATTRIBUTES) : assembly.cs makefile.mk $(BIN)$/cliuno.snk $(BIN)$/cliureversion.mk $(GNUCOPY) -p assembly.cs $@ - echo $(ECHOQUOTE) \ - [assembly:System.Reflection.AssemblyVersion( "$(CLI_BASETYPES_NEW_VERSION)")] \ - [assembly:System.Reflection.AssemblyKeyFile(@"$(BIN)$/cliuno.snk")]$(ECHOQUOTE) \ + echo \ + '[assembly:System.Reflection.AssemblyVersion( "$(CLI_BASETYPES_NEW_VERSION)")] \ + [assembly:System.Reflection.AssemblyKeyFile(@"$(BIN)$/cliuno.snk")]' \ >> $@ .ELSE $(ASSEMBLY_ATTRIBUTES) : assembly.cs makefile.mk $(BIN)$/cliuno.snk $(BIN)$/cliureversion.mk $(GNUCOPY) -p assembly.cs $@ - echo $(ECHOQUOTE) \ - [assembly:System.Reflection.AssemblyVersion( "$(CLI_BASETYPES_NEW_VERSION)")]$(ECHOQUOTE) \ + echo \ + '[assembly:System.Reflection.AssemblyVersion( "$(CLI_BASETYPES_NEW_VERSION)")]' \ >> $@ .ENDIF diff --git a/cli_ure/source/climaker/makefile.mk b/cli_ure/source/climaker/makefile.mk index 8bea8f5c60e7..b001a1545fae 100644 --- a/cli_ure/source/climaker/makefile.mk +++ b/cli_ure/source/climaker/makefile.mk @@ -122,9 +122,7 @@ ALLTAR: \ #Create the config file that is used with the policy assembly $(CLIMAKER_CONFIG): climaker.exe.config $(COPY) $< $@ -.IF "$(USE_SHELL)"!="4nt" chmod +x $@ -.ENDIF # "$(USE_SHELL)"!="4nt" .IF "$(BUILD_FOR_CLI)" != "" diff --git a/cli_ure/source/native/makefile.mk b/cli_ure/source/native/makefile.mk index 333884bcdf73..2c8be1a9b5b9 100644 --- a/cli_ure/source/native/makefile.mk +++ b/cli_ure/source/native/makefile.mk @@ -45,13 +45,6 @@ CCACHE_DISABLE=TRUE use_shl_versions= -.IF "$(USE_SHELL)"!="4nt" -ECHOQUOTE=' -.ELSE -ECHOQUOTE= -.ENDIF - - .IF "$(BUILD_FOR_CLI)" == "" #do not even build the cxx files because they contain cli cpp all: @@ -143,11 +136,11 @@ CFLAGSCXX += -clr:oldSyntax $(ASSEMBLY_ATTRIBUTES) : assembly.cxx $(BIN)$/cliuno.snk $(BIN)$/cliureversion.mk @echo $(ASSEMBLY_KEY_X) $(GNUCOPY) -p assembly.cxx $@ - echo $(ECHOQUOTE) \ - [assembly:System::Reflection::AssemblyVersion( "$(CLI_CPPUHELPER_NEW_VERSION)" )]; $(ECHOQUOTE) \ + echo \ + '[assembly:System::Reflection::AssemblyVersion( "$(CLI_CPPUHELPER_NEW_VERSION)" )];' \ >> $(OUT)$/misc$/assembly_cppuhelper.cxx - echo $(ECHOQUOTE) \ - [assembly:System::Reflection::AssemblyKeyFile($(ASSEMBLY_KEY_X))]; $(ECHOQUOTE) \ + echo \ + '[assembly:System::Reflection::AssemblyKeyFile($(ASSEMBLY_KEY_X))];' \ >> $(OUT)$/misc$/assembly_cppuhelper.cxx diff --git a/cli_ure/source/native/msvc.map b/cli_ure/source/native/msvc.map index 2fba6b6d3e7e..429f750cc2b0 100644 --- a/cli_ure/source/native/msvc.map +++ b/cli_ure/source/native/msvc.map @@ -1,4 +1,4 @@ -UDK_3.1 { +UDK_3_0_0 { global: local: diff --git a/cli_ure/source/ure/makefile.mk b/cli_ure/source/ure/makefile.mk index 29e9c7770a8c..3e0290888cc5 100644 --- a/cli_ure/source/ure/makefile.mk +++ b/cli_ure/source/ure/makefile.mk @@ -37,13 +37,6 @@ TARGET = ure .INCLUDE : $(PRJ)$/util$/target.pmk .INCLUDE : target.mk - -.IF "$(USE_SHELL)"!="4nt" -ECHOQUOTE=' -.ELSE -ECHOQUOTE= -.ENDIF - .IF "$(BUILD_FOR_CLI)" != "" .INCLUDE : $(BIN)$/cliureversion.mk @@ -69,15 +62,15 @@ CSFILES = \ .IF "$(CCNUMVER)" <= "001399999999" $(ASSEMBLY_ATTRIBUTES) : assembly.cs makefile.mk $(BIN)$/cliuno.snk $(BIN)$/cliureversion.mk $(GNUCOPY) -p assembly.cs $@ - echo $(ECHOQUOTE) \ - [assembly:System.Reflection.AssemblyVersion( "$(CLI_URE_NEW_VERSION)")] \ - [assembly:System.Reflection.AssemblyKeyFile(@"$(BIN)$/cliuno.snk")]$(ECHOQUOTE) \ + echo \ + '[assembly:System.Reflection.AssemblyVersion( "$(CLI_URE_NEW_VERSION)")] \ + [assembly:System.Reflection.AssemblyKeyFile(@"$(BIN)$/cliuno.snk")]' \ >> $@ .ELSE $(ASSEMBLY_ATTRIBUTES) : assembly.cs makefile.mk $(BIN)$/cliuno.snk $(BIN)$/cliureversion.mk $(GNUCOPY) -p assembly.cs $@ - echo $(ECHOQUOTE) \ - [assembly:System.Reflection.AssemblyVersion( "$(CLI_URE_NEW_VERSION)")]$(ECHOQUOTE) \ + echo \ + '[assembly:System.Reflection.AssemblyVersion( "$(CLI_URE_NEW_VERSION)")]' \ >> $@ .ENDIF diff --git a/cli_ure/version/makefile.mk b/cli_ure/version/makefile.mk index e71a63746e54..2b5913100be4 100644 --- a/cli_ure/version/makefile.mk +++ b/cli_ure/version/makefile.mk @@ -37,15 +37,6 @@ TARGET = cliureversion.mk .INCLUDE : $(PRJ)$/util$/target.pmk .INCLUDE : target.mk - -.IF "$(USE_SHELL)"!="4nt" -ECHOQUOTE=' -.ELSE -ECHOQUOTE= -.ENDIF - - - ALLTAR : \ $(BIN)$/cliureversion.mk diff --git a/cli_ure/version/version.txt b/cli_ure/version/version.txt index d90b3ac4446a..15dac78d4ed8 100644 --- a/cli_ure/version/version.txt +++ b/cli_ure/version/version.txt @@ -25,23 +25,23 @@ # #************************************************************************* -CLI_URETYPES_NEW_VERSION=1.0.4.0 -CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.3.0 -CLI_URETYPES_POLICY_VERSION=4.0.0.0 +CLI_URETYPES_NEW_VERSION=1.0.6.0 +CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.5.0 +CLI_URETYPES_POLICY_VERSION=6.0.0.0 CLI_URETYPES_POLICY_ASSEMBLY=policy.1.0.cli_uretypes -CLI_BASETYPES_NEW_VERSION=1.0.15.0 -CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.14.0 -CLI_BASETYPES_POLICY_VERSION=15.0.0.0 +CLI_BASETYPES_NEW_VERSION=1.0.17.0 +CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.16.0 +CLI_BASETYPES_POLICY_VERSION=17.0.0.0 CLI_BASETYPES_POLICY_ASSEMBLY=policy.1.0.cli_basetypes -CLI_URE_NEW_VERSION=1.0.18.0 -CLI_URE_OLD_VERSION=1.0.0.0-1.0.17.0 -CLI_URE_POLICY_VERSION=18.0.0.0 +CLI_URE_NEW_VERSION=1.0.20.0 +CLI_URE_OLD_VERSION=1.0.0.0-1.0.19.0 +CLI_URE_POLICY_VERSION=20.0.0.0 CLI_URE_POLICY_ASSEMBLY=policy.1.0.cli_ure -CLI_CPPUHELPER_NEW_VERSION=1.0.18.0 -CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.17.0 -CLI_CPPUHELPER_POLICY_VERSION=18.0.0.0 +CLI_CPPUHELPER_NEW_VERSION=1.0.20.0 +CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.19.0 +CLI_CPPUHELPER_POLICY_VERSION=20.0.0.0 CLI_CPPUHELPER_POLICY_ASSEMBLY=policy.1.0.cli_cppuhelper diff --git a/codemaker/test/cppumaker/makefile.mk b/codemaker/test/cppumaker/makefile.mk index 3aa9dc65d90c..964ae166cdf5 100644 --- a/codemaker/test/cppumaker/makefile.mk +++ b/codemaker/test/cppumaker/makefile.mk @@ -33,6 +33,8 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk +CFLAGSCXX += $(CPPUNIT_CFLAGS) + DLLPRE = # no leading "lib" on .so files INCPRE += $(MISC)$/$(TARGET)$/inc diff --git a/cppu/qa/makefile.mk b/cppu/qa/makefile.mk index 51d9dfe22374..b40d3512e575 100644 --- a/cppu/qa/makefile.mk +++ b/cppu/qa/makefile.mk @@ -33,6 +33,8 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk +CFLAGSCXX += $(CPPUNIT_CFLAGS) + DLLPRE = # no leading "lib" on .so files INCPRE += $(MISC)$/$(TARGET)$/inc diff --git a/cppuhelper/prj/build.lst b/cppuhelper/prj/build.lst index db8ddcaae6c8..de66b2d61a4b 100644 --- a/cppuhelper/prj/build.lst +++ b/cppuhelper/prj/build.lst @@ -3,3 +3,4 @@ ch cppuhelper usr1 - all ch_mkout NULL ch cppuhelper\inc nmake - all ch_include NULL ch cppuhelper\source nmake - all ch_source ch_unotypes ch_include NULL ch cppuhelper\unotypes nmake - all ch_unotypes NULL +ch cppuhelper\qa\propertysetmixin nmake - all ch_qa_propertysetmixin ch_source NULL diff --git a/cppuhelper/qa/ifcontainer/export.map b/cppuhelper/qa/ifcontainer/export.map index 4ca70fa85463..879fa8953788 100644 --- a/cppuhelper/qa/ifcontainer/export.map +++ b/cppuhelper/qa/ifcontainer/export.map @@ -1,4 +1,4 @@ -UDK_3.0 { +UDK_3_0_0 { global: registerAllTestFunction; diff --git a/cppuhelper/qa/ifcontainer/makefile.mk b/cppuhelper/qa/ifcontainer/makefile.mk index 1e93701d3859..3277b4c204ea 100644 --- a/cppuhelper/qa/ifcontainer/makefile.mk +++ b/cppuhelper/qa/ifcontainer/makefile.mk @@ -35,6 +35,7 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk +CFLAGSCXX += $(CPPUNIT_CFLAGS) # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl diff --git a/cppuhelper/qa/propertysetmixin/comp.map b/cppuhelper/qa/propertysetmixin/comp.map deleted file mode 100644 index e4b038369818..000000000000 --- a/cppuhelper/qa/propertysetmixin/comp.map +++ /dev/null @@ -1,36 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -UDK_3_0_0 { - global: - component_getFactory; - component_getImplementationEnvironment; - component_writeInfo; - - local: - *; -}; diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk index 8bf652d33b9b..edd4795fc115 100644 --- a/cppuhelper/qa/propertysetmixin/makefile.mk +++ b/cppuhelper/qa/propertysetmixin/makefile.mk @@ -25,46 +25,44 @@ # #************************************************************************* -PRJ := ..$/.. +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ := ../.. PRJNAME := cppuhelper TARGET := qa_propertysetmixin -PACKAGE = test$/cppuhelper$/propertysetmixin$/comp +PACKAGE = test/cppuhelper/propertysetmixin/comp ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk -.IF "$(GUI)" == "WNT" -FILEURLPREFIX = file:/// -MY_URE_INTERNAL_JAVA_DIR=$(strip $(subst,\,/ file:///$(shell @$(WRAPCMD) echo $(SOLARBINDIR)))) +.IF "$(OS)" == "WNT" +my_file = file:/// .ELSE -FILEURLPREFIX = file:// -MY_URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR) -.ENDIF - - +my_file = file:// +.END DLLPRE = # no leading "lib" on .so files -INCPRE += -I$(MISC)$/$(TARGET)$/inc +INCPRE += -I$(MISC)/$(TARGET)/inc +CFLAGSCXX += $(CPPUNIT_CFLAGS) SHL1TARGET = $(TARGET) -SHL1OBJS = $(SLO)$/test_propertysetmixin.obj -SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(CPPUNITLIB) $(SALLIB) $(TESTSHL2LIB) +SHL1OBJS = $(SLO)/test_propertysetmixin.obj +SHL1VERSIONMAP = test.map +SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(CPPUNITLIB) $(SALLIB) SHL1IMPLIB = i$(SHL1TARGET) +SHL1RPATH = NONE DEF1NAME = $(SHL1TARGET) -.IF "$(COMNAME)" == "gcc3" -SHL1VERSIONMAP = test.gcc3.map -.ELSE -SHL1VERSIONMAP = test.map -.ENDIF - SHL2TARGET = $(TARGET).uno -SHL2OBJS = $(SLO)$/comp_propertysetmixin.obj -SHL2VERSIONMAP = comp.map +SHL2OBJS = $(SLO)/comp_propertysetmixin.obj +SHL2VERSIONMAP = $(SOLARENV)/src/component.map SHL2STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) SHL2IMPLIB = i$(SHL2TARGET) +SH21RPATH = NONE DEF2NAME = $(SHL2TARGET) SLOFILES = $(SHL1OBJS) $(SHL2OBJS) @@ -76,63 +74,52 @@ JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar ALLTAR: test -$(MISC)$/$(TARGET)$/types.urd: types.idl +$(MISC)/$(TARGET)/types.urd: types.idl - $(MKDIR) $(@:d) $(IDLC) -O$(@:d) -I$(SOLARIDLDIR) -cid -we $< -$(MISC)$/$(TARGET)$/types.rdb .ERRREMOVE: $(MISC)$/$(TARGET)$/types.urd +$(MISC)/$(TARGET)/types.rdb: $(MISC)/$(TARGET)/types.urd - $(RM) $@ $(REGMERGE) $@ /UCR $< -$(MISC)$/$(TARGET)$/uno.rdb .ERRREMOVE: $(MISC)$/$(TARGET)$/types.rdb \ - $(DLLDEST)$/$(SHL2TARGET)$(DLLPOST) \ - $(MISC)$/$(TARGET)$/$(TARGET).uno.jar $(MISC)$/$(TARGET)$/bootstrap.rdb +$(MISC)/$(TARGET)/uno.rdb: $(MISC)/$(TARGET)/types.rdb $(SHL2TARGETN) \ + $(MISC)/$(TARGET)/$(TARGET).uno.jar $(MISC)/$(TARGET)/bootstrap.rdb - $(MKDIR) $(@:d) - $(COPY) $(SOLARBINDIR)$/types.rdb $@ - $(REGMERGE) $@ / $(MISC)$/$(TARGET)$/types.rdb - $(REGCOMP) -register -r $@ -c javaloader.uno$(DLLPOST) \ - -c javavm.uno$(DLLPOST) -c reflection.uno$(DLLPOST) \ - -c stocservices.uno$(DLLPOST) - $(REGCOMP) -register -r $@ \ - -c $(subst,$/,/ $(DLLDEST)$/$(SHL2TARGET)$(DLLPOST)) - $(REGCOMP) -register -br $(MISC)$/$(TARGET)$/bootstrap.rdb -r $@ \ - -c \ - $(subst,$/,/ $(FILEURLPREFIX)$(PWD)$/$(MISC)$/$(TARGET)$/$(TARGET).uno.jar) \ - -classpath $(CLASSPATH) \ - -env:URE_INTERNAL_JAVA_DIR=$(MY_URE_INTERNAL_JAVA_DIR) - -$(MISC)$/$(TARGET)$/bootstrap.rdb .ERRREMOVE: + $(COPY) $(SOLARBINDIR)/types.rdb $@ + $(REGMERGE) $@ / $(MISC)/$(TARGET)/types.rdb + $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \ + -c reflection.uno -c stocservices.uno -c $(SHL2TARGETN) + $(REGCOMP) -register -br $(MISC)/$(TARGET)/bootstrap.rdb -r $@ \ + -c $(my_file)$(PWD)/$(MISC)/$(TARGET)/$(TARGET).uno.jar \ + -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) + +$(MISC)/$(TARGET)/bootstrap.rdb: - $(MKDIR) $(@:d) - $(COPY) $(SOLARBINDIR)$/types.rdb $@ - $(REGCOMP) -register -r $@ -c javaloader.uno$(DLLPOST) \ - -c javavm.uno$(DLLPOST) -c stocservices.uno$(DLLPOST) + $(COPY) $(SOLARBINDIR)/types.rdb $@ + $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \ + -c stocservices.uno -$(MISC)$/$(TARGET)$/cppumaker.flag: $(MISC)$/$(TARGET)$/types.rdb - $(CPPUMAKER) -O$(MISC)$/$(TARGET)$/inc -BUCR -Gc \ - -X$(SOLARBINDIR)$/types.rdb $< +$(MISC)/$(TARGET)/cppumaker.flag: $(MISC)/$(TARGET)/types.rdb + $(CPPUMAKER) -O$(MISC)/$(TARGET)/inc -BUCR -Gc \ + -X$(SOLARBINDIR)/types.rdb $< $(TOUCH) $@ -$(SLOFILES): $(MISC)$/$(TARGET)$/cppumaker.flag +$(SLOFILES): $(MISC)/$(TARGET)/cppumaker.flag -$(MISC)$/$(TARGET)$/javamaker.flag: $(MISC)$/$(TARGET)$/types.rdb - $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)$/types.rdb $< +$(MISC)/$(TARGET)/javamaker.flag: $(MISC)/$(TARGET)/types.rdb + $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/types.rdb $< $(TOUCH) $@ -# The following dependency (to execute javac whenever javamaker has run) does -# not work reliably, see #i28827#: -$(JAVAFILES) $(JAVACLASSFILES): $(MISC)$/$(TARGET)$/javamaker.flag +$(JAVATARGET): $(MISC)/$(TARGET)/javamaker.flag -$(MISC)$/$(TARGET)$/$(TARGET).uno.jar: $(JAVACLASSFILES) \ - $(MISC)$/$(TARGET)$/javamaker.flag manifest +$(MISC)/$(TARGET)/$(TARGET).uno.jar: $(JAVATARGET) \ + $(MISC)/$(TARGET)/javamaker.flag manifest jar cfm $@ manifest -C $(CLASSDIR) test/cppuhelper/propertysetmixin -test .PHONY: $(SHL1TARGETN) $(MISC)$/$(TARGET)$/uno.rdb -.IF "$(GUI)" == "WNT" - set CLASSPATH=$(CLASSPATH) && \ - set URE_INTERNAL_JAVA_DIR=$(MY_URE_INTERNAL_JAVA_DIR) && \ - testshl2 $(SHL1TARGETN) -forward "$(MISC)$/$(TARGET)$/uno.rdb#$(SOLARBINDIR)" -.ELSE - setenv CLASSPATH $(CLASSPATH) && \ - setenv URE_INTERNAL_JAVA_DIR $(MY_URE_INTERNAL_JAVA_DIR) && \ - testshl2 $(SHL1TARGETN) -forward "$(MISC)$/$(TARGET)$/uno.rdb#$(SOLARLIBDIR)" -.ENDIF +test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/uno.rdb + $(CPPUNITTESTER) $(SHL1TARGETN) \ + -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \ + -env:URE_INTERNAL_LIB_DIR=$(my_file)$(SOLARSHAREDBIN) \ + -env:arg-reg=$(MISC)/$(TARGET)/uno.rdb -env:arg-path=$(SOLARSHAREDBIN) + +.END diff --git a/cppuhelper/qa/propertysetmixin/test.gcc3.map b/cppuhelper/qa/propertysetmixin/test.gcc3.map deleted file mode 100644 index e7f19d73264e..000000000000 --- a/cppuhelper/qa/propertysetmixin/test.gcc3.map +++ /dev/null @@ -1,36 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -UDK_3_0_0 { - global: - registerAllTestFunction; - - _ZN4_STL7num_put*; # STLport - - local: - *; -}; diff --git a/cppuhelper/qa/propertysetmixin/test.map b/cppuhelper/qa/propertysetmixin/test.map index 7321bbca16ad..3308588ef6f8 100644 --- a/cppuhelper/qa/propertysetmixin/test.map +++ b/cppuhelper/qa/propertysetmixin/test.map @@ -27,7 +27,7 @@ UDK_3_0_0 { global: - registerAllTestFunction; + cppunitTestPlugIn; local: *; diff --git a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx index 395f0b096c7b..06db4cfdad52 100644 --- a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx +++ b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx @@ -61,9 +61,12 @@ #include "com/sun/star/uno/XComponentContext.hpp" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/servicefactory.hxx" -#include "testshl/simpleheader.hxx" +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" #include "osl/mutex.hxx" -#include "osl/thread.h" +#include "rtl/bootstrap.hxx" #include "rtl/ref.hxx" #include "rtl/string.h" #include "rtl/textenc.h" @@ -95,6 +98,14 @@ std::ostream & operator <<(std::ostream & out, css::uno::Any const & value) { out << "com::sun::star::uno::Any[" << value.getValueType() << ", ...]"; } +rtl::OUString getArgument(rtl::OUString const & name) { + rtl::OUString val; + CPPUNIT_ASSERT( + rtl::Bootstrap::get( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("arg-")) + name, val)); + return val; +} + class BoundListener: public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener > { @@ -219,17 +230,12 @@ void Test::setUp() { // single component context is used for all tests and destroyed in the last // pseudo-test "finish": if (!m_context.is()) { - char const * fw = getForwardString(); - rtl::OUString forward(fw, rtl_str_getLength(fw), - osl_getThreadTextEncoding()); - //TODO: check for string conversion failure - sal_Int32 index = forward.indexOf('#'); - rtl::OUString registry = forward.copy(0, index); - rtl::OUString bootstrappath = forward.copy(index+1); - css::uno::Reference< css::lang::XMultiComponentFactory > factory( cppu::createRegistryServiceFactory( - registry, sal_False, bootstrappath), + getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reg"))), + sal_False, + getArgument( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("path")))), css::uno::UNO_QUERY_THROW); css::uno::Reference< css::beans::XPropertySet >( factory, css::uno::UNO_QUERY_THROW)->getPropertyValue( @@ -667,8 +673,8 @@ void Test::testFull( css::uno::Reference< css::uno::XComponentContext > Test::m_context; -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); +CPPUNIT_TEST_SUITE_REGISTRATION(Test); } -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/cppuhelper/qa/unourl/export.map b/cppuhelper/qa/unourl/export.map index 4ca70fa85463..879fa8953788 100644 --- a/cppuhelper/qa/unourl/export.map +++ b/cppuhelper/qa/unourl/export.map @@ -1,4 +1,4 @@ -UDK_3.0 { +UDK_3_0_0 { global: registerAllTestFunction; diff --git a/cppuhelper/qa/unourl/makefile.mk b/cppuhelper/qa/unourl/makefile.mk index 9c4e3bc86976..de2c05d40bc1 100644 --- a/cppuhelper/qa/unourl/makefile.mk +++ b/cppuhelper/qa/unourl/makefile.mk @@ -35,6 +35,7 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk +CFLAGSCXX += $(CPPUNIT_CFLAGS) # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl diff --git a/cppuhelper/qa/weak/makefile.mk b/cppuhelper/qa/weak/makefile.mk index 771edb26cfe5..543e87118a75 100644 --- a/cppuhelper/qa/weak/makefile.mk +++ b/cppuhelper/qa/weak/makefile.mk @@ -33,6 +33,7 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk +CFLAGSCXX += $(CPPUNIT_CFLAGS) DLLPRE = # no leading "lib" on .so files SHL1TARGET = $(TARGET) diff --git a/cppuhelper/test/cfg_test.map b/cppuhelper/test/cfg_test.map deleted file mode 100644 index ac2c3750bfe0..000000000000 --- a/cppuhelper/test/cfg_test.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx index 2c8a7d8b6638..3934cfb67e19 100644 --- a/idlc/source/astdump.cxx +++ b/idlc/source/astdump.cxx @@ -134,6 +134,10 @@ sal_Bool AstModule::dump(RegistryKey& rKey) } } } + if ( getNodeType() == NT_root ) + { + localKey.releaseKey(); + } return AstDeclaration::dump(rKey); } diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index b7c4bc57dfc3..e20b7da1c42b 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -146,11 +146,11 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName) return 1; } - Registry regFile; - removeIfExists(regTmpName); OString urlRegTmpName = convertToFileUrl(regTmpName); - if ( regFile.create(OStringToOUString(urlRegTmpName, RTL_TEXTENCODING_UTF8)) ) + + Registry regFile; + if ( regFile.create(OStringToOUString(urlRegTmpName, RTL_TEXTENCODING_UTF8)) != REG_NO_ERROR ) { fprintf(stderr, "%s: could not create registry file '%s'\n", pOptions->getProgramName().getStr(), regTmpName.getStr()); @@ -161,7 +161,7 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName) } RegistryKey rootKey; - if ( regFile.openRootKey(rootKey) ) + if ( regFile.openRootKey(rootKey) != REG_NO_ERROR ) { fprintf(stderr, "%s: could not open root of registry file '%s'\n", pOptions->getProgramName().getStr(), regFileName.getStr()); @@ -174,7 +174,7 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName) // produce registry file if ( !idlc()->getRoot()->dump(rootKey) ) { - rootKey.closeKey(); + rootKey.releaseKey(); regFile.close(); regFile.destroy(OStringToOUString(regFileName, RTL_TEXTENCODING_UTF8)); removeIfExists(regFileName); @@ -182,16 +182,8 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName) return 1; } - if ( rootKey.closeKey() ) - { - fprintf(stderr, "%s: could not close root of registry file '%s'\n", - pOptions->getProgramName().getStr(), regFileName.getStr()); - removeIfExists(regTmpName); - removeIfExists(regFileName); - cleanPath(); - return 1; - } - if ( regFile.close() ) + rootKey.releaseKey(); + if ( regFile.close() != REG_NO_ERROR ) { fprintf(stderr, "%s: could not close registry file '%s'\n", pOptions->getProgramName().getStr(), regFileName.getStr()); diff --git a/idlc/source/makefile.mk b/idlc/source/makefile.mk index 37da1509afee..879090d15b54 100644 --- a/idlc/source/makefile.mk +++ b/idlc/source/makefile.mk @@ -120,11 +120,7 @@ YACCFLAGS+=-v .INCLUDE : target.mk $(MISC)$/stripped_scanner.ll : scanner.ll -.IF "$(GUI)"=="UNX" || "$(USE_SHELL)" != "4nt" tr -d "\015" < scanner.ll > $(MISC)$/stripped_scanner.ll -.ELSE - cat scanner.ll > $(MISC)$/stripped_scanner.ll -.ENDIF $(MISC)$/scanner.cxx: $(MISC)$/stripped_scanner.ll flex -o$(MISC)$/scanner.cxx $(MISC)$/stripped_scanner.ll diff --git a/idlc/source/preproc/cpp.h b/idlc/source/preproc/cpp.h index 24d30222b5a1..4b8645b2d34e 100644 --- a/idlc/source/preproc/cpp.h +++ b/idlc/source/preproc/cpp.h @@ -40,11 +40,8 @@ #define NULL 0 #endif -#ifndef __alpha typedef unsigned char uchar; -#endif - enum toktype { END, UNCLASS, NAME, NUMBER, STRING, CCON, NL, WS, DSHARP, diff --git a/io/source/TextInputStream/makefile.mk b/io/source/TextInputStream/makefile.mk index 6613c392d60a..3c0cd5c5702d 100644 --- a/io/source/TextInputStream/makefile.mk +++ b/io/source/TextInputStream/makefile.mk @@ -40,7 +40,7 @@ SLOFILES= \ $(SLO)$/TextInputStream.obj SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = tinstrm.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1STDLIBS= \ $(SALLIB) \ diff --git a/io/source/TextInputStream/tinstrm.map b/io/source/TextInputStream/tinstrm.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/io/source/TextInputStream/tinstrm.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/io/source/TextOutputStream/makefile.mk b/io/source/TextOutputStream/makefile.mk index cf3f09345e17..ad78178f8bfa 100644 --- a/io/source/TextOutputStream/makefile.mk +++ b/io/source/TextOutputStream/makefile.mk @@ -41,7 +41,7 @@ SLOFILES= \ $(SLO)$/TextOutputStream.obj SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = toutstrm.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1STDLIBS= \ $(SALLIB) \ diff --git a/io/source/TextOutputStream/toutstrm.map b/io/source/TextOutputStream/toutstrm.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/io/source/TextOutputStream/toutstrm.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/io/source/acceptor/acceptor.map b/io/source/acceptor/acceptor.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/io/source/acceptor/acceptor.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/io/source/acceptor/makefile.mk b/io/source/acceptor/makefile.mk index 5a33ca3f093d..3da3fbe18913 100644 --- a/io/source/acceptor/makefile.mk +++ b/io/source/acceptor/makefile.mk @@ -52,7 +52,7 @@ SLOFILES= \ $(SLO)$/acc_socket.obj SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = acceptor.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1RPATH=URELIB SHL1STDLIBS= \ diff --git a/io/source/connector/connectr.map b/io/source/connector/connectr.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/io/source/connector/connectr.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/io/source/connector/makefile.mk b/io/source/connector/makefile.mk index de3e922846db..7f12b850f1e3 100644 --- a/io/source/connector/makefile.mk +++ b/io/source/connector/makefile.mk @@ -52,7 +52,7 @@ SLOFILES= \ $(SLO)$/ctr_socket.obj SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = connectr.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1RPATH=URELIB SHL1STDLIBS= \ diff --git a/io/source/stm/makefile.mk b/io/source/stm/makefile.mk index ff16516bb4e1..a6a163eca4e2 100644 --- a/io/source/stm/makefile.mk +++ b/io/source/stm/makefile.mk @@ -53,7 +53,7 @@ SLOFILES = $(SLO)$/opipe.obj\ $(SLO)$/opump.obj SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = stm.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1STDLIBS= \ $(SALLIB) \ diff --git a/io/source/stm/stm.map b/io/source/stm/stm.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/io/source/stm/stm.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/javaunohelper/source/javaunohelper.map b/javaunohelper/source/javaunohelper.map index a7bf6b0721af..dcbe0506ae77 100644 --- a/javaunohelper/source/javaunohelper.map +++ b/javaunohelper/source/javaunohelper.map @@ -1,4 +1,4 @@ -UDK_3.1 { +UDK_3_0_0 { global: Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo; Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory; diff --git a/jvmaccess/util/cc5_solaris_sparc.map b/jvmaccess/util/cc5_solaris_sparc.map index e2cb767dc65e..bb59a648f4c5 100644 --- a/jvmaccess/util/cc5_solaris_sparc.map +++ b/jvmaccess/util/cc5_solaris_sparc.map @@ -25,7 +25,7 @@ # #************************************************************************* -UDK_3.1 { +UDK_3_0_0 { global: # jvmaccess/virtualmachine.hxx: __1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2t6M_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException() @@ -52,7 +52,7 @@ UDK_3.2 { __1cJjvmaccesscQ__RTTI__1CpnJjvmaccessOVirtualMachineLAttachGuardRCreationException__; # RTTI for jvmaccess::VirtualMachine::AttachGuard::CreationException * __1cJjvmaccesscR__RTTI__1CpknJjvmaccessOVirtualMachineLAttachGuardRCreationException__; # RTTI for jvmaccess::VirtualMachine::AttachGuard::CreationException const * __1cJjvmaccessOVirtualMachine2t5B6MpnHJavaVM__ibpnHJNIEnv___v_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *) #Nvariant 1 -} UDK_3.1; +} UDK_3_0_0; UDK_3.3 { global: diff --git a/jvmaccess/util/gcc3.map b/jvmaccess/util/gcc3.map index 330651a1cf6e..707645d2c829 100644 --- a/jvmaccess/util/gcc3.map +++ b/jvmaccess/util/gcc3.map @@ -25,7 +25,7 @@ # #************************************************************************* -UDK_3.1 { +UDK_3_0_0 { global: # jvmaccess/virtualmachine.hxx: _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC1Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException() @@ -59,7 +59,7 @@ UDK_3.2 { # We put the '*' at the beginning because its unlikely that these symbols will ever be a postfix of another symbol. _*ZN9jvmaccess14VirtualMachineC1EP10_Jv_JavaVMibP10_Jv_JNIEnv; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *) _*ZN9jvmaccess14VirtualMachineC2EP10_Jv_JavaVMibP10_Jv_JNIEnv; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *) -} UDK_3.1; +} UDK_3_0_0; UDK_3.3 { global: diff --git a/jvmaccess/util/msvc_win32_intel.map b/jvmaccess/util/msvc_win32_intel.map index fd148b1892ba..4620b1caa940 100644 --- a/jvmaccess/util/msvc_win32_intel.map +++ b/jvmaccess/util/msvc_win32_intel.map @@ -1,4 +1,4 @@ -UDK_3.1 { +UDK_3_0_0 { global: # jvmaccess/virtualmachine.hxx: ??0CreationException@AttachGuard@VirtualMachine@jvmaccess@@QAE@XZ; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException() @@ -15,7 +15,7 @@ UDK_3.1 { UDK_3.2 { global: -} UDK_3.1; +} UDK_3_0_0; UDK_3.3 { global: diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.hxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.hxx index 1647a1d9359b..3302fe42e90c 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.hxx @@ -69,9 +69,11 @@ namespace jfw_plugin #define JFW_PLUGIN_ARCH "m68k" #elif defined HPPA #define JFW_PLUGIN_ARCH "parisc" -#else // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA +#elif defined AXP +#define JFW_PLUGIN_ARCH "alpha" +#else // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA, ALPHA #error unknown plattform -#endif // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA +#endif // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA, ALPHA class MalformedVersionException diff --git a/offapi/com/sun/star/accessibility/AccessibleRole.idl b/offapi/com/sun/star/accessibility/AccessibleRole.idl index 7231db672c07..5fe65d04ec42 100644 --- a/offapi/com/sun/star/accessibility/AccessibleRole.idl +++ b/offapi/com/sun/star/accessibility/AccessibleRole.idl @@ -686,6 +686,33 @@ published constants AccessibleRole @since OOo 3.0 */ const short TREE_TABLE = 80; + + /** Comment role + + <p>An object which represents a comment.</p> + + <p>A comment is anchored at a certain content position in the document and + annotates this document content position or a certain text range of the document content. + In the OpenDocument file format a comment is known as an annotation.</p> + + <p>See also <const>COMMENT_END</const>.</p> + + @since OOo 3.2 + */ + const short COMMENT = 81; + + /** Comment end role + + <p>An invisible object which represents the end position of a text range which + is annotated by a comment - see <const>COMMENT</const>.</p> + + <p>This object and the corresponding object representing the comment shall be + in relation of type <const>MEMBER_OF</const>.</p> + + @since OOo 3.2 + */ + const short COMMENT_END = 82; + }; }; }; }; }; diff --git a/offapi/com/sun/star/deployment/LicenseException.idl b/offapi/com/sun/star/deployment/LicenseException.idl index ac4396f6db43..4d3996da191b 100644 --- a/offapi/com/sun/star/deployment/LicenseException.idl +++ b/offapi/com/sun/star/deployment/LicenseException.idl @@ -47,6 +47,14 @@ exception LicenseException : com::sun::star::uno::Exception /** contains the text of the license. */ string Text; + + /** indicates if the user can prevent to show the license + + Represents the attribute value + /description/registration/simple-license/@suppress-if-required + from the description.xml + */ + boolean SuppressIfRequired; }; }; }; }; }; diff --git a/offapi/com/sun/star/deployment/LicenseIndividualAgreementException.idl b/offapi/com/sun/star/deployment/LicenseIndividualAgreementException.idl index 67b82664c03d..4239d14f075f 100644 --- a/offapi/com/sun/star/deployment/LicenseIndividualAgreementException.idl +++ b/offapi/com/sun/star/deployment/LicenseIndividualAgreementException.idl @@ -45,6 +45,13 @@ exception LicenseIndividualAgreementException : com::sun::star::uno::Exception Contains the file name only. */ string ExtensionName; + /** indicates if the user can prevent to show the license + + Represents the attribute value + /description/registration/simple-license/@suppress-if-required + from the description.xml + */ + boolean SuppressIfRequired; }; }; }; }; }; diff --git a/offapi/com/sun/star/document/XDocumentRecovery.idl b/offapi/com/sun/star/document/XDocumentRecovery.idl new file mode 100644 index 000000000000..e5bf521d07f0 --- /dev/null +++ b/offapi/com/sun/star/document/XDocumentRecovery.idl @@ -0,0 +1,127 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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 __offapcom_sun_star_document_XDocumentRecovery_idl__ +#define __offapcom_sun_star_document_XDocumentRecovery_idl__ + +#include <com/sun/star/beans/PropertyValue.idl> +#include <com/sun/star/io/IOException.idl> +#include <com/sun/star/lang/WrappedTargetException.idl> + +//============================================================================= + +module com { module sun { module star { module document { + +//============================================================================= + +/** is the interface to be implemented by documents who wish to participate in + the document emergency-save / recovery process. + */ +interface XDocumentRecovery +{ + /** determines whether the document has been modified since the last call to <member>storeToRecoveryFile</member>. + + <p>If <code>storeToRecoveryFile</code> has not been called before, this method returns whether the document + has been modified since it has been loaded respectively created.</p> + + <p>When saving a session, either in case of a emergency (when OpenOffice.org crashed), or during a + periodic session save as configured by the user, <member>storeToRecoveryFile</member> is called for every + document where <code>wasModifiedSinceLastSave</code> returns <TRUE/>.</p> + + <p>It's allowed to implement this method sloppy, by returning <TRUE/> in cases where it is not sure whether + the document actually has been modified. So, the most simple implementation could simply delegate this call + to <member scope="com::sun::star::util">XModifiable::isModified</member>. (Well, actually that's the + second simple implementation, the <em>most</em> simple one would, still egitimately, always return <TRUE/>.)</p> + + <p>However, in such a case, the document might be saved more often than needed. In particular during the + periodic session save, this might become a problem when saving is expensive, for a single document + or the sum of all open documents.</p> + */ + boolean wasModifiedSinceLastSave(); + + /** does an emergency save of the document + + <p>A default implementation of this method could simply delegate this call to + <member scope="com::sun::star::frame">XStorable::storeToURL</member>.</p> + + @param TargetLocation + specifies the URL of the location to which the document should be emergency-saved. + + @param MediaDescriptor + contains additional arguments for the save process, for instance an StatusIndicator. + + @see MediaDescriptor + */ + void storeToRecoveryFile( + [in] string TargetLocation, + [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor + ) + raises ( ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException + ); + + /** recovers the document after a previous emergency or session save. + + <p>The document itself has previously been created, but <em>not</em> loaded + (via <member scope="com::sun::star::frame">XLoadable::load</member>) or initialized (via + <member scope="com::sun::star::frame">XLoadable::initNew</member>).</p> + + <p>Upon successful return, the document must be fully initialized. In particular, the + caller is not responsible for calling <member scope="com::sun::star::frame">XModel::attachResource</member>. + Instead, the implementation is responsible to do so, if required.</p> + + <p>A default implementation of this method could simply delegate this call to + <member scope="::com::sun::star::frame:">XLodable::load</member>, followed by + <member scope="com::sun::star::frame">XModel::attachResource</member>.</p> + + @param SourceLocation + specifies the URL of the location to which the document was previously emergency-saved. + + @param SalvagedFile + specifies the original URL of the file which had been emergency-saved. If this is empty, + then the file should be recovered from its original location. + + @param MediaDescriptor + contains additional arguments for the load process, for instance an StatusIndicator. + + @see MediaDescriptor + */ + void recoverFromFile( + [in] string SourceLocation, + [in] string SalvagedFile, + [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor + ) + raises ( ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException + ); +}; + +//============================================================================= + +}; }; }; }; + +//============================================================================= + +#endif diff --git a/offapi/com/sun/star/document/makefile.mk b/offapi/com/sun/star/document/makefile.mk index 2d9b6211af4e..48394a65008c 100644 --- a/offapi/com/sun/star/document/makefile.mk +++ b/offapi/com/sun/star/document/makefile.mk @@ -83,6 +83,7 @@ IDLFILES=\ XDocumentInsertable.idl\ XDocumentProperties.idl\ XDocumentPropertiesSupplier.idl\ + XDocumentRecovery.idl\ XDocumentSubStorageSupplier.idl\ XEmbeddedObjectResolver.idl\ XEmbeddedObjectSupplier.idl\ diff --git a/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl b/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl index c8baeb14a54b..733db10e61b1 100644 --- a/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl +++ b/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl @@ -51,6 +51,8 @@ #include <com/sun/star/frame/XDispatchProviderInterceptor.idl> #endif +#include <com/sun/star/embed/XStorage.idl> + //============================================================================ module com { module sun { module star { module embed { @@ -89,6 +91,19 @@ service EmbeddedObjectDescriptor [optional,property] ::com::sun::star::frame::XDispatchProviderInterceptor OutplaceDispatchInterceptor; + /** denotes the storage from which the embedded object is to be recovered. + + <p>Upon activating the embedded object, it is normally loaded from a storage as denoted by + the parameters to the <type>XEmbedObjectCreator</type> method calls.</p> + + <p>You can pass a non-<NULL/> <code>RecoveryStorage</code> in the object descriptor if you wish to load the + embedded object from an alternate storage.</p> + + <p>The object will still be based on the storage denoted in the <code>XEmbedObjectCreator</code> method + call, i.e., subsequent save operations will still use that storage. <code>RecoveryStorage</code> is used + at loading time only, and then discarded.</p> + */ + [optional, property] XStorage RecoveryStorage; }; //============================================================================ diff --git a/offapi/com/sun/star/frame/XController2.idl b/offapi/com/sun/star/frame/XController2.idl index b1e92ff63823..2c0157d99309 100644 --- a/offapi/com/sun/star/frame/XController2.idl +++ b/offapi/com/sun/star/frame/XController2.idl @@ -29,6 +29,7 @@ #include <com/sun/star/frame/XController.idl> #include <com/sun/star/awt/XWindow.idl> +#include <com/sun/star/beans/PropertyValue.idl> //============================================================================= @@ -58,6 +59,16 @@ interface XController2 : XController - if it's passed there, a view/controller pair of the same type will be created.</p> */ [readonly, attribute] string ViewControllerName; + + /** denotes the arguments used to create the instance. + + <p>Usually, controllers are created via <member>XModel2::createViewController</member>, where the + caller can pass not only a controller name, but also arguments parametrizing the to-be-created instance. + Those arguments used at creation time can subsequently be retrieved using the <code>CreationArguments</code> + member.</p> + */ + [readonly, attribute] sequence< ::com::sun::star::beans::PropertyValue > + CreationArguments; }; //============================================================================= diff --git a/offapi/com/sun/star/rdf/XDocumentRepository.idl b/offapi/com/sun/star/rdf/XDocumentRepository.idl index ee42faf0c51c..215fd89fa954 100644 --- a/offapi/com/sun/star/rdf/XDocumentRepository.idl +++ b/offapi/com/sun/star/rdf/XDocumentRepository.idl @@ -28,6 +28,10 @@ #ifndef __com_sun_star_rdf_XDocumentRepository_idl__ #define __com_sun_star_rdf_XDocumentRepository_idl__ +#ifndef __com_sun_star_beans_Pair_idl__ +#include <com/sun/star/beans/Pair.idl> +#endif + #ifndef __com_sun_star_rdf_XMetadatable_idl__ #include <com/sun/star/rdf/XMetadatable.idl> #endif @@ -84,13 +88,6 @@ interface XDocumentRepository : XRepository <code>Subject Predicate XLiteral(RDFaContent^^RDFaDatatype)</code> </li> </ul> - Further, add the following RDF statement to the same unspecified - named graph: - <ul> - <li> - <code>Subject rdfs:label XLiteral(Object->getText())</code> - </li> - </ul> </li> </ol> </p> @@ -172,13 +169,13 @@ interface XDocumentRepository : XRepository <li>if the element has no RDFa meta-data attributes: the empty sequence.</li> <li>if the element has RDFa meta-data attributes: - and no <code>rdfa:content</code> attached: - a sequence with the RDFa-statements corresponding to the - attributes</li> - <li>if the element has RDFa meta-data attributes, - and also <code>rdfa:content</code> attached: - a sequence with the RDFa-statements corresponding to the - attributes, including the RDFa-labels-statement</li> + <ul> + <li>a sequence with the RDFa-statements corresponding to the + attributes.</li> + <li>a flag indicating whether there is a xhtml:content + attribute.</li> + </ul> + </li> </ul> @throws com::sun::star::lang::IllegalArgumentException @@ -190,7 +187,8 @@ interface XDocumentRepository : XRepository @see Statement */ - sequence<Statement> getStatementRDFa([in] XMetadatable Element) + com::sun::star::beans::Pair< sequence<Statement>, boolean > + getStatementRDFa([in] XMetadatable Element) raises( com::sun::star::lang::IllegalArgumentException, RepositoryException ); diff --git a/offapi/com/sun/star/rendering/TexturingMode.idl b/offapi/com/sun/star/rendering/TexturingMode.idl index 9d54940b9dcf..b44a78eae6ce 100644 --- a/offapi/com/sun/star/rendering/TexturingMode.idl +++ b/offapi/com/sun/star/rendering/TexturingMode.idl @@ -36,13 +36,24 @@ module com { module sun { module star { module rendering { */ constants TexturingMode { + /** Pixel outside the texture area are fully transparent.<p> + + This completely switches off pixel generation outside the + texture coordinate range [0,1]. This results in only one + instance of the texture generated per textured primitive.<p> + */ + const byte NONE=0; + + //------------------------------------------------------------------------- + /** Clamp texture coordinate.<p> - This value clamps the texture coordinate to the range + This value clamps the texture coordinates to the range [0,1]. This results in only one instance of the texture - generated per textured primitive.<p> + generated per textured primitive, with the remaining area + filled with the color of the outermost texels<p> */ - const byte CLAMP=0; + const byte CLAMP=1; //------------------------------------------------------------------------- @@ -51,7 +62,7 @@ constants TexturingMode This value repeats the texture over the textured primitive, for the given texture coordinate.<p> */ - const byte REPEAT=1; + const byte REPEAT=2; }; }; }; }; }; diff --git a/offapi/com/sun/star/rendering/XGraphicDevice.idl b/offapi/com/sun/star/rendering/XGraphicDevice.idl index c48f7e3e184d..a9caaefede7e 100644 --- a/offapi/com/sun/star/rendering/XGraphicDevice.idl +++ b/offapi/com/sun/star/rendering/XGraphicDevice.idl @@ -45,12 +45,12 @@ #ifndef __com_sun_star_rendering_XBezierPolyPolygon2D_idl__ #include <com/sun/star/rendering/XBezierPolyPolygon2D.idl> #endif -#ifndef __com_sun_star_rendering_XParametricPolyPolygon2DFactory_idl__ -#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.idl> -#endif #ifndef __com_sun_star_rendering_XColorSpace_idl__ #include <com/sun/star/rendering/XColorSpace.idl> #endif +#ifndef __com_sun_star_lang_XMultiServiceFactory_idl__ +#include <com/sun/star/lang/XMultiServiceFactory.idl> +#endif module com { module sun { module star { module rendering { @@ -217,8 +217,67 @@ interface XGraphicDevice : ::com::sun::star::uno::XInterface this is not advisable: each canvas implementation is free to internally generate optimized parametric polygons, which can be used more directly for e.g. texturing operations. + + <pre> + Available services (all canvas implementations should provide + this minimal set, though are free to add more; just check the + getAvailableServiceNames() on the returned interface): + + - Gradients - all gradients need to support two construction + parameters, "Colors" being a <type>sequence<Color></type> + and "Stops" being a <type>sequence<double></type>. Both must + have the same length, and at least two elements. See + http://www.w3.org/TR/SVG11/pservers.html#GradientStops for + the semantics of gradient stops and colors. + Required gradient services: + + * "LinearGradient" - the gradient varies linearly between + the given colors. without coordinate system + transformation, the color interpolation happens in + increasing x direction, and is constant in y + direction. Equivalent to svg linear gradient + http://www.w3.org/TR/SVG11/pservers.html#LinearGradients + + * "EllipticalGradient" - this gradient has zeroth color + index in the middle, and varies linearly between center + and final color. The services takes an additional + parameter named "AspectRatio" of <type>double</type> + (width divided by height), if this aspect ratio is 1, the + gradient is circular. If it's not 1, the gradient is + elliptical, with the special twist that the aspect ratio + is maintained also for the center color: the gradient will + not collapse into a single point, but become a line of + center color. If "AspectRatio" is missing, or equal to 1, + this gradient yields similar results as the svg radial + gradient + http://www.w3.org/TR/SVG11/pservers.html#RadialGradients + + * "RectangularGradient" - this gradient has zeroth color + index in the middle, and varies linearly between center + and final color via rectangular boxes + around the center point. The services takes an additional + parameter named "AspectRatio" of <type>double</type> + (width divided by height), if this aspect ratio is 1, the + gradient is quadratic. If it's not 1, the gradient is + rectangular, with the special twist that the aspect ratio + is maintained also for the center color: the gradient will + not collapse into a single point, but become a line of + center color. + + - Hatch patterns - Required hatch services: + + * "VerticalLineHatch" - this hatching consists of vertical lines + * "OrthogonalLinesHatch" - this hatching consists of + crossing vertical and horizontal lines + * "ThreeCrossingLinesHatch" - this hatching consists of + vertical and horizontal lines plus diagonal lines from + left, top to bottom, right. + * "FourCrossingLinesHatch" - this hatching consists of + vertical and horizontal lines plus diagonal lines in both + directions. + </pre> */ - XParametricPolyPolygon2DFactory getParametricPolyPolygonFactory(); + com::sun::star::lang::XMultiServiceFactory getParametricPolyPolygonFactory(); //------------------------------------------------------------------------- diff --git a/offapi/com/sun/star/rendering/XParametricPolyPolygon2DFactory.idl b/offapi/com/sun/star/rendering/XParametricPolyPolygon2DFactory.idl deleted file mode 100644 index 2471849864a1..000000000000 --- a/offapi/com/sun/star/rendering/XParametricPolyPolygon2DFactory.idl +++ /dev/null @@ -1,152 +0,0 @@ -/************************************************************************* - * - * 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_rendering_XParametricPolyPolygon2DFactory_idl__ -#define __com_sun_star_rendering_XParametricPolyPolygon2DFactory_idl__ - -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif -#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ -#include <com/sun/star/lang/IllegalArgumentException.idl> -#endif -#ifndef __com_sun_star_geometry_RealRectangle2D_idl__ -#include <com/sun/star/geometry/RealRectangle2D.idl> -#endif -#ifndef __com_sun_star_rendering_XColorSpace_idl__ -#include <com/sun/star/rendering/XColorSpace.idl> -#endif - - -module com { module sun { module star { module rendering { - -interface XParametricPolyPolygon2D; - -/** This interface provides factory methods to generate various - ready-made XParametricPolyPolygon2Ds - */ -interface XParametricPolyPolygon2DFactory : ::com::sun::star::uno::XInterface -{ - /** Create a linear gradient. - - The gradient varies linearly between colors. the color positions on <0, 1> interval are given by stops values - in the x direction, and has constant color for fixed x - coordinate value in y direction - */ - XParametricPolyPolygon2D createLinearHorizontalGradient( [in] sequence<Color> colors, [in] sequence<double> stops ) - raises (com::sun::star::lang::IllegalArgumentException); - - /** Create an axial gradient. - - The gradient has middleColor in the middle, and varies - linearly between middleColor and endColor to both sides in the - x direction. For fixed x coordinate, the gradient has constant - color value in y direction. - */ - XParametricPolyPolygon2D createAxialHorizontalGradient( [in] sequence<Color> colors, [in] sequence<double> stops ) - raises (com::sun::star::lang::IllegalArgumentException); - - /** Create an elliptical gradient. - - The gradient has centerColor in the middle, and varies - linearly between center and endColor via concentric ellipses - around the center point. Note that the absolute size of the - rectangle given at this method does not matter, only it's - aspect ratio: if this aspect ratio is 1, the gradient is - circular. If it's not 1, the gradient is elliptical, with the - special twist that the aspect ratio is maintained also for the - center color: the gradient will not collapse into a single - point, but become a line of center color. - */ - XParametricPolyPolygon2D createEllipticalGradient( [in] sequence<Color> colors, [in] sequence<double> stops, [in] ::com::sun::star::geometry::RealRectangle2D boundRect ) - raises (com::sun::star::lang::IllegalArgumentException); - - /** Create a rectangular gradient. - - The gradient has centerColor in the middle, and varies - linearly between center and endColor via rectangular boxes - around the center point. Note that the absolute size of the - rectangle given at this method does not matter, only it's - aspect ratio: if this aspect ratio is 1, the gradient is - quadratic. If it's not 1, the gradient is rectangular, with - the special twist that the aspect ratio is maintained also for - the center color: the gradient will not collapse into a single - point, but become a line of center color. - */ - XParametricPolyPolygon2D createRectangularGradient( [in] sequence<Color> colors, [in] sequence<double> stops, [in] ::com::sun::star::geometry::RealRectangle2D boundRect ) - raises (com::sun::star::lang::IllegalArgumentException); - - /** Create a line hash of vertical lines. - - The hashing consists of vertical lines, with colors varying - linearly between leftColor and rightColor, when going from - left to right - */ - XParametricPolyPolygon2D createVerticalLinesHatch( [in] sequence<ColorComponent> leftColor, [in] sequence<ColorComponent> rightColor ) - raises (com::sun::star::lang::IllegalArgumentException); - - /** Create a line hash of orthogonally crossing lines. - - The hashing consists of vertical and horizontal lines, with - colors varying linearly between leftTopColor and - rightBottomColor, when going from left to right (for the - vertical lines) and from top tzo bottom (for the horizontal - lines). - */ - XParametricPolyPolygon2D createOrthogonalLinesHatch( [in] sequence<ColorComponent> leftTopColor, [in] sequence<ColorComponent> rightBottomColor ) - raises (com::sun::star::lang::IllegalArgumentException); - - /** Create a repeating line hash pattern of three crossing lines. - - The hashing consists of vertical and horizontal lines plus - diagonal lines from left, top to bottom, right. Each of the - three groups of lines varies the line color of distinct lines - linearly from startColor to endColor, starting at the leftmost - or topmost position. - */ - XParametricPolyPolygon2D createThreeCrossingLinesHatch( [in] sequence<ColorComponent> startColor, [in] sequence<ColorComponent> endColor ) - raises (com::sun::star::lang::IllegalArgumentException); - - /** Create a repeating line hash pattern of four crossing lines. - - The hashing consists of vertical and horizontal lines plus - diagonal lines in both directions. Each of the four groups of - lines varies the line color of distinct lines linearly from - startColor to endColor, starting at the leftmost or topmost - position. - */ - XParametricPolyPolygon2D createFourCrossingLinesHatch( [in] sequence<ColorComponent> startColor, [in] sequence<ColorComponent> endColor ) - raises (com::sun::star::lang::IllegalArgumentException); -}; - -//============================================================================= - -/// Service providing a <type>XParametricPolyPolygon2DFactory</type> service -service ParametricPolyPolygon2DFactory: XParametricPolyPolygon2DFactory; - -}; }; }; }; - -#endif diff --git a/offapi/com/sun/star/rendering/makefile.mk b/offapi/com/sun/star/rendering/makefile.mk index 3ed9cf9c27e7..6b59d156d35e 100644 --- a/offapi/com/sun/star/rendering/makefile.mk +++ b/offapi/com/sun/star/rendering/makefile.mk @@ -104,7 +104,6 @@ IDLFILES=\ XIntegerReadOnlyBitmap.idl \ XLinePolyPolygon2D.idl \ XParametricPolyPolygon2D.idl \ - XParametricPolyPolygon2DFactory.idl \ XPolyPolygon2D.idl \ XSimpleCanvas.idl \ XSprite.idl \ diff --git a/offapi/com/sun/star/report/XReportDefinition.idl b/offapi/com/sun/star/report/XReportDefinition.idl index 199737ab8c6d..9af58a8d702e 100644 --- a/offapi/com/sun/star/report/XReportDefinition.idl +++ b/offapi/com/sun/star/report/XReportDefinition.idl @@ -72,8 +72,8 @@ #ifndef __com_sun_star_awt_Size_idl__ #include <com/sun/star/awt/Size.idl> #endif -#ifndef __com_sun_star_util_XModifiable_idl__ -#include <com/sun/star/util/XModifiable.idl> +#ifndef __com_sun_star_util_XModifiable2_idl__ +#include <com/sun/star/util/XModifiable2.idl> #endif #ifndef __com_sun_star_document_XEventBroadcaster_idl__ #include <com/sun/star/document/XEventBroadcaster.idl> @@ -155,7 +155,7 @@ interface XReportDefinition of the document without saving any changes. </p> */ - interface com::sun::star::util::XModifiable; + interface com::sun::star::util::XModifiable2; /** allows the creation of sub reports. */ diff --git a/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl b/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl new file mode 100644 index 000000000000..891929514826 --- /dev/null +++ b/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: InteractionHandler.idl,v $ + * $Revision: 1.12 $ + * + * 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_sdb_InteractionHandler_idl__ +#define __com_sun_star_sdb_InteractionHandler_idl__ + +module com { module sun { module star { module task { + interface XInteractionHandler2; +}; }; }; }; + +module com { module sun { module star { module sdb { + +/** describes a service which is able to handle database-related interactions. + + <p>Usually, you will not instantiate this service directly. Instead, you'll instantiate a generic + <type scope="com::sun::star::task">InteractionHandler</type> service, and pass it your request. Based on + configuration data, this implementation will decide where to forward the request to.</p> + + <p>By default, the <code>DatabaseInteractionHandler</code> feels responsible (as per configuration) for the + following interaction types: + <ul> + <li><b>database related errors</b><br/> + The general structure to transport such errors is the <type scope="com::sun::star::sdbc">SQLException</type>, + and if your interaction request supplies such a <code>SQLException</code> (or an instance of any derived class), + the handler will display a generic error dialog, which is able to travel the object chain which may be contained + in the exception. + </li> + <li><b>parameter requests</b><br/> + If your interaction request supplies an <type scope="com::sun::star::sdb">ParametersRequest</type>, + the handler will open a standard dialog asking the user to fill in parameter values. + <br/> + In the case you want to use this feature of the handler, you should supply a special continuation + (<type scope="com::sun::star::sdb">XInteractionSupplyParameters</type>) as well, so the + handler can return the entered information. + </li> + </ul> + </p> +*/ +service DatabaseInteractionHandler: com::sun::star::task::XInteractionHandler2; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/sdb/DefinitionContent.idl b/offapi/com/sun/star/sdb/DefinitionContent.idl index 9538174ba3c3..d5ce22d9ff09 100644 --- a/offapi/com/sun/star/sdb/DefinitionContent.idl +++ b/offapi/com/sun/star/sdb/DefinitionContent.idl @@ -27,9 +27,8 @@ #ifndef __com_sun_star_sdb_DefinitionContent_idl__ #define __com_sun_star_sdb_DefinitionContent_idl__ -#ifndef __com_sun_star_ucb_Content_idl__ #include <com/sun/star/ucb/Content.idl> -#endif +#include <com/sun/star/container/XHierarchicalName.idl> //============================================================================= @@ -60,6 +59,11 @@ service DefinitionContent <p>Additional commands might be supported by derived services.</p> */ service ::com::sun::star::ucb::Content; + + /** provides access to the complete name of the content within its hierarchy + @since OOo 3.3 + */ + interface ::com::sun::star::container::XHierarchicalName; }; //============================================================================= diff --git a/offapi/com/sun/star/sdb/DocumentDefinition.idl b/offapi/com/sun/star/sdb/DocumentDefinition.idl index 29157d1cc9c7..c8f07fb69a18 100644 --- a/offapi/com/sun/star/sdb/DocumentDefinition.idl +++ b/offapi/com/sun/star/sdb/DocumentDefinition.idl @@ -71,6 +71,12 @@ service DocumentDefinition the sub document could be closed. Reasons for not closing the document include vetos by third parties, for instance, because the user opened a dialog modal to the sub document, or a long-running task such as printing is currently running.</li> + <li><strong>show</strong>: shows the sub document. This is useful if you previously opened the + document hidden, or if you previously hide it using the <em>hide</em> command.<br/> + The <em>open</em> command is not available if the sub document has not been loaded, yet.</li> + <li><strong>hide</strong>: hides the sub document. In opposite to the <em>close</em> command, + only the document window is hidden, but the document is kept loaded. A subsequent execution + of the <em>show</em> command will show the window, again.</li> </ul> */ service DefinitionContent; diff --git a/offapi/com/sun/star/sdb/InteractionHandler.idl b/offapi/com/sun/star/sdb/InteractionHandler.idl index 203cfef2008d..e76ef3d66f34 100644 --- a/offapi/com/sun/star/sdb/InteractionHandler.idl +++ b/offapi/com/sun/star/sdb/InteractionHandler.idl @@ -34,56 +34,11 @@ module com { module sun { module star { module task { module com { module sun { module star { module sdb { /** is a service for user interaction for databases. - <p> - interaction requests that the handler can provide are: - <ul> - <li><b>database related errors</b><br/> - The general structure to transport such errors is the - <type scope="com::sun::star::sdbc">SQLException</type> - , and if your - <type scope="com::sun::star::task">XInteractionRequest</type> - supplies such a - <type scope="com::sun::star::sdbc">SQLException</type> - (or an instance of any derived class), - the handler will display a generic error dialog, which is able - to travel the object chain which may be contained in the exception. - </li> - <li><b>authentication</b><br/> - If your - <type scope="com::sun::star::task">XInteractionRequest</type> - (see - <member scope="com::sun::star::task">XInteractionHandler::handle()</member> - ) supplies a - <type scope="com::sun::star::ucb">AuthenticationRequest</type> - , the handler will open a standard login - dialog to allow user authentication. - <br/> - Besides the using the members of the AuthenticationRequest in the usual manner, the member <em>Server</em> - (if not empty) is interpreted as datasource name, thus leading to a slightly different message when - requesting the user to enter it's login data. - <br/> - In the case you want to use this authentication feature, you should supply a special authentication - continuation ( - <type scope="com::sun::star::ucb">XInteractionSupplyAuthentication</type> - ) as well, so the - handler can return to you, the entered information. - </li> - <li><b>parameter requests</b><br/> - If your - <type scope="com::sun::star::task">XInteractionRequest</type> - supplies an - <type scope="com::sun::star::sdb">ParametersRequest</type> - , the handler will open a standard dialog asking - the user to fill in parameter values. - <br/> - In the case you want to use this feature of the handler, you should supply a special continuation - ( - <type scope="com::sun::star::sdb">XInteractionSupplyParameters</type> - ) as well, so the - handler can return to you, the entered information. - </li> - </ul> - </p> + @deprecated + Do not use this service anymore. Instead, create a generic <type scope="com::sun::star::task">InteractionHandler</type> + instance, and pass it your request. It will determine, based on configuration data, which concrete interaction + handler implementation to use for a specific request. In particular, requests formerly server by this service here + are by default passed to a <type>DatabaseInteractionHandler</type>. */ published service InteractionHandler: com::sun::star::task::XInteractionHandler; diff --git a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl index e5d72c066bdf..7c14255045e1 100644 --- a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl +++ b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl @@ -28,30 +28,15 @@ #ifndef __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ #define __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ -#ifndef __com_sun_star_sdbc_XDataSource_idl__ #include <com/sun/star/sdbc/XDataSource.idl> -#endif -#ifndef __com_sun_star_sdbc_SQLException_idl__ #include <com/sun/star/sdbc/SQLException.idl> -#endif -#ifndef __com_sun_star_sdbc_XConnection_idl__ #include <com/sun/star/sdbc/XConnection.idl> -#endif -#ifndef __com_sun_star_awt_XWindow_idl__ #include <com/sun/star/awt/XWindow.idl> -#endif -#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ #include <com/sun/star/lang/IllegalArgumentException.idl> -#endif -#ifndef __com_sun_star_container_NoSuchElementException_idl__ #include <com/sun/star/container/NoSuchElementException.idl> -#endif -#ifndef __com_sun_star_lang_XComponent_idl__ #include <com/sun/star/lang/XComponent.idl> -#endif -#ifndef __com_sun_star_beans_PropertyValue_idl__ #include <com/sun/star/beans/PropertyValue.idl> -#endif +#include <com/sun/star/beans/Pair.idl> //============================================================================= @@ -133,6 +118,29 @@ interface XDatabaseDocumentUI [attribute, readonly] sequence< ::com::sun::star::lang::XComponent > SubComponents; + /** identifies the given sub component + + @param SubComponent + the component to identify. Must be one of the components in <member>SubComponents</member>. + + @return + a record describing the sub component. The first element of the returned pair is the type + of the component, denoted by one of the <type>DatabaseObject</type> constants. The second + element is the name of the component. For object types which support nested structures (forms + and reports, actually), this might be a hierachical name. If the sub component has been newly created, + and not yet saved, this name is empty. + + @throws ::com::sun::star::lang::IllegalArgumentException + if the given component is not one of the controller's sub components + */ + ::com::sun::star::beans::Pair< long, string > + identifySubComponent( + [in] ::com::sun::star::lang::XComponent SubComponent + ) + raises ( + ::com::sun::star::lang::IllegalArgumentException + ); + /** closes all sub components of the database document. <p>During working with the database, the user might open different sub components: @@ -264,6 +272,52 @@ interface XDatabaseDocumentUI raises ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException ); + + /** creates a new sub component of the given type + + @param ObjectType + specifies the type of the object, must be one of the <type>DatabaseObject</type> + constants. + + @param DocumentDefinition + Upon successful return, and if and only if <arg>ObjectType</arg> equals <member>DatabaseObject::FORM</member> + or <member>DatabaseObject::REPORT</member>, this will contain the <type scope="com::sun::star::sdb">DocumentDefinition</type> + object which controls the sub component. + */ + ::com::sun::star::lang::XComponent createComponent( + [in] long ObjectType, + [out] ::com::sun::star::lang::XComponent DocumentDefinition ) + raises ( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::sdbc::SQLException ); + + /** creates a new sub component of the given type + + <p>In opposite to <member>createComponent</member>, this method allows you to specify + additional arguments which are passed to the to-be-loaded component.</p> + + <p>The meaning of the the arguments is defined at the service which is effectively + created. See the <a href="#component_types">above table</a> for a list of those + services.</p> + + @param ObjectType + specifies the type of the object, must be one of the <type>DatabaseObject</type> + constants. + + @param DocumentDefinition + Upon successful return, and if and only if <arg>ObjectType</arg> equals <member>DatabaseObject::FORM</member> + or <member>DatabaseObject::REPORT</member>, this will contain the <type scope="com::sun::star::sdb">DocumentDefinition</type> + object which controls the sub component.<br/> + You can use this object to control various aspects of the sub component. For instance, you could decide + to create the component hidden, by passing a <code>Hidden</code> flag (set to <TRUE/>) in <arg>Arguments</arg>, + manipulate the component, and then finally show it by invoking the <code>show</code> command at the + definition object. + */ + ::com::sun::star::lang::XComponent createComponentWithArguments( + [in] long ObjectType, + [in] sequence< ::com::sun::star::beans::PropertyValue > Arguments, + [out] ::com::sun::star::lang::XComponent DocumentDefinition ) + raises ( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::sdbc::SQLException ); }; //============================================================================= diff --git a/offapi/com/sun/star/sdb/makefile.mk b/offapi/com/sun/star/sdb/makefile.mk index 03aa5a2460c9..975bf03e7712 100644 --- a/offapi/com/sun/star/sdb/makefile.mk +++ b/offapi/com/sun/star/sdb/makefile.mk @@ -58,6 +58,7 @@ IDLFILES=\ DatabaseContext.idl \ DatabaseDocument.idl \ DatabaseEnvironment.idl \ + DatabaseInteractionHandler.idl \ DatabaseRegistrationEvent.idl \ DataColumn.idl \ DataSettings.idl \ diff --git a/offapi/com/sun/star/sdb/tools/XConnectionSupplier.idl b/offapi/com/sun/star/sdb/tools/XConnectionSupplier.idl new file mode 100644 index 000000000000..c0ec570ccf60 --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XConnectionSupplier.idl @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XConnectionSupplier.idl,v $ + * $Revision: 1.3 $ + * + * 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_sdb_tools_XConnectionSupplier_idl__ +#define __com_sun_star_sdb_tools_XConnectionSupplier_idl__ + +#include <com/sun/star/sdbc/XConnection.idl> +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include <com/sun/star/lang/XInitialization.idl> +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include <com/sun/star/beans/XPropertySet.idl> +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to access the active connection + + @see com::sun::star::sdbcx::XConnection + + @since OOo 3.3 +*/ +interface XConnectionSupplier +{ + /** returns the source connection. + */ + [attribute, readonly] com::sun::star::sdbc::XConnection ActiveConnection; + + interface com::sun::star::lang::XInitialization; + +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XIndexAlteration.idl b/offapi/com/sun/star/sdb/tools/XIndexAlteration.idl new file mode 100644 index 000000000000..fdc7ce517ca8 --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XIndexAlteration.idl @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XIndexAlteration.idl,v $ + * $Revision: 1.3 $ + * + * 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_sdb_tools_XIndexAlteration_idl__ +#define __com_sun_star_sdb_tools_XIndexAlteration_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include <com/sun/star/sdbc/SQLException.idl> +#endif +#include <com/sun/star/sdb/tools/XConnectionSupplier.idl> +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include <com/sun/star/lang/XInitialization.idl> +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include <com/sun/star/beans/XPropertySet.idl> +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to alter the indexes of a table. + + @see com::sun::star::sdb::DataSource::Settings + @see com::sun::star::sdbcx::XAppend + @see com::sun::star::sdbcx::XDrop + + @since OOo 3.3 +*/ +interface XIndexAlteration +{ + interface XConnectionSupplier; + + /** drops an object of the related container identified by its name. + @param table + the table to be altered + @param index + the name of the column to be dropped + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void dropIndex([in] com::sun::star::beans::XPropertySet table,[in] string index) + raises ( com::sun::star::sdbc::SQLException); + + /** creates a new object using the given descriptor and appends it + to the related container. + <b> + Note: + </b> + The descriptor will not be changed and can be used again to append another object. + @param table + the table to be altered + @param descriptor + the descriptor which should be serve to append a new object + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void addIndex([in] com::sun::star::beans::XPropertySet table,[in]com::sun::star::beans::XPropertySet descriptor) + raises (com::sun::star::sdbc::SQLException); + + +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XKeyAlteration.idl b/offapi/com/sun/star/sdb/tools/XKeyAlteration.idl new file mode 100644 index 000000000000..44389dfe64fd --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XKeyAlteration.idl @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XKeyAlteration.idl,v $ + * $Revision: 1.3 $ + * + * 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_sdb_tools_XKeyAlteration_idl__ +#define __com_sun_star_sdb_tools_XKeyAlteration_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include <com/sun/star/sdbc/SQLException.idl> +#endif +#include <com/sun/star/sdb/tools/XConnectionSupplier.idl> +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include <com/sun/star/lang/XInitialization.idl> +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include <com/sun/star/beans/XPropertySet.idl> +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to alter the keys of a table. + + @see com::sun::star::sdb::DataSource::Settings + @see com::sun::star::sdbcx::XAppend + @see com::sun::star::sdbcx::XDrop + + @since OOo 3.3 +*/ +interface XKeyAlteration +{ + interface XConnectionSupplier; + + /** drops an object of the related container identified by its name. + @param table + the table to be altered + @param key + the key to be dropped + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void dropKey([in] com::sun::star::beans::XPropertySet table,[in] com::sun::star::beans::XPropertySet key) + raises ( com::sun::star::sdbc::SQLException); + + /** creates a new object using the given descriptor and appends it + to the related container. + <b> + Note: + </b> + The descriptor will not be changed and can be used again to append another object. + @param table + the table to be altered + @param descriptor + the descriptor which should be serve to append a new object + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void addKey([in] com::sun::star::beans::XPropertySet table,[in]com::sun::star::beans::XPropertySet descriptor) + raises (com::sun::star::sdbc::SQLException); + + +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XTableAlteration.idl b/offapi/com/sun/star/sdb/tools/XTableAlteration.idl new file mode 100644 index 000000000000..fe0fe494fead --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XTableAlteration.idl @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XTableAlteration.idl,v $ + * $Revision: 1.3 $ + * + * 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_sdb_tools_XTableAlteration_idl__ +#define __com_sun_star_sdb_tools_XTableAlteration_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include <com/sun/star/sdbc/SQLException.idl> +#endif +#include <com/sun/star/sdb/tools/XConnectionSupplier.idl> +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include <com/sun/star/lang/XInitialization.idl> +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include <com/sun/star/beans/XPropertySet.idl> +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to alter a table. + + @see com::sun::star::sdb::DataSource::Settings + @see com::sun::star::sdbcx::ColumnDescriptor + @see com::sun::star::sdbcx::XAlterTable + @see com::sun::star::sdbcx::XAppend + @see com::sun::star::sdbcx::XDrop + + @since OOo 3.3 +*/ +interface XTableAlteration +{ + interface XConnectionSupplier; + + /** alter the column defined by name + + @param table + the table to be altered + + @param columnName + the name of the column to be changed + + @param columnDescriptor + the column descriptor with the information of the new column definition + + @throws com::sun::star::sdbc::SQLException + @see com::sun::star::sdbcx::XAlterTable + */ + void alterColumnByName( [in] com::sun::star::beans::XPropertySet table, [in] string columnName, [in] com::sun::star::beans::XPropertySet columnDescriptor) + raises ( com::sun::star::sdbc::SQLException ); + + /** creates a new object using the given descriptor and appends it + to the related container. + <b> + Note: + </b> + The descriptor will not be changed and can be used again to append another object. + @param table + the table to be altered + @param descriptor + the descriptor which should be serve to append a new object + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + @see com::sun::star::sdbcx::XAppend + */ + void addColumn([in] com::sun::star::beans::XPropertySet table,[in]com::sun::star::beans::XPropertySet descriptor) + raises (com::sun::star::sdbc::SQLException); + + /** drops an object of the related container identified by its name. + @param table + the table to be altered + @param columnName + the name of the column to be dropped + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + @see com::sun::star::sdbcx::XDrop + */ + void dropColumn([in] com::sun::star::beans::XPropertySet table,[in]string columnName) + raises ( com::sun::star::sdbc::SQLException); +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XTableRename.idl b/offapi/com/sun/star/sdb/tools/XTableRename.idl new file mode 100644 index 000000000000..f61d736bae8c --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XTableRename.idl @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XTableRename.idl,v $ + * $Revision: 1.3 $ + * + * 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_sdb_tools_XTableRename_idl__ +#define __com_sun_star_sdb_tools_XTableRename_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include <com/sun/star/sdbc/SQLException.idl> +#endif +#include <com/sun/star/sdb/tools/XConnectionSupplier.idl> +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include <com/sun/star/lang/XInitialization.idl> +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include <com/sun/star/beans/XPropertySet.idl> +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to rename table. + + @see com::sun::star::sdb::DataSource::Settings + + @since OOo 3.3 +*/ +interface XTableRename +{ + interface XConnectionSupplier; + + /** rename the given table to the new name + + @param table + the table to be renamed + @param newName + the new name of the table + @throws com::sun::star::sdbc::SQLException + */ + void rename( [in] com::sun::star::beans::XPropertySet table, [in] string newName) + raises ( com::sun::star::sdbc::SQLException ); + + +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XViewAccess.idl b/offapi/com/sun/star/sdb/tools/XViewAccess.idl new file mode 100644 index 000000000000..e64727341e81 --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XViewAccess.idl @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XViewAccess.idl,v $ + * $Revision: 1.3 $ + * + * 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_sdb_tools_XViewAccess_idl__ +#define __com_sun_star_sdb_tools_XViewAccess_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include <com/sun/star/sdbc/SQLException.idl> +#endif +#include <com/sun/star/sdb/tools/XConnectionSupplier.idl> +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include <com/sun/star/lang/XInitialization.idl> +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include <com/sun/star/beans/XPropertySet.idl> +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to fetch and to change the sql statements of views + + @see com::sun::star::sdb::DataSource::Settings + @see com::sun::star::sdbcx::View + + @since OOo 3.3 +*/ +interface XViewAccess +{ + interface XConnectionSupplier; + + /** returns the SQL statement of the view + + @param view + the table to be renamed + @throws com::sun::star::sdbc::SQLException + */ + string getCommand( [in] com::sun::star::beans::XPropertySet view) + raises ( com::sun::star::sdbc::SQLException ); + + /** allows to alter the SQL statement of a view + + @param view + the view to be altered + + @param command + the new SQL statement + + @throws com::sun::star::sdbc::SQLException + */ + void alterCommand( [in] com::sun::star::beans::XPropertySet view, [in] string command) + raises ( com::sun::star::sdbc::SQLException ); +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/makefile.mk b/offapi/com/sun/star/sdb/tools/makefile.mk index ab57745142a4..1bc7e6b11c7d 100644 --- a/offapi/com/sun/star/sdb/tools/makefile.mk +++ b/offapi/com/sun/star/sdb/tools/makefile.mk @@ -44,7 +44,13 @@ IDLFILES=\ XConnectionTools.idl \ XDataSourceMetaData.idl \ XObjectNames.idl \ - XTableName.idl + XTableName.idl \ + XTableRename.idl \ + XViewAccess.idl \ + XTableAlteration.idl \ + XKeyAlteration.idl \ + XIndexAlteration.idl \ + XConnectionSupplier.idl # ------------------------------------------------------------------ .INCLUDE : target.mk diff --git a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl b/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl index d05158a4db82..a115e914afb8 100644 --- a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl +++ b/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl @@ -48,7 +48,8 @@ exception DocumentMacroConfirmationRequest : ClassifiedInteractionRequest */ string DocumentURL; - /** refers to the storage which the document was last committed to. + /** refers to the storage related to the last commited version of the + document. This storage is necessary e.g. for displaying the existing signatures to the user, to allow him a decision whether or not to trust those signatures @@ -59,6 +60,10 @@ exception DocumentMacroConfirmationRequest : ClassifiedInteractionRequest ::com::sun::star::embed::XStorage DocumentStorage; + /** contains informations about the ODF version of the document + */ + string DocumentVersion; + /** contains informations about the signatures in the document */ sequence< ::com::sun::star::security::DocumentSignatureInformation > diff --git a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl b/offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl deleted file mode 100644 index cfdae9f435d3..000000000000 --- a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * 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_task_DocumentMacroConfirmationRequest2_idl__ -#define __com_sun_star_task_DocumentMacroConfirmationRequest2_idl__ - -#include <com/sun/star/task/ClassifiedInteractionRequest.idl> -#include <com/sun/star/embed/XStorage.idl> -#include <com/sun/star/security/DocumentSignatureInformation.idl> - - -//============================================================================= - -module com { module sun { module star { module task { - -//============================================================================= - -/** describes the request to approve or deny the execution of macros contained in - a document. - */ -exception DocumentMacroConfirmationRequest2 : ClassifiedInteractionRequest -{ - /** specifies the URL of the document which contains macros whose execution - should be approved or rejected. - */ - string DocumentURL; - - /** refers to the zip-storage related to the last commited version of the - document. - - This storage is necessary e.g. for displaying the existing signatures to - the user, to allow him a decision whether or not to trust those signatures - and thus the signed macros. - - @see ::com::sun::star::security::XDocumentDigitalSignatures::showScriptingContentSignatures - */ - ::com::sun::star::embed::XStorage - DocumentZipStorage; - - /** contains informations about the ODF version of the document - */ - string DocumentVersion; - - /** contains informations about the signatures in the document - */ - sequence< ::com::sun::star::security::DocumentSignatureInformation > - DocumentSignatureInformation; -}; - -//============================================================================= - -}; }; }; }; - -//============================================================================= - -#endif diff --git a/offapi/com/sun/star/task/InteractionHandler.idl b/offapi/com/sun/star/task/InteractionHandler.idl index c6785e831748..f772754d6d56 100644 --- a/offapi/com/sun/star/task/InteractionHandler.idl +++ b/offapi/com/sun/star/task/InteractionHandler.idl @@ -36,11 +36,15 @@ module com { module sun { module star { module com { module sun { module star { module task { //============================================================================ -/** An interaction request handler that lets the user handle a number of well - known requests via GUI dialogs (and the - <type scope="com::sun::star::task">PasswordContainer</type> service). +/** An interaction request handler that lets the user handle requests via GUI dialogs. - <P>The well known requests handled by this service include + <p>The interaction handler service has a numerof of <a href="#built_in_handler">built-in handlers</a>, responsible + for a lot of well known interactions. Additionally, there's a configuration module which allows to + <a href="#configuring_handlers">configure additional handlers</a>, responsible for arbitrary requests.</a></p> + + <a name="built_in_handler"></a> + <h3>Built-in Handlers</h3> + The following well-known requests can be dealt with by the built-in handlers: <UL> <LI><type scope="com::sun::star::ucb">AuthenticationRequest</type></LI> <LI><type scope="com::sun::star::ucb">CertificateValidationRequest</type></LI> @@ -131,6 +135,26 @@ module com { module sun { module star { module task { only. The names of the two volumes involved (two <atom>string</atom>s).</DD> </DL></P> + + <a name="configuring_handlers"></a> + <h3>Configurating additional Handlers</h3> + + <p>It is possible to configure additional interaction handlers, to which certain requests can be delegated. The + configuration node <code>/org.openoffice.Interaction/InteractionHandlers</code> is evaluated and respected + by the <code>InteractionHandler</code> implementation.</p> + + <p>A custom interaction handler can declare itself responsible for an arbitrary number of UNO types, specified + by full-qualified type name. Also, for each type, it can specify whether it is responsible for only this particular + type, or all possibly existent derived types.</p> + + <p>Whenever the <code>InteractionHandler</code> encounteres a request it cannot fulfill itself, it will examine + the configuration, to find a handler implementation for the request, and delegate it to the first matching + handler.</p> + + <p>If multiple custom interaction handlers declare themself responsible for the same request type, it is not + defined which handler will actully be invoked. Thus, when deploying a custom interaction handler, ensure + that the types you specify are general enough to cover all requests you want to handle, but also specific + enough to not cover requests which other handlers might be interested in.</p> */ published service InteractionHandler { diff --git a/offapi/com/sun/star/task/makefile.mk b/offapi/com/sun/star/task/makefile.mk index 98a66038bef2..3b622b469b63 100644 --- a/offapi/com/sun/star/task/makefile.mk +++ b/offapi/com/sun/star/task/makefile.mk @@ -41,7 +41,6 @@ PACKAGE=com$/sun$/star$/task IDLFILES=\ ClassifiedInteractionRequest.idl\ DocumentMacroConfirmationRequest.idl\ - DocumentMacroConfirmationRequest2.idl\ DocumentPasswordRequest.idl\ DocumentMSPasswordRequest.idl\ ErrorCodeRequest.idl\ diff --git a/offapi/com/sun/star/text/InContentMetadata.idl b/offapi/com/sun/star/text/InContentMetadata.idl index f6aec7bbee63..5eac10714576 100755 --- a/offapi/com/sun/star/text/InContentMetadata.idl +++ b/offapi/com/sun/star/text/InContentMetadata.idl @@ -32,6 +32,10 @@ #include <com/sun/star/container/XEnumerationAccess.idl> #endif +#ifndef __com_sun_star_container_XChild_idl__ +#include <com/sun/star/container/XChild.idl> +#endif + #ifndef __com_sun_star_text_TextContent_idl__ #include <com/sun/star/text/TextContent.idl> #endif @@ -68,6 +72,12 @@ service InContentMetadata annotated range of text can be enumerated. */ interface com::sun::star::container::XEnumerationAccess; + //------------------------------------------------------------------------- + /** The <type>TextContent</type> that is the parent of this text range. + @since OOo 3.3 + */ + interface com::sun::star::container::XChild; + }; diff --git a/offapi/com/sun/star/text/TextMarkupType.idl b/offapi/com/sun/star/text/TextMarkupType.idl index d99942e0d12f..5137d47d217f 100644 --- a/offapi/com/sun/star/text/TextMarkupType.idl +++ b/offapi/com/sun/star/text/TextMarkupType.idl @@ -58,6 +58,12 @@ constants TextMarkupType /// An inivisible markup used to identify sentence boundaries. /// @since OOo 3.0.1 const long SENTENCE = 4; + + /// Markups originates from change tracking. + /// @since OOo 3.3 + const long TRACK_CHANGE_INSERTION = 5; + const long TRACK_CHANGE_DELETION = 6; + const long TRACK_CHANGE_FORMATCHANGE = 7; }; }; }; }; }; diff --git a/offapi/com/sun/star/text/TextRangeContentProperties.idl b/offapi/com/sun/star/text/TextRangeContentProperties.idl new file mode 100644 index 000000000000..74acb67cf9ed --- /dev/null +++ b/offapi/com/sun/star/text/TextRangeContentProperties.idl @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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_text_TextRangeContentProperties_idl__ +#define __com_sun_star_text_TextRangeContentProperties_idl__ + +#ifndef __com_sun_star_table_XCell_idl__ +#include <com/sun/star/table/XCell.idl> +#endif + +#ifndef __com_sun_star_text_XTextContent_idl__ +#include <com/sun/star/text/XTextContent.idl> +#endif + +#ifndef __com_sun_star_text_XDocumentIndex_idl__ +#include <com/sun/star/text/XDocumentIndex.idl> +#endif + +#ifndef __com_sun_star_text_XTextTable_idl__ +#include <com/sun/star/text/XTextTable.idl> +#endif + +#ifndef __com_sun_star_text_XTextFrame_idl__ +#include <com/sun/star/text/XTextFrame.idl> +#endif + +#ifndef __com_sun_star_text_XTextSection_idl__ +#include <com/sun/star/text/XTextSection.idl> +#endif + +#ifndef __com_sun_star_text_XDocumentIndexMark_idl__ +#include <com/sun/star/text/XDocumentIndexMark.idl> +#endif + +#ifndef __com_sun_star_text_XFootnote_idl__ +#include <com/sun/star/text/XFootnote.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module text { + +//============================================================================= + +/** describes the structural properties to retrieve text contents. + + @since OOo 3.3 + */ +service TextRangeContentProperties +{ + //------------------------------------------------------------------------- + /** may contain a document index. */ + [optional, readonly, property] com::sun::star::text::XDocumentIndex + DocumentIndex; + + //------------------------------------------------------------------------- + /** may contain a text table. */ + [optional, readonly, property] com::sun::star::text::XTextTable + TextTable; + + //------------------------------------------------------------------------- + /** may contain a table cell. */ + [optional, readonly, property] com::sun::star::table::XCell Cell; + + //------------------------------------------------------------------------- + /** may contain a text frame. */ + [optional, readonly, property] com::sun::star::text::XTextFrame + TextFrame; + + //------------------------------------------------------------------------- + /** may contain a text section. */ + [optional, readonly, property] com::sun::star::text::XTextSection + TextSection; + + //------------------------------------------------------------------------- + /** may contain a document index mark. */ + [optional, readonly, property] com::sun::star::text::XDocumentIndexMark + DocumentIndexMark; + + //------------------------------------------------------------------------- + /** may contain a reference mark. */ + [optional, readonly, property] com::sun::star::text::XTextContent + ReferenceMark; + + //------------------------------------------------------------------------- + /** may contain a footnote. */ + [optional, readonly, property] com::sun::star::text::XFootnote Footnote; + + //------------------------------------------------------------------------- + /** may contain a endnote. */ + [optional, readonly, property] com::sun::star::text::XFootnote Endnote; + + //------------------------------------------------------------------------- + /** may contain a nested text content. + + For example, may contain an <type>InContentMetadata</type> or a + <type scope="com::sun::star::text::textfield">MetadataField</type>. + */ + [optional, readonly, property] com::sun::star::text::XTextContent + NestedTextContent; + +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/text/makefile.mk b/offapi/com/sun/star/text/makefile.mk index 28c3d1eaece3..4e6d24746af8 100644 --- a/offapi/com/sun/star/text/makefile.mk +++ b/offapi/com/sun/star/text/makefile.mk @@ -173,6 +173,7 @@ IDLFILES=\ TextPortionEnumeration.idl\ TextRange.idl\ TextRanges.idl\ + TextRangeContentProperties.idl\ TextSection.idl\ TextSections.idl\ TextSortable.idl\ diff --git a/offapi/com/sun/star/text/textfield/MetadataField.idl b/offapi/com/sun/star/text/textfield/MetadataField.idl index 64918b12849f..d98c4be39e96 100755 --- a/offapi/com/sun/star/text/textfield/MetadataField.idl +++ b/offapi/com/sun/star/text/textfield/MetadataField.idl @@ -32,6 +32,10 @@ #include <com/sun/star/container/XEnumerationAccess.idl> #endif +#ifndef __com_sun_star_container_XChild_idl__ +#include <com/sun/star/container/XChild.idl> +#endif + #ifndef __com_sun_star_text_TextField_idl__ #include <com/sun/star/text/TextField.idl> #endif @@ -50,7 +54,8 @@ module com { module sun { module star { module text { module textfield { //============================================================================= -/** is a <type>TextField</type> whose content is specified by RDF metadata. +/** is a <type scope="com::sun::star::text">TextField</type> whose content + is specified by RDF metadata. @since OOo 3.2 @@ -59,8 +64,8 @@ module com { module sun { module star { module text { module textfield { service MetadataField { //------------------------------------------------------------------------- - /** None of the properties of <type>TextContent</type> are - supported. */ + /** None of the properties of + <type scope="com::sun::star::text">TextContent</type> are supported. */ service com::sun::star::text::TextField; //------------------------------------------------------------------------- @@ -73,11 +78,18 @@ service MetadataField interface com::sun::star::text::XText; //------------------------------------------------------------------------- - /** The <type>TextContent</type>s that are contained in the - <type>MetadataField</type> can be enumerated. */ + /** The <type scope="com::sun::star::text">TextContent</type>s that are + contained in the <type>MetadataField</type> can be enumerated. */ interface com::sun::star::container::XEnumerationAccess; //------------------------------------------------------------------------- + /** The <type scope="com::sun::star::text">TextContent</type> + that is the parent of this <type>MetadataField</type>. + @since OOo 3.3 + */ + interface com::sun::star::container::XChild; + + //------------------------------------------------------------------------- /** this is the number format for this field. @see com::sun::star::util::NumberFormatter */ diff --git a/offapi/com/sun/star/util/Duration.idl b/offapi/com/sun/star/util/Duration.idl index 1832b4af4a55..ef544189210f 100644 --- a/offapi/com/sun/star/util/Duration.idl +++ b/offapi/com/sun/star/util/Duration.idl @@ -87,9 +87,9 @@ struct Duration unsigned short Seconds; //-------------------------------------------------------------------- - /** contains the hundredth seconds. + /** contains the milliseconds. */ - unsigned short HundredthSeconds; + unsigned short MilliSeconds; }; diff --git a/pyuno/zipcore/makefile.mk b/pyuno/zipcore/makefile.mk index 9e546e7d4018..06241da2bfdb 100755 --- a/pyuno/zipcore/makefile.mk +++ b/pyuno/zipcore/makefile.mk @@ -55,7 +55,7 @@ PYTHONBINARY=$(DESTROOT)$/bin$/python$(EXECPOST) .ENDIF FINDLIBFILES_TMP:=$(subst,/,$/ \ - $(shell @$(FIND) $(SOLARLIBDIR)$/python -type f| $(GREP) -v .pyc |$(GREP) -v .py\~ |$(GREP) -v .orig )) + $(shell @$(FIND) $(SOLARLIBDIR)$/python -type f| $(GREP) -v "\.pyc" |$(GREP) -v "\.py~" |$(GREP) -v .orig | $(GREP) -v _failed)) FINDLIBFILES=$(subst,$(SOLARLIBDIR)$/python, $(FINDLIBFILES_TMP)) FILES=\ diff --git a/registry/inc/registry/registry.hxx b/registry/inc/registry/registry.hxx index 00a763737413..7ded0738cd72 100644 --- a/registry/inc/registry/registry.hxx +++ b/registry/inc/registry/registry.hxx @@ -483,6 +483,9 @@ public: /// closes explicitly the current key inline RegError closeKey(); + /// releases the current key + inline void releaseKey(); + /** sets a value of a key. @param keyName specifies the name of the key which value will be set. @@ -807,19 +810,18 @@ inline void RegistryKey::setRegistry(Registry& registry) inline RegistryKey::~RegistryKey() { if (m_hImpl) - m_registry.m_pApi->closeKey(m_hImpl); + m_registry.m_pApi->releaseKey(m_hImpl); } inline RegistryKey& RegistryKey::operator = (const RegistryKey& toAssign) { m_registry = toAssign.m_registry; - if (m_hImpl != toAssign.m_hImpl) - { + if (toAssign.m_hImpl) + m_registry.m_pApi->acquireKey(toAssign.m_hImpl); + if (m_hImpl) m_registry.m_pApi->releaseKey(m_hImpl); - m_hImpl = toAssign.m_hImpl; - m_registry.m_pApi->acquireKey(m_hImpl); - } + m_hImpl = toAssign.m_hImpl; return *this; } @@ -945,6 +947,14 @@ inline RegError RegistryKey::closeKey() return REG_INVALID_KEY; } +inline void RegistryKey::releaseKey() +{ + if (m_registry.isValid() && (m_hImpl != 0)) + { + m_registry.m_pApi->releaseKey(m_hImpl), m_hImpl = 0; + } +} + inline RegError RegistryKey::setValue(const ::rtl::OUString& keyName, RegValueType valueType, RegValue pValue, @@ -1163,15 +1173,13 @@ inline Registry::~Registry() inline Registry& Registry::operator = (const Registry& toAssign) { - - if (m_hImpl != toAssign.m_hImpl) - { - m_pApi->release(m_hImpl); - m_pApi = toAssign.m_pApi; - m_hImpl = toAssign.m_hImpl; - } + if (toAssign.m_hImpl) + toAssign.m_pApi->acquire(toAssign.m_hImpl); if (m_hImpl) - m_pApi->acquire(m_hImpl); + m_pApi->release(m_hImpl); + + m_pApi = toAssign.m_pApi; + m_hImpl = toAssign.m_hImpl; return *this; } diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index 17f84a3b3973..9496aee84d8e 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -28,13 +28,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_registry.hxx" -#include "reflcnst.hxx" - #include "keyimpl.hxx" -#include <rtl/alloc.h> -#include <rtl/memory.h> + +#include "reflcnst.hxx" +#include "rtl/alloc.h" +#include "rtl/memory.h" #include "rtl/ustrbuf.hxx" +using rtl::OUString; +using rtl::OUStringBuffer; +using namespace store; + namespace { static char const VALUE_PREFIX[] = "$VL_"; } //********************************************************************* @@ -43,9 +47,35 @@ namespace { static char const VALUE_PREFIX[] = "$VL_"; } ORegKey::ORegKey(const OUString& keyName, ORegistry* pReg) : m_refCount(1) , m_name(keyName) - , m_bDeleted(sal_False) + , m_bDeleted(0) + , m_bModified(0) , m_pRegistry(pReg) -{} +{ +} + +//********************************************************************* +// ~ORegKey() +// +ORegKey::~ORegKey() +{ + OSL_POSTCOND(m_refCount == 0, "registry::ORegKey::dtor(): refcount not zero."); +} + +//********************************************************************* +// acquireKey +// +RegError ORegKey::acquireKey(RegKeyHandle hKey) +{ + return m_pRegistry->acquireKey(hKey); +} + +//********************************************************************* +// releaseKey +// +RegError ORegKey::releaseKey(RegKeyHandle hKey) +{ + return m_pRegistry->releaseKey(hKey); +} //********************************************************************* // createKey @@ -61,7 +91,7 @@ RegError ORegKey::createKey(const OUString& keyName, RegKeyHandle* phNewKey) // RegError ORegKey::openKey(const OUString& keyName, RegKeyHandle* phOpenKey) { - return (m_pRegistry->openKey(this, keyName, phOpenKey)); + return m_pRegistry->openKey(this, keyName, phOpenKey); } @@ -70,33 +100,24 @@ RegError ORegKey::openKey(const OUString& keyName, RegKeyHandle* phOpenKey) // RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubKeys, sal_uInt32* pnSubKeys) { - ORegKey* pKey; - OUString sFullKeyName, sSubKeyName; - RegKeyHandle hSKey = 0, hSubKey; - RegError _ret = REG_NO_ERROR; - sal_uInt32 nSubKeys; - ORegKey* *subKeys; + RegError _ret = REG_NO_ERROR; + + *phOpenSubKeys = 0; + *pnSubKeys = 0; + ORegKey* pKey = this; if ( keyName.getLength() ) { - _ret = openKey(keyName, &hSKey); - if (_ret) - { - *phOpenSubKeys = NULL; - *pnSubKeys = 0; + _ret = openKey(keyName, (RegKeyHandle*)&pKey); + if (_ret != REG_NO_ERROR) return _ret; - } - - pKey = (ORegKey*)hSKey; - } else - { - pKey = this; } - nSubKeys = pKey->countSubKeys(); - + sal_uInt32 nSubKeys = pKey->countSubKeys(); *pnSubKeys = nSubKeys; - subKeys = (ORegKey**)rtl_allocateZeroMemory(nSubKeys * sizeof(ORegKey*)); + + ORegKey** pSubKeys; + pSubKeys = (ORegKey**)rtl_allocateZeroMemory(nSubKeys * sizeof(ORegKey*)); OStoreDirectory::iterator iter; OStoreDirectory rStoreDir(pKey->getStoreDir()); @@ -107,22 +128,19 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK { if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR ) { - sSubKeyName = iter.m_pszName; - sFullKeyName = pKey->getName(); - if (sFullKeyName.getLength() > 1) - sFullKeyName += m_pRegistry->ROOT; - sFullKeyName += sSubKeyName; + OUString const sSubKeyName = iter.m_pszName; - _ret = pKey->openKey(sSubKeyName, &hSubKey); - if (_ret) + ORegKey* pOpenSubKey = 0; + _ret = pKey->openKey(sSubKeyName, (RegKeyHandle*)&pOpenSubKey); + if (_ret != REG_NO_ERROR) { *phOpenSubKeys = NULL; *pnSubKeys = 0; - rtl_freeMemory(subKeys); - return _ret; + rtl_freeMemory(pSubKeys); // @@@ leaking 'pSubKeys[0...nSubkeys-1]' + return _ret; // @@@ leaking 'pKey' } - subKeys[nSubKeys] = ((ORegKey*)hSubKey); + pSubKeys[nSubKeys] = pOpenSubKey; nSubKeys++; } @@ -130,10 +148,10 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK _err = rStoreDir.next(iter); } - *phOpenSubKeys = (RegKeyHandle*)subKeys; + *phOpenSubKeys = (RegKeyHandle*)pSubKeys; if (keyName.getLength()) { - closeKey(hSKey); + (void) releaseKey(pKey); } return REG_NO_ERROR; } @@ -146,35 +164,28 @@ RegError ORegKey::getKeyNames(const OUString& keyName, rtl_uString*** pSubKeyNames, sal_uInt32* pnSubKeys) { - ORegKey* pKey; - OUString sFullKeyName, sSubKeyName; - RegError _ret = REG_NO_ERROR; - sal_uInt32 nSubKeys; - rtl_uString** pSubKeys; + RegError _ret = REG_NO_ERROR; + + *pSubKeyNames = 0; + *pnSubKeys = 0; + ORegKey* pKey = this; if (keyName.getLength()) { _ret = openKey(keyName, (RegKeyHandle*)&pKey); - if (_ret) - { - *pSubKeyNames = NULL; - *pnSubKeys = 0; + if (_ret != REG_NO_ERROR) return _ret; - } - } else - { - pKey = this; } - nSubKeys = pKey->countSubKeys(); - + sal_uInt32 nSubKeys = pKey->countSubKeys(); *pnSubKeys = nSubKeys; + + rtl_uString** pSubKeys = 0; pSubKeys = (rtl_uString**)rtl_allocateZeroMemory(nSubKeys * sizeof(rtl_uString*)); OStoreDirectory::iterator iter; OStoreDirectory rStoreDir(pKey->getStoreDir()); storeError _err = rStoreDir.first(iter); - OUString subKey; nSubKeys = 0; @@ -182,14 +193,14 @@ RegError ORegKey::getKeyNames(const OUString& keyName, { if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR) { - sSubKeyName = iter.m_pszName; - sFullKeyName = pKey->getName(); + OUString const sSubKeyName = iter.m_pszName; + + OUString sFullKeyName(pKey->getName()); if (sFullKeyName.getLength() > 1) sFullKeyName += m_pRegistry->ROOT; sFullKeyName += sSubKeyName; - subKey = sFullKeyName; - rtl_uString_newFromString(&pSubKeys[nSubKeys], subKey.pData); + rtl_uString_newFromString(&pSubKeys[nSubKeys], sFullKeyName.pData); nSubKeys++; } @@ -200,7 +211,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName, *pSubKeyNames = pSubKeys; if (keyName.getLength()) { - closeKey((RegKeyHandle)pKey); + releaseKey(pKey); } return REG_NO_ERROR; } @@ -349,7 +360,6 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal break; } - sal_uInt32 writenBytes; if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) ) { @@ -361,8 +371,8 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal rtl_freeMemory(pBuffer); return REG_SET_VALUE_FAILED; } + setModified(); - //rValue.flush(); rtl_freeMemory(pBuffer); return REG_NO_ERROR; } @@ -420,8 +430,8 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueL rtl_freeMemory(pBuffer); return REG_SET_VALUE_FAILED; } + setModified(); - //rValue.flush(); rtl_freeMemory(pBuffer); return REG_NO_ERROR; } @@ -488,8 +498,8 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu rtl_freeMemory(pBuffer); return REG_SET_VALUE_FAILED; } + setModified(); - //rValue.flush(); rtl_freeMemory(pBuffer); return REG_NO_ERROR; } @@ -556,8 +566,8 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p rtl_freeMemory(pBuffer); return REG_SET_VALUE_FAILED; } + setModified(); - //rValue.flush(); rtl_freeMemory(pBuffer); return REG_NO_ERROR; } @@ -626,7 +636,6 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const return REG_INVALID_VALUE; } -// rtl_copyMemory(value, pBuffer, valueSize); switch (valueType) { case RG_VALUETYPE_NOT_DEFINED: @@ -970,33 +979,30 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** // RegError ORegKey::getKeyType(const OUString& name, RegKeyType* pKeyType) const { - ORegKey* pKey; - RegError _ret = REG_NO_ERROR; - *pKeyType = RG_KEYTYPE; REG_GUARD(m_pRegistry->m_mutex); if ( name.getLength() ) { - _ret = ((ORegKey*)this)->openKey( - name, (RegKeyHandle*)&pKey); - if (_ret) + ORegKey* pThis = const_cast< ORegKey* >(this); + + RegKeyHandle hKey = 0; + RegError _ret = pThis->openKey(name, &hKey); + if (_ret != REG_NO_ERROR) return _ret; - ((ORegKey*)this)->closeKey((RegKeyHandle)pKey); - return _ret; - } else - { - return _ret; + (void) pThis->releaseKey(hKey); } + + return REG_NO_ERROR; } RegError ORegKey::getResolvedKeyName(const OUString& keyName, OUString& resolvedName) { - if (keyName.getLength() == 0) { + if (keyName.getLength() == 0) return REG_INVALID_KEYNAME; - } + resolvedName = getFullPath(keyName); return REG_NO_ERROR; } diff --git a/registry/source/keyimpl.hxx b/registry/source/keyimpl.hxx index f579040ab039..c2558b4f8394 100644 --- a/registry/source/keyimpl.hxx +++ b/registry/source/keyimpl.hxx @@ -30,16 +30,14 @@ #include <registry/registry.h> #include "regimpl.hxx" -#include <rtl/string.hxx> - -using namespace rtl; -using namespace store; +#include <rtl/ustring.hxx> class ORegKey { public: - ORegKey(const OUString& keyName, ORegistry* pReg); + ORegKey(const rtl::OUString& keyName, ORegistry* pReg); + ~ORegKey(); sal_uInt32 acquire() { return ++m_refCount; } @@ -47,68 +45,77 @@ public: sal_uInt32 release() { return --m_refCount; } - RegError createKey(const OUString& keyName, RegKeyHandle* phNewKey); + RegError acquireKey(RegKeyHandle hKey); + RegError releaseKey(RegKeyHandle hKey); + + RegError createKey(const rtl::OUString& keyName, RegKeyHandle* phNewKey); - RegError openKey(const OUString& keyName, RegKeyHandle* phOpenKey); + RegError openKey(const rtl::OUString& keyName, RegKeyHandle* phOpenKey); - RegError openSubKeys(const OUString& keyName, + RegError openSubKeys(const rtl::OUString& keyName, RegKeyHandle** phOpenSubKeys, sal_uInt32* pnSubKeys); - RegError getKeyNames(const OUString& keyName, + RegError getKeyNames(const rtl::OUString& keyName, rtl_uString*** pSubKeyNames, sal_uInt32* pnSubKeys); RegError closeKey(RegKeyHandle hKey); - RegError deleteKey(const OUString& keyName); + RegError deleteKey(const rtl::OUString& keyName); - RegError getValueInfo(const OUString& valueName, + RegError getValueInfo(const rtl::OUString& valueName, RegValueType* pValueTye, sal_uInt32* pValueSize) const; - RegError setValue(const OUString& valueName, + RegError setValue(const rtl::OUString& valueName, RegValueType vType, RegValue value, sal_uInt32 vSize); - RegError setLongListValue(const OUString& valueName, + RegError setLongListValue(const rtl::OUString& valueName, sal_Int32* pValueList, sal_uInt32 len); - RegError setStringListValue(const OUString& valueName, + RegError setStringListValue(const rtl::OUString& valueName, sal_Char** pValueList, sal_uInt32 len); - RegError setUnicodeListValue(const OUString& valueName, + RegError setUnicodeListValue(const rtl::OUString& valueName, sal_Unicode** pValueList, sal_uInt32 len); - RegError getValue(const OUString& valueName, RegValue value) const; + RegError getValue(const rtl::OUString& valueName, RegValue value) const; - RegError getLongListValue(const OUString& valueName, + RegError getLongListValue(const rtl::OUString& valueName, sal_Int32** pValueList, sal_uInt32* pLen) const; - RegError getStringListValue(const OUString& valueName, + RegError getStringListValue(const rtl::OUString& valueName, sal_Char*** pValueList, sal_uInt32* pLen) const; - RegError getUnicodeListValue(const OUString& valueName, + RegError getUnicodeListValue(const rtl::OUString& valueName, sal_Unicode*** pValueList, sal_uInt32* pLen) const; - RegError getKeyType(const OUString& name, + RegError getKeyType(const rtl::OUString& name, RegKeyType* pKeyType) const; - RegError getResolvedKeyName(const OUString& keyName, - OUString& resolvedName); + RegError getResolvedKeyName(const rtl::OUString& keyName, + rtl::OUString& resolvedName); + + bool isDeleted() const + { return m_bDeleted != 0; } - sal_Bool isDeleted() const - { return m_bDeleted; } + void setDeleted (sal_Bool bKeyDeleted) + { m_bDeleted = bKeyDeleted ? 1 : 0; } - void setDeleted(sal_Bool bKeyDeleted) - { m_bDeleted = bKeyDeleted; } + bool isModified() const + { return m_bModified != 0; } + + void setModified (bool bModified = true) + { m_bModified = bModified ? 1 : 0; } sal_Bool isReadOnly() const { return m_pRegistry->isReadOnly(); } @@ -118,28 +125,27 @@ public: ORegistry* getRegistry() const { return m_pRegistry; } - const OStoreFile& getStoreFile() const + const store::OStoreFile& getStoreFile() const { return m_pRegistry->getStoreFile(); } - OStoreDirectory getStoreDir(); + store::OStoreDirectory getStoreDir(); - const OUString& getName() const + const rtl::OUString& getName() const { return m_name; } sal_uInt32 getRefCount() const { return m_refCount; } - OUString getFullPath(OUString const & path) const; + rtl::OUString getFullPath(rtl::OUString const & path) const; private: sal_uInt32 m_refCount; - OUString m_name; - sal_Bool m_bDeleted; + rtl::OUString m_name; + int m_bDeleted:1; + int m_bModified:1; ORegistry* m_pRegistry; }; - - #endif diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 8d0c98b57041..2d3322c25b13 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -28,6 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_registry.hxx" +#include "regimpl.hxx" + #include <memory> #include <string.h> #include <stdio.h> @@ -39,18 +41,6 @@ #include <unistd.h> #endif -#ifdef MACOSX -// Get the store.hxx inlines non-inline, solves crashes in cppumaker -#define inline -#endif - -#include "regimpl.hxx" - -#ifdef MACOSX -// Get the store.hxx inlines non-inline, solves crashes in cppumaker -#undef inline -#endif - #ifndef __REGISTRY_REFLREAD_HXX__ #include <registry/reflread.hxx> #endif @@ -64,19 +54,19 @@ #include "registry/types.h" #include "registry/version.h" -#ifndef __REFLCNST_HXX__ #include "reflcnst.hxx" -#endif #include "keyimpl.hxx" + #include <osl/thread.h> #include <rtl/alloc.h> #include <rtl/memory.h> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> -#ifndef _ODL_FILE_HXX_ #include <osl/file.hxx> -#endif +using namespace rtl; +using namespace osl; +using namespace store; #if defined ( GCC ) && ( defined ( SCO ) ) sal_helper::ORealDynamicLoader* sal_helper::ODynamicLoader<RegistryTypeReader_Api>::m_pLoader = NULL; @@ -467,11 +457,9 @@ ORegistry::ORegistry() // ORegistry::~ORegistry() { - if (m_openKeyTable.count(ROOT) > 0) - { - m_openKeyTable[ROOT]->release(); - delete(m_openKeyTable[ROOT]); - } + ORegKey* pRootKey = m_openKeyTable[ROOT]; + if (pRootKey != 0) + (void) releaseKey(pRootKey); if (m_file.isValid()) m_file.close(); @@ -546,8 +534,7 @@ RegError ORegistry::closeRegistry() if (m_file.isValid()) { - closeKey(m_openKeyTable[ROOT]); - m_file.flush(); + (void) releaseKey(m_openKeyTable[ROOT]); m_file.close(); m_isOpen = sal_False; return REG_NO_ERROR; @@ -595,7 +582,7 @@ RegError ORegistry::destroyRegistry(const OUString& regName) if (m_file.isValid()) { - closeKey(m_openKeyTable[ROOT]); + releaseKey(m_openKeyTable[ROOT]); m_file.close(); m_isOpen = sal_False; @@ -621,6 +608,39 @@ RegError ORegistry::destroyRegistry(const OUString& regName) } //********************************************************************* +// acquireKey +// +RegError ORegistry::acquireKey (RegKeyHandle hKey) +{ + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; + + REG_GUARD(m_mutex); + pKey->acquire(); + + return REG_NO_ERROR; +} + +//********************************************************************* +// releaseKey +// +RegError ORegistry::releaseKey (RegKeyHandle hKey) +{ + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; + + REG_GUARD(m_mutex); + if (pKey->release() == 0) + { + m_openKeyTable.erase(pKey->getName()); + delete pKey; + } + return REG_NO_ERROR; +} + +//********************************************************************* // createKey // RegError ORegistry::createKey(RegKeyHandle hKey, const OUString& keyName, @@ -718,6 +738,7 @@ RegError ORegistry::openKey(RegKeyHandle hKey, const OUString& keyName, default: break; } + std::auto_ptr< ORegKey > p(new ORegKey(path, this)); i = m_openKeyTable.insert(std::make_pair(path, p.get())).first; p.release(); @@ -734,56 +755,51 @@ RegError ORegistry::openKey(RegKeyHandle hKey, const OUString& keyName, // RegError ORegistry::closeKey(RegKeyHandle hKey) { - ORegKey* pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); REG_GUARD(m_mutex); - if (m_openKeyTable.count(pKey->getName()) > 0) + OUString const aKeyName (pKey->getName()); + if (!(m_openKeyTable.count(aKeyName) > 0)) + return REG_KEY_NOT_OPEN; + + if (pKey->isModified()) { - if (pKey->getRefCount() == 1) + ORegKey * pRootKey = getRootKey(); + if (pKey != pRootKey) { - m_openKeyTable.erase(pKey->getName()); - delete(pKey); - hKey = NULL; - } else + // propagate "modified" state to RootKey. + pRootKey->setModified(); + } + else { - pKey->release(); + // closing modified RootKey, flush registry file. + OSL_TRACE("registry::ORegistry::closeKey(): flushing modified RootKey"); + (void) m_file.flush(); } - - return REG_NO_ERROR; - } else - { - return REG_KEY_NOT_OPEN; + pKey->setModified(false); + (void) releaseKey(pRootKey); } -} + return releaseKey(pKey); +} //********************************************************************* // deleteKey // RegError ORegistry::deleteKey(RegKeyHandle hKey, const OUString& keyName) { - ORegKey* pKey; - RegError _ret = REG_NO_ERROR; - + ORegKey* pKey = static_cast< ORegKey* >(hKey); if ( !keyName.getLength() ) - { return REG_INVALID_KEYNAME; - } REG_GUARD(m_mutex); - if (hKey) - pKey = (ORegKey*)hKey; - else + if (!pKey) pKey = m_openKeyTable[ROOT]; - OUString sFullKeyName = pKey->getFullPath(keyName); - - pKey = m_openKeyTable[ROOT]; - _ret = eraseKey(pKey, sFullKeyName); - - return _ret; + OUString sFullKeyName(pKey->getFullPath(keyName)); + return eraseKey(m_openKeyTable[ROOT], sFullKeyName); } RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName) @@ -822,17 +838,15 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName) sFullPath += ROOT; } - RegKeyHandle hOldKey; - _ret = pKey->openKey(keyName, &hOldKey); - if (_ret) - { + ORegKey* pOldKey = 0; + _ret = pKey->openKey(keyName, (RegKeyHandle*)&pOldKey); + if (_ret != REG_NO_ERROR) return _ret; - } - _ret = deleteSubkeysAndValues((ORegKey*)hOldKey); - if (_ret) + _ret = deleteSubkeysAndValues(pOldKey); + if (_ret != REG_NO_ERROR) { - pKey->closeKey(hOldKey); + pKey->closeKey(pOldKey); return _ret; } @@ -840,47 +854,39 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName) tmpName += ROOT; OStoreFile sFile(pKey->getStoreFile()); - if ( sFile.isValid() && sFile.remove(sFullPath, tmpName) ) { return REG_DELETE_KEY_FAILED; } - //sFile.flush(); + pOldKey->setModified(); // set flag deleted !!! - ((ORegKey*)hOldKey)->setDeleted(sal_True); + pOldKey->setDeleted(sal_True); - _ret = pKey->closeKey(hOldKey); - if (_ret) - { - return _ret; - } - - return REG_NO_ERROR; + return pKey->closeKey(pOldKey); } - //********************************************************************* -// deleteSubKeys +// deleteSubKeysAndValues // RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) { OStoreDirectory::iterator iter; - OUString keyName; RegError _ret = REG_NO_ERROR; OStoreDirectory rStoreDir(pKey->getStoreDir()); storeError _err = rStoreDir.first(iter); while ( _err == store_E_None ) { - keyName = iter.m_pszName; + OUString const keyName = iter.m_pszName; if (iter.m_nAttrib & STORE_ATTRIB_ISDIR) { _ret = eraseKey(pKey, keyName); if (_ret) return _ret; - } else + } + else { OUString sFullPath(pKey->getName()); @@ -891,7 +897,7 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) { return REG_DELETE_VALUE_FAILED; } - //((OStoreFile&)pKey->getStoreFile()).flush(); + pKey->setModified(); } _err = rStoreDir.next(iter); @@ -907,119 +913,99 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName, sal_Bool bWarnings, sal_Bool bReport) { - RegError _ret = REG_NO_ERROR; - ORegistry* pReg; - ORegKey *pKey, *pRootKey; + RegError _ret = REG_NO_ERROR; + ORegKey* pKey = static_cast< ORegKey* >(hKey); - pReg = new ORegistry(); + std::auto_ptr< ORegistry > pReg (new ORegistry()); _ret = pReg->initRegistry(regFileName, REG_READONLY); - if (_ret) - { + if (_ret != REG_NO_ERROR) return _ret; - } - - pKey = (ORegKey*)hKey; - pRootKey = pReg->getRootKey(); + ORegKey* pRootKey = pReg->getRootKey(); REG_GUARD(m_mutex); OStoreDirectory::iterator iter; - OUString keyName; OStoreDirectory rStoreDir(pRootKey->getStoreDir()); storeError _err = rStoreDir.first(iter); while ( _err == store_E_None ) { - keyName = iter.m_pszName; + OUString const keyName = iter.m_pszName; if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR ) { _ret = loadAndSaveKeys(pKey, pRootKey, keyName, 0, bWarnings, bReport); - } else + } + else { _ret = loadAndSaveValue(pKey, pRootKey, keyName, 0, bWarnings, bReport); } - if (_ret == REG_MERGE_ERROR || - (_ret == REG_MERGE_CONFLICT && bWarnings)) - { - rStoreDir = OStoreDirectory(); - pRootKey->release(); - delete(pReg); - return _ret; - } + if (_ret == REG_MERGE_ERROR) + break; + if (_ret == REG_MERGE_CONFLICT && bWarnings) + break; _err = rStoreDir.next(iter); } rStoreDir = OStoreDirectory(); - pRootKey->release(); - delete(pReg); + (void) pReg->releaseKey(pRootKey); return _ret; } //********************************************************************* -// loadKey +// saveKey // RegError ORegistry::saveKey(RegKeyHandle hKey, const OUString& regFileName, sal_Bool bWarnings, sal_Bool bReport) { - RegError _ret = REG_NO_ERROR; - ORegistry* pReg; - ORegKey *pKey, *pRootKey; + RegError _ret = REG_NO_ERROR; + ORegKey* pKey = static_cast< ORegKey* >(hKey); - pReg = new ORegistry(); + std::auto_ptr< ORegistry > pReg (new ORegistry()); _ret = pReg->initRegistry(regFileName, REG_CREATE); - if (_ret) - { + if (_ret != REG_NO_ERROR) return _ret; - } - - pKey = (ORegKey*)hKey; - pRootKey = pReg->getRootKey(); + ORegKey* pRootKey = pReg->getRootKey(); REG_GUARD(m_mutex); OStoreDirectory::iterator iter; - OUString keyName; OStoreDirectory rStoreDir(pKey->getStoreDir()); storeError _err = rStoreDir.first(iter); while ( _err == store_E_None ) { - keyName = iter.m_pszName; + OUString const keyName = iter.m_pszName; if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR ) { _ret = loadAndSaveKeys(pRootKey, pKey, keyName, pKey->getName().getLength(), bWarnings, bReport); - } else + } + else { _ret = loadAndSaveValue(pRootKey, pKey, keyName, pKey->getName().getLength(), bWarnings, bReport); } - if (_ret) - { - pRootKey->release(); - delete(pReg); - return _ret; - } + if (_ret != REG_NO_ERROR) + break; _err = rStoreDir.next(iter); } - pRootKey->release(); - delete(pReg); - return REG_NO_ERROR; + (void) pReg->releaseKey(pRootKey); + return _ret; } //********************************************************************* -// loadValue() +// loadAndSaveValue() // RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, ORegKey* pSourceKey, @@ -1062,7 +1048,6 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, { return REG_VALUE_NOT_EXISTS; } - //pSourceKey->getStoreFile().flush(); pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE); @@ -1134,13 +1119,13 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, rtl_freeMemory(pBuffer); return REG_INVALID_VALUE; } - //rTargetFile.flush(); if (rwBytes != nSize) { rtl_freeMemory(pBuffer); return REG_INVALID_VALUE; } + pTargetKey->setModified(); rtl_freeMemory(pBuffer); return _ret; @@ -1354,7 +1339,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue, } //********************************************************************* -// loadKeys() +// loadAndSaveKeys() // RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, ORegKey* pSourceKey, @@ -1363,7 +1348,6 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, sal_Bool bWarnings, sal_Bool bReport) { - ORegKey* pTmpKey; RegError _ret = REG_NO_ERROR; OUString sRelPath(pSourceKey->getName().copy(nCut)); OUString sFullPath; @@ -1374,11 +1358,10 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, if (sRelPath.getLength() > 1 || sFullPath.getLength() == 0) sFullPath += ROOT; - OUString sFullKeyName = sFullPath; - OStoreDirectory rStoreDir; - + OUString sFullKeyName = sFullPath; sFullKeyName += keyName; + OStoreDirectory rStoreDir; if (rStoreDir.create(pTargetKey->getStoreFile(), sFullPath, keyName, KEY_MODE_CREATE)) { return REG_CREATE_KEY_FAILED; @@ -1389,21 +1372,18 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, m_openKeyTable[sFullKeyName]->setDeleted(sal_False); } - _ret = pSourceKey->openKey( - keyName, (RegKeyHandle*)&pTmpKey); - if (_ret) - { + ORegKey* pTmpKey = 0; + _ret = pSourceKey->openKey(keyName, (RegKeyHandle*)&pTmpKey); + if (_ret != REG_NO_ERROR) return _ret; - } OStoreDirectory::iterator iter; - OUString sName; OStoreDirectory rTmpStoreDir(pTmpKey->getStoreDir()); storeError _err = rTmpStoreDir.first(iter); while ( _err == store_E_None) { - sName = iter.m_pszName; + OUString const sName = iter.m_pszName; if (iter.m_nAttrib & STORE_ATTRIB_ISDIR) { @@ -1415,17 +1395,15 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, sName, nCut, bWarnings, bReport); } - if (_ret == REG_MERGE_ERROR || - (_ret == REG_MERGE_CONFLICT && bWarnings)) - { - pSourceKey->closeKey(pTmpKey); - return _ret; - } + if (_ret == REG_MERGE_ERROR) + break; + if (_ret == REG_MERGE_CONFLICT && bWarnings) + break; _err = rTmpStoreDir.next(iter); } - pSourceKey->closeKey(pTmpKey); + pSourceKey->releaseKey(pTmpKey); return _ret; } @@ -1479,21 +1457,6 @@ RegError ORegistry::dumpRegistry(RegKeyHandle hKey) const return REG_NO_ERROR; } -RegError ORegistry::flush() -{ - REG_GUARD(m_mutex); - - if (m_file.isValid()) - { - m_file.flush(); - return REG_NO_ERROR; - } else - { - return REG_REGISTRY_NOT_EXISTS; - } -} - - //********************************************************************* // dumpValue() // diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx index 739ca57b73d1..7523bb586749 100644 --- a/registry/source/regimpl.hxx +++ b/registry/source/regimpl.hxx @@ -29,10 +29,10 @@ #define _REGIMPL_HXX_ #include <set> - #include <hash_map> #include <registry/registry.h> +#include <rtl/ustring.hxx> #include <osl/mutex.hxx> #include <store/store.hxx> @@ -59,11 +59,10 @@ #define REG_CREATE 0x0004 // allow write accesses #define REG_GUARD(mutex) \ - Guard< Mutex > aGuard( mutex ); + osl::Guard< osl::Mutex > aGuard( mutex ); -using namespace rtl; -using namespace osl; -using namespace store; +// @@@ using namespace rtl; +// @@@ using namespace osl; class ORegKey; class RegistryTypeReader; @@ -79,39 +78,40 @@ public: sal_uInt32 release() { return --m_refCount; } - RegError initRegistry(const OUString& name, + RegError initRegistry(const rtl::OUString& name, RegAccessMode accessMode); RegError closeRegistry(); - RegError destroyRegistry(const OUString& name); + RegError destroyRegistry(const rtl::OUString& name); + + RegError acquireKey(RegKeyHandle hKey); + RegError releaseKey(RegKeyHandle hKey); RegError createKey(RegKeyHandle hKey, - const OUString& keyName, + const rtl::OUString& keyName, RegKeyHandle* phNewKey); RegError openKey(RegKeyHandle hKey, - const OUString& keyName, + const rtl::OUString& keyName, RegKeyHandle* phOpenKey); RegError closeKey(RegKeyHandle hKey); - RegError deleteKey(RegKeyHandle hKey, const OUString& keyName); + RegError deleteKey(RegKeyHandle hKey, const rtl::OUString& keyName); RegError loadKey(RegKeyHandle hKey, - const OUString& regFileName, + const rtl::OUString& regFileName, sal_Bool bWarings=sal_False, sal_Bool bReport=sal_False); RegError saveKey(RegKeyHandle hKey, - const OUString& regFileName, + const rtl::OUString& regFileName, sal_Bool bWarings=sal_False, sal_Bool bReport=sal_False); RegError dumpRegistry(RegKeyHandle hKey) const; - RegError flush(); - ~ORegistry(); sal_Bool isReadOnly() const @@ -122,62 +122,62 @@ public: ORegKey* getRootKey(); - const OStoreFile& getStoreFile() + const store::OStoreFile& getStoreFile() { return m_file; } - const OUString& getName() const + const rtl::OUString& getName() const { return m_name; } friend class ORegKey; private: - RegError eraseKey(ORegKey* pKey, const OUString& keyName); + RegError eraseKey(ORegKey* pKey, const rtl::OUString& keyName); RegError deleteSubkeysAndValues(ORegKey* pKey); RegError loadAndSaveValue(ORegKey* pTargetKey, ORegKey* pSourceKey, - const OUString& valueName, + const rtl::OUString& valueName, sal_uInt32 nCut, sal_Bool bWarnings=sal_False, sal_Bool bReport=sal_False); - RegError checkBlop(OStoreStream& rValue, - const OUString& sTargetPath, + RegError checkBlop(store::OStoreStream& rValue, + const rtl::OUString& sTargetPath, sal_uInt32 srcValueSize, sal_uInt8* pSrcBuffer, sal_Bool bReport=sal_False); - RegError mergeModuleValue(OStoreStream& rTargetValue, + RegError mergeModuleValue(store::OStoreStream& rTargetValue, RegistryTypeReader& reader, RegistryTypeReader& reader2); RegError loadAndSaveKeys(ORegKey* pTargetKey, ORegKey* pSourceKey, - const OUString& keyName, + const rtl::OUString& keyName, sal_uInt32 nCut, sal_Bool bWarnings=sal_False, sal_Bool bReport=sal_False); - RegError dumpValue(const OUString& sPath, - const OUString& sName, + RegError dumpValue(const rtl::OUString& sPath, + const rtl::OUString& sName, sal_Int16 nSpace) const; - RegError dumpKey(const OUString& sPath, - const OUString& sName, + RegError dumpKey(const rtl::OUString& sPath, + const rtl::OUString& sName, sal_Int16 nSpace) const; - typedef std::hash_map< OUString, ORegKey*, OUStringHash > KeyMap; + typedef std::hash_map< rtl::OUString, ORegKey*, rtl::OUStringHash > KeyMap; sal_uInt32 m_refCount; - Mutex m_mutex; + osl::Mutex m_mutex; sal_Bool m_readOnly; sal_Bool m_isOpen; - OUString m_name; - OStoreFile m_file; + rtl::OUString m_name; + store::OStoreFile m_file; KeyMap m_openKeyTable; - const OUString ROOT; + const rtl::OUString ROOT; }; #endif diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx index aa7d7cedcc27..ea858f062f51 100644 --- a/registry/source/registry.cxx +++ b/registry/source/registry.cxx @@ -27,13 +27,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_registry.hxx" + #include <registry/registry.h> #include <registry/registry.hxx> #include <osl/process.h> -#include "regimpl.hxx" -#ifndef _REGKEY_HXX_ + #include "keyimpl.hxx" -#endif +#include "regimpl.hxx" #include "regkey.hxx" #if defined(WIN32) || defined(WNT) || defined(OS2) @@ -257,46 +257,42 @@ static RegError REGISTRY_CALLTYPE loadKey(RegHandle hReg, rtl_uString* keyName, rtl_uString* regFileName) { - ORegistry *pReg; - ORegKey *pKey, *pNewKey; - RegError _ret; - if (hReg) - { - pReg = (ORegistry*)hReg; - if (!pReg->isOpen()) - return REG_REGISTRY_NOT_OPEN; - } else - { + ORegistry* pReg = static_cast< ORegistry* >(hReg); + if (!pReg) return REG_INVALID_REGISTRY; - } - if (hKey) - { - pKey = (ORegKey*)hKey; + if (!pReg->isOpen()) + return REG_REGISTRY_NOT_OPEN; - if (pKey->getRegistry() != pReg || pKey->isDeleted()) - return REG_INVALID_KEY; - } else - { + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) return REG_INVALID_KEY; - } + if (pKey->getRegistry() != pReg) + return REG_INVALID_KEY; + if (pKey->isDeleted()) + return REG_INVALID_KEY; if (pKey->isReadOnly()) return REG_REGISTRY_READONLY; - if (!pKey->openKey(keyName, (RegKeyHandle*)&pNewKey)) + + ORegKey* pNewKey = 0; + RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey); + if (_ret == REG_NO_ERROR) { - pKey->closeKey(pNewKey); + pKey->releaseKey(pNewKey); pKey->deleteKey(keyName); } - if ((_ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey))) + _ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey); + if (_ret != REG_NO_ERROR) return _ret; - if ((_ret = pReg->loadKey(pNewKey, regFileName))) + _ret = pReg->loadKey(pNewKey, regFileName); + if (_ret != REG_NO_ERROR) { - pKey->closeKey(pNewKey); + pKey->releaseKey(pNewKey); pKey->deleteKey(keyName); return _ret; } @@ -312,41 +308,36 @@ static RegError REGISTRY_CALLTYPE saveKey(RegHandle hReg, rtl_uString* keyName, rtl_uString* regFileName) { - ORegistry *pReg; - ORegKey *pKey, *pNewKey; - RegError _ret; - if (hReg) - { - pReg = (ORegistry*)hReg; - if (!pReg->isOpen()) - return REG_REGISTRY_NOT_OPEN; - } else - { + ORegistry* pReg = static_cast< ORegistry* >(hReg); + if (!pReg) return REG_INVALID_REGISTRY; - } - if (hKey) - { - pKey = (ORegKey*)hKey; + if (!pReg->isOpen()) + return REG_REGISTRY_NOT_OPEN; - if (pKey->getRegistry() != pReg || pKey->isDeleted()) - return REG_INVALID_KEY; - } else - { + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; + + if (pKey->getRegistry() != pReg) + return REG_INVALID_KEY; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } - if ((_ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey))) + ORegKey* pNewKey = 0; + RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey); + if (_ret != REG_NO_ERROR) return _ret; - if ((_ret = pReg->saveKey(pNewKey, regFileName))) + _ret = pReg->saveKey(pNewKey, regFileName); + if (_ret != REG_NO_ERROR) { - pKey->closeKey(pNewKey); + (void) pKey->releaseKey(pNewKey); return _ret; } - return pKey->closeKey(pNewKey); + return pKey->releaseKey(pNewKey); } //********************************************************************* @@ -359,114 +350,68 @@ static RegError REGISTRY_CALLTYPE mergeKey(RegHandle hReg, sal_Bool bWarnings, sal_Bool bReport) { - ORegistry *pReg; - ORegKey *pKey, *pNewKey; - RegError _ret; - - if (hReg) - { - pReg = (ORegistry*)hReg; - if (!pReg->isOpen()) - return(REG_REGISTRY_NOT_OPEN); - } else - { + ORegistry* pReg = static_cast< ORegistry* >(hReg); + if (!pReg) return REG_INVALID_REGISTRY; - } - - if (hKey) - { - pKey = (ORegKey*)hKey; + if (!pReg->isOpen()) + return REG_REGISTRY_NOT_OPEN; - if (pKey->getRegistry() != pReg || pKey->isDeleted()) - return REG_INVALID_KEY; - } else - { + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; + if (pKey->getRegistry() != pReg) + return REG_INVALID_KEY; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } - if (pKey->isReadOnly()) return REG_REGISTRY_READONLY; if (keyName->length) { - if ((_ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey) )) + ORegKey* pNewKey = 0; + RegError _ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey); + if (_ret != REG_NO_ERROR) return _ret; - } else - { - pNewKey = pKey; - } - - _ret = pKey->getRegistry()->loadKey(pNewKey, regFileName, bWarnings, bReport); - - if (_ret == REG_MERGE_ERROR || - (_ret == REG_MERGE_CONFLICT && bWarnings)) - { - pKey->closeKey(pNewKey); - return _ret; - } - /* - if (_ret) - { - if (_ret == REG_MERGE_ERROR || - (_ret == REG_MERGE_CONFLICT && bWarnings)) + _ret = pReg->loadKey(pNewKey, regFileName, bWarnings, bReport); + if (_ret == REG_MERGE_ERROR || (_ret == REG_MERGE_CONFLICT && bWarnings)) { - pKey->closeKey(pNewKey); - pKey->deleteKey(keyName); - pKey->createKey(keyName, (RegKeyHandle*)&pNewKey); - pReg->loadKey(pNewKey, tmpName, sal_False, sal_False); + if (pNewKey != pKey) + (void) pKey->closeKey(pNewKey); + else + (void) pKey->releaseKey(pNewKey); + return _ret; } - destroyRegistry(hReg, tmpName); - - pKey->closeKey(pNewKey); - return _ret; + return (pNewKey != pKey) ? pKey->closeKey(pNewKey) : pKey->releaseKey(pNewKey); } - destroyRegistry(hReg, tmpName); - */ - _ret = pKey->closeKey(pNewKey); - - if (_ret == REG_NO_ERROR ) - _ret = pReg->flush(); - return _ret; + return pReg->loadKey(pKey, regFileName, bWarnings, bReport); } - //********************************************************************* // dumpRegistry // static RegError REGISTRY_CALLTYPE dumpRegistry(RegHandle hReg, RegKeyHandle hKey) { - ORegistry *pReg; - ORegKey *pKey; - - if (hReg) - { - pReg = (ORegistry*)hReg; - if (!pReg->isOpen()) - return REG_REGISTRY_NOT_OPEN; - } else - { + ORegistry* pReg = static_cast< ORegistry* >(hReg); + if (!pReg) return REG_INVALID_REGISTRY; - } - - if (hKey) - { - pKey = (ORegKey*)hKey; + if (!pReg->isOpen()) + return REG_REGISTRY_NOT_OPEN; - if (pKey->getRegistry() != pReg || pKey->isDeleted()) - return REG_INVALID_KEY; - } else - { + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; + if (pKey->getRegistry() != pReg) + return REG_INVALID_KEY; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } return pReg->dumpRegistry(hKey); } - //********************************************************************* // initRegistry_Api // diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx index 61153ed15170..c65de7e3e2ca 100644 --- a/registry/source/regkey.cxx +++ b/registry/source/regkey.cxx @@ -29,21 +29,25 @@ #include "precompiled_registry.hxx" #include "regkey.hxx" + #include <registry/registry.hxx> #include <rtl/alloc.h> #include "regimpl.hxx" #include "keyimpl.hxx" +using rtl::OUString; //********************************************************************* // acquireKey // void REGISTRY_CALLTYPE acquireKey(RegKeyHandle hKey) { - ORegKey* pKey = (ORegKey*) hKey; - - if (pKey != NULL) - pKey->acquire(); + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (pKey != 0) + { + ORegistry* pReg = pKey->getRegistry(); + (void) pReg->acquireKey(pKey); + } } @@ -52,12 +56,11 @@ void REGISTRY_CALLTYPE acquireKey(RegKeyHandle hKey) // void REGISTRY_CALLTYPE releaseKey(RegKeyHandle hKey) { - ORegKey* pKey = (ORegKey*) hKey; - - if (pKey) + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (pKey != 0) { - if (pKey->release() == 0) - delete pKey; + ORegistry* pReg = pKey->getRegistry(); + (void) pReg->releaseKey(pKey); } } @@ -67,13 +70,8 @@ void REGISTRY_CALLTYPE releaseKey(RegKeyHandle hKey) // sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle hKey) { - if (hKey) - { - return ((ORegKey*)hKey)->isReadOnly(); - } else - { - return sal_False; - } + ORegKey* pKey = static_cast< ORegKey* >(hKey); + return (pKey != 0) ? pKey->isReadOnly() : sal_False; } @@ -82,9 +80,10 @@ sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle hKey) // RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName) { - if (hKey) + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (pKey) { - rtl_uString_assign( pKeyName, ((ORegKey*)hKey)->getName().pData ); + rtl_uString_assign( pKeyName, pKey->getName().pData ); return REG_NO_ERROR; } else { @@ -101,22 +100,14 @@ RegError REGISTRY_CALLTYPE createKey(RegKeyHandle hKey, rtl_uString* keyName, RegKeyHandle* phNewKey) { - ORegKey* pKey; + *phNewKey = 0; - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - { - phNewKey = NULL; - return REG_INVALID_KEY; - } - } else - { - phNewKey = NULL; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } if (pKey->isReadOnly()) return REG_REGISTRY_READONLY; @@ -131,22 +122,14 @@ RegError REGISTRY_CALLTYPE openKey(RegKeyHandle hKey, rtl_uString* keyName, RegKeyHandle* phOpenKey) { - ORegKey* pKey; + *phOpenKey = 0; - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - { - phOpenKey = NULL; - return REG_INVALID_KEY; - } - } else - { - phOpenKey = NULL; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } return pKey->openKey(keyName, phOpenKey); } @@ -159,24 +142,15 @@ RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey, RegKeyHandle** pphSubKeys, sal_uInt32* pnSubKeys) { - ORegKey* pKey; + *pphSubKeys = NULL; + *pnSubKeys = 0; - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - { - *pphSubKeys = NULL; - *pnSubKeys = 0; - return REG_INVALID_KEY; - } - } else - { - *pphSubKeys = NULL; - *pnSubKeys = 0; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } return pKey->openSubKeys(keyName, pphSubKeys, pnSubKeys); } @@ -187,43 +161,30 @@ RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey, RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle* phSubKeys, sal_uInt32 nSubKeys) { - RegError _ret = REG_NO_ERROR; + if (phSubKeys == 0 || nSubKeys == 0) + return REG_INVALID_KEY; - if (phSubKeys != 0 && nSubKeys != 0) + ORegistry* pReg = ((ORegKey*)(phSubKeys[0]))->getRegistry(); + for (sal_uInt32 i = 0; i < nSubKeys; i++) { - ORegistry* pReg = NULL; - - pReg = ((ORegKey*)phSubKeys[0])->getRegistry(); - - for (sal_uInt32 i=0; (i < nSubKeys) && (_ret == REG_NO_ERROR); i++) - { - _ret = pReg->closeKey(phSubKeys[i]); - } - - rtl_freeMemory(phSubKeys); + (void) pReg->closeKey(phSubKeys[i]); } - else - _ret = REG_INVALID_KEY; + rtl_freeMemory(phSubKeys); - return _ret; + return REG_NO_ERROR; } - //********************************************************************* // deleteKey // RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey, rtl_uString* keyName) { - ORegKey* pKey; - - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - return REG_INVALID_KEY; - } else + if (pKey->isDeleted()) return REG_INVALID_KEY; if (pKey->isReadOnly()) @@ -237,24 +198,13 @@ RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey, // RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle hKey) { - ORegKey* pKey; - ORegistry* pReg; - - if (hKey) - { - pKey = (ORegKey*)hKey; - - pReg = pKey->getRegistry(); - - if (pReg->closeKey(hKey)) - return REG_INVALID_KEY; - } else + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) return REG_INVALID_KEY; - return REG_NO_ERROR; + return pKey->closeKey(hKey); } - //********************************************************************* // setValue // @@ -264,15 +214,11 @@ RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, RegValue pData, sal_uInt32 valueSize) { - ORegKey* pKey; - - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - return REG_INVALID_KEY; - } else + if (pKey->isDeleted()) return REG_INVALID_KEY; if (pKey->isReadOnly()) @@ -281,24 +227,22 @@ RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); if (keyName->length) { - RegKeyHandle hSubKey; - ORegKey* pSubKey; - RegError _ret1 = pKey->openKey(keyName, &hSubKey); - if (_ret1) + ORegKey* pSubKey = 0; + RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); + if (_ret1 != REG_NO_ERROR) return _ret1; - pSubKey = (ORegKey*)hSubKey; _ret1 = pSubKey->setValue(valueName, valueType, pData, valueSize); - if (_ret1) + if (_ret1 != REG_NO_ERROR) { - RegError _ret2 = pKey->closeKey(hSubKey); + RegError _ret2 = pKey->closeKey(pSubKey); if (_ret2) return _ret2; else return _ret1; } - return pKey->closeKey(hSubKey); + return pKey->closeKey(pSubKey); } return pKey->setValue(valueName, valueType, pData, valueSize); @@ -312,15 +256,11 @@ RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey, sal_Int32* pValueList, sal_uInt32 len) { - ORegKey* pKey; - - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - return REG_INVALID_KEY; - } else + if (pKey->isDeleted()) return REG_INVALID_KEY; if (pKey->isReadOnly()) @@ -329,24 +269,22 @@ RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey, OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); if (keyName->length) { - RegKeyHandle hSubKey; - ORegKey* pSubKey; - RegError _ret1 = pKey->openKey(keyName, &hSubKey); - if (_ret1) + ORegKey* pSubKey = 0; + RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); + if (_ret1 != REG_NO_ERROR) return _ret1; - pSubKey = (ORegKey*)hSubKey; _ret1 = pSubKey->setLongListValue(valueName, pValueList, len); - if (_ret1) + if (_ret1 != REG_NO_ERROR) { - RegError _ret2 = pKey->closeKey(hSubKey); - if (_ret2) + RegError _ret2 = pKey->closeKey(pSubKey); + if (_ret2 != REG_NO_ERROR) return _ret2; else return _ret1; } - return pKey->closeKey(hSubKey); + return pKey->closeKey(pSubKey); } return pKey->setLongListValue(valueName, pValueList, len); @@ -360,15 +298,11 @@ RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey, sal_Char** pValueList, sal_uInt32 len) { - ORegKey* pKey; - - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - return REG_INVALID_KEY; - } else + if (pKey->isDeleted()) return REG_INVALID_KEY; if (pKey->isReadOnly()) @@ -377,24 +311,22 @@ RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey, OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); if (keyName->length) { - RegKeyHandle hSubKey; - ORegKey* pSubKey; - RegError _ret1 = pKey->openKey(keyName, &hSubKey); - if (_ret1) + ORegKey* pSubKey = 0; + RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); + if (_ret1 != REG_NO_ERROR) return _ret1; - pSubKey = (ORegKey*)hSubKey; _ret1 = pSubKey->setStringListValue(valueName, pValueList, len); - if (_ret1) + if (_ret1 != REG_NO_ERROR) { - RegError _ret2 = pKey->closeKey(hSubKey); - if (_ret2) + RegError _ret2 = pKey->closeKey(pSubKey); + if (_ret2 != REG_NO_ERROR) return _ret2; else return _ret1; } - return pKey->closeKey(hSubKey); + return pKey->closeKey(pSubKey); } return pKey->setStringListValue(valueName, pValueList, len); @@ -408,15 +340,11 @@ RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey, sal_Unicode** pValueList, sal_uInt32 len) { - ORegKey* pKey; - - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - return REG_INVALID_KEY; - } else + if (pKey->isDeleted()) return REG_INVALID_KEY; if (pKey->isReadOnly()) @@ -425,24 +353,22 @@ RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey, OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); if (keyName->length) { - RegKeyHandle hSubKey; - ORegKey* pSubKey; - RegError _ret1 = pKey->openKey(keyName, &hSubKey); - if (_ret1) + ORegKey* pSubKey = 0; + RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); + if (_ret1 != REG_NO_ERROR) return _ret1; - pSubKey = (ORegKey*)hSubKey; _ret1 = pSubKey->setUnicodeListValue(valueName, pValueList, len); - if (_ret1) + if (_ret1 != REG_NO_ERROR) { - RegError _ret2 = pKey->closeKey(hSubKey); - if (_ret2) + RegError _ret2 = pKey->closeKey(pSubKey); + if (_ret2 != REG_NO_ERROR) return _ret2; else return _ret1; } - return pKey->closeKey(hSubKey); + return pKey->closeKey(pSubKey); } return pKey->setUnicodeListValue(valueName, pValueList, len); @@ -456,49 +382,41 @@ RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey, RegValueType* pValueType, sal_uInt32* pValueSize) { - ORegKey* pKey; - RegValueType valueType; - sal_uInt32 valueSize; - *pValueType = RG_VALUETYPE_NOT_DEFINED; *pValueSize = 0; - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - return REG_INVALID_KEY; - } else + if (pKey->isDeleted()) return REG_INVALID_KEY; + RegValueType valueType; + sal_uInt32 valueSize; + OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); if (keyName->length) { - RegKeyHandle hSubKey; - ORegKey* pSubKey; - RegError _ret = pKey->openKey(keyName, &hSubKey); - if (_ret) + ORegKey* pSubKey = 0; + RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); + if (_ret != REG_NO_ERROR) return _ret; - pSubKey = (ORegKey*)hSubKey; - if (pSubKey->getValueInfo(valueName, &valueType, &valueSize)) + if (pSubKey->getValueInfo(valueName, &valueType, &valueSize) != REG_NO_ERROR) { - _ret = pKey->closeKey(hSubKey); - if (_ret) - return _ret; - else - return REG_INVALID_VALUE; + (void) pKey->releaseKey(pSubKey); + return REG_INVALID_VALUE; } *pValueType = valueType; *pValueSize = valueSize; - return pKey->closeKey(hSubKey); + return pKey->releaseKey(pSubKey); } - if (pKey->getValueInfo(valueName, &valueType, &valueSize)) + if (pKey->getValueInfo(valueName, &valueType, &valueSize) != REG_NO_ERROR) { return REG_INVALID_VALUE; } @@ -516,52 +434,29 @@ RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey, rtl_uString* keyName, RegValue pValue) { - ORegKey* pKey; - - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - { - pValue = NULL; - return REG_INVALID_KEY; - } - } else - { - pValue = NULL; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); if (keyName->length) { - RegKeyHandle hSubKey; - ORegKey* pSubKey; - RegError _ret1 = pKey->openKey(keyName, &hSubKey); - if (_ret1) - { - pValue = NULL; + ORegKey* pSubKey = 0; + RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); + if (_ret1 != REG_NO_ERROR) return _ret1; - } - pSubKey = (ORegKey*)hSubKey; _ret1 = pSubKey->getValue(valueName, pValue); - if (_ret1) + if (_ret1 != REG_NO_ERROR) { - RegError _ret2 = pKey->closeKey(hSubKey); - if (_ret2) - { - pValue = NULL; - return _ret2; - } else - { - pValue = NULL; - return _ret1; - } + (void) pKey->releaseKey(pSubKey); + return _ret1; } - return pKey->closeKey(hSubKey); + return pKey->releaseKey(pSubKey); } return pKey->getValue(valueName, pValue); @@ -575,58 +470,32 @@ RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey, sal_Int32** pValueList, sal_uInt32* pLen) { - ORegKey* pKey; + OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getLongListValue(): invalid parameter"); + *pValueList = 0, *pLen = 0; - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - { - pValueList = NULL; - *pLen = 0; - return REG_INVALID_KEY; - } - } else - { - pValueList = NULL; - *pLen = 0; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); if (keyName->length) { - RegKeyHandle hSubKey; - ORegKey* pSubKey; - RegError _ret1 = pKey->openKey(keyName, &hSubKey); - if (_ret1) - { - pValueList = NULL; - *pLen = 0; + ORegKey* pSubKey = 0; + RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); + if (_ret1 != REG_NO_ERROR) return _ret1; - } - - pSubKey = (ORegKey*)hSubKey; _ret1 = pSubKey->getLongListValue(valueName, pValueList, pLen); - if (_ret1) + if (_ret1 != REG_NO_ERROR) { - RegError _ret2 = pKey->closeKey(hSubKey); - if (_ret2) - { - pValueList = NULL; - *pLen = 0; - return _ret2; - } else - { - pValueList = NULL; - *pLen = 0; - return _ret1; - } + (void) pKey->releaseKey(pSubKey); + return _ret1; } - return pKey->closeKey(hSubKey); + return pKey->releaseKey(pSubKey); } return pKey->getLongListValue(valueName, pValueList, pLen); @@ -640,58 +509,32 @@ RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey, sal_Char*** pValueList, sal_uInt32* pLen) { - ORegKey* pKey; + OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getStringListValue(): invalid parameter"); + *pValueList = 0, *pLen = 0; - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - { - pValueList = NULL; - *pLen = 0; - return REG_INVALID_KEY; - } - } else - { - pValueList = NULL; - *pLen = 0; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); if (keyName->length) { - RegKeyHandle hSubKey; - ORegKey* pSubKey; - RegError _ret1 = pKey->openKey(keyName, &hSubKey); - if (_ret1) - { - pValueList = NULL; - *pLen = 0; + ORegKey* pSubKey = 0; + RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); + if (_ret1 != REG_NO_ERROR) return _ret1; - } - - pSubKey = (ORegKey*)hSubKey; _ret1 = pSubKey->getStringListValue(valueName, pValueList, pLen); - if (_ret1) + if (_ret1 != REG_NO_ERROR) { - RegError _ret2 = pKey->closeKey(hSubKey); - if (_ret2) - { - pValueList = NULL; - *pLen = 0; - return _ret2; - } else - { - pValueList = NULL; - *pLen = 0; - return _ret1; - } + (void) pKey->releaseKey(pSubKey); + return _ret1; } - return pKey->closeKey(hSubKey); + return pKey->releaseKey(pSubKey); } return pKey->getStringListValue(valueName, pValueList, pLen); @@ -705,58 +548,32 @@ RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey, sal_Unicode*** pValueList, sal_uInt32* pLen) { - ORegKey* pKey; + OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getUnicodeListValue(): invalid parameter"); + *pValueList = 0, *pLen = 0; - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - { - pValueList = NULL; - *pLen = 0; - return REG_INVALID_KEY; - } - } else - { - pValueList = NULL; - *pLen = 0; + if (pKey->isDeleted()) return REG_INVALID_KEY; - } OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") ); if (keyName->length) { - RegKeyHandle hSubKey; - ORegKey* pSubKey; - RegError _ret1 = pKey->openKey(keyName, &hSubKey); - if (_ret1) - { - pValueList = NULL; - *pLen = 0; + ORegKey* pSubKey = 0; + RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey); + if (_ret1 != REG_NO_ERROR) return _ret1; - } - - pSubKey = (ORegKey*)hSubKey; _ret1 = pSubKey->getUnicodeListValue(valueName, pValueList, pLen); - if (_ret1) + if (_ret1 != REG_NO_ERROR) { - RegError _ret2 = pKey->closeKey(hSubKey); - if (_ret2) - { - pValueList = NULL; - *pLen = 0; - return _ret2; - } else - { - pValueList = NULL; - *pLen = 0; - return _ret1; - } + (void) pKey->releaseKey(pSubKey); + return _ret1; } - return pKey->closeKey(hSubKey); + return pKey->releaseKey(pSubKey); } return pKey->getUnicodeListValue(valueName, pValueList, pLen); @@ -806,7 +623,6 @@ RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType, return REG_NO_ERROR; } - //********************************************************************* // createLink // @@ -830,15 +646,11 @@ RegError REGISTRY_CALLTYPE getKeyType(RegKeyHandle hKey, rtl_uString* keyName, RegKeyType* pKeyType) { - ORegKey* pKey; - - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - return REG_INVALID_KEY; - } else + if (pKey->isDeleted()) return REG_INVALID_KEY; return pKey->getKeyType(keyName, pKeyType); @@ -861,26 +673,20 @@ RegError REGISTRY_CALLTYPE getResolvedKeyName(RegKeyHandle hKey, sal_Bool, rtl_uString** pResolvedName) { - ORegKey *pKey; - RegError _ret = REG_NO_ERROR; - - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - return REG_INVALID_KEY; - } else + if (pKey->isDeleted()) return REG_INVALID_KEY; OUString resolvedName; - _ret = pKey->getResolvedKeyName(keyName, resolvedName); - if (!_ret) + RegError _ret = pKey->getResolvedKeyName(keyName, resolvedName); + if (_ret == REG_NO_ERROR) rtl_uString_assign(pResolvedName, resolvedName.pData); return _ret; } - //********************************************************************* // getKeyNames // @@ -889,15 +695,11 @@ RegError REGISTRY_CALLTYPE getKeyNames(RegKeyHandle hKey, rtl_uString*** pSubKeyNames, sal_uInt32* pnSubKeys) { - ORegKey* pKey; - - if (hKey) - { - pKey = (ORegKey*)hKey; + ORegKey* pKey = static_cast< ORegKey* >(hKey); + if (!pKey) + return REG_INVALID_KEY; - if (pKey->isDeleted()) - return REG_INVALID_KEY; - } else + if (pKey->isDeleted()) return REG_INVALID_KEY; return pKey->getKeyNames(keyName, pSubKeyNames, pnSubKeys); @@ -1205,7 +1007,6 @@ RegError REGISTRY_CALLTYPE reg_getLinkTarget(RegKeyHandle hKey, return getLinkTarget(hKey, linkName, pLinkTarget); } - //********************************************************************* // reg_getResolvedKeyName // @@ -1214,14 +1015,8 @@ RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey, sal_Bool firstLinkOnly, rtl_uString** pResolvedName) { - ORegKey *pKey; - - if (hKey) - pKey = (ORegKey*)hKey; - else + if (!hKey) return REG_INVALID_KEY; return getResolvedKeyName(hKey, keyName, firstLinkOnly, pResolvedName); } - - diff --git a/registry/tools/checksingleton.cxx b/registry/tools/checksingleton.cxx index 7f5397b2d609..4353721ad0b0 100644 --- a/registry/tools/checksingleton.cxx +++ b/registry/tools/checksingleton.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_registry.hxx" + #include <stdio.h> #include <string.h> @@ -452,10 +453,10 @@ int _cdecl main( int argc, char * argv[] ) sal_Bool bSingletonsExist = checkSingletons(singletonKey, typeKey); - indexRoot.closeKey(); - typeRoot.closeKey(); - typeKey.closeKey(); - singletonKey.closeKey(); + indexRoot.releaseKey(); + typeRoot.releaseKey(); + typeKey.releaseKey(); + singletonKey.releaseKey(); if ( indexReg.close() ) { fprintf(stderr, "%s: closing registry \"%s\" failed\n", diff --git a/registry/tools/regcompare.cxx b/registry/tools/regcompare.cxx index 44984454622f..4e95d884de30 100644 --- a/registry/tools/regcompare.cxx +++ b/registry/tools/regcompare.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_registry.hxx" + #include <stdio.h> #include <string.h> @@ -2273,8 +2274,8 @@ static sal_uInt32 compareKeys(RegistryKey& key1, RegistryKey& key2) { nError += compareKeys(subKey1, subKey2); } - subKey1.closeKey(); - subKey2.closeKey(); + subKey1.releaseKey(); + subKey2.releaseKey(); ++iter; } @@ -2377,8 +2378,8 @@ int _cdecl main( int argc, char * argv[] ) } } - key1.closeKey(); - key2.closeKey(); + key1.releaseKey(); + key2.releaseKey(); if ( reg1.close() ) { fprintf(stdout, "%s: closing registry \"%s\" failed\n", diff --git a/registry/tools/regmerge.cxx b/registry/tools/regmerge.cxx index 330a1f5c4b66..06786a9b993e 100644 --- a/registry/tools/regmerge.cxx +++ b/registry/tools/regmerge.cxx @@ -31,7 +31,7 @@ #include <stdio.h> #include <string.h> -#include "registry/registry.h" +#include "registry/registry.hxx" #include <rtl/ustring.hxx> #include <rtl/alloc.h> #include <osl/process.h> @@ -204,9 +204,7 @@ int main( int argc, char * argv[] ) int _cdecl main( int argc, char * argv[] ) #endif { - RegHandle hReg; - RegKeyHandle hRootKey; - bool bVerbose = checkCommandArgs(argc, argv); + bool bVerbose = checkCommandArgs(argc, argv); if (realargc < 4) { @@ -216,9 +214,11 @@ int _cdecl main( int argc, char * argv[] ) } ::rtl::OUString regName( convertToFileUrl(realargv[1]) ); - if (reg_openRegistry(regName.pData, &hReg, REG_READWRITE)) + + Registry reg; + if (reg.open(regName, REG_READWRITE) != REG_NO_ERROR) { - if (reg_createRegistry(regName.pData, &hReg)) + if (reg.create(regName) != REG_NO_ERROR) { if (bVerbose) fprintf(stderr, "open registry \"%s\" failed\n", realargv[1]); @@ -227,17 +227,16 @@ int _cdecl main( int argc, char * argv[] ) } } - if (!reg_openRootKey(hReg, &hRootKey)) + RegistryKey rootKey; + if (reg.openRootKey(rootKey) == REG_NO_ERROR) { ::rtl::OUString mergeKeyName( ::rtl::OUString::createFromAscii(realargv[2]) ); ::rtl::OUString targetRegName; for (int i = 3; i < realargc; i++) { targetRegName = convertToFileUrl(realargv[i]); - RegError _ret = reg_mergeKey( - hRootKey, mergeKeyName.pData, targetRegName.pData, sal_False, - bVerbose); - if (_ret) + RegError _ret = reg.mergeKey(rootKey, mergeKeyName, targetRegName, sal_False, bVerbose); + if (_ret != REG_NO_ERROR) { if (_ret == REG_MERGE_CONFLICT) { @@ -259,13 +258,7 @@ int _cdecl main( int argc, char * argv[] ) } } - if (reg_closeKey(hRootKey)) - { - if (bVerbose) - fprintf(stderr, "closing root key of registry \"%s\" failed\n", - realargv[1]); - exit(-3); - } + rootKey.releaseKey(); } else { if (bVerbose) @@ -274,7 +267,7 @@ int _cdecl main( int argc, char * argv[] ) exit(-4); } - if (reg_closeRegistry(hReg)) + if (reg.close() != REG_NO_ERROR) { if (bVerbose) fprintf(stderr, "closing registry \"%s\" failed\n", realargv[1]); diff --git a/remotebridges/source/bridge/makefile.mk b/remotebridges/source/bridge/makefile.mk index 6c217b273372..1b712bef1913 100644 --- a/remotebridges/source/bridge/makefile.mk +++ b/remotebridges/source/bridge/makefile.mk @@ -43,7 +43,7 @@ SLOFILES= \ $(SLO)$/bridge_connection.obj\ $(SLO)$/bridge_provider.obj SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = remotebridge.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1STDLIBS= \ $(SALLIB) \ diff --git a/remotebridges/source/bridge/remotebridge.map b/remotebridges/source/bridge/remotebridge.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/remotebridges/source/bridge/remotebridge.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/remotebridges/source/factory/brdgfctr.map b/remotebridges/source/factory/brdgfctr.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/remotebridges/source/factory/brdgfctr.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/remotebridges/source/factory/makefile.mk b/remotebridges/source/factory/makefile.mk index 4f0a6d04437b..7cd3875bcfb3 100644 --- a/remotebridges/source/factory/makefile.mk +++ b/remotebridges/source/factory/makefile.mk @@ -43,7 +43,7 @@ SLOFILES= \ $(SLO)$/bridgeimpl.obj SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = brdgfctr.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1STDLIBS= \ $(SALLIB) \ diff --git a/remotebridges/source/unourl_resolver/makefile.mk b/remotebridges/source/unourl_resolver/makefile.mk index 7eea4e7cf239..a3e4af7f0d91 100644 --- a/remotebridges/source/unourl_resolver/makefile.mk +++ b/remotebridges/source/unourl_resolver/makefile.mk @@ -43,7 +43,7 @@ SLOFILES= \ $(SLO)$/unourl_resolver.obj SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = uuresolver.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1STDLIBS= \ $(SALLIB) \ diff --git a/remotebridges/source/unourl_resolver/uuresolver.map b/remotebridges/source/unourl_resolver/uuresolver.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/remotebridges/source/unourl_resolver/uuresolver.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx new file mode 100644 index 000000000000..1082e6ff9844 --- /dev/null +++ b/sal/cppunittester/cppunittester.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 <cstdlib> +#include <iostream> + +#include "cppunit/CompilerOutputter.h" +#include "cppunit/TestResult.h" +#include "cppunit/TestResultCollector.h" +#include "cppunit/TestRunner.h" +#include "cppunit/extensions/TestFactoryRegistry.h" +#include "cppunit/plugin/PlugInManager.h" +#include "cppunit/portability/Stream.h" +#include "osl/thread.h" +#include "rtl/process.h" +#include "rtl/string.hxx" +#include "rtl/ustring.hxx" +#include "sal/main.h" + +SAL_IMPLEMENT_MAIN() { + if (rtl_getAppCommandArgCount() != 1) { + std::cerr << "Usage: cppunittester <shared-library-path>" << std::endl; + return EXIT_FAILURE; + } + rtl::OUString path; + rtl_getAppCommandArg(0, &path.pData); + CppUnit::PlugInManager manager; + manager.load( + rtl::OUStringToOString(path, osl_getThreadTextEncoding()).getStr()); + CppUnit::TestRunner runner; + runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); + CppUnit::TestResult result; + CppUnit::TestResultCollector collector; + result.addListener(&collector); + runner.run(result); + CppUnit::CompilerOutputter(&collector, CppUnit::stdCErr()).write(); + return collector.wasSuccessful() ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/stoc/test/registry_tdprovider/testregistrytdprovider.gcc3.map b/sal/cppunittester/makefile.mk index 609b64e1e0ca..938b63d90ae9 100644 --- a/stoc/test/registry_tdprovider/testregistrytdprovider.gcc3.map +++ b/sal/cppunittester/makefile.mk @@ -23,16 +23,23 @@ # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. # -#************************************************************************* +#***********************************************************************/ + +PRJ = .. +PRJNAME = sal +TARGET = cppunittester + +ENABLE_EXCEPTIONS = TRUE + +.INCLUDE: settings.mk + +CFLAGSCXX += $(CPPUNIT_CFLAGS) -UDK_3_0_0 { - global: - component_getFactory; - component_getImplementationEnvironment; - component_writeInfo; +OBJFILES = $(APP1OBJS) - _ZN4_STL7num_put*; # STLport +APP1OBJS = $(OBJ)/cppunittester.obj +APP1RPATH = NONE +APP1STDLIBS = $(CPPUNITLIB) $(SALLIB) +APP1TARGET = cppunittester - local: - *; -}; +.INCLUDE: target.mk diff --git a/sal/inc/osl/semaphor.h b/sal/inc/osl/semaphor.h index 2986ae4bec6c..c0c74515404a 100644 --- a/sal/inc/osl/semaphor.h +++ b/sal/inc/osl/semaphor.h @@ -37,6 +37,10 @@ extern "C" { typedef void* oslSemaphore; /** Creates a semaphore.<BR> + + @deprecated + Must not be used, as unnamed semaphores are not supported on Mac OS X. + @param InitialCount denotes the starting value the semaphore. If you set it to zero, the first acquire() blocks. Otherwise InitialCount acquire()s are immedeatly successfull. @@ -45,12 +49,20 @@ typedef void* oslSemaphore; oslSemaphore SAL_CALL osl_createSemaphore(sal_uInt32 initialCount); /** Release the OS-structures and free semaphore data-structure + + @deprecated + Must not be used, as unnamed semaphores are not supported on Mac OS X. + @return fbbb */ void SAL_CALL osl_destroySemaphore(oslSemaphore Semaphore); /** acquire() decreases the count. It will block if it tries to decrease below zero. + + @deprecated + Must not be used, as unnamed semaphores are not supported on Mac OS X. + @return False if the system-call failed. */ sal_Bool SAL_CALL osl_acquireSemaphore(oslSemaphore Semaphore); @@ -59,10 +71,17 @@ sal_Bool SAL_CALL osl_acquireSemaphore(oslSemaphore Semaphore); return with False if it would decrease the count below zero. (When acquire() would block.) If it could successfully decrease the count, it will return True. + + @deprecated + Must not be used, as unnamed semaphores are not supported on Mac OS X. */ sal_Bool SAL_CALL osl_tryToAcquireSemaphore(oslSemaphore Semaphore); /** release() increases the count. + + @deprecated + Must not be used, as unnamed semaphores are not supported on Mac OS X. + @return False if the system-call failed. */ sal_Bool SAL_CALL osl_releaseSemaphore(oslSemaphore Semaphore); diff --git a/sal/inc/osl/semaphor.hxx b/sal/inc/osl/semaphor.hxx index 6209aa9970a8..a45737d27524 100644 --- a/sal/inc/osl/semaphor.hxx +++ b/sal/inc/osl/semaphor.hxx @@ -35,7 +35,11 @@ namespace osl { + /** C++ wrapper class around C semaphore functions. + @deprecated + Must not be used, as unnamed semaphores are not supported on Mac OS X. + */ class Semaphore { public: diff --git a/sal/osl/os2/process_impl.cxx b/sal/osl/os2/process_impl.cxx index d27bd72190e5..27b12bbe0f6a 100644 --- a/sal/osl/os2/process_impl.cxx +++ b/sal/osl/os2/process_impl.cxx @@ -141,6 +141,7 @@ oslProcessError SAL_CALL osl_getExecutableFile (rtl_uString ** ppustrFile) oslProcessError result = osl_Process_E_NotFound; osl_acquireMutex(g_command_args.m_mutex); + OSL_ASSERT(g_command_args.m_nCount > 0); if (g_command_args.m_nCount > 0) { /* CommandArgs set. Obtain argv[0]. */ @@ -160,6 +161,7 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount (void) sal_uInt32 result = 0; osl_acquireMutex(g_command_args.m_mutex); + OSL_ASSERT(g_command_args.m_nCount > 0); if (g_command_args.m_nCount > 0) result = g_command_args.m_nCount - 1; osl_releaseMutex(g_command_args.m_mutex); @@ -175,6 +177,7 @@ oslProcessError SAL_CALL osl_getCommandArg (sal_uInt32 nArg, rtl_uString ** strC oslProcessError result = osl_Process_E_NotFound; osl_acquireMutex(g_command_args.m_mutex); + OSL_ASSERT(g_command_args.m_nCount > 0); if (g_command_args.m_nCount > (nArg + 1)) { rtl_uString_assign (strCommandArg, g_command_args.m_ppArgs[nArg + 1]); @@ -190,7 +193,7 @@ oslProcessError SAL_CALL osl_getCommandArg (sal_uInt32 nArg, rtl_uString ** strC **************************************/ void SAL_CALL osl_setCommandArgs (int argc, char ** argv) { - + OSL_ASSERT(argc > 0); osl_acquireMutex(g_command_args.m_mutex); OSL_ENSURE (g_command_args.m_nCount == 0, "osl_setCommandArgs(): CommandArgs already set."); if (g_command_args.m_nCount == 0) diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c index 5262fef5cd38..300a1446e81a 100644 --- a/sal/osl/unx/process.c +++ b/sal/osl/unx/process.c @@ -489,7 +489,16 @@ static void ChildStatusProc(void *pData) { int i; for (i = 0; data.m_pszEnv[i] != NULL; i++) - putenv(data.m_pszEnv[i]); + { + if (strchr(data.m_pszEnv[i], '=') == NULL) + { + unsetenv(data.m_pszEnv[i]); /*TODO: check error return*/ + } + else + { + putenv(data.m_pszEnv[i]); /*TODO: check error return*/ + } + } OSL_TRACE("ChildStatusProc : starting '%s'",data.m_pszArgs[0]); diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index adfc59e9c8af..e712b6748e7f 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -184,6 +184,7 @@ oslProcessError SAL_CALL osl_getExecutableFile (rtl_uString ** ppustrFile) oslProcessError result = osl_Process_E_NotFound; pthread_mutex_lock (&(g_command_args.m_mutex)); + OSL_ASSERT(g_command_args.m_nCount > 0); if (g_command_args.m_nCount > 0) { /* CommandArgs set. Obtain argv[0]. */ @@ -203,6 +204,7 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount (void) sal_uInt32 result = 0; pthread_mutex_lock (&(g_command_args.m_mutex)); + OSL_ASSERT(g_command_args.m_nCount > 0); if (g_command_args.m_nCount > 0) result = g_command_args.m_nCount - 1; pthread_mutex_unlock (&(g_command_args.m_mutex)); @@ -218,6 +220,7 @@ oslProcessError SAL_CALL osl_getCommandArg (sal_uInt32 nArg, rtl_uString ** strC oslProcessError result = osl_Process_E_NotFound; pthread_mutex_lock (&(g_command_args.m_mutex)); + OSL_ASSERT(g_command_args.m_nCount > 0); if (g_command_args.m_nCount > (nArg + 1)) { rtl_uString_assign (strCommandArg, g_command_args.m_ppArgs[nArg + 1]); @@ -233,6 +236,7 @@ oslProcessError SAL_CALL osl_getCommandArg (sal_uInt32 nArg, rtl_uString ** strC **************************************/ void SAL_CALL osl_setCommandArgs (int argc, char ** argv) { + OSL_ASSERT(argc > 0); pthread_mutex_lock (&(g_command_args.m_mutex)); OSL_ENSURE (g_command_args.m_nCount == 0, "osl_setCommandArgs(): CommandArgs already set."); if (g_command_args.m_nCount == 0) diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c index c5141fa02260..5563375d9567 100644 --- a/sal/osl/unx/signal.c +++ b/sal/osl/unx/signal.c @@ -74,10 +74,14 @@ #include "file_path_helper.h" #define ACT_IGNORE 1 -#define ACT_ABORT 2 -#define ACT_EXIT 3 -#define ACT_SYSTEM 4 -#define ACT_HIDE 5 +#define ACT_EXIT 2 +#define ACT_SYSTEM 3 +#define ACT_HIDE 4 +#ifdef SAL_ENABLE_CRASH_REPORT +# define ACT_ABORT 5 +#else +# define ACT_ABORT ACT_SYSTEM +#endif #define MAX_PATH_LEN 2048 @@ -556,7 +560,7 @@ static int ReportCrash( int Signal ) if (Signals[i].Signal == Signal && Signals[i].Action == ACT_ABORT ) { int ret; - char szShellCmd[512]; + char szShellCmd[512] = { '\0' }; char *pXMLTempName = NULL; char *pStackTempName = NULL; char *pChecksumTempName = NULL; @@ -728,68 +732,57 @@ static int ReportCrash( int Signal ) if ( checksumout ) fclose( checksumout ); -#if defined( LINUX ) - if ( pXMLTempName && pChecksumTempName && pStackTempName ) - snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), - "crash_report -p %d -s %d -xml %s -chksum %s -stack %s%s", - getpid(), - Signal, - pXMLTempName, - pChecksumTempName, - pStackTempName, - bAutoCrashReport ? " -noui -send" : " -noui" ); -#elif defined( MACOSX ) if ( pXMLTempName && pChecksumTempName && pStackTempName ) +#endif /* INCLUDE_BACKTRACE */ { - rtl_uString *crashrep_url = NULL; - rtl_uString *crashrep_path = NULL; - rtl_String *crashrep_path_system = NULL; - - rtl_string2UString( &crashrep_url, RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program/crash_report.bin"), OSTRING_TO_OUSTRING_CVTFLAGS ); - rtl_bootstrap_expandMacros( &crashrep_url ); - osl_getSystemPathFromFileURL( crashrep_url, &crashrep_path ); + rtl_uString * crashrep_url = NULL; + rtl_uString * crashrep_path = NULL; + rtl_String * crashrep_path_system = NULL; + rtl_string2UString( + &crashrep_url, + RTL_CONSTASCII_USTRINGPARAM( + "$BRAND_BASE_DIR/program/crashrep"), + OSTRING_TO_OUSTRING_CVTFLAGS); + rtl_bootstrap_expandMacros(&crashrep_url); + osl_getSystemPathFromFileURL(crashrep_url, &crashrep_path); rtl_uString2String( &crashrep_path_system, - rtl_uString_getStr( crashrep_path ), - rtl_uString_getLength( crashrep_path ), + rtl_uString_getStr(crashrep_path), + rtl_uString_getLength(crashrep_path), osl_getThreadTextEncoding(), - RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR ); - - rtl_uString_release( crashrep_url ); - rtl_uString_release( crashrep_path ); - + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR + | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)); + rtl_uString_release(crashrep_url); + rtl_uString_release(crashrep_path); +#if defined INCLUDE_BACKTRACE && (defined LINUX || defined MACOSX) snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), - "%s -p %d -s %d -xml %s -chksum %s -stack %s%s", - rtl_string_getStr( crashrep_path_system ), + "%s -p %d -s %d -xml %s -chksum %s -stack %s -noui%s", + rtl_string_getStr(crashrep_path_system), getpid(), Signal, pXMLTempName, pChecksumTempName, pStackTempName, - bAutoCrashReport ? " -noui -send" : " -noui" ); - - rtl_string_release( crashrep_path_system ); - - printf( "%s\n", szShellCmd ); - } -#elif defined ( SOLARIS ) - if ( pXMLTempName && pChecksumTempName ) + bAutoCrashReport ? " -send" : "" ); +#elif defined INCLUDE_BACKTRACE && defined SOLARIS snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), - "crash_report -p %d -s %d -xml %s -chksum %s%s", + "%s -p %d -s %d -xml %s -chksum %s -noui%s", + rtl_string_getStr(crashrep_path_system), getpid(), Signal, pXMLTempName, pChecksumTempName, - bAutoCrashReport ? " -noui -send" : " -noui" ); + bAutoCrashReport ? " -send" : "" ); +#else + snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), + "%s -p %d -s %d -noui%s", + rtl_string_getStr(crashrep_path_system), + getpid(), Signal, bAutoCrashReport ? " -send" : "" ); #endif + rtl_string_release(crashrep_path_system); + } -#else /* defined INCLUDE BACKTRACE */ - snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), - "crash_report -p %d -s %d%s", getpid(), Signal, bAutoCrashReport ? " -noui -send" : " -noui" ); -#endif /* defined INCLUDE BACKTRACE */ - - - ret = system( szShellCmd ); + ret = szShellCmd[0] == '\0' ? -1 : system( szShellCmd ); if ( pXMLTempName ) unlink( pXMLTempName ); diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index 734824d63e57..09bdec7988c3 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -529,7 +529,7 @@ static oslFileError osl_openLocalRoot( rtl_uString* pBackSlash = 0; rtl_uString_assign( &pCurDir, pDirImpl->m_pDirectoryPath ); - rtl_uString_newFromStr( &pBackSlash, L"\\" ); + rtl_uString_newFromAscii( &pBackSlash, "\\" ); rtl_uString_newConcat( &pDirImpl->m_pDirectoryPath, pCurDir, pBackSlash ); rtl_uString_release( pBackSlash ); rtl_uString_release( pCurDir ); @@ -594,7 +594,7 @@ static oslFileError SAL_CALL osl_openFileDirectory( rtl_uString* pBackSlash = 0; rtl_uString_assign( &pCurDir, pDirImpl->m_pDirectoryPath ); - rtl_uString_newFromStr( &pBackSlash, L"\\" ); + rtl_uString_newFromAscii( &pBackSlash, "\\" ); rtl_uString_newConcat( &pDirImpl->m_pDirectoryPath, pCurDir, pBackSlash ); rtl_uString_release( pBackSlash ); rtl_uString_release( pCurDir ); @@ -964,7 +964,7 @@ static oslFileError SAL_CALL osl_getNextFileItem( pItemImpl->nRefCount = 1; rtl_uString* pTmpFileName = 0; - rtl_uString_newFromStr( &pTmpFileName, pItemImpl->FindData.cFileName ); + rtl_uString_newFromStr( &pTmpFileName, reinterpret_cast<const sal_Unicode *>(pItemImpl->FindData.cFileName) ); rtl_uString_newConcat( &pItemImpl->m_pFullPath, pDirImpl->m_pDirectoryPath, pTmpFileName ); rtl_uString_release( pTmpFileName ); @@ -1754,7 +1754,7 @@ oslFileError SAL_CALL osl_getFileStatus( sal_uInt32 nLen = rtl_uString_getLength( pItemImpl->m_pFullPath ); ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH ); sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>( rtl_uString_getStr( pItemImpl->m_pFullPath ) ), - aBuffer, + ::osl::mingw_reinterpret_cast<LPTSTR>( aBuffer ), aBuffer.getBufSizeInSymbols(), sal_True ); diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx index 8e11be1d6a5c..90140cda97c6 100644 --- a/sal/osl/w32/file_url.cxx +++ b/sal/osl/w32/file_url.cxx @@ -252,13 +252,13 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u DWORD dwCandidatPathType = PATHTYPE_ERROR; - if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, WSTR_LONG_PATH_PREFIX_UNC, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1 ) ) + if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, reinterpret_cast<const sal_Unicode *>(WSTR_LONG_PATH_PREFIX_UNC), ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1 ) ) { /* This is long path in UNC notation */ lpComponent = lpszPath + ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1; dwCandidatPathType = PATHTYPE_ABSOLUTE_UNC | PATHTYPE_IS_LONGPATH; } - else if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) ) + else if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, reinterpret_cast<const sal_Unicode *>(WSTR_LONG_PATH_PREFIX), ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) ) { /* This is long path */ lpComponent = lpszPath + ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1; @@ -465,7 +465,7 @@ static DWORD GetCaseCorrectPathNameEx( DWORD nSkipLevels, BOOL bCheckExistence ) { - ::osl::LongPathBuffer< sal_Unicode > szFile( MAX_PATH + 1 ); + ::osl::LongPathBuffer< WCHAR > szFile( MAX_PATH + 1 ); sal_Int32 nRemoved = PathRemoveFileSpec( lpszPath, szFile, MAX_PATH + 1 ); sal_Int32 nLastStepRemoved = nRemoved; while ( nLastStepRemoved && szFile[0] == 0 ) @@ -505,7 +505,7 @@ static DWORD GetCaseCorrectPathNameEx( { if ( bCheckExistence ) { - ::osl::LongPathBuffer< sal_Unicode > aShortPath( MAX_LONG_PATH ); + ::osl::LongPathBuffer< WCHAR > aShortPath( MAX_LONG_PATH ); _tcscpy( aShortPath, lpszPath ); _tcscat( aShortPath, szFile ); @@ -777,14 +777,14 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p else { ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH ); - sal_uInt32 nNewLen = GetCaseCorrectPathName( pDecodedURL + nSkip, - aBuf, + sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>(pDecodedURL + nSkip), + ::osl::mingw_reinterpret_cast<LPTSTR>(aBuf), aBuf.getBufSizeInSymbols(), sal_False ); if ( nNewLen <= MAX_PATH - 12 - || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_SYSTEM_ROOT_PATH, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 ) - || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) ) + || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, reinterpret_cast<const sal_Unicode*>(WSTR_SYSTEM_ROOT_PATH), ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 ) + || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, reinterpret_cast<const sal_Unicode*>(WSTR_LONG_PATH_PREFIX), ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) ) { rtl_uString_newFromStr_WithLength( &strTempPath, aBuf, nNewLen ); } @@ -793,7 +793,7 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p /* it should be an UNC path, use the according prefix */ rtl_uString *strSuffix = NULL; rtl_uString *strPrefix = NULL; - rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX_UNC, ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX_UNC ) - 1 ); + rtl_uString_newFromStr_WithLength( &strPrefix, reinterpret_cast<const sal_Unicode*>(WSTR_LONG_PATH_PREFIX_UNC), ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX_UNC ) - 1 ); rtl_uString_newFromStr_WithLength( &strSuffix, aBuf + 2, nNewLen - 2 ); rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix ); @@ -805,7 +805,7 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p { rtl_uString *strSuffix = NULL; rtl_uString *strPrefix = NULL; - rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX ) - 1 ); + rtl_uString_newFromStr_WithLength( &strPrefix, reinterpret_cast<const sal_Unicode*>(WSTR_LONG_PATH_PREFIX), ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX ) - 1 ); rtl_uString_newFromStr_WithLength( &strSuffix, aBuf, nNewLen ); rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix ); @@ -1093,15 +1093,15 @@ oslFileError SAL_CALL osl_getAbsoluteFileURL( rtl_uString* ustrBaseURL, rtl_uStr { osl_acquireMutex( g_CurrentDirectoryMutex ); - GetCurrentDirectoryW( aCurrentDir.getBufSizeInSymbols(), aCurrentDir ); - SetCurrentDirectoryW( reinterpret_cast<LPCTSTR>(ustrBaseSysPath->buffer) ); + GetCurrentDirectoryW( aCurrentDir.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aCurrentDir) ); + SetCurrentDirectoryW( reinterpret_cast<LPCWSTR>(ustrBaseSysPath->buffer) ); } - dwResult = GetFullPathNameW( reinterpret_cast<LPCTSTR>(ustrRelSysPath->buffer), aBuffer.getBufSizeInSymbols(), aBuffer, &lpFilePart ); + dwResult = GetFullPathNameW( reinterpret_cast<LPCWSTR>(ustrRelSysPath->buffer), aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), &lpFilePart ); if ( ustrBaseSysPath ) { - SetCurrentDirectoryW( aCurrentDir ); + SetCurrentDirectoryW( ::osl::mingw_reinterpret_cast<LPCWSTR>(aCurrentDir) ); osl_releaseMutex( g_CurrentDirectoryMutex ); } diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx index 98ffd0bc09d4..b730bd3347df 100644 --- a/sal/osl/w32/module.cxx +++ b/sal/osl/w32/module.cxx @@ -64,9 +64,9 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod if ( osl_File_E_None != nError ) rtl_uString_assign(&Module, strModuleName); - hInstance = LoadLibraryW(Module->buffer); + hInstance = LoadLibraryW(reinterpret_cast<LPCWSTR>(Module->buffer)); if (hInstance == NULL) - hInstance = LoadLibraryExW(Module->buffer, NULL, + hInstance = LoadLibraryExW(reinterpret_cast<LPCWSTR>(Module->buffer), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (hInstance <= (HINSTANCE)HINSTANCE_ERROR) @@ -88,7 +88,7 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod sal_Bool SAL_CALL osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult) { - HINSTANCE hInstance = GetModuleHandleW(pModuleName->buffer); + HINSTANCE hInstance = GetModuleHandleW(reinterpret_cast<LPCWSTR>(pModuleName->buffer)); if( hInstance ) { *pResult = (oslModule) hInstance; @@ -429,7 +429,7 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT( void *pv, rtl_uString **pu ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH ); rtl_uString *ustrSysPath = NULL; - GetModuleFileNameW( lpModules[iModule], aBuffer, aBuffer.getBufSizeInSymbols() ); + GetModuleFileNameW( lpModules[iModule], ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), aBuffer.getBufSizeInSymbols() ); rtl_uString_newFromStr( &ustrSysPath, aBuffer ); osl_getFileURLFromSystemPath( ustrSysPath, pustrURL ); diff --git a/sal/osl/w32/path_helper.hxx b/sal/osl/w32/path_helper.hxx index 64b0ac573da3..d157b42aa428 100644 --- a/sal/osl/w32/path_helper.hxx +++ b/sal/osl/w32/path_helper.hxx @@ -108,8 +108,11 @@ public: { return m_pBuffer; } + }; + template< class U, class T > U mingw_reinterpret_cast(LongPathBuffer<T>& a) { return reinterpret_cast<U>(static_cast<T*>(a)); } + } // end namespace osl #endif diff --git a/sal/osl/w32/pipe.c b/sal/osl/w32/pipe.c index 8f9da54dd52d..bd5185a2ba2b 100644 --- a/sal/osl/w32/pipe.c +++ b/sal/osl/w32/pipe.c @@ -629,7 +629,7 @@ oslPipeError SAL_CALL osl_getLastPipeError(oslPipe pPipe) pPipe->m_Error = osl_Pipe_E_None; } else - Error = osl_Pipe_E_None; + Error = osl_Pipe_E_NotFound; return (Error); } diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx index 12eda6658033..96187be7e203 100644 --- a/sal/osl/w32/process.cxx +++ b/sal/osl/w32/process.cxx @@ -227,7 +227,7 @@ extern "C" oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl ( ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH ); DWORD buflen = 0; - if ((buflen = GetModuleFileNameW (0, aBuffer, aBuffer.getBufSizeInSymbols())) > 0) + if ((buflen = GetModuleFileNameW (0, ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), aBuffer.getBufSizeInSymbols())) > 0) { rtl_uString * pAbsPath = 0; rtl_uString_newFromStr_WithLength (&(pAbsPath), aBuffer, buflen); @@ -279,7 +279,7 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char ** argv) for (i = 0; i < nArgs; i++) { /* Convert to unicode */ - rtl_uString_newFromStr( &(ppArgs[i]), wargv[i] ); + rtl_uString_newFromStr( &(ppArgs[i]), reinterpret_cast<const sal_Unicode*>(wargv[i]) ); } if (ppArgs[0] != 0) { @@ -288,7 +288,7 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char ** argv) DWORD dwResult = 0; dwResult = SearchPath ( - 0, ppArgs[0]->buffer, L".exe", aBuffer.getBufSizeInSymbols(), aBuffer, 0); + 0, reinterpret_cast<LPCWSTR>(ppArgs[0]->buffer), L".exe", aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), 0); if ((0 < dwResult) && (dwResult < aBuffer.getBufSizeInSymbols())) { /* Replace argv[0] with it's absolute path */ @@ -322,6 +322,7 @@ oslProcessError SAL_CALL osl_getExecutableFile( rtl_uString **ppustrFile ) oslProcessError result = osl_Process_E_NotFound; osl_acquireMutex (*osl_getGlobalMutex()); + OSL_ASSERT(g_command_args.m_nCount > 0); if (g_command_args.m_nCount > 0) { /* CommandArgs set. Obtain arv[0]. */ @@ -340,6 +341,7 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount(void) sal_uInt32 result = 0; osl_acquireMutex (*osl_getGlobalMutex()); + OSL_ASSERT(g_command_args.m_nCount > 0); if (g_command_args.m_nCount > 0) { /* We're not counting argv[0] here. */ @@ -357,6 +359,7 @@ oslProcessError SAL_CALL osl_getCommandArg( sal_uInt32 nArg, rtl_uString **strCo oslProcessError result = osl_Process_E_NotFound; osl_acquireMutex (*osl_getGlobalMutex()); + OSL_ASSERT(g_command_args.m_nCount > 0); if (g_command_args.m_nCount > (nArg + 1)) { /* We're not counting argv[0] here. */ @@ -372,6 +375,7 @@ oslProcessError SAL_CALL osl_getCommandArg( sal_uInt32 nArg, rtl_uString **strCo void SAL_CALL osl_setCommandArgs (int argc, char ** argv) { + OSL_ASSERT(argc > 0); osl_acquireMutex (*osl_getGlobalMutex()); if (g_command_args.m_nCount == 0) { @@ -401,9 +405,9 @@ oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *ustrVar, rtl_uString ** { WCHAR buff[ENV_BUFFER_SIZE]; - if (GetEnvironmentVariableW(ustrVar->buffer, buff, ENV_BUFFER_SIZE) > 0) + if (GetEnvironmentVariableW(reinterpret_cast<LPCWSTR>(ustrVar->buffer), buff, ENV_BUFFER_SIZE) > 0) { - rtl_uString_newFromStr(ustrValue, buff); + rtl_uString_newFromStr(ustrValue, reinterpret_cast<const sal_Unicode*>(buff)); return osl_Process_E_None; } return osl_Process_E_Unknown; @@ -422,7 +426,7 @@ oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir osl_acquireMutex( g_CurrentDirectoryMutex ); - dwLen = GetCurrentDirectory( aBuffer.getBufSizeInSymbols(), aBuffer ); + dwLen = GetCurrentDirectory( aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer) ); osl_releaseMutex( g_CurrentDirectoryMutex ); if ( dwLen && dwLen < aBuffer.getBufSizeInSymbols() ) diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx index f46c233ee932..fc04d5b84a8f 100644 --- a/sal/osl/w32/procimpl.cxx +++ b/sal/osl/w32/procimpl.cxx @@ -169,8 +169,7 @@ namespace /* private */ { rtl::OUString env_var = rtl::OUString(env_vars[i]); - if ((env_var.getLength() == 0) || - (env_var.indexOf(NAME_VALUE_SEPARATOR) == -1)) + if (env_var.getLength() == 0) return false; iterator_pair_t iter_pair = std::equal_range( @@ -179,10 +178,17 @@ namespace /* private */ env_var, less_environment_variable()); - if (iter_pair.first != iter_pair.second) // found - *iter_pair.first = env_var; - else // not found - merged_env->insert(iter_pair.first, env_var); + if (env_var.indexOf(NAME_VALUE_SEPARATOR) == -1) + { + merged_env->erase(iter_pair.first, iter_pair.second); + } + else + { + if (iter_pair.first != iter_pair.second) // found + *iter_pair.first = env_var; + else // not found + merged_env->insert(iter_pair.first, env_var); + } } return true; } @@ -198,9 +204,9 @@ namespace /* private */ if (!create_merged_environment(environment_vars, n_environment_vars, &merged_env)) return false; - // reserve enough space for the '\0'-separated environment strings and + // allocate enough space for the '\0'-separated environment strings and // a final '\0' - environment.reserve(calc_sum_of_string_lengths(merged_env) + 1); + environment.resize(calc_sum_of_string_lengths(merged_env) + 1); string_container_const_iterator_t iter = merged_env.begin(); string_container_const_iterator_t iter_end = merged_env.end(); diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx index f30ac7ce3348..9f4ea5630e1f 100644 --- a/sal/osl/w32/profile.cxx +++ b/sal/osl/w32/profile.cxx @@ -36,6 +36,9 @@ #include <osl/file.h> #include <osl/util.h> #include <rtl/alloc.h> +#include <algorithm> +using std::min; +static inline void copy_ustr_n( void *dest, const void *source, size_t length ) { rtl_copyMemory(dest, source, length*sizeof(sal_Unicode)); } #define LINES_INI 32 #define LINES_ADD 10 @@ -503,7 +506,7 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); GetPrivateProfileString(pszSection, pszEntry, pszDefault, pszString, MaxLen, aFileName); } @@ -684,7 +687,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile, { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); WritePrivateProfileString(pszSection, pszEntry, pszString, aFileName); } @@ -795,7 +798,7 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile, { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); WritePrivateProfileString(pszSection, pszEntry, NULL, aFileName); } @@ -869,7 +872,7 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); n = GetPrivateProfileString(pszSection, NULL, NULL, pszBuffer, MaxLen, aFileName); } @@ -900,7 +903,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if( ::sal::static_int_cast< sal_uInt32 >( strName->length ) >= aFile.getBufSizeInSymbols() ) return sal_False; - wcscpy( aFile, strName->buffer); + copy_ustr_n( aFile, strName->buffer, strName->length+1); nFileLen = strName->length; if (rtl_ustr_indexOfChar( aFile, L'.' ) == -1) @@ -909,7 +912,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, return sal_False; /* add default extension */ - wcscpy( aFile + nFileLen, STR_INI_EXTENSION); + copy_ustr_n( aFile + nFileLen, STR_INI_EXTENSION, wcslen(STR_INI_EXTENSION)+1 ); nFileLen += wcslen(STR_INI_EXTENSION); } } @@ -939,13 +942,13 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if ((nFileLen = nLen - nOffset) >= aFile.getBufSizeInSymbols()) return sal_False; - wcsncpy(aFile, pProgName + nOffset, nFileLen); + copy_ustr_n(aFile, pProgName + nOffset, nFileLen); if (nFileLen + wcslen(STR_INI_EXTENSION) >= aFile.getBufSizeInSymbols()) return sal_False; /* add default extension */ - wcscpy(aFile + nFileLen, STR_INI_EXTENSION); + copy_ustr_n(aFile + nFileLen, STR_INI_EXTENSION, wcslen(STR_INI_EXTENSION)+1); nFileLen += wcslen(STR_INI_EXTENSION); rtl_uString_release( strProgName ); @@ -974,7 +977,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if ( ::sal::static_int_cast< sal_uInt32 >( strHome->length ) >= aPath.getBufSizeInSymbols()) return sal_False; - wcscpy( aPath, strHome->buffer); + copy_ustr_n( aPath, strHome->buffer, strHome->length+1); nPathLen = strHome->length; if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METAHOME)) @@ -985,7 +988,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if (nLen + nPathLen >= aPath.getBufSizeInSymbols()) return sal_False; - wcscpy(aPath + nPathLen, pPath); + copy_ustr_n(aPath + nPathLen, pPath, nLen+1); nPathLen += nLen; } @@ -1006,7 +1009,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if ( ::sal::static_int_cast< sal_uInt32 >( strConfig->length ) >= aPath.getBufSizeInSymbols()) return sal_False; - wcscpy( aPath, strConfig->buffer); + copy_ustr_n( aPath, strConfig->buffer, strConfig->length+1 ); nPathLen = strConfig->length; if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METACFG)) @@ -1017,7 +1020,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if (nLen + nPathLen >= aPath.getBufSizeInSymbols()) return sal_False; - wcscpy(aPath + nPathLen, pPath); + copy_ustr_n(aPath + nPathLen, pPath, nLen+1); nPathLen += nLen; } @@ -1027,7 +1030,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, else if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METASYS), STR_INI_METASYS) == 0) && ((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METASYS)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METASYS)] == '/'))) { - if (((nPathLen = GetWindowsDirectoryW(aPath, aPath.getBufSizeInSymbols())) == 0) || (nPathLen >= aPath.getBufSizeInSymbols())) + if (((nPathLen = GetWindowsDirectoryW(::osl::mingw_reinterpret_cast<LPWSTR>(aPath), aPath.getBufSizeInSymbols())) == 0) || (nPathLen >= aPath.getBufSizeInSymbols())) return (sal_False); if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METASYS)) @@ -1038,7 +1041,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if (nLen + nPathLen >= aPath.getBufSizeInSymbols()) return sal_False; - wcscpy(aPath + nPathLen, pPath); + copy_ustr_n(aPath + nPathLen, pPath, nLen+1); nPathLen += nLen; } } @@ -1050,13 +1053,13 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if (! lookupProfile(pPath + RTL_CONSTASCII_LENGTH(STR_INI_METAINS), aFile, aPath)) return (sal_False); - nPathLen = wcslen(aPath); + nPathLen = rtl_ustr_getLength(aPath); } else if( ::sal::static_int_cast< sal_uInt32 >( nLen ) < aPath.getBufSizeInSymbols()) { - wcscpy(aPath, pPath); - nPathLen = wcslen(aPath); + copy_ustr_n(aPath, pPath, nLen+1); + nPathLen = rtl_ustr_getLength(aPath); } else return sal_False; @@ -1073,7 +1076,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, if ( ::sal::static_int_cast< sal_uInt32 >( strConfigDir->length ) >= aPath.getBufSizeInSymbols() ) return sal_False; - wcscpy(aPath, strConfigDir->buffer); + copy_ustr_n(aPath, strConfigDir->buffer, strConfigDir->length+1); nPathLen = strConfigDir->length; } @@ -1087,7 +1090,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, return sal_False; /* append file name */ - wcscpy(aPath + nPathLen, aFile); + copy_ustr_n(aPath + nPathLen, aFile, nFileLen+1); nPathLen += nFileLen; /* copy filename */ @@ -1141,7 +1144,7 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff { ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL); n = GetPrivateProfileSectionNames(pszBuffer, MaxLen, aFileName); } @@ -1276,7 +1279,7 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi OSL_TRACE("opening '%s' read only\n",pszFilename); #endif - pFile->m_Handle = CreateFileW( rtl_uString_getStr( strFileName ), GENERIC_READ, + pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); @@ -1289,7 +1292,7 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi OSL_TRACE("opening '%s' read/write\n",pszFilename); #endif - if ((pFile->m_Handle = CreateFileW( rtl_uString_getStr( strFileName ), GENERIC_READ | GENERIC_WRITE, + if ((pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) @@ -2133,13 +2136,13 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) /* unlink bak */ - DeleteFileW( rtl_uString_getStr( ustrBakFile ) ); + DeleteFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrBakFile )) ); /* rename ini bak */ - MoveFileExW( rtl_uString_getStr( ustrIniFile ), rtl_uString_getStr( ustrBakFile ), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH ); + MoveFileExW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrIniFile )), reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrBakFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH ); /* rename tmp ini */ - MoveFileExW( rtl_uString_getStr( ustrTmpFile ), rtl_uString_getStr( ustrIniFile ), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH ); + MoveFileExW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrTmpFile )), reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrIniFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH ); return bRet; } @@ -2316,7 +2319,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str while ((strPath[i] != L'"') && (strPath[i] != L'\0')) i++; - WideCharToMultiByte(CP_ACP,0, strPath, i, Product, sizeof(Product), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strPath), i, Product, sizeof(Product), NULL, NULL); Product[i] = '\0'; strPath += i; @@ -2443,31 +2446,31 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str ((nEnd = rtl_ustr_indexOfChar(pCommandArg + nStart + 1, L']')) != -1)) { dwPathLen = nEnd; - wcsncpy(aPath, pCommandArg + nStart + 1, dwPathLen ); + copy_ustr_n(aPath, pCommandArg + nStart + 1, dwPathLen); aPath[dwPathLen] = 0; /* build full path */ if ((aPath[dwPathLen - 1] != L'/') && (aPath[dwPathLen - 1] != L'\\')) { - wcscpy(aPath + dwPathLen++, L"/"); + copy_ustr_n(aPath + dwPathLen++, L"/", 2); } if (*strPath) { - wcscpy(aPath + dwPathLen, strPath); - dwPathLen += wcslen(strPath); + copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1); + dwPathLen += rtl_ustr_getLength(strPath); } else { ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH ); int n; - if ((n = WideCharToMultiByte(CP_ACP,0, aPath, -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL)) > 0) + if ((n = WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL)) > 0) { strcpy(aTmpPath + n, SVERSION_USER); if (access(aTmpPath, 0) >= 0) { - dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, aPath + dwPathLen, aPath.getBufSizeInSymbols() - dwPathLen ); + dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + dwPathLen), aPath.getBufSizeInSymbols() - dwPathLen ); } } } @@ -2507,14 +2510,14 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str } else { - wcsncpy(aPath, strExecutable->buffer, nPos ); + copy_ustr_n(aPath, strExecutable->buffer, nPos); aPath[nPos] = 0; dwPathLen = nPos; } } else { - wcsncpy(aPath, strExecutable->buffer, nPos ); + copy_ustr_n(aPath, strExecutable->buffer, nPos); dwPathLen = nPos; aPath[dwPathLen] = 0; } @@ -2522,7 +2525,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str /* if we have no product identification use the executable file name */ if (*Product == 0) { - WideCharToMultiByte(CP_ACP,0, strExecutable->buffer + nPos + 1, -1, Product, sizeof(Product), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strExecutable->buffer + nPos + 1), -1, Product, sizeof(Product), NULL, NULL); /* remove extension */ if ((pChr = strrchr(Product, '.')) != NULL) @@ -2534,18 +2537,18 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str /* remember last subdir */ nPos = rtl_ustr_lastIndexOfChar(aPath, L'\\'); - wcscpy(aPath + dwPathLen++, L"\\"); + copy_ustr_n(aPath + dwPathLen++, L"\\", 2); if (*strPath) { - wcscpy(aPath + dwPathLen, strPath); - dwPathLen += wcslen(strPath); + copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1); + dwPathLen += rtl_ustr_getLength(strPath); } { ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, aPath, -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL); /* if file not exists, remove any specified subdirectories like "bin" or "program" */ @@ -2569,13 +2572,13 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str } else { - dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, aPath + nPos + 1, aPath.getBufSizeInSymbols() - (nPos + 1) ); + dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + nPos + 1), aPath.getBufSizeInSymbols() - (nPos + 1) ); } } else { - wcscpy(aPath + nPos + 1, strPath); - dwPathLen = nPos + 1 + wcslen(strPath); + copy_ustr_n(aPath + nPos + 1, strPath, rtl_ustr_getLength(strPath)+1); + dwPathLen = nPos + 1 + rtl_ustr_getLength(strPath); } break; @@ -2589,12 +2592,12 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str aPath[dwPathLen] = 0; } - wcscpy(aPath + dwPathLen, strFile); + copy_ustr_n(aPath + dwPathLen, strFile, rtl_ustr_getLength(strFile)+1); { ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH ); - WideCharToMultiByte(CP_ACP,0, aPath, -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL); + WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL); if ((access(aTmpPath, 0) < 0) && (strlen(Product) > 0)) { @@ -2645,20 +2648,20 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str if (strlen(Buffer) > 0) { dwPathLen = MultiByteToWideChar( - CP_ACP, 0, Buffer, -1, aPath, aPath.getBufSizeInSymbols() ); + CP_ACP, 0, Buffer, -1, ::osl::mingw_reinterpret_cast<LPWSTR>(aPath), aPath.getBufSizeInSymbols() ); dwPathLen -=1; /* build full path */ if ((aPath[dwPathLen - 1] != L'/') && (aPath[dwPathLen - 1] != L'\\')) { - wcscpy(aPath + dwPathLen++, L"\\"); + copy_ustr_n(aPath + dwPathLen++, L"\\", 2); } if (*strPath) { - wcscpy(aPath + dwPathLen, strPath); - dwPathLen += wcslen(strPath); + copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1); + dwPathLen += rtl_ustr_getLength(strPath); } else { @@ -2666,7 +2669,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str int n; if ((n = WideCharToMultiByte( - CP_ACP,0, aPath, -1, aTmpPath, + CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL)) > 0) { @@ -2675,7 +2678,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str { dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, - aPath + dwPathLen, + reinterpret_cast<LPWSTR>(aPath + dwPathLen), aPath.getBufSizeInSymbols() - dwPathLen ); } } @@ -2696,7 +2699,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str } /* copy filename */ - wcscpy(strProfile, aPath); + copy_ustr_n(strProfile, aPath, dwPathLen+1); return sal_True; } diff --git a/sal/osl/w32/tempfile.cxx b/sal/osl/w32/tempfile.cxx index 4bf136b6b0e0..6a3d2549004a 100644 --- a/sal/osl/w32/tempfile.cxx +++ b/sal/osl/w32/tempfile.cxx @@ -240,7 +240,7 @@ oslFileError SAL_CALL osl_createTempFile( oslFileError SAL_CALL osl_getTempDirURL(rtl_uString** pustrTempDir) { ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH ); - LPWSTR lpBuffer = aBuffer; + LPWSTR lpBuffer = ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer); DWORD nBufferLength = aBuffer.getBufSizeInSymbols() - 1; DWORD nLength; diff --git a/sal/prj/build.lst b/sal/prj/build.lst index 5622d80edeef..c96c3977f725 100644 --- a/sal/prj/build.lst +++ b/sal/prj/build.lst @@ -1,4 +1,4 @@ -sa sal : xml2cmp stlport external BOOST:boost NULL +sa sal : xml2cmp stlport external BOOST:boost CPPUNIT:cppunit NULL sa sal usr1 - all sa_mkout NULL sa sal\inc nmake - all sa_inc NULL sa sal\typesconfig nmake - u sa_tc sa_inc NULL @@ -14,3 +14,9 @@ sa sal\qa nmake - all sa_qa sa_util NULL sa sal\osl\unx nmake - u sa_oslu sa_tc.u sa_inc NULL sa sal\osl\all nmake - all sa_oslall sa_tc.u sa_inc NULL sa sal\util nmake - all sa_util sa_tc.u sa_oslall sa_uwinapi.n sa_kill.n sa_onlineupdate.n sa_osln.n sa_oslp.p sa_oslu.u sa_rtl sa_textenc NULL +sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL +sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL +sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL +sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL +sa sal\qa\osl\pipe nmake - all sa_qa_osl_pipe sa_cppunittester sa_util NULL +sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL diff --git a/sal/prj/d.lst b/sal/prj/d.lst index bcd9c0e2c95a..3ce270bbbfc4 100644 --- a/sal/prj/d.lst +++ b/sal/prj/d.lst @@ -34,3 +34,5 @@ symlink: %_DEST%\lib%_EXT%\libuno_sal.dylib.3 %_DEST%\lib%_EXT%\libuno_sal.dylib ..\%__SRC%\inc\udkversion.h %_DEST%\inc%_EXT%\sal\udkversion.h +..\%__SRC%\bin\cppunittester %_DEST%\bin%_EXT%\cppunittester +..\%__SRC%\bin\cppunittester.exe %_DEST%\bin%_EXT%\cppunittester.exe diff --git a/sal/qa/ByteSequence/ByteSequence.cxx b/sal/qa/ByteSequence/ByteSequence.cxx index 8c1bebf934c7..3a408edb3ef0 100644 --- a/sal/qa/ByteSequence/ByteSequence.cxx +++ b/sal/qa/ByteSequence/ByteSequence.cxx @@ -33,7 +33,10 @@ #include <rtl/byteseq.hxx> -#include <testshl/simpleheader.hxx> +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" using namespace rtl; @@ -590,18 +593,13 @@ public: }; // class getData // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ByteSequence::ctor, "rtl_ByteSequence"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ByteSequence::assign, "rtl_ByteSequence"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ByteSequence::equal, "rtl_ByteSequence"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ByteSequence::notequal, "rtl_ByteSequence"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ByteSequence::getArray, "rtl_ByteSequence"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ByteSequence::realloc, "rtl_ByteSequence"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ByteSequence::getData, "rtl_ByteSequence"); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::ctor); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::assign); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::equal); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::notequal); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::getArray); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::realloc); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_ByteSequence::getData); } // namespace ByteSequence - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sal/qa/ByteSequence/export.exp b/sal/qa/ByteSequence/export.exp deleted file mode 100644 index a13529da5876..000000000000 --- a/sal/qa/ByteSequence/export.exp +++ /dev/null @@ -1 +0,0 @@ -registerAllTestFunction diff --git a/sal/qa/ByteSequence/makefile.mk b/sal/qa/ByteSequence/makefile.mk index 4727a0cc51b1..972444ca8b57 100644 --- a/sal/qa/ByteSequence/makefile.mk +++ b/sal/qa/ByteSequence/makefile.mk @@ -24,6 +24,11 @@ # for a copy of the LGPLv3 License. # #************************************************************************* + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + PRJ=..$/.. PRJNAME=sal @@ -40,31 +45,34 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + #----------------------------------- OStringBuffer ----------------------------------- SHL1OBJS= \ $(SLO)$/ByteSequence.obj SHL1TARGET= rtl_ByteSequence -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) +SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) # SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME =$(SHL1TARGET) -# DEF1EXPORTFILE= export.exp SHL1VERSIONMAP = $(PRJ)$/qa$/export.map +SHL1RPATH = NONE # --- BEGIN -------------------------------------------------------- SHL2OBJS= \ $(SLO)$/rtl_old_testbyteseq.obj SHL2TARGET= rtl_old_testbyteseq -SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) +SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB) SHL2IMPLIB= i$(SHL2TARGET) DEF2NAME =$(SHL2TARGET) SHL2VERSIONMAP = $(PRJ)$/qa$/export.map +SHL2RPATH = NONE # END -------------------------------------------------------------- #------------------------------- All object files ------------------------------- @@ -76,3 +84,4 @@ SLOFILES=$(SHL1OBJS) .INCLUDE : target.mk .INCLUDE : _cppunit.mk +.END diff --git a/sal/qa/ByteSequence/rtl_old_testbyteseq.cxx b/sal/qa/ByteSequence/rtl_old_testbyteseq.cxx index 0c5e7126ce2e..61c312162c78 100644 --- a/sal/qa/ByteSequence/rtl_old_testbyteseq.cxx +++ b/sal/qa/ByteSequence/rtl_old_testbyteseq.cxx @@ -34,13 +34,15 @@ #include <stdio.h> -// #include <osl/diagnose.h> +#include <osl/diagnose.h> #include <rtl/byteseq.hxx> using namespace ::rtl; -#include <testshl/simpleheader.hxx> - +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" namespace rtl_testbyteseq { @@ -126,7 +128,7 @@ void oldbyteseq::test_bytesequence_001() } // namespace osl_test_file // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_testbyteseq::oldbyteseq, "rtl_ByteSequence" ); +CPPUNIT_TEST_SUITE_REGISTRATION( rtl_testbyteseq::oldbyteseq ); // ----------------------------------------------------------------------------- -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sal/qa/OStringBuffer/export.exp b/sal/qa/OStringBuffer/export.exp deleted file mode 100644 index a13529da5876..000000000000 --- a/sal/qa/OStringBuffer/export.exp +++ /dev/null @@ -1 +0,0 @@ -registerAllTestFunction diff --git a/sal/qa/OStringBuffer/makefile.mk b/sal/qa/OStringBuffer/makefile.mk index c7e3a2a37657..d46168dc4d0e 100644 --- a/sal/qa/OStringBuffer/makefile.mk +++ b/sal/qa/OStringBuffer/makefile.mk @@ -24,6 +24,11 @@ # for a copy of the LGPLv3 License. # #************************************************************************* + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + PRJ=..$/.. PRJNAME=sal @@ -40,6 +45,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + #------------------------------- All object files ------------------------------- # do this here, so we get right dependencies # SLOFILES= \ @@ -52,15 +59,14 @@ SHL1OBJS= \ $(SLO)$/rtl_String_Utils.obj SHL1TARGET= rtl_OStringBuffer -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) +SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) # SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME =$(SHL1TARGET) -# DEF1EXPORTFILE= export.exp SHL1VERSIONMAP = $(PRJ)$/qa$/export.map - +SHL1RPATH = NONE #------------------------------- All object files ------------------------------- # do this here, so we get right dependencies @@ -71,3 +77,4 @@ SLOFILES=$(SHL1OBJS) .INCLUDE : target.mk .INCLUDE : _cppunit.mk +.END diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx index c2221aa68682..01a620e8a238 100644 --- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx +++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx @@ -35,7 +35,12 @@ #include <rtl/strbuf.hxx> -#include <testshl/simpleheader.hxx> +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" + +#include <string.h> using namespace rtl; @@ -18404,67 +18409,34 @@ t_print("\n"); // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::ctors, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::makeStringAndClear, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::getLength, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::getCapacity, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::ensureCapacity, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::setLength, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::charAt, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::csuc, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::getStr, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::setCharAt, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_001, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_002, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_003, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_004, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_005, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_006_Int32, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_006_Int32_Bounderies, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_006_Int32_Negative, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_006_Int32_WrongRadix, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_006_Int32_defaultParam, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_007_Int64, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_007_Int64_Bounderies, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_007_Int64_Negative, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_007_Int64_WrongRadix, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_007_Int64_defaultParam, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_008_float, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_008_Float_Negative, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_009_double, - "rtl_OStringBuffer"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OStringBuffer::append_009_Double_Negative, - "rtl_OStringBuffer"); - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::ctors); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::makeStringAndClear); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::getLength); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::getCapacity); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::ensureCapacity); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::setLength); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::charAt); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::csuc); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::getStr); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::setCharAt); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_001); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_002); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_003); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_004); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_005); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_006_Int32); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_006_Int32_Bounderies); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_006_Int32_Negative); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_006_Int32_WrongRadix); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_006_Int32_defaultParam); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_007_Int64); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_007_Int64_Bounderies); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_007_Int64_Negative); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_007_Int64_WrongRadix); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_007_Int64_defaultParam); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_008_float); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_008_Float_Negative); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_009_double); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_009_Double_Negative); + +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sal/qa/OStringBuffer/rtl_String_Const.h b/sal/qa/OStringBuffer/rtl_String_Const.h index 8e5a2977b27a..fb0f9409dded 100644 --- a/sal/qa/OStringBuffer/rtl_String_Const.h +++ b/sal/qa/OStringBuffer/rtl_String_Const.h @@ -542,7 +542,6 @@ static const sal_Int32 expValStrLastNormal[nStrLastNormalCount] = 0,-1,0,4,-1,-1,-1,-1,-1,3,15,11 }; //------------------------------------------------------------------------ -static const sal_Int32 kNonSInt64Max = LONG_MIN; static const sal_Int32 kNonSInt32Max = INT_MIN; static const sal_Int32 kNonSInt16Max = SHRT_MIN; //------------------------------------------------------------------------ diff --git a/sal/qa/OStringBuffer/rtl_String_Utils.cxx b/sal/qa/OStringBuffer/rtl_String_Utils.cxx index 0dc2caaf83be..74b3e80e47c1 100644 --- a/sal/qa/OStringBuffer/rtl_String_Utils.cxx +++ b/sal/qa/OStringBuffer/rtl_String_Utils.cxx @@ -88,7 +88,7 @@ sal_Char* cpystr( sal_Char* dst, const sal_Char* src ) const sal_Char* psrc = src; sal_Char* pdst = dst; - while( *pdst++ = *psrc++ ); + while( (*pdst++ = *psrc++) ); return ( dst ); } diff --git a/sal/qa/export.map b/sal/qa/export.map index 0e4fe0c88ff2..3308588ef6f8 100755 --- a/sal/qa/export.map +++ b/sal/qa/export.map @@ -25,9 +25,9 @@ # #************************************************************************* -UDK_3.0 { +UDK_3_0_0 { global: - registerAllTestFunction; + cppunitTestPlugIn; local: *; diff --git a/sal/qa/osl/module/export_dll.map b/sal/qa/osl/module/export_dll.map index 9527d66debdc..87c701f21d91 100644 --- a/sal/qa/osl/module/export_dll.map +++ b/sal/qa/osl/module/export_dll.map @@ -25,7 +25,7 @@ # #************************************************************************* -UDK_3.0 { +UDK_3_0_0 { global: firstfunc; diff --git a/sal/qa/osl/mutex/makefile.mk b/sal/qa/osl/mutex/makefile.mk index 4ec1e56c8a17..de4121e3a0b9 100755 --- a/sal/qa/osl/mutex/makefile.mk +++ b/sal/qa/osl/mutex/makefile.mk @@ -25,6 +25,10 @@ # #************************************************************************* +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + PRJ=..$/..$/.. PRJNAME=sal @@ -39,25 +43,24 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:Socket by codegen.pl SHL1OBJS= \ $(SLO)$/osl_Mutex.obj SHL1TARGET= osl_Mutex -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) +SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) .IF "$(GUI)" == "WNT" SHL1STDLIBS += $(WS2_32LIB) .ENDIF -.IF "$(GUI)" == "UNX" -SHL1STDLIBS += -ldl -lnsl -.ENDIF - SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) SHL1VERSIONMAP = $(PRJ)$/qa$/export.map +SHL1RPATH = NONE # auto generated Target:Socket # END ------------------------------------------------------------------ @@ -66,3 +69,5 @@ SHL1VERSIONMAP = $(PRJ)$/qa$/export.map .INCLUDE : target.mk .INCLUDE : _cppunit.mk + +.END diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx index 45292da9718a..df0d2fe8ef6b 100755 --- a/sal/qa/osl/mutex/osl_Mutex.cxx +++ b/sal/qa/osl/mutex/osl_Mutex.cxx @@ -31,6 +31,10 @@ //------------------------------------------------------------------------ // include files //------------------------------------------------------------------------ +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" #include <osl_Mutex_Const.h> using namespace osl; @@ -46,17 +50,17 @@ inline void printUString( const ::rtl::OUString & str ) { rtl::OString aString; - t_print("#printUString_u# " ); + printf("#printUString_u# " ); aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ); - t_print("%s\n", aString.getStr( ) ); + printf("%s\n", aString.getStr( ) ); } /** print Boolean value. */ inline void printBool( sal_Bool bOk ) { - t_print("#printBool# " ); - ( sal_True == bOk ) ? t_print("YES!\n" ): t_print("NO!\n" ); + printf("#printBool# " ); + ( sal_True == bOk ) ? printf("YES!\n" ): printf("NO!\n" ); } /** pause nSec seconds helper function. @@ -75,7 +79,7 @@ namespace ThreadHelper #if ( defined UNX ) || ( defined OS2 ) //Unix sleep( _nSec ); #endif - // t_print("# done\n" ); + // printf("# done\n" ); } void thread_sleep_tenth_sec(sal_Int32 _nTenthSec) { @@ -227,7 +231,7 @@ protected: { // block here if the mutex has been acquired pMyMutex->acquire( ); - t_print("# Mutex acquired. \n" ); + printf("# Mutex acquired. \n" ); pMyMutex->release( ); } }; @@ -273,7 +277,7 @@ protected: Mutex* pGlobalMutex; pGlobalMutex = pGlobalMutex->getGlobalMutex( ); pGlobalMutex->acquire( ); - t_print("# Global Mutex acquired. \n" ); + printf("# Global Mutex acquired. \n" ); pGlobalMutex->release( ); } }; @@ -338,7 +342,7 @@ namespace osl_Mutex bRes = sal_True; /*for (sal_Int8 i=0; i<BUFFER_SIZE; i++) - t_print("#data in buffer is %d\n", m_Data.buffer[i]); + printf("#data in buffer is %d\n", m_Data.buffer[i]); */ CPPUNIT_ASSERT_MESSAGE("Mutex ctor", bRes == sal_True); @@ -692,7 +696,7 @@ protected: void SAL_CALL run( ) { // acquire the mutex - // t_print("# ClearGuardThread" ); + // printf("# ClearGuardThread" ); ClearableMutexGuard aGuard( pMyMutex ); ThreadHelper::thread_sleep( 5 ); @@ -768,7 +772,7 @@ namespace osl_ClearableGuard TimeValue aTimeVal_after; osl_getSystemTime( &aTimeVal_after ); sal_Int32 nSec = aTimeVal_after.Seconds - aTimeVal_befor.Seconds; - t_print("nSec is %d\n", nSec); + printf("nSec is %"SAL_PRIdINT32"\n", nSec); myThread.join(); @@ -834,7 +838,7 @@ protected: void SAL_CALL run( ) { // acquire the mutex - t_print("# ResettableGuard" ); + printf("# ResettableGuard" ); ResettableMutexGuard aGuard( pMyMutex ); // release the mutex aGuard.clear( ); @@ -933,13 +937,11 @@ namespace osl_ResettableGuard }; // class reset // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_ResettableGuard::ctor, "osl_ResettableGuard"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_ResettableGuard::reset, "osl_ResettableGuard"); +CPPUNIT_TEST_SUITE_REGISTRATION(osl_ResettableGuard::ctor); +CPPUNIT_TEST_SUITE_REGISTRATION(osl_ResettableGuard::reset); } // namespace osl_ResettableGuard -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); // The following sets variables for GNU EMACS // Local Variables: diff --git a/sal/qa/osl/mutex/osl_Mutex_Const.h b/sal/qa/osl/mutex/osl_Mutex_Const.h index 7ae2de6fba63..30d321775f01 100755 --- a/sal/qa/osl/mutex/osl_Mutex_Const.h +++ b/sal/qa/osl/mutex/osl_Mutex_Const.h @@ -1,5 +1,5 @@ /************************************************************************* -* + * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. @@ -46,8 +46,6 @@ #endif #include <osl/time.h> -#include <testshl/simpleheader.hxx> - #ifdef UNX #include <unistd.h> #endif diff --git a/sal/qa/osl/pipe/export.exp b/sal/qa/osl/pipe/export.exp deleted file mode 100644 index a13529da5876..000000000000 --- a/sal/qa/osl/pipe/export.exp +++ /dev/null @@ -1 +0,0 @@ -registerAllTestFunction diff --git a/sal/qa/osl/pipe/makefile.mk b/sal/qa/osl/pipe/makefile.mk index 23ae77d2bbcc..6350cdba0233 100644 --- a/sal/qa/osl/pipe/makefile.mk +++ b/sal/qa/osl/pipe/makefile.mk @@ -25,6 +25,10 @@ # #************************************************************************* +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + PRJ=..$/..$/.. PRJNAME=sal @@ -39,20 +43,22 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:Pipe by codegen.pl SHL1OBJS= \ $(SLO)$/osl_Pipe.obj SHL1TARGET= osl_Pipe -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) +SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) # SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME =$(SHL1TARGET) SHL1VERSIONMAP = $(PRJ)$/qa$/export.map -# DEF1EXPORTFILE= export.exp +SHL1RPATH = NONE # auto generated Target:Pipe # END ------------------------------------------------------------------ @@ -60,3 +66,5 @@ SHL1VERSIONMAP = $(PRJ)$/qa$/export.map .INCLUDE : target.mk .INCLUDE : _cppunit.mk + +.END diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx index 89c6ac4927f5..6371ad3b5250 100644 --- a/sal/qa/osl/pipe/osl_Pipe.cxx +++ b/sal/qa/osl/pipe/osl_Pipe.cxx @@ -32,7 +32,10 @@ // include files //------------------------------------------------------------------------ -#include <testshl/simpleheader.hxx> +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" #include <sal/types.h> #include <rtl/ustring.hxx> @@ -52,6 +55,7 @@ #ifdef UNX #include <unistd.h> #endif +#include <string.h> using namespace osl; using namespace rtl; @@ -64,8 +68,8 @@ using namespace rtl; */ inline void printBool( sal_Bool bOk ) { - t_print("#printBool# " ); - ( sal_True == bOk ) ? t_print("YES!\n" ): t_print("NO!\n" ); + printf("#printBool# " ); + ( sal_True == bOk ) ? printf("YES!\n" ): printf("NO!\n" ); } /** print a UNI_CODE String. @@ -74,9 +78,9 @@ inline void printUString( const ::rtl::OUString & str ) { rtl::OString aString; - t_print("#printUString_u# " ); + printf("#printUString_u# " ); aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ); - t_print("%s\n", aString.getStr( ) ); + printf("%s\n", aString.getStr( ) ); } /** print last error of pipe system. @@ -84,43 +88,43 @@ inline void printUString( const ::rtl::OUString & str ) inline void printPipeError( ::osl::Pipe aPipe ) { oslPipeError nError = aPipe.getError( ); - t_print("#printPipeError# " ); + printf("#printPipeError# " ); switch ( nError ) { case osl_Pipe_E_None: - t_print("Success!\n" ); + printf("Success!\n" ); break; case osl_Pipe_E_NotFound: - t_print("The returned error is: Not found!\n" ); + printf("The returned error is: Not found!\n" ); break; case osl_Pipe_E_AlreadyExists: - t_print("The returned error is: Already exist!\n" ); + printf("The returned error is: Already exist!\n" ); break; case osl_Pipe_E_NoProtocol: - t_print("The returned error is: No protocol!\n" ); + printf("The returned error is: No protocol!\n" ); break; case osl_Pipe_E_NetworkReset: - t_print("The returned error is: Network reset!\n" ); + printf("The returned error is: Network reset!\n" ); break; case osl_Pipe_E_ConnectionAbort: - t_print("The returned error is: Connection aborted!\n" ); + printf("The returned error is: Connection aborted!\n" ); break; case osl_Pipe_E_ConnectionReset: - t_print("The returned error is: Connection reset!\n" ); + printf("The returned error is: Connection reset!\n" ); break; case osl_Pipe_E_NoBufferSpace: - t_print("The returned error is: No buffer space!\n" ); + printf("The returned error is: No buffer space!\n" ); break; case osl_Pipe_E_TimedOut: - t_print("The returned error is: Timeout!\n" ); + printf("The returned error is: Timeout!\n" ); break; case osl_Pipe_E_ConnectionRefused: - t_print("The returned error is: Connection refused!\n" ); + printf("The returned error is: Connection refused!\n" ); break; case osl_Pipe_E_invalidError: - t_print("The returned error is: Invalid error!\n" ); + printf("The returned error is: Invalid error!\n" ); break; default: - t_print("The returned error is: Number %d, Unknown Error\n", nError ); + printf("The returned error is: Number %d, Unknown Error\n", nError ); break; } } @@ -625,8 +629,8 @@ namespace osl_Pipe printPipeError( aPipe ); aPipe.clear( ); - CPPUNIT_ASSERT_MESSAGE( "#test comment#: open a non-exist pipe. not passed in (W32)(LINUX)(UNX).", - osl_Pipe_E_invalidError == nError ); + CPPUNIT_ASSERT_MESSAGE( "#test comment#: open a non-exist pipe.", + nError != osl_Pipe_E_None ); } void getError_002( ) @@ -638,8 +642,8 @@ namespace osl_Pipe aPipe.clear( ); aPipe1.clear( ); - CPPUNIT_ASSERT_MESSAGE( "#test comment#: create an already exist pipe.not passed in (W32)(LINUX)(UNX).", - osl_Pipe_E_invalidError == nError ); + CPPUNIT_ASSERT_MESSAGE( "#test comment#: create an already exist pipe.", + nError != osl_Pipe_E_None ); } CPPUNIT_TEST_SUITE( getError ); @@ -687,17 +691,17 @@ namespace osl_Pipe // ----------------------------------------------------------------------------- - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::ctors, "osl_Pipe"); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::is, "osl_Pipe"); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::create, "osl_Pipe"); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::clear, "osl_Pipe"); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::assign, "osl_Pipe"); -//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::isValid, "osl_Pipe"); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::isEqual, "osl_Pipe"); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::close, "osl_Pipe"); - //CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::accept, "osl_Pipe"); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::getError, "osl_Pipe"); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Pipe::getHandle, "osl_Pipe"); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::ctors); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::is); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::create); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::clear); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::assign); +//CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::isValid); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::isEqual); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::close); + //CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::accept); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::getError); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::getHandle); // ----------------------------------------------------------------------------- } // namespace osl_Pipe @@ -881,7 +885,7 @@ namespace osl_StreamPipe void thread_sleep( sal_Int32 _nSec ) { /// print statement in thread process must use fflush() to force display. - // t_print("wait %d seconds. ", _nSec ); + // printf("wait %d seconds. ", _nSec ); fflush(stdout); #ifdef WNT //Windows @@ -890,7 +894,7 @@ namespace osl_StreamPipe #if ( defined UNX ) || ( defined OS2 ) //Unix sleep( _nSec ); #endif - // t_print("done\n" ); + // printf("done\n" ); } // test read/write & send/recv data to pipe // ----------------------------------------------------------------------------- @@ -909,27 +913,27 @@ namespace osl_StreamPipe { sal_Int32 nChars = 0; - t_print("open pipe\n"); + printf("open pipe\n"); ::osl::StreamPipe aSenderPipe( aTestPipeName, osl_Pipe_OPEN ); // aTestPipeName is a string = "TestPipe" if ( aSenderPipe.is() == sal_False ) { - t_print("pipe open failed! \n"); + printf("pipe open failed! \n"); } else { - t_print("read\n"); + printf("read\n"); nChars = aSenderPipe.read( buf, m_pTestString1.getLength() + 1 ); if ( nChars < 0 ) { - t_print("read failed! \n"); + printf("read failed! \n"); return; } - t_print("buffer is %s \n", buf); - t_print("send\n"); + printf("buffer is %s \n", buf); + printf("send\n"); nChars = aSenderPipe.send( m_pTestString2.getStr(), m_pTestString2.getLength() + 1 ); if ( nChars < 0 ) { - t_print("client send failed! \n"); + printf("client send failed! \n"); return; } } @@ -948,7 +952,7 @@ namespace osl_StreamPipe ::osl::StreamPipe aConnectionPipe; Pipe_DataSource_Thread( ) { - t_print("create pipe\n"); + printf("create pipe\n"); aListenPipe.create( aTestPipeName, osl_Pipe_CREATE ); } ~Pipe_DataSource_Thread( ) @@ -961,40 +965,40 @@ namespace osl_StreamPipe //create pipe. sal_Int32 nChars; //::osl::StreamPipe aListenPipe( aTestPipeName, osl_Pipe_CREATE ); - t_print("listen\n"); + printf("listen\n"); if ( aListenPipe.is() == sal_False ) { - t_print("pipe create failed! \n"); + printf("pipe create failed! \n"); } else { //::osl::StreamPipe aConnectionPipe; //start server and wait for connection. - t_print("accept\n"); + printf("accept\n"); if ( osl_Pipe_E_None != aListenPipe.accept( aConnectionPipe ) ) { - t_print("pipe accept failed!"); + printf("pipe accept failed!"); return; } - t_print("write\n"); + printf("write\n"); // write to pipe nChars = aConnectionPipe.write( m_pTestString1.getStr(), m_pTestString1.getLength() + 1 ); if ( nChars < 0) { - t_print("server write failed! \n"); + printf("server write failed! \n"); return; } - t_print("recv\n"); + printf("recv\n"); nChars = aConnectionPipe.recv( buf, 256 ); if ( nChars < 0) { - t_print("server receive failed! \n"); + printf("server receive failed! \n"); return; } //thread_sleep( 2 ); - t_print("received message is: %s\n", buf ); + printf("received message is: %s\n", buf ); //aConnectionPipe.close(); } } @@ -1045,16 +1049,11 @@ namespace osl_StreamPipe }; // class recv // ----------------------------------------------------------------------------- - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_StreamPipe::ctors, "osl_StreamPipe"); -//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_StreamPipe::assign, "osl_StreamPipe"); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_StreamPipe::recv, "osl_StreamPipe"); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamPipe::ctors); +//CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamPipe::assign); + CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamPipe::recv); // ----------------------------------------------------------------------------- } // namespace osl_StreamPipe - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sal/qa/osl/pipe/osl_Pipe.xsce b/sal/qa/osl/pipe/osl_Pipe.xsce deleted file mode 100644 index d96a915d8ab9..000000000000 --- a/sal/qa/osl/pipe/osl_Pipe.xsce +++ /dev/null @@ -1,9 +0,0 @@ -#i23307# -osl_Pipe.getError.getError_001 wntmsci -osl_Pipe.getError.getError_002 wntmsci - -osl_StreamPipe.recv.recv_002 wntmsci unxsols -# osl_Pipe.ctors.ctors_acquire wntmsci - -#i27889# -osl_Pipe.ctors.ctors_no_acquire wntmsci diff --git a/sal/qa/osl/pipe/osl_Pipe_Const.h b/sal/qa/osl/pipe/osl_Pipe_Const.h deleted file mode 100644 index 0b70655eabc0..000000000000 --- a/sal/qa/osl/pipe/osl_Pipe_Const.h +++ /dev/null @@ -1 +0,0 @@ -// no longer used diff --git a/sal/qa/osl/profile/makefile.mk b/sal/qa/osl/profile/makefile.mk index aa99e25f7c3b..a95db211c2a6 100644 --- a/sal/qa/osl/profile/makefile.mk +++ b/sal/qa/osl/profile/makefile.mk @@ -24,6 +24,11 @@ # for a copy of the LGPLv3 License. # #************************************************************************* + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + PRJ=..$/..$/.. PRJNAME=sal @@ -39,16 +44,19 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- SHL1OBJS= \ $(SLO)$/osl_old_testprofile.obj SHL1TARGET= osl_old_testprofile -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) +SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) SHL1VERSIONMAP = $(PRJ)$/qa$/export.map +SHL1RPATH = NONE # END ------------------------------------------------------------------ @@ -62,4 +70,4 @@ SLOFILES=\ .INCLUDE : target.mk .INCLUDE : _cppunit.mk - +.END diff --git a/sal/qa/osl/profile/osl_old_testprofile.cxx b/sal/qa/osl/profile/osl_old_testprofile.cxx index d85e80203cb3..966a453dc79f 100644 --- a/sal/qa/osl/profile/osl_old_testprofile.cxx +++ b/sal/qa/osl/profile/osl_old_testprofile.cxx @@ -37,7 +37,10 @@ #include <stdio.h> #include <osl/profile.h> -#include <testshl/simpleheader.hxx> +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" //================================================================================================== // ----------------------------------------------------------------------------- @@ -64,7 +67,8 @@ void oldtests::test_profile(void) // successful write - if (hProfile = osl_openProfile( ustrProfileName, 0 )) + hProfile = osl_openProfile( ustrProfileName, 0 ); + if (hProfile != 0) { if (! osl_writeProfileBool( hProfile, "testsection", "testbool", 1 )) printf( "### cannot write into init file!\n" ); @@ -73,7 +77,8 @@ void oldtests::test_profile(void) } // unsuccessful write - if (hProfile = osl_openProfile( ustrProfileName2, 0 )) + hProfile = osl_openProfile( ustrProfileName2, 0 ); + if (hProfile != 0) { if (osl_writeProfileBool( hProfile, "testsection", "testbool", 1 )) printf( "### unexpected success writing into test2.ini!\n" ); @@ -88,7 +93,7 @@ void oldtests::test_profile(void) } // namespace osl_Profile // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_Profile::oldtests, "osl_Profile" ); +CPPUNIT_TEST_SUITE_REGISTRATION( osl_Profile::oldtests ); // ----------------------------------------------------------------------------- -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sal/qa/osl/semaphore/osl_Semaphore.cxx b/sal/qa/osl/semaphore/osl_Semaphore.cxx deleted file mode 100644 index 4a02e284a89b..000000000000 --- a/sal/qa/osl/semaphore/osl_Semaphore.cxx +++ /dev/null @@ -1,525 +0,0 @@ - /************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sal.hxx" - -//------------------------------------------------------------------------ -// include files -//------------------------------------------------------------------------ -#include <osl_Semaphore_Const.h> - -using namespace osl; -using namespace rtl; - - -//------------------------------------------------------------------------ -// helper functions and classes -//------------------------------------------------------------------------ - -/** print Boolean value. -*/ -inline void printBool( sal_Bool bOk ) -{ - t_print("#printBool# " ); - ( sal_True == bOk ) ? t_print("YES!\n" ): t_print("NO!\n" ); -} - -/** print a UNI_CODE String. -*/ -inline void printUString( const ::rtl::OUString & str ) -{ - rtl::OString aString; - - t_print("#printUString_u# " ); - aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ); - t_print("%s\n", aString.getStr( ) ); -} - -/** wait _nSec seconds. -*/ -void thread_sleep( sal_Int32 _nSec ) -{ - /// print statement in thread process must use fflush() to force display. - // t_print("wait %d seconds. ", _nSec ); - // fflush( stdout ); - -#ifdef WNT //Windows - Sleep( _nSec * 1000 ); -#endif -#if ( defined UNX ) || ( defined OS2 ) //Unix - sleep( _nSec ); -#endif -} - - void thread_sleep_tenth_sec(sal_Int32 _nTenthSec) - { -#ifdef WNT //Windows - Sleep(_nTenthSec * 100 ); -#endif -#if ( defined UNX ) || ( defined OS2 ) //Unix - TimeValue nTV; - nTV.Seconds = static_cast<sal_uInt32>( _nTenthSec/10 ); - nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 ); - osl_waitThread(&nTV); -#endif -} - -/** thread for testing Semaphore acquire. - */ -class HoldThread : public Thread -{ -public: - //get the Semaphores to operate - HoldThread( ::osl::Semaphore& Sem ): MySem( Sem ) { } - - ~HoldThread( ) - { - CPPUNIT_ASSERT_MESSAGE( "#HoldThread does not shutdown properly.\n", sal_False == this -> isRunning( ) ); - } -protected: - ::osl::Semaphore& MySem; - - void SAL_CALL run() - { - // block here if it tries to decrease below zero. - MySem.acquire( ); - t_print("Semaphore acquired. \n" ); - MySem.release( ); - } -}; - -/** thread for testing Semaphore release and tryToAcquire. - */ -class WaitThread : public Thread -{ -public: - //get the Semaphore pointer to operate - WaitThread( ::osl::Semaphore& Sem ): MySem( Sem ) { } - - ~WaitThread( ) - { - CPPUNIT_ASSERT_MESSAGE( "WaitThread does not shutdown properly.\n", sal_False == this -> isRunning( ) ); - } -protected: - Semaphore& MySem; - - void SAL_CALL run( ) - { - // block here if the semaphore has been acquired - MySem.acquire( ); - thread_sleep_tenth_sec( 2 ); - MySem.release( ); - } -}; - -/** thread for producer-consumer model. - */ -#define BSIZE 50 -class SemBuffer -{ -public: - sal_Int32 Buf[BSIZE]; - ::osl::Semaphore& aSemOccupied; - ::osl::Semaphore& aSemEmpty; - ::osl::Mutex& aMutex; - - SemBuffer( ::osl::Semaphore& Sem, ::osl::Semaphore& Sem1, ::osl::Mutex& Mut ) - :aSemOccupied( Sem ), aSemEmpty( Sem1 ), aMutex( Mut ) - { - for ( sal_Int8 iCount=0; iCount < BSIZE; iCount++ ) - Buf[iCount] = 0; - } -}; - -class WriterThread : public Thread -{ -public: - //get the Semaphores to operate - WriterThread( SemBuffer& aSemBuffer ): MySemBuffer( aSemBuffer ){ } - - ~WriterThread( ) - { - CPPUNIT_ASSERT_MESSAGE( "WriterThread does not shutdown properly.\n", sal_False == this -> isRunning( ) ); - } -protected: - SemBuffer& MySemBuffer; - - void SAL_CALL run( ) - { - for ( sal_Int32 iCount = 0; iCount < BSIZE; iCount++ ) - { - MySemBuffer.aSemEmpty.acquire( ) ; - MySemBuffer.aMutex.acquire( ) ; - MySemBuffer.Buf[iCount] = iCount; - MySemBuffer.aMutex.release( ) ; - MySemBuffer.aSemOccupied.release( ) ; - } - } -}; - -class ReaderThread : public Thread -{ -public: - //get the Semaphores to operate - ReaderThread( SemBuffer& aSemBuffer ): MySemBuffer( aSemBuffer ){ } - - ~ReaderThread( ) - { - CPPUNIT_ASSERT_MESSAGE( "ReaderThread does not shutdown properly.\n", sal_False == this -> isRunning( ) ); - } - -protected: - SemBuffer& MySemBuffer; - - void SAL_CALL run( ) - { - for ( sal_Int32 iCount = 0; iCount < BSIZE; iCount++ ) - { - MySemBuffer.aSemOccupied.acquire( ) ; - MySemBuffer.aMutex.acquire( ) ; - MySemBuffer.Buf[iCount] *= MySemBuffer.Buf[iCount]; - MySemBuffer.aMutex.release( ) ; - MySemBuffer.aSemEmpty.release( ) ; - } - } -}; - - - -//------------------------------------------------------------------------ -// test code start here -//------------------------------------------------------------------------ - -namespace osl_Semaphore -{ - - /** testing the method: - Semaphore(sal_uInt32 initialCount); - */ - class ctors : public CppUnit::TestFixture - { - public: - sal_Bool bRes, bRes1; - - void ctors_001( ) - { - ::osl::Semaphore aSem(sal_uInt32(0)); - bRes = aSem.tryToAcquire( ); - - CPPUNIT_ASSERT_MESSAGE( "#test comment#: create semaphore with initialCount = 0. the first acquire will block.", - sal_False == bRes ); - } - - void ctors_002( ) - { - ::osl::Semaphore aSem(sal_uInt32(1)); - bRes = aSem.tryToAcquire( ); - if ( sal_True == bRes ) - aSem.release( ); - - CPPUNIT_ASSERT_MESSAGE( "#test comment#: create semaphore with initialCount = 1. the first acquire will not block.", - sal_True == bRes ); - } - - void ctors_003( ) - { - ::osl::Semaphore aSem(sal_uInt32(1)); - bRes = aSem.tryToAcquire( ); - bRes1 = aSem.tryToAcquire( ); - - CPPUNIT_ASSERT_MESSAGE( "#test comment#: create semaphore with initialCount = 1. acquire twice will cause block.", - sal_True == bRes && sal_False == bRes1); - } - - void ctors_004( ) - { - oslSemaphore hSem = new ::osl::Semaphore(sal_uInt32(1)); - - CPPUNIT_ASSERT_MESSAGE( "#test comment#: test return value of the constructor, it should not be NULL.", - NULL != hSem ); - } - - void ctors_005( ) - { - ::osl::Semaphore aSemaphore(sal_uInt32(2)); - bRes = aSemaphore.tryToAcquire( )&& - aSemaphore.tryToAcquire( )&& - !aSemaphore.tryToAcquire( ); - - CPPUNIT_ASSERT_MESSAGE( "#test comment#: create semaphore with initialCount = 2. guess what behaviour will the semaphore act like.", - sal_True == bRes ); - } - - CPPUNIT_TEST_SUITE( ctors ); - CPPUNIT_TEST( ctors_001 ); - CPPUNIT_TEST( ctors_002 ); - CPPUNIT_TEST( ctors_003 ); - CPPUNIT_TEST( ctors_004 ); - CPPUNIT_TEST( ctors_005 ); - CPPUNIT_TEST_SUITE_END( ); - }; // class ctors - - - /** testing the method: - sal_Bool acquire(); - */ - class acquire : public CppUnit::TestFixture - { - public: - sal_Bool bRes, bRes1, bRes2; - - /** tester comment: - acquire semaphore in main thread, and then call acquire again in myThread, - the child thread should block, wait 2 secs, it still block. Then release - semaphore in main thread, the child thread could return from acquire, and - go to exec next statement, so could terminate quickly. - */ - - void acquire_001( ) - { - // launch the child thread - ::osl::Semaphore aSemaphore(1); - bRes = aSemaphore.acquire( ); - HoldThread myThread( aSemaphore ); - myThread.create( ); - - // if acquire in myThread does not work, 2 secs is long enough, - // myThread should terminate now, and bRes1 should be sal_False - thread_sleep_tenth_sec( 2 ); - bRes1 = myThread.isRunning( ); - - // after release semaphore, myThread stops blocking and will terminate immediately - aSemaphore.release( ); - thread_sleep_tenth_sec( 1 ); - bRes2 = myThread.isRunning( ); - myThread.join( ); - - CPPUNIT_ASSERT_MESSAGE( "#test comment#: test acquire of Semaphore.", - bRes == sal_True && bRes1 == sal_True && bRes2 == sal_False ); - } - - /** tester comment: - launch 3 thread for testing acquirement inter-process. - */ - - void acquire_002( ) - { - // launch three child threads - ::osl::Semaphore aSemaphore(1); - bRes = aSemaphore.acquire( ); - HoldThread myThread1( aSemaphore ); - myThread1.create( ); - HoldThread myThread2( aSemaphore ); - myThread2.create( ); - HoldThread myThread3( aSemaphore ); - myThread3.create( ); - - // if acquire in myThread does not work, 2 secs is long enough, - thread_sleep_tenth_sec( 2 ); - bRes1 = myThread1.isRunning( ) && myThread2.isRunning( ) && myThread3.isRunning( ); - - // after release semaphore, myThread stops blocking and will terminate immediately - aSemaphore.release( ); - thread_sleep_tenth_sec( 1 ); - bRes2 = myThread1.isRunning( ) || myThread2.isRunning( ) || myThread3.isRunning( ); - myThread1.join( ); - myThread2.join( ); - myThread3.join( ); - - CPPUNIT_ASSERT_MESSAGE( "#test comment#: test acquire of Semaphore in multithreaded environment.", - bRes == sal_True && bRes1 == sal_True && bRes2 == sal_False ); - } - - - - /** tester comment: - launch 3 thread for testing acquirement inter-process. in this test, - we use two threads as producer and consumer, operate together on an - array which is initialized to 0 for every item. producer takes action - as follow: - p(A), p(M), Buf[i]=i, v(M), v(B). - consumer's action is like: - p(B), p(M), Buf[i]=Buf[i]*Buf[i], v(M), v(A). - consumer must operate on the array after producer does sequetially, - otherwise, the array will contain items remain zero after all threads - terminate. array will be filled with index^2 in the end. - */ - - void acquire_003( ) - { - // initialization. - ::osl::Semaphore aSemOccupied( sal_uInt32(0) ); - ::osl::Semaphore aSemEmpty( BSIZE ); - ::osl::Mutex aMutex; - - // launch two threads. - SemBuffer aBuffer( aSemOccupied, aSemEmpty, aMutex ); - WriterThread myThread1( aBuffer ); - ReaderThread myThread2( aBuffer ); - myThread1.create( ); - myThread2.create( ); - - myThread1.join( ); - myThread2.join( ); - - bRes = sal_True; - for ( sal_Int32 iCount = 0; iCount < BSIZE; iCount++ ) - bRes = bRes && ( aBuffer.Buf[iCount] == iCount*iCount ); - - CPPUNIT_ASSERT_MESSAGE( "#test comment#: test acquire of Semaphore using Producer-Consumer model.", - sal_True == bRes ); - } - - CPPUNIT_TEST_SUITE( acquire ); - CPPUNIT_TEST( acquire_001 ); - CPPUNIT_TEST( acquire_002 ); - CPPUNIT_TEST( acquire_003 ); - CPPUNIT_TEST_SUITE_END( ); - }; // class acquire - - - /** testing the method: - sal_Bool tryToAcquire(); - */ - class tryToAcquire : public CppUnit::TestFixture - { - public: - sal_Bool bRes, bRes1, bRes2; - /** tester comment: - First let child thread acquire the semaphore, and wait 2 secs, during the 2 secs, - in main thread, tryToAcquire semaphore should return False, then after the - child thread terminated, tryToAcquire should return True - */ - void tryToAcquire_001() - { - ::osl::Semaphore aSemaphore(1); - WaitThread myThread( aSemaphore ); - myThread.create(); - - // ensure the child thread acquire the semaphore - thread_sleep_tenth_sec(1); - bRes1 = aSemaphore.tryToAcquire(); - - if (bRes1 == sal_True) - aSemaphore.release(); - // wait the child thread terminate - myThread.join(); - - bRes2 = aSemaphore.tryToAcquire(); - if (bRes2 == sal_True) - aSemaphore.release(); - - CPPUNIT_ASSERT_MESSAGE("#test comment#: Try to acquire Semaphore", - bRes1 == sal_False && bRes2 == sal_True); - } - - void tryToAcquire_002() - { - ::osl::Semaphore aSem(1); - bRes = aSem.tryToAcquire( ); - bRes1 = aSem.tryToAcquire( ); - - - CPPUNIT_ASSERT_MESSAGE("#test comment#: Try to acquire Semaphore twice should block.", - sal_True == bRes && sal_False == bRes1); - } - - CPPUNIT_TEST_SUITE( tryToAcquire ); - CPPUNIT_TEST( tryToAcquire_001 ); - CPPUNIT_TEST( tryToAcquire_002 ); - CPPUNIT_TEST_SUITE_END( ); - }; // class tryToAcquire - - - /** testing the method: - sal_Bool release(); - */ - class release : public CppUnit::TestFixture - { - public: - sal_Bool bRes, bRes1, bRes2, bRunning; - sal_Int32 nCount; - /** acquire/release are not used in pairs: after child thread acquired semaphore, - the main thread release it, then any thread could acquire it. - */ - void release_001() - { - Semaphore aSemaphore(1); - WaitThread myThread( aSemaphore ); - myThread.create( ); - - // ensure the child thread acquire the mutex - thread_sleep_tenth_sec( 1 ); - - bRunning = myThread.isRunning( ); - bRes1 = aSemaphore.tryToAcquire( ); - // wait the child thread terminate - myThread.join( ); - - bRes2 = aSemaphore.tryToAcquire( ); - if ( bRes2 == sal_True ) - aSemaphore.release( ); - - CPPUNIT_ASSERT_MESSAGE( "release Semaphore: try to aquire before and after the semaphore has been released", - bRes1 == sal_False && bRes2 == sal_True && bRunning == sal_True ); - - } - - void release_002() - { - Semaphore aSemaphore(sal_uInt32(0)); - bRes1 = sal_True; - for ( nCount = 0; nCount < 10; nCount++, aSemaphore.release( ) ) { } - for ( nCount = 0; nCount < 10; nCount++, bRes1 = bRes1 && aSemaphore.tryToAcquire( ) ) { } - bRes = aSemaphore.tryToAcquire( ); - - CPPUNIT_ASSERT_MESSAGE( "release Semaphore: release ten times and acquire eleven times.", - sal_False == bRes && sal_True == bRes1); - } - - CPPUNIT_TEST_SUITE( release ); - CPPUNIT_TEST( release_001 ); - CPPUNIT_TEST( release_002 ); - CPPUNIT_TEST_SUITE_END( ); - }; // class release - -// ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Semaphore::ctors, "osl_Semaphore"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Semaphore::acquire, "osl_Semaphore"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Semaphore::tryToAcquire, "osl_Semaphore"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Semaphore::release, "osl_Semaphore"); -// ----------------------------------------------------------------------------- - -} // namespace osl_Semaphore - - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; diff --git a/sal/qa/osl/semaphore/osl_Semaphore_Const.h b/sal/qa/osl/semaphore/osl_Semaphore_Const.h deleted file mode 100644 index 457d27e42865..000000000000 --- a/sal/qa/osl/semaphore/osl_Semaphore_Const.h +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************* - * - * 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 _OSL_SEMAPHORE_CONST_H_ -#define _OSL_SEMAPHORE_CONST_H_ - -//------------------------------------------------------------------------ -//------------------------------------------------------------------------ - -#include <sal/types.h> -#include <rtl/ustring.hxx> - -#ifndef _OSL_THREAD_HXX_ -#include <osl/thread.hxx> -#endif -#include <osl/mutex.hxx> -#include <osl/pipe.hxx> - -#ifndef _OSL_SEMAPHOR_HXX_ -#include <osl/semaphor.hxx> -#endif -#include <osl/time.h> - -#include <testshl/simpleheader.hxx> - -#ifdef UNX -#include <unistd.h> -#endif - -//------------------------------------------------------------------------ -// most return value -1 denote a fail of operation. -//------------------------------------------------------------------------ -#define OSL_PIPE_FAIL -1 - -#define OSLTEST_DECLARE_USTRING( str_name, str_value ) \ - ::rtl::OUString a##str_name = rtl::OUString::createFromAscii( str_value ) - -//------------------------------------------------------------------------ -// semaphre names -//------------------------------------------------------------------------ -OSLTEST_DECLARE_USTRING( TestSem, "testsem" ); - -const char pTestString[17] = "Sun Microsystems"; - - -#endif /* _OSL_SEMAPHORE_CONST_H_ */ diff --git a/sal/qa/rtl/alloc/makefile.mk b/sal/qa/rtl/alloc/makefile.mk index ea22fbc2720a..37ae3718b40d 100755 --- a/sal/qa/rtl/alloc/makefile.mk +++ b/sal/qa/rtl/alloc/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:jobfile by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/bootstrap/makefile.mk b/sal/qa/rtl/bootstrap/makefile.mk index e17f3c410e94..d32f9db35383 100644 --- a/sal/qa/rtl/bootstrap/makefile.mk +++ b/sal/qa/rtl/bootstrap/makefile.mk @@ -50,6 +50,8 @@ MY_SCRIPTCAT=tr -d "\015" < CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/cipher/makefile.mk b/sal/qa/rtl/cipher/makefile.mk index 73bf673f6c3d..b89e392d71d6 100644 --- a/sal/qa/rtl/cipher/makefile.mk +++ b/sal/qa/rtl/cipher/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/crc32/makefile.mk b/sal/qa/rtl/crc32/makefile.mk index c936b51a32d3..6bd3bd89d5a6 100755 --- a/sal/qa/rtl/crc32/makefile.mk +++ b/sal/qa/rtl/crc32/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:jobfile by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/digest/makefile.mk b/sal/qa/rtl/digest/makefile.mk index fceb9eac8de8..415183b7e9a0 100644 --- a/sal/qa/rtl/digest/makefile.mk +++ b/sal/qa/rtl/digest/makefile.mk @@ -41,6 +41,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + #----------------------------------- OStringBuffer ----------------------------------- SHL1OBJS= \ diff --git a/sal/qa/rtl/doublelock/makefile.mk b/sal/qa/rtl/doublelock/makefile.mk index a914dfa86f22..b13ccf420c06 100644 --- a/sal/qa/rtl/doublelock/makefile.mk +++ b/sal/qa/rtl/doublelock/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:testjob by codegen.pl diff --git a/sal/qa/rtl/locale/makefile.mk b/sal/qa/rtl/locale/makefile.mk index 490ee7b22364..329769b5d3ec 100644 --- a/sal/qa/rtl/locale/makefile.mk +++ b/sal/qa/rtl/locale/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:locale by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/logfile/makefile.mk b/sal/qa/rtl/logfile/makefile.mk index 92e3d30dd7a5..9b52e0a45b37 100644 --- a/sal/qa/rtl/logfile/makefile.mk +++ b/sal/qa/rtl/logfile/makefile.mk @@ -39,6 +39,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # --- BEGIN -------------------------------------------------------- SHL1OBJS= \ $(SLO)$/rtl_logfile.obj diff --git a/sal/qa/rtl/math/makefile.mk b/sal/qa/rtl/math/makefile.mk index a5cd21da67ce..3b35e52ab1f4 100644 --- a/sal/qa/rtl/math/makefile.mk +++ b/sal/qa/rtl/math/makefile.mk @@ -41,6 +41,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + #----------------------------------- OStringBuffer ----------------------------------- SHL1OBJS= \ diff --git a/sal/qa/rtl/ostring/makefile.mk b/sal/qa/rtl/ostring/makefile.mk index bfb6c74c3482..06469b38a407 100644 --- a/sal/qa/rtl/ostring/makefile.mk +++ b/sal/qa/rtl/ostring/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/oustring/makefile.mk b/sal/qa/rtl/oustring/makefile.mk index e65611410003..6f15637651c6 100644 --- a/sal/qa/rtl/oustring/makefile.mk +++ b/sal/qa/rtl/oustring/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/oustringbuffer/makefile.mk b/sal/qa/rtl/oustringbuffer/makefile.mk index 7ba01bcebd72..544f7b7df170 100644 --- a/sal/qa/rtl/oustringbuffer/makefile.mk +++ b/sal/qa/rtl/oustringbuffer/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/process/makefile.mk b/sal/qa/rtl/process/makefile.mk index ef79fc46ca3a..5df9dc01504e 100644 --- a/sal/qa/rtl/process/makefile.mk +++ b/sal/qa/rtl/process/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/random/makefile.mk b/sal/qa/rtl/random/makefile.mk index b97599240a37..cd57ec9bcc13 100644 --- a/sal/qa/rtl/random/makefile.mk +++ b/sal/qa/rtl/random/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:job by codegen.pl SHL1OBJS= \ diff --git a/sal/qa/rtl/strings/makefile.mk b/sal/qa/rtl/strings/makefile.mk index e1a5dd3af99a..3c1b9219642f 100644 --- a/sal/qa/rtl/strings/makefile.mk +++ b/sal/qa/rtl/strings/makefile.mk @@ -37,6 +37,8 @@ ENABLE_EXCEPTIONS := TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + SHL1TARGET := $(TARGET) SHL1OBJS := \ $(SLO)$/test_oustringbuffer_utf32.obj \ diff --git a/sal/qa/rtl/textenc/gcc3_export.map b/sal/qa/rtl/textenc/gcc3_export.map deleted file mode 100644 index e7f19d73264e..000000000000 --- a/sal/qa/rtl/textenc/gcc3_export.map +++ /dev/null @@ -1,36 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -UDK_3_0_0 { - global: - registerAllTestFunction; - - _ZN4_STL7num_put*; # STLport - - local: - *; -}; diff --git a/sal/qa/rtl/textenc/makefile.mk b/sal/qa/rtl/textenc/makefile.mk index 1126c0facaba..597309d9bfe6 100644 --- a/sal/qa/rtl/textenc/makefile.mk +++ b/sal/qa/rtl/textenc/makefile.mk @@ -39,6 +39,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # --- BEGIN -------------------------------------------------------- SHL1OBJS= \ $(SLO)$/rtl_textcvt.obj @@ -47,11 +49,7 @@ SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) -.IF "$(COMNAME)" == "gcc3" -SHL1VERSIONMAP = gcc3_export.map -.ELSE SHL1VERSIONMAP = $(PRJ)$/qa$/export.map -.ENDIF # END -------------------------------------------------------------- @@ -63,11 +61,7 @@ SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) SHL2IMPLIB= i$(SHL2TARGET) DEF2NAME =$(SHL2TARGET) -.IF "$(COMNAME)" == "gcc3" -SHL2VERSIONMAP = gcc3_export.map -.ELSE SHL2VERSIONMAP = $(PRJ)$/qa$/export.map -.ENDIF # END -------------------------------------------------------------- diff --git a/sal/qa/rtl/uri/makefile.mk b/sal/qa/rtl/uri/makefile.mk index 1858f586401a..d4a8814cc649 100644 --- a/sal/qa/rtl/uri/makefile.mk +++ b/sal/qa/rtl/uri/makefile.mk @@ -39,6 +39,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # --- BEGIN -------------------------------------------------------- SHL1OBJS= \ $(SLO)$/rtl_Uri.obj diff --git a/sal/qa/rtl/uuid/makefile.mk b/sal/qa/rtl/uuid/makefile.mk index 93890f0da819..40e583f8b019 100644 --- a/sal/qa/rtl/uuid/makefile.mk +++ b/sal/qa/rtl/uuid/makefile.mk @@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +CFLAGSCXX += $(CPPUNIT_CFLAGS) + # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl SHL1OBJS= \ diff --git a/sal/rtl/source/macro.hxx b/sal/rtl/source/macro.hxx index a48918668f83..50f0d7de924e 100644 --- a/sal/rtl/source/macro.hxx +++ b/sal/rtl/source/macro.hxx @@ -89,6 +89,8 @@ this is inserted for the case that the preprocessor ignores error # define THIS_ARCH "M68K" #elif defined HPPA # define THIS_ARCH "HPPA" +#elif defined AXP +# define THIS_ARCH "ALPHA" #endif #if ! defined THIS_ARCH diff --git a/sal/typesconfig/typesconfig.c b/sal/typesconfig/typesconfig.c index 8223c80a5856..708837be926b 100644 --- a/sal/typesconfig/typesconfig.c +++ b/sal/typesconfig/typesconfig.c @@ -160,7 +160,7 @@ int check( TestFunc func, Type eT, void* p ) |* Letzte Aenderung |* *************************************************************************/ -#if defined(IA64) || defined(ARM32) || defined(HPPA) +#if defined(IA64) || defined(ARM32) || defined(HPPA) || defined(AXP) int forceerror() { diff --git a/sal/util/makefile.mk b/sal/util/makefile.mk index 6de6cc25c7ce..82ebbc811c8d 100644 --- a/sal/util/makefile.mk +++ b/sal/util/makefile.mk @@ -230,8 +230,6 @@ SHL1STDLIBS+=-lgcc $(SHL1TARGETN) : $(OUT)$/inc$/udkversion.h .ENDIF # "$(SHL1TARGETN)" != "" -.IF "$(GUI)"=="UNX" || "$(USE_SHELL)"!="4nt" - $(OUT)$/inc$/udkversion.h: echo '#ifndef _SAL_UDKVERSION_H_' > $@ echo '#define _SAL_UDKVERSION_H_' >> $@ @@ -241,17 +239,3 @@ $(OUT)$/inc$/udkversion.h: echo '#define SAL_UDK_MICRO "$(UDK_MICRO)"' >> $@ echo '' >> $@ echo '#endif' >> $@ - -.ELSE - -$(OUT)$/inc$/udkversion.h: - echo #ifndef _SAL_UDKVERSION_H_ > $@ - echo #define _SAL_UDKVERSION_H_ >> $@ - echo. >> $@ - echo #define SAL_UDK_MAJOR "$(UDK_MAJOR)" >> $@ - echo #define SAL_UDK_MINOR "$(UDK_MINOR)" >> $@ - echo #define SAL_UDK_MICRO "$(UDK_MICRO)" >> $@ - echo. >> $@ - echo #endif >> $@ - -.ENDIF diff --git a/salhelper/inc/salhelper/queue.hxx b/salhelper/inc/salhelper/queue.hxx index f0daa8e9a904..445cc5f32da1 100644 --- a/salhelper/inc/salhelper/queue.hxx +++ b/salhelper/inc/salhelper/queue.hxx @@ -93,6 +93,12 @@ public: //---------------------------------------------------------------------------- +/** Queue. + + @deprecated + Must not be used, as it internally uses unnamed semaphores, which are not + supported on Mac OS X. +*/ template<class element_type> class Queue : protected QueueBase<element_type> { @@ -130,6 +136,12 @@ public: //---------------------------------------------------------------------------- +/** Bounded queue. + + @deprecated + Must not be used, as it internally uses unnamed semaphores, which are not + supported on Mac OS X. +*/ template<class element_type> class BoundedQueue : protected Queue<element_type> { diff --git a/salhelper/qa/makefile.mk b/salhelper/qa/makefile.mk index 1ce9ccb6f4ca..fe2aff7453be 100644 --- a/salhelper/qa/makefile.mk +++ b/salhelper/qa/makefile.mk @@ -33,6 +33,8 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk +CFLAGSCXX += $(CPPUNIT_CFLAGS) + SHL1TARGET = $(TARGET) SHL1OBJS = $(SLO)$/test_api.obj SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) $(SALHELPERLIB) $(TESTSHL2LIB) diff --git a/salhelper/source/makefile.mk b/salhelper/source/makefile.mk index 4eb278f42fbd..a6b83cb5e090 100644 --- a/salhelper/source/makefile.mk +++ b/salhelper/source/makefile.mk @@ -48,11 +48,6 @@ SLOFILES= \ $(SLO)$/dynload.obj \ $(SLO)$/simplereferenceobject.obj -# SCO: the linker does know about weak symbols, but we can't ignore multiple defined symbols -.IF "$(OS)"=="SCO" -SLOFILES+=$(SLO)$/staticmb.obj -.ENDIF - .IF "$(GUI)" == "WNT" SHL1TARGET= $(TARGET)$(UDK_MAJOR)$(COMID) .ELIF "$(GUI)" == "OS2" diff --git a/salhelper/source/staticmb.cxx b/salhelper/source/staticmb.cxx deleted file mode 100644 index 274b720b1e2d..000000000000 --- a/salhelper/source/staticmb.cxx +++ /dev/null @@ -1,26 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ diff --git a/salhelper/test/rtti/sols.map b/salhelper/test/rtti/sols.map index 962d648475f4..babf2c901585 100644 --- a/salhelper/test/rtti/sols.map +++ b/salhelper/test/rtti/sols.map @@ -1,4 +1,4 @@ -SAMPLELIB { +UDK_3_0_0 { global: GetVersionInfo; _fini; diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst index 2550563c8c34..1fb7d34eeb32 100644 --- a/stoc/prj/build.lst +++ b/stoc/prj/build.lst @@ -22,3 +22,4 @@ tc stoc\source\javavm nmake - all tc_jvm tc_inc NULL tc stoc\source\javaloader nmake - all tc_jvload tc_inc NULL tc stoc\source\uriproc nmake - all tc_uriproc tc_stserv tc_inc NULL tc stoc\util nmake - all tc_util tc_boot tc_stserv tc_tcv tc_uriproc tc_smgr tc_inc tc_sreg tc_defr tc_ireg tc_regtd tc_tdmng tc_sec NULL +tc stoc\test\uriproc nmake - all tc_test_uriproc tc_util NULL diff --git a/stoc/source/corereflection/corefl.map b/stoc/source/corereflection/corefl.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/stoc/source/corereflection/corefl.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx index ec325ce11db1..95d9990257f5 100644 --- a/stoc/source/corereflection/criface.cxx +++ b/stoc/source/corereflection/criface.cxx @@ -877,7 +877,8 @@ sal_Bool InterfaceIdlClassImpl::isAssignableFrom( const Reference< XIdlClass > & Uik InterfaceIdlClassImpl::getUik() throw(::com::sun::star::uno::RuntimeException) { - return *(Uik *)&getTypeDescr()->aUik; + return Uik(0, 0, 0, 0, 0); + // Uiks are deprecated and this function must not be called } //__________________________________________________________________________________________________ Sequence< Reference< XIdlMethod > > InterfaceIdlClassImpl::getMethods() diff --git a/stoc/source/corereflection/makefile.mk b/stoc/source/corereflection/makefile.mk index 1a37f93b4bb4..b61eb13aa9ee 100644 --- a/stoc/source/corereflection/makefile.mk +++ b/stoc/source/corereflection/makefile.mk @@ -55,7 +55,7 @@ NOOPTFILES += $(SLO)$/criface.obj .ENDIF SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = corefl.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1STDLIBS= \ $(CPPULIB) \ $(CPPUHELPERLIB) \ diff --git a/stoc/source/inspect/introspection.map b/stoc/source/inspect/introspection.map deleted file mode 100644 index c2806d230702..000000000000 --- a/stoc/source/inspect/introspection.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3.1 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/stoc/source/inspect/makefile.mk b/stoc/source/inspect/makefile.mk index 3a5630d13995..80e87dbf7cab 100644 --- a/stoc/source/inspect/makefile.mk +++ b/stoc/source/inspect/makefile.mk @@ -50,7 +50,7 @@ SHL1STDLIBS= \ $(CPPUHELPERLIB) \ $(SALLIB) -SHL1VERSIONMAP = introspection.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1RPATH=URELIB SHL1DEPN= diff --git a/stoc/source/invocation/inv.map b/stoc/source/invocation/inv.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/stoc/source/invocation/inv.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/stoc/source/invocation/makefile.mk b/stoc/source/invocation/makefile.mk index 8e50bfba1285..c170bf6b614e 100644 --- a/stoc/source/invocation/makefile.mk +++ b/stoc/source/invocation/makefile.mk @@ -50,7 +50,7 @@ SHL1STDLIBS= \ $(CPPUHELPERLIB) \ $(SALLIB) -SHL1VERSIONMAP = inv.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1DEPN= SHL1IMPLIB= i$(TARGET) SHL1LIBS= $(SLB)$/$(TARGET).lib diff --git a/stoc/source/invocation_adapterfactory/invadp.map b/stoc/source/invocation_adapterfactory/invadp.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/stoc/source/invocation_adapterfactory/invadp.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/stoc/source/invocation_adapterfactory/makefile.mk b/stoc/source/invocation_adapterfactory/makefile.mk index 2edb30ea5eb0..66568af039e7 100644 --- a/stoc/source/invocation_adapterfactory/makefile.mk +++ b/stoc/source/invocation_adapterfactory/makefile.mk @@ -50,7 +50,7 @@ SHL1STDLIBS= \ $(CPPUHELPERLIB) \ $(SALLIB) -SHL1VERSIONMAP = invadp.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1RPATH=URELIB SHL1DEPN= diff --git a/stoc/source/javaloader/javaloader.map b/stoc/source/javaloader/javaloader.map deleted file mode 100644 index ac2c3750bfe0..000000000000 --- a/stoc/source/javaloader/javaloader.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/stoc/source/javaloader/makefile.mk b/stoc/source/javaloader/makefile.mk index ef35b6921964..60eea6a23457 100644 --- a/stoc/source/javaloader/makefile.mk +++ b/stoc/source/javaloader/makefile.mk @@ -52,7 +52,7 @@ SHL1STDLIBS=\ $(SALLIB) \ $(JVMACCESSLIB) -SHL1VERSIONMAP = javaloader.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1DEPN= SHL1IMPLIB= i$(TARGET) SHL1LIBS= $(SLB)$/$(TARGET).lib diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 9e23685bd264..ad72a64a811c 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -354,6 +354,23 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm, } } + // read https proxy name + css::uno::Reference<css::registry::XRegistryKey> httpsProxy_name = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetHTTPSProxyName"))); + if(httpsProxy_name.is() && httpsProxy_name->getStringValue().getLength()) { + rtl::OUString httpsHost = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("https.proxyHost=")); + httpsHost += httpsProxy_name->getStringValue(); + + // read https proxy port + css::uno::Reference<css::registry::XRegistryKey> httpsProxy_port = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetHTTPSProxyPort"))); + if(httpsProxy_port.is() && httpsProxy_port->getLongValue()) { + rtl::OUString httpsPort = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("https.proxyPort=")); + httpsPort += rtl::OUString::valueOf(httpsProxy_port->getLongValue()); + + pjvm->pushProp(httpsHost); + pjvm->pushProp(httpsPort); + } + } + // read nonProxyHosts css::uno::Reference<css::registry::XRegistryKey> nonProxies_name = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetNoProxy"))); if(nonProxies_name.is() && nonProxies_name->getStringValue().getLength()) { @@ -1170,6 +1187,22 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( aPropertyValue = rtl::OUString::valueOf(n); } else if (aAccessor.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( + "ooInetHTTPSProxyName"))) + { + aPropertyName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "https.proxyHost")); + rEvent.Element >>= aPropertyValue; + } + else if (aAccessor.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( + "ooInetHTTPSProxyPort"))) + { + aPropertyName + = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("https.proxyPort")); + sal_Int32 n = 0; + rEvent.Element >>= n; + aPropertyValue = rtl::OUString::valueOf(n); + } + else if (aAccessor.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "ooInetFTPProxyName"))) { aPropertyName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( diff --git a/stoc/source/javavm/jen.map b/stoc/source/javavm/jen.map deleted file mode 100644 index ac2c3750bfe0..000000000000 --- a/stoc/source/javavm/jen.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/stoc/source/javavm/makefile.mk b/stoc/source/javavm/makefile.mk index 4be9d87f46be..96908d10d1a1 100644 --- a/stoc/source/javavm/makefile.mk +++ b/stoc/source/javavm/makefile.mk @@ -54,7 +54,7 @@ SLOFILES= \ $(SLO)$/interact.obj SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = jen.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1STDLIBS= \ $(CPPUHELPERLIB) \ $(CPPULIB) \ diff --git a/stoc/source/namingservice/makefile.mk b/stoc/source/namingservice/makefile.mk index 00015b35e1f5..424180e114a1 100644 --- a/stoc/source/namingservice/makefile.mk +++ b/stoc/source/namingservice/makefile.mk @@ -50,7 +50,7 @@ SHL1STDLIBS= \ $(CPPUHELPERLIB) \ $(SALLIB) -SHL1VERSIONMAP = namingservice.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1DEPN= SHL1IMPLIB= i$(TARGET) diff --git a/stoc/source/namingservice/namingservice.map b/stoc/source/namingservice/namingservice.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/stoc/source/namingservice/namingservice.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/stoc/source/proxy_factory/makefile.mk b/stoc/source/proxy_factory/makefile.mk index bcb630cb0073..b38dac146ae1 100644 --- a/stoc/source/proxy_factory/makefile.mk +++ b/stoc/source/proxy_factory/makefile.mk @@ -45,7 +45,7 @@ SLOFILES= \ $(SLO)$/proxyfac.obj SHL1TARGET=$(TARGET) -SHL1VERSIONMAP = proxyfac.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1STDLIBS= \ $(CPPULIB) \ diff --git a/stoc/source/proxy_factory/proxyfac.map b/stoc/source/proxy_factory/proxyfac.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/stoc/source/proxy_factory/proxyfac.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/stoc/test/registry_tdprovider/makefile.mk b/stoc/test/registry_tdprovider/makefile.mk index 0b86669218b5..f258963f9299 100644 --- a/stoc/test/registry_tdprovider/makefile.mk +++ b/stoc/test/registry_tdprovider/makefile.mk @@ -40,16 +40,11 @@ SLOFILES = $(SLO)$/testregistrytdprovider.obj SHL1TARGET = testregistrytdprovider.uno SHL1OBJS = $(SLOFILES) +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) SHL1IMPLIB = itestregistrytdprovider DEF1NAME = $(SHL1TARGET) -.IF "$(COMNAME)" == "gcc3" -SHL1VERSIONMAP = testregistrytdprovider.gcc3.map -.ELSE -SHL1VERSIONMAP = testregistrytdprovider.map -.ENDIF - .INCLUDE: target.mk ALLTAR: test diff --git a/stoc/test/registry_tdprovider/testregistrytdprovider.map b/stoc/test/registry_tdprovider/testregistrytdprovider.map deleted file mode 100644 index e4b038369818..000000000000 --- a/stoc/test/registry_tdprovider/testregistrytdprovider.map +++ /dev/null @@ -1,36 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -UDK_3_0_0 { - global: - component_getFactory; - component_getImplementationEnvironment; - component_writeInfo; - - local: - *; -}; diff --git a/stoc/test/tdmanager/makefile.mk b/stoc/test/tdmanager/makefile.mk index e3276b19eede..8f39ac552038 100644 --- a/stoc/test/tdmanager/makefile.mk +++ b/stoc/test/tdmanager/makefile.mk @@ -40,16 +40,11 @@ SLOFILES = $(SLO)$/testtdmanager.obj SHL1TARGET = testtdmanager.uno SHL1OBJS = $(SLOFILES) +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) SHL1IMPLIB = itesttdmanager DEF1NAME = $(SHL1TARGET) -.IF "$(COMNAME)" == "gcc3" -SHL1VERSIONMAP = testtdmanager.gcc3.map -.ELSE -SHL1VERSIONMAP = testtdmanager.map -.ENDIF - .INCLUDE: target.mk ALLTAR: test diff --git a/stoc/test/tdmanager/testtdmanager.gcc3.map b/stoc/test/tdmanager/testtdmanager.gcc3.map deleted file mode 100644 index 609b64e1e0ca..000000000000 --- a/stoc/test/tdmanager/testtdmanager.gcc3.map +++ /dev/null @@ -1,38 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -UDK_3_0_0 { - global: - component_getFactory; - component_getImplementationEnvironment; - component_writeInfo; - - _ZN4_STL7num_put*; # STLport - - local: - *; -}; diff --git a/stoc/test/tdmanager/testtdmanager.map b/stoc/test/tdmanager/testtdmanager.map deleted file mode 100644 index e4b038369818..000000000000 --- a/stoc/test/tdmanager/testtdmanager.map +++ /dev/null @@ -1,36 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -UDK_3_0_0 { - global: - component_getFactory; - component_getImplementationEnvironment; - component_writeInfo; - - local: - *; -}; diff --git a/stoc/test/testsmgr_cpnt.map b/stoc/test/testsmgr_cpnt.map index d8c4047c5603..ab5ed357b461 100644 --- a/stoc/test/testsmgr_cpnt.map +++ b/stoc/test/testsmgr_cpnt.map @@ -1,4 +1,4 @@ -UDK_3.1 { +UDK_3_0_0 { global: component_getImplementationEnvironment; component_writeInfo; diff --git a/stoc/test/uriproc/makefile.mk b/stoc/test/uriproc/makefile.mk index d529f8623075..cfdc33e7586b 100644 --- a/stoc/test/uriproc/makefile.mk +++ b/stoc/test/uriproc/makefile.mk @@ -25,7 +25,11 @@ # #************************************************************************* -PRJ := ..$/.. +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ := ../.. PRJNAME := stoc TARGET := test_uriproc @@ -33,27 +37,14 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk +CFLAGSCXX += $(CPPUNIT_CFLAGS) DLLPRE = # no leading "lib" on .so files -UNOTYPES = \ - com.sun.star.beans.XPropertySet \ - com.sun.star.lang.XComponent \ - com.sun.star.lang.XMultiComponentFactory \ - com.sun.star.uno.XComponentContext \ - com.sun.star.uri.ExternalUriReferenceTranslator \ - com.sun.star.uri.UriReferenceFactory \ - com.sun.star.uri.VndSunStarPkgUrlReferenceFactory \ - com.sun.star.uri.XExternalUriReferenceTranslator \ - com.sun.star.uri.XUriReference \ - com.sun.star.uri.XUriReferenceFactory \ - com.sun.star.uri.XVndSunStarPkgUrlReferenceFactory \ - com.sun.star.uri.XVndSunStarScriptUrlReference \ - com.sun.star.util.XMacroExpander - SHL1TARGET = $(TARGET) -SHL1OBJS = $(SLO)$/test_uriproc.obj -SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(CPPUNITLIB) $(SALLIB) $(TESTSHL2LIB) +SHL1OBJS = $(SLO)/test_uriproc.obj +SHL1STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(CPPUNITLIB) $(SALLIB) SHL1VERSIONMAP = version.map +SHL1RPATH = NONE SHL1IMPLIB = i$(SHL1TARGET) DEF1NAME = $(SHL1TARGET) @@ -61,11 +52,24 @@ SLOFILES = $(SHL1OBJS) .INCLUDE: target.mk +.IF "$(OS)" == "WNT" +my_file = file:/// +.ELSE +my_file = file:// +.END + ALLTAR: test -$(BIN)$/$(TARGET).rdb .ERRREMOVE: - $(COPY) $(SOLARBINDIR)$/types.rdb $@ - regcomp -register -r $@ -c $(subst,$/,/ $(DLLDEST)$/stocservices.uno$(DLLPOST)) +test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb + $(CPPUNITTESTER) $(SHL1TARGETN) \ + -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \ + -env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb \ + -env:OOO_TEST_PREFIX=$(my_file)$(PWD)/$(DLLDEST)/ + +$(MISC)/$(TARGET)/services.rdb: + $(MKDIRHIER) $(@:d) + $(RM) $@ + $(REGCOMP) -register -r $@ -wop=vnd.sun.star.expand:\$${{OOO_TEST_PREFIX}} \ + -c $(DLLDEST)/stocservices.uno$(DLLPOST) -test .PHONY: $(SHL1TARGETN) $(BIN)$/$(TARGET).rdb - testshl2 $(SHL1TARGETN) -forward $(BIN)$/$(TARGET).rdb +.END diff --git a/stoc/test/uriproc/test_uriproc.cxx b/stoc/test/uriproc/test_uriproc.cxx index 4e46d29644f0..a7ad8d9abf94 100644 --- a/stoc/test/uriproc/test_uriproc.cxx +++ b/stoc/test/uriproc/test_uriproc.cxx @@ -28,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_stoc.hxx" -#include "com/sun/star/beans/XPropertySet.hpp" #include "com/sun/star/lang/XComponent.hpp" #include "com/sun/star/lang/XMultiComponentFactory.hpp" #include "com/sun/star/uno/Reference.hxx" @@ -43,10 +42,12 @@ #include "com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.hpp" #include "com/sun/star/uri/XVndSunStarScriptUrlReference.hpp" #include "com/sun/star/util/XMacroExpander.hpp" -#include "cppuhelper/servicefactory.hxx" -#include "testshl/simpleheader.hxx" +#include "cppuhelper/bootstrap.hxx" +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" #include "osl/diagnose.h" -#include "osl/thread.h" #include "rtl/string.h" #include "rtl/string.hxx" #include "rtl/textenc.h" @@ -148,20 +149,12 @@ private: }; void Test::setUp() { - char const * registry = getForwardString(); - css::uno::Reference< css::lang::XMultiServiceFactory > factory( - cppu::createRegistryServiceFactory( - rtl::OUString( - registry, rtl_str_getLength(registry), - osl_getThreadTextEncoding()))); - //TODO: check for string conversion failure - css::uno::Reference< css::beans::XPropertySet >( - factory, css::uno::UNO_QUERY_THROW)->getPropertyValue( - rtl::OUString::createFromAscii("DefaultContext")) >>= m_context; + m_context = cppu::defaultBootstrap_InitialComponentContext(); m_uriFactory = css::uri::UriReferenceFactory::create(m_context); } void Test::tearDown() { + m_uriFactory.clear(); css::uno::Reference< css::lang::XComponent >( m_context, css::uno::UNO_QUERY_THROW)->dispose(); } @@ -1004,8 +997,8 @@ void Test::testPkgUrlFactory() { } } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); +CPPUNIT_TEST_SUITE_REGISTRATION(Test); } -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/stoc/test/uriproc/version.map b/stoc/test/uriproc/version.map index 7321bbca16ad..3308588ef6f8 100644 --- a/stoc/test/uriproc/version.map +++ b/stoc/test/uriproc/version.map @@ -27,7 +27,7 @@ UDK_3_0_0 { global: - registerAllTestFunction; + cppunitTestPlugIn; local: *; diff --git a/stoc/util/bootstrap.map b/stoc/util/bootstrap.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/stoc/util/bootstrap.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/stoc/util/makefile.mk b/stoc/util/makefile.mk index af2ed92edccb..4243d45511fe 100644 --- a/stoc/util/makefile.mk +++ b/stoc/util/makefile.mk @@ -50,7 +50,7 @@ LIB1FILES= $(SLB)$/bootstrap.lib \ $(SLB)$/regtypeprov.lib \ $(SLB)$/typemgr.lib -SHL1VERSIONMAP = bootstrap.map +SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL1STDLIBS= \ $(CPPULIB) \ @@ -75,7 +75,7 @@ LIB2FILES= \ $(SLB)$/typeconverter.lib \ $(SLB)$/uriproc.lib -SHL2VERSIONMAP = stocservices.map +SHL2VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map SHL2STDLIBS= \ $(CPPULIB) \ diff --git a/stoc/util/stocservices.map b/stoc/util/stocservices.map deleted file mode 100644 index 30c5bb729ac7..000000000000 --- a/stoc/util/stocservices.map +++ /dev/null @@ -1,9 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - component_canUnload; - local: - *; -}; diff --git a/store/inc/store/store.hxx b/store/inc/store/store.hxx index 67fa5e3d824b..8e90de321345 100644 --- a/store/inc/store/store.hxx +++ b/store/inc/store/store.hxx @@ -26,11 +26,11 @@ ************************************************************************/ #ifndef _STORE_STORE_HXX_ -#define _STORE_STORE_HXX_ "$Revision: 1.5 $" +#define _STORE_STORE_HXX_ -#include <sal/types.h> -#include <rtl/ustring.hxx> -#include <store/store.h> +#include "sal/types.h" +#include "rtl/ustring.hxx" +#include "store/store.h" namespace store { @@ -45,86 +45,154 @@ class OStoreStream public: /** Construction. */ - inline OStoreStream (void) SAL_THROW(()); + inline OStoreStream (void) SAL_THROW(()) + : m_hImpl (0) + {} /** Destruction. */ - inline ~OStoreStream (void) SAL_THROW(()); + inline ~OStoreStream (void) SAL_THROW(()) + { + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + } /** Copy construction. */ - inline OStoreStream ( - const OStoreStream& rOther) SAL_THROW(()); + inline OStoreStream (OStoreStream const & rhs) SAL_THROW(()) + : m_hImpl (rhs.m_hImpl) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Assignment. */ - inline OStoreStream& operator= ( - const OStoreStream& rOther) SAL_THROW(()); - + inline OStoreStream & operator= (OStoreStream const & rhs) SAL_THROW(()) + { + if (rhs.m_hImpl) + (void) store_acquireHandle (rhs.m_hImpl); + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + m_hImpl = rhs.m_hImpl; + return *this; + } /** Construction from Stream Handle. */ - inline OStoreStream (storeStreamHandle Handle) SAL_THROW(()); + inline explicit OStoreStream (storeStreamHandle Handle) SAL_THROW(()) + : m_hImpl (Handle) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Conversion into Stream Handle. */ - inline operator storeStreamHandle (void) const SAL_THROW(()); + inline operator storeStreamHandle (void) const SAL_THROW(()) + { + return m_hImpl; + } /** Check for a valid Stream Handle. @return sal_True if valid, sal_False otherwise. */ - inline sal_Bool isValid (void) const SAL_THROW(()); - + inline bool isValid (void) const SAL_THROW(()) + { + return (m_hImpl != 0); + } /** Open the stream. @see store_openStream() */ inline storeError create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode - ) SAL_THROW(()); + storeFileHandle hFile, + rtl::OUString const & rPath, + rtl::OUString const & rName, + storeAccessMode eMode) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openStream (hFile, rPath.pData, rName.pData, eMode, &m_hImpl); + } /** Close the stream. @see store_closeStream() */ - inline void close (void) SAL_THROW(()); + inline void close (void) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_closeStream (m_hImpl); + m_hImpl = 0; + } + } /** Read from the stream. @see store_readStream() */ inline storeError readAt ( - sal_uInt32 nOffset, - void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone - ) SAL_THROW(()); + sal_uInt32 nOffset, + void * pBuffer, + sal_uInt32 nBytes, + sal_uInt32 & rnDone) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_readStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone); + } /** Write to the stream. @see store_writeStream() */ inline storeError writeAt ( - sal_uInt32 nOffset, - const void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone - ) SAL_THROW(()); + sal_uInt32 nOffset, + void const * pBuffer, + sal_uInt32 nBytes, + sal_uInt32 & rnDone) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_writeStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone); + } /** Flush the stream. @see store_flushStream() */ - inline storeError flush (void) const SAL_THROW(()); + inline storeError flush (void) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_flushStream (m_hImpl); + } /** Get the stream size. @see store_getStreamSize() */ - inline storeError getSize (sal_uInt32 &rnSize) const SAL_THROW(()); + inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_getStreamSize (m_hImpl, &rnSize); + } /** Set the stream size. @see store_setStreamSize() */ - inline storeError setSize (sal_uInt32 nSize) SAL_THROW(()); + inline storeError setSize (sal_uInt32 nSize) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_setStreamSize (m_hImpl, nSize); + } private: /** Representation. @@ -142,52 +210,91 @@ class OStoreDirectory public: /** Construction. */ - inline OStoreDirectory (void) SAL_THROW(()); + inline OStoreDirectory (void) SAL_THROW(()) + : m_hImpl (0) + {} /** Destruction. */ - inline ~OStoreDirectory (void) SAL_THROW(()); + inline ~OStoreDirectory (void) SAL_THROW(()) + { + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + } /** Copy construction. */ - inline OStoreDirectory ( - const OStoreDirectory& rOther) SAL_THROW(()); + inline OStoreDirectory (OStoreDirectory const & rhs) SAL_THROW(()) + : m_hImpl (rhs.m_hImpl) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Assignment. */ - inline OStoreDirectory& operator= ( - const OStoreDirectory& rOther) SAL_THROW(()); - + inline OStoreDirectory & operator= (OStoreDirectory const & rhs) SAL_THROW(()) + { + if (rhs.m_hImpl) + (void) store_acquireHandle (rhs.m_hImpl); + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + m_hImpl = rhs.m_hImpl; + return *this; + } /** Construction from Directory Handle. */ - inline OStoreDirectory (storeDirectoryHandle Handle) SAL_THROW(()); + inline explicit OStoreDirectory (storeDirectoryHandle Handle) SAL_THROW(()) + : m_hImpl (Handle) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Conversion into Directory Handle. */ - inline operator storeDirectoryHandle (void) const SAL_THROW(()); + inline operator storeDirectoryHandle(void) const SAL_THROW(()) + { + return m_hImpl; + } /** Check for a valid Directory Handle. @return sal_True if valid, sal_False otherwise. */ - inline sal_Bool isValid (void) const SAL_THROW(()); - + inline bool isValid (void) const SAL_THROW(()) + { + return (m_hImpl != 0); + } /** Open the directory. @see store_openDirectory() */ inline storeError create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode - ) SAL_THROW(()); + storeFileHandle hFile, + rtl::OUString const & rPath, + rtl::OUString const & rName, + storeAccessMode eMode) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openDirectory (hFile, rPath.pData, rName.pData, eMode, &m_hImpl); + } /** Close the directory. @see store_closeDirectory() */ - inline void close (void) SAL_THROW(()); - + inline void close (void) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_closeDirectory (m_hImpl); + m_hImpl = 0; + } + } /** Directory iterator type. @see first() @@ -198,12 +305,24 @@ public: /** Find first directory entry. @see store_findFirst() */ - inline storeError first (iterator& it) SAL_THROW(()); + inline storeError first (iterator& it) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_findFirst (m_hImpl, &it); + } /** Find next directory entry. @see store_findNext() */ - inline storeError next (iterator& it) SAL_THROW(()); + inline storeError next (iterator& it) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_findNext (m_hImpl, &it); + } /** Directory traversal helper. @see travel() @@ -225,7 +344,18 @@ public: @param rTraveller [in] the traversal callback. @return store_E_NoMoreFiles upon end of iteration. */ - inline storeError travel (traveller& rTraveller) const; + inline storeError travel (traveller & rTraveller) const + { + storeError eErrCode = store_E_InvalidHandle; + if (m_hImpl) + { + iterator it; + eErrCode = store_findFirst (m_hImpl, &it); + while ((eErrCode == store_E_None) && rTraveller.visit(it)) + eErrCode = store_findNext (m_hImpl, &it); + } + return eErrCode; + } private: /** Representation. @@ -243,126 +373,220 @@ class OStoreFile public: /** Construction. */ - inline OStoreFile (void) SAL_THROW(()); + inline OStoreFile (void) SAL_THROW(()) + : m_hImpl (0) + {} /** Destruction. */ - inline ~OStoreFile (void) SAL_THROW(()); + inline ~OStoreFile (void) SAL_THROW(()) + { + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + } /** Copy construction. */ - inline OStoreFile (const OStoreFile& rOther) SAL_THROW(()); + inline OStoreFile (OStoreFile const & rhs) SAL_THROW(()) + : m_hImpl (rhs.m_hImpl) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Assignment. */ - inline OStoreFile& operator= (const OStoreFile& rOther) SAL_THROW(()); - + inline OStoreFile & operator= (OStoreFile const & rhs) SAL_THROW(()) + { + if (rhs.m_hImpl) + (void) store_acquireHandle (rhs.m_hImpl); + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + m_hImpl = rhs.m_hImpl; + return *this; + } /** Construction from File Handle. */ - inline OStoreFile (storeFileHandle Handle) SAL_THROW(()); + inline explicit OStoreFile (storeFileHandle Handle) SAL_THROW(()) + : m_hImpl (Handle) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Conversion into File Handle. */ - inline operator storeFileHandle (void) const SAL_THROW(()); + inline operator storeFileHandle (void) const SAL_THROW(()) + { + return m_hImpl; + } /** Check for a valid File Handle. @return sal_True if valid, sal_False otherwise. */ - inline sal_Bool isValid (void) const SAL_THROW(()); - + inline bool isValid (void) const SAL_THROW(()) + { + return (m_hImpl != 0); + } /** Open the file. @see store_openFile() */ inline storeError create ( - const rtl::OUString &rFilename, - storeAccessMode eAccessMode, - sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE - ) SAL_THROW(()); + rtl::OUString const & rFilename, + storeAccessMode eAccessMode, + sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl); + } /** Open the temporary file in memory. @see store_createMemoryFile() */ inline storeError createInMemory ( - sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE - ) SAL_THROW(()); + sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_createMemoryFile (nPageSize, &m_hImpl); + } /** Close the file. @see store_closeFile() */ - inline void close (void) SAL_THROW(()); + inline void close (void) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_closeFile (m_hImpl); + m_hImpl = 0; + } + } /** Flush the file. @see store_flushFile() */ - inline storeError flush (void) const SAL_THROW(()); + inline storeError flush (void) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_flushFile (m_hImpl); + } /** Get the number of referers to the file. @see store_getFileRefererCount() */ - inline storeError getRefererCount ( - sal_uInt32 &rnRefCount) const SAL_THROW(()); + inline storeError getRefererCount (sal_uInt32 & rnRefCount) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_getFileRefererCount (m_hImpl, &rnRefCount); + } /** Get the file size. @see store_getFileSize() */ - inline storeError getSize ( - sal_uInt32 &rnSize) const SAL_THROW(()); + inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + return store_getFileSize (m_hImpl, &rnSize); + } /** Set attributes of a file entry. @see store_attrib() */ inline storeError attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2, - sal_uInt32 &rnAttrib - ) SAL_THROW(()); + rtl::OUString const & rPath, + rtl::OUString const & rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2, + sal_uInt32 & rnAttrib) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib); + } /** Set attributes of a file entry. @see store_attrib() */ inline storeError attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2 - ) SAL_THROW(()); + rtl::OUString const & rPath, + rtl::OUString const & rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL); + } /** Insert a file entry as 'hard link' to another file entry. @see store_link() */ inline storeError link ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName - ) SAL_THROW(()); + rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName, + rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_link ( + m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData); + } /** Insert a file entry as 'symbolic link' to another file entry. @see store_symlink() */ inline storeError symlink ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName - ) SAL_THROW(()); + rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName, + rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_symlink (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData); + } /** Rename a file entry. @see store_rename() */ inline storeError rename ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName - ) SAL_THROW(()); + rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName, + rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_rename (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData); + } /** Remove a file entry. @see store_remove() */ inline storeError remove ( - const rtl::OUString &rPath, - const rtl::OUString &rName - ) SAL_THROW(()); + rtl::OUString const & rPath, rtl::OUString const & rName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_remove (m_hImpl, rPath.pData, rName.pData); + } private: /** Representation. @@ -376,8 +600,6 @@ private: * *======================================================================*/ -#include <store/store.inl> - } // namespace store #endif /* !_STORE_STORE_HXX_ */ diff --git a/store/inc/store/store.inl b/store/inc/store/store.inl deleted file mode 100644 index 91866c7311da..000000000000 --- a/store/inc/store/store.inl +++ /dev/null @@ -1,451 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#define _STORE_STORE_INL_ "$Revision: 1.4 $" - -/*======================================================================== - * - * OStoreStream implementation. - * - *======================================================================*/ -inline OStoreStream::OStoreStream (void) SAL_THROW(()) - : m_hImpl (0) -{ -} - -inline OStoreStream::~OStoreStream (void) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); -} - -inline OStoreStream::OStoreStream ( - const OStoreStream& rOther) SAL_THROW(()) - : m_hImpl (rOther.m_hImpl) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreStream& OStoreStream::operator= ( - const OStoreStream& rOther) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; - if (m_hImpl) - store_acquireHandle (m_hImpl); - return *this; -} - -inline OStoreStream::OStoreStream ( - storeStreamHandle Handle) SAL_THROW(()) - : m_hImpl (Handle) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreStream::operator storeStreamHandle (void) const SAL_THROW(()) -{ - return m_hImpl; -} - -inline sal_Bool OStoreStream::isValid (void) const SAL_THROW(()) -{ - return (!!m_hImpl); -} - -inline storeError OStoreStream::create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_openStream ( - hFile, rPath.pData, rName.pData, eMode, &m_hImpl); -} - -inline void OStoreStream::close (void) SAL_THROW(()) -{ - if (m_hImpl) - { - store_closeStream (m_hImpl); - m_hImpl = 0; - } -} - -inline storeError OStoreStream::readAt ( - sal_uInt32 nOffset, - void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_readStream ( - m_hImpl, nOffset, pBuffer, nBytes, &rnDone); -} - -inline storeError OStoreStream::writeAt ( - sal_uInt32 nOffset, - const void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_writeStream ( - m_hImpl, nOffset, pBuffer, nBytes, &rnDone); -} - -inline storeError OStoreStream::flush (void) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_flushStream (m_hImpl); -} - -inline storeError OStoreStream::getSize ( - sal_uInt32 &rnSize) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_getStreamSize (m_hImpl, &rnSize); -} - -inline storeError OStoreStream::setSize ( - sal_uInt32 nSize) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_setStreamSize (m_hImpl, nSize); -} - -/*======================================================================== - * - * OStoreDirectory implementation. - * - *======================================================================*/ -inline OStoreDirectory::OStoreDirectory (void) SAL_THROW(()) - : m_hImpl (0) -{ -} - -inline OStoreDirectory::~OStoreDirectory (void) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); -} - -inline OStoreDirectory::OStoreDirectory ( - const OStoreDirectory& rOther) SAL_THROW(()) - : m_hImpl (rOther.m_hImpl) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreDirectory& OStoreDirectory::operator= ( - const OStoreDirectory& rOther) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; - if (m_hImpl) - store_acquireHandle (m_hImpl); - return *this; -} - -inline OStoreDirectory::OStoreDirectory ( - storeDirectoryHandle Handle) SAL_THROW(()) - : m_hImpl (Handle) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreDirectory::operator storeDirectoryHandle(void) const SAL_THROW(()) -{ - return m_hImpl; -} - -inline sal_Bool OStoreDirectory::isValid (void) const SAL_THROW(()) -{ - return (!!m_hImpl); -} - -inline storeError OStoreDirectory::create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_openDirectory ( - hFile, rPath.pData, rName.pData, eMode, &m_hImpl); -} - -inline void OStoreDirectory::close (void) SAL_THROW(()) -{ - if (m_hImpl) - { - store_closeDirectory (m_hImpl); - m_hImpl = 0; - } -} - -inline storeError OStoreDirectory::first (iterator& it) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_findFirst (m_hImpl, &it); -} - -inline storeError OStoreDirectory::next (iterator& it) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_findNext (m_hImpl, &it); -} - -inline storeError OStoreDirectory::travel (traveller& rTraveller) const -{ - storeError eErrCode = store_E_InvalidHandle; - if (m_hImpl) - { - iterator it; - eErrCode = store_findFirst (m_hImpl, &it); - while ((eErrCode == store_E_None) && rTraveller.visit(it)) - eErrCode = store_findNext (m_hImpl, &it); - } - return eErrCode; -} - -/*======================================================================== - * - * OStoreFile implementation. - * - *======================================================================*/ -inline OStoreFile::OStoreFile (void) SAL_THROW(()) - : m_hImpl (0) -{ -} - -inline OStoreFile::~OStoreFile (void) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); -} - -inline OStoreFile::OStoreFile ( - const OStoreFile& rOther) SAL_THROW(()) - : m_hImpl (rOther.m_hImpl) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreFile& OStoreFile::operator= ( - const OStoreFile& rOther) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; - if (m_hImpl) - store_acquireHandle (m_hImpl); - return *this; -} - -inline OStoreFile::OStoreFile ( - storeFileHandle Handle) SAL_THROW(()) - : m_hImpl (Handle) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreFile::operator storeFileHandle (void) const SAL_THROW(()) -{ - return m_hImpl; -} - -inline sal_Bool OStoreFile::isValid (void) const SAL_THROW(()) -{ - return (!!m_hImpl); -} - -inline storeError OStoreFile::create ( - const rtl::OUString &rFilename, - storeAccessMode eAccessMode, - sal_uInt16 nPageSize) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl); -} - -inline storeError OStoreFile::createInMemory ( - sal_uInt16 nPageSize) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_createMemoryFile (nPageSize, &m_hImpl); -} - -inline void OStoreFile::close (void) SAL_THROW(()) -{ - if (m_hImpl) - { - store_closeFile (m_hImpl); - m_hImpl = 0; - } -} - -inline storeError OStoreFile::flush (void) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_flushFile (m_hImpl); -} - -inline storeError OStoreFile::getRefererCount ( - sal_uInt32 &rnRefCount) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_getFileRefererCount (m_hImpl, &rnRefCount); -} - -inline storeError OStoreFile::getSize ( - sal_uInt32 &rnSize) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_getFileSize (m_hImpl, &rnSize); -} - -inline storeError OStoreFile::attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2, - sal_uInt32 &rnAttrib) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_attrib ( - m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib); -} - -inline storeError OStoreFile::attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_attrib ( - m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL); -} - -inline storeError OStoreFile::link ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_link ( - m_hImpl, - rSrcPath.pData, rSrcName.pData, - rDstPath.pData, rDstName.pData); -} - -inline storeError OStoreFile::symlink ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_symlink ( - m_hImpl, - rSrcPath.pData, rSrcName.pData, - rDstPath.pData, rDstName.pData); -} - -inline storeError OStoreFile::rename ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_rename ( - m_hImpl, - rSrcPath.pData, rSrcName.pData, - rDstPath.pData, rDstName.pData); -} - -inline storeError OStoreFile::remove ( - const rtl::OUString &rPath, const rtl::OUString &rName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_remove (m_hImpl, rPath.pData, rName.pData); -} - diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index 795b720e0632..f1145a029c29 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -148,40 +148,6 @@ storeError ILockBytes::flush() return flush_Impl(); } -storeError ILockBytes::lockRange (sal_uInt32 nOffset, sal_uInt32 nBytes) -{ - OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::lockRange(): invalid Offset"); - if (nOffset == STORE_PAGE_NULL) - return store_E_CantSeek; - - sal_uInt64 size = nOffset + nBytes; - if (size > SAL_MAX_UINT32) - return store_E_CantSeek; - -#ifdef STORE_FEATURE_LOCKING - return lockRange_Impl (nOffset, nBytes); -#else - return store_E_None; // E_Unsupported -#endif /* STORE_FEATURE_LOCKING */ -} - -storeError ILockBytes::unlockRange (sal_uInt32 nOffset, sal_uInt32 nBytes) -{ - OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::unlockRange(): invalid Offset"); - if (nOffset == STORE_PAGE_NULL) - return store_E_CantSeek; - - sal_uInt64 size = nOffset + nBytes; - if (size > SAL_MAX_UINT32) - return store_E_CantSeek; - -#ifdef STORE_FEATURE_LOCKING - return unlockRange_Impl (nOffset, nBytes); -#else - return store_E_None; // E_Unsupported -#endif /* STORE_FEATURE_LOCKING */ -} - /*======================================================================== * * FileLockBytes implementation. diff --git a/store/source/lockbyte.hxx b/store/source/lockbyte.hxx index bbaf92c4ae99..ef34b8708f26 100644 --- a/store/source/lockbyte.hxx +++ b/store/source/lockbyte.hxx @@ -120,26 +120,6 @@ public: */ storeError flush(); - /** - @param nOffset [in] - @param nBytes [in] - @return store_E_None upon success - store_E_LockingViolation - */ - storeError lockRange ( - sal_uInt32 nOffset, - sal_uInt32 nBytes); - - /** - @param nOffset [in] - @param nBytes [in] - @return store_E_None upon success - store_E_LockingViolation - */ - storeError unlockRange ( - sal_uInt32 nOffset, - sal_uInt32 nBytes); - private: /** Implementation (abstract). */ @@ -172,16 +152,6 @@ private: sal_uInt32 nSize) = 0; virtual storeError flush_Impl() = 0; - -#ifdef STORE_FEATURE_LOCKING - virtual storeError lockRange_Impl ( - sal_uInt32 nOffset, - sal_uInt32 nBytes) = 0; - - virtual storeError unlockRange_Impl ( - sal_uInt32 nOffset, - sal_uInt32 nBytes) = 0; -#endif /* STORE_FEATURE_LOCKING */ }; /*======================================================================== diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index 0a489c1ee29f..9c1e4ea985bf 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -553,13 +553,6 @@ struct PageData /** guard (external representation). */ - void guard() - { - sal_uInt32 nCRC32 = 0; - nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); - nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G)); - m_aGuard.m_nCRC32 = store::htonl(nCRC32); - } void guard (sal_uInt32 nAddr) { sal_uInt32 nCRC32 = 0; @@ -571,16 +564,6 @@ struct PageData /** verify (external representation). */ - storeError verify() const - { - sal_uInt32 nCRC32 = 0; - nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); - nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G)); - if (m_aGuard.m_nCRC32 != store::htonl(nCRC32)) - return store_E_InvalidChecksum; - else - return store_E_None; - } storeError verify (sal_uInt32 nAddr) const { sal_uInt32 nCRC32 = 0; diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 6f1a5cde0340..d2612d60b3db 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -83,36 +83,36 @@ struct OStoreSuperBlock m_aUnused (0) {} - OStoreSuperBlock (const OStoreSuperBlock& rOther) - : m_aGuard (rOther.m_aGuard), - m_aDescr (rOther.m_aDescr), - m_nMarked (rOther.m_nMarked), - m_aMarked (rOther.m_aMarked), - m_nUnused (rOther.m_nUnused), - m_aUnused (rOther.m_aUnused) + OStoreSuperBlock (const OStoreSuperBlock & rhs) + : m_aGuard (rhs.m_aGuard), + m_aDescr (rhs.m_aDescr), + m_nMarked (rhs.m_nMarked), + m_aMarked (rhs.m_aMarked), + m_nUnused (rhs.m_nUnused), + m_aUnused (rhs.m_aUnused) {} - OStoreSuperBlock& operator= (const OStoreSuperBlock& rOther) + OStoreSuperBlock& operator= (const OStoreSuperBlock & rhs) { - m_aGuard = rOther.m_aGuard; - m_aDescr = rOther.m_aDescr; - m_nMarked = rOther.m_nMarked; - m_aMarked = rOther.m_aMarked; - m_nUnused = rOther.m_nUnused; - m_aUnused = rOther.m_aUnused; + m_aGuard = rhs.m_aGuard; + m_aDescr = rhs.m_aDescr; + m_nMarked = rhs.m_nMarked; + m_aMarked = rhs.m_aMarked; + m_nUnused = rhs.m_nUnused; + m_aUnused = rhs.m_aUnused; return *this; } /** Comparison. */ - sal_Bool operator== (const OStoreSuperBlock& rOther) const + sal_Bool operator== (const OStoreSuperBlock & rhs) const { - return ((m_aGuard == rOther.m_aGuard ) && - (m_aDescr == rOther.m_aDescr ) && - (m_nMarked == rOther.m_nMarked) && - (m_aMarked == rOther.m_aMarked) && - (m_nUnused == rOther.m_nUnused) && - (m_aUnused == rOther.m_aUnused) ); + return ((m_aGuard == rhs.m_aGuard ) && + (m_aDescr == rhs.m_aDescr ) && + (m_nMarked == rhs.m_nMarked) && + (m_aMarked == rhs.m_aMarked) && + (m_nUnused == rhs.m_nUnused) && + (m_aUnused == rhs.m_aUnused) ); } /** unused(Count|Head|Insert|Remove|Reset). @@ -173,94 +173,24 @@ struct OStoreSuperBlock /*======================================================================== * - * OStoreStateBlock. - * - *======================================================================*/ -struct OStoreStateBlock -{ - enum StateBits - { - STATE_CLEAN = 0, - STATE_CLOSE_WAIT = 1, - STATE_FLUSH_WAIT = 2 - }; - - /** Representation. - */ - sal_uInt32 m_nState; - - /** theSize. - */ - static const size_t theSize = sizeof(sal_uInt32); - - /** Construction. - */ - OStoreStateBlock() - : m_nState (store::htonl(STATE_CLEAN)) - {} - - /** Operation. - */ - bool closePending (void) const - { - sal_uInt32 nState = store::ntohl(m_nState); - return ((nState & STATE_CLOSE_WAIT) == STATE_CLOSE_WAIT); - } - void closed (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState &= ~STATE_CLOSE_WAIT; - m_nState = store::htonl(nState); - } - - bool flushPending (void) const - { - sal_uInt32 nState = store::ntohl(m_nState); - return ((nState & STATE_FLUSH_WAIT) == STATE_FLUSH_WAIT); - } - void flushed (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState &= ~STATE_FLUSH_WAIT; - m_nState = store::htonl(nState); - } - - void modified (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState |= (STATE_CLOSE_WAIT | STATE_FLUSH_WAIT); - m_nState = store::htonl(nState); - } - void clean (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState &= ~(STATE_CLOSE_WAIT | STATE_FLUSH_WAIT); - m_nState = store::htonl(nState); - } -}; - -/*======================================================================== - * - * OStoreSuperBlockPage interface. + * SuperBlockPage interface. * *======================================================================*/ namespace store { -struct OStoreSuperBlockPage +struct SuperBlockPage { typedef OStoreSuperBlock SuperBlock; - typedef OStoreStateBlock StateBlock; /** Representation. */ SuperBlock m_aSuperOne; SuperBlock m_aSuperTwo; - StateBlock m_aState; /** theSize. */ - static const size_t theSize = 2 * SuperBlock::theSize + StateBlock::theSize; + static const size_t theSize = 2 * SuperBlock::theSize; static const sal_uInt16 thePageSize = theSize; STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= thePageSize); @@ -286,147 +216,138 @@ struct OStoreSuperBlockPage /** Construction. */ - explicit OStoreSuperBlockPage (sal_uInt16 nPageSize = thePageSize) + explicit SuperBlockPage (sal_uInt16 nPageSize = thePageSize) : m_aSuperOne(nPageSize), - m_aSuperTwo(nPageSize), - m_aState() + m_aSuperTwo(nPageSize) {} - /** guard (external representation). - */ - void guard() - { - m_aSuperOne.guard(); - m_aSuperTwo.guard(); - } - /** save. */ - storeError save (OStorePageBIOS &rBIOS) + storeError save (OStorePageBIOS & rBIOS, sal_uInt32 nSize = theSize) { - // Guard. - guard(); - - // Write. - return rBIOS.write (0, this, theSize); + m_aSuperOne.guard(); + m_aSuperTwo = m_aSuperOne; + return rBIOS.write (0, this, nSize); } - /** close. + /** Page allocation. */ - storeError close ( - OStorePageBIOS &rBIOS); + storeError unusedHead ( + OStorePageBIOS & rBIOS, + PageData & rPageHead); - /** flush. - */ - storeError flush ( - OStorePageBIOS &rBIOS); + storeError unusedPop ( + OStorePageBIOS & rBIOS, + PageData const & rPageHead); - /** modified. - */ - storeError modified ( - OStorePageBIOS &rBIOS); + storeError unusedPush ( + OStorePageBIOS & rBIOS, + sal_uInt32 nAddr); /** verify (with repair). */ - storeError verify ( - OStorePageBIOS &rBIOS); + storeError verify (OStorePageBIOS & rBIOS); }; } // namespace store /*======================================================================== * - * OStoreSuperBlockPage implementation. + * SuperBlockPage implementation. * *======================================================================*/ /* - * close. + * unusedHead(): get freelist head (alloc page, step 1). */ -storeError OStoreSuperBlockPage::close (OStorePageBIOS &rBIOS) +storeError SuperBlockPage::unusedHead (OStorePageBIOS & rBIOS, PageData & rPageHead) { - storeError eErrCode = store_E_None; - if (m_aState.closePending()) + storeError eErrCode = verify (rBIOS); + if (eErrCode != store_E_None) + return eErrCode; + + // Check freelist head. + OStorePageLink const aListHead (m_aSuperOne.unusedHead()); + if (aListHead.location() == 0) { - // Mark as modified. - m_aState.modified(); + // Freelist empty, see SuperBlock::ctor(). + rPageHead.location (STORE_PAGE_NULL); + return store_E_None; + } - // Check access mode. - if (rBIOS.isWriteable()) - { - // Save StateBlock. - StateBlock aState (m_aState); + // Load PageHead. + eErrCode = rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize); + if (eErrCode != store_E_None) + return eErrCode; - // Mark as clean. - aState.clean(); + eErrCode = rPageHead.verify (aListHead.location()); + if (eErrCode != store_E_None) + return eErrCode; - // Write behind SuperBlock. - sal_uInt32 nAddr = 2 * SuperBlock::theSize; - eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize); - } + // Verify page is unused. + sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); + OSL_POSTCOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedHead(): page not free"); + if (nAddr == STORE_PAGE_NULL) + { + // Page in use. + rPageHead.location (STORE_PAGE_NULL); - // Mark as clean. - m_aState.clean(); + // Recovery: Reset freelist to empty. + m_aSuperOne.unusedReset(); + eErrCode = save (rBIOS); } return eErrCode; } /* - * flush. + * unusedPop(): pop freelist head (alloc page, step 2). */ -storeError OStoreSuperBlockPage::flush (OStorePageBIOS &rBIOS) +storeError SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead) { - storeError eErrCode = store_E_None; - if (m_aState.flushPending()) - { - // Check access mode. - if (rBIOS.isWriteable()) - { - // Save StateBlock. - StateBlock aState (m_aState); - - // Mark as flushed. - aState.flushed(); - - // Write behind SuperBlock. - sal_uInt32 nAddr = 2 * SuperBlock::theSize; - eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize); - } - - // Mark as flushed. - m_aState.flushed(); - } - return eErrCode; + sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); + OSL_PRECOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedPop(): page not free"); + if (nAddr == STORE_PAGE_NULL) + return store_E_CantSeek; + + // Pop from FreeList. + OStorePageLink const aListHead (nAddr); + m_aSuperOne.unusedRemove (aListHead); + return save (rBIOS); } /* - * modified. + * unusedPush(): push new freelist head. */ -storeError OStoreSuperBlockPage::modified (OStorePageBIOS &rBIOS) +storeError SuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr) { - storeError eErrCode = store_E_None; - if (!m_aState.flushPending()) - { - // Mark as modified. - m_aState.modified(); + storeError eErrCode = verify (rBIOS); + if (eErrCode != store_E_None) + return eErrCode; - // Check access mode. - if (rBIOS.isWriteable()) - { - // Save StateBlock. - StateBlock aState (m_aState); + PageData aPageHead; + eErrCode = rBIOS.read (nAddr, &aPageHead, PageData::theSize); + if (eErrCode != store_E_None) + return eErrCode; - // Write behind SuperBlock. - sal_uInt32 nAddr = 2 * SuperBlock::theSize; - eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize); - } - } - return eErrCode; + eErrCode = aPageHead.verify (nAddr); + if (eErrCode != store_E_None) + return eErrCode; + + aPageHead.m_aUnused = m_aSuperOne.unusedHead(); + aPageHead.guard (nAddr); + + eErrCode = rBIOS.write (nAddr, &aPageHead, PageData::theSize); + if (eErrCode != store_E_None) + return eErrCode; + + OStorePageLink const aListHead (nAddr); + m_aSuperOne.unusedInsert(aListHead); + return save (rBIOS); } /* * verify (with repair). */ -storeError OStoreSuperBlockPage::verify (OStorePageBIOS &rBIOS) +storeError SuperBlockPage::verify (OStorePageBIOS & rBIOS) { // Verify 1st copy. storeError eErrCode = m_aSuperOne.verify(); @@ -636,8 +557,7 @@ OStorePageBIOS::AceCache::destroy (OStorePageBIOS::Ace * ace) OStorePageBIOS::OStorePageBIOS (void) : m_xLockBytes (NULL), m_pSuper (NULL), - m_bModified (sal_False), - m_bWriteable (sal_False) + m_bWriteable (false) { } @@ -646,158 +566,63 @@ OStorePageBIOS::OStorePageBIOS (void) */ OStorePageBIOS::~OStorePageBIOS (void) { - OStorePageBIOS::close(); -} - -/* - * verify (SuperBlock with repair). - * Internal: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::verify (SuperPage *&rpSuper) -{ - // Check SuperBlock page allocation. - if (rpSuper == 0) - { - // Allocate. - if ((rpSuper = new SuperPage()) == 0) - return store_E_OutOfMemory; - - // Load (w/o verification). - storeError eErrCode = read (0, rpSuper, SuperPage::theSize); - if (eErrCode != store_E_None) - { - // Cleanup and fail. - delete rpSuper, rpSuper = 0; - return eErrCode; - } - - // Check SuperBlock state. - if (rpSuper->m_aState.closePending()) - OSL_TRACE("OStorePageBIOS::verify(): close pending.\n"); - - if (rpSuper->m_aState.flushPending()) - OSL_TRACE("OStorePageBIOS::verify(): flush pending.\n"); - } - - // Verify SuperBlock page (with repair). - return rpSuper->verify (*this); -} - -/* - * repair (SuperBlock). - * Internal: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::repair (SuperPage *&rpSuper) -{ - // Acquire Lock. - storeError eErrCode = acquireLock (0, SuperPage::theSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Verify SuperBlock page (with repair). - eErrCode = verify (rpSuper); - if (eErrCode != store_E_None) - { - // Failure. - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - - // ReleaseLock. - return releaseLock (0, SuperPage::theSize); + cleanup_Impl(); } /* - * create (SuperBlock). - * Internal: Precond: initialized, exclusive access. + * initialize. + * Precond: none. */ -storeError OStorePageBIOS::create (sal_uInt16 nPageSize) +storeError OStorePageBIOS::initialize ( + ILockBytes * pLockBytes, + storeAccessMode eAccessMode, + sal_uInt16 & rnPageSize) { - // Check (internal) precond. - OSL_PRECOND(m_xLockBytes.is(), "store::PageBIOS::create(): contract violation"); - - // Check PageSize. - if ((STORE_MINIMUM_PAGESIZE > nPageSize) || (nPageSize > STORE_MAXIMUM_PAGESIZE)) - return store_E_InvalidParameter; - nPageSize = ((nPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); - - // Acquire Lock. - storeError eErrCode = acquireLock (0, nPageSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Allocate SuperBlock page. - delete m_pSuper, m_pSuper = 0; - if ((m_pSuper = new(nPageSize) SuperPage(nPageSize)) == 0) - { - // Cleanup and fail. - releaseLock (0, nPageSize); - return store_E_OutOfMemory; - } - m_pSuper->guard(); + // Acquire exclusive access. + osl::MutexGuard aGuard (m_aMutex); - // Create initial page (w/ SuperBlock). - eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize); + // Initialize. + storeError eErrCode = initialize_Impl (pLockBytes, eAccessMode, rnPageSize); if (eErrCode != store_E_None) { - // Cleanup and fail. - releaseLock (0, nPageSize); - return eErrCode; + // Cleanup. + cleanup_Impl(); } - -#ifdef STORE_FEATURE_COMMIT - // Commit. - eErrCode = m_xLockBytes->flush(); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::create(): flush failed"); -#endif /* STORE_FEATURE_COMMIT */ - - // Adjust modified state. - m_bModified = (eErrCode != store_E_None); - - // Release Lock and finish. - return releaseLock (0, nPageSize); + return eErrCode; } /* - * initialize. - * Precond: none. + * initialize_Impl. + * Internal: Precond: exclusive access. */ -storeError OStorePageBIOS::initialize ( +storeError OStorePageBIOS::initialize_Impl ( ILockBytes * pLockBytes, storeAccessMode eAccessMode, sal_uInt16 & rnPageSize) { - // Acquire exclusive access. - osl::MutexGuard aGuard (m_aMutex); - - // Check arguments. - storeError eErrCode = store_E_InvalidParameter; - if (!pLockBytes) - return eErrCode; - // Cleanup. -#if 0 /* OLD */ - __STORE_DELETEZ (m_pAcl); /* @@@ */ -#endif /* OLD */ - delete m_pSuper, m_pSuper = 0; + cleanup_Impl(); // Initialize. m_xLockBytes = pLockBytes; - m_bModified = sal_False; - m_bWriteable = (!(eAccessMode == store_AccessReadOnly)); + if (!m_xLockBytes.is()) + return store_E_InvalidParameter; + m_bWriteable = (eAccessMode != store_AccessReadOnly); // Check access mode. - if (eAccessMode == store_AccessReadOnly) - { - // Verify SuperBlock page. - eErrCode = verify (m_pSuper); - } - else if (eAccessMode != store_AccessCreate) + storeError eErrCode = store_E_None; + if (eAccessMode != store_AccessCreate) { - // Verify (w/ repair) SuperBlock page. - eErrCode = repair (m_pSuper); + // Load SuperBlock page. + if ((m_pSuper = new SuperBlockPage()) == 0) + return store_E_OutOfMemory; + + eErrCode = read (0, m_pSuper, SuperBlockPage::theSize); + if (eErrCode == store_E_None) + { + // Verify SuperBlock page (with repair). + eErrCode = m_pSuper->verify (*this); + } } else { @@ -806,13 +631,6 @@ storeError OStorePageBIOS::initialize ( if (eErrCode != store_E_None) return eErrCode; -#ifdef STORE_FEATURE_COMMIT - // Commit. - eErrCode = m_xLockBytes->flush(); - if (eErrCode != store_E_None) - return eErrCode; -#endif /* STORE_FEATURE_COMMIT */ - // Mark as not existing. eErrCode = store_E_NotExists; } @@ -829,14 +647,18 @@ storeError OStorePageBIOS::initialize ( if (eAccessMode == store_AccessReadWrite) return store_E_NotExists; - // Create SuperBlock page. - eErrCode = create (rnPageSize); + // Check PageSize. + if ((STORE_MINIMUM_PAGESIZE > rnPageSize) || (rnPageSize > STORE_MAXIMUM_PAGESIZE)) + return store_E_InvalidParameter; + rnPageSize = ((rnPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); + + // Create initial page (w/ SuperBlock). + if ((m_pSuper = new(rnPageSize) SuperBlockPage(rnPageSize)) == 0) + return store_E_OutOfMemory; + eErrCode = m_pSuper->save (*this, rnPageSize); } if (eErrCode == store_E_None) { - // Obtain modified state. - m_bModified = m_pSuper->m_aState.flushPending(); - // Obtain page size. rnPageSize = store::ntohs(m_pSuper->m_aSuperOne.m_aDescr.m_nSize); @@ -852,33 +674,35 @@ storeError OStorePageBIOS::initialize ( } /* - * acquireLock. - * Low Level: Precond: initialized, exclusive access. + * cleanup_Impl. + * Internal: Precond: exclusive access. */ -storeError OStorePageBIOS::acquireLock ( - sal_uInt32 nAddr, sal_uInt32 nSize) +void OStorePageBIOS::cleanup_Impl() { - // Check precond. - if (!m_xLockBytes.is()) - return store_E_InvalidAccess; + // Check referer count. + if (m_ace_head.m_used > 0) + { + // Report remaining referer count. + OSL_TRACE("store::PageBIOS::cleanup_Impl(): referer count: %d\n", m_ace_head.m_used); + for (Ace * ace = m_ace_head.m_next; ace != &m_ace_head; ace = m_ace_head.m_next) + { + m_ace_head.m_used -= ace->m_used; + AceCache::get().destroy (ace); + } + OSL_ENSURE(m_ace_head.m_used == 0, "store::PageBIOS::cleanup_Impl(): logic error"); + } - // Acquire Lock. - return m_xLockBytes->lockRange (nAddr, nSize); -} + // Release SuperBlock page. + delete m_pSuper, m_pSuper = 0; -/* - * releaseLock. - * Low Level: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::releaseLock ( - sal_uInt32 nAddr, sal_uInt32 nSize) -{ - // Check precond. - if (!m_xLockBytes.is()) - return store_E_InvalidAccess; + // Release PageCache. + m_xCache.clear(); + + // Release PageAllocator. + m_xAllocator.clear(); - // Release Lock. - return m_xLockBytes->unlockRange (nAddr, nSize); + // Release LockBytes. + m_xLockBytes.clear(); } /* @@ -892,7 +716,7 @@ storeError OStorePageBIOS::read ( if (!m_xLockBytes.is()) return store_E_InvalidAccess; - // Read Page. + // Read Data. return m_xLockBytes->readAt (nAddr, pData, nSize); } @@ -909,18 +733,6 @@ storeError OStorePageBIOS::write ( if (!m_bWriteable) return store_E_AccessViolation; - // Check modified state. - if (!m_bModified) - { - // Mark as modified. - m_bModified = sal_True; - - // Mark SuperBlock modified. - storeError eErrCode = m_pSuper->modified (*this); - if (eErrCode != store_E_None) - return eErrCode; - } - // Write Data. return m_xLockBytes->writeAt (nAddr, pData, nSize); } @@ -1026,160 +838,44 @@ storeError OStorePageBIOS::allocate ( if (!m_bWriteable) return store_E_AccessViolation; - // Acquire SuperBlock Lock. - storeError eErrCode = acquireLock (0, SuperPage::theSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Load SuperBlock and require good health. - eErrCode = verify (m_pSuper); - if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - - // Check allocation. + // Check allocation type. + storeError eErrCode = store_E_None; if (eAlloc != ALLOCATE_EOF) { - // Check FreeList. - OStorePageLink aListHead (m_pSuper->m_aSuperTwo.unusedHead()); - if (aListHead.location()) - { - // Allocate from FreeList. - OStorePageData aPageHead (OStorePageData::theSize); - aPageHead.location (aListHead.location()); - - // Load PageHead. - eErrCode = peek (aPageHead); - if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - - // Verify FreeList head. - OSL_PRECOND( - aPageHead.m_aUnused.m_nAddr != STORE_PAGE_NULL, - "OStorePageBIOS::allocate(): page not free"); - if (aPageHead.m_aUnused.location() == STORE_PAGE_NULL) - { - // Recovery: Reset FreeList. - m_pSuper->m_aSuperTwo.unusedReset(); - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; - - // Save SuperBlock page. - eErrCode = m_pSuper->save (*this); - - // Release SuperBlock Lock. - releaseLock (0, SuperPage::theSize); - - // Recovery: Allocate from EOF. - if (eErrCode == store_E_None) - return allocate (rPage, ALLOCATE_EOF); - else - return store_E_Unknown; - } - - // Pop from FreeList. - aListHead = aPageHead.m_aUnused.location(); - rPage.get()->m_aUnused = STORE_PAGE_NULL; - - // Save page at PageHead location. - eErrCode = saveObjectAt_Impl (rPage, aPageHead.location()); - if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - - // Save SuperBlock page. - m_pSuper->m_aSuperTwo.unusedRemove (aListHead); - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; - - eErrCode = m_pSuper->save (*this); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::allocate(): SuperBlock save failed"); - - // Release SuperBlock Lock and finish. - return releaseLock (0, SuperPage::theSize); - } - } - - // Allocate from logical EOF. Determine physical EOF. - sal_uInt32 nPhysLen = STORE_PAGE_NULL; - eErrCode = m_xLockBytes->getSize (nPhysLen); - if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - - // Obtain logical EOF. - OStorePageDescriptor aDescr (m_pSuper->m_aSuperTwo.m_aDescr); - sal_uInt32 nLogLen = store::ntohl(aDescr.m_nAddr); - if (nLogLen == 0) - nLogLen = nPhysLen; /* backward compatibility */ + // Try freelist head. + PageData aPageHead; + eErrCode = m_pSuper->unusedHead (*this, aPageHead); + if (eErrCode != store_E_None) + return eErrCode; - if (!(nLogLen < nPhysLen)) - { - // Check modified state. - if (!m_bModified) + sal_uInt32 const nAddr = aPageHead.location(); + if (nAddr != STORE_PAGE_NULL) { - // Mark modified. - m_bModified = sal_True; - - // Mark SuperBlock modified. - eErrCode = m_pSuper->modified (*this); + // Save page. + eErrCode = saveObjectAt_Impl (rPage, nAddr); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } - } - - // Resize. - sal_uInt32 nAlign = SAL_MIN (nPhysLen, STORE_MAXIMUM_PAGESIZE); - nPhysLen = ((nPhysLen + nAlign) / nAlign) * nAlign; - eErrCode = m_xLockBytes->setSize (nPhysLen); - if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); - return eErrCode; + // Pop freelist head and finish. + return m_pSuper->unusedPop (*this, aPageHead); } } - // Save page at logical EOF. - eErrCode = saveObjectAt_Impl (rPage, nLogLen); + // Allocate from EOF. Determine current size. + sal_uInt32 nSize = STORE_PAGE_NULL; + eErrCode = m_xLockBytes->getSize (nSize); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } - - // Save SuperBlock page. - nLogLen += store::ntohs(aDescr.m_nSize); - aDescr.m_nAddr = store::htonl(nLogLen); - - m_pSuper->m_aSuperTwo.m_aDescr = aDescr; - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; - eErrCode = m_pSuper->save (*this); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::allocate(): SuperBlock save failed"); - - // Release SuperBlock Lock and finish. - return releaseLock (0, SuperPage::theSize); + // Save page at current EOF. + return saveObjectAt_Impl (rPage, nSize); } /* * free. * Precond: initialized, writeable. */ -storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) +storeError OStorePageBIOS::free (sal_uInt32 nAddr) { // Acquire exclusive access. osl::MutexGuard aGuard (m_aMutex); @@ -1190,58 +886,11 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) if (!m_bWriteable) return store_E_AccessViolation; - // Acquire SuperBlock Lock. - storeError eErrCode = acquireLock (0, SuperPage::theSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Load SuperBlock and require good health. - eErrCode = verify (m_pSuper); - if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - - // Load PageHead. - OStorePageData aPageHead(OStorePageData::theSize); - aPageHead.location (nAddr); - - eErrCode = peek (aPageHead); - if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - // Invalidate cache. (void) m_xCache->removePageAt (nAddr); - // Push onto FreeList. - OStorePageLink aListHead (m_pSuper->m_aSuperTwo.unusedHead()); - - aPageHead.m_aUnused.m_nAddr = aListHead.m_nAddr; - aListHead.m_nAddr = aPageHead.m_aDescr.m_nAddr; - - // Save PageHead. - eErrCode = poke (aPageHead); - if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - - // Save SuperBlock page. - m_pSuper->m_aSuperTwo.unusedInsert (aListHead); - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; - - eErrCode = m_pSuper->save (*this); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::free(): SuperBlock save failed"); - - // Release SuperBlock Lock and finish. - return releaseLock (0, SuperPage::theSize); + // Push onto freelist. + return m_pSuper->unusedPush (*this, nAddr); } /* @@ -1333,57 +982,16 @@ storeError OStorePageBIOS::saveObjectAt_Impl (OStorePageObject & rPage, sal_uInt * close. * Precond: none. */ -storeError OStorePageBIOS::close (void) +storeError OStorePageBIOS::close() { // Acquire exclusive access. osl::MutexGuard aGuard (m_aMutex); - // Check referer count. - if (m_ace_head.m_used > 0) - { - // Report remaining referer count. - OSL_TRACE("store::PageBIOS::close(): referer count: %d\n", m_ace_head.m_used); -#if 1 /* NEW */ - for (Ace * ace = m_ace_head.m_next; ace != &m_ace_head; ace = m_ace_head.m_next) - { - m_ace_head.m_used -= ace->m_used; - AceCache::get().destroy (ace); - } - OSL_ENSURE(m_ace_head.m_used == 0, "store::PageBIOS::close(): logic error"); -#endif /* NEW */ - } - - // Check SuperBlock page. - storeError eErrCode = store_E_None; - if (m_pSuper) - { - // Release SuperBlock page. - eErrCode = m_pSuper->close (*this); - delete m_pSuper, m_pSuper = 0; - } - - // Release PageCache. - m_xCache.clear(); - - // Check LockBytes. - if (m_xLockBytes.is()) - { -#ifdef STORE_FEATURE_COMMIT - // Commit. - storeError result = m_xLockBytes->flush(); - if (eErrCode == store_E_None) - { - // Previous result(s) okay. Propagate next result. - eErrCode = result; - } -#endif /* STORE_FEATURE_COMMIT */ - - // Release LockBytes. - m_xLockBytes.clear(); - } + // Cleanup. + cleanup_Impl(); // Done. - return eErrCode; + return store_E_None; } /* @@ -1399,27 +1007,8 @@ storeError OStorePageBIOS::flush (void) if (!m_xLockBytes.is()) return store_E_InvalidAccess; - // Check mode and state. - storeError eErrCode = store_E_None; - if (!(m_bWriteable && m_bModified)) - return eErrCode; - - // Flush SuperBlock page. - eErrCode = m_pSuper->flush (*this); - - // Flush LockBytes. - storeError result = m_xLockBytes->flush(); - if (eErrCode == store_E_None) - { - // Previous result(s) okay. Propagate next result. - eErrCode = result; - } - - // Adjust modified state. - m_bModified = (eErrCode != store_E_None); - - // Done. - return eErrCode; + // Flush LockBytes and finish. + return m_xLockBytes->flush(); } /* @@ -1462,7 +1051,7 @@ storeError OStorePageBIOS::scanBegin ( return store_E_InvalidAccess; // Check SuperBlock page. - storeError eErrCode = verify (m_pSuper); + storeError eErrCode = m_pSuper->verify (*this); if (eErrCode != store_E_None) { // Damaged. Determine page size (NYI). @@ -1472,7 +1061,8 @@ storeError OStorePageBIOS::scanBegin ( // Setup Context descriptor. rCtx.m_aDescr = m_pSuper->m_aSuperOne.m_aDescr; - rCtx.m_aDescr.m_nAddr = rCtx.m_aDescr.m_nSize; // @@@ ntoh @@@ + rCtx.m_aDescr.m_nSize = store::ntohs(rCtx.m_aDescr.m_nSize); + rCtx.m_aDescr.m_nAddr = rCtx.m_aDescr.m_nSize; // Setup Context size. eErrCode = size (rCtx.m_nSize); @@ -1498,17 +1088,22 @@ storeError OStorePageBIOS::scanNext ( return store_E_InvalidAccess; // Setup PageHead. - OStorePageData aPageHead (OStorePageData::theSize); + PageData aPageHead; // Check context. while (rCtx.isValid()) { // Assign next location. - aPageHead.location (rCtx.m_aDescr.m_nAddr); + sal_uInt32 nAddr = rCtx.m_aDescr.m_nAddr; rCtx.m_aDescr.m_nAddr += rCtx.m_aDescr.m_nSize; - // Load PageHead. - storeError eErrCode = peek (aPageHead); + // Read PageHead. + storeError eErrCode = read (nAddr, &aPageHead, PageData::theSize); + if (eErrCode != store_E_None) + continue; + + // Verify PageHead. + eErrCode = aPageHead.verify (nAddr); if (eErrCode != store_E_None) continue; @@ -1521,7 +1116,7 @@ storeError OStorePageBIOS::scanNext ( continue; // Load page. - eErrCode = loadObjectAt_Impl (rPage, aPageHead.location()); + eErrCode = loadObjectAt_Impl (rPage, nAddr); if (eErrCode != store_E_None) continue; @@ -1532,31 +1127,3 @@ storeError OStorePageBIOS::scanNext ( // Done. return store_E_CantSeek; } - -/* - * peek (PageHead). - * Internal: Precond: initialized, readable, exclusive access. - */ -storeError OStorePageBIOS::peek (OStorePageData &rData) -{ - // Read PageHead. - storeError eErrCode = read (rData.location(), &rData, OStorePageData::theSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Verify PageHead. - return rData.verify(); -} - -/* - * poke (PageHead). - * Internal: Precond: initialized, writeable, exclusive access. - */ -storeError OStorePageBIOS::poke (OStorePageData &rData) -{ - // Guard PageHead. - rData.guard(); - - // Write PageHead. - return write (rData.location(), &rData, OStorePageData::theSize); -} diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx index ad84b40b05e7..439089d41bd6 100644 --- a/store/source/storbios.hxx +++ b/store/source/storbios.hxx @@ -26,7 +26,7 @@ ************************************************************************/ #ifndef _STORE_STORBIOS_HXX_ -#define _STORE_STORBIOS_HXX_ "$Revision: 1.1.2.3 $" +#define _STORE_STORBIOS_HXX_ #include "sal/types.h" #include "rtl/ref.hxx" @@ -46,7 +46,7 @@ namespace store { -struct OStoreSuperBlockPage; +struct SuperBlockPage; class OStorePageBIOS : public store::OStoreObject { @@ -75,16 +75,6 @@ public: return m_xAllocator; } - /** acquireLock. - */ - storeError acquireLock ( - sal_uInt32 nAddr, sal_uInt32 nSize); - - /** releaseLock. - */ - storeError releaseLock ( - sal_uInt32 nAddr, sal_uInt32 nSize); - /** read. */ storeError read ( @@ -95,10 +85,6 @@ public: storeError write ( sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize); - /** isModified. - */ - inline bool isModified (void) const; - /** isWriteable. */ inline bool isWriteable (void) const; @@ -129,8 +115,7 @@ public: storeError allocate ( OStorePageObject& rPage, Allocation eAllocation = ALLOCATE_FIRST); - storeError free ( - OStorePageData & /* rData */, sal_uInt32 nAddr); + storeError free (sal_uInt32 nAddr); /** Page I/O. */ @@ -196,10 +181,8 @@ private: rtl::Reference<ILockBytes> m_xLockBytes; osl::Mutex m_aMutex; - typedef OStoreSuperBlockPage SuperPage; - SuperPage *m_pSuper; + SuperBlockPage * m_pSuper; - bool m_bModified; bool m_bWriteable; rtl::Reference< PageData::Allocator > m_xAllocator; @@ -230,22 +213,16 @@ private: class AceCache; - /** create (SuperBlock). - */ - storeError create (sal_uInt16 nPageSize); - - /** SuperBlock verification and repair. + /** Initialization. */ - storeError verify (SuperPage *&rpSuper); - storeError repair (SuperPage *&rpSuper); + storeError initialize_Impl ( + ILockBytes * pLockBytes, + storeAccessMode eAccessMode, + sal_uInt16 & rnPageSize); + void cleanup_Impl(); /** Page Maintenance. */ - storeError peek ( - OStorePageData &rData); - storeError poke ( - OStorePageData &rData); - storeError loadObjectAt_Impl ( OStorePageObject & rPage, sal_uInt32 nAddr); storeError saveObjectAt_Impl ( @@ -261,10 +238,6 @@ inline OStorePageBIOS::operator osl::Mutex& (void) const { return (osl::Mutex&)m_aMutex; } -inline bool OStorePageBIOS::isModified (void) const -{ - return m_bModified; -} inline bool OStorePageBIOS::isWriteable (void) const { return m_bWriteable; diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index 97bcc87fcb6c..901da15c8040 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -95,8 +95,7 @@ static storeError store_truncate_Impl ( if (nSingle == 0) { // Free single indirect page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; } @@ -135,8 +134,7 @@ static storeError store_truncate_Impl ( if ((nDouble + nSingle) == 0) { // Free double indirect page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; } @@ -171,8 +169,7 @@ static storeError store_truncate_Impl ( if ((nTriple + nDouble + nSingle) == 0) { // Free triple indirect page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; } @@ -433,17 +430,8 @@ storeError OStoreIndirectionPageObject::truncate ( if (!(nSingle < nLimit)) return store_E_InvalidAccess; - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Truncate. + storeError eErrCode = store_E_None; for (sal_uInt16 i = nLimit; i > nSingle; i--) { // Obtain data page location. @@ -451,13 +439,9 @@ storeError OStoreIndirectionPageObject::truncate ( if (nAddr != STORE_PAGE_NULL) { // Free data page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Clear pointer to data page. rPage.m_pData[i - 1] = STORE_PAGE_NULL; @@ -470,19 +454,10 @@ storeError OStoreIndirectionPageObject::truncate ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /* @@ -501,26 +476,14 @@ storeError OStoreIndirectionPageObject::truncate ( if (!((nDouble < nLimit) && (nSingle < nLimit))) return store_E_InvalidAccess; - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Truncate. + storeError eErrCode = store_E_None; for (sal_uInt16 i = nLimit; i > nDouble + 1; i--) { // Truncate single indirect page to zero direct pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Clear pointer to single indirect page. rPage.m_pData[i - 1] = STORE_PAGE_NULL; @@ -530,10 +493,7 @@ storeError OStoreIndirectionPageObject::truncate ( // Truncate last single indirect page to 'nSingle' direct pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nDouble]), nSingle, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Check for complete truncation. if (nSingle == 0) @@ -548,19 +508,10 @@ storeError OStoreIndirectionPageObject::truncate ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /* @@ -580,26 +531,14 @@ storeError OStoreIndirectionPageObject::truncate ( if (!((nTriple < nLimit) && (nDouble < nLimit) && (nSingle < nLimit))) return store_E_InvalidAccess; - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Truncate. + storeError eErrCode = store_E_None; for (sal_uInt16 i = nLimit; i > nTriple + 1; i--) { // Truncate double indirect page to zero single indirect pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, 0, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Clear pointer to double indirect page. rPage.m_pData[i - 1] = STORE_PAGE_NULL; @@ -609,10 +548,7 @@ storeError OStoreIndirectionPageObject::truncate ( // Truncate last double indirect page to 'nDouble', 'nSingle' pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nTriple]), nDouble, nSingle, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Check for complete truncation. if ((nDouble + nSingle) == 0) @@ -627,19 +563,10 @@ storeError OStoreIndirectionPageObject::truncate ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /*======================================================================== @@ -1129,8 +1056,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (nAddr == STORE_PAGE_NULL) continue; // Free data page. - OStoreDataPageData aData; - eErrCode = rBIOS.free (aData, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) break; diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx index 6b062f7127f8..01ea2c0f86ec 100644 --- a/store/source/stordata.hxx +++ b/store/source/stordata.hxx @@ -26,7 +26,7 @@ ************************************************************************/ #ifndef _STORE_STORDATA_HXX_ -#define _STORE_STORDATA_HXX_ "$Revision: 1.6.8.2 $" +#define _STORE_STORDATA_HXX_ #include "sal/types.h" #include "sal/macros.h" diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx index 770e46ee84b6..a49e850061b6 100644 --- a/store/source/storpage.cxx +++ b/store/source/storpage.cxx @@ -117,11 +117,6 @@ storeError OStorePageManager::initialize ( // Save RootNode. eErrCode = base::saveObjectAt (m_aRoot, rnPageSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Flush for robustness. - (void) base::flush(); } // Done. @@ -857,8 +852,7 @@ storeError OStorePageManager::remove (const OStorePageKey &rKey) eErrCode = base::releasePage (aDescr, store_AccessReadWrite); // Release and free directory page. - OStorePageData aPageHead; - eErrCode = base::free (aPageHead, aPage.location()); + eErrCode = base::free (aPage.location()); } // Remove entry. diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 9636cc2f4f8c..23d7ca778961 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -202,25 +202,10 @@ storeError OStoreBTreeNodeObject::split ( if (!rxPageL->querySplit()) return store_E_None; - // Save PageDescriptor. - OStorePageDescriptor aDescr (xPage->m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - - // [Begin PageL Lock (NYI)] - // Construct right page. PageHolderObject< page > xPageR; if (!xPageR.construct (rBIOS.allocator())) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_OutOfMemory; - } // Split right page off left page. xPageR->split (*rxPageL); @@ -228,12 +213,9 @@ storeError OStoreBTreeNodeObject::split ( // Allocate right page. self aNodeR (xPageR.get()); - eErrCode = rBIOS.allocate (aNodeR); + storeError eErrCode = rBIOS.allocate (aNodeR); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Truncate left page. rxPageL->truncate (rxPageL->capacityCount() / 2); @@ -242,35 +224,14 @@ storeError OStoreBTreeNodeObject::split ( self aNodeL (rxPageL.get()); eErrCode = rBIOS.saveObjectAt (aNodeL, aNodeL.location()); if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } - - // [End PageL Lock (NYI)] // Insert right page. OStorePageLink aLink (xPageR->location()); xPage->insert (nIndexL + 1, T(xPageR->m_pData[0].m_aKey, aLink)); - // Save this page. - eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } - - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Save this page and leave. + return rBIOS.saveObjectAt (*this, location()); } /* @@ -284,56 +245,34 @@ storeError OStoreBTreeNodeObject::remove ( PageHolderObject< page > xImpl (m_xPage); page & rPage = (*xImpl); - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Check depth. + storeError eErrCode = store_E_None; if (rPage.depth()) { // Check link entry. T const aEntryL (rPage.m_pData[nIndexL]); if (!(rEntryL.compare (aEntryL) == T::COMPARE_EQUAL)) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_InvalidAccess; - } // Load link node. self aNodeL; eErrCode = rBIOS.loadObjectAt (aNodeL, aEntryL.m_aLink.location()); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Recurse: remove from link node. eErrCode = aNodeL.remove (0, rEntryL, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Check resulting link node usage. PageHolderObject< page > xPageL (aNodeL.get()); if (xPageL->usageCount() == 0) { // Free empty link node. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, xPageL->location()); + eErrCode = rBIOS.free (xPageL->location()); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Remove index. rPage.remove (nIndexL); @@ -355,7 +294,7 @@ storeError OStoreBTreeNodeObject::remove ( { rPageL.merge (rPageR); - eErrCode = rBIOS.free (aPageHead, rPageR.location()); + eErrCode = rBIOS.free (rPageR.location()); } } } @@ -370,10 +309,7 @@ storeError OStoreBTreeNodeObject::remove ( { // Check leaf entry. if (!(rEntryL.compare (rPage.m_pData[nIndexL]) == T::COMPARE_EQUAL)) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_NotExists; - } // Save leaf entry. rEntryL = rPage.m_pData[nIndexL]; @@ -388,19 +324,10 @@ storeError OStoreBTreeNodeObject::remove ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeNodeObject::remove(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /*======================================================================== @@ -454,33 +381,17 @@ storeError OStoreBTreeRootObject::change ( PageHolderObject< page > xPage (m_xPage); (void) testInvariant("OStoreBTreeRootObject::change(): enter"); - // Save PageDescriptor. - OStorePageDescriptor aDescr (xPage->m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - // Save root location. sal_uInt32 const nRootAddr = xPage->location(); - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Construct new root. if (!rxPageL.construct (rBIOS.allocator())) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_OutOfMemory; - } // Save this as prev root. - eErrCode = rBIOS.allocate (*this); + storeError eErrCode = rBIOS.allocate (*this); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_OutOfMemory; - } // Setup new root. rxPageL->depth (xPage->depth() + 1); @@ -495,24 +406,10 @@ storeError OStoreBTreeRootObject::change ( tmp.swap (m_xPage); } - // Save this as new root. + // Save this as new root and finish. eErrCode = rBIOS.saveObjectAt (*this, nRootAddr); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeRootObject::change(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } - - // Flush for robustness. - (void) rBIOS.flush(); - - // Done. Release Lock and Leave. (void) testInvariant("OStoreBTreeRootObject::change(): leave"); - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + return eErrCode; } /* diff --git a/store/workben/makefile.mk b/store/workben/makefile.mk index 07b558d06bc6..8893f4c7d646 100644 --- a/store/workben/makefile.mk +++ b/store/workben/makefile.mk @@ -76,6 +76,7 @@ APP1OBJS= $(OBJ)$/t_file.obj APP1STDLIBS= $(STOREDBGLIB) APP1STDLIBS+= $(SALLIB) APP1DEPN= $(STOREDBGLIB) +APP1RPATH= UREBIN APP2TARGET= t_page APP2OBJS= $(OBJ)$/t_page.obj @@ -88,6 +89,7 @@ APP3OBJS= $(OBJ)$/t_base.obj APP3STDLIBS= $(STOREDBGLIB) APP3STDLIBS+= $(SALLIB) APP3DEPN= $(STOREDBGLIB) +APP3RPATH= UREBIN APP4TARGET= t_store APP4OBJS= $(OBJ)$/t_store.obj diff --git a/store/workben/t_base.cxx b/store/workben/t_base.cxx index 49176c3dcfad..7f99c287a210 100644 --- a/store/workben/t_base.cxx +++ b/store/workben/t_base.cxx @@ -362,19 +362,8 @@ int SAL_CALL main (int argc, char **argv) rtl_zeroMemory (pBuffer, sizeof (pBuffer)); rtl_copyMemory (pBuffer, argv[0], rtl_str_getLength(argv[0]) + 1); - eErrCode = xBIOS->acquireLock (TEST_PAGESIZE, sizeof(pBuffer)); - if (eErrCode != store_E_None) - return eErrCode; - eErrCode = xBIOS->write (TEST_PAGESIZE, pBuffer, sizeof (pBuffer)); if (eErrCode != store_E_None) - { - xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer)); - return eErrCode; - } - - eErrCode = xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer)); - if (eErrCode != store_E_None) return eErrCode; xBIOS.clear(); diff --git a/unoil/climaker/version.txt b/unoil/climaker/version.txt index 360bb20069d4..f3c80f838ad3 100644 --- a/unoil/climaker/version.txt +++ b/unoil/climaker/version.txt @@ -25,8 +25,8 @@ # #************************************************************************* -CLI_OOOTYPES_NEW_VERSION=1.0.4.0 -CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.3.0 -CLI_OOOTYPES_POLICY_VERSION=4.0.0.0 +CLI_OOOTYPES_NEW_VERSION=1.0.6.0 +CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.5.0 +CLI_OOOTYPES_POLICY_VERSION=6.0.0.0 CLI_OOOTYPES_POLICY_ASSEMBLY=policy.1.0.cli_oootypes diff --git a/ure/source/uretest/version.map b/ure/source/uretest/version.map index a93667d9da82..82a89b6b28fc 100644 --- a/ure/source/uretest/version.map +++ b/ure/source/uretest/version.map @@ -34,6 +34,8 @@ UDK_3_0_0 { _ZTI*; _ZTS*; + _ZN4_STL7num_put*; # for STLport + local: *; }; |