unotools/source/i18n/localedatawrapper.cxx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
New commits: commit df6601c2432fa6353c9641cedea918fc524ae31d Author: Eike Rathke <er...@redhat.com> AuthorDate: Mon Aug 22 16:16:08 2022 +0200 Commit: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> CommitDate: Wed Aug 24 15:32:06 2022 +0200 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 <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit 5061f59ae538a35c9531c366574c64007cb9f0be) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138545 Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 55cde4a360a4..25a3fc2f5218 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: */