12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #include <kopano/platform.h>
- #include "inputStreamMAPIAdapter.h"
- namespace KC {
- inputStreamMAPIAdapter::inputStreamMAPIAdapter(IStream *lpStream)
- {
- this->lpStream = lpStream;
- if (lpStream)
- lpStream->AddRef();
- }
- inputStreamMAPIAdapter::~inputStreamMAPIAdapter()
- {
- if (lpStream)
- lpStream->Release();
- }
- size_t inputStreamMAPIAdapter::read(unsigned char *data, size_t count)
- {
- ULONG ulSize = 0;
- if (lpStream->Read(data, count, &ulSize) != hrSuccess)
- return 0;
- if (ulSize != count)
- this->ateof = true;
- return ulSize;
- }
- void inputStreamMAPIAdapter::reset()
- {
- LARGE_INTEGER move;
- move.QuadPart = 0;
- lpStream->Seek(move, SEEK_SET, NULL);
- this->ateof = false;
- }
- size_t inputStreamMAPIAdapter::skip(size_t count)
- {
- ULARGE_INTEGER ulSize;
- LARGE_INTEGER move;
- move.QuadPart = count;
- lpStream->Seek(move, SEEK_CUR, &ulSize);
- if (ulSize.QuadPart != count)
- this->ateof = true;
- return ulSize.QuadPart;
- }
- }
|