Skip to content

Commit

Permalink
Call vec.data() instead of &vec[0] (ray-project#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadn authored and pcmoritz committed Jul 6, 2016
1 parent 1f4ab05 commit 5412d3c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/raylib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static PyObject* deserialize(PyObject* worker_capsule, const Obj& obj, std::vect
for (int i = 0; i < array.shape_size(); ++i) {
dims.push_back(array.shape(i));
}
PyArrayObject* pyarray = (PyArrayObject*) PyArray_SimpleNew(array.shape_size(), &dims[0], array.dtype());
PyArrayObject* pyarray = (PyArrayObject*) PyArray_SimpleNew(array.shape_size(), dims.data(), array.dtype());
switch (array.dtype()) {
RAYLIB_DESERIALIZE_NPY(FLOAT, npy_float, float)
RAYLIB_DESERIALIZE_NPY(DOUBLE, npy_double, double)
Expand Down
2 changes: 1 addition & 1 deletion src/worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void Worker::put_object(ObjRef objref, const Obj* obj, std::vector<ObjRef> &cont
ObjHandle result;
RAY_CHECK(receive_obj_queue_.receive(&result), "error receiving over IPC");
uint8_t* target = segmentpool_->get_address(result);
std::memcpy(target, &data[0], data.size());
std::memcpy(target, data.data(), data.size());
// We immediately unmap here; if the object is going to be accessed again, it will be mapped again;
// This is reqired because we do not have a mechanism to unmap the object later.
segmentpool_->unmap_segment(result.segmentid());
Expand Down

0 comments on commit 5412d3c

Please sign in to comment.