summaryrefslogtreecommitdiff
path: root/unotools/source/i18n/localedatawrapper.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2022-08-22 16:16:08 +0200
committerEike Rathke <erack@redhat.com>2022-08-22 20:30:20 +0200
commitb759f6720b50487200740a6202e21774897b44b2 (patch)
tree0d81b960d30952be168c4d43ea9a67942f5f9798 /unotools/source/i18n/localedatawrapper.cxx
parent96d71754db51bf4eb0fba98a759e90a373e1d10a (diff)
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 <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'unotools/source/i18n/localedatawrapper.cxx')
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx20
1 files changed, 7 insertions, 13 deletions
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: */