MCPcopy Create free account
hub / github.com/carbonengine/trinity / SetBufferAndSize

Method SetBufferAndSize

trinity/Controllers/Actions/Tr2ActionPython.cpp:236–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236void Tr2ActionPython::SetBufferAndSize( const char* memberName, uint8_t* buffer, size_t bufferSize )
237{
238 if( !m_instance )
239 {
240 InstantiateObject();
241 }
242 if( !m_vtable.onLoad )
243 {
244 return;
245 }
246
247 auto gil = PyGILState_Ensure();
248 ON_BLOCK_EXIT( [&gil] { PyGILState_Release( gil ); } );
249
250 std::string state( (const char*)buffer, bufferSize );
251 PyObject* bytes = PyVerCompat::ToPyBytes( state.data(), state.size() );
252 m_vtable.onLoad.CallVoid( bytes ).ReportException();
253 Py_XDECREF( bytes );
254 delete[] buffer;
255}

Callers

nothing calls this directly

Calls 2

ToPyBytesFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected