From b759f6720b50487200740a6202e21774897b44b2 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 22 Aug 2022 16:16:08 +0200 Subject: Resolves: tdf#150288 Do not prepend the locale's full date acceptance pattern ... if it wasn't present as first, but take the date acceptance patterns as specified by the user. Change-Id: Ife2fd39731bac0e0b121f22392f22b48ffc9c978 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138694 Reviewed-by: Eike Rathke Tested-by: Jenkins --- unotools/source/i18n/localedatawrapper.cxx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'unotools/source/i18n/localedatawrapper.cxx') diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 54aa49f44877..9e6fe8990979 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -1550,19 +1550,13 @@ void LocaleDataWrapper::loadDateAcceptancePatterns( } } - // Never overwrite the locale's full date pattern! The first. - if (std::as_const(aDateAcceptancePatterns)[0] == rPatterns[0]) - aDateAcceptancePatterns = comphelper::containerToSequence(rPatterns); // sane - else - { - // Copy existing full date pattern and append the sequence passed. - /* TODO: could check for duplicates and shrink target sequence */ - Sequence< OUString > aTmp( rPatterns.size() + 1 ); - auto it = aTmp.getArray(); - *it = std::as_const(aDateAcceptancePatterns)[0]; - std::copy(rPatterns.begin(), rPatterns.end(), std::next(it)); - aDateAcceptancePatterns = aTmp; - } + // Earlier versions checked for presence of the full date pattern with + // aDateAcceptancePatterns[0] == rPatterns[0] and prepended that if not. + // This lead to confusion if the patterns were intentionally specified + // without, giving entirely a different DMY order, see tdf#150288. + // Not checking this and accepting the given patterns as is may result in + // the user shooting themself in the foot, but we can't have both. + aDateAcceptancePatterns = comphelper::containerToSequence(rPatterns); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit