-----------------------------------------------------------------------------
| 118 | |
| 119 | //----------------------------------------------------------------------------- |
| 120 | tresult PLUGIN_API MemoryStream::write (void* buffer, int32 numBytes, int32* numBytesWritten) |
| 121 | { |
| 122 | if (allocationError) |
| 123 | return kOutOfMemory; |
| 124 | if (buffer == nullptr) |
| 125 | return kInvalidArgument; |
| 126 | |
| 127 | // Does write exceed size ? |
| 128 | TSize requiredSize = cursor + numBytes; |
| 129 | if (requiredSize > size) |
| 130 | { |
| 131 | if (requiredSize > memorySize) |
| 132 | setSize (requiredSize); |
| 133 | else |
| 134 | size = requiredSize; |
| 135 | } |
| 136 | |
| 137 | // Copy data |
| 138 | if (memory && cursor >= 0 && numBytes > 0) |
| 139 | { |
| 140 | memcpy (&memory[cursor], buffer, static_cast<size_t> (numBytes)); |
| 141 | // Update cursor |
| 142 | cursor += numBytes; |
| 143 | } |
| 144 | else |
| 145 | numBytes = 0; |
| 146 | |
| 147 | if (numBytesWritten) |
| 148 | *numBytesWritten = numBytes; |
| 149 | |
| 150 | return kResultTrue; |
| 151 | } |
| 152 | |
| 153 | //----------------------------------------------------------------------------- |
| 154 | tresult PLUGIN_API MemoryStream::seek (int64 pos, int32 mode, int64* result) |
no outgoing calls
no test coverage detected