3 * Copyright (C) 2000,2001 A.J. van Os; Released under GPL
6 * Build, read and destroy a list of Word picture information
13 /* Variables needed to write the Picture Information List */
14 static picture_desc_type
*pAnchor
= NULL
;
15 static picture_desc_type
*pPictureLast
= NULL
;
19 * vDestroyPictInfoList - destroy the Picture Information List
22 vDestroyPictInfoList(void)
24 picture_desc_type
*pCurr
, *pNext
;
26 DBG_MSG("vDestroyPictInfoList");
28 /* Free the Picture Information List */
30 while (pCurr
!= NULL
) {
36 /* Reset all control variables */
38 } /* end of vDestroyPictInfoList */
41 * vAdd2PictInfoList - Add an element to the Picture Information List
44 vAdd2PictInfoList(const picture_block_type
*pPictureBlock
)
46 picture_desc_type
*pListMember
;
48 fail(pPictureBlock
== NULL
);
50 NO_DBG_MSG("bAdd2PictInfoList");
52 if (pPictureBlock
->ulFileOffset
== FC_INVALID
) {
54 * This offset is really past the end of the file,
55 * so don't waste any memory by storing it.
59 if (pPictureBlock
->ulFileOffsetPicture
== FC_INVALID
) {
61 * The place where this picture is supposed to be stored
67 NO_DBG_HEX(pPictureBlock
->ulFileOffset
);
68 NO_DBG_HEX(pPictureBlock
->ulFileOffsetPicture
);
69 NO_DBG_HEX(pPictureBlock
->ulPictureOffset
);
71 /* Create list member */
72 pListMember
= xmalloc(sizeof(picture_desc_type
));
73 /* Fill the list member */
74 pListMember
->tInfo
= *pPictureBlock
;
75 pListMember
->pNext
= NULL
;
76 /* Add the new member to the list */
77 if (pAnchor
== NULL
) {
78 pAnchor
= pListMember
;
80 fail(pPictureLast
== NULL
);
81 pPictureLast
->pNext
= pListMember
;
83 pPictureLast
= pListMember
;
84 } /* end of vAdd2PictInfoList */
87 * Get the info with the given file offset from the Picture Information List
90 ulGetPictInfoListItem(ULONG ulFileOffset
)
92 picture_desc_type
*pCurr
;
94 for (pCurr
= pAnchor
; pCurr
!= NULL
; pCurr
= pCurr
->pNext
) {
95 if (pCurr
->tInfo
.ulFileOffset
== ulFileOffset
) {
96 return pCurr
->tInfo
.ulFileOffsetPicture
;
100 } /* end of ulGetPictInfoListItem */