Fix type errors and a few warnings for Visual Studio 2010 64-bit build.
We're still far from 64b statically safe, mostly around SkReader32.h
and the address-alignment code in GrTypes.h.
Original code provided by jianliang79.
http://code.google.com/p/skia/issues/detail?id=601
git-svn-id: http://skia.googlecode.com/svn/trunk@3994 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/shadows.cpp b/gm/shadows.cpp
index e9274c7..2fb1615 100644
--- a/gm/shadows.cpp
+++ b/gm/shadows.cpp
@@ -95,7 +95,7 @@
paint.setLooper(shadowLoopers[i]);
- canvas->translate(SkIntToScalar(i*40), SkIntToScalar(0));
+ canvas->translate(SkIntToScalar((unsigned int)i*40), SkIntToScalar(0));
setup(&paint, gRec[0].fColor, gRec[0].fStrokeWidth);
canvas->drawRect(fRect, paint);
diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h
index 5f62203..f0f9449 100644
--- a/include/core/SkTDArray.h
+++ b/include/core/SkTDArray.h
@@ -154,7 +154,7 @@
return this->append(1, NULL);
}
T* append(size_t count, const T* src = NULL) {
- unsigned oldCount = fCount;
+ size_t oldCount = fCount;
if (count) {
SkASSERT(src == NULL || fArray == NULL ||
src + count <= fArray || fArray + oldCount <= src);
@@ -179,7 +179,7 @@
T* insert(size_t index, size_t count, const T* src = NULL) {
SkASSERT(count);
SkASSERT(index <= fCount);
- int oldCount = fCount;
+ size_t oldCount = fCount;
this->growBy(count);
T* dst = fArray + index;
memmove(dst + count, dst, sizeof(T) * (oldCount - index));
@@ -197,7 +197,7 @@
void removeShuffle(size_t index) {
SkASSERT(index < fCount);
- unsigned newCount = fCount - 1;
+ size_t newCount = fCount - 1;
fCount = newCount;
if (index != newCount) {
memcpy(fArray + index, fArray + newCount, sizeof(T));
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index 2aea5b0..ea35ff1 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -386,11 +386,13 @@
SkTDArray<SkPoint>(pos);
pos.setCount(asciiLength);
for (index = 0; index < asciiLength; index++)
- pos[index].set(SkIntToScalar(index * 10), SkIntToScalar(index * 2));
+ pos[index].set(SkIntToScalar((unsigned int)index * 10),
+ SkIntToScalar((unsigned int)index * 2));
SkTDArray<SkPoint>(pos2);
pos2.setCount(asciiLength);
for (index = 0; index < asciiLength; index++)
- pos2[index].set(SkIntToScalar(index * 10), SkIntToScalar(20));
+ pos2[index].set(SkIntToScalar((unsigned int)index * 10),
+ SkIntToScalar(20));
// shaders
SkPoint linearPoints[] = { { 0, 0, }, { SkIntToScalar(40), SkIntToScalar(40) } };
diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp
index eced08a..db4dbea 100644
--- a/samplecode/SampleText.cpp
+++ b/samplecode/SampleText.cpp
@@ -105,7 +105,7 @@
SkASSERT(m > mm);
}
}
- nn = SkIntToScalar(n);
+ nn = SkIntToScalar((unsigned int)n);
mm = m;
}