Address lint issues in pdf directories.
Review URL: http://codereview.appspot.com/4887042

git-svn-id: http://skia.googlecode.com/svn/trunk@2117 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/pdf/SkBitSet.h b/include/pdf/SkBitSet.h
index 4791df4..fd564a5 100755
--- a/include/pdf/SkBitSet.h
+++ b/include/pdf/SkBitSet.h
@@ -55,7 +55,7 @@
         SkASSERT((size_t)index < fBitCount);
         size_t internalIndex = index / 32;
         SkASSERT(internalIndex < fDwordCount);
-        return (uint32_t*)fBitData.get() + internalIndex;
+        return reinterpret_cast<uint32_t*>(fBitData.get()) + internalIndex;
     }
 };
 
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index 9892d5c..dff61a3 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -71,8 +71,7 @@
     }
 
     virtual void setMatrixClip(const SkMatrix& m, const SkRegion& r,
-                               const SkClipStack& c)
-    {
+                               const SkClipStack& c) {
         SkDevice::setMatrixClip(m, r, c);
     }
 
diff --git a/include/pdf/SkPDFFont.h b/include/pdf/SkPDFFont.h
index 982fd34..4b7943c 100644
--- a/include/pdf/SkPDFFont.h
+++ b/include/pdf/SkPDFFont.h
@@ -48,7 +48,7 @@
 
     class F2BIter {
     public:
-        F2BIter(const SkPDFGlyphSetMap& map);
+        explicit F2BIter(const SkPDFGlyphSetMap& map);
         FontGlyphSetPair* next() const;
         void reset(const SkPDFGlyphSetMap& map);
 
diff --git a/include/pdf/SkPDFTypes.h b/include/pdf/SkPDFTypes.h
index 8e7ea1a..155b826 100644
--- a/include/pdf/SkPDFTypes.h
+++ b/include/pdf/SkPDFTypes.h
@@ -285,22 +285,22 @@
      *  @return The value argument is returned.
      */
     SkPDFObject* append(SkPDFObject* value);
-    
+
     /** Creates a SkPDFInt object and appends it to the array.
      *  @param value The value to add to the array.
      */
     void appendInt(int32_t value);
-    
+
     /** Creates a SkPDFScalar object and appends it to the array.
      *  @param value The value to add to the array.
      */
     void appendScalar(SkScalar value);
-    
+
     /** Creates a SkPDFName object and appends it to the array.
      *  @param value The value to add to the array.
      */
     void appendName(const char name[]);
-    
+
 private:
     static const int kMaxLen = 8191;
     SkTDArray<SkPDFObject*> fValue;
@@ -346,19 +346,19 @@
      *  @return The value argument is returned.
      */
     SkPDFObject* insert(const char key[], SkPDFObject* value);
-    
+
     /** Add the int to the dictionary with the given key.
      *  @param key   The text of the key for this dictionary entry.
      *  @param value The int value for this dictionary entry.
      */
     void insertInt(const char key[], int32_t value);
-    
+
     /** Add the scalar to the dictionary with the given key.
      *  @param key   The text of the key for this dictionary entry.
      *  @param value The scalar value for this dictionary entry.
      */
     void insertScalar(const char key[], SkScalar value);
-    
+
     /** Add the name to the dictionary with the given key.
      *  @param key   The text of the key for this dictionary entry.
      *  @param name  The name for this dictionary entry.
@@ -372,7 +372,7 @@
     void insertName(const char key[], const SkString& name) {
         this->insertName(key, name.c_str());
     }
-    
+
     /** Remove all entries from the dictionary.
      */
     void clear();
diff --git a/include/pdf/SkPDFUtils.h b/include/pdf/SkPDFUtils.h
index b25698b..5b9d74e 100644
--- a/include/pdf/SkPDFUtils.h
+++ b/include/pdf/SkPDFUtils.h
@@ -29,7 +29,7 @@
             PRINT_NOT_IMPL("NOT_IMPLEMENTED: " #condition "\n");   \
             SkDEBUGCODE(SkASSERT(!assert);)                        \
         }                                                          \
-    } while(0)
+    } while (0)
 
 class SkPDFUtils {
 public:
diff --git a/src/pdf/SkBitSet.cpp b/src/pdf/SkBitSet.cpp
index c2bbeaf..c10c100 100755
--- a/src/pdf/SkBitSet.cpp
+++ b/src/pdf/SkBitSet.cpp
@@ -24,7 +24,7 @@
 }
 
 const SkBitSet& SkBitSet::operator=(const SkBitSet& rhs) {
-    if (this == (SkBitSet*)&rhs) {
+    if (this == &rhs) {
         return *this;
     }
     fBitCount = rhs.fBitCount;
@@ -84,7 +84,7 @@
 
 void SkBitSet::exportTo(SkTDArray<uint32_t>* array) const {
     SkASSERT(array);
-    uint32_t* data = (uint32_t*)fBitData.get();
+    uint32_t* data = reinterpret_cast<uint32_t*>(fBitData.get());
     for (unsigned int i = 0; i < fDwordCount; ++i) {
         uint32_t value = data[i];
         if (value) {  // There are set bits
diff --git a/src/pdf/SkPDFCatalog.cpp b/src/pdf/SkPDFCatalog.cpp
index a3abef7..90aa78e 100644
--- a/src/pdf/SkPDFCatalog.cpp
+++ b/src/pdf/SkPDFCatalog.cpp
@@ -106,11 +106,11 @@
     int first = -1;
     int last = fCatalog.count() - 1;
     // TODO(vandebo) support linearized format.
-    //int last = fCatalog.count() - fFirstPageCount - 1;
-    //if (firstPage) {
-    //    first = fCatalog.count() - fFirstPageCount;
-    //    last = fCatalog.count() - 1;
-    //}
+    // int last = fCatalog.count() - fFirstPageCount - 1;
+    // if (firstPage) {
+    //     first = fCatalog.count() - fFirstPageCount;
+    //     last = fCatalog.count() - 1;
+    // }
 
     stream->writeText("xref\n");
     stream->writeDecAsText(first + 1);
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index daf8018..b76234c 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -793,9 +793,8 @@
     // We want the text in glyph id encoding and a writable buffer, so we end
     // up making a copy either way.
     size_t numGlyphs = paint.textToGlyphs(text, len, NULL);
-    uint16_t* glyphIDs =
-        (uint16_t*)sk_malloc_flags(numGlyphs * 2,
-                                   SK_MALLOC_TEMP | SK_MALLOC_THROW);
+    uint16_t* glyphIDs = reinterpret_cast<uint16_t*>(
+            sk_malloc_flags(numGlyphs * 2, SK_MALLOC_TEMP | SK_MALLOC_THROW));
     SkAutoFree autoFreeGlyphIDs(glyphIDs);
     if (paint.getTextEncoding() != SkPaint::kGlyphID_TextEncoding) {
         paint.textToGlyphs(text, len, glyphIDs);
@@ -872,15 +871,15 @@
     size_t numGlyphs;
     if (paint.getTextEncoding() != SkPaint::kGlyphID_TextEncoding) {
         numGlyphs = paint.textToGlyphs(text, len, NULL);
-        glyphIDs = (uint16_t*)sk_malloc_flags(numGlyphs * 2,
-                                              SK_MALLOC_TEMP | SK_MALLOC_THROW);
+        glyphIDs = reinterpret_cast<uint16_t*>(sk_malloc_flags(
+                numGlyphs * 2, SK_MALLOC_TEMP | SK_MALLOC_THROW));
         glyphStorage.set(glyphIDs);
         paint.textToGlyphs(text, len, glyphIDs);
         textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
     } else {
         SkASSERT((len & 1) == 0);
         numGlyphs = len / 2;
-        glyphIDs = (uint16_t*)text;
+        glyphIDs = reinterpret_cast<uint16_t*>(const_cast<void*>((text)));
     }
 
     SkDrawCacheProc glyphCacheProc = textPaint.getDrawCacheProc();
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index bf5a2e8..e566856 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -161,10 +161,10 @@
     }
     fCatalog->emitSubstituteResources(stream, true);
     // TODO(vandebo) support linearized format
-    //if (fPages.size() > 1) {
-    //    // TODO(vandebo) save the file offset for the first page xref table.
-    //    fCatalog->emitXrefTable(stream, true);
-    //}
+    // if (fPages.size() > 1) {
+    //     // TODO(vandebo) save the file offset for the first page xref table.
+    //     fCatalog->emitXrefTable(stream, true);
+    // }
 
     for (int i = 0; i < fPageTree.count(); i++) {
         fPageTree[i]->emitObject(stream, fCatalog.get(), true);
@@ -204,7 +204,7 @@
 
     SkPDFPage* page = new SkPDFPage(pdfDevice);
     SkSafeUnref(fPages[pageNumber]);
-    fPages[pageNumber] = page; // Reference from new passed to fPages.
+    fPages[pageNumber] = page;  // Reference from new passed to fPages.
     return true;
 }
 
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index ecee502..d96afa8 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -166,10 +166,10 @@
         }
         ((uint8_t *)src)[srcLen] = 0;
     } else {
-        static const size_t bufSize = 4096;
-        uint8_t buf[bufSize];
+        static const size_t kBufSize = 4096;
+        uint8_t buf[kBufSize];
         size_t amount;
-        while ((amount = srcStream->read(buf, bufSize)) > 0)
+        while ((amount = srcStream->read(buf, kBufSize)) > 0)
             dynamicStream.write(buf, amount);
         amount = 0;
         dynamicStream.write(&amount, 1);  // NULL terminator.
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp
index d75a84c..8cfbcce 100644
--- a/src/pdf/SkPDFImage.cpp
+++ b/src/pdf/SkPDFImage.cpp
@@ -147,7 +147,7 @@
             int offset2 = 8 - offset1;
             for (int y = srcRect.fTop; y < srcRect.fBottom; y++) {
                 uint8_t* src = bitmap.getAddr1(0, y);
-                // This may read up to one byte after src, but the potentially 
+                // This may read up to one byte after src, but the potentially
                 // invalid bits are never used for computation.
                 for (int x = srcRect.fLeft; x < srcRect.fRight; x += 8)  {
                     if (offset1) {
diff --git a/src/pdf/SkPDFPage.cpp b/src/pdf/SkPDFPage.cpp
index fc6bca6..cc8fc48 100644
--- a/src/pdf/SkPDFPage.cpp
+++ b/src/pdf/SkPDFPage.cpp
@@ -103,7 +103,7 @@
                 // TODO(vandebo) put the objects in strict access order.
                 // Probably doesn't matter because they are so small.
                 if (curNodes[i] != pages[0]) {
-                    pageTree->push(curNodes[i]); // Transfer reference.
+                    pageTree->push(curNodes[i]);  // Transfer reference.
                     catalog->addObject(curNodes[i], false);
                 } else {
                     SkSafeUnref(curNodes[i]);
@@ -123,9 +123,9 @@
         curNodes = nextRoundNodes;
         nextRoundNodes.rewind();
         treeCapacity *= kNodeSize;
-    } while(curNodes.count() > 1);
+    } while (curNodes.count() > 1);
 
-    pageTree->push(curNodes[0]); // Transfer reference.
+    pageTree->push(curNodes[0]);  // Transfer reference.
     catalog->addObject(curNodes[0], false);
     if (rootNode)
         *rootNode = curNodes[0];
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 0996d5b..218a66e 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -200,7 +200,7 @@
 }
 
 static SkString linearCode(const SkShader::GradientInfo& info) {
-    SkString function("{pop\n"); // Just ditch the y value.
+    SkString function("{pop\n");  // Just ditch the y value.
     tileModeCode(info.fTileMode, &function);
     gradientFunctionCode(info, &function);
     function.append("}");
@@ -300,7 +300,7 @@
 
 class SkPDFFunctionShader : public SkPDFDict, public SkPDFShader {
 public:
-    SkPDFFunctionShader(SkPDFShader::State* state);
+    explicit SkPDFFunctionShader(SkPDFShader::State* state);
     ~SkPDFFunctionShader() {
         if (isValid()) {
             RemoveShader(this);
@@ -325,7 +325,7 @@
 
 class SkPDFImageShader : public SkPDFStream, public SkPDFShader {
 public:
-    SkPDFImageShader(SkPDFShader::State* state);
+    explicit SkPDFImageShader(SkPDFShader::State* state);
     ~SkPDFImageShader() {
         RemoveShader(this);
         fResources.unrefAll();
@@ -808,8 +808,8 @@
     } else {
         fColorData.set(sk_malloc_throw(
                     fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar))));
-        fInfo.fColors = (SkColor*)fColorData.get();
-        fInfo.fColorOffsets = (SkScalar*)(fInfo.fColors + fInfo.fColorCount);
+        fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get());
+        fInfo.fColorOffsets = reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount);
         shader.asAGradient(&fInfo);
     }
 }