/////////////////////////////////////////////////////////////////////////////
-// Name: imagiff.h
+// Name: src/common/imagiff.h
// Purpose: wxImage handler for Amiga IFF images
// Author: Steffen Gutmann, Thomas Meyer
// RCS-ID: $Id$
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-# pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_IMAGE && wxUSE_IFF
+
#ifndef WX_PRECOMP
-# include "wx/defs.h"
+ #include "wx/log.h"
+ #include "wx/intl.h"
#endif
-#if wxUSE_IMAGE && wxUSE_IFF
-
#include "wx/imagiff.h"
#include "wx/wfstream.h"
-#include "wx/log.h"
-#include "wx/intl.h"
#if wxUSE_PALETTE
#include "wx/palette.h"
// main decoding loop. searches IFF chunks and handles them.
// terminates when BODY chunk was found or dataptr ran over end of file
//
- bool BMHDok = false, CMAPok = false, CAMGok = false;
+ bool BMHDok = false, CAMGok = false;
int bmhd_width = 0, bmhd_height = 0, bmhd_bitplanes = 0, bmhd_transcol = -1;
- byte bmhd_masking = 0, bmhd_compression = 0;
+ byte bmhd_compression = 0;
long camg_viewmode = 0;
int colors = 0;
while (dataptr + 8 <= dataend) {
// get chunk length and make even
- size_t chunkLen = (iff_getlong(dataptr + 4) + 1) & 0xfffffffe;
-#ifdef __VMS
- // Silence compiler warning
- int chunkLen_;
- chunkLen_ = chunkLen;
- if (chunkLen_ < 0) { // format error?
-#else
- if (chunkLen < 0) { // format error?
-#endif
+ long chunkLen = (iff_getlong(dataptr + 4) + 1) & 0xfffffffe;
+ if (chunkLen < 0) { // format error?
break;
}
bool truncated = (dataptr + 8 + chunkLen > dataend);
bmhd_width = iff_getword(dataptr + 8); // width of picture
bmhd_height= iff_getword(dataptr + 8 + 2); // height of picture
bmhd_bitplanes = *(dataptr + 8 + 8); // # of bitplanes
- bmhd_masking = *(dataptr + 8 + 9);
+ // bmhd_masking = *(dataptr + 8 + 9); -- unused currently
bmhd_compression = *(dataptr + 8 + 10); // get compression
bmhd_transcol = iff_getword(dataptr + 8 + 12);
BMHDok = true; // got BMHD
wxLogTrace(_T("iff"), _T("Read %d colors from IFF file."),
colors);
- CMAPok = true; // got CMAP
dataptr += 8 + chunkLen; // to next chunk
} else if (strncmp((char *)dataptr, "CAMG", 4) == 0) { // CAMG ?
if (chunkLen < 4 || truncated) {