[Libreoffice-commits] core.git: pyuno/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 23 15:16:59 UTC 2020
pyuno/source/module/pyuno.cxx | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 82ade9ab29425b4c76b1a2073325d1269158dc03
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Oct 23 11:08:03 2020 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Oct 23 17:16:06 2020 +0200
PyLong_AsLongAndOverflow returns long, and that's fine to use here
...where the goal is to check for a value in the range
[SAL_MIN_INT32 .. SAL_MAX_INT32], i.e., [-2^31 .. 2^31 - 1]: While C++17 (via C
LONG_MIN, LONG_MAX) only guarantees a range of [-(2^31 - 1) .. 2^31 - 1] for
long, C++20 now requires two's complement and a fitting range of at least
[-2^31 .. 2^31 - 1].
No need for 0d79d216886a71436e705c93829ed66a33270a9c "long->tools::Long in
pyuno..sd" here.
Change-Id: I6be60b50acfe5ed798cc8e9e1183c336c8d72059
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104712
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 527bcdbf76b5..25aea6436032 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -24,7 +24,6 @@
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
-#include <tools/long.hxx>
#include <typelib/typedescription.hxx>
@@ -319,7 +318,7 @@ static sal_Int32 lcl_PyNumber_AsSal_Int32( PyObject *pObj )
// Convert Python number to platform long, then check actual value against
// bounds of sal_Int32
int nOverflow;
- tools::Long nResult = PyLong_AsLongAndOverflow( pObj, &nOverflow );
+ long nResult = PyLong_AsLongAndOverflow( pObj, &nOverflow );
if ( nOverflow || nResult > SAL_MAX_INT32 || nResult < SAL_MIN_INT32) {
PyErr_SetString( PyExc_IndexError, "Python int too large to convert to UNO long" );
return -1;
More information about the Libreoffice-commits
mailing list