[pytango] 265/483: fixes #612
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.
commit 5cb035226e9377646d4991d7915b71409291d6d6
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date: Mon Jul 8 16:11:32 2013 +0000
fixes #612
git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@23087 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
src/boost/cpp/device_attribute.cpp | 3 ++-
src/boost/cpp/device_attribute_numpy.hpp | 12 +++++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/boost/cpp/device_attribute.cpp b/src/boost/cpp/device_attribute.cpp
index c61ff74..3bdc20b 100644
--- a/src/boost/cpp/device_attribute.cpp
+++ b/src/boost/cpp/device_attribute.cpp
@@ -624,7 +624,8 @@ namespace PyDeviceAttribute
if (isImage) {
for(CORBA::ULong y = 0; y < dim_y; ++y) {
object py_sub = py_value[y];
- if (len(py_sub) != dim_x)
+ CORBA::ULong len_py_sub = static_cast<CORBA::ULong>(boost::python::len(py_sub));
+ if (len_py_sub != dim_x)
raise_(PyExc_TypeError, non_valid_image);
for(CORBA::ULong x = 0; x < dim_x; ++x) {
python_tangocpp<tangoTypeConst>::to_cpp(py_sub[x], buffer[x + y*dim_x]);
diff --git a/src/boost/cpp/device_attribute_numpy.hpp b/src/boost/cpp/device_attribute_numpy.hpp
index 9932620..b770771 100644
--- a/src/boost/cpp/device_attribute_numpy.hpp
+++ b/src/boost/cpp/device_attribute_numpy.hpp
@@ -239,16 +239,18 @@ namespace PyDeviceAttribute {
// x and y position it corresponded! Yes, 'iter' has a coordinates
// field, but it was always [0,0], never updated!!
npy_intp coordinates[2];
- Py_ssize_t &x = coordinates[1];
- Py_ssize_t &y = coordinates[0];
- for (y=0; y < dim_y; ++y) {
- for (x=0; x < dim_x; ++x) {
+ npy_intp &x = coordinates[1];
+ npy_intp &y = coordinates[0];
+ npy_intp ndim_x = static_cast<npy_intp>(dim_x);
+ npy_intp ndim_y = static_cast<npy_intp>(dim_y);
+ for (y=0; y < ndim_y; ++y) {
+ for (x=0; x < ndim_x; ++x) {
PyArray_ITER_GOTO(iter, coordinates);
PyObject* dataObj = PyArray_GETITEM(array, iter->dataptr);
const object py_data = object( handle<>( dataObj ) );
- buffer[y*dim_x + x] = extract<TangoScalarType>(py_data);
+ buffer[y*ndim_x + x] = extract<TangoScalarType>(py_data);
}
}
} else {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git
More information about the debian-science-commits
mailing list