Hi, i would like to know what is the appropriate way to create a Document from a buffer(unsigned char*).
I have a class member SmartPtr m_Document and a function that loads it from a buffer
void LoadFromBuffer(const unsigned char *buff, size_t length)
{
auto arr = MakeArray<uint8_t>(length, buff);
auto streamIn = MakeObject< System::IO::MemoryStream>(arr);
m_Document = MakeObject< Document>(streamIn);
}
Also i would like to know if it is posible to have any memmory leak if i do it this way.
Your LoadFromBuffer function is correct. This method should not lead to memory leaks.
We spent a lot of time to get rid of memory leaks from our library and we intend to continue this work. However, if you notice any issue, please feel free to let us know.