File tree 1 file changed +2
-7
lines changed 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -32,20 +32,15 @@ void Decoder::decode_bytes(
32
32
if (decoder) {
33
33
decoder->setTimeBase (timeBase);
34
34
decoder->setTimeMultiplier (1 ); // report in usecs instead of nanoseconds
35
- const size_t bufSize = PyByteArray_GET_SIZE (events.ptr ());
36
- // for some reason this returns a bad pointer
37
- // const uint8_t *buf = reinterpret_cast<uint8_t *>(PyByteArray_AsString(events.ptr()));
38
- // TODO(Bernd): avoid the memory copy here
39
- const std::string foo (events); // creates unnecessary copy!
40
35
delete cdEvents_; // in case events have not been picked up
41
36
cdEvents_ = new std::vector<EventCD>();
42
37
delete extTrigEvents_; // in case events have not been picked up
43
38
extTrigEvents_ = new std::vector<EventExtTrig>();
44
39
// TODO(Bernd): use hack here to avoid initializing the memory
45
40
cdEvents_->reserve (maxSizeCD_);
46
41
extTrigEvents_->reserve (maxSizeExtTrig_);
47
- const uint8_t * buf = reinterpret_cast <const uint8_t *>(&foo[ 0 ] );
48
- decoder->decode (buf, bufSize , this );
42
+ const uint8_t * buf = reinterpret_cast <const uint8_t *>(PyBytes_AsString (events. ptr ()) );
43
+ decoder->decode (buf, PyBytes_Size (events. ptr ()) , this );
49
44
}
50
45
}
51
46
You can’t perform that action at this time.
0 commit comments