diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index 1d8b4d7f124ff1614bf2e211f6f037d6ac0e126d..31ae7f5f2ec6b939ac9a5f6c1b08fd6f5ad2d829 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -1406,9 +1406,13 @@ def _enqueue_copy_buffer_rect(queue, src, dst, src_origin, dst_origin, region, if src_pitches is None: src_pitches = _ffi.NULL src_pitches_l = 0 + else: + src_pitches_l = len(src_pitches) if dst_pitches is None: dst_pitches = _ffi.NULL dst_pitches_l = 0 + else: + dst_pitches_l = len(dst_pitches) src_origin_l = len(src_origin) dst_origin_l = len(dst_origin) region_l = len(region) diff --git a/src/c_wrapper/utils.h b/src/c_wrapper/utils.h index 62fb359ca8d9f31750f46ebad37f2a5af2e265d8..d1bbb7d06f0779537bb61c953e2aae07e1e0e412 100644 --- a/src/c_wrapper/utils.h +++ b/src/c_wrapper/utils.h @@ -386,10 +386,8 @@ public: { if (l < n) { memcpy(m_intern_buf, buf, type_size<T>::value * l); - if (content) { - for (size_t i = l;i < n;i++) { - m_intern_buf[i] = content; - } + for (size_t i = l;i < n;i++) { + m_intern_buf[i] = content; } this->set(m_intern_buf); }