diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-24 21:46:29 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-24 21:46:29 +0000 |
commit | a8c7f7702fb4bbedb615031bc653c5cd161a038e (patch) | |
tree | c51f2a6f6f647a4b84fe0fc5c1f077b45fec8087 /src | |
parent | 8f6884aab8aecd7657cf3f9cdbc682f0deca29c5 (diff) |
fix (some) 64bit warnings -- size_t -> int
BUG=skia:
R=mtklein@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/147053003
git-svn-id: http://skia.googlecode.com/svn/trunk@13178 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkAAClip.cpp | 4 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 2 | ||||
-rw-r--r-- | src/core/SkDebug.cpp | 5 | ||||
-rw-r--r-- | src/core/SkDraw.cpp | 10 | ||||
-rw-r--r-- | src/core/SkEdgeBuilder.cpp | 2 | ||||
-rw-r--r-- | src/core/SkError.cpp | 2 | ||||
-rw-r--r-- | src/core/SkFontDescriptor.cpp | 2 | ||||
-rw-r--r-- | src/core/SkGlyphCache.cpp | 4 | ||||
-rw-r--r-- | src/core/SkLineClipper.cpp | 2 | ||||
-rw-r--r-- | src/core/SkMallocPixelRef.cpp | 6 | ||||
-rw-r--r-- | src/core/SkMask.cpp | 2 | ||||
-rw-r--r-- | src/core/SkMetaData.cpp | 4 |
12 files changed, 25 insertions, 20 deletions
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp index a9d591a963..14152f8317 100644 --- a/src/core/SkAAClip.cpp +++ b/src/core/SkAAClip.cpp @@ -530,7 +530,7 @@ bool SkAAClip::trimTopBottom() { do { yoff -= 1; } while (row_is_all_zeros(base + yoff->fOffset, width)); - skip = stop - yoff - 1; + skip = SkToInt(stop - yoff - 1); SkASSERT(skip >= 0 && skip < head->fRowCount); if (skip > 0) { // removing from the bottom is easier than from the top, as we don't @@ -1033,7 +1033,7 @@ public: SkDEBUGCODE(prevY = row->fY); yoffset->fY = row->fY - adjustY; - yoffset->fOffset = data - baseData; + yoffset->fOffset = SkToU32(data - baseData); yoffset += 1; size_t n = row->fData->count(); diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 29c09d1e7a..71b81a1fa2 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1595,7 +1595,7 @@ void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], if (2 == count) { r.set(pts[0], pts[1]); } else { - r.set(pts, count); + r.set(pts, SkToInt(count)); } SkRect storage; if (this->quickReject(paint.computeFastStrokeBounds(r, &storage))) { diff --git a/src/core/SkDebug.cpp b/src/core/SkDebug.cpp index 2a04b302ff..772352248d 100644 --- a/src/core/SkDebug.cpp +++ b/src/core/SkDebug.cpp @@ -41,4 +41,9 @@ uint32_t SkToU32(uintmax_t x) { return (uint32_t)x; } +int SkToInt(intmax_t x) { + SkASSERT((int)x == x); + return (int)x; +} + #endif diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index affb24322c..013b73d23a 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -151,11 +151,11 @@ static void D_Clear_BitmapXferProc(void* pixels, size_t bytes, uint32_t) { static void D_Dst_BitmapXferProc(void*, size_t, uint32_t data) {} static void D32_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { - sk_memset32((uint32_t*)pixels, data, bytes >> 2); + sk_memset32((uint32_t*)pixels, data, SkToInt(bytes >> 2)); } static void D16_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { - sk_memset16((uint16_t*)pixels, data, bytes >> 1); + sk_memset16((uint16_t*)pixels, data, SkToInt(bytes >> 1)); } static void DA8_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { @@ -553,7 +553,7 @@ static bool bounder_points(SkBounder* bounder, SkCanvas::PointMode mode, SkRect bounds; SkScalar inset = paint.getStrokeWidth(); - bounds.set(pts, count); + bounds.set(pts, SkToInt(count)); bounds.inset(-inset, -inset); matrix.mapRect(&bounds); @@ -610,14 +610,14 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count, const size_t backup = (SkCanvas::kPolygon_PointMode == mode); do { - size_t n = count; + int n = SkToInt(count); if (n > MAX_DEV_PTS) { n = MAX_DEV_PTS; } matrix->mapPoints(devPts, pts, n); proc(rec, devPts, n, bltr); pts += n - backup; - SkASSERT(count >= n); + SkASSERT(SkToInt(count) >= n); count -= n; if (count > 0) { count += backup; diff --git a/src/core/SkEdgeBuilder.cpp b/src/core/SkEdgeBuilder.cpp index 799c6762d9..c3f5dafe8d 100644 --- a/src/core/SkEdgeBuilder.cpp +++ b/src/core/SkEdgeBuilder.cpp @@ -150,7 +150,7 @@ int SkEdgeBuilder::buildPoly(const SkPath& path, const SkIRect* iclip, } SkASSERT((char*)edge <= (char*)fEdgeList); SkASSERT(edgePtr - fEdgeList <= maxEdgeCount); - return edgePtr - fEdgeList; + return SkToInt(edgePtr - fEdgeList); } static void handle_quad(SkEdgeBuilder* builder, const SkPoint pts[3]) { diff --git a/src/core/SkError.cpp b/src/core/SkError.cpp index f5d233c6da..9e8ff2ddef 100644 --- a/src/core/SkError.cpp +++ b/src/core/SkError.cpp @@ -130,7 +130,7 @@ void SkErrorInternals::SetError(SkError code, const char *fmt, ...) { } sprintf( str, "%s: ", error_name ); - int string_left = ERROR_STRING_LENGTH - strlen( str ); + int string_left = SkToInt(ERROR_STRING_LENGTH - strlen(str)); str += strlen(str); va_start( args, fmt ); diff --git a/src/core/SkFontDescriptor.cpp b/src/core/SkFontDescriptor.cpp index 7679d92a14..5088ed7687 100644 --- a/src/core/SkFontDescriptor.cpp +++ b/src/core/SkFontDescriptor.cpp @@ -25,7 +25,7 @@ SkFontDescriptor::SkFontDescriptor(SkTypeface::Style style) { } static void read_string(SkStream* stream, SkString* string) { - const uint32_t length = stream->readPackedUInt(); + const uint32_t length = SkToU32(stream->readPackedUInt()); if (length > 0) { string->resize(length); stream->read(string->writable_str(), length); diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index a78b197a55..2b1b62b839 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -560,10 +560,10 @@ size_t SkGlyphCache_Globals::internalPurge(size_t minBytesNeeded) { if (fTotalMemoryUsed > fCacheSizeLimit) { bytesNeeded = fTotalMemoryUsed - fCacheSizeLimit; } - bytesNeeded = SkMax32(bytesNeeded, minBytesNeeded); + bytesNeeded = SkTMax(bytesNeeded, minBytesNeeded); if (bytesNeeded) { // no small purges! - bytesNeeded = SkMax32(bytesNeeded, fTotalMemoryUsed >> 2); + bytesNeeded = SkTMax(bytesNeeded, fTotalMemoryUsed >> 2); } int countNeeded = 0; diff --git a/src/core/SkLineClipper.cpp b/src/core/SkLineClipper.cpp index 634de0d1e7..1645917d70 100644 --- a/src/core/SkLineClipper.cpp +++ b/src/core/SkLineClipper.cpp @@ -267,7 +267,7 @@ int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, *r = tmp[index1]; } - lineCount = r - result; + lineCount = SkToInt(r - result); } // Now copy the results into the caller's lines[] parameter diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp index c591ffb37d..fae10c4c6a 100644 --- a/src/core/SkMallocPixelRef.cpp +++ b/src/core/SkMallocPixelRef.cpp @@ -55,7 +55,7 @@ SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info, return NULL; } - int32_t minRB = info.minRowBytes(); + int32_t minRB = SkToS32(info.minRowBytes()); if (minRB < 0) { return NULL; // allocation will be too large } @@ -65,7 +65,7 @@ SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info, int32_t rowBytes; if (requestedRowBytes) { - rowBytes = requestedRowBytes; + rowBytes = SkToS32(requestedRowBytes); } else { rowBytes = minRB; } @@ -204,7 +204,7 @@ size_t SkMallocPixelRef::getAllocatedSizeInBytes() const { void SkMallocPixelRef::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); - buffer.write32(fRB); + buffer.write32(SkToU32(fRB)); // TODO: replace this bulk write with a chunky one that can trim off any // trailing bytes on each scanline (in case rowbytes > width*size) diff --git a/src/core/SkMask.cpp b/src/core/SkMask.cpp index f3ae88a906..929835717b 100644 --- a/src/core/SkMask.cpp +++ b/src/core/SkMask.cpp @@ -25,7 +25,7 @@ size_t SkMask::computeImageSize() const { size_t SkMask::computeTotalImageSize() const { size_t size = this->computeImageSize(); if (fFormat == SkMask::k3D_Format) { - size = safeMul32(size, 3); + size = safeMul32(SkToS32(size), 3); } return size; } diff --git a/src/core/SkMetaData.cpp b/src/core/SkMetaData.cpp index 5a494b3511..dfc2a94901 100644 --- a/src/core/SkMetaData.cpp +++ b/src/core/SkMetaData.cpp @@ -91,7 +91,7 @@ SkScalar* SkMetaData::setScalars(const char name[], int count, const SkScalar va void SkMetaData::setString(const char name[], const char value[]) { - (void)this->set(name, value, sizeof(char), kString_Type, strlen(value) + 1); + (void)this->set(name, value, sizeof(char), kString_Type, SkToInt(strlen(value) + 1)); } void SkMetaData::setPtr(const char name[], void* ptr, PtrProc proc) { @@ -105,7 +105,7 @@ void SkMetaData::setBool(const char name[], bool value) } void SkMetaData::setData(const char name[], const void* data, size_t byteCount) { - (void)this->set(name, data, sizeof(char), kData_Type, byteCount); + (void)this->set(name, data, sizeof(char), kData_Type, SkToInt(byteCount)); } void* SkMetaData::set(const char name[], const void* data, size_t dataSize, Type type, int count) |