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) { |