hwpfilter/source/hbox.cxx | 1 include/vcl/mnemonic.hxx | 12 ++++----- solenv/gbuild/AllLangMoTarget.mk | 12 +++++++-- vcl/CppunitTest_vcl_mnemonic.mk | 49 +++++++++++++++++++++++++++++++++++++++ vcl/Module_vcl.mk | 1 vcl/qa/cppunit/mnemonic.cxx | 42 +++++++++++++++++++++++++++++++++ vcl/source/window/mnemonic.cxx | 10 +++---- 7 files changed, 113 insertions(+), 14 deletions(-)
New commits: commit 5488ff0be8ec4625822428781298ffb76ea84041 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Jul 21 20:07:41 2017 +0100 mnemonics in words with Eszett misplaced because the text is normalized with toUpper and uppercase à is SS and using the insertion index of the normalized string in the original string is out by one if we normalize with toLower then according to icu/source/data/unidata/SpecialCasing.txt then as long as the language is not Lithuanian its always one to one so just normalize to lower case with blank locale Change-Id: I0ad1c7e2ad0216b7c27ec62105f9a25672ade8a8 diff --git a/include/vcl/mnemonic.hxx b/include/vcl/mnemonic.hxx index 26e4e5e15458..f531ab66d348 100644 --- a/include/vcl/mnemonic.hxx +++ b/include/vcl/mnemonic.hxx @@ -31,14 +31,14 @@ #define MNEMONIC_RANGE_1_START 0x30 #define MNEMONIC_RANGE_1_END 0x39 // Latin A-Z -#define MNEMONIC_RANGE_2_START 0x41 -#define MNEMONIC_RANGE_2_END 0x5A +#define MNEMONIC_RANGE_2_START 0x61 +#define MNEMONIC_RANGE_2_END 0x7A // Cyrillic -#define MNEMONIC_RANGE_3_START 0x0410 -#define MNEMONIC_RANGE_3_END 0x042F +#define MNEMONIC_RANGE_3_START 0x0430 +#define MNEMONIC_RANGE_3_END 0x044F // Greek -#define MNEMONIC_RANGE_4_START 0x0391 -#define MNEMONIC_RANGE_4_END 0x03AB +#define MNEMONIC_RANGE_4_START 0x03B1 +#define MNEMONIC_RANGE_4_END 0x03CB #define MNEMONIC_RANGES 4 #define MAX_MNEMONICS ((MNEMONIC_RANGE_1_END-MNEMONIC_RANGE_1_START+1)+\ (MNEMONIC_RANGE_2_END-MNEMONIC_RANGE_2_START+1)+\ diff --git a/vcl/CppunitTest_vcl_mnemonic.mk b/vcl/CppunitTest_vcl_mnemonic.mk new file mode 100644 index 000000000000..15dc99e8f0a9 --- /dev/null +++ b/vcl/CppunitTest_vcl_mnemonic.mk @@ -0,0 +1,49 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,vcl_mnemonic)) + +$(eval $(call gb_CppunitTest_set_include,vcl_mnemonic,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,vcl_mnemonic, \ + vcl/qa/cppunit/mnemonic \ +)) + +$(eval $(call gb_CppunitTest_use_externals,vcl_mnemonic,boost_headers)) + +$(eval $(call gb_CppunitTest_use_libraries,vcl_mnemonic, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + svt \ + test \ + tl \ + tk \ + unotest \ + vcl \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,vcl_mnemonic)) + +$(eval $(call gb_CppunitTest_use_ure,vcl_mnemonic)) +$(eval $(call gb_CppunitTest_use_vcl,vcl_mnemonic)) + +$(eval $(call gb_CppunitTest_use_components,vcl_mnemonic,\ + configmgr/source/configmgr \ + i18npool/util/i18npool \ + ucb/source/core/ucb1 \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,vcl_mnemonic)) + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 218cae68efc1..15e9d77ca485 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -149,6 +149,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\ CppunitTest_vcl_complextext \ CppunitTest_vcl_filters_test \ CppunitTest_vcl_mapmode \ + CppunitTest_vcl_mnemonic \ CppunitTest_vcl_outdev \ CppunitTest_vcl_app_test \ CppunitTest_vcl_jpeg_read_write_test \ diff --git a/vcl/qa/cppunit/mnemonic.cxx b/vcl/qa/cppunit/mnemonic.cxx new file mode 100644 index 000000000000..1e5ec74c1ec8 --- /dev/null +++ b/vcl/qa/cppunit/mnemonic.cxx @@ -0,0 +1,42 @@ +/* -*- 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/. + */ + +#include <test/bootstrapfixture.hxx> +#include <cppunit/TestAssert.h> +#include <cppunit/TestFixture.h> + +#include <osl/file.hxx> +#include <osl/process.h> + +#include <vcl/mnemonic.hxx> + +class VclMnemonicTest : public test::BootstrapFixture +{ +public: + VclMnemonicTest() : BootstrapFixture(true, false) {} + + void testMnemonic(); + + CPPUNIT_TEST_SUITE(VclMnemonicTest); + CPPUNIT_TEST(testMnemonic); + CPPUNIT_TEST_SUITE_END(); +}; + +void VclMnemonicTest::testMnemonic() +{ + MnemonicGenerator aGenerator; + OUString sResult = aGenerator.CreateMnemonic(OUString::fromUtf8(u8"Ãa")); + CPPUNIT_ASSERT_EQUAL(sResult[1], sal_Unicode('~')); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(VclMnemonicTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx index fe57879d6444..b95f372f33c3 100644 --- a/vcl/source/window/mnemonic.cxx +++ b/vcl/source/window/mnemonic.cxx @@ -72,14 +72,13 @@ sal_Unicode MnemonicGenerator::ImplFindMnemonic( const OUString& rKey ) void MnemonicGenerator::RegisterMnemonic( const OUString& rKey ) { - const css::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale(); uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass(); // Don't crash even when we don't have access to i18n service if ( !xCharClass.is() ) return; - OUString aKey = xCharClass->toUpper( rKey, 0, rKey.getLength(), rLocale ); + OUString aKey = xCharClass->toLower(rKey, 0, rKey.getLength(), css::lang::Locale()); // If we find a Mnemonic, set the flag. In other case count the // characters, because we need this to set most as possible @@ -116,14 +115,13 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey ) if ( _rKey.isEmpty() || ImplFindMnemonic( _rKey ) ) return _rKey; - const css::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale(); uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass(); // Don't crash even when we don't have access to i18n service if ( !xCharClass.is() ) return _rKey; - OUString aKey = xCharClass->toUpper( _rKey, 0, _rKey.getLength(), rLocale ); + OUString aKey = xCharClass->toLower(_rKey, 0, _rKey.getLength(), css::lang::Locale()); bool bChanged = false; sal_Int32 nLen = aKey.getLength(); @@ -255,7 +253,7 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey ) // Append Ascii Mnemonic for ( c = MNEMONIC_RANGE_2_START; c <= MNEMONIC_RANGE_2_END; c++ ) { - nMnemonicIndex = ImplGetMnemonicIndex( c ); + nMnemonicIndex = ImplGetMnemonicIndex(sal_Unicode(rtl::toAsciiUpperCase(c))); if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND ) { if ( maMnemonics[nMnemonicIndex] ) @@ -316,7 +314,7 @@ OUString MnemonicGenerator::EraseAllMnemonicChars( const OUString& rStr ) // check for CJK-style mnemonic if( i > 0 && (i+2) < nLen ) { - sal_Unicode c = aStr[i+1]; + sal_Unicode c = sal_Unicode(rtl::toAsciiUpperCase(aStr[i+1])); if( aStr[ i-1 ] == '(' && aStr[ i+2 ] == ')' && c >= MNEMONIC_RANGE_2_START && c <= MNEMONIC_RANGE_2_END ) commit 91795dfd726c76db03e5bc731608e7bff8eabacb Author: Caolán McNamara <caol...@redhat.com> Date: Fri Jul 21 16:12:49 2017 +0100 call python script with whatever is set as the python to use Change-Id: I5dcfe7c1eca2f6388d6606521722a5fe876a9f34 diff --git a/solenv/gbuild/AllLangMoTarget.mk b/solenv/gbuild/AllLangMoTarget.mk index d3953b1163ae..8276f76a0b98 100644 --- a/solenv/gbuild/AllLangMoTarget.mk +++ b/solenv/gbuild/AllLangMoTarget.mk @@ -25,6 +25,14 @@ # MoTarget +ifeq ($(SYSTEM_PYTHON),) +gb_Python_EXECUTABLE := $(gb_Python_INSTALLED_EXECUTABLE) +gb_Python_DEPS ?= $(call gb_Package_get_target,python3) $(call gb_Package_get_target,python_shell) +else +gb_Python_EXECUTABLE := $(PYTHON_FOR_BUILD) +gb_Python_DEPS := +endif + $(call gb_MoTarget_get_clean_target,%) : $(call gb_Output_announce,$*,$(false),RES,2) $(call gb_Helper_abbreviate_dirs,\ @@ -32,14 +40,14 @@ $(call gb_MoTarget_get_clean_target,%) : $(call gb_MoTarget_get_target,$*) \ $(call gb_MoTarget_get_install_target,$*)) -$(call gb_MoTarget_get_target,%) : $(gb_Helper_MISCDUMMY) +$(call gb_MoTarget_get_target,%) : $(gb_Helper_MISCDUMMY) $(gb_Python_DEPS) $(call gb_Output_announce,$*,$(true),MO,2) # after translate should look like this # $(call gb_Helper_abbreviate_dirs,\ # mkdir -p $(dir $@) && \ # $(MSGUNIQ) $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION)/messages.po | $(MSGFMT) - -o $@) $(call gb_Helper_abbreviate_dirs,\ - mkdir -p $(dir $@) && $(SRCDIR)/solenv/bin/interim-update-module-for-gettext $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION) $@.po && \ + mkdir -p $(dir $@) && $(gb_Python_EXECUTABLE) $(SRCDIR)/solenv/bin/interim-update-module-for-gettext $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION) $@.po && \ $(MSGUNIQ) --force-po $@.po | $(MSGFMT) - -o $@) #$(info $(call gb_MoTarget_get_target,$(1))) commit bbe1636291cbfe3a8c2690b692740e1c823403be Author: Caolán McNamara <caol...@redhat.com> Date: Fri Jul 21 21:35:49 2017 +0100 ofz#2704 null-dereference read Change-Id: Iaadec2dfdebd2b2e273d369cc22f48153cd6d213 diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx index 7520c68c934a..491353f92e61 100644 --- a/hwpfilter/source/hbox.cxx +++ b/hwpfilter/source/hbox.cxx @@ -379,6 +379,7 @@ Picture::Picture() , pictype(0) , ishyper(false) { + memset(&picinfo, 0, sizeof(picinfo)); } Picture::~Picture()
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits