From b37e2dd071c83454b3b06c0959a76b6012f53abb Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 22 Oct 2013 09:20:52 +0100 Subject: Resolves: fdo#38838 remove UniString hammer silver nails into coffin and bury in concrete Change-Id: I3fda2ff47738bb33793adab97faba2d439ac9a28 --- basic/source/runtime/inputbox.cxx | 2 +- cui/source/options/certpath.cxx | 1 + editeng/source/editeng/editdoc.hxx | 1 + extensions/source/scanner/grid.cxx | 4 +- filter/source/graphicfilter/ios2met/ios2met.cxx | 3 +- filter/source/graphicfilter/ipict/ipict.cxx | 1 + include/tools/solar.h | 1 - include/tools/string.hxx | 212 ------------------------ include/vcl/vclmedit.hxx | 1 + sc/source/core/data/documen2.cxx | 1 + sc/source/core/data/documen9.cxx | 1 + sc/source/core/tool/ddelink.cxx | 1 + sc/source/core/tool/interpr1.cxx | 1 + sc/source/ui/dbgui/asciiopt.cxx | 1 + sc/source/ui/dbgui/imoptdlg.cxx | 1 + sc/source/ui/dbgui/scuiasciiopt.cxx | 1 + sc/source/ui/dbgui/scuiimoptdlg.cxx | 1 + solenv/gdb/libreoffice/tl.py | 25 --- svx/source/gallery2/gallery1.cxx | 1 + svx/source/svdraw/svdotxln.cxx | 1 + sw/source/core/edit/edtox.cxx | 2 +- sw/source/core/fields/ddefld.cxx | 1 + sw/source/ui/config/uinums.cxx | 1 + sw/source/ui/docvw/edtwin2.cxx | 2 +- sw/source/ui/utlui/content.cxx | 1 + tools/Library_tl.mk | 1 - tools/source/string/strimp.cxx | 136 --------------- tools/source/string/strucvt.cxx | 58 ------- tools/source/string/tustring.cxx | 96 ----------- vcl/source/app/dbggui.cxx | 3 +- vcl/source/control/button.cxx | 1 + vcl/source/filter/sgvtext.cxx | 1 + vcl/source/gdi/cvtsvm.cxx | 1 + vcl/source/gdi/metaact.cxx | 1 + 34 files changed, 30 insertions(+), 536 deletions(-) delete mode 100644 tools/source/string/strimp.cxx delete mode 100644 tools/source/string/strucvt.cxx delete mode 100644 tools/source/string/tustring.cxx 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 #include #include #include 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 #include #include +#include #include #include "svtools/treelistentry.hxx" #include 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 #include #include +#include #include #include 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 +#include #include #include #include // 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 +#include #include +#include #include #include #include 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 +#include #include #include #include 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 -#include -#include -#include -#include -#include -#include -#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(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 & -operator <<( - std::basic_ostream & 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 #include #include #include 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 #include +#include #include #include #include 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 #include #include +#include #include #include #include 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 +#include #include #include #include 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 #include +#include #include #include #include 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 +#include #include #include // 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 +#include #include 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 +#include #include #include #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 +#include #include //======================================================================== 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 #include +#include #include #include #include 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 +#include #include #include #include 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 #include #include - +#include #include #include 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 #include #include #include 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 #include +#include #include #include #include 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 #endif - +#include #include #include #include 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 #include +#include #include #include #include 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 - -#include "boost/static_assert.hpp" - -#include -#include -#include -#include -#include - -#include - -#include - -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 -#include - -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 #include -#include "tools/debug.hxx" +#include +#include #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 +#include #include #include 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 +#include #include #include #include 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 #include +#include #include #include #include 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 #include +#include #include #include #include -- cgit