SkStream Testing: fix bug in new unit test.

Review URL: https://codereview.chromium.org/1297143004
This commit is contained in:
halcanary 2015-08-19 07:22:04 -07:00 committed by Commit bot
parent a4c3244760
commit d75e21dade

View File

@ -343,15 +343,15 @@ public:
DumbStream(const uint8_t* data, size_t n)
: fData(data), fCount(n), fIdx(0) {}
size_t read(void* buffer, size_t size) override {
size_t c = SkTMin(fCount - fIdx, size);
if (c) {
memcpy(buffer, &fData[fIdx], size);
fIdx += c;
size_t copyCount = SkTMin(fCount - fIdx, size);
if (copyCount) {
memcpy(buffer, &fData[fIdx], copyCount);
fIdx += copyCount;
}
return c;
return copyCount;
}
bool isAtEnd() const override {
return fCount > fIdx;
return fCount == fIdx;
}
private:
const uint8_t* fData;