rem: if (ifd.HasField(TAG_FILL_ORDER) && ifd.GetUint(TAG_FILL_ORDER) != 1) return B_NO_TRANSLATOR;
context: check_tiff_fields(TiffIfd &ifd, TiffDetails *pdetails, bool bAllocArrays){	if (!pdetails)		return B_BAD_VALUE;			try {		// Extra Samples are not yet supported		if (ifd.HasField(TAG_EXTRA_SAMPLES))			return B_NO_TRANSLATOR;					// Only the default values are supported for the		// following fields.  HasField is called so that		// if a field is not present, a TiffIfdFieldNotFoundException		// will not be thrown when GetUint is called.		// (If they are not present, that is fine, but if		// they are present and have a non-default value,		// that is a problem)			if (ifd.HasField(TAG_FILL_ORDER) &&			ifd.GetUint(TAG_FILL_ORDER) != 1)			return B_NO_TRANSLATOR;		if (ifd.HasField(TAG_ORIENTATION) &&			ifd.GetUint(TAG_ORIENTATION) != 1)			return B_NO_TRANSLATOR;		if (ifd.HasField(TAG_PLANAR_CONFIGURATION) &&			ifd.GetUint(TAG_PLANAR_CONFIGURATION) != 1)			return B_NO_TRANSLATOR;		if (ifd.HasField(TAG_SAMPLE_FORMAT) &&			ifd.GetUint(TAG_SAMPLE_FORMAT) != 1)			return B_NO_TRANSLATOR;					// Copy fields useful to TIFFTranslator		uint32 width			= ifd.GetUint(TAG_IMAGE_WIDTH);		uint32 height			= ifd.GetUint(TAG_IMAGE_HEIGHT);		uint16 interpretation	= ifd.GetUint(TAG_PHOTO_INTERPRETATION);				uint32 compression;		if (!ifd.HasField(TAG_COMPRESSION))			compression = COMPRESSION_NONE;		else			compression = ifd.GetUint(TAG_COMPRESSION);				uint16 imageType = 0, bitsPerPixel = 0;		switch (interpretation) {			// black and white or grayscale images			case PHOTO_WHITEZERO:			case PHOTO_BLACKZERO:				// default value for samples per pixel is 1				if (ifd.HasField(TAG_SAMPLES_PER_PIXEL) &&					ifd.GetUint(TAG_SAMPLES_PER_PIXEL) != 1)					return B_NO_TRANSLATOR;									// default value for bits per sample is 1				if (!ifd.HasField(TAG_BITS_PER_SAMPLE) ||					ifd.GetUint(TAG_BITS_PER_SAMPLE) == 1) {					bitsPerPixel = 1;										if (compression != COMPRESSION_NONE &&						compression != COMPRESSION_HUFFMAN &&						compression != COMPRESSION_PACKBITS)						return B_NO_TRANSLATOR;							} else if (ifd.GetUint(TAG_BITS_PER_SAMPLE) == 4 ||					ifd.GetUint(TAG_BITS_PER_SAMPLE) == 8) {					bitsPerPixel = ifd.GetUint(TAG_BITS_PER_SAMPLE);										if (compression != COMPRESSION_NONE &&						compression != COMPRESSION_PACKBITS)						return B_NO_TRANSLATOR;				} else					return B_NO_TRANSLATOR;									imageType = TIFF_BILEVEL;									break;							// Palette color images			case PHOTO_PALETTE:				if (compression != COMPRESSION_NONE &&					compression != COMPRESSION_PACKBITS)					return B_NO_TRANSLATOR;									// default value for samples per pixel is 1				if (ifd.HasField(TAG_SAMPLES_PER_PIXEL) &&					ifd.GetUint(TAG_SAMPLES_PER_PIXEL) != 1)					return B_NO_TRANSLATOR;									bitsPerPixel = ifd.GetUint(TAG_BITS_PER_SAMPLE);				if (bitsPerPixel != 4 && bitsPerPixel != 8)					return B_NO_TRANSLATOR;									// ensure that the color map is the expected length				if (ifd.GetCount(TAG_COLOR_MAP) !=					(uint32) (3 * (1 << bitsPerPixel)))					return B_NO_TRANSLATOR;							imageType = TIFF_PALETTE;				break;							case PHOTO_RGB:				if (compression != COMPRESSION_NONE &&					compression != COMPRESSION_PACKBITS)					return B_NO_TRANSLATOR;									if (ifd.GetUint(TAG_SAMPLES_PER_PIXEL) != 3)					return B_NO_TRANSLATOR;				if (ifd.GetCount(TAG_BITS_PER_SAMPLE) != 3 ||					ifd.GetUint(TAG_BITS_PER_SAMPLE, 1) != 8 ||					ifd.GetUint(TAG_BITS_PER_SAMPLE, 2) != 8 ||					ifd.GetUint(TAG_BITS_PER_SAMPLE, 3) != 8)					return B_NO_TRANSLATOR;								imageType = TIFF_RGB;				break;							case PHOTO_SEPARATED:				if (compression != COMPRESSION_NONE &&					compression != COMPRESSION_PACKBITS)					return B_NO_TRANSLATOR;									// CMYK (default ink set)				// is the only ink set supported				if (ifd.HasField(TAG_INK_SET) &&					ifd.GetUint(TAG_INK_SET) != INK_SET_CMYK)					return B_NO_TRANSLATOR;								if (ifd.GetUint(TAG_SAMPLES_PER_PIXEL) != 4)					return B_NO_TRANSLATOR;				if (ifd.GetCount(TAG_BITS_PER_SAMPLE) != 4 ||					ifd.GetUint(TAG_BITS_PER_SAMPLE, 1) != 8 ||					ifd.GetUint(TAG_BITS_PER_SAMPLE, 2) != 8 ||					ifd.GetUint(TAG_BITS_PER_SAMPLE, 3) != 8 ||					ifd.GetUint(TAG_BITS_PER_SAMPLE, 4) != 8)					return B_NO_TRANSLATOR;								imageType = TIFF_CMYK;				break;								default:				return B_NO_TRANSLATOR;		}				uint32 rowsPerStrip, stripsPerImage;		if (!ifd.HasField(TAG_ROWS_PER_STRIP))			rowsPerStrip = DEFAULT_ROWS_PER_STRIP;		else			rowsPerStrip = ifd.GetUint(TAG_ROWS_PER_STRIP);		stripsPerImage = (height + rowsPerStrip - 1) / rowsPerStrip;					if (ifd.GetCount(TAG_STRIP_OFFSETS) != stripsPerImage ||			ifd.GetCount(TAG_STRIP_BYTE_COUNTS) != stripsPerImage)			return B_NO_TRANSLATOR;				// return read in details if output pointer is supplied		pdetails->width				= width;		pdetails->height			= height;		pdetails->compression		= compression;		pdetails->rowsPerStrip		= rowsPerStrip;		pdetails->stripsPerImage	= stripsPerImage;		pdetails->interpretation	= interpretation;		pdetails->bitsPerPixel		= bitsPerPixel;		pdetails->imageType			= imageType;					if (bAllocArrays) {			ifd.GetUint32Array(TAG_STRIP_OFFSETS,				&pdetails->pstripOffsets);			ifd.GetUint32Array(TAG_STRIP_BYTE_COUNTS,				&pdetails->pstripByteCounts);							if (pdetails->imageType == TIFF_PALETTE)				ifd.GetAdjustedColorMap(&pdetails->pcolorMap);		}				} catch (TiffIfdException) {		return B_NO_TRANSLATOR;	}			return B_OK;}