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

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

?? tif_dirread.c

?? 支持各種柵格圖像和矢量圖像讀取的庫
?? C
?? 第 1 頁 / 共 4 頁
字號:
		toff_t* new_dirlist;		/*		 * XXX: Reduce memory allocation granularity of the dirlist		 * array.		 */		new_dirlist = (toff_t *)_TIFFCheckRealloc(tif,							  tif->tif_dirlist,							  tif->tif_dirnumber,							  2 * sizeof(toff_t),							  "for IFD list");		if (!new_dirlist)			return 0;		tif->tif_dirlistsize = 2 * tif->tif_dirnumber;		tif->tif_dirlist = new_dirlist;	}	tif->tif_dirlist[tif->tif_dirnumber - 1] = diroff;	return 1;}/* * 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) {		TIFFWarningExt(tif->tif_clientdata, 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);	} else if (count < dir->tdir_count) {		TIFFWarningExt(tif->tif_clientdata, tif->tif_name,	"incorrect count for field \"%s\" (%lu, expecting %lu); tag trimmed",		    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,		    dir->tdir_count, count);		return (1);	}	return (1);}/* * Read IFD structure from the specified offset. If the pointer to * nextdiroff variable has been specified, read it too. Function returns a * number of fields in the directory or 0 if failed. */static uint16TIFFFetchDirectory(TIFF* tif, toff_t diroff, TIFFDirEntry **pdir,		   toff_t *nextdiroff){	static const char module[] = "TIFFFetchDirectory";	TIFFDirEntry *dir;	uint16 dircount;	assert(pdir);	tif->tif_diroff = diroff;	if (nextdiroff)		*nextdiroff = 0;	if (!isMapped(tif)) {		if (!SeekOK(tif, tif->tif_diroff)) {			TIFFErrorExt(tif->tif_clientdata, module,				"%s: Seek error accessing TIFF directory",				tif->tif_name);			return 0;		}		if (!ReadOK(tif, &dircount, sizeof (uint16))) {			TIFFErrorExt(tif->tif_clientdata, module,				"%s: Can not read TIFF directory count",				tif->tif_name);			return 0;		}		if (tif->tif_flags & TIFF_SWAB)			TIFFSwabShort(&dircount);		dir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount,						sizeof (TIFFDirEntry),						"to read TIFF directory");		if (dir == NULL)			return 0;		if (!ReadOK(tif, dir, dircount*sizeof (TIFFDirEntry))) {			TIFFErrorExt(tif->tif_clientdata, module,				"%.100s: Can not read TIFF directory",				tif->tif_name);			_TIFFfree(dir);			return 0;		}		/*		 * Read offset to next directory for sequential scans if		 * needed.		 */		if (nextdiroff)			(void) ReadOK(tif, nextdiroff, sizeof(uint32));	} else {		toff_t off = tif->tif_diroff;		/*		 * Check for integer overflow when validating the dir_off,		 * otherwise a very high offset may cause an OOB read and		 * crash the client. Make two comparisons instead of		 *		 *  off + sizeof(uint16) > tif->tif_size		 *		 * to avoid overflow.		 */		if (tif->tif_size < sizeof (uint16) ||		    off > tif->tif_size - sizeof(uint16)) {			TIFFErrorExt(tif->tif_clientdata, module,				"%s: Can not read TIFF directory count",				tif->tif_name);			return 0;		} else {			_TIFFmemcpy(&dircount, tif->tif_base + off,				    sizeof(uint16));		}		off += sizeof (uint16);		if (tif->tif_flags & TIFF_SWAB)			TIFFSwabShort(&dircount);		dir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount,						sizeof(TIFFDirEntry),						"to read TIFF directory");		if (dir == NULL)			return 0;		if (off + dircount * sizeof (TIFFDirEntry) > tif->tif_size) {			TIFFErrorExt(tif->tif_clientdata, module,				     "%s: Can not read TIFF directory",				     tif->tif_name);			_TIFFfree(dir);			return 0;		} else {			_TIFFmemcpy(dir, tif->tif_base + off,				    dircount * sizeof(TIFFDirEntry));		}		if (nextdiroff) {			off += dircount * sizeof (TIFFDirEntry);			if (off + sizeof (uint32) <= tif->tif_size) {				_TIFFmemcpy(nextdiroff, tif->tif_base + off,					    sizeof (uint32));			}		}	}	if (nextdiroff && tif->tif_flags & TIFF_SWAB)		TIFFSwabLong(nextdiroff);	*pdir = dir;	return dircount;}/* * Fetch a contiguous directory item. */static tsize_tTIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp){	int w = TIFFDataWidth((TIFFDataType) dir->tdir_type);	tsize_t cc = dir->tdir_count * w;	/* Check for overflow. */	if (!dir->tdir_count || !w || cc / w != (tsize_t)dir->tdir_count)		goto bad;	if (!isMapped(tif)) {		if (!SeekOK(tif, dir->tdir_offset))			goto bad;		if (!ReadOK(tif, cp, cc))			goto bad;	} else {		/* Check for overflow. */		if ((tsize_t)dir->tdir_offset + cc < (tsize_t)dir->tdir_offset		    || (tsize_t)dir->tdir_offset + cc < cc		    || (tsize_t)dir->tdir_offset + cc > (tsize_t)tif->tif_size)			goto bad;		_TIFFmemcpy(cp, tif->tif_base + dir->tdir_offset, cc);	}	if (tif->tif_flags & TIFF_SWAB) {		switch (dir->tdir_type) {		case TIFF_SHORT:		case TIFF_SSHORT:			TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);			break;		case TIFF_LONG:		case TIFF_SLONG:		case TIFF_FLOAT:			TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);			break;		case TIFF_RATIONAL:		case TIFF_SRATIONAL:			TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);			break;		case TIFF_DOUBLE:			TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);			break;		}	}	return (cc);bad:	TIFFErrorExt(tif->tif_clientdata, tif->tif_name,		     "Error fetching data for field \"%s\"",		     _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);	return (tsize_t) 0;}/* * Fetch an ASCII item from the file. */static tsize_tTIFFFetchString(TIFF* tif, TIFFDirEntry* dir, char* cp){	if (dir->tdir_count <= 4) {		uint32 l = dir->tdir_offset;		if (tif->tif_flags & TIFF_SWAB)			TIFFSwabLong(&l);		_TIFFmemcpy(cp, &l, dir->tdir_count);		return (1);	}	return (TIFFFetchData(tif, dir, cp));}/* * Convert numerator+denominator to float. */static intcvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv){	if (denom == 0) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,		    "%s: Rational with zero denominator (num = %lu)",		    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);		return (0);	} else {		if (dir->tdir_type == TIFF_RATIONAL)			*rv = ((float)num / (float)denom);		else			*rv = ((float)(int32)num / (float)(int32)denom);		return (1);	}}/* * Fetch a rational item from the file * at offset off and return the value * as a floating point number. */static floatTIFFFetchRational(TIFF* tif, TIFFDirEntry* dir){	uint32 l[2];	float v;	return (!TIFFFetchData(tif, dir, (char *)l) ||	    !cvtRational(tif, dir, l[0], l[1], &v) ? 1.0f : v);}/* * Fetch a single floating point value * from the offset field and return it * as a native float. */static floatTIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir){	float v;	int32 l = TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);        _TIFFmemcpy(&v, &l, sizeof(float));	TIFFCvtIEEEFloatToNative(tif, 1, &v);	return (v);}/* * Fetch an array of BYTE or SBYTE values. */static intTIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint8* v){    if (dir->tdir_count <= 4) {        /*         * Extract data from offset field.         */        if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {	    if (dir->tdir_type == TIFF_SBYTE)                switch (dir->tdir_count) {                    case 4: v[3] = dir->tdir_offset & 0xff;                    case 3: v[2] = (dir->tdir_offset >> 8) & 0xff;                    case 2: v[1] = (dir->tdir_offset >> 16) & 0xff;		    case 1: v[0] = dir->tdir_offset >> 24;                }	    else                switch (dir->tdir_count) {                    case 4: v[3] = dir->tdir_offset & 0xff;                    case 3: v[2] = (dir->tdir_offset >> 8) & 0xff;                    case 2: v[1] = (dir->tdir_offset >> 16) & 0xff;		    case 1: v[0] = dir->tdir_offset >> 24;                }	} else {	    if (dir->tdir_type == TIFF_SBYTE)                switch (dir->tdir_count) {                    case 4: v[3] = dir->tdir_offset >> 24;                    case 3: v[2] = (dir->tdir_offset >> 16) & 0xff;                    case 2: v[1] = (dir->tdir_offset >> 8) & 0xff;                    case 1: v[0] = dir->tdir_offset & 0xff;		}	    else                switch (dir->tdir_count) {                    case 4: v[3] = dir->tdir_offset >> 24;                    case 3: v[2] = (dir->tdir_offset >> 16) & 0xff;                    case 2: v[1] = (dir->tdir_offset >> 8) & 0xff;                    case 1: v[0] = dir->tdir_offset & 0xff;		}	}        return (1);    } else        return (TIFFFetchData(tif, dir, (char*) v) != 0);	/* XXX */}/* * Fetch an array of SHORT or SSHORT values. */static intTIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v){	if (dir->tdir_count <= 2) {		if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {			switch (dir->tdir_count) {			case 2: v[1] = (uint16) (dir->tdir_offset & 0xffff);			case 1: v[0] = (uint16) (dir->tdir_offset >> 16);			}		} else {			switch (dir->tdir_count) {			case 2: v[1] = (uint16) (dir->tdir_offset >> 16);			case 1: v[0] = (uint16) (dir->tdir_offset & 0xffff);			}		}		return (1);	} else		return (TIFFFetchData(tif, dir, (char *)v) != 0);}/* * Fetch a pair of SHORT or BYTE values. Some tags may have either BYTE * or SHORT type and this function works with both ones. */static intTIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir){	/*	 * Prevent overflowing the v stack arrays below by performing a sanity	 * check on tdir_count, this should never be greater than two.	 */	if (dir->tdir_count > 2) {		TIFFWarningExt(tif->tif_clientdata, tif->tif_name,		"unexpected count for field \"%s\", %lu, expected 2; ignored",			_TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,			dir->tdir_count);		return 0;	}	switch (dir->tdir_type) {		case TIFF_BYTE:		case TIFF_SBYTE:			{			uint8 v[4];			return TIFFFetchByteArray(tif, dir, v)				&& TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);			}		case TIFF_SHORT:		case TIFF_SSHORT:			{			uint16 v[2];			return TIFFFetchShortArray(tif, dir, v)				&& TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);			}		default:			return 0;	}}/* * Fetch an array of LONG or SLONG values. */static intTIFFFetchLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v){	if (dir->tdir_count == 1) {		v[0] = dir->tdir_offset;		return (1);	} else		return (TIFFFetchData(tif, dir, (char*) v) != 0);}/* * Fetch an array of RATIONAL or SRATIONAL values. */static intTIFFFetchRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v){	int ok = 0;	uint32* l;	l = (uint32*)_TIFFCheckMalloc(tif,	    dir->tdir_count, TIFFDataWidth((TIFFDataType) dir->tdir_type),	    "to fetch array of rationals");	if (l) {		if (TIFFFetchData(tif, dir, (char *)l)) {			uint32 i;			for (i = 0; i < dir->tdir_count; i++) {				ok = cvtRational(tif, dir,				    l[2*i+0], l[2*i+1], &v[i]);				if (!ok)					break;			}		}		_TIFFfree((char *)l);	}	return (ok);}/* * Fetch an array of FLOAT values. */static intTIFFFetchFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v){	if (dir->tdir_count == 1) {		v[0] = *(float*) &dir->tdir_offset;		TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);		return (1);	} else	if (TIFFFetchData(tif, dir, (char*) v)) {		TIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);		return (1);	} else		return (0);}/* * Fetch an array of DOUBLE values. */static intTIFFFetchDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v){	if (TIFFFetchData(tif, dir, (char*) v)) {		TIFFCvtIEEEDoubleToNative(tif, dir->tdir_count, v);		return (1);	} else		return (0);}/* * Fetch an array of ANY values.  The actual values are returned as doubles * which should be able hold all the types.  Yes, there really should be an * tany_t to avoid this potential non-portability ...  Note in particular that * we assume that the double return value vector is large enough to read in * any fundamental type.  We use that vector as a buffer to read in the base * type vector and then convert it in place to double (from end to front of * course). */static intTIFFFetchAnyArray(TIFF* tif, TIFFDirEntry* dir, double* v){	int i;	switch (dir->tdir_type) {	case TIFF_BYTE:	case TIFF_SBYTE:		if (!TIFFFetchByteArray(tif, dir, (uint8*) v))			return (0);		if (dir->tdir_type == TIFF_BYTE) {			uint8* vp = (uint8*) v;			for (i = dir->tdir_count-1; i >= 0; i--)				v[i] = vp[i];		} else {			int8* vp = (int8*) v;			for (i = dir->tdir_count-1; i >= 0; i--)				v[i] = vp[i];		}		break;	case TIFF_SHORT:	case TIFF_SSHORT:		if (!TIFFFetchShortArray(tif, dir, (uint16*) v))			return (0);		if (dir->tdir_type == TIFF_SHORT) {			uint16* vp = (uint16*) v;			for (i = dir->tdir_count-1; i >= 0; i--)				v[i] = vp[i];		} else {			int16* vp = (int16*) v;			for (i = dir->tdir_count-1; i >= 0; i--)				v[i] = vp[i];		}		break;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线视频国内自拍亚洲视频| 日韩美女天天操| 欧美嫩在线观看| xnxx国产精品| 日韩一区欧美一区| 日韩精品久久理论片| 久久99久久精品欧美| 成人av午夜影院| 日韩精品一区二| 亚洲精品国久久99热| 国产乱码精品一区二区三区av| 在线观看一区日韩| 久久久久久久久一| 国产三级三级三级精品8ⅰ区| 亚洲人成网站影音先锋播放| 国产精品一区二区三区四区| 精品少妇一区二区| 美女www一区二区| 欧美一区二区视频在线观看2020| 夜色激情一区二区| 色综合天天做天天爱| 中文字幕一区二区三| 成人午夜电影小说| 国产精品嫩草影院com| 国产成人免费视频网站| 国产视频在线观看一区二区三区 | 欧美第一区第二区| 丝袜a∨在线一区二区三区不卡| 欧洲视频一区二区| 一区2区3区在线看| 欧美在线观看视频一区二区三区| 亚洲你懂的在线视频| 91蜜桃传媒精品久久久一区二区| 中文字幕视频一区二区三区久| 国产精品一区二区在线观看不卡| 久久精品夜色噜噜亚洲a∨| 国产精品一区免费视频| 国产三级一区二区三区| 成人黄色大片在线观看| 中文字幕中文在线不卡住| 91在线视频18| 亚洲第一福利一区| 日韩欧美卡一卡二| 国产成人av一区二区三区在线观看| 久久久www免费人成精品| 久久精品国产久精国产| 国产亚洲一区字幕| 91网上在线视频| 午夜视频在线观看一区| 欧美一区二区久久久| 日本少妇一区二区| 国产日本欧美一区二区| 91捆绑美女网站| 污片在线观看一区二区| 欧美精品一区二区三区很污很色的 | 成人欧美一区二区三区黑人麻豆| av中文字幕不卡| 天天综合网 天天综合色| 久久蜜臀精品av| 91成人免费在线视频| 麻豆精品在线观看| 最新欧美精品一区二区三区| 欧美日韩不卡一区| 成人做爰69片免费看网站| 亚洲一区二区欧美日韩| 欧美xxx久久| 91久久精品午夜一区二区| 久久爱www久久做| 亚洲欧美日韩中文播放| 精品久久人人做人人爰| 91免费看片在线观看| 极品少妇一区二区| 亚洲一区二区三区不卡国产欧美| 久久久久久久精| 欧美亚洲日本一区| 成人网在线播放| 免费久久精品视频| 亚洲免费av观看| 国产无遮挡一区二区三区毛片日本| 在线观看一区不卡| 高潮精品一区videoshd| 强制捆绑调教一区二区| 亚洲一区免费视频| 国产精品入口麻豆原神| 日韩精品一区二区三区中文不卡| 91国偷自产一区二区开放时间 | 开心九九激情九九欧美日韩精美视频电影 | 国产亚洲va综合人人澡精品| 精品1区2区3区| 成人99免费视频| 国内成人免费视频| 蜜臀av国产精品久久久久| 亚洲一区二区三区四区五区中文 | 亚洲一区二区三区小说| 国产精品国产成人国产三级| 久久久午夜精品| 日韩欧美国产不卡| 欧美猛男gaygay网站| 色系网站成人免费| 99免费精品在线| 成人开心网精品视频| 国产精品一二三区| 国产一区二区三区在线观看免费 | 欧美精品一卡两卡| 欧美视频日韩视频在线观看| 99re在线精品| 91视频精品在这里| www.成人在线| 91视频在线看| 在线观看日韩国产| 在线影视一区二区三区| 91久久久免费一区二区| 欧美影院午夜播放| 欧美男人的天堂一二区| 欧美肥大bbwbbw高潮| 91精品国产综合久久福利| 69堂成人精品免费视频| 91.麻豆视频| 日韩精品在线一区二区| 精品国精品自拍自在线| 国产欧美一区二区在线观看| 国产精品美女久久久久久久久| 国产精品天干天干在线综合| 中文字幕一区在线观看| 亚洲乱码国产乱码精品精的特点| 一区二区三区欧美| 日韩高清一区在线| 韩国视频一区二区| 成人的网站免费观看| 91福利小视频| 日韩欧美久久久| 国产免费观看久久| 亚洲一区二区影院| 蜜桃视频第一区免费观看| 国产精品99久久久久| 94色蜜桃网一区二区三区| 欧美日韩和欧美的一区二区| 欧美一区二区久久| 国产精品美女一区二区| 亚洲一级二级三级在线免费观看| 麻豆91精品视频| 国产aⅴ精品一区二区三区色成熟| 91麻豆自制传媒国产之光| 56国语精品自产拍在线观看| 国产三级一区二区| 午夜精品久久久久久不卡8050| 国内国产精品久久| 在线视频中文字幕一区二区| 欧美成人精品1314www| 国产精品情趣视频| 热久久久久久久| av在线这里只有精品| 欧美精品三级在线观看| 国产精品传媒在线| 蜜臀精品久久久久久蜜臀| fc2成人免费人成在线观看播放| 欧美精品第1页| 最新国产成人在线观看| 久久精品国产一区二区三| 色婷婷av一区二区三区软件 | 在线成人高清不卡| 国产精品美女久久福利网站| 日韩在线观看一区二区| 91在线观看地址| 久久夜色精品一区| 三级亚洲高清视频| 91蜜桃免费观看视频| 国产视频一区二区三区在线观看| 午夜精品久久久久久久| 91美女片黄在线观看91美女| 久久久久97国产精华液好用吗| 日韩精品欧美精品| 欧美在线一二三| 亚洲日本中文字幕区| 国产成人h网站| 久久蜜桃一区二区| 久久99国产精品麻豆| 6080日韩午夜伦伦午夜伦| 亚洲一区二三区| 在线观看网站黄不卡| 亚洲人成网站影音先锋播放| 成人久久久精品乱码一区二区三区| 欧美xxxxxxxx| 日韩电影在线免费观看| 欧美日韩一二三区| 亚洲精品视频在线观看网站| 成人av免费在线| 国产精品日韩成人| 播五月开心婷婷综合| 国产精品久久毛片a| 成人18视频日本| 中文字幕一区二区三| 91亚洲男人天堂| 亚洲乱码中文字幕综合| 91在线观看下载| 亚洲自拍欧美精品| 欧美日韩国产一级片| 日韩高清不卡一区二区三区| 91精品婷婷国产综合久久 | 久久伊99综合婷婷久久伊|