⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pictlist.c

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 C
字号:
/* * pictlist.c * Copyright (C) 2000-2004 A.J. van Os; Released under GNU GPL * * Description: * Build, read and destroy a list of Word picture information */#include <stdlib.h>#include "antiword.h"/* * Private structure to hide the way the information * is stored from the rest of the program */typedef struct picture_mem_tag {	picture_block_type      tInfo;	struct picture_mem_tag *pNext;} picture_mem_type;/* Variables needed to write the Picture Information List */static picture_mem_type	*pAnchor = NULL;static picture_mem_type	*pPictureLast = NULL;/* * vDestroyPictInfoList - destroy the Picture Information List */voidvDestroyPictInfoList(void){	picture_mem_type	*pCurr, *pNext;	DBG_MSG("vDestroyPictInfoList");	/* Free the Picture Information List */	pCurr = pAnchor;	while (pCurr != NULL) {		pNext = pCurr->pNext;		pCurr = xfree(pCurr);		pCurr = pNext;	}	pAnchor = NULL;	/* Reset all control variables */	pPictureLast = NULL;} /* end of vDestroyPictInfoList *//* * vAdd2PictInfoList - Add an element to the Picture Information List */voidvAdd2PictInfoList(const picture_block_type *pPictureBlock){	picture_mem_type	*pListMember;	fail(pPictureBlock == NULL);	NO_DBG_MSG("bAdd2PictInfoList");	if (pPictureBlock->ulFileOffset == FC_INVALID) {		/*		 * This offset is really past the end of the file,		 * so don't waste any memory by storing it.		 */		return;	}	if (pPictureBlock->ulFileOffsetPicture == FC_INVALID) {		/*		 * The place where this picture is supposed to be stored		 * doesn't exist.		 */		return;	}	NO_DBG_HEX(pPictureBlock->ulFileOffset);	NO_DBG_HEX(pPictureBlock->ulFileOffsetPicture);	NO_DBG_HEX(pPictureBlock->ulPictureOffset);	/* Create list member */	pListMember = xmalloc(sizeof(picture_mem_type));	/* Fill the list member */	pListMember->tInfo = *pPictureBlock;	pListMember->pNext = NULL;	/* Add the new member to the list */	if (pAnchor == NULL) {		pAnchor = pListMember;	} else {		fail(pPictureLast == NULL);		pPictureLast->pNext = pListMember;	}	pPictureLast = pListMember;} /* end of vAdd2PictInfoList *//* * Get the info with the given file offset from the Picture Information List */ULONGulGetPictInfoListItem(ULONG ulFileOffset){	picture_mem_type	*pCurr;	for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {		if (pCurr->tInfo.ulFileOffset == ulFileOffset) {			return pCurr->tInfo.ulFileOffsetPicture;		}	}	return FC_INVALID;} /* end of ulGetPictInfoListItem */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -