亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tif_pdsdirread.c

?? tiff格式傳真源碼例子
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_pdsdirread.c,v 1.2 2003/11/17 15:09:39 dron Exp $ *//* * Copyright (c) 1988-1996 Sam Leffler * Copyright (c) 1991-1996 Silicon Graphics, Inc. * Copyright (c( 1996 USAF Phillips Laboratory * * Permission to use, copy, modify, distribute, and sell this software and  * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. *  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.   *  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE  * OF THIS SOFTWARE. *//* * TIFF Library. *  * These routines written by Conrad J. Poelman on a single late-night of * March 20-21, 1996. * * The entire purpose of this file is to provide a single external function, * TIFFReadPrivateDataSubDirectory(). This function is intended for use in reading a * private subdirectory from a TIFF file into a private structure. The * actual writing of data into the structure is handled by the setFieldFn(), * which is passed to TIFFReadPrivateDataSubDirectory() as a parameter. The idea is to * enable any application wishing to store private subdirectories to do so * easily using this function, without modifying the TIFF library. * * The astute observer will notice that only two functions are at all different * from the original tif_dirread.c file: TIFFReadPrivateDataSubDirectory() and * TIFFFetchNormalSubTag(). All the other stuff that makes this file so huge * is only necessary because all of those functions are declared static in * tif_dirread.c, so we have to totally duplicate them in order to use them. * * Oh, also note the bug fix in TIFFFetchFloat(). * */#include "tiffiop.h"#define	IGNORE	0		/* tag placeholder used below */#if HAVE_IEEEFP#define	TIFFCvtIEEEFloatToNative(tif, n, fp)#define	TIFFCvtIEEEDoubleToNative(tif, n, dp)#elseextern	void TIFFCvtIEEEFloatToNative(TIFF*, uint32, float*);extern	void TIFFCvtIEEEDoubleToNative(TIFF*, uint32, double*);#endifstatic	void EstimateStripByteCounts(TIFF*, TIFFDirEntry*, uint16);static	void MissingRequired(TIFF*, const char*);static	int CheckDirCount(TIFF*, TIFFDirEntry*, uint32);static	tsize_t TIFFFetchData(TIFF*, TIFFDirEntry*, char*);static	tsize_t TIFFFetchString(TIFF*, TIFFDirEntry*, char*);static	float TIFFFetchRational(TIFF*, TIFFDirEntry*);static	int TIFFFetchNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,				  int (*getFieldFn)(TIFF *tif,ttag_t tag,...));static	int TIFFFetchPerSampleShorts(TIFF*, TIFFDirEntry*, int*);static	int TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*);static	int TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16*);static	int TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32**);static	int TIFFFetchExtraSamples(TIFF*, TIFFDirEntry*);static	int TIFFFetchRefBlackWhite(TIFF*, TIFFDirEntry*);static	float TIFFFetchFloat(TIFF*, TIFFDirEntry*);static	int TIFFFetchFloatArray(TIFF*, TIFFDirEntry*, float*);static	int TIFFFetchDoubleArray(TIFF*, TIFFDirEntry*, double*);static	int TIFFFetchAnyArray(TIFF*, TIFFDirEntry*, double*);static	int TIFFFetchShortPair(TIFF*, TIFFDirEntry*);#if STRIPCHOP_SUPPORTstatic	void ChopUpSingleUncompressedStrip(TIFF*);#endifstatic char *CheckMalloc(TIFF* tif, tsize_t n, const char* what){	char *cp = (char*)_TIFFmalloc(n);	if (cp == NULL)		TIFFError(tif->tif_name, "No space %s", what);	return (cp);}/* Just as was done with TIFFWritePrivateDataSubDirectory(), here we implement   TIFFReadPrivateDataSubDirectory() which takes an offset into the TIFF file,   a TIFFFieldInfo structure specifying the types of the various tags,   and a function to use to set individual tags when they are encountered.   The data is read from the file, translated using the TIFF library's   built-in machine-independent conversion functions, and filled into   private subdirectory structure.   This code was written by copying the original TIFFReadDirectory() function   from tif_dirread.c and paring it down to what is needed for this.   It is the caller's responsibility to allocate and initialize the internal   structure that setFieldFn() will be writing into. If this function is being   called more than once before closing the file, the caller also must be   careful to free data in the structure before re-initializing.   It is also the caller's responsibility to verify the presence of   any required fields after reading the directory in.*/intTIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,				TIFFFieldInfo *field_info,				int (*setFieldFn)(TIFF *tif, ttag_t tag, ...)){	register TIFFDirEntry* dp;	register int n;	register TIFFDirectory* td;	TIFFDirEntry* dir;	int iv;	long v;	double dv;	const TIFFFieldInfo* fip;	int fix;	uint16 dircount;	uint32 nextdiroff;	char* cp;	int diroutoforderwarning = 0;	/* Skipped part about checking for directories or compression data. */	if (!isMapped(tif)) {		if (!SeekOK(tif, pdir_offset)) {			TIFFError(tif->tif_name,			    "Seek error accessing TIFF private subdirectory");			return (0);		}		if (!ReadOK(tif, &dircount, sizeof (uint16))) {			TIFFError(tif->tif_name,			    "Can not read TIFF private subdirectory count");			return (0);		}		if (tif->tif_flags & TIFF_SWAB)			TIFFSwabShort(&dircount);		dir = (TIFFDirEntry *)CheckMalloc(tif,		    dircount * sizeof (TIFFDirEntry), "to read TIFF private subdirectory");		if (dir == NULL)			return (0);		if (!ReadOK(tif, dir, dircount*sizeof (TIFFDirEntry))) {			TIFFError(tif->tif_name, "Can not read TIFF private subdirectory");			goto bad;		}		/*		 * Read offset to next directory for sequential scans.		 */		(void) ReadOK(tif, &nextdiroff, sizeof (uint32));	} else {		toff_t off = pdir_offset;		if (off + sizeof (short) > tif->tif_size) {			TIFFError(tif->tif_name,			    "Can not read TIFF private subdirectory count");			return (0);		} else			_TIFFmemcpy(&dircount, tif->tif_base + off, sizeof (uint16));		off += sizeof (uint16);		if (tif->tif_flags & TIFF_SWAB)			TIFFSwabShort(&dircount);		dir = (TIFFDirEntry *)CheckMalloc(tif,		    dircount * sizeof (TIFFDirEntry), "to read TIFF private subdirectory");		if (dir == NULL)			return (0);		if (off + dircount*sizeof (TIFFDirEntry) > tif->tif_size) {			TIFFError(tif->tif_name, "Can not read TIFF private subdirectory");			goto bad;		} else			_TIFFmemcpy(dir, tif->tif_base + off,			    dircount*sizeof (TIFFDirEntry));		off += dircount* sizeof (TIFFDirEntry);		if (off + sizeof (uint32) < tif->tif_size)			_TIFFmemcpy(&nextdiroff, tif->tif_base+off, sizeof (uint32));	}	if (tif->tif_flags & TIFF_SWAB)		TIFFSwabLong(&nextdiroff);	/*	 * Setup default value and then make a pass over	 * the fields to check type and tag information,	 * and to extract info required to size data	 * structures.  A second pass is made afterwards	 * to read in everthing not taken in the first pass.	 */	td = &tif->tif_dir;		for (fip = field_info, dp = dir, n = dircount;	     n > 0; n--, dp++) {		if (tif->tif_flags & TIFF_SWAB) {			TIFFSwabArrayOfShort(&dp->tdir_tag, 2);			TIFFSwabArrayOfLong(&dp->tdir_count, 2);		}		/*		 * Find the field information entry for this tag.		 */		/*		 * Silicon Beach (at least) writes unordered		 * directory tags (violating the spec).  Handle		 * it here, but be obnoxious (maybe they'll fix it?).		 */		if (dp->tdir_tag < fip->field_tag) {			if (!diroutoforderwarning) {				TIFFWarning(tif->tif_name,	"invalid TIFF private subdirectory; tags are not sorted in ascending order");				diroutoforderwarning = 1;			}			fip = field_info;    /* O(n^2) */		}		while (fip->field_tag && fip->field_tag < dp->tdir_tag)			fip++;		if (!fip->field_tag || fip->field_tag != dp->tdir_tag) {			TIFFWarning(tif->tif_name,			    "unknown field with tag %d (0x%x) in private subdirectory ignored",			    dp->tdir_tag,  dp->tdir_tag);			dp->tdir_tag = IGNORE;			fip = field_info;/* restart search */			continue;		}		/*		 * Null out old tags that we ignore.		 */		/* Not implemented yet, since FIELD_IGNORE is specific to		   the main directories. Could pass this in too... */		if (0 /* && fip->field_bit == FIELD_IGNORE */) {	ignore:			dp->tdir_tag = IGNORE;			continue;		}		/*		 * Check data type.		 */		while (dp->tdir_type != (u_short)fip->field_type) {			if (fip->field_type == TIFF_ANY)	/* wildcard */				break;			fip++;			if (!fip->field_tag || fip->field_tag != dp->tdir_tag) {				TIFFWarning(tif->tif_name,				   "wrong data type %d for \"%s\"; tag ignored",				    dp->tdir_type, fip[-1].field_name);				goto ignore;			}		}		/*		 * Check count if known in advance.		 */		if (fip->field_readcount != TIFF_VARIABLE) {			uint32 expected = (fip->field_readcount == TIFF_SPP) ?			    (uint32) td->td_samplesperpixel :			    (uint32) fip->field_readcount;			if (!CheckDirCount(tif, dp, expected))				goto ignore;		}		/* Now read in and process data from field. */		if (!TIFFFetchNormalSubTag(tif, dp, fip, setFieldFn))		    goto bad;	}	if (dir)		_TIFFfree(dir);	return (1);bad:	if (dir)		_TIFFfree(dir);	return (0);}static voidEstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount){	register TIFFDirEntry *dp;	register TIFFDirectory *td = &tif->tif_dir;	uint16 i;	if (td->td_stripbytecount)		_TIFFfree(td->td_stripbytecount);	td->td_stripbytecount = (uint32*)	    CheckMalloc(tif, td->td_nstrips * sizeof (uint32),		"for \"StripByteCounts\" array");	if (td->td_compression != COMPRESSION_NONE) {		uint32 space = (uint32)(sizeof (TIFFHeader)		    + sizeof (uint16)		    + (dircount * sizeof (TIFFDirEntry))		    + sizeof (uint32));		toff_t filesize = TIFFGetFileSize(tif);		uint16 n;		/* calculate amount of space used by indirect values */		for (dp = dir, n = dircount; n > 0; n--, dp++) {			uint32 cc = dp->tdir_count*TIFFDataWidth(dp->tdir_type);			if (cc > sizeof (uint32))				space += cc;		}		space = (filesize - space) / td->td_samplesperpixel;		for (i = 0; i < td->td_nstrips; i++)			td->td_stripbytecount[i] = space;		/*		 * This gross hack handles the case were the offset to		 * the last strip is past the place where we think the strip		 * should begin.  Since a strip of data must be contiguous,		 * it's safe to assume that we've overestimated the amount		 * of data in the strip and trim this number back accordingly.		 */ 		i--;		if (td->td_stripoffset[i] + td->td_stripbytecount[i] > filesize)			td->td_stripbytecount[i] =			    filesize - td->td_stripoffset[i];	} else {		uint32 rowbytes = TIFFScanlineSize(tif);		uint32 rowsperstrip = td->td_imagelength / td->td_nstrips;		for (i = 0; i < td->td_nstrips; i++)			td->td_stripbytecount[i] = rowbytes*rowsperstrip;	}	TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);	if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))		td->td_rowsperstrip = td->td_imagelength;}static voidMissingRequired(TIFF* tif, const char* tagname){	TIFFError(tif->tif_name,	    "TIFF directory is missing required \"%s\" field", tagname);}/* * Check the count field of a directory * entry against a known value.  The caller * is expected to skip/ignore the tag if * there is a mismatch. */static intCheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count){	if (count != dir->tdir_count) {		TIFFWarning(tif->tif_name,	"incorrect count for field \"%s\" (%lu, expecting %lu); tag ignored",		    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,		    dir->tdir_count, count);		return (0);	}	return (1);}/* * Fetch a contiguous directory item. */static tsize_tTIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp){	int w = TIFFDataWidth(dir->tdir_type);	tsize_t cc = dir->tdir_count * w;	if (!isMapped(tif)) {		if (!SeekOK(tif, dir->tdir_offset))			goto bad;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产乱码字幕精品高清av| 精品女同一区二区| 日韩久久久久久| 亚洲自拍偷拍图区| 99久久国产免费看| 久久综合五月天婷婷伊人| 五月开心婷婷久久| 日本精品视频一区二区| 中文字幕精品三区| 久久精品理论片| 欧美大片一区二区| 久久国产欧美日韩精品| 色综合一区二区三区| 亚洲欧洲日韩在线| 91久久线看在观草草青青 | 国产精品99久久久久久有的能看| 7777精品伊人久久久大香线蕉的 | 中文字幕的久久| 成人精品鲁一区一区二区| 综合分类小说区另类春色亚洲小说欧美| 九九视频精品免费| 中文字幕在线观看一区二区| www.日韩大片| 亚洲高清不卡在线观看| 日韩一区二区精品在线观看| 麻豆一区二区三区| 中文字幕欧美激情| 欧美性大战久久久久久久| 蜜桃久久久久久| 国产精品欧美久久久久无广告| 91在线云播放| 久久国产精品无码网站| 久久久久久久久久电影| 91丝袜美女网| 精品在线观看视频| 亚洲综合免费观看高清在线观看 | 成人黄色一级视频| 图片区小说区国产精品视频| 久久久久9999亚洲精品| 欧美伊人精品成人久久综合97| 蜜臀av性久久久久蜜臀aⅴ四虎 | 亚洲欧美综合色| 日韩一区二区免费高清| 在线观看成人免费视频| 国产一区二区女| 秋霞午夜鲁丝一区二区老狼| 亚洲色图欧美在线| 欧美国产成人在线| 精品国产污网站| 7777精品伊人久久久大香线蕉最新版| 福利91精品一区二区三区| 视频一区欧美精品| 午夜av一区二区三区| 亚洲男人天堂av| 亚洲精品视频一区二区| 中国av一区二区三区| 久久久av毛片精品| 久久综合色之久久综合| 欧美一二区视频| 欧美成人精品1314www| 日韩欧美aaaaaa| 久久久影视传媒| 国产亚洲欧美一区在线观看| 久久久久国色av免费看影院| 26uuu色噜噜精品一区| 日韩一卡二卡三卡| 91精品麻豆日日躁夜夜躁| 欧美日韩精品三区| 精品第一国产综合精品aⅴ| 欧美v日韩v国产v| 国产欧美1区2区3区| 成人免费一区二区三区视频| 亚洲精品免费在线播放| 日本在线不卡一区| 韩国三级中文字幕hd久久精品| 国内成人免费视频| 99精品黄色片免费大全| 欧美久久久久久蜜桃| 2024国产精品视频| 国产欧美一区二区三区在线老狼| 中文字幕五月欧美| 免费看黄色91| 色综合中文字幕| 精品国产免费视频| 一区二区三区在线视频免费| 久久国产精品免费| 欧美性猛交xxxx乱大交退制版| 精品福利在线导航| 亚洲一区在线观看免费观看电影高清| 美日韩一区二区| 在线影视一区二区三区| 欧美国产精品久久| 九色综合狠狠综合久久| 欧美色手机在线观看| 中文乱码免费一区二区| 精品一区二区三区视频在线观看 | 久久99蜜桃精品| 欧洲精品在线观看| 国产精品电影一区二区三区| 美女一区二区三区在线观看| 欧美私模裸体表演在线观看| 中文在线一区二区| 国产福利91精品一区| 欧美变态凌虐bdsm| 久久精品国产精品亚洲精品| 制服丝袜日韩国产| 日韩不卡免费视频| 欧美高清hd18日本| 日本美女一区二区三区视频| 欧美理论片在线| 久久成人18免费观看| 精品久久久久久最新网址| 精品午夜一区二区三区在线观看| 欧美一区二区三区喷汁尤物| 蜜臀av一级做a爰片久久| 欧美不卡视频一区| 欧美日本国产一区| 欧美性受xxxx| 欧美xxxxx裸体时装秀| 秋霞电影网一区二区| 欧美成人精品1314www| 成人妖精视频yjsp地址| 一区二区三区在线视频免费观看| 欧美视频一区二区三区四区| 亚洲主播在线观看| 欧美成人三级在线| jvid福利写真一区二区三区| 一区二区三区四区视频精品免费 | 日韩欧美久久久| 国产成人在线网站| 亚洲成av人片在线观看无码| 精品国产91洋老外米糕| 色成人在线视频| 韩国三级中文字幕hd久久精品| 怡红院av一区二区三区| 精品国产一区二区三区忘忧草 | 色综合久久久久久久久久久| 丝袜诱惑制服诱惑色一区在线观看 | 日本不卡123| 日韩精品一区二区在线观看| 99久久99久久精品免费看蜜桃| 午夜一区二区三区视频| 久久亚洲精品国产精品紫薇| 欧美中文字幕一二三区视频| 国产成人免费xxxxxxxx| 日韩成人午夜精品| 亚洲第一成人在线| 亚洲综合网站在线观看| 亚洲天堂久久久久久久| 国产日韩亚洲欧美综合| 欧美成人福利视频| 欧美电影免费观看高清完整版在线 | 亚洲色图在线看| 国产精品高清亚洲| 国产精品你懂的在线欣赏| 日韩伦理av电影| 91黄色免费网站| 欧美中文一区二区三区| www.日韩av| 91成人看片片| 91精品国产综合久久久久久久久久| 欧美午夜在线观看| 欧美日韩一卡二卡| 日韩天堂在线观看| 国产欧美一区二区三区在线看蜜臀| 日韩精品中文字幕一区| 久久久蜜桃精品| 国产精品久久久久久久浪潮网站 | 国产欧美日韩麻豆91| 一区免费观看视频| 五月天激情综合| 国产精品一二三在| 91猫先生在线| 国产免费成人在线视频| 亚洲美女电影在线| 一个色在线综合| 亚洲高清免费一级二级三级| 日本视频在线一区| 成人黄色av电影| 欧美日韩免费不卡视频一区二区三区| 欧美一区二区三区四区视频| 久久精品一区二区| 日韩高清电影一区| 成年人国产精品| 久久久一区二区三区| 午夜成人免费电影| 91在线视频网址| 精品黑人一区二区三区久久| 亚洲综合一区在线| 粉嫩高潮美女一区二区三区 | 国产成人激情av| 777久久久精品| 亚洲成人动漫av| 91女人视频在线观看| 中文字幕第一页久久| 国产尤物一区二区在线| 日韩亚洲欧美综合| 日韩av一区二区在线影视| 91女神在线视频| 一区二区三区精品久久久|