[Libreoffice-commits] core.git: forms/source
Stephan Bergmann
sbergman at redhat.com
Tue Jan 23 06:57:17 UTC 2018
forms/source/component/Edit.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 280cc198296b6728d990ee40f92b7f842c4959b1
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Jan 22 16:09:37 2018 +0100
Fix odd check for nFieldLen range, assuming typos
The code used the odd combination of checking signed nFieldLen for != 0 and
<= USHRT_MAX, and then converting to sal_Int16 (not sal_uInt16) ever since
bf4154eb5307ec8c35f000fd1df39ef3abb2eb6d "initial import". But there are indeed
various MaxTextLen properties in offapi of type short, not unsigned short, so
for one assume that checking for <= SAL_MAX_INT16 (not SAL_MAX_UINT16) was
actually intended. And, for another, also assume that checking nFieldLen for
> 0 instead of != 0 was intended.
Change-Id: I119ef3ce71ee397cb6cbca714bca154e29e6599d
Reviewed-on: https://gerrit.libreoffice.org/48348
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx
index 5c845a01866e..0454af30f4ba 100644
--- a/forms/source/component/Edit.cxx
+++ b/forms/source/component/Edit.cxx
@@ -576,7 +576,7 @@ void OEditModel::onConnectedDbColumn( const Reference< XInterface >& _rxForm )
sal_Int32 nFieldLen = 0;
xField->getPropertyValue("Precision") >>= nFieldLen;
- if (nFieldLen && nFieldLen <= USHRT_MAX)
+ if (nFieldLen > 0 && nFieldLen <= SAL_MAX_INT16)
{
Any aVal;
aVal <<= static_cast<sal_Int16>(nFieldLen);
More information about the Libreoffice-commits
mailing list