diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-19 22:00:40 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-19 22:00:40 +0000 |
commit | 2cfa3200fda29279eba1240170c7e873d12f9d48 (patch) | |
tree | 42c50379d08cfbbf9d2af7b316010feafe1b1f78 | |
parent | 2dceedaa1e4dfb9accc82d8e3d3afac9ba5b2142 (diff) |
fix warnings around size_t/int
fix warnings around undeclared (non-static) functions
TBR=bsalomon@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/242643008
git-svn-id: http://skia.googlecode.com/svn/trunk@14267 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/core/SkDescriptor.h | 4 | ||||
-rwxr-xr-x | src/core/SkDistanceFieldGen.cpp | 6 | ||||
-rw-r--r-- | src/core/SkPackBits.cpp | 24 | ||||
-rw-r--r-- | src/core/SkPaint.cpp | 11 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 8 | ||||
-rw-r--r-- | src/gpu/GrTHashTable.h | 5 | ||||
-rw-r--r-- | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkLuaCanvas.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkMatrix22.cpp | 1 | ||||
-rw-r--r-- | src/utils/SkMatrix22.h | 5 |
10 files changed, 38 insertions, 30 deletions
diff --git a/src/core/SkDescriptor.h b/src/core/SkDescriptor.h index e71ff41b5c..c526451af5 100644 --- a/src/core/SkDescriptor.h +++ b/src/core/SkDescriptor.h @@ -37,14 +37,14 @@ public: uint32_t getLength() const { return fLength; } - void* addEntry(uint32_t tag, uint32_t length, const void* data = NULL) { + void* addEntry(uint32_t tag, size_t length, const void* data = NULL) { SkASSERT(tag); SkASSERT(SkAlign4(length) == length); SkASSERT(this->findEntry(tag, NULL) == NULL); Entry* entry = (Entry*)((char*)this + fLength); entry->fTag = tag; - entry->fLen = length; + entry->fLen = SkToU32(length); if (data) { memcpy(entry + 1, data, length); } diff --git a/src/core/SkDistanceFieldGen.cpp b/src/core/SkDistanceFieldGen.cpp index aec5f1d13e..ef0ee86d59 100755 --- a/src/core/SkDistanceFieldGen.cpp +++ b/src/core/SkDistanceFieldGen.cpp @@ -329,9 +329,9 @@ static unsigned char pack_distance_field_val(float dist, float distanceMagnitude // assumes a padded 8-bit image and distance field // width and height are the original width and height of the image -bool generate_distance_field_from_image(unsigned char* distanceField, - const unsigned char* copyPtr, - int width, int height) { +static bool generate_distance_field_from_image(unsigned char* distanceField, + const unsigned char* copyPtr, + int width, int height) { SkASSERT(NULL != distanceField); SkASSERT(NULL != copyPtr); diff --git a/src/core/SkPackBits.cpp b/src/core/SkPackBits.cpp index 7a1444b14c..3c6197b6f2 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) { diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 241175e4e0..176992f441 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -536,12 +536,11 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength, case kUTF8_TextEncoding: return SkUTF8_CountUnichars((const char*)textData, byteLength); case kUTF16_TextEncoding: - return SkUTF16_CountUnichars((const uint16_t*)textData, - byteLength >> 1); + return SkUTF16_CountUnichars((const uint16_t*)textData, SkToInt(byteLength >> 1)); case kUTF32_TextEncoding: - return byteLength >> 2; + return SkToInt(byteLength >> 2); case kGlyphID_TextEncoding: - return byteLength >> 1; + return SkToInt(byteLength >> 1); default: SkDEBUGFAIL("unknown text encoding"); } @@ -554,7 +553,7 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength, if (this->getTextEncoding() == kGlyphID_TextEncoding) { // we want to ignore the low bit of byteLength memcpy(glyphs, textData, byteLength >> 1 << 1); - return byteLength >> 1; + return SkToInt(byteLength >> 1); } SkAutoGlyphCache autoCache(*this, NULL, NULL); @@ -589,7 +588,7 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength, default: SkDEBUGFAIL("unknown text encoding"); } - return gptr - glyphs; + return SkToInt(gptr - glyphs); } bool SkPaint::containsText(const void* textData, size_t byteLength) const { diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 52ea56d5a0..ba18392c88 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -310,14 +310,14 @@ bool SkPicturePlayback::containsBitmaps() const { #include "SkStream.h" -static void write_tag_size(SkWriteBuffer& buffer, uint32_t tag, uint32_t size) { +static void write_tag_size(SkWriteBuffer& buffer, uint32_t tag, size_t size) { buffer.writeUInt(tag); buffer.writeUInt(size); } -static void write_tag_size(SkWStream* stream, uint32_t tag, uint32_t size) { +static void write_tag_size(SkWStream* stream, uint32_t tag, size_t size) { stream->write32(tag); - stream->write32(size); + stream->write32(SkToU32(size)); } static size_t compute_chunk_size(SkFlattenable::Factory* array, int count) { @@ -357,7 +357,7 @@ static void write_factories(SkWStream* stream, const SkFactorySet& rec) { if (NULL == name || 0 == *name) { stream->writePackedUInt(0); } else { - uint32_t len = strlen(name); + size_t len = strlen(name); stream->writePackedUInt(len); stream->write(name, len); } diff --git a/src/gpu/GrTHashTable.h b/src/gpu/GrTHashTable.h index 83462c70c9..9307425b91 100644 --- a/src/gpu/GrTHashTable.h +++ b/src/gpu/GrTHashTable.h @@ -61,7 +61,10 @@ private: kHashCount = 1 << kHashBits, kHashMask = kHashCount - 1 }; - static unsigned hash2Index(uint32_t hash) { + static unsigned hash2Index(intptr_t hash) { + if (sizeof(hash) == 8) { + hash ^= hash >> 32; + } hash ^= hash >> 16; if (kHashBits <= 8) { hash ^= hash >> 8; diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp index 2751e02c18..cbfbb266c5 100644 --- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp +++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp @@ -712,7 +712,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target, case GR_GL_BUFFER_SIZE: *params = 0; if (buffer) - *params = buffer->getSize(); + *params = SkToInt(buffer->getSize()); break; case GR_GL_BUFFER_USAGE: *params = GR_GL_STATIC_DRAW; diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp index 7e1d5a8fe2..531cbb0064 100644 --- a/src/utils/SkLuaCanvas.cpp +++ b/src/utils/SkLuaCanvas.cpp @@ -168,7 +168,7 @@ void SkLuaCanvas::drawPaint(const SkPaint& paint) { void SkLuaCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) { AUTO_LUA("drawPoints"); - lua.pushArrayPoint(pts, count, "points"); + lua.pushArrayPoint(pts, SkToInt(count), "points"); lua.pushPaint(paint, "paint"); } diff --git a/src/utils/SkMatrix22.cpp b/src/utils/SkMatrix22.cpp index 107e123a68..a13b72939f 100644 --- a/src/utils/SkMatrix22.cpp +++ b/src/utils/SkMatrix22.cpp @@ -6,6 +6,7 @@ */ #include "SkMatrix.h" +#include "SkMatrix22.h" #include "SkPoint.h" #include "SkScalar.h" diff --git a/src/utils/SkMatrix22.h b/src/utils/SkMatrix22.h index d0f4ed3155..bc567eab8e 100644 --- a/src/utils/SkMatrix22.h +++ b/src/utils/SkMatrix22.h @@ -5,6 +5,9 @@ * found in the LICENSE file. */ +#ifndef SkMatrix22_DEFINED +#define SkMatrix22_DEFINED + #include "SkPoint.h" class SkMatrix; @@ -24,3 +27,5 @@ class SkMatrix; * and saves a multiply by not computing r. */ void SkComputeGivensRotation(const SkVector& h, SkMatrix* G); + +#endif |