aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-06 12:04:24 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-06 12:04:24 +0000
commit1445a0d53b0793a2cc05c20e4ba74528f028cd8e (patch)
tree0dbaf2f22be03a7958aa75906f6c18cc82d0acac
parent920901da539ed8fca76d372abbef872d2cb31be5 (diff)
fix warnings on Mac in src/pdf
Fix these class of warnings: - unused functions - unused locals - sign mismatch - missing function prototypes - missing newline at end of file - 64 to 32 bit truncation The changes prefer to link in dead code in the debug build with 'if (false)' than to comment it out, but trivial cases are commented out or sometimes deleted if it appears to be a copy/paste error. Review URL: https://codereview.appspot.com/6299047 git-svn-id: http://skia.googlecode.com/svn/trunk@4178 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/pdf/SkPDFCatalog.cpp2
-rw-r--r--src/pdf/SkPDFDocument.cpp20
-rw-r--r--src/pdf/SkPDFFont.cpp9
-rw-r--r--src/pdf/SkPDFPage.cpp2
4 files changed, 23 insertions, 10 deletions
diff --git a/src/pdf/SkPDFCatalog.cpp b/src/pdf/SkPDFCatalog.cpp
index bc22e6aced..646476b111 100644
--- a/src/pdf/SkPDFCatalog.cpp
+++ b/src/pdf/SkPDFCatalog.cpp
@@ -190,7 +190,7 @@ off_t SkPDFCatalog::setSubstituteResourcesOffsets(off_t fileOffset,
SkTDArray<SkPDFObject*>* targetList = getSubstituteList(firstPage);
off_t offsetSum = fileOffset;
for (int i = 0; i < targetList->count(); ++i) {
- offsetSum += setFileOffset((*targetList)[i], offsetSum);
+ offsetSum += setFileOffset((*targetList)[i], (size_t) offsetSum);
}
return offsetSum - fileOffset;
}
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index 3b9b686ba8..cb24fbacf5 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -17,7 +17,7 @@
// Add the resources, starting at firstIndex to the catalog, removing any dupes.
// A hash table would be really nice here.
-void addResourcesToCatalog(int firstIndex, bool firstPage,
+static void addResourcesToCatalog(int firstIndex, bool firstPage,
SkTDArray<SkPDFObject*>* resourceList,
SkPDFCatalog* catalog) {
for (int i = firstIndex; i < resourceList->count(); i++) {
@@ -123,12 +123,14 @@ bool SkPDFDocument::emitPDF(SkWStream* stream) {
// Figure out the size of things and inform the catalog of file offsets.
off_t fileOffset = headerSize();
- fileOffset += fCatalog->setFileOffset(fDocCatalog.get(), fileOffset);
- fileOffset += fCatalog->setFileOffset(fPages[0], fileOffset);
- fileOffset += fPages[0]->getPageSize(fCatalog.get(), fileOffset);
+ fileOffset += fCatalog->setFileOffset(fDocCatalog.get(),
+ (size_t) fileOffset);
+ fileOffset += fCatalog->setFileOffset(fPages[0], (size_t) fileOffset);
+ fileOffset += fPages[0]->getPageSize(fCatalog.get(),
+ (size_t) fileOffset);
for (int i = 0; i < fSecondPageFirstResourceIndex; i++) {
fileOffset += fCatalog->setFileOffset(fPageResources[i],
- fileOffset);
+ (size_t) fileOffset);
}
// Add the size of resources of substitute objects used on page 1.
fileOffset += fCatalog->setSubstituteResourcesOffsets(fileOffset, true);
@@ -138,18 +140,20 @@ bool SkPDFDocument::emitPDF(SkWStream* stream) {
}
for (int i = 0; i < fPageTree.count(); i++) {
- fileOffset += fCatalog->setFileOffset(fPageTree[i], fileOffset);
+ fileOffset += fCatalog->setFileOffset(fPageTree[i],
+ (size_t) fileOffset);
}
for (int i = 1; i < fPages.count(); i++) {
- fileOffset += fPages[i]->getPageSize(fCatalog.get(), fileOffset);
+ fileOffset += fPages[i]->getPageSize(fCatalog.get(),
+ (size_t) fileOffset);
}
for (int i = fSecondPageFirstResourceIndex;
i < fPageResources.count();
i++) {
fileOffset += fCatalog->setFileOffset(fPageResources[i],
- fileOffset);
+ (size_t) fileOffset);
}
fileOffset += fCatalog->setSubstituteResourcesOffsets(fileOffset,
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 35394b6804..9f0177e669 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -463,6 +463,13 @@ static void append_bfrange_section(const SkTDArray<BFRange>& bfrange,
// For the worst case (having 65536 continuous unicode and we use every other
// one of them), the possible savings by aggressive optimization is 416KB
// pre-compressed and does not provide enough motivation for implementation.
+
+// FIXME: this should be in a header so that it is separately testable
+// ( see caller in tests/ToUnicode.cpp )
+void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
+ const SkPDFGlyphSet* subset,
+ SkDynamicMemoryWStream* cmap);
+
void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
const SkPDFGlyphSet* subset,
SkDynamicMemoryWStream* cmap) {
@@ -529,10 +536,12 @@ static SkPDFStream* generate_tounicode_cmap(
return new SkPDFStream(cmapStream.get());
}
+#if defined (SK_SFNTLY_SUBSETTER)
static void sk_delete_array(const void* ptr, size_t, void*) {
// Use C-style cast to cast away const and cast type simultaneously.
delete[] (unsigned char*)ptr;
}
+#endif
static int get_subset_font_stream(const char* fontName,
const SkTypeface* typeface,
diff --git a/src/pdf/SkPDFPage.cpp b/src/pdf/SkPDFPage.cpp
index 3f3dec98b3..3c8bd04a91 100644
--- a/src/pdf/SkPDFPage.cpp
+++ b/src/pdf/SkPDFPage.cpp
@@ -37,7 +37,7 @@ void SkPDFPage::finalizePage(SkPDFCatalog* catalog, bool firstPage,
off_t SkPDFPage::getPageSize(SkPDFCatalog* catalog, off_t fileOffset) {
SkASSERT(fContentStream.get() != NULL);
- catalog->setFileOffset(fContentStream.get(), fileOffset);
+ catalog->setFileOffset(fContentStream.get(), (size_t) fileOffset);
return fContentStream->getOutputSize(catalog, true);
}