compilerplugins/clang/unusedmethods.results | 10 - solenv/clang-format/excludelist | 1 vcl/IwyuFilter_vcl.yaml | 3 vcl/Library_vcl.mk | 1 vcl/source/fontsubset/sft.cxx | 1 vcl/source/fontsubset/xlat.cxx | 144 ---------------------------- vcl/source/fontsubset/xlat.hxx | 37 ------- 7 files changed, 197 deletions(-)
New commits: commit 558bd068e204c08010433f98d400a5103a053d83 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon May 26 10:31:35 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Jun 6 11:45:03 2025 +0200 drop unused vcl::TranslateChar and its converter cache Change-Id: Ib8ca08b7b8693cd92a576786e327ff7e63486920 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185790 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/compilerplugins/clang/unusedmethods.results b/compilerplugins/clang/unusedmethods.results index 8fe388967ee5..9c9d04ab637f 100644 --- a/compilerplugins/clang/unusedmethods.results +++ b/compilerplugins/clang/unusedmethods.results @@ -3408,16 +3408,6 @@ vcl/source/edit/textdat2.hxx:87 __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<const TETextPortion *, std::__cxx1998::vector<TETextPortion> >, std::vector<TETextPortion> > TETextPortionList::end() const vcl/source/filter/FilterConfigCache.hxx:70 rtl::OUString FilterConfigCache::GetImportFormatMediaType(unsigned short) -vcl/source/fontsubset/xlat.hxx:30 - unsigned short vcl::TranslateChar12(unsigned short) -vcl/source/fontsubset/xlat.hxx:31 - unsigned short vcl::TranslateChar13(unsigned short) -vcl/source/fontsubset/xlat.hxx:32 - unsigned short vcl::TranslateChar14(unsigned short) -vcl/source/fontsubset/xlat.hxx:33 - unsigned short vcl::TranslateChar15(unsigned short) -vcl/source/fontsubset/xlat.hxx:34 - unsigned short vcl::TranslateChar16(unsigned short) vcl/source/window/menuitemlist.hxx:123 void MenuItemList::Clear() vcl/unx/generic/dtrans/X11_clipboard.hxx:106 diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index d044568af714..554233aad13e 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -14687,7 +14687,6 @@ vcl/source/fontsubset/fontsubset.cxx vcl/source/fontsubset/sft.cxx vcl/source/fontsubset/ttcr.cxx vcl/source/fontsubset/ttcr.hxx -vcl/source/fontsubset/xlat.cxx vcl/source/gdi/CommonSalLayout.cxx vcl/source/gdi/configsettings.cxx vcl/source/gdi/cvtgrf.cxx diff --git a/vcl/IwyuFilter_vcl.yaml b/vcl/IwyuFilter_vcl.yaml index aba0e21f1375..c9811f0759c7 100644 --- a/vcl/IwyuFilter_vcl.yaml +++ b/vcl/IwyuFilter_vcl.yaml @@ -52,9 +52,6 @@ excludelist: vcl/source/filter/wmf/wmfexternal.cxx: # Actually these are used - com/sun/star/beans/PropertyValue.hpp - vcl/source/fontsubset/sft.cxx: - # Needed on WIN32 / MAC / IOS - - xlat.hxx vcl/source/gdi/configsettings.cxx: # Needed for OSL_DEBUG_LEVEL > 2 - sal/log.hxx diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 8f20824695a6..f8a6de5b5c2a 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -508,7 +508,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/fontsubset/fontsubset \ vcl/source/fontsubset/sft \ vcl/source/fontsubset/ttcr \ - vcl/source/fontsubset/xlat \ vcl/source/pdf/COSWriter \ vcl/source/pdf/EncryptionHashTransporter \ vcl/source/pdf/ExternalPDFStreams \ diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 8c1040bf279e..67bc04cc1097 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -42,7 +42,6 @@ #include <tools/fix16.hxx> #endif #include "ttcr.hxx" -#include "xlat.hxx" #include <rtl/crc.h> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> diff --git a/vcl/source/fontsubset/xlat.cxx b/vcl/source/fontsubset/xlat.cxx deleted file mode 100644 index b7966f27988e..000000000000 --- a/vcl/source/fontsubset/xlat.cxx +++ /dev/null @@ -1,144 +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 <rtl/textcvt.h> -#include "xlat.hxx" - -namespace { - -#define MAX_CVT_SELECT 6 - -class ConverterCache -{ -public: - explicit ConverterCache(); - ~ConverterCache(); - sal_uInt16 convertOne( int nSelect, sal_Unicode ); -private: - void ensureConverter( int nSelect ); - rtl_UnicodeToTextConverter maConverterCache[ MAX_CVT_SELECT+1 ]; - rtl_UnicodeToTextContext maContexts[ MAX_CVT_SELECT+1 ]; -}; - -ConverterCache::ConverterCache() -{ - for( int i = 0; i <= MAX_CVT_SELECT; ++i) - { - maConverterCache[i] = nullptr; - maContexts[i] = nullptr; - } -} - -ConverterCache::~ConverterCache() -{ - for( int i = 0; i <= MAX_CVT_SELECT; ++i) - { - if( !maContexts[i] ) - continue; - rtl_destroyUnicodeToTextContext( maConverterCache[i], maContexts[i] ); - rtl_destroyUnicodeToTextConverter( maConverterCache[i] ); - } -} - -void ConverterCache::ensureConverter( int nSelect ) -{ - // SAL_WARN_IF( (2>nSelect) || (nSelect>MAX_CVT_SELECT)), "vcl", "invalid XLAT.Converter requested" ); - rtl_UnicodeToTextContext aContext = maContexts[ nSelect ]; - if( !aContext ) - { - rtl_TextEncoding eRecodeFrom = RTL_TEXTENCODING_UNICODE; - switch( nSelect ) - { - default: nSelect = 1; [[fallthrough]]; // to unicode recoding - case 1: eRecodeFrom = RTL_TEXTENCODING_UNICODE; break; - case 2: eRecodeFrom = RTL_TEXTENCODING_SHIFT_JIS; break; - case 3: eRecodeFrom = RTL_TEXTENCODING_GB_2312; break; - case 4: eRecodeFrom = RTL_TEXTENCODING_BIG5; break; - case 5: eRecodeFrom = RTL_TEXTENCODING_MS_949; break; - case 6: eRecodeFrom = RTL_TEXTENCODING_MS_1361; break; - } - rtl_UnicodeToTextConverter aRecodeConverter = rtl_createUnicodeToTextConverter( eRecodeFrom ); - maConverterCache[ nSelect ] = aRecodeConverter; - - aContext = rtl_createUnicodeToTextContext( aRecodeConverter ); - maContexts[ nSelect ] = aContext; - } - - rtl_resetUnicodeToTextContext( maConverterCache[ nSelect ], aContext ); -} - -sal_uInt16 ConverterCache::convertOne( int nSelect, sal_Unicode aChar ) -{ - ensureConverter( nSelect ); - - sal_Unicode aUCS2Char = aChar; - char aTempArray[8]; - sal_Size nTempSize; - sal_uInt32 nCvtInfo; - - // TODO: use direct unicode->mbcs converter should there ever be one - int nCodeLen = rtl_convertUnicodeToText( - maConverterCache[ nSelect ], maContexts[ nSelect ], - &aUCS2Char, 1, aTempArray, sizeof(aTempArray), - RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0 - | RTL_UNICODETOTEXT_FLAGS_INVALID_0, - &nCvtInfo, &nTempSize ); - - sal_uInt16 aCode = aTempArray[0]; - for( int i = 1; i < nCodeLen; ++i ) - aCode = (aCode << 8) + (aTempArray[i] & 0xFF); - return aCode; -} - -} // anonymous namespace - -namespace vcl -{ - -static ConverterCache aCC; - -sal_uInt16 TranslateChar12(sal_uInt16 src) -{ - return aCC.convertOne( 2, src); -} - -sal_uInt16 TranslateChar13(sal_uInt16 src) -{ - return aCC.convertOne( 3, src); -} - -sal_uInt16 TranslateChar14(sal_uInt16 src) -{ - return aCC.convertOne( 4, src); -} - -sal_uInt16 TranslateChar15(sal_uInt16 src) -{ - return aCC.convertOne( 5, src); -} - -sal_uInt16 TranslateChar16(sal_uInt16 src) -{ - return aCC.convertOne( 6, src); -} - - -} // namespace vcl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/fontsubset/xlat.hxx b/vcl/source/fontsubset/xlat.hxx deleted file mode 100644 index 89eba1b7f460..000000000000 --- a/vcl/source/fontsubset/xlat.hxx +++ /dev/null @@ -1,37 +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 . - */ - -/*| Author: Alexander Gelfenbain |*/ - -#pragma once - -#include <sal/types.h> - -namespace vcl -{ -// TODO: sal_UCS4 - -sal_uInt16 TranslateChar12(sal_uInt16); -sal_uInt16 TranslateChar13(sal_uInt16); -sal_uInt16 TranslateChar14(sal_uInt16); -sal_uInt16 TranslateChar15(sal_uInt16); -sal_uInt16 TranslateChar16(sal_uInt16); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */