Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: tests/StreamTest.cpp

Issue 1297143004: SkStream Testing: fix bug in new unit test. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/StreamTest.cpp
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
index 08adf142c10313bb0f1b4983556db9ec025387a4..6f78eca5f0de6c4554db514ccad9c0fbb9138e38 100644
--- a/tests/StreamTest.cpp
+++ b/tests/StreamTest.cpp
@@ -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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698