/* Initialize the data */
B->Type = bmUnknown;
B->Name = EmptyStrBuf;
- B->Tag = 0;
B->Width = Width;
B->Height = Height;
B->Pal = 0;
void FreeBitmap (Bitmap* B)
/* Free a dynamically allocated bitmap */
{
- /* Free the format specific data, the palette and then the bitmap */
- xfree (B->Tag);
+ /* Free the palette and then the bitmap */
xfree (B->Pal);
xfree(B);
}
*/
StrBuf Name;
- /* Pointer to some format specific data. May be used by the frontend.
- * The data is free'd as a block when calling FreeBitmap.
- */
- void* Tag;
-
/* Size of the bitmap */
unsigned Width;
unsigned Height;
+static void FreePCXHeader (PCXHeader* H)
+/* Free a PCX header structure */
+{
+ xfree (H);
+}
+
+
+
static PCXHeader* ReadPCXHeader (FILE* F, const char* Name)
/* Read a structured PCX header from the given file and return it */
{
/* Copy the name */
SB_CopyStr (&B->Name, Name);
- /* Remember the PCX header in the tag */
- B->Tag = P;
-
/* Allocate memory for the scan line */
L = xmalloc (P->Width);
/* Close the file */
fclose (F);
+ /* Free the PCX header */
+ FreePCXHeader (P);
+
/* Return the bitmap */
return B;
}