aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-27 13:42:58 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-27 13:42:58 +0000
commit7fa2a65c0cfc714364490cb715171461143024e0 (patch)
treeb7e40b0ca71a7ac8d957d150f038603cde2dcd3c
parent1a5e51f94ed8cb01600184119e52bb64bdb3dccc (diff)
fix more 64bit warnings
BUG=skia: Review URL: https://codereview.chromium.org/147683003 git-svn-id: http://skia.googlecode.com/svn/trunk@13190 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gm/getpostextpath.cpp4
-rw-r--r--gm/nonclosedpaths.cpp4
-rw-r--r--gm/offsetimagefilter.cpp2
-rw-r--r--gm/polygons.cpp4
-rw-r--r--gm/testimagefilters.cpp2
-rw-r--r--gm/typeface.cpp2
-rw-r--r--include/core/SkTypes.h2
-rw-r--r--samplecode/SampleAll.cpp6
-rw-r--r--samplecode/SampleApp.cpp2
-rw-r--r--samplecode/SampleComplexClip.cpp2
-rw-r--r--samplecode/SampleEncode.cpp6
-rw-r--r--samplecode/SampleHairline.cpp5
-rw-r--r--samplecode/SamplePatch.cpp2
-rw-r--r--samplecode/SampleRegion.cpp2
-rw-r--r--samplecode/SampleRotateCircles.cpp2
-rw-r--r--samplecode/SampleShaderText.cpp2
-rw-r--r--samplecode/SampleSlides.cpp2
-rw-r--r--src/core/SkDebug.cpp5
-rw-r--r--src/core/SkFlate.cpp4
-rw-r--r--src/core/SkPictureFlat.h4
-rwxr-xr-xsrc/ports/SkFontHost_mac.cpp24
-rw-r--r--src/ports/SkImageDecoder_CG.cpp4
-rw-r--r--src/utils/SkLua.cpp2
-rw-r--r--src/utils/SkLuaCanvas.cpp3
-rw-r--r--src/views/mac/SkOptionsTableView.mm10
25 files changed, 58 insertions, 49 deletions
diff --git a/gm/getpostextpath.cpp b/gm/getpostextpath.cpp
index 0f2eb7983e..68faf95fad 100644
--- a/gm/getpostextpath.cpp
+++ b/gm/getpostextpath.cpp
@@ -33,7 +33,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) {
// explicitly add spaces, to test a prev. bug
const char* text = "Ham bur ge fons";
- size_t len = strlen(text);
+ int len = SkToInt(strlen(text));
SkPath path;
SkPaint paint;
@@ -54,7 +54,7 @@ protected:
SkLCGRandom rand;
SkScalar x = SkIntToScalar(20);
SkScalar y = SkIntToScalar(100);
- for (size_t i = 0; i < len; ++i) {
+ for (int i = 0; i < len; ++i) {
pos[i].set(x, y + rand.nextSScalar1() * 24);
x += widths[i];
}
diff --git a/gm/nonclosedpaths.cpp b/gm/nonclosedpaths.cpp
index bc37c54a83..98ccb1cb15 100644
--- a/gm/nonclosedpaths.cpp
+++ b/gm/nonclosedpaths.cpp
@@ -71,7 +71,7 @@ protected:
// 0(may use hairline rendering), 10(common case for stroke-style)
// 40 and 50(>= geometry width/height, make the contour filled in fact)
static const int kStrokeWidth[] = {0, 10, 40, 50};
- size_t numWidths = SK_ARRAY_COUNT(kStrokeWidth);
+ int numWidths = SK_ARRAY_COUNT(kStrokeWidth);
static const SkPaint::Style kStyle[] = {
SkPaint::kStroke_Style, SkPaint::kStrokeAndFill_Style
@@ -98,7 +98,7 @@ protected:
for (size_t style = 0; style < SK_ARRAY_COUNT(kStyle); ++style) {
for (size_t cap = 0; cap < SK_ARRAY_COUNT(kCap); ++cap) {
for (size_t join = 0; join < SK_ARRAY_COUNT(kJoin); ++join) {
- for (size_t width = 0; width < numWidths; ++width) {
+ for (int width = 0; width < numWidths; ++width) {
canvas->save();
SetLocation(canvas, counter, SkPaint::kJoinCount * numWidths);
diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp
index e0d2fbc81b..1b76ba2bc9 100644
--- a/gm/offsetimagefilter.cpp
+++ b/gm/offsetimagefilter.cpp
@@ -86,7 +86,7 @@ protected:
SkPaint paint;
int x = 0, y = 0;
- for (size_t i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap;
SkIRect cropRect = SkIRect::MakeXYWH(i * 12,
i * 8,
diff --git a/gm/polygons.cpp b/gm/polygons.cpp
index bddde8f6ee..436035530e 100644
--- a/gm/polygons.cpp
+++ b/gm/polygons.cpp
@@ -27,8 +27,8 @@ protected:
}
virtual SkISize onISize() SK_OVERRIDE {
- size_t width = kNumPolygons * kCellSize + 40;
- size_t height = (kNumJoins * kNumStrokeWidths + kNumExtraStyles) * kCellSize + 40;
+ int width = kNumPolygons * kCellSize + 40;
+ int height = (kNumJoins * kNumStrokeWidths + kNumExtraStyles) * kCellSize + 40;
return SkISize::Make(width, height);
}
diff --git a/gm/testimagefilters.cpp b/gm/testimagefilters.cpp
index 48ecf9536c..6d27c3a21a 100644
--- a/gm/testimagefilters.cpp
+++ b/gm/testimagefilters.cpp
@@ -117,7 +117,7 @@ protected:
canvas->translate(SkIntToScalar(8), SkIntToScalar(8));
- for (size_t i = 0; i < SK_ARRAY_COUNT(gFilterProc); ++i) {
+ for (int i = 0; i < (int)SK_ARRAY_COUNT(gFilterProc); ++i) {
int ix = i % 4;
int iy = i / 4;
diff --git a/gm/typeface.cpp b/gm/typeface.cpp
index 9754e9788a..f2c56a591e 100644
--- a/gm/typeface.cpp
+++ b/gm/typeface.cpp
@@ -50,7 +50,7 @@ protected:
SkPaint paint;
paint.setAntiAlias(true);
- for (size_t i = 0; i < SK_ARRAY_COUNT(gFaces); i++) {
+ for (int i = 0; i < (int)SK_ARRAY_COUNT(gFaces); i++) {
this->drawWithFace(text, i, y, paint, canvas);
}
// Now go backwards
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 7db3b190d7..969aac77b6 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -218,6 +218,7 @@ typedef uint8_t SkBool8;
SK_API int32_t SkToS32(intmax_t);
SK_API uint32_t SkToU32(uintmax_t);
SK_API int SkToInt(intmax_t);
+ SK_API unsigned SkToUInt(uintmax_t);
#else
#define SkToS8(x) ((int8_t)(x))
#define SkToU8(x) ((uint8_t)(x))
@@ -226,6 +227,7 @@ typedef uint8_t SkBool8;
#define SkToS32(x) ((int32_t)(x))
#define SkToU32(x) ((uint32_t)(x))
#define SkToInt(x) ((int)(x))
+ #define SkToUInt(x) ((unsigned)(x))
#endif
/** Returns 0 or 1 based on the condition
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index 647a199dda..6b742b8355 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -336,10 +336,10 @@ protected:
SkRect rect = {0, 0, SkIntToScalar(40), SkIntToScalar(40) };
SkRect rect2 = {0, 0, SkIntToScalar(65), SkIntToScalar(20) };
SkScalar left = 0, top = 0, x = 0, y = 0;
- size_t index;
+ int index;
char ascii[] = "ascii...";
- size_t asciiLength = sizeof(ascii) - 1;
+ int asciiLength = sizeof(ascii) - 1;
char utf8[] = "utf8" "\xe2\x80\xa6";
short utf16[] = {'u', 't', 'f', '1', '6', 0x2026 };
short utf16simple[] = {'u', 't', 'f', '1', '6', '!' };
@@ -602,7 +602,7 @@ SkCornerPathEffect.h:28:class SkCornerPathEffect : public SkPathEffect {
SkString str("GOOGLE");
for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
- apply_shader(&paint, i);
+ apply_shader(&paint, (int)i);
// paint.setMaskFilter(NULL);
// paint.setColor(SK_ColorBLACK);
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 3b953f4846..287639ad88 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -128,7 +128,7 @@ static bool readTitleFromPrefs(SkString* title) {
return false;
}
- int len = stream.getLength();
+ size_t len = stream.getLength();
SkString data(len);
stream.read(data.writable_str(), len);
const char* s = data.c_str();
diff --git a/samplecode/SampleComplexClip.cpp b/samplecode/SampleComplexClip.cpp
index 30f94f7b48..0d613ec161 100644
--- a/samplecode/SampleComplexClip.cpp
+++ b/samplecode/SampleComplexClip.cpp
@@ -96,7 +96,7 @@ protected:
for (int invA = 0; invA < 2; ++invA) {
for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); ++op) {
- int idx = invA * SK_ARRAY_COUNT(gOps) + op;
+ size_t idx = invA * SK_ARRAY_COUNT(gOps) + op;
if (!(idx % 3)) {
canvas->restore();
canvas->translate(0, SkIntToScalar(250));
diff --git a/samplecode/SampleEncode.cpp b/samplecode/SampleEncode.cpp
index 45666a3b06..7af47a697e 100644
--- a/samplecode/SampleEncode.cpp
+++ b/samplecode/SampleEncode.cpp
@@ -112,7 +112,7 @@ public:
SkBitmap* fBitmaps;
SkAutoDataUnref* fEncodedPNGs;
SkAutoDataUnref* fEncodedJPEGs;
- size_t fBitmapCount;
+ int fBitmapCount;
EncodeView() {
#if 1
@@ -120,7 +120,7 @@ public:
fBitmaps = new SkBitmap[fBitmapCount];
fEncodedPNGs = new SkAutoDataUnref[fBitmapCount];
fEncodedJPEGs = new SkAutoDataUnref[fBitmapCount];
- for (size_t i = 0; i < fBitmapCount; i++) {
+ for (int i = 0; i < fBitmapCount; i++) {
make_image(&fBitmaps[i], gConfigs[i], i);
for (size_t j = 0; j < SK_ARRAY_COUNT(gTypes); j++) {
@@ -181,7 +181,7 @@ protected:
SkScalar x = 0, y = 0, maxX = 0;
const int SPACER = 10;
- for (size_t i = 0; i < fBitmapCount; i++) {
+ for (int i = 0; i < fBitmapCount; i++) {
canvas->drawText(gConfigLabels[i], strlen(gConfigLabels[i]),
x + SkIntToScalar(fBitmaps[i].width()) / 2, 0,
paint);
diff --git a/samplecode/SampleHairline.cpp b/samplecode/SampleHairline.cpp
index 5da2639115..f08146e672 100644
--- a/samplecode/SampleHairline.cpp
+++ b/samplecode/SampleHairline.cpp
@@ -74,11 +74,12 @@ static bool check_bitmap_margin(const SkBitmap& bm, int margin) {
return false;
}
// left column
- if (!check_zeros(bm.getAddr32(i, 0), bm.height(), rb >> 2)) {
+ if (!check_zeros(bm.getAddr32(i, 0), bm.height(), SkToInt(rb >> 2))) {
return false;
}
int right = bm.width() - margin + i;
- if (!check_zeros(bm.getAddr32(right, 0), bm.height(), rb >> 2)) {
+ if (!check_zeros(bm.getAddr32(right, 0), bm.height(),
+ SkToInt(rb >> 2))) {
return false;
}
}
diff --git a/samplecode/SamplePatch.cpp b/samplecode/SamplePatch.cpp
index c630e8956a..5f39eda37a 100644
--- a/samplecode/SamplePatch.cpp
+++ b/samplecode/SamplePatch.cpp
@@ -314,7 +314,7 @@ protected:
unsigned modi) SK_OVERRIDE {
for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); i++) {
if (hittest(fPts[i], x, y)) {
- return new PtClick(this, i);
+ return new PtClick(this, (int)i);
}
}
return this->INHERITED::onFindClickHandler(x, y, modi);
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index 7e3e0d260c..c29f0907ce 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -123,7 +123,7 @@ inline float roundf(float x) { return (x-floor(x))>0.5 ? ceil(x) : floor(x); }
#ifdef SK_DEBUG
static void make_rgn(SkRegion* rgn, int left, int top, int right, int bottom,
- size_t count, int32_t runs[]) {
+ int count, int32_t runs[]) {
SkIRect r;
r.set(left, top, right, bottom);
diff --git a/samplecode/SampleRotateCircles.cpp b/samplecode/SampleRotateCircles.cpp
index 1f586be4fe..537f42485b 100644
--- a/samplecode/SampleRotateCircles.cpp
+++ b/samplecode/SampleRotateCircles.cpp
@@ -333,7 +333,7 @@ protected:
unsigned modi) SK_OVERRIDE {
for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); ++i) {
if (hittest(fPts[i], x, y)) {
- return new MyClick(this, i);
+ return new MyClick(this, (int)i);
}
}
return this->INHERITED::onFindClickHandler(x, y, modi);
diff --git a/samplecode/SampleShaderText.cpp b/samplecode/SampleShaderText.cpp
index 603d67e384..6855824d3f 100644
--- a/samplecode/SampleShaderText.cpp
+++ b/samplecode/SampleShaderText.cpp
@@ -186,7 +186,7 @@ protected:
canvas->save();
for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); s++) {
canvas->save();
- int i = 2*s;
+ size_t i = 2*s;
canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth),
SkIntToScalar((i % testsPerCol) * rowHeight));
paint.setShader(shaders[s])->unref();
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index 9372d5d468..68651f3ea1 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -646,7 +646,7 @@ static void texteffect_slide(SkCanvas* canvas) {
paint.setAntiAlias(true);
paint.setColor(SK_ColorBLUE);
for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
- apply_shader(&paint, i);
+ apply_shader(&paint, (int)i);
canvas->drawText(str, len, x, y, paint);
y += 80;
if (i == 4) {
diff --git a/src/core/SkDebug.cpp b/src/core/SkDebug.cpp
index 772352248d..d484f5eaff 100644
--- a/src/core/SkDebug.cpp
+++ b/src/core/SkDebug.cpp
@@ -46,4 +46,9 @@ int SkToInt(intmax_t x) {
return (int)x;
}
+unsigned SkToUInt(uintmax_t x) {
+ SkASSERT((unsigned)x == x);
+ return (unsigned)x;
+}
+
#endif
diff --git a/src/core/SkFlate.cpp b/src/core/SkFlate.cpp
index 8258cdcd1d..2b4e36d727 100644
--- a/src/core/SkFlate.cpp
+++ b/src/core/SkFlate.cpp
@@ -61,7 +61,7 @@ bool doFlate(bool compress, SkStream* src, SkWStream* dst) {
flateData.avail_in = 0;
} else {
flateData.next_in = input;
- flateData.avail_in = inputLength;
+ flateData.avail_in = SkToUInt(inputLength);
}
rc = Z_OK;
@@ -83,7 +83,7 @@ bool doFlate(bool compress, SkStream* src, SkWStream* dst) {
if (read == 0)
break;
flateData.next_in = inputBuffer;
- flateData.avail_in = read;
+ flateData.avail_in = SkToUInt(read);
}
if (compress)
rc = deflate(&flateData, Z_NO_FLUSH);
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h
index 06a9840975..d92e4c45df 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -272,7 +272,7 @@ public:
buffer.setFlags(controller->getWriteBufferFlags());
Traits::flatten(buffer, obj);
- uint32_t size = buffer.size();
+ size_t size = buffer.size();
SkASSERT(SkIsAlign4(size));
// Allocate enough memory to hold SkFlatData struct and the flat data itself.
@@ -282,7 +282,7 @@ public:
// Put the serialized contents into the data section of the new allocation.
buffer.writeToMemory(result->data());
// Stamp the index, size and checksum in the header.
- result->stampHeader(index, size);
+ result->stampHeader(index, SkToS32(size));
return result;
}
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index c27bd67443..04af696608 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -149,7 +149,7 @@ static CGFloat CGRectGetWidth_inline(const CGRect& rect) {
///////////////////////////////////////////////////////////////////////////////
static void sk_memset_rect32(uint32_t* ptr, uint32_t value,
- size_t width, size_t height, size_t rowBytes) {
+ int width, int height, size_t rowBytes) {
SkASSERT(width);
SkASSERT(width * sizeof(uint32_t) <= rowBytes);
@@ -1441,7 +1441,7 @@ static SkTypeface* create_from_dataProvider(CGDataProviderRef provider) {
// so the performance impact isn't too bad.
static void populate_glyph_to_unicode_slow(CTFontRef ctFont, CFIndex glyphCount,
SkTDArray<SkUnichar>* glyphToUnicode) {
- glyphToUnicode->setCount(glyphCount);
+ glyphToUnicode->setCount(SkToInt(glyphCount));
SkUnichar* out = glyphToUnicode->begin();
sk_bzero(out, glyphCount * sizeof(SkUnichar));
UniChar unichar = 0;
@@ -1485,7 +1485,7 @@ static void populate_glyph_to_unicode(CTFontRef ctFont, CFIndex glyphCount,
length = 8192;
}
const UInt8* bits = CFDataGetBytePtr(bitmap);
- glyphToUnicode->setCount(glyphCount);
+ glyphToUnicode->setCount(SkToInt(glyphCount));
SkUnichar* out = glyphToUnicode->begin();
sk_bzero(out, glyphCount * sizeof(SkUnichar));
for (int i = 0; i < length; i++) {
@@ -1625,7 +1625,7 @@ SkAdvancedTypefaceMetrics* SkTypeface_Mac::onGetAdvancedTypefaceMetrics(
} else {
info->fGlyphWidths.reset(
skia_advanced_typeface_metrics_utils::getAdvanceData(ctFont.get(),
- glyphCount,
+ SkToInt(glyphCount),
glyphIDs,
glyphIDsCount,
&getWidthAdvance));
@@ -1724,8 +1724,8 @@ SkStream* SkTypeface_Mac::onOpenStream(int* ttcIndex) const {
entry->tag = SkEndian_SwapBE32(tableTags[tableIndex]);
entry->checksum = SkEndian_SwapBE32(SkOTUtils::CalcTableChecksum((SK_OT_ULONG*)dataPtr,
tableSize));
- entry->offset = SkEndian_SwapBE32(dataPtr - dataStart);
- entry->logicalLength = SkEndian_SwapBE32(tableSize);
+ entry->offset = SkEndian_SwapBE32(SkToU32(dataPtr - dataStart));
+ entry->logicalLength = SkEndian_SwapBE32(SkToU32(tableSize));
dataPtr += (tableSize + 3) & ~3;
++entry;
@@ -1785,7 +1785,7 @@ int SkTypeface_Mac::onGetTableTags(SkFontTableTag tags[]) const {
if (NULL == cfArray) {
return 0;
}
- int count = CFArrayGetCount(cfArray);
+ int count = SkToInt(CFArrayGetCount(cfArray));
if (tags) {
for (int i = 0; i < count; ++i) {
uintptr_t fontTag = reinterpret_cast<uintptr_t>(CFArrayGetValueAtIndex(cfArray, i));
@@ -1930,7 +1930,7 @@ int SkTypeface_Mac::onCharsToGlyphs(const void* chars, Encoding encoding,
SkUnichar uni = SkUTF8_NextUnichar(&utf8);
utf16 += SkUTF16_FromUnichar(uni, utf16);
}
- srcCount = utf16 - src;
+ srcCount = SkToInt(utf16 - src);
break;
}
case kUTF16_Encoding: {
@@ -1951,7 +1951,7 @@ int SkTypeface_Mac::onCharsToGlyphs(const void* chars, Encoding encoding,
for (int i = 0; i < glyphCount; ++i) {
utf16 += SkUTF16_FromUnichar(utf32[i], utf16);
}
- srcCount = utf16 - src;
+ srcCount = SkToInt(utf16 - src);
break;
}
}
@@ -1999,7 +1999,7 @@ int SkTypeface_Mac::onCharsToGlyphs(const void* chars, Encoding encoding,
}
int SkTypeface_Mac::onCountGlyphs() const {
- return CTFontGetGlyphCount(fFontRef);
+ return SkToInt(CTFontGetGlyphCount(fFontRef));
}
///////////////////////////////////////////////////////////////////////////////
@@ -2142,7 +2142,7 @@ public:
if (NULL == fArray) {
fArray = CFArrayCreate(NULL, NULL, 0, NULL);
}
- fCount = CFArrayGetCount(fArray);
+ fCount = SkToInt(CFArrayGetCount(fArray));
}
virtual ~SkFontStyleSet_Mac() {
@@ -2219,7 +2219,7 @@ class SkFontMgr_Mac : public SkFontMgr {
void lazyInit() {
if (NULL == fNames) {
fNames = SkCTFontManagerCopyAvailableFontFamilyNames();
- fCount = fNames ? CFArrayGetCount(fNames) : 0;
+ fCount = fNames ? SkToInt(CFArrayGetCount(fNames)) : 0;
}
}
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index beb6ed11e4..90c282dc9b 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -66,8 +66,8 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
}
SkAutoTCallVProc<CGImage, CGImageRelease> arimage(image);
- const int width = CGImageGetWidth(image);
- const int height = CGImageGetHeight(image);
+ const int width = SkToInt(CGImageGetWidth(image));
+ const int height = SkToInt(CGImageGetHeight(image));
bm->setConfig(SkBitmap::kARGB_8888_Config, width, height);
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return true;
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 8bc646f0c7..9bbdc6c6ad 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -1029,7 +1029,7 @@ static int lrrect_type(lua_State* L) {
}
static int lrrect_radii(lua_State* L) {
- int corner = lua_tointeger(L, 2);
+ int corner = SkToInt(lua_tointeger(L, 2));
SkVector v;
if (corner < 0 || corner > 3) {
SkDebugf("bad corner index %d", corner);
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index c5ec006913..0136231ce1 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -57,7 +57,8 @@ void AutoCallLua::pushEncodedText(SkPaint::TextEncoding enc, const void* text,
this->pushString(str, "text");
} break;
case SkPaint::kGlyphID_TextEncoding:
- this->pushArrayU16((const uint16_t*)text, length >> 1, "glyphs");
+ this->pushArrayU16((const uint16_t*)text, SkToInt(length >> 1),
+ "glyphs");
break;
case SkPaint::kUTF32_TextEncoding:
break;
diff --git a/src/views/mac/SkOptionsTableView.mm b/src/views/mac/SkOptionsTableView.mm
index 7a6afe42b3..b4cdbf4119 100644
--- a/src/views/mac/SkOptionsTableView.mm
+++ b/src/views/mac/SkOptionsTableView.mm
@@ -66,7 +66,7 @@
int menuIndex = fMenus->find(const_cast<SkOSMenu *>(menu));
if (menuIndex >= 0 && menuIndex < fMenus->count()) {
NSUInteger first = 0;
- for (NSInteger i = 0; i < menuIndex; ++i) {
+ for (int i = 0; i < menuIndex; ++i) {
first += (*fMenus)[i]->getCount();
}
[fItems removeObjectsInRange:NSMakeRange(first, [fItems count] - first)];
@@ -148,7 +148,7 @@
}
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
- int columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]];
+ NSInteger columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]];
if (columnIndex == 0) {
const SkOSMenu::Item* item = ((SkOptionItem*)[fItems objectAtIndex:row]).fItem;
NSString* label = [NSString stringWithUTF8String:item->getLabel()];
@@ -163,7 +163,7 @@
- (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
if (tableColumn) {
- int columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]];
+ NSInteger columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]];
if (columnIndex == 1)
return [((SkOptionItem*)[fItems objectAtIndex:row]).fCell copy];
else
@@ -173,7 +173,7 @@
}
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
- int columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]];
+ NSInteger columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]];
if (columnIndex == 1) {
SkOptionItem* option = (SkOptionItem*)[self.fItems objectAtIndex:row];
NSCell* storedCell = option.fCell;
@@ -207,7 +207,7 @@
}
- (void)tableView:(NSTableView *)tableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
- int columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]];
+ NSInteger columnIndex = [tableView columnWithIdentifier:[tableColumn identifier]];
if (columnIndex == 1) {
SkOptionItem* option = (SkOptionItem*)[self.fItems objectAtIndex:row];
NSCell* cell = option.fCell;