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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tif_dirwrite.c

?? 支持各種柵格圖像和矢量圖像讀取的庫
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* $Id: tif_dirwrite.c,v 1.37 2006/07/20 03:27:01 fwarmerdam Exp $ *//* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * 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. * * Directory Write Support Routines. */#include "tiffiop.h"#ifdef HAVE_IEEEFP# define	TIFFCvtNativeToIEEEFloat(tif, n, fp)# define	TIFFCvtNativeToIEEEDouble(tif, n, dp)#elseextern	void TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*);extern	void TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);#endifstatic	int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);static	void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);static	void TIFFSetupShort(TIFF*, ttag_t, TIFFDirEntry*, uint16);static	int TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);static	int TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);static	int TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);static	int TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**);static	int TIFFWriteShortArray(TIFF*, TIFFDirEntry*, uint16*);static	int TIFFWriteLongArray(TIFF *, TIFFDirEntry*, uint32*);static	int TIFFWriteRationalArray(TIFF *, TIFFDirEntry*, float*);static	int TIFFWriteFloatArray(TIFF *, TIFFDirEntry*, float*);static	int TIFFWriteDoubleArray(TIFF *, TIFFDirEntry*, double*);static	int TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*);static	int TIFFWriteAnyArray(TIFF*,	    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);static	int TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*);static	int TIFFWriteInkNames(TIFF*, TIFFDirEntry*);static	int TIFFWriteData(TIFF*, TIFFDirEntry*, char*);static	int TIFFLinkDirectory(TIFF*);#define	WriteRationalPair(type, tag1, v1, tag2, v2) {		\	TIFFWriteRational((tif), (type), (tag1), (dir), (v1))	\	TIFFWriteRational((tif), (type), (tag2), (dir)+1, (v2))	\	(dir)++;						\}#define	TIFFWriteRational(tif, type, tag, dir, v)		\	(dir)->tdir_tag = (tag);				\	(dir)->tdir_type = (type);				\	(dir)->tdir_count = 1;					\	if (!TIFFWriteRationalArray((tif), (dir), &(v)))	\		goto bad;/* * Write the contents of the current directory * to the specified file.  This routine doesn't * handle overwriting a directory with auxiliary * storage that's been changed. */static int_TIFFWriteDirectory(TIFF* tif, int done){	uint16 dircount;	toff_t diroff;	ttag_t tag;	uint32 nfields;	tsize_t dirsize;	char* data;	TIFFDirEntry* dir;	TIFFDirectory* td;	unsigned long b, fields[FIELD_SETLONGS];	int fi, nfi;	if (tif->tif_mode == O_RDONLY)		return (1);	/*	 * Clear write state so that subsequent images with	 * different characteristics get the right buffers	 * setup for them.	 */	if (done)	{		if (tif->tif_flags & TIFF_POSTENCODE) {			tif->tif_flags &= ~TIFF_POSTENCODE;			if (!(*tif->tif_postencode)(tif)) {				TIFFErrorExt(tif->tif_clientdata,					     tif->tif_name,				"Error post-encoding before directory write");				return (0);			}		}		(*tif->tif_close)(tif);		/* shutdown encoder */		/*		 * Flush any data that might have been written		 * by the compression close+cleanup routines.		 */		if (tif->tif_rawcc > 0                     && (tif->tif_flags & TIFF_BEENWRITING) != 0                    && !TIFFFlushData1(tif)) {			TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			    "Error flushing data before directory write");			return (0);		}		if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {			_TIFFfree(tif->tif_rawdata);			tif->tif_rawdata = NULL;			tif->tif_rawcc = 0;			tif->tif_rawdatasize = 0;		}		tif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP);	}	td = &tif->tif_dir;	/*	 * Size the directory so that we can calculate	 * offsets for the data items that aren't kept	 * in-place in each field.	 */	nfields = 0;	for (b = 0; b <= FIELD_LAST; b++)		if (TIFFFieldSet(tif, b) && b != FIELD_CUSTOM)			nfields += (b < FIELD_SUBFILETYPE ? 2 : 1);	nfields += td->td_customValueCount;	dirsize = nfields * sizeof (TIFFDirEntry);	data = (char*) _TIFFmalloc(dirsize);	if (data == NULL) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			     "Cannot write directory, out of space");		return (0);	}	/*	 * Directory hasn't been placed yet, put	 * it at the end of the file and link it	 * into the existing directory structure.	 */	if (tif->tif_diroff == 0 && !TIFFLinkDirectory(tif))		goto bad;	tif->tif_dataoff = (toff_t)(	    tif->tif_diroff + sizeof (uint16) + dirsize + sizeof (toff_t));	if (tif->tif_dataoff & 1)		tif->tif_dataoff++;	(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);	tif->tif_curdir++;	dir = (TIFFDirEntry*) data;	/*	 * Setup external form of directory	 * entries and write data items.	 */	_TIFFmemcpy(fields, td->td_fieldsset, sizeof (fields));	/*	 * Write out ExtraSamples tag only if	 * extra samples are present in the data.	 */	if (FieldSet(fields, FIELD_EXTRASAMPLES) && !td->td_extrasamples) {		ResetFieldBit(fields, FIELD_EXTRASAMPLES);		nfields--;		dirsize -= sizeof (TIFFDirEntry);	}								/*XXX*/	for (fi = 0, nfi = tif->tif_nfields; nfi > 0; nfi--, fi++) {		const TIFFFieldInfo* fip = tif->tif_fieldinfo[fi];		/*		 * For custom fields, we test to see if the custom field		 * is set or not.  For normal fields, we just use the		 * FieldSet test.		*/		if( fip->field_bit == FIELD_CUSTOM )		{			int ci, is_set = FALSE;			for( ci = 0; ci < td->td_customValueCount; ci++ )				is_set |= (td->td_customValues[ci].info == fip);			if( !is_set )				continue;		}		else if (!FieldSet(fields, fip->field_bit))			continue;		/*		 * Handle other fields.		 */		switch (fip->field_bit)		{		case FIELD_STRIPOFFSETS:			/*			 * We use one field bit for both strip and tile			 * offsets, and so must be careful in selecting			 * the appropriate field descriptor (so that tags			 * are written in sorted order).			 */			tag = isTiled(tif) ?			    TIFFTAG_TILEOFFSETS : TIFFTAG_STRIPOFFSETS;			if (tag != fip->field_tag)				continue;						dir->tdir_tag = (uint16) tag;			dir->tdir_type = (uint16) TIFF_LONG;			dir->tdir_count = (uint32) td->td_nstrips;			if (!TIFFWriteLongArray(tif, dir, td->td_stripoffset))				goto bad;			break;		case FIELD_STRIPBYTECOUNTS:			/*			 * We use one field bit for both strip and tile			 * byte counts, and so must be careful in selecting			 * the appropriate field descriptor (so that tags			 * are written in sorted order).			 */			tag = isTiled(tif) ?			    TIFFTAG_TILEBYTECOUNTS : TIFFTAG_STRIPBYTECOUNTS;			if (tag != fip->field_tag)				continue;						dir->tdir_tag = (uint16) tag;			dir->tdir_type = (uint16) TIFF_LONG;			dir->tdir_count = (uint32) td->td_nstrips;			if (!TIFFWriteLongArray(tif, dir, td->td_stripbytecount))				goto bad;			break;		case FIELD_ROWSPERSTRIP:			TIFFSetupShortLong(tif, TIFFTAG_ROWSPERSTRIP,			    dir, td->td_rowsperstrip);			break;		case FIELD_COLORMAP:			if (!TIFFWriteShortTable(tif, TIFFTAG_COLORMAP, dir,			    3, td->td_colormap))				goto bad;			break;		case FIELD_IMAGEDIMENSIONS:			TIFFSetupShortLong(tif, TIFFTAG_IMAGEWIDTH,			    dir++, td->td_imagewidth);			TIFFSetupShortLong(tif, TIFFTAG_IMAGELENGTH,			    dir, td->td_imagelength);			break;		case FIELD_TILEDIMENSIONS:			TIFFSetupShortLong(tif, TIFFTAG_TILEWIDTH,			    dir++, td->td_tilewidth);			TIFFSetupShortLong(tif, TIFFTAG_TILELENGTH,			    dir, td->td_tilelength);			break;		case FIELD_COMPRESSION:			TIFFSetupShort(tif, TIFFTAG_COMPRESSION,			    dir, td->td_compression);			break;		case FIELD_PHOTOMETRIC:			TIFFSetupShort(tif, TIFFTAG_PHOTOMETRIC,			    dir, td->td_photometric);			break;		case FIELD_POSITION:			WriteRationalPair(TIFF_RATIONAL,			    TIFFTAG_XPOSITION, td->td_xposition,			    TIFFTAG_YPOSITION, td->td_yposition);			break;		case FIELD_RESOLUTION:			WriteRationalPair(TIFF_RATIONAL,			    TIFFTAG_XRESOLUTION, td->td_xresolution,			    TIFFTAG_YRESOLUTION, td->td_yresolution);			break;		case FIELD_BITSPERSAMPLE:		case FIELD_MINSAMPLEVALUE:		case FIELD_MAXSAMPLEVALUE:		case FIELD_SAMPLEFORMAT:			if (!TIFFWritePerSampleShorts(tif, fip->field_tag, dir))				goto bad;			break;		case FIELD_SMINSAMPLEVALUE:		case FIELD_SMAXSAMPLEVALUE:			if (!TIFFWritePerSampleAnys(tif,			    _TIFFSampleToTagType(tif), fip->field_tag, dir))				goto bad;			break;		case FIELD_PAGENUMBER:		case FIELD_HALFTONEHINTS:		case FIELD_YCBCRSUBSAMPLING:			if (!TIFFSetupShortPair(tif, fip->field_tag, dir))				goto bad;			break;		case FIELD_INKNAMES:			if (!TIFFWriteInkNames(tif, dir))				goto bad;			break;		case FIELD_TRANSFERFUNCTION:			if (!TIFFWriteTransferFunction(tif, dir))				goto bad;			break;		case FIELD_SUBIFD:			/*			 * XXX: Always write this field using LONG type			 * for backward compatibility.			 */			dir->tdir_tag = (uint16) fip->field_tag;			dir->tdir_type = (uint16) TIFF_LONG;			dir->tdir_count = (uint32) td->td_nsubifd;			if (!TIFFWriteLongArray(tif, dir, td->td_subifd))				goto bad;			/*			 * Total hack: if this directory includes a SubIFD			 * tag then force the next <n> directories to be			 * written as ``sub directories'' of this one.  This			 * is used to write things like thumbnails and			 * image masks that one wants to keep out of the			 * normal directory linkage access mechanism.			 */			if (dir->tdir_count > 0) {				tif->tif_flags |= TIFF_INSUBIFD;				tif->tif_nsubifd = (uint16) dir->tdir_count;				if (dir->tdir_count > 1)					tif->tif_subifdoff = dir->tdir_offset;				else					tif->tif_subifdoff = (uint32)(					      tif->tif_diroff					    + sizeof (uint16)					    + ((char*)&dir->tdir_offset-data));			}			break;		default:			/* XXX: Should be fixed and removed. */			if (fip->field_tag == TIFFTAG_DOTRANGE) {				if (!TIFFSetupShortPair(tif, fip->field_tag, dir))					goto bad;			}			else if (!TIFFWriteNormalTag(tif, dir, fip))				goto bad;			break;		}		dir++;                		if( fip->field_bit != FIELD_CUSTOM )			ResetFieldBit(fields, fip->field_bit);	}	/*	 * Write directory.	 */	dircount = (uint16) nfields;	diroff = (uint32) tif->tif_nextdiroff;	if (tif->tif_flags & TIFF_SWAB) {		/*		 * The file's byte order is opposite to the		 * native machine architecture.  We overwrite		 * the directory information with impunity		 * because it'll be released below after we		 * write it to the file.  Note that all the		 * other tag construction routines assume that		 * we do this byte-swapping; i.e. they only		 * byte-swap indirect data.		 */		for (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) {			TIFFSwabArrayOfShort(&dir->tdir_tag, 2);			TIFFSwabArrayOfLong(&dir->tdir_count, 2);		}		dircount = (uint16) nfields;		TIFFSwabShort(&dircount);		TIFFSwabLong(&diroff);	}	(void) TIFFSeekFile(tif, tif->tif_diroff, SEEK_SET);	if (!WriteOK(tif, &dircount, sizeof (dircount))) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			     "Error writing directory count");		goto bad;	}	if (!WriteOK(tif, data, dirsize)) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			     "Error writing directory contents");		goto bad;	}	if (!WriteOK(tif, &diroff, sizeof (uint32))) {		TIFFErrorExt(tif->tif_clientdata, tif->tif_name,			     "Error writing directory link");		goto bad;	}	if (done) {		TIFFFreeDirectory(tif);		tif->tif_flags &= ~TIFF_DIRTYDIRECT;		(*tif->tif_cleanup)(tif);		/*		* Reset directory-related state for subsequent		* directories.		*/		TIFFCreateDirectory(tif);	}	_TIFFfree(data);	return (1);bad:	_TIFFfree(data);	return (0);}#undef WriteRationalPairintTIFFWriteDirectory(TIFF* tif){	return _TIFFWriteDirectory(tif, TRUE);}/* * Similar to TIFFWriteDirectory(), writes the directory out * but leaves all data structures in memory so that it can be * written again.  This will make a partially written TIFF file * readable before it is successfully completed/closed. */ intTIFFCheckpointDirectory(TIFF* tif){	int rc;	/* Setup the strips arrays, if they haven't already been. */	if (tif->tif_dir.td_stripoffset == NULL)	    (void) TIFFSetupStrips(tif);	rc = _TIFFWriteDirectory(tif, FALSE);	(void) TIFFSetWriteOffset(tif, TIFFSeekFile(tif, 0, SEEK_END));	return rc;}static int_TIFFWriteCustomDirectory(TIFF* tif, toff_t *pdiroff){	uint16 dircount;	uint32 nfields;	tsize_t dirsize;	char* data;	TIFFDirEntry* dir;	TIFFDirectory* td;	unsigned long b, fields[FIELD_SETLONGS];	int fi, nfi;	if (tif->tif_mode == O_RDONLY)		return (1);	td = &tif->tif_dir;	/*	 * Size the directory so that we can calculate	 * offsets for the data items that aren't kept	 * in-place in each field.	 */	nfields = 0;	for (b = 0; b <= FIELD_LAST; b++)		if (TIFFFieldSet(tif, b) && b != FIELD_CUSTOM)			nfields += (b < FIELD_SUBFILETYPE ? 2 : 1);	nfields += td->td_customValueCount;	dirsize = nfields * sizeof (TIFFDirEntry);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美亚洲综合色| 色综合久久九月婷婷色综合| 亚洲欧美日韩国产中文在线| 欧美日韩高清影院| 成人午夜av电影| 日本不卡视频在线观看| 亚洲欧洲性图库| www久久久久| 在线看国产一区| 风间由美性色一区二区三区| 天堂在线一区二区| 国产精品麻豆网站| 2021中文字幕一区亚洲| 欧美另类久久久品| 91啪亚洲精品| 成人免费视频一区二区| 卡一卡二国产精品| 丝袜诱惑亚洲看片| 一区二区三区高清不卡| 中文字幕一区二区三区不卡| youjizz国产精品| 久久99国产精品免费网站| 午夜日韩在线电影| 亚洲国产综合色| 亚洲三级在线看| 国产精品伦理在线| 久久久www成人免费无遮挡大片| 欧美另类变人与禽xxxxx| 91麻豆国产自产在线观看| 国产精品一区二区久久不卡| 亚洲成人动漫一区| 中文字幕视频一区| 久久久一区二区三区| 欧美性猛交xxxxxxxx| av午夜精品一区二区三区| 激情深爱一区二区| 亚洲成人福利片| 亚洲人成7777| 国产精品电影一区二区三区| 国产精品久久久久桃色tv| 久久精子c满五个校花| 欧美一区二区三区视频免费| 欧美羞羞免费网站| 色伊人久久综合中文字幕| 国产91露脸合集magnet| 国产白丝精品91爽爽久久 | 亚洲欧美日韩久久精品| 国产亚洲成年网址在线观看| 欧美成人a在线| 欧美一区二区视频网站| 欧美人与禽zozo性伦| 欧美视频在线一区二区三区| 色天天综合久久久久综合片| 99精品久久99久久久久| 成人av在线资源网| 国产成人午夜高潮毛片| 婷婷亚洲久悠悠色悠在线播放| 亚洲欧美另类图片小说| 中文字幕av一区二区三区高| 91丨porny丨户外露出| 成人黄色综合网站| av资源网一区| 色婷婷综合久色| 91福利视频久久久久| 91麻豆免费观看| 91久久精品一区二区二区| 成人一区二区三区视频在线观看| 国产成人夜色高潮福利影视| 国产精品中文字幕一区二区三区| 激情五月激情综合网| 国产高清久久久| 成人福利视频网站| 色偷偷一区二区三区| 欧美写真视频网站| 6080日韩午夜伦伦午夜伦| 日韩欧美在线1卡| 久久女同精品一区二区| 国产精品无码永久免费888| 国产精品第13页| 中文字幕高清不卡| 一区二区三区在线播放| 日本网站在线观看一区二区三区 | 国产欧美一区二区精品秋霞影院| 国产欧美日本一区视频| 自拍av一区二区三区| 午夜精品在线视频一区| 六月丁香婷婷色狠狠久久| 久久99精品久久久久久久久久久久| 免费看日韩a级影片| 蜜桃久久久久久| thepron国产精品| 欧美日韩激情在线| 久久综合五月天婷婷伊人| 综合激情成人伊人| 亚洲h动漫在线| 国产一区二区三区| 色婷婷国产精品| 日韩一级免费观看| 亚洲色图在线播放| 免费成人在线影院| 波多野结衣精品在线| 欧美日韩成人综合天天影院| 2019国产精品| 中文字幕永久在线不卡| 午夜日韩在线观看| 国产精品1区2区3区在线观看| 一本到不卡免费一区二区| 91精品国产综合久久久久久| 日本一区二区成人| 性感美女极品91精品| 成人永久看片免费视频天堂| 欧美日韩在线精品一区二区三区激情| 欧美v国产在线一区二区三区| 国产精品久久久久影院色老大| 视频一区二区不卡| 成人网在线免费视频| 制服视频三区第一页精品| 2023国产精品| 亚洲精品日产精品乱码不卡| 久久不见久久见中文字幕免费| 99在线精品免费| 日韩一区国产二区欧美三区| 一区二区三区免费观看| 偷拍与自拍一区| 国产一区二区免费视频| 4hu四虎永久在线影院成人| 亚洲私人黄色宅男| 国产剧情一区二区三区| 69堂成人精品免费视频| 一区二区三区在线观看国产| 国产精品538一区二区在线| 欧美一区二区三区视频在线| 一区二区三区色| 国产高清久久久久| 欧美一卡二卡在线| 亚洲国产视频网站| 99久久精品国产导航| 久久精品夜色噜噜亚洲aⅴ| 男男成人高潮片免费网站| 欧美日韩色一区| 亚洲另类色综合网站| 成人爱爱电影网址| 欧美韩日一区二区三区| 美腿丝袜在线亚洲一区| 91最新地址在线播放| 日韩一区二区免费在线观看| 日韩电影在线免费观看| 欧美视频中文字幕| 亚洲免费av高清| 91蜜桃视频在线| 国产精品动漫网站| av不卡在线播放| 国产精品初高中害羞小美女文| 国产成人亚洲精品狼色在线| 久久日一线二线三线suv| 久久99精品一区二区三区| 7777女厕盗摄久久久| 日韩精品乱码免费| 3d成人动漫网站| 捆绑紧缚一区二区三区视频 | 国内国产精品久久| 精品乱码亚洲一区二区不卡| 免费人成在线不卡| 亚洲精品在线观看网站| 国产一区二区三区黄视频| 久久久蜜臀国产一区二区| 国产曰批免费观看久久久| 久久一区二区三区四区| 国产一区二区三区久久久 | 日本网站在线观看一区二区三区| av成人动漫在线观看| 中文字幕成人av| 色吧成人激情小说| 亚洲成av人片在线| 91精品国产乱| 国产伦精品一区二区三区视频青涩| 欧美精品一区二| proumb性欧美在线观看| 亚洲综合视频在线观看| 91精品国产全国免费观看| 国内外成人在线视频| 中文字幕欧美区| 97久久人人超碰| 亚洲精品视频在线观看网站| 欧美精品粉嫩高潮一区二区| 九色|91porny| 国产精品婷婷午夜在线观看| 日本大香伊一区二区三区| 日韩av中文字幕一区二区三区| 欧美精品一区二区三区很污很色的| 北岛玲一区二区三区四区 | 久久精品国产一区二区| 国产无遮挡一区二区三区毛片日本| 国产麻豆精品久久一二三| 久久亚洲综合色| 99久久免费视频.com| 日日骚欧美日韩| 国产精品视频免费| 在线成人午夜影院| 成人ar影院免费观看视频|