result r = E_SUCCESS;
std::unique_ptr<ByteBuffer> pByteBuffer(new (std::nothrow) ByteBuffer());
SysTryReturn(NID_SCL, pByteBuffer != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- r = pByteBuffer->Construct(pByteArray.release(), 0, byteBufferLength, byteBufferLength);
+ r = pByteBuffer->Construct(byteBufferLength);
SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = pByteBuffer->SetArray(pByteArray.get(), 0, byteBufferLength);
+ pByteBuffer->Rewind();
return pByteBuffer.release();
}