diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-10-23 11:08:03 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-10-23 17:16:06 +0200 |
commit | 82ade9ab29425b4c76b1a2073325d1269158dc03 (patch) | |
tree | 927f6968e9d6d32981714221a68f96138e4af4b9 /pyuno | |
parent | ec9b799b48b7e93809d4ccbb6b8b3ea1642f7a13 (diff) |
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@redhat.com>
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/source/module/pyuno.cxx | 3 |
1 files changed, 1 insertions, 2 deletions
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; |