Fix setFileOffset type to remove warnings.
Review URL: https://codereview.appspot.com/6334050 git-svn-id: http://skia.googlecode.com/svn/trunk@4585 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
0cb1e2bcae
commit
30580f6949
@ -38,7 +38,7 @@ SkPDFObject* SkPDFCatalog::addObject(SkPDFObject* obj, bool onFirstPage) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
size_t SkPDFCatalog::setFileOffset(SkPDFObject* obj, size_t offset) {
|
||||
size_t SkPDFCatalog::setFileOffset(SkPDFObject* obj, off_t offset) {
|
||||
int objIndex = assignObjNum(obj) - 1;
|
||||
SkASSERT(fCatalog[objIndex].fObjNumAssigned);
|
||||
SkASSERT(fCatalog[objIndex].fFileOffset == 0);
|
||||
@ -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], (size_t) offsetSum);
|
||||
offsetSum += setFileOffset((*targetList)[i], offsetSum);
|
||||
}
|
||||
return offsetSum - fileOffset;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
* @param obj The object to add.
|
||||
* @param offset The byte offset in the output stream of this object.
|
||||
*/
|
||||
size_t setFileOffset(SkPDFObject* obj, size_t offset);
|
||||
size_t setFileOffset(SkPDFObject* obj, off_t offset);
|
||||
|
||||
/** Output the object number for the passed object.
|
||||
* @param obj The object of interest.
|
||||
|
@ -123,14 +123,13 @@ 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(),
|
||||
(size_t) fileOffset);
|
||||
fileOffset += fCatalog->setFileOffset(fPages[0], (size_t) fileOffset);
|
||||
fileOffset += fCatalog->setFileOffset(fDocCatalog.get(), fileOffset);
|
||||
fileOffset += fCatalog->setFileOffset(fPages[0], fileOffset);
|
||||
fileOffset += fPages[0]->getPageSize(fCatalog.get(),
|
||||
(size_t) fileOffset);
|
||||
for (int i = 0; i < fSecondPageFirstResourceIndex; i++) {
|
||||
fileOffset += fCatalog->setFileOffset(fPageResources[i],
|
||||
(size_t) fileOffset);
|
||||
fileOffset);
|
||||
}
|
||||
// Add the size of resources of substitute objects used on page 1.
|
||||
fileOffset += fCatalog->setSubstituteResourcesOffsets(fileOffset, true);
|
||||
@ -140,20 +139,18 @@ bool SkPDFDocument::emitPDF(SkWStream* stream) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < fPageTree.count(); i++) {
|
||||
fileOffset += fCatalog->setFileOffset(fPageTree[i],
|
||||
(size_t) fileOffset);
|
||||
fileOffset += fCatalog->setFileOffset(fPageTree[i], fileOffset);
|
||||
}
|
||||
|
||||
for (int i = 1; i < fPages.count(); i++) {
|
||||
fileOffset += fPages[i]->getPageSize(fCatalog.get(),
|
||||
(size_t) fileOffset);
|
||||
fileOffset += fPages[i]->getPageSize(fCatalog.get(), fileOffset);
|
||||
}
|
||||
|
||||
for (int i = fSecondPageFirstResourceIndex;
|
||||
i < fPageResources.count();
|
||||
i++) {
|
||||
fileOffset += fCatalog->setFileOffset(fPageResources[i],
|
||||
(size_t) fileOffset);
|
||||
fileOffset);
|
||||
}
|
||||
|
||||
fileOffset += fCatalog->setSubstituteResourcesOffsets(fileOffset,
|
||||
|
@ -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(), (size_t) fileOffset);
|
||||
catalog->setFileOffset(fContentStream.get(), fileOffset);
|
||||
return fContentStream->getOutputSize(catalog, true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user