aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar ctguil@chromium.org <ctguil@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-15 23:55:03 +0000
committerGravatar ctguil@chromium.org <ctguil@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-15 23:55:03 +0000
commita5c7234e81748f76cbeede40e619351146e5286a (patch)
tree8ed00bec04bc664f52c2c35f49df38625ac8a197
parent7b5e0171694364ef86e3e78dbdd8b83a336b8f53 (diff)
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
-rwxr-xr-xinclude/pdf/SkBitSet.h2
-rw-r--r--include/pdf/SkPDFDevice.h3
-rw-r--r--include/pdf/SkPDFFont.h2
-rw-r--r--include/pdf/SkPDFTypes.h16
-rw-r--r--include/pdf/SkPDFUtils.h2
-rwxr-xr-xsrc/pdf/SkBitSet.cpp4
-rw-r--r--src/pdf/SkPDFCatalog.cpp10
-rw-r--r--src/pdf/SkPDFDevice.cpp11
-rw-r--r--src/pdf/SkPDFDocument.cpp10
-rw-r--r--src/pdf/SkPDFFont.cpp6
-rw-r--r--src/pdf/SkPDFImage.cpp2
-rw-r--r--src/pdf/SkPDFPage.cpp6
-rw-r--r--src/pdf/SkPDFShader.cpp10
13 files changed, 41 insertions, 43 deletions
diff --git a/include/pdf/SkBitSet.h b/include/pdf/SkBitSet.h
index 4791df4de5..fd564a531e 100755
--- a/include/pdf/SkBitSet.h
+++ b/include/pdf/SkBitSet.h
@@ -55,7 +55,7 @@ private:
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 9892d5cc1f..dff61a388b 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -71,8 +71,7 @@ public:
}
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 982fd34244..4b7943c854 100644
--- a/include/pdf/SkPDFFont.h
+++ b/include/pdf/SkPDFFont.h
@@ -48,7 +48,7 @@ public:
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 8e7ea1a0af..155b8262fa 100644
--- a/include/pdf/SkPDFTypes.h
+++ b/include/pdf/SkPDFTypes.h
@@ -285,22 +285,22 @@ public:
* @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 @@ public:
* @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 @@ public:
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 b25698bea8..5b9d74e321 100644
--- a/include/pdf/SkPDFUtils.h
+++ b/include/pdf/SkPDFUtils.h
@@ -29,7 +29,7 @@ struct SkRect;
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 c2bbeaf87a..c10c100de7 100755
--- a/src/pdf/SkBitSet.cpp
+++ b/src/pdf/SkBitSet.cpp
@@ -24,7 +24,7 @@ SkBitSet::SkBitSet(const SkBitSet& source)
}
const SkBitSet& SkBitSet::operator=(const SkBitSet& rhs) {
- if (this == (SkBitSet*)&rhs) {
+ if (this == &rhs) {
return *this;
}
fBitCount = rhs.fBitCount;
@@ -84,7 +84,7 @@ bool SkBitSet::orBits(const SkBitSet& source) {
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 a3abef70ab..90aa78e0c8 100644
--- a/src/pdf/SkPDFCatalog.cpp
+++ b/src/pdf/SkPDFCatalog.cpp
@@ -106,11 +106,11 @@ int32_t SkPDFCatalog::emitXrefTable(SkWStream* stream, bool firstPage) {
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 daf80181fb..b76234c04b 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -793,9 +793,8 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
// 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 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
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 bf5a2e8797..e566856d6d 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -161,10 +161,10 @@ bool SkPDFDocument::emitPDF(SkWStream* stream) {
}
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 @@ bool SkPDFDocument::setPage(int pageNumber, SkPDFDevice* pdfDevice) {
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 ecee5020df..d96afa8238 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -166,10 +166,10 @@ SkStream* handleType1Stream(SkStream* srcStream, size_t* headerLen,
}
((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 d75a84cdc0..8cfbcce2ed 100644
--- a/src/pdf/SkPDFImage.cpp
+++ b/src/pdf/SkPDFImage.cpp
@@ -147,7 +147,7 @@ void extractImageData(const SkBitmap& bitmap, const SkIRect& srcRect,
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 fc6bca66bf..cc8fc48d97 100644
--- a/src/pdf/SkPDFPage.cpp
+++ b/src/pdf/SkPDFPage.cpp
@@ -103,7 +103,7 @@ void SkPDFPage::GeneratePageTree(const SkTDArray<SkPDFPage*>& pages,
// 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 @@ void SkPDFPage::GeneratePageTree(const SkTDArray<SkPDFPage*>& pages,
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 0996d5b912..218a66eeda 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -200,7 +200,7 @@ static void tileModeCode(SkShader::TileMode mode, SkString* result) {
}
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 @@ public:
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 @@ private:
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 @@ SkPDFShader::State::State(const SkShader& shader,
} 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);
}
}