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

Unified Diff: src/core/SkPackBits.cpp

Issue 242643008: fix warnings around size_t/int (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | « src/core/SkDistanceFieldGen.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPackBits.cpp
diff --git a/src/core/SkPackBits.cpp b/src/core/SkPackBits.cpp
index 7a1444b14c0c24bfa955d7fda1cae2a28b66a0d4..3c6197b6f27fff829e816f6cb85d9f31a0ba3d28 100644
--- a/src/core/SkPackBits.cpp
+++ b/src/core/SkPackBits.cpp
@@ -10,7 +10,7 @@
#define GATHER_STATSx
static inline void small_memcpy(void* SK_RESTRICT dst,
- const void* SK_RESTRICT src, int n) {
+ const void* SK_RESTRICT src, size_t n) {
SkASSERT(n > 0 && n <= 15);
uint8_t* d = (uint8_t*)dst;
const uint8_t* s = (const uint8_t*)src;
@@ -34,7 +34,7 @@ static inline void small_memcpy(void* SK_RESTRICT dst,
}
}
-static inline void small_memset(void* dst, uint8_t value, int n) {
+static inline void small_memset(void* dst, uint8_t value, size_t n) {
SkASSERT(n > 0 && n <= 15);
uint8_t* d = (uint8_t*)dst;
switch (n) {
@@ -196,7 +196,7 @@ size_t SkPackBits::Pack16(const uint16_t* SK_RESTRICT src, int count,
const uint16_t* stop = src + count;
for (;;) {
- count = stop - src;
+ count = SkToInt(stop - src);
SkASSERT(count >= 0);
if (count == 0) {
return dst - origDst;
@@ -218,7 +218,7 @@ size_t SkPackBits::Pack16(const uint16_t* SK_RESTRICT src, int count,
break;
}
} while (*s == value);
- dst = flush_same16(dst, value, s - src);
+ dst = flush_same16(dst, value, SkToInt(s - src));
} else { // accumulate diff values...
do {
if (++s == stop) {
@@ -227,7 +227,7 @@ size_t SkPackBits::Pack16(const uint16_t* SK_RESTRICT src, int count,
} while (*s != s[-1]);
s -= 1; // back up so we don't grab one of the "same" values that follow
FLUSH_DIFF:
- dst = flush_diff16(dst, src, s - src);
+ dst = flush_diff16(dst, src, SkToInt(s - src));
}
src = s;
}
@@ -239,7 +239,7 @@ size_t SkPackBits::Pack8(const uint8_t* SK_RESTRICT src, int count,
const uint8_t* stop = src + count;
for (;;) {
- count = stop - src;
+ count = SkToInt(stop - src);
SkASSERT(count >= 0);
if (count == 0) {
return dst - origDst;
@@ -260,7 +260,7 @@ size_t SkPackBits::Pack8(const uint8_t* SK_RESTRICT src, int count,
break;
}
} while (*s == value);
- dst = flush_same8(dst, value, s - src);
+ dst = flush_same8(dst, value, SkToInt(s - src));
} else { // accumulate diff values...
do {
if (++s == stop) {
@@ -271,7 +271,7 @@ size_t SkPackBits::Pack8(const uint8_t* SK_RESTRICT src, int count,
} while (*s != s[-1] || s[-1] != s[-2]);
s -= 2; // back up so we don't grab the "same" values that follow
FLUSH_DIFF:
- dst = flush_diff8(dst, src, s - src);
+ dst = flush_diff8(dst, src, SkToInt(s - src));
}
src = s;
}
@@ -298,7 +298,7 @@ int SkPackBits::Unpack16(const uint8_t* SK_RESTRICT src, size_t srcSize,
dst += n;
}
SkASSERT(src == stop);
- return dst - origDst;
+ return SkToInt(dst - origDst);
}
int SkPackBits::Unpack8(const uint8_t* SK_RESTRICT src, size_t srcSize,
@@ -319,7 +319,7 @@ int SkPackBits::Unpack8(const uint8_t* SK_RESTRICT src, size_t srcSize,
dst += n;
}
SkASSERT(src == stop);
- return dst - origDst;
+ return SkToInt(dst - origDst);
}
enum UnpackState {
@@ -339,7 +339,7 @@ void SkPackBits::Unpack8(uint8_t* SK_RESTRICT dst, size_t dstSkip,
// state 1: do the skip-loop
while (dstSkip > 0) {
- unsigned n = *src++;
+ size_t n = *src++;
if (n <= 127) { // repeat count (n + 1)
n += 1;
if (n > dstSkip) {
@@ -387,7 +387,7 @@ void SkPackBits::Unpack8(uint8_t* SK_RESTRICT dst, size_t dstSkip,
// copy at most dstWrite bytes into dst[]
while (dstWrite > 0) {
- unsigned n = *src++;
+ size_t n = *src++;
if (n <= 127) { // repeat count (n + 1)
n += 1;
if (n > dstWrite) {
« no previous file with comments | « src/core/SkDistanceFieldGen.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698