00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <stdlib.h>
00010 #include "antiword.h"
00011
00012
00013
00014
00015
00016
00017 typedef struct picture_mem_tag {
00018 picture_block_type tInfo;
00019 struct picture_mem_tag *pNext;
00020 } picture_mem_type;
00021
00022
00023 static picture_mem_type *pAnchor = NULL;
00024 static picture_mem_type *pPictureLast = NULL;
00025
00026
00027
00028
00029
00030 void
00031 vDestroyPictInfoList(void)
00032 {
00033 picture_mem_type *pCurr, *pNext;
00034
00035 DBG_MSG("vDestroyPictInfoList");
00036
00037
00038 pCurr = pAnchor;
00039 while (pCurr != NULL) {
00040 pNext = pCurr->pNext;
00041 pCurr = xfree(pCurr);
00042 pCurr = pNext;
00043 }
00044 pAnchor = NULL;
00045
00046 pPictureLast = NULL;
00047 }
00048
00049
00050
00051
00052 void
00053 vAdd2PictInfoList(const picture_block_type *pPictureBlock)
00054 {
00055 picture_mem_type *pListMember;
00056
00057 fail(pPictureBlock == NULL);
00058
00059 NO_DBG_MSG("bAdd2PictInfoList");
00060
00061 if (pPictureBlock->ulFileOffset == FC_INVALID) {
00062
00063
00064
00065
00066 return;
00067 }
00068 if (pPictureBlock->ulFileOffsetPicture == FC_INVALID) {
00069
00070
00071
00072
00073 return;
00074 }
00075
00076 NO_DBG_HEX(pPictureBlock->ulFileOffset);
00077 NO_DBG_HEX(pPictureBlock->ulFileOffsetPicture);
00078 NO_DBG_HEX(pPictureBlock->ulPictureOffset);
00079
00080
00081 pListMember = xmalloc(sizeof(picture_mem_type));
00082
00083 pListMember->tInfo = *pPictureBlock;
00084 pListMember->pNext = NULL;
00085
00086 if (pAnchor == NULL) {
00087 pAnchor = pListMember;
00088 } else {
00089 fail(pPictureLast == NULL);
00090 pPictureLast->pNext = pListMember;
00091 }
00092 pPictureLast = pListMember;
00093 }
00094
00095
00096
00097
00098 ULONG
00099 ulGetPictInfoListItem(ULONG ulFileOffset)
00100 {
00101 picture_mem_type *pCurr;
00102
00103 for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
00104 if (pCurr->tInfo.ulFileOffset == ulFileOffset) {
00105 return pCurr->tInfo.ulFileOffsetPicture;
00106 }
00107 }
00108 return FC_INVALID;
00109 }