build with -Wall
fix associated warnings (at least on gcc 4.0.1)



git-svn-id: http://skia.googlecode.com/svn/trunk@129 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/Makefile b/Makefile
index fa88b0a..dc55591 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 # setup our defaults
 CC := gcc
 C_INCLUDES := -Iinclude/core -Iinclude/effects -Iinclude/images -Iinclude/utils
-CFLAGS := # -O2 
+CFLAGS := -Wall # -O2 
 LINKER_OPTS := -lpthread
 DEFINES := -DSK_CAN_USE_FLOAT
 HIDE = @
diff --git a/src/core/SkConcaveToTriangles.cpp b/src/core/SkConcaveToTriangles.cpp
index 28d8a51..efad528 100644
--- a/src/core/SkConcaveToTriangles.cpp
+++ b/src/core/SkConcaveToTriangles.cpp
@@ -586,7 +586,7 @@
 
 static void PrintVertices(size_t numPts, Vertex *vt) {
     DebugPrintf("\nVertices:\n");
-    for (int i = 0; i < numPts; i++) {
+    for (size_t i = 0; i < numPts; i++) {
         Vertex *e0, *e1;
         Vertex::VertexType type = vt[i].classify(&e0, &e1);
         DebugPrintf("%2d: (%.7g, %.7g), prev(%d), next(%d), "
@@ -596,12 +596,14 @@
                     GetVertexTypeString(type), e0 - vt, e1 - vt);
         Trapezoid *trap[2];
         vt[i].trapezoids(trap, trap+1);
-        for (int i = 0; i < 2; ++i)
-            if (trap[i] != NULL)
+        for (int j = 0; j < 2; ++j) {
+            if (trap[j] != NULL) {
                 DebugPrintf(", trap(L=%d, R=%d, B=%d)",
-                            trap[i]->left()   - vt,
-                            trap[i]->right()  - vt,
-                            trap[i]->bottom() - vt);
+                            trap[j]->left()   - vt,
+                            trap[j]->right()  - vt,
+                            trap[j]->bottom() - vt);
+            }
+        }
         DebugPrintf("\n");
     }
 }
@@ -609,7 +611,7 @@
 
 static void PrintVertexPtrs(size_t numPts, VertexPtr *vp, Vertex *vtBase) {
     DebugPrintf("\nSorted Vertices:\n");
-    for (int i = 0; i < numPts; i++) {
+    for (size_t i = 0; i < numPts; i++) {
         Vertex *e0, *e1;
         Vertex *vt = vp[i].vt;
         Vertex::VertexType type = vt->classify(&e0, &e1);
@@ -620,12 +622,14 @@
                     GetVertexTypeString(type), e0 - vtBase, e1 - vtBase);
         Trapezoid *trap[2];
         vt->trapezoids(trap, trap+1);
-        for (int i = 0; i < 2; ++i)
-            if (trap[i] != NULL)
+        for (int j = 0; j < 2; ++j) {
+            if (trap[j] != NULL) {
                 DebugPrintf(", trap(L=%d, R=%d, B=%d)",
-                            trap[i]->left()   - vtBase,
-                            trap[i]->right()  - vtBase,
-                            trap[i]->bottom() - vtBase);
+                            trap[j]->left()   - vtBase,
+                            trap[j]->right()  - vtBase,
+                            trap[j]->bottom() - vtBase);
+            }
+        }
         DebugPrintf("\n");
     }
 }
@@ -642,7 +646,7 @@
     size_t count_1 = count - 1;
     do {
         sorted = true;
-        for (int i = 0; i < count_1; ++i) {
+        for (size_t i = 0; i < count_1; ++i) {
             if (array[i + 1] < array[i]) {
                 T t = array[i];
                 array[i] = array[i + 1];
@@ -859,7 +863,6 @@
 // Triangulate an unimonotone chain.
 bool TriangulateMonotone(Vertex *first, Vertex *last,
                          SkTDArray<SkPoint> *triangles) {
-    bool success = true;
     DebugPrintf("TriangulateMonotone()\n");
 
     size_t numVertices = CountVertices(first, last);
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h
index fe9477d..aad1dcd 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -50,7 +50,7 @@
 class SkRefCntPlayback {
 public:
     SkRefCntPlayback();
-    ~SkRefCntPlayback();
+    virtual ~SkRefCntPlayback();
     
     int count() const { return fCount; }
     
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 4a3338a..421d5c2 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -458,7 +458,7 @@
     fRegions = SkNEW_ARRAY(SkRegion, fRegionCount);
     for (i = 0; i < fRegionCount; i++) {
         uint32_t size = buffer.readU32();
-        uint32_t bytes = fRegions[i].unflatten(buffer.skip(size));
+        SkDEBUGCODE(uint32_t bytes =) fRegions[i].unflatten(buffer.skip(size));
         SkASSERT(size == bytes);
     }
 }
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index 6571328..4def146 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -45,28 +45,28 @@
 
 int8_t SkStream::readS8() {
     int8_t value;
-    size_t len = this->read(&value, 1);
+    SkDEBUGCODE(size_t len =) this->read(&value, 1);
     SkASSERT(1 == len);
     return value;
 }
 
 int16_t SkStream::readS16() {
     int16_t value;
-    size_t len = this->read(&value, 2);
+    SkDEBUGCODE(size_t len =) this->read(&value, 2);
     SkASSERT(2 == len);
     return value;
 }
 
 int32_t SkStream::readS32() {
     int32_t value;
-    size_t len = this->read(&value, 4);
+    SkDEBUGCODE(size_t len =) this->read(&value, 4);
     SkASSERT(4 == len);
     return value;
 }
 
 SkScalar SkStream::readScalar() {
     SkScalar value;
-    size_t len = this->read(&value, sizeof(SkScalar));
+    SkDEBUGCODE(size_t len =) this->read(&value, sizeof(SkScalar));
     SkASSERT(sizeof(SkScalar) == len);
     return value;
 }
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index b409f1e..b088c1e 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -266,6 +266,7 @@
     ::CGContextRelease(contextRef);
 }
 
+#if 0
 static void convert_metrics(SkPaint::FontMetrics* dst,
                             const ATSFontMetrics& src) {
     dst->fTop     = -SkFloatToScalar(src.ascent);
@@ -274,6 +275,7 @@
     dst->fBottom  = SkFloatToScalar(src.descent);
     dst->fLeading = SkFloatToScalar(src.leading);
 }
+#endif
 
 static void* get_font_table(ATSFontRef fontID, uint32_t tag) {
     ByteCount size;
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index 50d59cf..38c3dc1 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -176,11 +176,6 @@
     int32_t     x;
     SkRandom    rand;
     
-    // these should not assert
-    SkToS8(127);    SkToS8(-128);       SkToU8(255);
-    SkToS16(32767); SkToS16(-32768);    SkToU16(65535);
-    SkToS32(2*1024*1024);   SkToS32(-2*1024*1024);  SkToU32(4*1024*1024);
-    
     // these should assert
 #if 0
     SkToS8(128);
diff --git a/tests/PackBitsTest.cpp b/tests/PackBitsTest.cpp
index fc11fb2..22de3c3 100644
--- a/tests/PackBitsTest.cpp
+++ b/tests/PackBitsTest.cpp
@@ -45,7 +45,7 @@
         size_t maxSize = SkPackBits::ComputeMaxSize16(size);
         REPORTER_ASSERT(reporter, maxSize >= dstSize);
 
-        int srcCount = SkPackBits::Unpack16(dst, dstSize, src2);
+        size_t srcCount = SkPackBits::Unpack16(dst, dstSize, src2);
         REPORTER_ASSERT(reporter, size == srcCount);
         bool match = memcmp(src, src2, size * sizeof(uint16_t)) == 0;
         REPORTER_ASSERT(reporter, match);
@@ -99,7 +99,7 @@
             size_t maxSize = SkPackBits::ComputeMaxSize8(size);
             REPORTER_ASSERT(reporter, maxSize >= dstSize);
 
-            int srcCount = SkPackBits::Unpack8(dst, dstSize, src2);
+            size_t srcCount = SkPackBits::Unpack8(dst, dstSize, src2);
             REPORTER_ASSERT(reporter, size == srcCount);
             bool match = memcmp(src, src2, size * sizeof(uint8_t)) == 0;
             REPORTER_ASSERT(reporter, match);
diff --git a/tests/TriangulationTest.cpp b/tests/TriangulationTest.cpp
index 869e739..9d47181 100644
--- a/tests/TriangulationTest.cpp
+++ b/tests/TriangulationTest.cpp
@@ -36,7 +36,7 @@
 }
 
 
-static bool CompareTriangleList(size_t numTriangles,
+static bool CompareTriangleList(int numTriangles,
                                 const float refTriangles[][3][2],
                                 const SkTDArray<SkPoint> &triangles) {
     if (triangles.count() != numTriangles * 3) {
@@ -44,8 +44,8 @@
                numTriangles, triangles.count() / 3);
         return false;
     }
-    size_t numErrors = 0;
-    for (size_t i = 0; i < numTriangles; ++i) {
+    int numErrors = 0;
+    for (int i = 0; i < numTriangles; ++i) {
         const float *r = &refTriangles[i][0][0];
         const SkScalar *t = &triangles[i * 3].fX;
         bool equalTriangle = true;