diff options
34 files changed, 30 insertions, 536 deletions
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx index db457608495b..af59f84f4d5c 100644 --- a/basic/source/runtime/inputbox.cxx +++ b/basic/source/runtime/inputbox.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - +#include <tools/lineend.hxx> #include <vcl/button.hxx> #include <vcl/fixed.hxx> #include <vcl/edit.hxx> diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx index 482873d73ea9..89dc712fedb1 100644 --- a/cui/source/options/certpath.cxx +++ b/cui/source/options/certpath.cxx @@ -10,6 +10,7 @@ #include <officecfg/Office/Common.hxx> #include <osl/file.hxx> #include <osl/security.hxx> +#include <osl/thread.h> #include <svtools/stdctrl.hxx> #include "svtools/treelistentry.hxx" #include <unotools/securityoptions.hxx> diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index ab6d577ecdec..7234f6b9787f 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -28,6 +28,7 @@ #include <svl/itemset.hxx> #include <svl/style.hxx> #include <svl/itempool.hxx> +#include <tools/lineend.hxx> #include <vector> #include <deque> diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 1e9af527591d..6fe68ec148b3 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "sal/config.h" - +#include <sal/config.h> +#include <osl/thread.h> #include <grid.hrc> #include <cstdio> #include <math.h> // for M_LN10 and M_E diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index 5ec8e34059d9..fb74fc4addb3 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -17,8 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/graph.hxx> +#include <osl/thread.h> #include <tools/poly.hxx> +#include <vcl/graph.hxx> #include <vcl/dibtools.hxx> #include <vcl/virdev.hxx> #include <vcl/lineinfo.hxx> diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index c69dc01328de..f1903e94b6b6 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -19,6 +19,7 @@ #include <string.h> +#include <osl/thread.h> #include <vcl/bmpacc.hxx> #include <vcl/graph.hxx> #include <tools/poly.hxx> diff --git a/include/tools/solar.h b/include/tools/solar.h index b6d90e6c5c26..2bc9160bc5d7 100644 --- a/include/tools/solar.h +++ b/include/tools/solar.h @@ -118,7 +118,6 @@ inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((sal_uInt8*)&n)[7 #pragma warning(error : 4002 4003) #endif -#define UniString String #define xub_StrLen sal_uInt16 #define STRING_CONCAT3( s1, s2, s3 ) \ diff --git a/include/tools/string.hxx b/include/tools/string.hxx index 9efa5d75b1b0..1757a64f96b6 100644 --- a/include/tools/string.hxx +++ b/include/tools/string.hxx @@ -21,230 +21,18 @@ #define _STRING_HXX #include <tools/solar.h> -#include <osl/thread.h> -#include <rtl/textenc.h> -#include <rtl/textcvt.h> -#include <rtl/ustrbuf.h> -#include <rtl/string.hxx> -#include <rtl/ustring.hxx> -#include "tools/toolsdllapi.h" -#include "tools/lineend.hxx" /******************************************************************************* - * * THIS CODE IS DEPRECATED. DO NOT USE IT IN ANY NEW CODE. - * - * Use the string classes in rtl/ustring.hxx and rtl/ustrbuf.hxx (and - * rtl/string.hxx and rtl/strbuf.hxx for byte-sized strings) instead. If you - * feel functionality missing from those string classes, please request - * improvements on discuss@openoffice.org. - * * There will not be any fixes to the code here. ******************************************************************************/ -class ResId; -class String; -class UniString; - -#define BYTESTRING_TO_UNISTRING_CVTFLAGS (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |\ - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |\ - RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT) - -// String-Types - -#ifdef STRING32 -#define STRING_NOTFOUND ((xub_StrLen)0x7FFFFFFF) -#define STRING_LEN ((xub_StrLen)0x7FFFFFFF) -#define STRING_MAXLEN ((xub_StrLen)0x7FFFFFFF) -#else #define STRING_NOTFOUND ((xub_StrLen)0xFFFF) #define STRING_LEN ((xub_StrLen)0xFFFF) #define STRING_MAXLEN ((xub_StrLen)0xFFFF) -#endif enum StringCompare { COMPARE_LESS = -1, COMPARE_EQUAL = 0, COMPARE_GREATER = 1 }; -//Internal String data - -// Data used for the management of this String -// use only for debugging purposes (never assign to String directly!) - -#ifdef SAL_W32 -#pragma pack(push, 4) -#endif - -typedef struct _UniStringData -{ - sal_Int32 mnRefCount; // reference counter - sal_Int32 mnLen; // Length of the String - sal_Unicode maStr[1]; // CharArray (String) -} UniStringData; - -#ifdef SAL_W32 -#pragma pack(pop) -#endif - -// UniString - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED UniString -{ -private: - UniStringData* mpData; - - TOOLS_DLLPRIVATE inline void ImplCopyData(); - TOOLS_DLLPRIVATE inline sal_Unicode * ImplCopyStringData(sal_Unicode *); - - StringCompare CompareTo( const UniString& rStr, - xub_StrLen nLen = STRING_LEN ) const; - - UniString& Assign( const OUString& rStr ); - UniString& Append( const UniString& rStr ); -public: - UniString(); - UniString( const UniString& rStr ); - UniString( const OUString& rStr ); - ~UniString(); - - operator OUString () const - { - return OUString( rtl_uStringBuffer_refReturn( - reinterpret_cast<rtl_uString*>(mpData)), SAL_NO_ACQUIRE ); - } - -#ifdef RTL_FAST_STRING - template< typename T1, typename T2 > - UniString( const rtl::OUStringConcat< T1, T2 >& concat ) - : mpData(NULL) { Assign( OUString( concat )); } - template< typename T1, typename T2 > - UniString& operator =( const rtl::OUStringConcat< T1, T2 >& concat ) - { return Assign( OUString( concat )); } - template< typename T1, typename T2 > - UniString& operator +=( const rtl::OUStringConcat< T1, T2 >& concat ) - { return Append( UniString( concat ) ); } -#endif - - UniString& operator =( const OUString& rStr ) - { return Assign( rStr ); } - - UniString& operator +=( const OUString& rStr ) - { return Append( UniString(rStr) ); } - - xub_StrLen Len() const { return (xub_StrLen)mpData->mnLen; } - - const sal_Unicode* GetBuffer() const { return mpData->maStr; } - - friend sal_Bool operator == ( const UniString& rStr1, const UniString& rStr2 ); - friend sal_Bool operator != ( const UniString& rStr1, const UniString& rStr2 ) - { return !(operator == ( rStr1, rStr2 )); } - friend sal_Bool operator < ( const UniString& rStr1, const UniString& rStr2 ) - { return (rStr1.CompareTo( rStr2 ) == COMPARE_LESS); } - friend sal_Bool operator > ( const UniString& rStr1, const UniString& rStr2 ) - { return (rStr1.CompareTo( rStr2 ) == COMPARE_GREATER); } - friend sal_Bool operator <= ( const UniString& rStr1, const UniString& rStr2 ) - { return !(operator > ( rStr1, rStr2 )); } - friend sal_Bool operator >= ( const UniString& rStr1, const UniString& rStr2 ) - { return !(operator < ( rStr1, rStr2 )); } -}; - -template< typename charT, typename traits > std::basic_ostream<charT, traits> & -operator <<( - std::basic_ostream<charT, traits> & stream, UniString const & string) -{ - return stream << - OUStringToOString(string, RTL_TEXTENCODING_UTF8).getStr(); - // best effort; potentially loses data due to conversion failures - // (stray surrogate halves) and embedded null characters -} - -#ifdef RTL_FAST_STRING -namespace rtl -{ -template<> -struct ToStringHelper< UniString > - { - static int length( const UniString& s ) { return s.Len(); } - static sal_Unicode* addData( sal_Unicode* buffer, const UniString& s ) { return addDataHelper( buffer, s.GetBuffer(), s.Len()); } - static const bool allowOStringConcat = false; - static const bool allowOUStringConcat = true; - }; -} - -#endif - -// some compare operators, so that conversions from String to OUString don't -// have to insert conversions all over the place -inline bool operator==(UniString const& rLeft, OUString const& rRight) -{ - return OUString(rLeft) == rRight; -} - -inline bool operator==(OUString const& rLeft, UniString const& rRight) -{ - return rLeft == OUString(rRight); -} - -inline bool operator!=(UniString const& rLeft, OUString const& rRight) -{ - return OUString(rLeft) != rRight; -} - -inline bool operator!=(OUString const& rLeft, UniString const& rRight) -{ - return rLeft != OUString(rRight); -} - -#ifdef RTL_FAST_STRING -// The above operators make comparisons involving fast string concatenation ambiguous, so provide explicit overloads. -template< typename T1, typename T2 > -inline bool operator==( const rtl::OUStringConcat< T1, T2 >& concat, const OUString& str ) -{ - return OUString( concat ) == str; -} - -template< typename T1, typename T2 > -inline bool operator!=( const rtl::OUStringConcat< T1, T2 >& concat, const OUString& str ) -{ - return OUString( concat ) == str; -} - -template< typename T1, typename T2 > -inline bool operator==( const OUString& str, const rtl::OUStringConcat< T1, T2 >& concat ) -{ - return str == OUString( concat ); -} - -template< typename T1, typename T2 > -inline bool operator!=( const OUString& str, const rtl::OUStringConcat< T1, T2 >& concat ) -{ - return str != OUString( concat ); -} - -template< typename T1, typename T2 > -inline bool operator==( const rtl::OUStringConcat< T1, T2 >& concat, const UniString& str ) -{ - return UniString( concat ) == str; -} - -template< typename T1, typename T2 > -inline bool operator!=( const rtl::OUStringConcat< T1, T2 >& concat, const UniString& str ) -{ - return UniString( concat ) == str; -} - -template< typename T1, typename T2 > -inline bool operator==( const UniString& str, const rtl::OUStringConcat< T1, T2 >& concat ) -{ - return str == UniString( concat ); -} - -template< typename T1, typename T2 > -inline bool operator!=( const UniString& str, const rtl::OUStringConcat< T1, T2 >& concat ) -{ - return str != UniString( concat ); -} - -#endif - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx index 3ac6dd6b8e2f..cb203e960f3a 100644 --- a/include/vcl/vclmedit.hxx +++ b/include/vcl/vclmedit.hxx @@ -20,6 +20,7 @@ #ifndef _VCLMEDIT_HXX #define _VCLMEDIT_HXX +#include <tools/lineend.hxx> #include <tools/wintypes.hxx> #include <vcl/edit.hxx> #include <vcl/dllapi.h> diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 9a7a0ec84986..77d1278fd784 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -22,6 +22,7 @@ #include <editeng/editeng.hxx> #include <editeng/forbiddencharacterstable.hxx> +#include <osl/thread.h> #include <svx/xtable.hxx> #include <sfx2/linkmgr.hxx> #include <svx/svdpool.hxx> diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 6f339fbb5d75..4c2bf25d7c1d 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -25,6 +25,7 @@ #include <editeng/fontitem.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <editeng/langitem.hxx> +#include <osl/thread.h> #include <svx/svdetc.hxx> #include <svx/svditer.hxx> #include <svx/svdocapt.hxx> diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx index e8ecfbde018d..d79653ac6966 100644 --- a/sc/source/core/tool/ddelink.cxx +++ b/sc/source/core/tool/ddelink.cxx @@ -18,6 +18,7 @@ */ #include <comphelper/string.hxx> +#include <osl/thread.h> #include <sfx2/linkmgr.hxx> #include <sfx2/bindings.hxx> #include <svl/zforlist.hxx> diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 6b600a0cef6e..ab792b5eb836 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -22,6 +22,7 @@ #include "scitems.hxx" #include <editeng/langitem.hxx> #include <editeng/justifyitem.hxx> +#include <osl/thread.h> #include <svx/algitem.hxx> #include <unotools/textsearch.hxx> #include <svl/zforlist.hxx> diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index 076b8f84cbab..b2ea0c8ae398 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -23,6 +23,7 @@ #include "asciiopt.hxx" #include "asciiopt.hrc" #include <comphelper/string.hxx> +#include <osl/thread.h> #include <rtl/tencinfo.h> #include <unotools/transliterationwrapper.hxx> // ause diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx index f588c161ba02..56d4b74851fd 100644 --- a/sc/source/ui/dbgui/imoptdlg.cxx +++ b/sc/source/ui/dbgui/imoptdlg.cxx @@ -22,6 +22,7 @@ #include "scresid.hxx" #include "imoptdlg.hrc" #include <comphelper/string.hxx> +#include <osl/thread.h> #include <rtl/tencinfo.h> static const sal_Char pStrFix[] = "FIX"; diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 89c13d8be5a5..5e2720a1a149 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -26,6 +26,7 @@ #include "scuiasciiopt.hxx" #include "asciiopt.hrc" #include <comphelper/string.hxx> +#include <osl/thread.h> #include <rtl/tencinfo.h> #include <unotools/transliterationwrapper.hxx> #include "editutil.hxx" diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx index 1c63b1b0329a..1b712959d433 100644 --- a/sc/source/ui/dbgui/scuiimoptdlg.cxx +++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx @@ -27,6 +27,7 @@ #include "scresid.hxx" #include "imoptdlg.hrc" #include <comphelper/string.hxx> +#include <osl/thread.h> #include <rtl/tencinfo.h> //======================================================================== diff --git a/solenv/gdb/libreoffice/tl.py b/solenv/gdb/libreoffice/tl.py index 7c18a9555434..15e539883501 100644 --- a/solenv/gdb/libreoffice/tl.py +++ b/solenv/gdb/libreoffice/tl.py @@ -10,27 +10,6 @@ import gdb from libreoffice.util import printing -from libreoffice.util.string import StringPrinterHelper - -class StringPrinter(StringPrinterHelper): - '''Prints ByteString or UniString''' - - def __init__(self, typename, val, encoding = None): - super(StringPrinter, self).__init__(typename, val, encoding) - - def valid(self): - data = self.val['mpData'] - # mnRefCount is not a good indicator: it seems there could be - # cases where it is negative (-7FFFFFED) - return data #and data.dereference()['mnRefCount'] > 0 - - def data(self): - assert self.val['mpData'] - return self.val['mpData'].dereference()['maStr'] - - def length(self): - assert self.val['mpData'] - return self.val['mpData'].dereference()['mnLen'] class BigIntPrinter(object): '''Prints big integer''' @@ -377,10 +356,6 @@ def build_pretty_printers(): printer = printing.Printer('libreoffice/tl') - # old-style strings - printer.add('ByteString', StringPrinter) - printer.add('String', lambda name, val: StringPrinter(name, val, 'utf-16')) - # old-style containers printer.add('DynArray', LinearContainerPrinter) printer.add('List', LinearContainerPrinter) diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index 110d951059be..939fb1f4f7fd 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -21,6 +21,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <osl/thread.h> #include <tools/vcompat.hxx> #include <ucbhelper/content.hxx> #include <unotools/ucbstreamhelper.hxx> diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx index f6c61c377a03..fd2c30298a2b 100644 --- a/svx/source/svdraw/svdotxln.cxx +++ b/svx/source/svdraw/svdotxln.cxx @@ -20,6 +20,7 @@ #include "sal/config.h" #include <comphelper/processfactory.hxx> +#include <osl/thread.h> #include <unotools/ucbstreamhelper.hxx> #include <unotools/localfilehelper.hxx> #include <ucbhelper/content.hxx> diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 522f665b0ced..49c1c202f559 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/i18n/TransliterationModules.hpp> #include <comphelper/string.hxx> #include <svl/fstathelper.hxx> - +#include <osl/thread.h> #include <unotools/textsearch.hxx> #include <sfx2/docfile.hxx> diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index 589d76f46bcc..40240a64ea2b 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <osl/thread.h> #include <sfx2/linkmgr.hxx> #include <doc.hxx> #include <editsh.hxx> diff --git a/sw/source/ui/config/uinums.cxx b/sw/source/ui/config/uinums.cxx index 7a9b63e6f9d4..cf1ffd580d48 100644 --- a/sw/source/ui/config/uinums.cxx +++ b/sw/source/ui/config/uinums.cxx @@ -20,6 +20,7 @@ #include <hintids.hxx> #include <svl/urihelper.hxx> +#include <osl/thread.h> #include <unotools/pathoptions.hxx> #include <tools/stream.hxx> #include <sfx2/docfile.hxx> diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx index 91e3a36b0fb3..b6e7d23e194b 100644 --- a/sw/source/ui/docvw/edtwin2.cxx +++ b/sw/source/ui/docvw/edtwin2.cxx @@ -24,7 +24,7 @@ #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> #endif - +#include <osl/thread.h> #include <vcl/help.hxx> #include <svl/stritem.hxx> #include <unotools/securityoptions.hxx> diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index cb60d4385b5e..25d693013409 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -19,6 +19,7 @@ #include <comphelper/string.hxx> #include <svl/urlbmk.hxx> +#include <osl/thread.h> #include <tools/urlobj.hxx> #include <sfx2/docfile.hxx> #include <sfx2/dispatch.hxx> diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index 0676abf656c2..db2360b077f4 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -83,7 +83,6 @@ $(eval $(call gb_Library_add_exception_objects,tl,\ tools/source/stream/strmsys \ tools/source/stream/vcompat \ tools/source/string/tenccvt \ - tools/source/string/tustring \ tools/source/string/reversemap \ tools/source/zcodec/zcodec \ )) diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx deleted file mode 100644 index de479e450669..000000000000 --- a/tools/source/string/strimp.cxx +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -static sal_Int32 ImplStringCompareWithoutZero( const STRCODE* pStr1, const STRCODE* pStr2, - sal_Int32 nCount ) -{ - sal_Int32 nRet = 0; - while ( nCount && - ((nRet = ((sal_Int32)((STRCODEU)*pStr1))-((sal_Int32)((STRCODEU)*pStr2))) == 0) ) - { - ++pStr1, - ++pStr2, - --nCount; - } - - return nRet; -} - -static STRINGDATA* ImplAllocData( sal_Int32 nLen ) -{ - STRINGDATA* pData = (STRINGDATA*)rtl_allocateMemory( sizeof(STRINGDATA)+(nLen*sizeof( STRCODE )) ); - pData->mnRefCount = 1; - pData->mnLen = nLen; - pData->maStr[nLen] = 0; - return pData; -} - -static STRINGDATA* _ImplCopyData( STRINGDATA* pData ) -{ - unsigned int nSize = sizeof(STRINGDATA)+(pData->mnLen*sizeof( STRCODE )); - STRINGDATA* pNewData = (STRINGDATA*)rtl_allocateMemory( nSize ); - memcpy( pNewData, pData, nSize ); - pNewData->mnRefCount = 1; - STRING_RELEASE((STRING_TYPE *)pData); - return pNewData; -} - -inline void STRING::ImplCopyData() -{ - DBG_ASSERT( (mpData->mnRefCount != 0), "String::ImplCopyData() - RefCount == 0" ); - - // Dereference data if this string is referenced - if ( mpData->mnRefCount != 1 ) - mpData = _ImplCopyData( mpData ); -} - -inline STRCODE* STRING::ImplCopyStringData( STRCODE* pStr ) -{ - if ( mpData->mnRefCount != 1 ) { - DBG_ASSERT( (pStr >= mpData->maStr) && - ((pStr-mpData->maStr) < mpData->mnLen), - "ImplCopyStringData - pStr from other String-Instanz" ); - unsigned int nIndex = (unsigned int)(pStr-mpData->maStr); - mpData = _ImplCopyData( mpData ); - pStr = mpData->maStr + nIndex; - } - return pStr; -} - -inline sal_Int32 ImplGetCopyLen( sal_Int32 nStrLen, sal_Int32 nCopyLen ) -{ - OSL_ASSERT(nStrLen <= STRING_MAXLEN && nCopyLen <= STRING_MAXLEN); - if ( nCopyLen > STRING_MAXLEN-nStrLen ) - nCopyLen = STRING_MAXLEN-nStrLen; - return nCopyLen; -} - -STRING::STRING() - : mpData(NULL) -{ - STRING_NEW((STRING_TYPE **)&mpData); -} - -STRING::STRING( const STRING& rStr ) -{ - // Set pointer to argument string and increase reference counter - STRING_ACQUIRE((STRING_TYPE *)rStr.mpData); - mpData = rStr.mpData; -} - -STRING::~STRING() -{ - // free string data - STRING_RELEASE((STRING_TYPE *)mpData); -} - -STRING& STRING::Append( const STRING& rStr ) -{ - // Assignment is sufficient if string is empty - sal_Int32 nLen = mpData->mnLen; - if ( !nLen ) - { - STRING_ACQUIRE((STRING_TYPE *)rStr.mpData); - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = rStr.mpData; - } - else - { - // Detect overflow - sal_Int32 nCopyLen = ImplGetCopyLen( nLen, rStr.mpData->mnLen ); - - if ( nCopyLen ) - { - // allocate string of new size - STRINGDATA* pNewData = ImplAllocData( nLen+nCopyLen ); - - // copy string - memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) ); - memcpy( pNewData->maStr+nLen, rStr.mpData->maStr, nCopyLen*sizeof( STRCODE ) ); - - // free old string - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - } - } - - return *this; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/strucvt.cxx b/tools/source/string/strucvt.cxx deleted file mode 100644 index 916eb04116ad..000000000000 --- a/tools/source/string/strucvt.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -UniString::UniString( const OUString& rStr ) - : mpData(NULL) -{ - OSL_ENSURE(rStr.pData->length < STRING_MAXLEN, - "Overflowing OUString -> UniString cut to zero length"); - - - if (rStr.pData->length < STRING_MAXLEN) - { - mpData = reinterpret_cast< UniStringData * >(const_cast< OUString & >(rStr).pData); - STRING_ACQUIRE((STRING_TYPE *)mpData); - } - else - { - STRING_NEW((STRING_TYPE **)&mpData); - } -} - -UniString& UniString::Assign( const OUString& rStr ) -{ - OSL_ENSURE(rStr.pData->length < STRING_MAXLEN, - "Overflowing OUString -> UniString cut to zero length"); - - if (rStr.pData->length < STRING_MAXLEN) - { - if( mpData != NULL ) - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = reinterpret_cast< UniStringData * >(const_cast< OUString & >(rStr).pData); - STRING_ACQUIRE((STRING_TYPE *)mpData); - } - else - { - STRING_NEW((STRING_TYPE **)&mpData); - } - - return *this; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx deleted file mode 100644 index cc4f27d3915b..000000000000 --- a/tools/source/string/tustring.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <string.h> - -#include "boost/static_assert.hpp" - -#include <osl/interlck.h> -#include <rtl/alloc.h> -#include <rtl/tencinfo.h> -#include <rtl/instance.hxx> -#include <tools/string.hxx> - -#include <impstrg.hxx> - -#include <tools/debug.hxx> - -DBG_NAME( UniString ) - -#define STRCODE sal_Unicode -#define STRCODEU sal_Unicode -#define STRING UniString -#define STRINGDATA UniStringData -#define STRING_TYPE rtl_uString -#define STRING_ACQUIRE rtl_uString_acquire -#define STRING_RELEASE rtl_uString_release -#define STRING_NEW rtl_uString_new - -#include <strimp.cxx> -#include <strucvt.cxx> - -StringCompare STRING::CompareTo( const STRING& rStr, xub_StrLen nLen ) const -{ - if ( mpData == rStr.mpData ) - return COMPARE_EQUAL; - - // determine maximal length - if ( mpData->mnLen < nLen ) - nLen = static_cast< xub_StrLen >(mpData->mnLen+1); - if ( rStr.mpData->mnLen < nLen ) - nLen = static_cast< xub_StrLen >(rStr.mpData->mnLen+1); - - sal_Int32 nCompare = ImplStringCompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen ); - - if ( nCompare == 0 ) - return COMPARE_EQUAL; - else if ( nCompare < 0 ) - return COMPARE_LESS; - else - return COMPARE_GREATER; -} - -sal_Bool operator==(const UniString& rStr1, const UniString& rStr2) -{ - if ( rStr1.mpData == rStr2.mpData ) - return sal_True; - - if ( rStr1.mpData->mnLen != rStr2.mpData->mnLen ) - return sal_False; - - return (ImplStringCompareWithoutZero( rStr1.mpData->maStr, rStr2.mpData->maStr, rStr1.mpData->mnLen ) == 0); -} - -xub_StrLen ImplStringLen( const sal_Char* pStr ) -{ - const sal_Char* pTempStr = pStr; - while( *pTempStr ) - ++pTempStr; - return (xub_StrLen)(pTempStr-pStr); -} - -xub_StrLen ImplStringLen( const sal_Unicode* pStr ) -{ - const sal_Unicode* pTempStr = pStr; - while( *pTempStr ) - ++pTempStr; - return (xub_StrLen)(pTempStr-pStr); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index 52177f079550..69ee0c7ff1ed 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -28,7 +28,8 @@ #include <cmath> #include <limits.h> -#include "tools/debug.hxx" +#include <tools/debug.hxx> +#include <tools/lineend.hxx> #include "sal/log.hxx" #include "vcl/svapp.hxx" diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 73b1ed401b90..9b442090426a 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -19,6 +19,7 @@ #include <tools/debug.hxx> +#include <tools/lineend.hxx> #include <tools/poly.hxx> #include <tools/rc.h> diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx index 9ef64678ccdd..3cadc838804a 100644 --- a/vcl/source/filter/sgvtext.cxx +++ b/vcl/source/filter/sgvtext.cxx @@ -20,6 +20,7 @@ #include "sal/config.h" #include <boost/static_assert.hpp> +#include <osl/thread.h> #include <rtl/math.h> #include <comphelper/string.hxx> #include <tools/config.hxx> diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index bcff2623dad6..8835e446797b 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -19,6 +19,7 @@ #include <algorithm> #include <string.h> +#include <osl/thread.h> #include <tools/debug.hxx> #include <tools/stream.hxx> #include <tools/helpers.hxx> diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index a522e051a5d9..d205723af9ea 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -19,6 +19,7 @@ #include <algorithm> #include <string.h> +#include <osl/thread.h> #include <tools/stream.hxx> #include <tools/vcompat.hxx> #include <tools/helpers.hxx> |