Changed identify string to include index of identified page and count of pages so that even when this translator is used with programs that don't support multiple pages, the user can see how many pages the TIFF has and what page is currently active. Also, fixed issue when ioExtension is supplied, but does not contain "/documentIndex" which caused B_NO_TRANSLATOR to be returned.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4217 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber 2003-08-03 13:04:07 +00:00
parent 0383957902
commit ab361b2efb

View File

@ -442,9 +442,15 @@ identify_tiff_header(BPositionIO *inSource, BMessage *ioExtension,
ioExtension->AddInt32(DOCUMENT_COUNT, document_count);
// Check if a document index has been specified
ioExtension->FindInt32(DOCUMENT_INDEX, &document_index);
if (document_index < 1 || document_index > document_count)
status_t fnd = ioExtension->FindInt32(DOCUMENT_INDEX, &document_index);
if (fnd == B_OK && (document_index < 1 || document_index > document_count))
// If a document index has been supplied, and it is an invalid value,
// return failure
return B_NO_TRANSLATOR;
else if (fnd != B_OK)
// If FindInt32 failed, make certain the document index
// is the default value
document_index = 1;
}
// identify the document the user specified or the first document
@ -458,7 +464,8 @@ identify_tiff_header(BPositionIO *inSource, BMessage *ioExtension,
outInfo->quality = TIFF_IN_QUALITY;
outInfo->capability = TIFF_IN_CAPABILITY;
strcpy(outInfo->MIME, "image/tiff");
strcpy(outInfo->name, "TIFF image");
sprintf(outInfo->name, "TIFF image (page %d of %d)",
static_cast<int>(document_index), static_cast<int>(document_count));
}
if (!poutTIFF)