summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util')
-rw-r--r--src/lib/util/astring.h8
-rw-r--r--src/lib/util/avhuff.h64
-rw-r--r--src/lib/util/aviio.c318
-rw-r--r--src/lib/util/aviio.h40
-rw-r--r--src/lib/util/bitmap.c44
-rw-r--r--src/lib/util/bitmap.h46
-rw-r--r--src/lib/util/bitstream.h36
-rw-r--r--src/lib/util/cdrom.c208
-rw-r--r--src/lib/util/cdrom.h80
-rw-r--r--src/lib/util/chd.c174
-rw-r--r--src/lib/util/chd.h132
-rw-r--r--src/lib/util/chdcd.c52
-rw-r--r--src/lib/util/chdcd.h8
-rw-r--r--src/lib/util/chdcodec.c118
-rw-r--r--src/lib/util/chdcodec.h46
-rw-r--r--src/lib/util/corefile.c60
-rw-r--r--src/lib/util/corefile.h12
-rw-r--r--src/lib/util/coretmpl.h10
-rw-r--r--src/lib/util/flac.c52
-rw-r--r--src/lib/util/flac.h52
-rw-r--r--src/lib/util/harddisk.c4
-rw-r--r--src/lib/util/harddisk.h10
-rw-r--r--src/lib/util/hashing.c66
-rw-r--r--src/lib/util/hashing.h8
-rw-r--r--src/lib/util/huffman.c18
-rw-r--r--src/lib/util/huffman.h32
-rw-r--r--src/lib/util/jedparse.c7
-rw-r--r--src/lib/util/jedparse.h16
-rw-r--r--src/lib/util/md5.c15
-rw-r--r--src/lib/util/md5.h1
-rw-r--r--src/lib/util/opresolv.c27
-rw-r--r--src/lib/util/opresolv.h33
-rw-r--r--src/lib/util/options.c20
-rw-r--r--src/lib/util/options.h66
-rw-r--r--src/lib/util/palette.c42
-rw-r--r--src/lib/util/palette.h18
-rw-r--r--src/lib/util/plaparse.c8
-rw-r--r--src/lib/util/plaparse.h2
-rw-r--r--src/lib/util/png.c28
-rw-r--r--src/lib/util/png.h98
-rw-r--r--src/lib/util/pool.c46
-rw-r--r--src/lib/util/pool.h12
-rw-r--r--src/lib/util/sha1.c400
-rw-r--r--src/lib/util/sha1.h16
-rw-r--r--src/lib/util/tagmap.h16
-rw-r--r--src/lib/util/un7z.c20
-rw-r--r--src/lib/util/un7z.h14
-rw-r--r--src/lib/util/unicode.h54
-rw-r--r--src/lib/util/unzip.c168
-rw-r--r--src/lib/util/unzip.h88
-rw-r--r--src/lib/util/vbiparse.c27
-rw-r--r--src/lib/util/vbiparse.h52
-rw-r--r--src/lib/util/xmlfile.c10
-rw-r--r--src/lib/util/xmlfile.h34
-rw-r--r--src/lib/util/zippath.c14
55 files changed, 1520 insertions, 1530 deletions
diff --git a/src/lib/util/astring.h b/src/lib/util/astring.h
index 763537241a1..7931075d1ea 100644
--- a/src/lib/util/astring.h
+++ b/src/lib/util/astring.h
@@ -180,10 +180,10 @@ private:
void normalize_substr(int &start, int &count, int length) const;
// internal state
- char * m_text;
- int m_alloclen;
- char m_smallbuf[64];
- int m_len;
+ char * m_text;
+ int m_alloclen;
+ char m_smallbuf[64];
+ int m_len;
};
diff --git a/src/lib/util/avhuff.h b/src/lib/util/avhuff.h
index d2662a89098..e1236a0708a 100644
--- a/src/lib/util/avhuff.h
+++ b/src/lib/util/avhuff.h
@@ -53,7 +53,7 @@
// CONSTANTS
//**************************************************************************
-#define AVHUFF_USE_FLAC (1)
+#define AVHUFF_USE_FLAC (1)
// errors
@@ -86,21 +86,21 @@ class avhuff_decompress_config
public:
avhuff_decompress_config()
: maxsamples(0),
- actsamples(NULL),
- maxmetalength(0),
- actmetalength(NULL),
- metadata(NULL)
+ actsamples(NULL),
+ maxmetalength(0),
+ actmetalength(NULL),
+ metadata(NULL)
{
memset(audio, 0, sizeof(audio));
}
- bitmap_yuy16 video; // pointer to video bitmap
- UINT32 maxsamples; // maximum number of samples per channel
- UINT32 * actsamples; // actual number of samples per channel
- INT16 * audio[16]; // pointer to individual audio channels
- UINT32 maxmetalength; // maximum length of metadata
- UINT32 * actmetalength; // actual length of metadata
- UINT8 * metadata; // pointer to metadata buffer
+ bitmap_yuy16 video; // pointer to video bitmap
+ UINT32 maxsamples; // maximum number of samples per channel
+ UINT32 * actsamples; // actual number of samples per channel
+ INT16 * audio[16]; // pointer to individual audio channels
+ UINT32 maxmetalength; // maximum length of metadata
+ UINT32 * actmetalength; // actual length of metadata
+ UINT8 * metadata; // pointer to metadata buffer
};
@@ -140,9 +140,9 @@ private:
private:
// internal state
- int m_rlecount;
- huffman_encoder<256 + 16> m_encoder;
- dynamic_array<UINT16> m_rlebuffer;
+ int m_rlecount;
+ huffman_encoder<256 + 16> m_encoder;
+ dynamic_array<UINT16> m_rlebuffer;
};
// internal helpers
@@ -151,17 +151,17 @@ private:
avhuff_error encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength);
// video encoding contexts
- deltarle_encoder m_ycontext;
- deltarle_encoder m_cbcontext;
- deltarle_encoder m_crcontext;
+ deltarle_encoder m_ycontext;
+ deltarle_encoder m_cbcontext;
+ deltarle_encoder m_crcontext;
// audio encoding contexts
- dynamic_buffer m_audiobuffer;
+ dynamic_buffer m_audiobuffer;
#if AVHUFF_USE_FLAC
- flac_encoder m_flac_encoder;
+ flac_encoder m_flac_encoder;
#else
- huffman_8bit_encoder m_audiohi_encoder;
- huffman_8bit_encoder m_audiolo_encoder;
+ huffman_8bit_encoder m_audiohi_encoder;
+ huffman_8bit_encoder m_audiolo_encoder;
#endif
};
@@ -200,9 +200,9 @@ private:
private:
// internal state
- int m_rlecount;
- UINT8 m_prevdata;
- huffman_decoder<256 + 16> m_decoder;
+ int m_rlecount;
+ UINT8 m_prevdata;
+ huffman_decoder<256 + 16> m_decoder;
};
@@ -212,18 +212,18 @@ private:
avhuff_error decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor);
// internal state
- avhuff_decompress_config m_config;
+ avhuff_decompress_config m_config;
// video decoding contexts
- deltarle_decoder m_ycontext;
- deltarle_decoder m_cbcontext;
- deltarle_decoder m_crcontext;
+ deltarle_decoder m_ycontext;
+ deltarle_decoder m_cbcontext;
+ deltarle_decoder m_crcontext;
// audio decoding contexts
- huffman_8bit_decoder m_audiohi_decoder;
- huffman_8bit_decoder m_audiolo_decoder;
+ huffman_8bit_decoder m_audiohi_decoder;
+ huffman_8bit_decoder m_audiolo_decoder;
#if AVHUFF_USE_FLAC
- flac_decoder m_flac_decoder;
+ flac_decoder m_flac_decoder;
#endif
};
diff --git a/src/lib/util/aviio.c b/src/lib/util/aviio.c
index aec1a68b81a..16ec39e0cbb 100644
--- a/src/lib/util/aviio.c
+++ b/src/lib/util/aviio.c
@@ -46,60 +46,60 @@
CONSTANTS
***************************************************************************/
-#define FILETYPE_READ 1
-#define FILETYPE_CREATE 2
-
-#define MAX_RIFF_SIZE (2UL * 1024 * 1024 * 1024 - 1024) /* just under 2GB */
-#define MAX_AVI_SIZE_IN_GB (256)
-#define FOUR_GB ((UINT64)1 << 32)
-
-#define MAX_SOUND_CHANNELS 2
-#define SOUND_BUFFER_MSEC 2000 /* microseconds of sond buffering */
-
-#define CHUNKTYPE_RIFF AVI_FOURCC('R','I','F','F')
-#define CHUNKTYPE_LIST AVI_FOURCC('L','I','S','T')
-#define CHUNKTYPE_JUNK AVI_FOURCC('J','U','N','K')
-#define CHUNKTYPE_AVIH AVI_FOURCC('a','v','i','h')
-#define CHUNKTYPE_STRH AVI_FOURCC('s','t','r','h')
-#define CHUNKTYPE_STRF AVI_FOURCC('s','t','r','f')
-#define CHUNKTYPE_IDX1 AVI_FOURCC('i','d','x','1')
-#define CHUNKTYPE_INDX AVI_FOURCC('i','n','d','x')
-#define CHUNKTYPE_XXDB AVI_FOURCC(0x00,0x00,'d','b')
-#define CHUNKTYPE_XXDC AVI_FOURCC(0x00,0x00,'d','c')
-#define CHUNKTYPE_XXWB AVI_FOURCC(0x00,0x00,'w','b')
-#define CHUNKTYPE_IXXX AVI_FOURCC('i','x',0x00,0x00)
-#define CHUNKTYPE_XX_MASK AVI_FOURCC(0x00,0x00,0xff,0xff)
-
-#define LISTTYPE_AVI AVI_FOURCC('A','V','I',' ')
-#define LISTTYPE_AVIX AVI_FOURCC('A','V','I','X')
-#define LISTTYPE_HDRL AVI_FOURCC('h','d','r','l')
-#define LISTTYPE_STRL AVI_FOURCC('s','t','r','l')
-#define LISTTYPE_MOVI AVI_FOURCC('m','o','v','i')
-
-#define STREAMTYPE_VIDS AVI_FOURCC('v','i','d','s')
-#define STREAMTYPE_AUDS AVI_FOURCC('a','u','d','s')
-
-#define HANDLER_DIB AVI_FOURCC('D','I','B',' ')
-#define HANDLER_HFYU AVI_FOURCC('h','f','y','u')
+#define FILETYPE_READ 1
+#define FILETYPE_CREATE 2
+
+#define MAX_RIFF_SIZE (2UL * 1024 * 1024 * 1024 - 1024) /* just under 2GB */
+#define MAX_AVI_SIZE_IN_GB (256)
+#define FOUR_GB ((UINT64)1 << 32)
+
+#define MAX_SOUND_CHANNELS 2
+#define SOUND_BUFFER_MSEC 2000 /* microseconds of sond buffering */
+
+#define CHUNKTYPE_RIFF AVI_FOURCC('R','I','F','F')
+#define CHUNKTYPE_LIST AVI_FOURCC('L','I','S','T')
+#define CHUNKTYPE_JUNK AVI_FOURCC('J','U','N','K')
+#define CHUNKTYPE_AVIH AVI_FOURCC('a','v','i','h')
+#define CHUNKTYPE_STRH AVI_FOURCC('s','t','r','h')
+#define CHUNKTYPE_STRF AVI_FOURCC('s','t','r','f')
+#define CHUNKTYPE_IDX1 AVI_FOURCC('i','d','x','1')
+#define CHUNKTYPE_INDX AVI_FOURCC('i','n','d','x')
+#define CHUNKTYPE_XXDB AVI_FOURCC(0x00,0x00,'d','b')
+#define CHUNKTYPE_XXDC AVI_FOURCC(0x00,0x00,'d','c')
+#define CHUNKTYPE_XXWB AVI_FOURCC(0x00,0x00,'w','b')
+#define CHUNKTYPE_IXXX AVI_FOURCC('i','x',0x00,0x00)
+#define CHUNKTYPE_XX_MASK AVI_FOURCC(0x00,0x00,0xff,0xff)
+
+#define LISTTYPE_AVI AVI_FOURCC('A','V','I',' ')
+#define LISTTYPE_AVIX AVI_FOURCC('A','V','I','X')
+#define LISTTYPE_HDRL AVI_FOURCC('h','d','r','l')
+#define LISTTYPE_STRL AVI_FOURCC('s','t','r','l')
+#define LISTTYPE_MOVI AVI_FOURCC('m','o','v','i')
+
+#define STREAMTYPE_VIDS AVI_FOURCC('v','i','d','s')
+#define STREAMTYPE_AUDS AVI_FOURCC('a','u','d','s')
+
+#define HANDLER_DIB AVI_FOURCC('D','I','B',' ')
+#define HANDLER_HFYU AVI_FOURCC('h','f','y','u')
/* main AVI header files */
-#define AVIF_HASINDEX 0x00000010
-#define AVIF_MUSTUSEINDEX 0x00000020
-#define AVIF_ISINTERLEAVED 0x00000100
-#define AVIF_COPYRIGHTED 0x00010000
-#define AVIF_WASCAPTUREFILE 0x00020000
+#define AVIF_HASINDEX 0x00000010
+#define AVIF_MUSTUSEINDEX 0x00000020
+#define AVIF_ISINTERLEAVED 0x00000100
+#define AVIF_COPYRIGHTED 0x00010000
+#define AVIF_WASCAPTUREFILE 0x00020000
/* index definitions */
-#define AVI_INDEX_OF_INDEXES 0x00
-#define AVI_INDEX_OF_CHUNKS 0x01
-#define AVI_INDEX_IS_DATA 0x80
-#define AVI_INDEX_2FIELD 0x01
+#define AVI_INDEX_OF_INDEXES 0x00
+#define AVI_INDEX_OF_CHUNKS 0x01
+#define AVI_INDEX_IS_DATA 0x80
+#define AVI_INDEX_2FIELD 0x01
/* HuffYUV definitions */
-#define HUFFYUV_PREDICT_LEFT 0
+#define HUFFYUV_PREDICT_LEFT 0
#define HUFFYUV_PREDICT_GRADIENT 1
-#define HUFFYUV_PREDICT_MEDIAN 2
-#define HUFFYUV_PREDICT_DECORR 0x40
+#define HUFFYUV_PREDICT_MEDIAN 2
+#define HUFFYUV_PREDICT_DECORR 0x40
@@ -109,95 +109,95 @@
struct avi_chunk
{
- UINT64 offset; /* file offset of chunk header */
- UINT64 size; /* size of this chunk */
- UINT32 type; /* type of this chunk */
- UINT32 listtype; /* type of this list (if we are a list) */
+ UINT64 offset; /* file offset of chunk header */
+ UINT64 size; /* size of this chunk */
+ UINT32 type; /* type of this chunk */
+ UINT32 listtype; /* type of this list (if we are a list) */
};
struct avi_chunk_list
{
- UINT64 offset; /* offset in the file of header */
- UINT32 length; /* length of the chunk including header */
+ UINT64 offset; /* offset in the file of header */
+ UINT32 length; /* length of the chunk including header */
};
struct huffyuv_table
{
- UINT8 shift[256]; /* bit shift amounts */
- UINT32 bits[256]; /* bit match values */
- UINT32 mask[256]; /* bit mask values */
- UINT16 baselookup[65536]; /* base lookup table */
- UINT16 * extralookup; /* extra lookup tables */
+ UINT8 shift[256]; /* bit shift amounts */
+ UINT32 bits[256]; /* bit match values */
+ UINT32 mask[256]; /* bit mask values */
+ UINT16 baselookup[65536]; /* base lookup table */
+ UINT16 * extralookup; /* extra lookup tables */
};
struct huffyuv_data
{
- UINT8 predictor; /* predictor */
- huffyuv_table table[3]; /* array of tables */
+ UINT8 predictor; /* predictor */
+ huffyuv_table table[3]; /* array of tables */
};
struct avi_stream
{
- UINT32 type; /* subtype of stream */
- UINT32 format; /* format of stream data */
+ UINT32 type; /* subtype of stream */
+ UINT32 format; /* format of stream data */
- UINT32 rate; /* timescale for stream */
- UINT32 scale; /* duration of one sample in the stream */
- UINT32 samples; /* number of samples */
+ UINT32 rate; /* timescale for stream */
+ UINT32 scale; /* duration of one sample in the stream */
+ UINT32 samples; /* number of samples */
- avi_chunk_list * chunk; /* list of chunks */
- UINT32 chunks; /* chunks currently known */
- UINT32 chunksalloc; /* number of chunks allocated */
+ avi_chunk_list * chunk; /* list of chunks */
+ UINT32 chunks; /* chunks currently known */
+ UINT32 chunksalloc; /* number of chunks allocated */
- UINT32 width; /* width of video */
- UINT32 height; /* height of video */
- UINT32 depth; /* depth of video */
- UINT8 interlace; /* interlace parameters */
- huffyuv_data * huffyuv; /* huffyuv decompression data */
+ UINT32 width; /* width of video */
+ UINT32 height; /* height of video */
+ UINT32 depth; /* depth of video */
+ UINT8 interlace; /* interlace parameters */
+ huffyuv_data * huffyuv; /* huffyuv decompression data */
- UINT16 channels; /* audio channels */
- UINT16 samplebits; /* audio bits per sample */
- UINT32 samplerate; /* audio sample rate */
+ UINT16 channels; /* audio channels */
+ UINT16 samplebits; /* audio bits per sample */
+ UINT32 samplerate; /* audio sample rate */
/* only used when creating */
- UINT64 saved_strh_offset; /* writeoffset of strh chunk */
- UINT64 saved_indx_offset; /* writeoffset of indx chunk */
+ UINT64 saved_strh_offset; /* writeoffset of strh chunk */
+ UINT64 saved_indx_offset; /* writeoffset of indx chunk */
};
struct avi_file
{
/* shared data */
- osd_file * file; /* pointer to open file */
- int type; /* type of access (read/create) */
- avi_movie_info info; /* movie info structure */
- UINT8 * tempbuffer; /* temporary buffer */
- UINT32 tempbuffersize; /* size of the temporary buffer */
+ osd_file * file; /* pointer to open file */
+ int type; /* type of access (read/create) */
+ avi_movie_info info; /* movie info structure */
+ UINT8 * tempbuffer; /* temporary buffer */
+ UINT32 tempbuffersize; /* size of the temporary buffer */
/* only used when reading */
- int streams; /* number of streams */
- avi_stream * stream; /* allocated array of stream information */
- avi_chunk rootchunk; /* dummy root chunk that wraps the whole file */
+ int streams; /* number of streams */
+ avi_stream * stream; /* allocated array of stream information */
+ avi_chunk rootchunk; /* dummy root chunk that wraps the whole file */
/* only used when creating */
- UINT64 writeoffs; /* current file write offset */
- UINT64 riffbase; /* base of the current RIFF */
+ UINT64 writeoffs; /* current file write offset */
+ UINT64 riffbase; /* base of the current RIFF */
- avi_chunk chunkstack[8]; /* stack of chunks we are writing */
- int chunksp; /* stack pointer for the current chunk */
+ avi_chunk chunkstack[8]; /* stack of chunks we are writing */
+ int chunksp; /* stack pointer for the current chunk */
- UINT64 saved_movi_offset; /* writeoffset of movi list */
- UINT64 saved_avih_offset; /* writeoffset of avih chunk */
+ UINT64 saved_movi_offset; /* writeoffset of movi list */
+ UINT64 saved_avih_offset; /* writeoffset of avih chunk */
- INT16 * soundbuf; /* buffer for sound data */
- UINT32 soundbuf_samples; /* length of sound buffer in samples */
- UINT32 soundbuf_chansamples[MAX_SOUND_CHANNELS]; /* samples in buffer for each channel */
- UINT32 soundbuf_chunks; /* number of chunks completed so far */
- UINT32 soundbuf_frames; /* number of frames ahead of the video */
+ INT16 * soundbuf; /* buffer for sound data */
+ UINT32 soundbuf_samples; /* length of sound buffer in samples */
+ UINT32 soundbuf_chansamples[MAX_SOUND_CHANNELS]; /* samples in buffer for each channel */
+ UINT32 soundbuf_chunks; /* number of chunks completed so far */
+ UINT32 soundbuf_frames; /* number of frames ahead of the video */
};
@@ -294,9 +294,9 @@ INLINE UINT32 fetch_32bits(const UINT8 *data)
INLINE UINT64 fetch_64bits(const UINT8 *data)
{
return (UINT64)data[0] | ((UINT64)data[1] << 8) |
- ((UINT64)data[2] << 16) | ((UINT64)data[3] << 24) |
- ((UINT64)data[4] << 32) | ((UINT64)data[5] << 40) |
- ((UINT64)data[6] << 48) | ((UINT64)data[7] << 56);
+ ((UINT64)data[2] << 16) | ((UINT64)data[3] << 24) |
+ ((UINT64)data[4] << 32) | ((UINT64)data[5] << 40) |
+ ((UINT64)data[6] << 48) | ((UINT64)data[7] << 56);
}
@@ -740,24 +740,24 @@ const char *avi_error_string(avi_error err)
{
switch (err)
{
- case AVIERR_NONE: return "success";
- case AVIERR_END: return "hit end of file";
- case AVIERR_INVALID_DATA: return "invalid data";
- case AVIERR_NO_MEMORY: return "out of memory";
- case AVIERR_READ_ERROR: return "read error";
- case AVIERR_WRITE_ERROR: return "write error";
- case AVIERR_STACK_TOO_DEEP: return "stack overflow";
- case AVIERR_UNSUPPORTED_FEATURE: return "unsupported feature";
- case AVIERR_CANT_OPEN_FILE: return "unable to open file";
- case AVIERR_INCOMPATIBLE_AUDIO_STREAMS: return "found incompatible audio streams";
- case AVIERR_INVALID_SAMPLERATE: return "found invalid sample rate";
- case AVIERR_INVALID_STREAM: return "invalid stream";
- case AVIERR_INVALID_FRAME: return "invalid frame index";
- case AVIERR_INVALID_BITMAP: return "invalid bitmap";
- case AVIERR_UNSUPPORTED_VIDEO_FORMAT: return "unsupported video format";
- case AVIERR_UNSUPPORTED_AUDIO_FORMAT: return "unsupported audio format";
- case AVIERR_EXCEEDED_SOUND_BUFFER: return "sound buffer overflow";
- default: return "undocumented error";
+ case AVIERR_NONE: return "success";
+ case AVIERR_END: return "hit end of file";
+ case AVIERR_INVALID_DATA: return "invalid data";
+ case AVIERR_NO_MEMORY: return "out of memory";
+ case AVIERR_READ_ERROR: return "read error";
+ case AVIERR_WRITE_ERROR: return "write error";
+ case AVIERR_STACK_TOO_DEEP: return "stack overflow";
+ case AVIERR_UNSUPPORTED_FEATURE: return "unsupported feature";
+ case AVIERR_CANT_OPEN_FILE: return "unable to open file";
+ case AVIERR_INCOMPATIBLE_AUDIO_STREAMS: return "found incompatible audio streams";
+ case AVIERR_INVALID_SAMPLERATE: return "found invalid sample rate";
+ case AVIERR_INVALID_STREAM: return "invalid stream";
+ case AVIERR_INVALID_FRAME: return "invalid frame index";
+ case AVIERR_INVALID_BITMAP: return "invalid bitmap";
+ case AVIERR_UNSUPPORTED_VIDEO_FORMAT: return "unsupported video format";
+ case AVIERR_UNSUPPORTED_AUDIO_FORMAT: return "unsupported audio format";
+ case AVIERR_EXCEEDED_SOUND_BUFFER: return "sound buffer overflow";
+ default: return "undocumented error";
}
}
@@ -1571,7 +1571,7 @@ static avi_error parse_indx_chunk(avi_file *file, avi_stream *stream, avi_chunk
{
const UINT8 *base = &chunkdata[24 + entry * 4 * longs_per_entry];
UINT32 offset = fetch_32bits(&base[0]);
- UINT32 size = fetch_32bits(&base[4]) & 0x7fffffff; // bit 31 == NOT a keyframe
+ UINT32 size = fetch_32bits(&base[4]) & 0x7fffffff; // bit 31 == NOT a keyframe
/* set the info for this chunk and advance */
avierr = set_stream_chunk_info(stream, stream->chunks++, baseoffset + offset - 8, size + 8);
@@ -1746,7 +1746,7 @@ static avi_error chunk_write(avi_file *file, UINT32 type, const void *data, UINT
/* if we are getting too big, split the RIFF */
/* note that we ignore writes before the current RIFF base, as those are assumed to be
- overwrites of a chunk from the previous RIFF */
+ overwrites of a chunk from the previous RIFF */
if (file->writeoffs >= file->riffbase && file->writeoffs + length + idxreserve - file->riffbase >= MAX_RIFF_SIZE)
{
/* close the movi list */
@@ -1917,10 +1917,10 @@ static avi_error write_avih_chunk(avi_file *file, int initial_write)
put_32bits(&buffer[0], 1000000 * (INT64)video->scale / video->rate); /* dwMicroSecPerFrame */
put_32bits(&buffer[12], AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* dwFlags */
- put_32bits(&buffer[16], video->samples); /* dwTotalFrames */
- put_32bits(&buffer[24], file->streams); /* dwStreams */
- put_32bits(&buffer[32], video->width); /* dwWidth */
- put_32bits(&buffer[36], video->height); /* dwHeight */
+ put_32bits(&buffer[16], video->samples); /* dwTotalFrames */
+ put_32bits(&buffer[24], file->streams); /* dwStreams */
+ put_32bits(&buffer[32], video->width); /* dwWidth */
+ put_32bits(&buffer[36], video->height); /* dwHeight */
/* (over)write the chunk */
return chunk_overwrite(file, CHUNKTYPE_AVIH, buffer, sizeof(buffer), &file->saved_avih_offset, initial_write);
@@ -1939,29 +1939,29 @@ static avi_error write_strh_chunk(avi_file *file, avi_stream *stream, int initia
/* reset the buffer */
memset(buffer, 0, sizeof(buffer));
- put_32bits(&buffer[0], stream->type); /* fccType */
- put_32bits(&buffer[20], stream->scale); /* dwScale */
- put_32bits(&buffer[24], stream->rate); /* dwRate */
- put_32bits(&buffer[32], stream->samples); /* dwLength */
- put_32bits(&buffer[40], 10000); /* dwQuality */
+ put_32bits(&buffer[0], stream->type); /* fccType */
+ put_32bits(&buffer[20], stream->scale); /* dwScale */
+ put_32bits(&buffer[24], stream->rate); /* dwRate */
+ put_32bits(&buffer[32], stream->samples); /* dwLength */
+ put_32bits(&buffer[40], 10000); /* dwQuality */
/* video-stream specific data */
if (stream->type == STREAMTYPE_VIDS)
{
- put_32bits(&buffer[4], /* fccHandler */
+ put_32bits(&buffer[4], /* fccHandler */
(stream->format == FORMAT_HFYU) ? HANDLER_HFYU : HANDLER_DIB);
- put_32bits(&buffer[36], /* dwSuggestedBufferSize */
+ put_32bits(&buffer[36], /* dwSuggestedBufferSize */
stream->width * stream->height * 4);
- put_16bits(&buffer[52], stream->width); /* rcFrame.right */
- put_16bits(&buffer[54], stream->height); /* rcFrame.bottom */
+ put_16bits(&buffer[52], stream->width); /* rcFrame.right */
+ put_16bits(&buffer[54], stream->height); /* rcFrame.bottom */
}
/* audio-stream specific data */
if (stream->type == STREAMTYPE_AUDS)
{
- put_32bits(&buffer[36], /* dwSuggestedBufferSize */
+ put_32bits(&buffer[36], /* dwSuggestedBufferSize */
stream->samplerate * stream->channels * (stream->samplebits / 8));
- put_32bits(&buffer[44], /* dwSampleSize */
+ put_32bits(&buffer[44], /* dwSampleSize */
stream->channels * (stream->samplebits / 8));
}
@@ -1985,13 +1985,13 @@ static avi_error write_strf_chunk(avi_file *file, avi_stream *stream)
/* reset the buffer */
memset(buffer, 0, sizeof(buffer));
- put_32bits(&buffer[0], sizeof(buffer)); /* biSize */
- put_32bits(&buffer[4], stream->width); /* biWidth */
- put_32bits(&buffer[8], stream->height); /* biHeight */
- put_16bits(&buffer[12], 1); /* biPlanes */
- put_16bits(&buffer[14], stream->depth); /* biBitCount */
- put_32bits(&buffer[16], stream->format); /* biCompression */
- put_32bits(&buffer[20], /* biSizeImage */
+ put_32bits(&buffer[0], sizeof(buffer)); /* biSize */
+ put_32bits(&buffer[4], stream->width); /* biWidth */
+ put_32bits(&buffer[8], stream->height); /* biHeight */
+ put_16bits(&buffer[12], 1); /* biPlanes */
+ put_16bits(&buffer[14], stream->depth); /* biBitCount */
+ put_32bits(&buffer[16], stream->format); /* biCompression */
+ put_32bits(&buffer[20], /* biSizeImage */
stream->width * stream->height * (stream->depth + 7) / 8);
/* write the chunk */
@@ -2006,14 +2006,14 @@ static avi_error write_strf_chunk(avi_file *file, avi_stream *stream)
/* reset the buffer */
memset(buffer, 0, sizeof(buffer));
- put_16bits(&buffer[0], 1); /* wFormatTag */
- put_16bits(&buffer[2], stream->channels); /* nChannels */
- put_32bits(&buffer[4], stream->samplerate); /* nSamplesPerSec */
- put_32bits(&buffer[8], /* nAvgBytesPerSec */
+ put_16bits(&buffer[0], 1); /* wFormatTag */
+ put_16bits(&buffer[2], stream->channels); /* nChannels */
+ put_32bits(&buffer[4], stream->samplerate); /* nSamplesPerSec */
+ put_32bits(&buffer[8], /* nAvgBytesPerSec */
stream->samplerate * stream->channels * (stream->samplebits / 8));
- put_16bits(&buffer[12], /* nBlockAlign */
+ put_16bits(&buffer[12], /* nBlockAlign */
stream->channels * (stream->samplebits / 8));
- put_16bits(&buffer[14], stream->samplebits); /* wBitsPerSample */
+ put_16bits(&buffer[14], stream->samplebits); /* wBitsPerSample */
/* write the chunk */
return chunk_write(file, CHUNKTYPE_STRF, buffer, sizeof(buffer));
@@ -2070,12 +2070,12 @@ static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initia
memset(tempbuf, 0, 24 + 8 * chunks_this_index);
/* make a regular index */
- put_16bits(&tempbuf[0], 2); /* wLongsPerEntry */
- tempbuf[2] = 0; /* bIndexSubType */
- tempbuf[3] = AVI_INDEX_OF_CHUNKS; /* bIndexType */
- put_32bits(&tempbuf[4], chunks_this_index); /* nEntriesInUse */
- put_32bits(&tempbuf[8], chunkid); /* dwChunkId */
- put_64bits(&tempbuf[12], currentbase); /* qwBaseOffset */
+ put_16bits(&tempbuf[0], 2); /* wLongsPerEntry */
+ tempbuf[2] = 0; /* bIndexSubType */
+ tempbuf[3] = AVI_INDEX_OF_CHUNKS; /* bIndexType */
+ put_32bits(&tempbuf[4], chunks_this_index); /* nEntriesInUse */
+ put_32bits(&tempbuf[8], chunkid); /* dwChunkId */
+ put_64bits(&tempbuf[12], currentbase); /* qwBaseOffset */
/* now fill in the indexes */
chunks_this_index = 0;
@@ -2108,11 +2108,11 @@ static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initia
/* build up the master index */
if (master_entries != 0)
{
- put_16bits(&buffer[0], 4); /* wLongsPerEntry */
- buffer[2] = 0; /* bIndexSubType */
- buffer[3] = AVI_INDEX_OF_INDEXES; /* bIndexType */
- put_32bits(&buffer[4], master_entries); /* nEntriesInUse */
- put_32bits(&buffer[8], chunkid); /* dwChunkId */
+ put_16bits(&buffer[0], 4); /* wLongsPerEntry */
+ buffer[2] = 0; /* bIndexSubType */
+ buffer[3] = AVI_INDEX_OF_INDEXES; /* bIndexType */
+ put_32bits(&buffer[4], master_entries); /* nEntriesInUse */
+ put_32bits(&buffer[8], chunkid); /* dwChunkId */
}
/* (over)write the chunk */
diff --git a/src/lib/util/aviio.h b/src/lib/util/aviio.h
index 6c07c9b2669..320e6855f4f 100644
--- a/src/lib/util/aviio.h
+++ b/src/lib/util/aviio.h
@@ -89,12 +89,12 @@ enum avi_datatype
MACROS
***************************************************************************/
-#define AVI_FOURCC(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
+#define AVI_FOURCC(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
-#define FORMAT_UYVY AVI_FOURCC('U','Y','V','Y')
-#define FORMAT_VYUY AVI_FOURCC('V','Y','U','Y')
-#define FORMAT_YUY2 AVI_FOURCC('Y','U','Y','2')
-#define FORMAT_HFYU AVI_FOURCC('H','F','Y','U')
+#define FORMAT_UYVY AVI_FOURCC('U','Y','V','Y')
+#define FORMAT_VYUY AVI_FOURCC('V','Y','U','Y')
+#define FORMAT_YUY2 AVI_FOURCC('Y','U','Y','2')
+#define FORMAT_HFYU AVI_FOURCC('H','F','Y','U')
@@ -107,21 +107,21 @@ struct avi_file;
struct avi_movie_info
{
- UINT32 video_format; /* format of video data */
- UINT32 video_timescale; /* timescale for video data */
- UINT32 video_sampletime; /* duration of a single video sample (frame) */
- UINT32 video_numsamples; /* total number of video samples */
- UINT32 video_width; /* width of the video */
- UINT32 video_height; /* height of the video */
- UINT32 video_depth; /* depth of the video */
-
- UINT32 audio_format; /* format of audio data */
- UINT32 audio_timescale; /* timescale for audio data */
- UINT32 audio_sampletime; /* duration of a single audio sample */
- UINT32 audio_numsamples; /* total number of audio samples */
- UINT32 audio_channels; /* number of audio channels */
- UINT32 audio_samplebits; /* number of bits per channel */
- UINT32 audio_samplerate; /* sample rate of audio */
+ UINT32 video_format; /* format of video data */
+ UINT32 video_timescale; /* timescale for video data */
+ UINT32 video_sampletime; /* duration of a single video sample (frame) */
+ UINT32 video_numsamples; /* total number of video samples */
+ UINT32 video_width; /* width of the video */
+ UINT32 video_height; /* height of the video */
+ UINT32 video_depth; /* depth of the video */
+
+ UINT32 audio_format; /* format of audio data */
+ UINT32 audio_timescale; /* timescale for audio data */
+ UINT32 audio_sampletime; /* duration of a single audio sample */
+ UINT32 audio_numsamples; /* total number of audio samples */
+ UINT32 audio_channels; /* number of audio channels */
+ UINT32 audio_samplebits; /* number of bits per channel */
+ UINT32 audio_samplerate; /* sample rate of audio */
};
diff --git a/src/lib/util/bitmap.c b/src/lib/util/bitmap.c
index e8dffaa6b58..6f86da6d048 100644
--- a/src/lib/util/bitmap.c
+++ b/src/lib/util/bitmap.c
@@ -94,10 +94,10 @@ inline void bitmap_t::compute_base(int xslop, int yslop)
bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop)
: m_alloc(NULL),
- m_allocbytes(0),
- m_format(format),
- m_bpp(bpp),
- m_palette(NULL)
+ m_allocbytes(0),
+ m_format(format),
+ m_bpp(bpp),
+ m_palette(NULL)
{
// allocate intializes all other fields
allocate(width, height, xslop, yslop);
@@ -106,30 +106,30 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xsl
bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels)
: m_alloc(NULL),
- m_allocbytes(0),
- m_base(base),
- m_rowpixels(rowpixels),
- m_width(width),
- m_height(height),
- m_format(format),
- m_bpp(bpp),
- m_palette(NULL),
- m_cliprect(0, width - 1, 0, height - 1)
+ m_allocbytes(0),
+ m_base(base),
+ m_rowpixels(rowpixels),
+ m_width(width),
+ m_height(height),
+ m_format(format),
+ m_bpp(bpp),
+ m_palette(NULL),
+ m_cliprect(0, width - 1, 0, height - 1)
{
}
bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect)
: m_alloc(NULL),
- m_allocbytes(0),
- m_base(source.raw_pixptr(subrect.min_y, subrect.min_x)),
- m_rowpixels(source.m_rowpixels),
- m_width(subrect.width()),
- m_height(subrect.height()),
- m_format(format),
- m_bpp(bpp),
- m_palette(NULL),
- m_cliprect(0, subrect.width() - 1, 0, subrect.height() - 1)
+ m_allocbytes(0),
+ m_base(source.raw_pixptr(subrect.min_y, subrect.min_x)),
+ m_rowpixels(source.m_rowpixels),
+ m_width(subrect.width()),
+ m_height(subrect.height()),
+ m_format(format),
+ m_bpp(bpp),
+ m_palette(NULL),
+ m_cliprect(0, subrect.width() - 1, 0, subrect.height() - 1)
{
assert(format == source.m_format);
assert(bpp == source.m_bpp);
diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h
index 0578ef43023..bf3ae10f454 100644
--- a/src/lib/util/bitmap.h
+++ b/src/lib/util/bitmap.h
@@ -54,14 +54,14 @@
// bitmap_format describes the various bitmap formats we use
enum bitmap_format
{
- BITMAP_FORMAT_INVALID = 0, // invalid forma
- BITMAP_FORMAT_IND8, // 8bpp indexed
- BITMAP_FORMAT_IND16, // 16bpp indexed
- BITMAP_FORMAT_IND32, // 32bpp indexed
- BITMAP_FORMAT_IND64, // 64bpp indexed
- BITMAP_FORMAT_RGB32, // 32bpp 8-8-8 RGB
- BITMAP_FORMAT_ARGB32, // 32bpp 8-8-8-8 ARGB
- BITMAP_FORMAT_YUY16, // 16bpp 8-8 Y/Cb, Y/Cr in sequence
+ BITMAP_FORMAT_INVALID = 0, // invalid forma
+ BITMAP_FORMAT_IND8, // 8bpp indexed
+ BITMAP_FORMAT_IND16, // 16bpp indexed
+ BITMAP_FORMAT_IND32, // 32bpp indexed
+ BITMAP_FORMAT_IND64, // 64bpp indexed
+ BITMAP_FORMAT_RGB32, // 32bpp 8-8-8 RGB
+ BITMAP_FORMAT_ARGB32, // 32bpp 8-8-8-8 ARGB
+ BITMAP_FORMAT_YUY16, // 16bpp 8-8 Y/Cb, Y/Cr in sequence
BITMAP_FORMAT_LAST
};
@@ -136,10 +136,10 @@ public:
void offsety(INT32 delta) { min_y += delta; max_y += delta; }
// internal state
- INT32 min_x; // minimum X, or left coordinate
- INT32 max_x; // maximum X, or right coordinate (inclusive)
- INT32 min_y; // minimum Y, or top coordinate
- INT32 max_y; // maximum Y, or bottom coordinate (inclusive)
+ INT32 min_x; // minimum X, or left coordinate
+ INT32 max_x; // maximum X, or right coordinate (inclusive)
+ INT32 min_y; // minimum Y, or top coordinate
+ INT32 max_y; // maximum Y, or bottom coordinate (inclusive)
};
@@ -205,16 +205,16 @@ private:
void compute_base(int xslop, int yslop);
// internal state
- UINT8 * m_alloc; // pointer to allocated pixel memory
- UINT32 m_allocbytes; // size of our allocation
- void * m_base; // pointer to pixel (0,0) (adjusted for padding)
- INT32 m_rowpixels; // pixels per row (including padding)
- INT32 m_width; // width of the bitmap
- INT32 m_height; // height of the bitmap
- bitmap_format m_format; // format of the bitmap
- UINT8 m_bpp; // bits per pixel
- palette_t * m_palette; // optional palette
- rectangle m_cliprect; // a clipping rectangle covering the full bitmap
+ UINT8 * m_alloc; // pointer to allocated pixel memory
+ UINT32 m_allocbytes; // size of our allocation
+ void * m_base; // pointer to pixel (0,0) (adjusted for padding)
+ INT32 m_rowpixels; // pixels per row (including padding)
+ INT32 m_width; // width of the bitmap
+ INT32 m_height; // height of the bitmap
+ bitmap_format m_format; // format of the bitmap
+ UINT8 m_bpp; // bits per pixel
+ palette_t * m_palette; // optional palette
+ rectangle m_cliprect; // a clipping rectangle covering the full bitmap
};
@@ -438,4 +438,4 @@ public:
};
-#endif // __BITMAP_H__
+#endif // __BITMAP_H__
diff --git a/src/lib/util/bitstream.h b/src/lib/util/bitstream.h
index 85c2e067c2f..5e77d91d73f 100644
--- a/src/lib/util/bitstream.h
+++ b/src/lib/util/bitstream.h
@@ -68,11 +68,11 @@ public:
private:
// internal state
- UINT32 m_buffer; // current bit accumulator
- int m_bits; // number of bits in the accumulator
- const UINT8 * m_read; // read pointer
- UINT32 m_doffset; // byte offset within the data
- UINT32 m_dlength; // length of the data
+ UINT32 m_buffer; // current bit accumulator
+ int m_bits; // number of bits in the accumulator
+ const UINT8 * m_read; // read pointer
+ UINT32 m_doffset; // byte offset within the data
+ UINT32 m_dlength; // length of the data
};
@@ -92,11 +92,11 @@ public:
private:
// internal state
- UINT32 m_buffer; // current bit accumulator
- int m_bits; // number of bits in the accumulator
- UINT8 * m_write; // write pointer
- UINT32 m_doffset; // byte offset within the data
- UINT32 m_dlength; // length of the data
+ UINT32 m_buffer; // current bit accumulator
+ int m_bits; // number of bits in the accumulator
+ UINT8 * m_write; // write pointer
+ UINT32 m_doffset; // byte offset within the data
+ UINT32 m_dlength; // length of the data
};
@@ -111,10 +111,10 @@ private:
inline bitstream_in::bitstream_in(const void *src, UINT32 srclength)
: m_buffer(0),
- m_bits(0),
- m_read(reinterpret_cast<const UINT8 *>(src)),
- m_doffset(0),
- m_dlength(srclength)
+ m_bits(0),
+ m_read(reinterpret_cast<const UINT8 *>(src)),
+ m_doffset(0),
+ m_dlength(srclength)
{
}
@@ -209,10 +209,10 @@ inline UINT32 bitstream_in::flush()
inline bitstream_out::bitstream_out(void *dest, UINT32 destlength)
: m_buffer(0),
- m_bits(0),
- m_write(reinterpret_cast<UINT8 *>(dest)),
- m_doffset(0),
- m_dlength(destlength)
+ m_bits(0),
+ m_write(reinterpret_cast<UINT8 *>(dest)),
+ m_doffset(0),
+ m_dlength(destlength)
{
}
diff --git a/src/lib/util/cdrom.c b/src/lib/util/cdrom.c
index d783c556503..fd178e05444 100644
--- a/src/lib/util/cdrom.c
+++ b/src/lib/util/cdrom.c
@@ -55,7 +55,7 @@
DEBUGGING
***************************************************************************/
-#define VERBOSE (0)
+#define VERBOSE (0)
#if VERBOSE
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
void CLIB_DECL logerror(const char *text,...);
@@ -69,18 +69,18 @@ void CLIB_DECL logerror(const char *text,...);
CONSTANTS
***************************************************************************/
-const int SYNC_OFFSET = 0x000; // offset within sector
-const int SYNC_NUM_BYTES = 12; // 12 bytes
+const int SYNC_OFFSET = 0x000; // offset within sector
+const int SYNC_NUM_BYTES = 12; // 12 bytes
-const int MODE_OFFSET = 0x00f; // offset within sector
+const int MODE_OFFSET = 0x00f; // offset within sector
-const int ECC_P_OFFSET = 0x81c; // offset within sector
-const int ECC_P_NUM_BYTES = 86; // 2 lots of 86
-const int ECC_P_COMP = 24; // 24 bytes each
+const int ECC_P_OFFSET = 0x81c; // offset within sector
+const int ECC_P_NUM_BYTES = 86; // 2 lots of 86
+const int ECC_P_COMP = 24; // 24 bytes each
const int ECC_Q_OFFSET = ECC_P_OFFSET + 2 * ECC_P_NUM_BYTES;
-const int ECC_Q_NUM_BYTES = 52; // 2 lots of 52
-const int ECC_Q_COMP = 43; // 43 bytes each
+const int ECC_Q_NUM_BYTES = 52; // 2 lots of 52
+const int ECC_Q_COMP = 43; // 43 bytes each
@@ -90,10 +90,10 @@ const int ECC_Q_COMP = 43; // 43 bytes each
struct cdrom_file
{
- chd_file * chd; /* CHD file */
- cdrom_toc cdtoc; /* TOC for the CD */
- chdcd_track_input_info track_info; /* track info */
- core_file * fhandle[CD_MAX_TRACKS];/* file handle */
+ chd_file * chd; /* CHD file */
+ cdrom_toc cdtoc; /* TOC for the CD */
+ chdcd_track_input_info track_info; /* track info */
+ core_file * fhandle[CD_MAX_TRACKS];/* file handle */
};
@@ -189,8 +189,8 @@ cdrom_file *cdrom_open(const char *inputfile)
}
}
/* calculate the starting frame for each track, keeping in mind that CHDMAN
- pads tracks out with extra frames to fit 4-frame size boundries
- */
+ pads tracks out with extra frames to fit 4-frame size boundries
+ */
physofs = logofs = 0;
for (i = 0; i < file->cdtoc.numtrks; i++)
{
@@ -213,10 +213,10 @@ cdrom_file *cdrom_open(const char *inputfile)
file->cdtoc.tracks[i].datasize,
file->cdtoc.tracks[i].subsize,
file->cdtoc.tracks[i].frames,
- file->cdtoc.tracks[i].extraframes,
- file->cdtoc.tracks[i].pregap,
+ file->cdtoc.tracks[i].extraframes,
+ file->cdtoc.tracks[i].pregap,
file->cdtoc.tracks[i].postgap,
- file->cdtoc.tracks[i].logframeofs,
+ file->cdtoc.tracks[i].logframeofs,
file->cdtoc.tracks[i].physframeofs,
file->cdtoc.tracks[i].chdframeofs));
}
@@ -270,8 +270,8 @@ cdrom_file *cdrom_open(chd_file *chd)
LOG(("CD has %d tracks\n", file->cdtoc.numtrks));
/* calculate the starting frame for each track, keeping in mind that CHDMAN
- pads tracks out with extra frames to fit 4-frame size boundries
- */
+ pads tracks out with extra frames to fit 4-frame size boundries
+ */
physofs = chdofs = logofs = 0;
for (i = 0; i < file->cdtoc.numtrks; i++)
{
@@ -296,10 +296,10 @@ cdrom_file *cdrom_open(chd_file *chd)
file->cdtoc.tracks[i].datasize,
file->cdtoc.tracks[i].subsize,
file->cdtoc.tracks[i].frames,
- file->cdtoc.tracks[i].extraframes,
- file->cdtoc.tracks[i].pregap,
+ file->cdtoc.tracks[i].extraframes,
+ file->cdtoc.tracks[i].pregap,
file->cdtoc.tracks[i].postgap,
- file->cdtoc.tracks[i].logframeofs,
+ file->cdtoc.tracks[i].logframeofs,
file->cdtoc.tracks[i].physframeofs,
file->cdtoc.tracks[i].chdframeofs));
}
@@ -419,7 +419,7 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32
bufptr[12] = msf>>16;
bufptr[13] = msf>>8;
bufptr[14] = msf&0xff;
- bufptr[15] = 1; // mode 1
+ bufptr[15] = 1; // mode 1
LOG(("CDROM: promotion of mode1/form1 sector to mode1 raw is not complete!\n"));
return (read_partial_sector(file, bufptr+16, chdsector, tracknum, 0, 2048) == CHDERR_NONE);
}
@@ -516,7 +516,7 @@ UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track)
/*-------------------------------------------------
cdrom_get_track_start_phys - get the
- physical frame number that a track starts at
+ physical frame number that a track starts at
-------------------------------------------------*/
UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track)
@@ -561,10 +561,10 @@ int cdrom_get_adr_control(cdrom_file *file, int track)
if (track == 0xaa || file->cdtoc.tracks[track].trktype == CD_TRACK_AUDIO)
{
- return 0x10; // audio track, subchannel is position
+ return 0x10; // audio track, subchannel is position
}
- return 0x14; // data track, subchannel is position
+ return 0x14; // data track, subchannel is position
}
@@ -756,15 +756,15 @@ const char *cdrom_get_type_string(UINT32 trktype)
{
switch (trktype)
{
- case CD_TRACK_MODE1: return "MODE1";
- case CD_TRACK_MODE1_RAW: return "MODE1_RAW";
- case CD_TRACK_MODE2: return "MODE2";
- case CD_TRACK_MODE2_FORM1: return "MODE2_FORM1";
- case CD_TRACK_MODE2_FORM2: return "MODE2_FORM2";
- case CD_TRACK_MODE2_FORM_MIX: return "MODE2_FORM_MIX";
- case CD_TRACK_MODE2_RAW: return "MODE2_RAW";
- case CD_TRACK_AUDIO: return "AUDIO";
- default: return "UNKNOWN";
+ case CD_TRACK_MODE1: return "MODE1";
+ case CD_TRACK_MODE1_RAW: return "MODE1_RAW";
+ case CD_TRACK_MODE2: return "MODE2";
+ case CD_TRACK_MODE2_FORM1: return "MODE2_FORM1";
+ case CD_TRACK_MODE2_FORM2: return "MODE2_FORM2";
+ case CD_TRACK_MODE2_FORM_MIX: return "MODE2_FORM_MIX";
+ case CD_TRACK_MODE2_RAW: return "MODE2_RAW";
+ case CD_TRACK_AUDIO: return "AUDIO";
+ default: return "UNKNOWN";
}
}
@@ -778,9 +778,9 @@ const char *cdrom_get_subtype_string(UINT32 subtype)
{
switch (subtype)
{
- case CD_SUB_NORMAL: return "RW";
- case CD_SUB_RAW: return "RW_RAW";
- default: return "NONE";
+ case CD_SUB_NORMAL: return "RW";
+ case CD_SUB_RAW: return "RW_RAW";
+ default: return "NONE";
}
}
@@ -816,7 +816,7 @@ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc)
{
/* parse the metadata */
type[0] = subtype[0] = 0;
- pgtype[0] = pgsub[0] = 0;
+ pgtype[0] = pgsub[0] = 0;
if (sscanf(metadata, CDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames) != 4)
return CHDERR_INVALID_DATA;
if (tracknum == 0 || tracknum > CD_MAX_TRACKS)
@@ -827,36 +827,36 @@ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc)
{
err = chd->read_metadata(CDROM_TRACK_METADATA2_TAG, toc->numtrks, metadata);
if (err == CHDERR_NONE)
- {
- /* parse the metadata */
- type[0] = subtype[0] = 0;
- pregap = postgap = 0;
- if (sscanf(metadata, CDROM_TRACK_METADATA2_FORMAT, &tracknum, type, subtype, &frames, &pregap, pgtype, pgsub, &postgap) != 8)
- return CHDERR_INVALID_DATA;
- if (tracknum == 0 || tracknum > CD_MAX_TRACKS)
- return CHDERR_INVALID_DATA;
- track = &toc->tracks[tracknum - 1];
- }
- else
- {
- err = chd->read_metadata(GDROM_TRACK_METADATA_TAG, toc->numtrks, metadata);
-
- if (err == CHDERR_NONE)
- {
- /* parse the metadata */
- type[0] = subtype[0] = 0;
- pregap = postgap = 0;
- if (sscanf(metadata, GDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames, &padframes, &pregap, pgtype, pgsub, &postgap) != 9)
- return CHDERR_INVALID_DATA;
- if (tracknum == 0 || tracknum > CD_MAX_TRACKS)
- return CHDERR_INVALID_DATA;
- track = &toc->tracks[tracknum - 1];
- }
- else
- {
- break;
- }
- }
+ {
+ /* parse the metadata */
+ type[0] = subtype[0] = 0;
+ pregap = postgap = 0;
+ if (sscanf(metadata, CDROM_TRACK_METADATA2_FORMAT, &tracknum, type, subtype, &frames, &pregap, pgtype, pgsub, &postgap) != 8)
+ return CHDERR_INVALID_DATA;
+ if (tracknum == 0 || tracknum > CD_MAX_TRACKS)
+ return CHDERR_INVALID_DATA;
+ track = &toc->tracks[tracknum - 1];
+ }
+ else
+ {
+ err = chd->read_metadata(GDROM_TRACK_METADATA_TAG, toc->numtrks, metadata);
+
+ if (err == CHDERR_NONE)
+ {
+ /* parse the metadata */
+ type[0] = subtype[0] = 0;
+ pregap = postgap = 0;
+ if (sscanf(metadata, GDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames, &padframes, &pregap, pgtype, pgsub, &postgap) != 9)
+ return CHDERR_INVALID_DATA;
+ if (tracknum == 0 || tracknum > CD_MAX_TRACKS)
+ return CHDERR_INVALID_DATA;
+ track = &toc->tracks[tracknum - 1];
+ }
+ else
+ {
+ break;
+ }
+ }
}
/* extract the track type and determine the data size */
@@ -873,7 +873,7 @@ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc)
/* set the frames and extra frames data */
track->frames = frames;
- track->padframes = padframes;
+ track->padframes = padframes;
int padded = (frames + CD_TRACK_PADDING - 1) / CD_TRACK_PADDING;
track->extraframes = padded * CD_TRACK_PADDING - frames;
@@ -886,15 +886,15 @@ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc)
cdrom_convert_type_string_to_pregap_info(pgtype, track);
cdrom_convert_subtype_string_to_pregap_info(pgsub, track);
- /* set the postgap info */
- track->postgap = postgap;
+ /* set the postgap info */
+ track->postgap = postgap;
}
/* if we got any tracks this way, we're done */
if (toc->numtrks > 0)
return CHDERR_NONE;
- printf("toc->numtrks = %d?!\n", toc->numtrks);
+ printf("toc->numtrks = %d?!\n", toc->numtrks);
/* look for old-style metadata */
dynamic_buffer oldmetadata;
@@ -954,25 +954,25 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc)
/* write the metadata */
for (i = 0; i < toc->numtrks; i++)
{
- astring metadata;
- if (!(toc->flags & CD_FLAG_GDROM))
- {
- metadata.format(CDROM_TRACK_METADATA2_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype),
- cdrom_get_subtype_string(toc->tracks[i].subtype), toc->tracks[i].frames, toc->tracks[i].pregap,
- cdrom_get_type_string(toc->tracks[i].pgtype), cdrom_get_subtype_string(toc->tracks[i].pgsub),
- toc->tracks[i].postgap);
-
- err = chd->write_metadata(CDROM_TRACK_METADATA2_TAG, i, metadata);
- }
- else
- {
- metadata.format(GDROM_TRACK_METADATA_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype),
- cdrom_get_subtype_string(toc->tracks[i].subtype), toc->tracks[i].frames, toc->tracks[i].padframes,
- toc->tracks[i].pregap, cdrom_get_type_string(toc->tracks[i].pgtype),
- cdrom_get_subtype_string(toc->tracks[i].pgsub), toc->tracks[i].postgap);
-
- err = chd->write_metadata(GDROM_TRACK_METADATA_TAG, i, metadata);
- }
+ astring metadata;
+ if (!(toc->flags & CD_FLAG_GDROM))
+ {
+ metadata.format(CDROM_TRACK_METADATA2_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype),
+ cdrom_get_subtype_string(toc->tracks[i].subtype), toc->tracks[i].frames, toc->tracks[i].pregap,
+ cdrom_get_type_string(toc->tracks[i].pgtype), cdrom_get_subtype_string(toc->tracks[i].pgsub),
+ toc->tracks[i].postgap);
+
+ err = chd->write_metadata(CDROM_TRACK_METADATA2_TAG, i, metadata);
+ }
+ else
+ {
+ metadata.format(GDROM_TRACK_METADATA_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype),
+ cdrom_get_subtype_string(toc->tracks[i].subtype), toc->tracks[i].frames, toc->tracks[i].padframes,
+ toc->tracks[i].pregap, cdrom_get_type_string(toc->tracks[i].pgtype),
+ cdrom_get_subtype_string(toc->tracks[i].pgsub), toc->tracks[i].postgap);
+
+ err = chd->write_metadata(GDROM_TRACK_METADATA_TAG, i, metadata);
+ }
if (err != CHDERR_NONE)
return err;
}
@@ -1211,11 +1211,11 @@ void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8
val1 = val2 = 0;
for (int component = 0; component < rowlen; component++)
{
- val1 ^= ecc_source_byte(sector, row[component]);
- val2 ^= ecc_source_byte(sector, row[component]);
- val1 = ecclow[val1];
- }
- val1 = ecchigh[ecclow[val1] ^ val2];
+ val1 ^= ecc_source_byte(sector, row[component]);
+ val2 ^= ecc_source_byte(sector, row[component]);
+ val1 = ecclow[val1];
+ }
+ val1 = ecchigh[ecclow[val1] ^ val2];
val2 ^= val1;
}
@@ -1231,16 +1231,16 @@ bool ecc_verify(const UINT8 *sector)
for (int byte = 0; byte < ECC_P_NUM_BYTES; byte++)
{
UINT8 val1, val2;
- ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, val1, val2);
+ ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, val1, val2);
if (sector[ECC_P_OFFSET + byte] != val1 || sector[ECC_P_OFFSET + ECC_P_NUM_BYTES + byte] != val2)
return false;
}
// then verify Q bytes
- for (int byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
+ for (int byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
{
UINT8 val1, val2;
- ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, val1, val2);
+ ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, val1, val2);
if (sector[ECC_Q_OFFSET + byte] != val1 || sector[ECC_Q_OFFSET + ECC_Q_NUM_BYTES + byte] != val2)
return false;
}
@@ -1257,11 +1257,11 @@ void ecc_generate(UINT8 *sector)
{
// first verify P bytes
for (int byte = 0; byte < ECC_P_NUM_BYTES; byte++)
- ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, sector[ECC_P_OFFSET + byte], sector[ECC_P_OFFSET + ECC_P_NUM_BYTES + byte]);
+ ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, sector[ECC_P_OFFSET + byte], sector[ECC_P_OFFSET + ECC_P_NUM_BYTES + byte]);
// then verify Q bytes
- for (int byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
- ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, sector[ECC_Q_OFFSET + byte], sector[ECC_Q_OFFSET + ECC_Q_NUM_BYTES + byte]);
+ for (int byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
+ ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, sector[ECC_Q_OFFSET + byte], sector[ECC_Q_OFFSET + ECC_Q_NUM_BYTES + byte]);
}
diff --git a/src/lib/util/cdrom.h b/src/lib/util/cdrom.h
index 8737df50fdf..f17280ba449 100644
--- a/src/lib/util/cdrom.h
+++ b/src/lib/util/cdrom.h
@@ -54,37 +54,37 @@
// tracks are padded to a multiple of this many frames
const UINT32 CD_TRACK_PADDING = 4;
-#define CD_MAX_TRACKS (99) /* AFAIK the theoretical limit */
-#define CD_MAX_SECTOR_DATA (2352)
-#define CD_MAX_SUBCODE_DATA (96)
+#define CD_MAX_TRACKS (99) /* AFAIK the theoretical limit */
+#define CD_MAX_SECTOR_DATA (2352)
+#define CD_MAX_SUBCODE_DATA (96)
-#define CD_FRAME_SIZE (CD_MAX_SECTOR_DATA + CD_MAX_SUBCODE_DATA)
-#define CD_FRAMES_PER_HUNK (8)
+#define CD_FRAME_SIZE (CD_MAX_SECTOR_DATA + CD_MAX_SUBCODE_DATA)
+#define CD_FRAMES_PER_HUNK (8)
-#define CD_METADATA_WORDS (1+(CD_MAX_TRACKS * 6))
+#define CD_METADATA_WORDS (1+(CD_MAX_TRACKS * 6))
enum
{
- CD_TRACK_MODE1 = 0, /* mode 1 2048 bytes/sector */
- CD_TRACK_MODE1_RAW, /* mode 1 2352 bytes/sector */
- CD_TRACK_MODE2, /* mode 2 2336 bytes/sector */
- CD_TRACK_MODE2_FORM1, /* mode 2 2048 bytes/sector */
- CD_TRACK_MODE2_FORM2, /* mode 2 2324 bytes/sector */
- CD_TRACK_MODE2_FORM_MIX, /* mode 2 2336 bytes/sector */
- CD_TRACK_MODE2_RAW, /* mode 2 2352 bytes / sector */
- CD_TRACK_AUDIO, /* redbook audio track 2352 bytes/sector (588 samples) */
-
- CD_TRACK_RAW_DONTCARE /* special flag for cdrom_read_data: just return me whatever is there */
+ CD_TRACK_MODE1 = 0, /* mode 1 2048 bytes/sector */
+ CD_TRACK_MODE1_RAW, /* mode 1 2352 bytes/sector */
+ CD_TRACK_MODE2, /* mode 2 2336 bytes/sector */
+ CD_TRACK_MODE2_FORM1, /* mode 2 2048 bytes/sector */
+ CD_TRACK_MODE2_FORM2, /* mode 2 2324 bytes/sector */
+ CD_TRACK_MODE2_FORM_MIX, /* mode 2 2336 bytes/sector */
+ CD_TRACK_MODE2_RAW, /* mode 2 2352 bytes / sector */
+ CD_TRACK_AUDIO, /* redbook audio track 2352 bytes/sector (588 samples) */
+
+ CD_TRACK_RAW_DONTCARE /* special flag for cdrom_read_data: just return me whatever is there */
};
enum
{
- CD_SUB_NORMAL = 0, /* "cooked" 96 bytes per sector */
- CD_SUB_RAW, /* raw uninterleaved 96 bytes per sector */
- CD_SUB_NONE /* no subcode data stored */
+ CD_SUB_NORMAL = 0, /* "cooked" 96 bytes per sector */
+ CD_SUB_RAW, /* raw uninterleaved 96 bytes per sector */
+ CD_SUB_NONE /* no subcode data stored */
};
-#define CD_FLAG_GDROM 0x00000001 // disc is a GD-ROM, all tracks should be stored with GD-ROM metadata
+#define CD_FLAG_GDROM 0x00000001 // disc is a GD-ROM, all tracks should be stored with GD-ROM metadata
/***************************************************************************
TYPE DEFINITIONS
@@ -95,33 +95,33 @@ struct cdrom_file;
struct cdrom_track_info
{
/* fields used by CHDMAN and in MAME */
- UINT32 trktype; /* track type */
- UINT32 subtype; /* subcode data type */
- UINT32 datasize; /* size of data in each sector of this track */
- UINT32 subsize; /* size of subchannel data in each sector of this track */
- UINT32 frames; /* number of frames in this track */
- UINT32 extraframes; /* number of "spillage" frames in this track */
- UINT32 pregap; /* number of pregap frames */
- UINT32 postgap; /* number of postgap frames */
- UINT32 pgtype; /* type of sectors in pregap */
- UINT32 pgsub; /* type of subchannel data in pregap */
- UINT32 pgdatasize; /* size of data in each sector of the pregap */
- UINT32 pgsubsize; /* size of subchannel data in each sector of the pregap */
+ UINT32 trktype; /* track type */
+ UINT32 subtype; /* subcode data type */
+ UINT32 datasize; /* size of data in each sector of this track */
+ UINT32 subsize; /* size of subchannel data in each sector of this track */
+ UINT32 frames; /* number of frames in this track */
+ UINT32 extraframes; /* number of "spillage" frames in this track */
+ UINT32 pregap; /* number of pregap frames */
+ UINT32 postgap; /* number of postgap frames */
+ UINT32 pgtype; /* type of sectors in pregap */
+ UINT32 pgsub; /* type of subchannel data in pregap */
+ UINT32 pgdatasize; /* size of data in each sector of the pregap */
+ UINT32 pgsubsize; /* size of subchannel data in each sector of the pregap */
/* fields used in CHDMAN only */
- UINT32 padframes; /* number of frames of padding to add to the end of the track; needed for GDI */
+ UINT32 padframes; /* number of frames of padding to add to the end of the track; needed for GDI */
/* fields used in MAME only */
- UINT32 logframeofs; /* logical frame offset: offset including pre/postgaps */
+ UINT32 logframeofs; /* logical frame offset: offset including pre/postgaps */
UINT32 physframeofs; /* physical frame offset: offset ignoring pre/postgaps */
- UINT32 chdframeofs; /* frame number this track starts at on the CHD */
+ UINT32 chdframeofs; /* frame number this track starts at on the CHD */
};
struct cdrom_toc
{
- UINT32 numtrks; /* number of tracks */
- UINT32 flags; /* see FLAG_ above */
+ UINT32 numtrks; /* number of tracks */
+ UINT32 flags; /* see FLAG_ above */
cdrom_track_info tracks[CD_MAX_TRACKS];
};
@@ -188,8 +188,8 @@ INLINE UINT32 lba_to_msf(UINT32 lba)
f = lba % 75;
return ((m / 10) << 20) | ((m % 10) << 16) |
- ((s / 10) << 12) | ((s % 10) << 8) |
- ((f / 10) << 4) | ((f % 10) << 0);
+ ((s / 10) << 12) | ((s % 10) << 8) |
+ ((f / 10) << 4) | ((f % 10) << 0);
}
// segacd needs it like this.. investigate
@@ -209,4 +209,4 @@ INLINE UINT32 lba_to_msf_alt(int lba)
-#endif // __CDROM_H__
+#endif // __CDROM_H__
diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c
index 5c139a763c0..f47c471a0e3 100644
--- a/src/lib/util/chd.c
+++ b/src/lib/util/chd.c
@@ -61,45 +61,45 @@ const char *CDROM_TRACK_METADATA2_FORMAT = "TRACK:%d TYPE:%s SUBTYPE:%s FRAMES:%
const char *GDROM_TRACK_METADATA_FORMAT = "TRACK:%d TYPE:%s SUBTYPE:%s FRAMES:%d PAD:%d PREGAP:%d PGTYPE:%s PGSUB:%s POSTGAP:%d";
const char *AV_METADATA_FORMAT = "FPS:%d.%06d WIDTH:%d HEIGHT:%d INTERLACED:%d CHANNELS:%d SAMPLERATE:%d";
-static const UINT32 METADATA_HEADER_SIZE = 16; // metadata header size
+static const UINT32 METADATA_HEADER_SIZE = 16; // metadata header size
-static const UINT8 V34_MAP_ENTRY_FLAG_TYPE_MASK = 0x0f; // what type of hunk
-static const UINT8 V34_MAP_ENTRY_FLAG_NO_CRC = 0x10; // no CRC is present
+static const UINT8 V34_MAP_ENTRY_FLAG_TYPE_MASK = 0x0f; // what type of hunk
+static const UINT8 V34_MAP_ENTRY_FLAG_NO_CRC = 0x10; // no CRC is present
// V3-V4 entry types
enum
{
- V34_MAP_ENTRY_TYPE_INVALID = 0, // invalid type
- V34_MAP_ENTRY_TYPE_COMPRESSED = 1, // standard compression
- V34_MAP_ENTRY_TYPE_UNCOMPRESSED = 2, // uncompressed data
- V34_MAP_ENTRY_TYPE_MINI = 3, // mini: use offset as raw data
- V34_MAP_ENTRY_TYPE_SELF_HUNK = 4, // same as another hunk in this file
- V34_MAP_ENTRY_TYPE_PARENT_HUNK = 5, // same as a hunk in the parent file
- V34_MAP_ENTRY_TYPE_2ND_COMPRESSED = 6 // compressed with secondary algorithm (usually FLAC CDDA)
+ V34_MAP_ENTRY_TYPE_INVALID = 0, // invalid type
+ V34_MAP_ENTRY_TYPE_COMPRESSED = 1, // standard compression
+ V34_MAP_ENTRY_TYPE_UNCOMPRESSED = 2, // uncompressed data
+ V34_MAP_ENTRY_TYPE_MINI = 3, // mini: use offset as raw data
+ V34_MAP_ENTRY_TYPE_SELF_HUNK = 4, // same as another hunk in this file
+ V34_MAP_ENTRY_TYPE_PARENT_HUNK = 5, // same as a hunk in the parent file
+ V34_MAP_ENTRY_TYPE_2ND_COMPRESSED = 6 // compressed with secondary algorithm (usually FLAC CDDA)
};
// V5 compression types
enum
{
// these types are live when running
- COMPRESSION_TYPE_0 = 0, // codec #0
- COMPRESSION_TYPE_1 = 1, // codec #1
- COMPRESSION_TYPE_2 = 2, // codec #2
- COMPRESSION_TYPE_3 = 3, // codec #3
- COMPRESSION_NONE = 4, // no compression; implicit length = hunkbytes
- COMPRESSION_SELF = 5, // same as another block in this chd
- COMPRESSION_PARENT = 6, // same as a hunk's worth of units in the parent chd
+ COMPRESSION_TYPE_0 = 0, // codec #0
+ COMPRESSION_TYPE_1 = 1, // codec #1
+ COMPRESSION_TYPE_2 = 2, // codec #2
+ COMPRESSION_TYPE_3 = 3, // codec #3
+ COMPRESSION_NONE = 4, // no compression; implicit length = hunkbytes
+ COMPRESSION_SELF = 5, // same as another block in this chd
+ COMPRESSION_PARENT = 6, // same as a hunk's worth of units in the parent chd
// these additional pseudo-types are used for compressed encodings:
- COMPRESSION_RLE_SMALL, // start of small RLE run (4-bit length)
- COMPRESSION_RLE_LARGE, // start of large RLE run (8-bit length)
- COMPRESSION_SELF_0, // same as the last COMPRESSION_SELF block
- COMPRESSION_SELF_1, // same as the last COMPRESSION_SELF block + 1
- COMPRESSION_PARENT_SELF, // same block in the parent
- COMPRESSION_PARENT_0, // same as the last COMPRESSION_PARENT block
- COMPRESSION_PARENT_1 // same as the last COMPRESSION_PARENT block + 1
+ COMPRESSION_RLE_SMALL, // start of small RLE run (4-bit length)
+ COMPRESSION_RLE_LARGE, // start of large RLE run (8-bit length)
+ COMPRESSION_SELF_0, // same as the last COMPRESSION_SELF block
+ COMPRESSION_SELF_1, // same as the last COMPRESSION_SELF block + 1
+ COMPRESSION_PARENT_SELF, // same block in the parent
+ COMPRESSION_PARENT_0, // same as the last COMPRESSION_PARENT block
+ COMPRESSION_PARENT_1 // same as the last COMPRESSION_PARENT block + 1
};
@@ -113,12 +113,12 @@ enum
// description of where a metadata entry lives within the file
struct chd_file::metadata_entry
{
- UINT64 offset; // offset within the file of the header
- UINT64 next; // offset within the file of the next header
- UINT64 prev; // offset within the file of the previous header
- UINT32 length; // length of the metadata
- UINT32 metatag; // metadata tag
- UINT8 flags; // flag bits
+ UINT64 offset; // offset within the file of the header
+ UINT64 next; // offset within the file of the next header
+ UINT64 prev; // offset within the file of the previous header
+ UINT32 length; // length of the metadata
+ UINT32 metatag; // metadata tag
+ UINT8 flags; // flag bits
};
@@ -126,8 +126,8 @@ struct chd_file::metadata_entry
struct chd_file::metadata_hash
{
- UINT8 tag[4]; // tag of the metadata in big-endian
- sha1_t sha1; // hash data
+ UINT8 tag[4]; // tag of the metadata in big-endian
+ sha1_t sha1; // hash data
};
@@ -297,7 +297,7 @@ inline UINT8 chd_file::bits_for_value(UINT64 value)
chd_file::chd_file()
: m_file(NULL),
- m_owns_file(false)
+ m_owns_file(false)
{
// reset state
memset(m_decompressor, 0, sizeof(m_decompressor));
@@ -1382,39 +1382,39 @@ const char *chd_file::error_string(chd_error err)
{
switch (err)
{
- case CHDERR_NONE: return "no error";
- case CHDERR_NO_INTERFACE: return "no drive interface";
- case CHDERR_OUT_OF_MEMORY: return "out of memory";
- case CHDERR_NOT_OPEN: return "file not open";
- case CHDERR_ALREADY_OPEN: return "file already open";
- case CHDERR_INVALID_FILE: return "invalid file";
- case CHDERR_INVALID_PARAMETER: return "invalid parameter";
- case CHDERR_INVALID_DATA: return "invalid data";
- case CHDERR_FILE_NOT_FOUND: return "file not found";
- case CHDERR_REQUIRES_PARENT: return "requires parent";
- case CHDERR_FILE_NOT_WRITEABLE: return "file not writeable";
- case CHDERR_READ_ERROR: return "read error";
- case CHDERR_WRITE_ERROR: return "write error";
- case CHDERR_CODEC_ERROR: return "codec error";
- case CHDERR_INVALID_PARENT: return "invalid parent";
- case CHDERR_HUNK_OUT_OF_RANGE: return "hunk out of range";
- case CHDERR_DECOMPRESSION_ERROR: return "decompression error";
- case CHDERR_COMPRESSION_ERROR: return "compression error";
- case CHDERR_CANT_CREATE_FILE: return "can't create file";
- case CHDERR_CANT_VERIFY: return "can't verify file";
- case CHDERR_NOT_SUPPORTED: return "operation not supported";
- case CHDERR_METADATA_NOT_FOUND: return "can't find metadata";
- case CHDERR_INVALID_METADATA_SIZE: return "invalid metadata size";
- case CHDERR_UNSUPPORTED_VERSION: return "mismatched DIFF and CHD or unsupported CHD version";
- case CHDERR_VERIFY_INCOMPLETE: return "incomplete verify";
- case CHDERR_INVALID_METADATA: return "invalid metadata";
- case CHDERR_INVALID_STATE: return "invalid state";
- case CHDERR_OPERATION_PENDING: return "operation pending";
- case CHDERR_UNSUPPORTED_FORMAT: return "unsupported format";
- case CHDERR_UNKNOWN_COMPRESSION: return "unknown compression type";
- case CHDERR_WALKING_PARENT: return "currently examining parent";
- case CHDERR_COMPRESSING: return "currently compressing";
- default: return "undocumented error";
+ case CHDERR_NONE: return "no error";
+ case CHDERR_NO_INTERFACE: return "no drive interface";
+ case CHDERR_OUT_OF_MEMORY: return "out of memory";
+ case CHDERR_NOT_OPEN: return "file not open";
+ case CHDERR_ALREADY_OPEN: return "file already open";
+ case CHDERR_INVALID_FILE: return "invalid file";
+ case CHDERR_INVALID_PARAMETER: return "invalid parameter";
+ case CHDERR_INVALID_DATA: return "invalid data";
+ case CHDERR_FILE_NOT_FOUND: return "file not found";
+ case CHDERR_REQUIRES_PARENT: return "requires parent";
+ case CHDERR_FILE_NOT_WRITEABLE: return "file not writeable";
+ case CHDERR_READ_ERROR: return "read error";
+ case CHDERR_WRITE_ERROR: return "write error";
+ case CHDERR_CODEC_ERROR: return "codec error";
+ case CHDERR_INVALID_PARENT: return "invalid parent";
+ case CHDERR_HUNK_OUT_OF_RANGE: return "hunk out of range";
+ case CHDERR_DECOMPRESSION_ERROR: return "decompression error";
+ case CHDERR_COMPRESSION_ERROR: return "compression error";
+ case CHDERR_CANT_CREATE_FILE: return "can't create file";
+ case CHDERR_CANT_VERIFY: return "can't verify file";
+ case CHDERR_NOT_SUPPORTED: return "operation not supported";
+ case CHDERR_METADATA_NOT_FOUND: return "can't find metadata";
+ case CHDERR_INVALID_METADATA_SIZE: return "invalid metadata size";
+ case CHDERR_UNSUPPORTED_VERSION: return "mismatched DIFF and CHD or unsupported CHD version";
+ case CHDERR_VERIFY_INCOMPLETE: return "incomplete verify";
+ case CHDERR_INVALID_METADATA: return "invalid metadata";
+ case CHDERR_INVALID_STATE: return "invalid state";
+ case CHDERR_OPERATION_PENDING: return "operation pending";
+ case CHDERR_UNSUPPORTED_FORMAT: return "unsupported format";
+ case CHDERR_UNKNOWN_COMPRESSION: return "unknown compression type";
+ case CHDERR_WALKING_PARENT: return "currently examining parent";
+ case CHDERR_COMPRESSING: return "currently compressing";
+ default: return "undocumented error";
}
}
@@ -1474,10 +1474,10 @@ void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1)
// determine compression
switch (be_read(&rawheader[20], 4))
{
- case 0: m_compression[0] = CHD_CODEC_NONE; break;
- case 1: m_compression[0] = CHD_CODEC_ZLIB; break;
- case 2: m_compression[0] = CHD_CODEC_ZLIB; break;
- case 3: m_compression[0] = CHD_CODEC_AVHUFF; break;
+ case 0: m_compression[0] = CHD_CODEC_NONE; break;
+ case 1: m_compression[0] = CHD_CODEC_ZLIB; break;
+ case 2: m_compression[0] = CHD_CODEC_ZLIB; break;
+ case 3: m_compression[0] = CHD_CODEC_AVHUFF; break;
default: throw CHDERR_UNKNOWN_COMPRESSION;
}
m_compression[1] = m_compression[2] = m_compression[3] = CHD_CODEC_NONE;
@@ -1527,10 +1527,10 @@ void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1)
// determine compression
switch (be_read(&rawheader[20], 4))
{
- case 0: m_compression[0] = CHD_CODEC_NONE; break;
- case 1: m_compression[0] = CHD_CODEC_ZLIB; break;
- case 2: m_compression[0] = CHD_CODEC_ZLIB; break;
- case 3: m_compression[0] = CHD_CODEC_AVHUFF; break;
+ case 0: m_compression[0] = CHD_CODEC_NONE; break;
+ case 1: m_compression[0] = CHD_CODEC_ZLIB; break;
+ case 2: m_compression[0] = CHD_CODEC_ZLIB; break;
+ case 3: m_compression[0] = CHD_CODEC_AVHUFF; break;
default: throw CHDERR_UNKNOWN_COMPRESSION;
}
m_compression[1] = m_compression[2] = m_compression[3] = CHD_CODEC_NONE;
@@ -1787,7 +1787,7 @@ chd_error chd_file::compress_v5_map()
compressed[12] = lengthbits;
compressed[13] = selfbits;
compressed[14] = parentbits;
- compressed[15] = 0;
+ compressed[15] = 0;
// write the result
m_mapoffset = file_append(compressed, complen + 16);
@@ -2052,10 +2052,10 @@ chd_error chd_file::open_common(bool writeable)
sha1_t parentsha1 = sha1_t::null;
switch (m_version)
{
- case 3: parse_v3_header(rawheader, parentsha1); break;
- case 4: parse_v4_header(rawheader, parentsha1); break;
- case 5: parse_v5_header(rawheader, parentsha1); break;
- default: throw CHDERR_UNSUPPORTED_VERSION;
+ case 3: parse_v3_header(rawheader, parentsha1); break;
+ case 4: parse_v4_header(rawheader, parentsha1); break;
+ case 5: parse_v5_header(rawheader, parentsha1); break;
+ default: throw CHDERR_UNSUPPORTED_VERSION;
}
if (writeable && !m_allow_writes)
@@ -2335,14 +2335,14 @@ int CLIB_DECL chd_file::metadata_hash_compare(const void *elem1, const void *ele
chd_file_compressor::chd_file_compressor()
: m_walking_parent(false),
- m_total_in(0),
- m_total_out(0),
- m_read_queue(NULL),
- m_read_queue_offset(0),
- m_read_done_offset(0),
- m_read_error(false),
- m_work_queue(NULL),
- m_write_hunk(0)
+ m_total_in(0),
+ m_total_out(0),
+ m_read_queue(NULL),
+ m_read_queue_offset(0),
+ m_read_done_offset(0),
+ m_read_error(false),
+ m_work_queue(NULL),
+ m_write_hunk(0)
{
// zap arrays
memset(m_work_item, 0, sizeof(m_work_item));
diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h
index 67585f2f2ce..f1faa713495 100644
--- a/src/lib/util/chd.h
+++ b/src/lib/util/chd.h
@@ -221,9 +221,9 @@
//**************************************************************************
// pseudo-codecs returned by hunk_info
-const chd_codec_type CHD_CODEC_SELF = 1; // copy of another hunk
-const chd_codec_type CHD_CODEC_PARENT = 2; // copy of a parent's hunk
-const chd_codec_type CHD_CODEC_MINI = 3; // legacy "mini" 8-byte repeat
+const chd_codec_type CHD_CODEC_SELF = 1; // copy of another hunk
+const chd_codec_type CHD_CODEC_PARENT = 2; // copy of a parent's hunk
+const chd_codec_type CHD_CODEC_MINI = 3; // legacy "mini" 8-byte repeat
// core types
typedef UINT32 chd_metadata_tag;
@@ -233,7 +233,7 @@ const chd_metadata_tag CHDMETATAG_WILDCARD = 0;
const UINT32 CHDMETAINDEX_APPEND = ~0;
// metadata flags
-const UINT8 CHD_MDFLAGS_CHECKSUM = 0x01; // indicates data is checksummed
+const UINT8 CHD_MDFLAGS_CHECKSUM = 0x01; // indicates data is checksummed
// standard hard disk metadata
const chd_metadata_tag HARD_DISK_METADATA_TAG = CHD_MAKE_TAG('G','D','D','D');
@@ -428,42 +428,42 @@ private:
static int CLIB_DECL metadata_hash_compare(const void *elem1, const void *elem2);
// file characteristics
- core_file * m_file; // handle to the open core file
- bool m_owns_file; // flag indicating if this file should be closed on chd_close()
- bool m_allow_reads; // permit reads from this CHD?
- bool m_allow_writes; // permit writes to this CHD?
+ core_file * m_file; // handle to the open core file
+ bool m_owns_file; // flag indicating if this file should be closed on chd_close()
+ bool m_allow_reads; // permit reads from this CHD?
+ bool m_allow_writes; // permit writes to this CHD?
// core parameters from the header
- UINT32 m_version; // version of the header
- UINT64 m_logicalbytes; // logical size of the raw CHD data in bytes
- UINT64 m_mapoffset; // offset of map
- UINT64 m_metaoffset; // offset to first metadata bit
- UINT32 m_hunkbytes; // size of each raw hunk in bytes
- UINT32 m_hunkcount; // number of hunks represented
- UINT32 m_unitbytes; // size of each unit in bytes
- UINT64 m_unitcount; // number of units represented
- chd_codec_type m_compression[4]; // array of compression types used
- chd_file * m_parent; // pointer to parent file, or NULL if none
- bool m_parent_missing; // are we missing our parent?
+ UINT32 m_version; // version of the header
+ UINT64 m_logicalbytes; // logical size of the raw CHD data in bytes
+ UINT64 m_mapoffset; // offset of map
+ UINT64 m_metaoffset; // offset to first metadata bit
+ UINT32 m_hunkbytes; // size of each raw hunk in bytes
+ UINT32 m_hunkcount; // number of hunks represented
+ UINT32 m_unitbytes; // size of each unit in bytes
+ UINT64 m_unitcount; // number of units represented
+ chd_codec_type m_compression[4]; // array of compression types used
+ chd_file * m_parent; // pointer to parent file, or NULL if none
+ bool m_parent_missing; // are we missing our parent?
// key offsets within the header
- UINT64 m_mapoffset_offset; // offset of map offset field
- UINT64 m_metaoffset_offset;// offset of metaoffset field
- UINT64 m_sha1_offset; // offset of SHA1 field
- UINT64 m_rawsha1_offset; // offset of raw SHA1 field
- UINT64 m_parentsha1_offset;// offset of paren SHA1 field
+ UINT64 m_mapoffset_offset; // offset of map offset field
+ UINT64 m_metaoffset_offset;// offset of metaoffset field
+ UINT64 m_sha1_offset; // offset of SHA1 field
+ UINT64 m_rawsha1_offset; // offset of raw SHA1 field
+ UINT64 m_parentsha1_offset;// offset of paren SHA1 field
// map information
- UINT32 m_mapentrybytes; // length of each entry in a map
- dynamic_buffer m_rawmap; // raw map data
+ UINT32 m_mapentrybytes; // length of each entry in a map
+ dynamic_buffer m_rawmap; // raw map data
// compression management
- chd_decompressor * m_decompressor[4]; // array of decompression codecs
- dynamic_buffer m_compressed; // temporary buffer for compressed data
+ chd_decompressor * m_decompressor[4]; // array of decompression codecs
+ dynamic_buffer m_compressed; // temporary buffer for compressed data
// caching
- dynamic_buffer m_cache; // single-hunk cache for partial reads/writes
- UINT32 m_cachehunk; // which hunk is in the cache?
+ dynamic_buffer m_cache; // single-hunk cache for partial reads/writes
+ UINT32 m_cachehunk; // which hunk is in the cache?
};
@@ -505,9 +505,9 @@ private:
// internal entry
struct entry_t
{
- entry_t * m_next; // next entry in list
- UINT64 m_itemnum; // item number
- sha1_t m_sha1; // SHA-1 of the block
+ entry_t * m_next; // next entry in list
+ UINT64 m_itemnum; // item number
+ sha1_t m_sha1; // SHA-1 of the block
};
// block of entries
@@ -516,14 +516,14 @@ private:
entry_block(entry_block *prev)
: m_next(prev), m_nextalloc(0) { }
- entry_block * m_next; // next block in list
- UINT32 m_nextalloc; // next to be allocated
- entry_t m_array[16384]; // array of entries
+ entry_block * m_next; // next block in list
+ UINT32 m_nextalloc; // next to be allocated
+ entry_t m_array[16384]; // array of entries
};
// internal state
- entry_t * m_map[65536]; // map, hashed by CRC-16
- entry_block * m_block_list; // list of allocated blocks
+ entry_t * m_map[65536]; // map, hashed by CRC-16
+ entry_block * m_block_list; // list of allocated blocks
};
// status of a given work item
@@ -538,23 +538,23 @@ private:
// a CRC-16/SHA-1 pair
struct hash_pair
{
- crc16_t m_crc16; // calculated CRC-16
- sha1_t m_sha1; // calculated SHA-1
+ crc16_t m_crc16; // calculated CRC-16
+ sha1_t m_sha1; // calculated SHA-1
};
// a single work item
struct work_item
{
- osd_work_item * m_osd; // OSD work item running on this block
- chd_file_compressor *m_compressor; // pointer back to the compressor
- volatile work_status m_status; // current status of this item
- UINT32 m_hunknum; // number of the hunk we're working on
- UINT8 * m_data; // pointer to the data we are working on
- UINT8 * m_compressed; // pointer to the compressed data
- UINT32 m_complen; // compressed data length
- INT8 m_compression; // type of compression used
- chd_compressor_group *m_codecs; // codec instance
- dynamic_array<hash_pair> m_hash; // array of hashes
+ osd_work_item * m_osd; // OSD work item running on this block
+ chd_file_compressor *m_compressor; // pointer back to the compressor
+ volatile work_status m_status; // current status of this item
+ UINT32 m_hunknum; // number of the hunk we're working on
+ UINT8 * m_data; // pointer to the data we are working on
+ UINT8 * m_compressed; // pointer to the compressed data
+ UINT32 m_complen; // compressed data length
+ INT8 m_compression; // type of compression used
+ chd_compressor_group *m_codecs; // codec instance
+ dynamic_array<hash_pair> m_hash; // array of hashes
};
// internal helpers
@@ -566,31 +566,31 @@ private:
void async_read();
// current compression status
- bool m_walking_parent; // are we building the parent map?
- UINT64 m_total_in; // total bytes in
- UINT64 m_total_out; // total bytes out
- sha1_creator m_compsha1; // running SHA-1 on raw data
+ bool m_walking_parent; // are we building the parent map?
+ UINT64 m_total_in; // total bytes in
+ UINT64 m_total_out; // total bytes out
+ sha1_creator m_compsha1; // running SHA-1 on raw data
// hash lookup maps
- hashmap m_parent_map; // hash map for parent
- hashmap m_current_map; // hash map for current
+ hashmap m_parent_map; // hash map for parent
+ hashmap m_current_map; // hash map for current
// read I/O thread
- osd_work_queue * m_read_queue; // work queue for reading
- UINT64 m_read_queue_offset;// next offset to enqueue
- UINT64 m_read_done_offset; // next offset that will complete
- bool m_read_error; // error during reading?
+ osd_work_queue * m_read_queue; // work queue for reading
+ UINT64 m_read_queue_offset;// next offset to enqueue
+ UINT64 m_read_done_offset; // next offset that will complete
+ bool m_read_error; // error during reading?
// work item thread
static const int WORK_BUFFER_HUNKS = 256;
- osd_work_queue * m_work_queue; // queue for doing work on other threads
- dynamic_buffer m_work_buffer; // buffer containing hunk data to work on
- dynamic_buffer m_compressed_buffer;// buffer containing compressed data
- work_item m_work_item[WORK_BUFFER_HUNKS]; // status of each hunk
- chd_compressor_group * m_codecs[WORK_MAX_THREADS]; // codecs to use
+ osd_work_queue * m_work_queue; // queue for doing work on other threads
+ dynamic_buffer m_work_buffer; // buffer containing hunk data to work on
+ dynamic_buffer m_compressed_buffer;// buffer containing compressed data
+ work_item m_work_item[WORK_BUFFER_HUNKS]; // status of each hunk
+ chd_compressor_group * m_codecs[WORK_MAX_THREADS]; // codecs to use
// output state
- UINT32 m_write_hunk; // next hunk to write
+ UINT32 m_write_hunk; // next hunk to write
};
diff --git a/src/lib/util/chdcd.c b/src/lib/util/chdcd.c
index 3a6c272a22a..87985287caf 100644
--- a/src/lib/util/chdcd.c
+++ b/src/lib/util/chdcd.c
@@ -426,7 +426,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_
UINT32 size, mode;
UINT64 index0, index1, track_end;
- fseek(infile, 12, SEEK_CUR); // skip ISRC code
+ fseek(infile, 12, SEEK_CUR); // skip ISRC code
size = read_uint16(infile);
mode = read_uint16(infile);
fseek(infile, 2, SEEK_CUR);
@@ -442,42 +442,42 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_
switch (mode)
{
- case 0x0000: // 2048 byte data
+ case 0x0000: // 2048 byte data
outtoc.tracks[track-1].trktype = CD_TRACK_MODE1;
outinfo.track[track-1].swap = false;
break;
- case 0x0300: // Mode 2 Form 1
+ case 0x0300: // Mode 2 Form 1
printf("ERROR: Mode 2 Form 1 tracks not supported\n");
fclose(infile);
return CHDERR_UNSUPPORTED_FORMAT;
- case 0x0500: // raw data
+ case 0x0500: // raw data
printf("ERROR: Raw data tracks not supported\n");
fclose(infile);
return CHDERR_UNSUPPORTED_FORMAT;
- case 0x0600: // 2352 byte mode 2 raw
+ case 0x0600: // 2352 byte mode 2 raw
outtoc.tracks[track-1].trktype = CD_TRACK_MODE2_RAW;
outinfo.track[track-1].swap = false;
break;
- case 0x0700: // 2352 byte audio
+ case 0x0700: // 2352 byte audio
outtoc.tracks[track-1].trktype = CD_TRACK_AUDIO;
outinfo.track[track-1].swap = true;
break;
- case 0x0f00: // raw data with sub-channel
+ case 0x0f00: // raw data with sub-channel
printf("ERROR: Raw data tracks with sub-channel not supported\n");
fclose(infile);
return CHDERR_UNSUPPORTED_FORMAT;
- case 0x1000: // audio with sub-channel
+ case 0x1000: // audio with sub-channel
printf("ERROR: Audio tracks with sub-channel not supported\n");
fclose(infile);
return CHDERR_UNSUPPORTED_FORMAT;
- case 0x1100: // raw Mode 2 Form 1 with sub-channel
+ case 0x1100: // raw Mode 2 Form 1 with sub-channel
printf("ERROR: Raw Mode 2 Form 1 tracks with sub-channel not supported\n");
fclose(infile);
return CHDERR_UNSUPPORTED_FORMAT;
@@ -609,7 +609,7 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_
memset(&outtoc, 0, sizeof(outtoc));
outinfo.reset();
- outtoc.flags = CD_FLAG_GDROM;
+ outtoc.flags = CD_FLAG_GDROM;
fgets(linebuffer,511,infile);
numtracks=atoi(linebuffer);
@@ -630,7 +630,7 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_
outinfo.track[trknum].swap=false;
outinfo.track[trknum].offset=0;
- outtoc.tracks[trknum].datasize = 0;
+ outtoc.tracks[trknum].datasize = 0;
outtoc.tracks[trknum].subtype = CD_SUB_NONE;
outtoc.tracks[trknum].subsize = 0;
@@ -688,12 +688,12 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_
}
}
- #if 0
+ #if 0
for(i=0; i < numtracks; i++)
- {
- printf("%s %d %d %d (true %d)\n", outinfo.track[i].fname.cstr(), outtoc.tracks[i].frames, outtoc.tracks[i].padframes, outtoc.tracks[i].physframeofs, outtoc.tracks[i].frames - outtoc.tracks[i].padframes);
- }
- #endif
+ {
+ printf("%s %d %d %d (true %d)\n", outinfo.track[i].fname.cstr(), outtoc.tracks[i].frames, outtoc.tracks[i].padframes, outtoc.tracks[i].physframeofs, outtoc.tracks[i].frames - outtoc.tracks[i].padframes);
+ }
+ #endif
/* close the input TOC */
fclose(infile);
@@ -822,7 +822,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
cdrom_convert_subtype_string_to_track_info(token, &outtoc.tracks[trknum]);
}
- else if (!strcmp(token, "INDEX")) /* only in bin/cue files */
+ else if (!strcmp(token, "INDEX")) /* only in bin/cue files */
{
int idx, frames;
@@ -905,7 +905,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
outinfo.track[trknum].offset = outinfo.track[trknum-1].offset + outtoc.tracks[trknum-1].frames * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize);
outtoc.tracks[trknum].frames = (tlen - outinfo.track[trknum].offset) / (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize);
}
- else /* data files are different */
+ else /* data files are different */
{
tlen = get_file_size(outinfo.track[trknum].fname);
if (tlen == 0)
@@ -925,7 +925,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
{
outtoc.tracks[trknum].frames = outinfo.track[trknum+1].idx1offs - outinfo.track[trknum].idx1offs;
- if (trknum == 0) // track 0 offset is 0
+ if (trknum == 0) // track 0 offset is 0
{
outinfo.track[trknum].offset = 0;
}
@@ -940,7 +940,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
return CHDERR_INVALID_DATA;
}
}
- else /* data files are different */
+ else /* data files are different */
{
tlen = get_file_size(outinfo.track[trknum].fname);
if (tlen == 0)
@@ -969,13 +969,13 @@ chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
FILE *infile;
int i, trknum;
static char token[512];
- char tocftemp[512];
+ char tocftemp[512];
- strcpy(tocftemp, tocfname);
- for (i = 0; i < strlen(tocfname); i++)
- {
- tocftemp[i] = tolower(tocftemp[i]);
- }
+ strcpy(tocftemp, tocfname);
+ for (i = 0; i < strlen(tocfname); i++)
+ {
+ tocftemp[i] = tolower(tocftemp[i]);
+ }
if (strstr(tocftemp,".gdi"))
{
diff --git a/src/lib/util/chdcd.h b/src/lib/util/chdcd.h
index df799371603..d32fc6c0c73 100644
--- a/src/lib/util/chdcd.h
+++ b/src/lib/util/chdcd.h
@@ -19,9 +19,9 @@ struct chdcd_track_input_entry
chdcd_track_input_entry() { reset(); }
void reset() { fname.reset(); offset = idx0offs = idx1offs = 0; swap = false; }
- astring fname; // filename for each track
- UINT32 offset; // offset in the data file for each track
- bool swap; // data needs to be byte swapped
+ astring fname; // filename for each track
+ UINT32 offset; // offset in the data file for each track
+ bool swap; // data needs to be byte swapped
UINT32 idx0offs;
UINT32 idx1offs;
};
@@ -36,4 +36,4 @@ struct chdcd_track_input_info
chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo);
-#endif /* __CHDCD_H__ */
+#endif /* __CHDCD_H__ */
diff --git a/src/lib/util/chdcodec.c b/src/lib/util/chdcodec.c
index 1246791f89d..f3a3e13c0b3 100644
--- a/src/lib/util/chdcodec.c
+++ b/src/lib/util/chdcodec.c
@@ -79,7 +79,7 @@ private:
static void fast_free(voidpf opaque, voidpf address);
static const int MAX_ZLIB_ALLOCS = 64;
- UINT32 * m_allocptr[MAX_ZLIB_ALLOCS];
+ UINT32 * m_allocptr[MAX_ZLIB_ALLOCS];
};
@@ -98,8 +98,8 @@ public:
private:
// internal state
- z_stream m_deflater;
- chd_zlib_allocator m_allocator;
+ z_stream m_deflater;
+ chd_zlib_allocator m_allocator;
};
@@ -118,8 +118,8 @@ public:
private:
// internal state
- z_stream m_inflater;
- chd_zlib_allocator m_allocator;
+ z_stream m_inflater;
+ chd_zlib_allocator m_allocator;
};
@@ -139,7 +139,7 @@ private:
static void fast_free(void *p, void *address);
static const int MAX_LZMA_ALLOCS = 64;
- UINT32 * m_allocptr[MAX_LZMA_ALLOCS];
+ UINT32 * m_allocptr[MAX_LZMA_ALLOCS];
};
@@ -161,8 +161,8 @@ public:
private:
// internal state
- CLzmaEncProps m_props;
- chd_lzma_allocator m_allocator;
+ CLzmaEncProps m_props;
+ chd_lzma_allocator m_allocator;
};
@@ -181,8 +181,8 @@ public:
private:
// internal state
- CLzmaDec m_decoder;
- chd_lzma_allocator m_allocator;
+ CLzmaDec m_decoder;
+ chd_lzma_allocator m_allocator;
};
@@ -200,7 +200,7 @@ public:
private:
// internal state
- huffman_8bit_encoder m_encoder;
+ huffman_8bit_encoder m_encoder;
};
@@ -218,7 +218,7 @@ public:
private:
// internal state
- huffman_8bit_decoder m_decoder;
+ huffman_8bit_decoder m_decoder;
};
@@ -239,8 +239,8 @@ public:
private:
// internal state
- bool m_big_endian;
- flac_encoder m_encoder;
+ bool m_big_endian;
+ flac_encoder m_encoder;
};
@@ -258,8 +258,8 @@ public:
private:
// internal state
- bool m_big_endian;
- flac_decoder m_decoder;
+ bool m_big_endian;
+ flac_decoder m_decoder;
};
@@ -281,11 +281,11 @@ public:
private:
// internal state
- bool m_swap_endian;
- flac_encoder m_encoder;
- z_stream m_deflater;
- chd_zlib_allocator m_allocator;
- dynamic_buffer m_buffer;
+ bool m_swap_endian;
+ flac_encoder m_encoder;
+ z_stream m_deflater;
+ chd_zlib_allocator m_allocator;
+ dynamic_buffer m_buffer;
};
@@ -304,11 +304,11 @@ public:
private:
// internal state
- bool m_swap_endian;
- flac_decoder m_decoder;
- z_stream m_inflater;
- chd_zlib_allocator m_allocator;
- dynamic_buffer m_buffer;
+ bool m_swap_endian;
+ flac_decoder m_decoder;
+ z_stream m_inflater;
+ chd_zlib_allocator m_allocator;
+ dynamic_buffer m_buffer;
};
@@ -321,9 +321,9 @@ public:
// construction/destruction
chd_cd_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy),
- m_base_compressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SECTOR_DATA, lossy),
- m_subcode_compressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SUBCODE_DATA, lossy),
- m_buffer(hunkbytes + (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SUBCODE_DATA)
+ m_base_compressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SECTOR_DATA, lossy),
+ m_subcode_compressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SUBCODE_DATA, lossy),
+ m_buffer(hunkbytes + (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SUBCODE_DATA)
{
// make sure the CHD's hunk size is an even multiple of the frame size
if (hunkbytes % CD_FRAME_SIZE != 0)
@@ -375,9 +375,9 @@ public:
private:
// internal state
- _BaseCompressor m_base_compressor;
- _SubcodeCompressor m_subcode_compressor;
- dynamic_buffer m_buffer;
+ _BaseCompressor m_base_compressor;
+ _SubcodeCompressor m_subcode_compressor;
+ dynamic_buffer m_buffer;
};
@@ -390,9 +390,9 @@ public:
// construction/destruction
chd_cd_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
: chd_decompressor(chd, hunkbytes, lossy),
- m_base_decompressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SECTOR_DATA, lossy),
- m_subcode_decompressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SUBCODE_DATA, lossy),
- m_buffer(hunkbytes)
+ m_base_decompressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SECTOR_DATA, lossy),
+ m_subcode_decompressor(chd, (hunkbytes / CD_FRAME_SIZE) * CD_MAX_SUBCODE_DATA, lossy),
+ m_buffer(hunkbytes)
{
// make sure the CHD's hunk size is an even multiple of the frame size
if (hunkbytes % CD_FRAME_SIZE != 0)
@@ -435,9 +435,9 @@ public:
private:
// internal state
- _BaseDecompressor m_base_decompressor;
+ _BaseDecompressor m_base_decompressor;
_SubcodeDecompressor m_subcode_decompressor;
- dynamic_buffer m_buffer;
+ dynamic_buffer m_buffer;
};
@@ -458,8 +458,8 @@ private:
void postinit();
// internal state
- avhuff_encoder m_encoder;
- bool m_postinit;
+ avhuff_encoder m_encoder;
+ bool m_postinit;
};
@@ -478,7 +478,7 @@ public:
private:
// internal state
- avhuff_decoder m_decoder;
+ avhuff_decoder m_decoder;
};
@@ -491,18 +491,18 @@ private:
const chd_codec_list::codec_entry chd_codec_list::s_codec_list[] =
{
// general codecs
- { CHD_CODEC_ZLIB, false, "Deflate", &chd_codec_list::construct_compressor<chd_zlib_compressor>, &chd_codec_list::construct_decompressor<chd_zlib_decompressor> },
- { CHD_CODEC_LZMA, false, "LZMA", &chd_codec_list::construct_compressor<chd_lzma_compressor>, &chd_codec_list::construct_decompressor<chd_lzma_decompressor> },
- { CHD_CODEC_HUFFMAN, false, "Huffman", &chd_codec_list::construct_compressor<chd_huffman_compressor>, &chd_codec_list::construct_decompressor<chd_huffman_decompressor> },
- { CHD_CODEC_FLAC, false, "FLAC", &chd_codec_list::construct_compressor<chd_flac_compressor>, &chd_codec_list::construct_decompressor<chd_flac_decompressor> },
+ { CHD_CODEC_ZLIB, false, "Deflate", &chd_codec_list::construct_compressor<chd_zlib_compressor>, &chd_codec_list::construct_decompressor<chd_zlib_decompressor> },
+ { CHD_CODEC_LZMA, false, "LZMA", &chd_codec_list::construct_compressor<chd_lzma_compressor>, &chd_codec_list::construct_decompressor<chd_lzma_decompressor> },
+ { CHD_CODEC_HUFFMAN, false, "Huffman", &chd_codec_list::construct_compressor<chd_huffman_compressor>, &chd_codec_list::construct_decompressor<chd_huffman_decompressor> },
+ { CHD_CODEC_FLAC, false, "FLAC", &chd_codec_list::construct_compressor<chd_flac_compressor>, &chd_codec_list::construct_decompressor<chd_flac_decompressor> },
// general codecs with CD frontend
- { CHD_CODEC_CD_ZLIB, false, "CD Deflate", &chd_codec_list::construct_compressor<chd_cd_compressor<chd_zlib_compressor, chd_zlib_compressor> >, &chd_codec_list::construct_decompressor<chd_cd_decompressor<chd_zlib_decompressor, chd_zlib_decompressor> > },
- { CHD_CODEC_CD_LZMA, false, "CD LZMA", &chd_codec_list::construct_compressor<chd_cd_compressor<chd_lzma_compressor, chd_zlib_compressor> >, &chd_codec_list::construct_decompressor<chd_cd_decompressor<chd_lzma_decompressor, chd_zlib_decompressor> > },
- { CHD_CODEC_CD_FLAC, false, "CD FLAC", &chd_codec_list::construct_compressor<chd_cd_flac_compressor>, &chd_codec_list::construct_decompressor<chd_cd_flac_decompressor> },
+ { CHD_CODEC_CD_ZLIB, false, "CD Deflate", &chd_codec_list::construct_compressor<chd_cd_compressor<chd_zlib_compressor, chd_zlib_compressor> >, &chd_codec_list::construct_decompressor<chd_cd_decompressor<chd_zlib_decompressor, chd_zlib_decompressor> > },
+ { CHD_CODEC_CD_LZMA, false, "CD LZMA", &chd_codec_list::construct_compressor<chd_cd_compressor<chd_lzma_compressor, chd_zlib_compressor> >, &chd_codec_list::construct_decompressor<chd_cd_decompressor<chd_lzma_decompressor, chd_zlib_decompressor> > },
+ { CHD_CODEC_CD_FLAC, false, "CD FLAC", &chd_codec_list::construct_compressor<chd_cd_flac_compressor>, &chd_codec_list::construct_decompressor<chd_cd_flac_decompressor> },
// A/V codecs
- { CHD_CODEC_AVHUFF, false, "A/V Huffman", &chd_codec_list::construct_compressor<chd_avhuff_compressor>, &chd_codec_list::construct_decompressor<chd_avhuff_decompressor> },
+ { CHD_CODEC_AVHUFF, false, "A/V Huffman", &chd_codec_list::construct_compressor<chd_avhuff_compressor>, &chd_codec_list::construct_decompressor<chd_avhuff_decompressor> },
};
@@ -517,8 +517,8 @@ const chd_codec_list::codec_entry chd_codec_list::s_codec_list[] =
chd_codec::chd_codec(chd_file &chd, UINT32 hunkbytes, bool lossy)
: m_chd(chd),
- m_hunkbytes(hunkbytes),
- m_lossy(lossy)
+ m_hunkbytes(hunkbytes),
+ m_lossy(lossy)
{
}
@@ -643,9 +643,9 @@ const chd_codec_list::codec_entry *chd_codec_list::find_in_list(chd_codec_type t
chd_compressor_group::chd_compressor_group(chd_file &chd, UINT32 compressor_list[4])
: m_hunkbytes(chd.hunk_bytes()),
- m_compress_test(m_hunkbytes)
+ m_compress_test(m_hunkbytes)
#if CHDCODEC_VERIFY_COMPRESSION
- ,m_decompressed(m_hunkbytes)
+ ,m_decompressed(m_hunkbytes)
#endif
{
// verify the compression types and initialize the codecs
@@ -853,7 +853,7 @@ chd_zlib_compressor::chd_zlib_compressor(chd_file &chd, UINT32 hunkbytes, bool l
: chd_compressor(chd, hunkbytes, lossy)
{
// initialize the deflater
- m_deflater.next_in = (Bytef *)this; // bogus, but that's ok
+ m_deflater.next_in = (Bytef *)this; // bogus, but that's ok
m_deflater.avail_in = 0;
m_allocator.install(m_deflater);
int zerr = deflateInit2(&m_deflater, Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY);
@@ -918,7 +918,7 @@ chd_zlib_decompressor::chd_zlib_decompressor(chd_file &chd, UINT32 hunkbytes, bo
: chd_decompressor(chd, hunkbytes, lossy)
{
// init the inflater
- m_inflater.next_in = (Bytef *)this; // bogus, but that's ok
+ m_inflater.next_in = (Bytef *)this; // bogus, but that's ok
m_inflater.avail_in = 0;
m_allocator.install(m_inflater);
int zerr = inflateInit2(&m_inflater, -MAX_WBITS);
@@ -1394,7 +1394,7 @@ void chd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *
chd_cd_flac_compressor::chd_cd_flac_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy),
- m_buffer(hunkbytes)
+ m_buffer(hunkbytes)
{
// make sure the CHD's hunk size is an even multiple of the frame size
if (hunkbytes % CD_FRAME_SIZE != 0)
@@ -1412,7 +1412,7 @@ chd_cd_flac_compressor::chd_cd_flac_compressor(chd_file &chd, UINT32 hunkbytes,
m_encoder.set_strip_metadata(true);
// initialize the deflater
- m_deflater.next_in = (Bytef *)this; // bogus, but that's ok
+ m_deflater.next_in = (Bytef *)this; // bogus, but that's ok
m_deflater.avail_in = 0;
m_allocator.install(m_deflater);
int zerr = deflateInit2(&m_deflater, Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY);
@@ -1506,7 +1506,7 @@ UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes)
chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
: chd_decompressor(chd, hunkbytes, lossy),
- m_buffer(hunkbytes)
+ m_buffer(hunkbytes)
{
// make sure the CHD's hunk size is an even multiple of the frame size
if (hunkbytes % CD_FRAME_SIZE != 0)
@@ -1518,7 +1518,7 @@ chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbyt
m_swap_endian = (native_endian == 1);
// init the inflater
- m_inflater.next_in = (Bytef *)this; // bogus, but that's ok
+ m_inflater.next_in = (Bytef *)this; // bogus, but that's ok
m_inflater.avail_in = 0;
m_allocator.install(m_inflater);
int zerr = inflateInit2(&m_inflater, -MAX_WBITS);
@@ -1595,7 +1595,7 @@ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT
chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy)
: chd_compressor(chd, hunkbytes, lossy),
- m_postinit(false)
+ m_postinit(false)
{
try
{
diff --git a/src/lib/util/chdcodec.h b/src/lib/util/chdcodec.h
index a8d6f5382e8..21def8a3337 100644
--- a/src/lib/util/chdcodec.h
+++ b/src/lib/util/chdcodec.h
@@ -52,7 +52,7 @@
// MACROS
//**************************************************************************
-#define CHD_MAKE_TAG(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
+#define CHD_MAKE_TAG(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
@@ -90,9 +90,9 @@ public:
private:
// internal state
- chd_file & m_chd;
- UINT32 m_hunkbytes;
- bool m_lossy;
+ chd_file & m_chd;
+ UINT32 m_hunkbytes;
+ bool m_lossy;
};
@@ -144,11 +144,11 @@ private:
// an entry in the list
struct codec_entry
{
- chd_codec_type m_type;
- bool m_lossy;
- const char * m_name;
- chd_compressor * (*m_construct_compressor)(chd_file &, UINT32, bool);
- chd_decompressor * (*m_construct_decompressor)(chd_file &, UINT32, bool);
+ chd_codec_type m_type;
+ bool m_lossy;
+ const char * m_name;
+ chd_compressor * (*m_construct_compressor)(chd_file &, UINT32, bool);
+ chd_decompressor * (*m_construct_decompressor)(chd_file &, UINT32, bool);
};
// internal helper functions
@@ -180,12 +180,12 @@ public:
private:
// internal state
- UINT32 m_hunkbytes; // number of bytes in a hunk
- chd_compressor * m_compressor[4]; // array of active codecs
- dynamic_buffer m_compress_test; // test buffer for compression
+ UINT32 m_hunkbytes; // number of bytes in a hunk
+ chd_compressor * m_compressor[4]; // array of active codecs
+ dynamic_buffer m_compress_test; // test buffer for compression
#if CHDCODEC_VERIFY_COMPRESSION
- chd_decompressor * m_decompressor[4]; // array of active codecs
- dynamic_buffer m_decompressed; // verification buffer
+ chd_decompressor * m_decompressor[4]; // array of active codecs
+ dynamic_buffer m_decompressed; // verification buffer
#endif
};
@@ -196,21 +196,21 @@ private:
//**************************************************************************
// currently-defined codecs
-const chd_codec_type CHD_CODEC_NONE = 0;
+const chd_codec_type CHD_CODEC_NONE = 0;
// general codecs
-const chd_codec_type CHD_CODEC_ZLIB = CHD_MAKE_TAG('z','l','i','b');
-const chd_codec_type CHD_CODEC_LZMA = CHD_MAKE_TAG('l','z','m','a');
-const chd_codec_type CHD_CODEC_HUFFMAN = CHD_MAKE_TAG('h','u','f','f');
-const chd_codec_type CHD_CODEC_FLAC = CHD_MAKE_TAG('f','l','a','c');
+const chd_codec_type CHD_CODEC_ZLIB = CHD_MAKE_TAG('z','l','i','b');
+const chd_codec_type CHD_CODEC_LZMA = CHD_MAKE_TAG('l','z','m','a');
+const chd_codec_type CHD_CODEC_HUFFMAN = CHD_MAKE_TAG('h','u','f','f');
+const chd_codec_type CHD_CODEC_FLAC = CHD_MAKE_TAG('f','l','a','c');
// general codecs with CD frontend
-const chd_codec_type CHD_CODEC_CD_ZLIB = CHD_MAKE_TAG('c','d','z','l');
-const chd_codec_type CHD_CODEC_CD_LZMA = CHD_MAKE_TAG('c','d','l','z');
-const chd_codec_type CHD_CODEC_CD_FLAC = CHD_MAKE_TAG('c','d','f','l');
+const chd_codec_type CHD_CODEC_CD_ZLIB = CHD_MAKE_TAG('c','d','z','l');
+const chd_codec_type CHD_CODEC_CD_LZMA = CHD_MAKE_TAG('c','d','l','z');
+const chd_codec_type CHD_CODEC_CD_FLAC = CHD_MAKE_TAG('c','d','f','l');
// A/V codecs
-const chd_codec_type CHD_CODEC_AVHUFF = CHD_MAKE_TAG('a','v','h','u');
+const chd_codec_type CHD_CODEC_AVHUFF = CHD_MAKE_TAG('a','v','h','u');
// A/V codec configuration parameters
enum
diff --git a/src/lib/util/corefile.c b/src/lib/util/corefile.c
index cf154c3c529..f09716dc26d 100644
--- a/src/lib/util/corefile.c
+++ b/src/lib/util/corefile.c
@@ -60,9 +60,9 @@
CONSTANTS
***************************************************************************/
-#define FILE_BUFFER_SIZE 512
+#define FILE_BUFFER_SIZE 512
-#define OPEN_FLAG_HAS_CRC 0x10000
+#define OPEN_FLAG_HAS_CRC 0x10000
@@ -72,40 +72,40 @@
enum text_file_type
{
- TFT_OSD = 0, /* OSD depdendent encoding format used when BOMs missing */
- TFT_UTF8, /* UTF-8 */
- TFT_UTF16BE, /* UTF-16 (big endian) */
- TFT_UTF16LE, /* UTF-16 (little endian) */
- TFT_UTF32BE, /* UTF-32 (UCS-4) (big endian) */
- TFT_UTF32LE /* UTF-32 (UCS-4) (little endian) */
+ TFT_OSD = 0, /* OSD depdendent encoding format used when BOMs missing */
+ TFT_UTF8, /* UTF-8 */
+ TFT_UTF16BE, /* UTF-16 (big endian) */
+ TFT_UTF16LE, /* UTF-16 (little endian) */
+ TFT_UTF32BE, /* UTF-32 (UCS-4) (big endian) */
+ TFT_UTF32LE /* UTF-32 (UCS-4) (little endian) */
};
struct zlib_data
{
- z_stream stream;
- UINT8 buffer[1024];
- UINT64 realoffset;
- UINT64 nextoffset;
+ z_stream stream;
+ UINT8 buffer[1024];
+ UINT64 realoffset;
+ UINT64 nextoffset;
};
struct core_file
{
- osd_file * file; /* OSD file handle */
- zlib_data * zdata; /* compression data */
- UINT32 openflags; /* flags we were opened with */
- UINT8 data_allocated; /* was the data allocated by us? */
- UINT8 * data; /* file data, if RAM-based */
- UINT64 offset; /* current file offset */
- UINT64 length; /* total file length */
- text_file_type text_type; /* text output format */
- char back_chars[UTF8_CHAR_MAX]; /* buffer to hold characters for ungetc */
- int back_char_head; /* head of ungetc buffer */
- int back_char_tail; /* tail of ungetc buffer */
- UINT64 bufferbase; /* base offset of internal buffer */
- UINT32 bufferbytes; /* bytes currently loaded into buffer */
- UINT8 buffer[FILE_BUFFER_SIZE]; /* buffer data */
+ osd_file * file; /* OSD file handle */
+ zlib_data * zdata; /* compression data */
+ UINT32 openflags; /* flags we were opened with */
+ UINT8 data_allocated; /* was the data allocated by us? */
+ UINT8 * data; /* file data, if RAM-based */
+ UINT64 offset; /* current file offset */
+ UINT64 length; /* total file length */
+ text_file_type text_type; /* text output format */
+ char back_chars[UTF8_CHAR_MAX]; /* buffer to hold characters for ungetc */
+ int back_char_head; /* head of ungetc buffer */
+ int back_char_tail; /* tail of ungetc buffer */
+ UINT64 bufferbase; /* base offset of internal buffer */
+ UINT32 bufferbytes; /* bytes currently loaded into buffer */
+ UINT8 buffer[FILE_BUFFER_SIZE]; /* buffer data */
};
@@ -847,11 +847,11 @@ int core_fputs(core_file *f, const char *s)
{
if (*s == '\n')
{
- if (CRLF == 1) /* CR only */
+ if (CRLF == 1) /* CR only */
*pconvbuf++ = 13;
- else if (CRLF == 2) /* LF only */
+ else if (CRLF == 2) /* LF only */
*pconvbuf++ = 10;
- else if (CRLF == 3) /* CR+LF */
+ else if (CRLF == 3) /* CR+LF */
{
*pconvbuf++ = 13;
*pconvbuf++ = 10;
@@ -1079,5 +1079,3 @@ static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64
file->zdata->nextoffset += *actual;
return FILERR_NONE;
}
-
-
diff --git a/src/lib/util/corefile.h b/src/lib/util/corefile.h
index 79ec9518cac..c2790930675 100644
--- a/src/lib/util/corefile.h
+++ b/src/lib/util/corefile.h
@@ -53,12 +53,12 @@
ADDITIONAL OPEN FLAGS
***************************************************************************/
-#define OPEN_FLAG_NO_BOM 0x0100 /* don't output BOM */
+#define OPEN_FLAG_NO_BOM 0x0100 /* don't output BOM */
-#define FCOMPRESS_NONE 0 /* no compression */
-#define FCOMPRESS_MIN 1 /* minimal compression */
-#define FCOMPRESS_MEDIUM 6 /* standard compression */
-#define FCOMPRESS_MAX 9 /* maximum compression */
+#define FCOMPRESS_NONE 0 /* no compression */
+#define FCOMPRESS_MIN 1 /* minimal compression */
+#define FCOMPRESS_MEDIUM 6 /* standard compression */
+#define FCOMPRESS_MAX 9 /* maximum compression */
@@ -157,4 +157,4 @@ astring &core_filename_extract_base(astring &result, const char *name, bool stri
int core_filename_ends_with(const char *filename, const char *extension);
-#endif /* __COREFILE_H__ */
+#endif /* __COREFILE_H__ */
diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h
index 30d181edae6..d922506439f 100644
--- a/src/lib/util/coretmpl.h
+++ b/src/lib/util/coretmpl.h
@@ -61,8 +61,8 @@ public:
// construction/destruction
dynamic_array(int initial = 0)
: m_array(NULL),
- m_count(0),
- m_allocated(0) { if (initial != 0) expand_internal(initial); m_count = initial; }
+ m_count(0),
+ m_allocated(0) { if (initial != 0) expand_internal(initial); m_count = initial; }
virtual ~dynamic_array() { reset(); }
// operators
@@ -94,9 +94,9 @@ private:
}
// internal state
- _ElementType * m_array; // allocated array
- int m_count; // number of objects accessed in the list
- int m_allocated; // amount of space allocated for the array
+ _ElementType * m_array; // allocated array
+ int m_count; // number of objects accessed in the list
+ int m_allocated; // amount of space allocated for the array
};
diff --git a/src/lib/util/flac.c b/src/lib/util/flac.c
index 817e39047d9..ee38d451f5c 100644
--- a/src/lib/util/flac.c
+++ b/src/lib/util/flac.c
@@ -305,12 +305,12 @@ FLAC__StreamEncoderWriteStatus flac_encoder::write_callback(const FLAC__byte buf
flac_decoder::flac_decoder()
: m_decoder(FLAC__stream_decoder_new()),
- m_file(NULL),
- m_compressed_offset(0),
- m_compressed_start(NULL),
- m_compressed_length(0),
- m_compressed2_start(NULL),
- m_compressed2_length(0)
+ m_file(NULL),
+ m_compressed_offset(0),
+ m_compressed_start(NULL),
+ m_compressed_length(0),
+ m_compressed2_start(NULL),
+ m_compressed2_length(0)
{
}
@@ -321,12 +321,12 @@ flac_decoder::flac_decoder()
flac_decoder::flac_decoder(const void *buffer, UINT32 length, const void *buffer2, UINT32 length2)
: m_decoder(FLAC__stream_decoder_new()),
- m_file(NULL),
- m_compressed_offset(0),
- m_compressed_start(reinterpret_cast<const FLAC__byte *>(buffer)),
- m_compressed_length(length),
- m_compressed2_start(reinterpret_cast<const FLAC__byte *>(buffer2)),
- m_compressed2_length(length2)
+ m_file(NULL),
+ m_compressed_offset(0),
+ m_compressed_start(reinterpret_cast<const FLAC__byte *>(buffer)),
+ m_compressed_length(length),
+ m_compressed2_start(reinterpret_cast<const FLAC__byte *>(buffer2)),
+ m_compressed2_length(length2)
{
reset();
}
@@ -338,12 +338,12 @@ flac_decoder::flac_decoder(const void *buffer, UINT32 length, const void *buffer
flac_decoder::flac_decoder(core_file &file)
: m_decoder(FLAC__stream_decoder_new()),
- m_file(&file),
- m_compressed_offset(0),
- m_compressed_start(NULL),
- m_compressed_length(0),
- m_compressed2_start(NULL),
- m_compressed2_length(0)
+ m_file(&file),
+ m_compressed_offset(0),
+ m_compressed_start(NULL),
+ m_compressed_length(0),
+ m_compressed2_start(NULL),
+ m_compressed2_length(0)
{
reset();
}
@@ -406,19 +406,19 @@ bool flac_decoder::reset(UINT32 sample_rate, UINT8 num_channels, UINT32 block_si
// modify the template header with our parameters
static const UINT8 s_header_template[0x2a] =
{
- 0x66, 0x4C, 0x61, 0x43, // +00: 'fLaC' stream header
- 0x80, // +04: metadata block type 0 (STREAMINFO),
+ 0x66, 0x4C, 0x61, 0x43, // +00: 'fLaC' stream header
+ 0x80, // +04: metadata block type 0 (STREAMINFO),
// flagged as last block
- 0x00, 0x00, 0x22, // +05: metadata block length = 0x22
- 0x00, 0x00, // +08: minimum block size
- 0x00, 0x00, // +0A: maximum block size
- 0x00, 0x00, 0x00, // +0C: minimum frame size (0 == unknown)
- 0x00, 0x00, 0x00, // +0F: maximum frame size (0 == unknown)
+ 0x00, 0x00, 0x22, // +05: metadata block length = 0x22
+ 0x00, 0x00, // +08: minimum block size
+ 0x00, 0x00, // +0A: maximum block size
+ 0x00, 0x00, 0x00, // +0C: minimum frame size (0 == unknown)
+ 0x00, 0x00, 0x00, // +0F: maximum frame size (0 == unknown)
0x0A, 0xC4, 0x42, 0xF0, 0x00, 0x00, 0x00, 0x00, // +12: sample rate (0x0ac44 == 44100),
// numchannels (2), sample bits (16),
// samples in stream (0 == unknown)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +1A: MD5 signature (0 == none)
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 //
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 //
// +2A: start of stream data
};
memcpy(m_custom_header, s_header_template, sizeof(s_header_template));
diff --git a/src/lib/util/flac.h b/src/lib/util/flac.h
index f379d52521f..888f4226636 100644
--- a/src/lib/util/flac.h
+++ b/src/lib/util/flac.h
@@ -96,21 +96,21 @@ private:
FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame);
// internal state
- FLAC__StreamEncoder * m_encoder; // actual encoder
- core_file * m_file; // output file
- UINT32 m_compressed_offset; // current offset with the compressed stream
- FLAC__byte * m_compressed_start; // start of compressed data
- UINT32 m_compressed_length; // length of the compressed stream
+ FLAC__StreamEncoder * m_encoder; // actual encoder
+ core_file * m_file; // output file
+ UINT32 m_compressed_offset; // current offset with the compressed stream
+ FLAC__byte * m_compressed_start; // start of compressed data
+ UINT32 m_compressed_length; // length of the compressed stream
// parameters
- UINT32 m_sample_rate; // sample rate
- UINT8 m_channels; // number of channels
- UINT32 m_block_size; // block size
+ UINT32 m_sample_rate; // sample rate
+ UINT8 m_channels; // number of channels
+ UINT32 m_block_size; // block size
// header stripping
- bool m_strip_metadata; // strip the the metadata?
- UINT32 m_ignore_bytes; // how many bytes to ignore when writing
- bool m_found_audio; // have we hit the audio yet?
+ bool m_strip_metadata; // strip the the metadata?
+ UINT32 m_ignore_bytes; // how many bytes to ignore when writing
+ bool m_found_audio; // have we hit the audio yet?
};
@@ -157,21 +157,21 @@ private:
static void error_callback_static(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
// output state
- FLAC__StreamDecoder * m_decoder; // actual encoder
- core_file * m_file; // output file
- UINT32 m_sample_rate; // decoded sample rate
- UINT8 m_channels; // decoded number of channels
- UINT8 m_bits_per_sample; // decoded bits per sample
- UINT32 m_compressed_offset; // current offset in compressed data
- const FLAC__byte * m_compressed_start; // start of compressed data
- UINT32 m_compressed_length; // length of compressed data
- const FLAC__byte * m_compressed2_start; // start of compressed data
- UINT32 m_compressed2_length; // length of compressed data
- INT16 * m_uncompressed_start[8];// pointer to start of uncompressed data (up to 8 streams)
- UINT32 m_uncompressed_offset; // current position in uncompressed data
- UINT32 m_uncompressed_length; // length of uncompressed data
- bool m_uncompressed_swap; // swap uncompressed sample data
- UINT8 m_custom_header[0x2a]; // custom header
+ FLAC__StreamDecoder * m_decoder; // actual encoder
+ core_file * m_file; // output file
+ UINT32 m_sample_rate; // decoded sample rate
+ UINT8 m_channels; // decoded number of channels
+ UINT8 m_bits_per_sample; // decoded bits per sample
+ UINT32 m_compressed_offset; // current offset in compressed data
+ const FLAC__byte * m_compressed_start; // start of compressed data
+ UINT32 m_compressed_length; // length of compressed data
+ const FLAC__byte * m_compressed2_start; // start of compressed data
+ UINT32 m_compressed2_length; // length of compressed data
+ INT16 * m_uncompressed_start[8];// pointer to start of uncompressed data (up to 8 streams)
+ UINT32 m_uncompressed_offset; // current position in uncompressed data
+ UINT32 m_uncompressed_length; // length of uncompressed data
+ bool m_uncompressed_swap; // swap uncompressed sample data
+ UINT8 m_custom_header[0x2a]; // custom header
};
diff --git a/src/lib/util/harddisk.c b/src/lib/util/harddisk.c
index 64af494405a..49c829f4214 100644
--- a/src/lib/util/harddisk.c
+++ b/src/lib/util/harddisk.c
@@ -48,8 +48,8 @@
struct hard_disk_file
{
- chd_file * chd; /* CHD file */
- hard_disk_info info; /* hard disk info */
+ chd_file * chd; /* CHD file */
+ hard_disk_info info; /* hard disk info */
};
diff --git a/src/lib/util/harddisk.h b/src/lib/util/harddisk.h
index 09351be9072..820a7a27e9e 100644
--- a/src/lib/util/harddisk.h
+++ b/src/lib/util/harddisk.h
@@ -54,10 +54,10 @@ struct hard_disk_file;
struct hard_disk_info
{
- UINT32 cylinders;
- UINT32 heads;
- UINT32 sectors;
- UINT32 sectorbytes;
+ UINT32 cylinders;
+ UINT32 heads;
+ UINT32 sectors;
+ UINT32 sectorbytes;
};
@@ -75,4 +75,4 @@ hard_disk_info *hard_disk_get_info(hard_disk_file *file);
UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer);
UINT32 hard_disk_write(hard_disk_file *file, UINT32 lbasector, const void *buffer);
-#endif /* __HARDDISK_H__ */
+#endif /* __HARDDISK_H__ */
diff --git a/src/lib/util/hashing.c b/src/lib/util/hashing.c
index 618750b1946..6519dd40049 100644
--- a/src/lib/util/hashing.c
+++ b/src/lib/util/hashing.c
@@ -262,39 +262,39 @@ void crc16_creator::append(const void *data, UINT32 length)
{
static const UINT16 s_table[256] =
{
- 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
- 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
- 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
- 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
- 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
- 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
- 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
- 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
- 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
- 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
- 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
- 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
- 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
- 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
- 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
- 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
- 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
- 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
- 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
- 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
- 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
- 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
- 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
- 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
- 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
- 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
- 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
- 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
- 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
- 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
- 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
- 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
- };
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
+ 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
+ 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
+ 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
+ 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
+ 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
+ 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
+ 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
+ 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
+ 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
+ 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
+ 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
+ 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
+ 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
+ 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
+ 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
+ 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
+ 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
+ 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
+ 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
+ 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
+ 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
+ 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
+ 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
+ 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
+ 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
+ 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
+ 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
+ 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
+ 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
+ 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
+ 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
+ };
const UINT8 *src = reinterpret_cast<const UINT8 *>(data);
diff --git a/src/lib/util/hashing.h b/src/lib/util/hashing.h
index cebaba95b18..6ab0b652af9 100644
--- a/src/lib/util/hashing.h
+++ b/src/lib/util/hashing.h
@@ -99,7 +99,7 @@ public:
protected:
// internal state
- struct sha1_ctx m_context; // internal context
+ struct sha1_ctx m_context; // internal context
};
@@ -149,7 +149,7 @@ public:
protected:
// internal state
- struct MD5Context m_context; // internal context
+ struct MD5Context m_context; // internal context
};
@@ -195,7 +195,7 @@ public:
protected:
// internal state
- crc32_t m_accum; // internal accumulator
+ crc32_t m_accum; // internal accumulator
};
@@ -241,7 +241,7 @@ public:
protected:
// internal state
- crc16_t m_accum; // internal accumulator
+ crc16_t m_accum; // internal accumulator
};
diff --git a/src/lib/util/huffman.c b/src/lib/util/huffman.c
index 60120bbdf32..d4bc29deec5 100644
--- a/src/lib/util/huffman.c
+++ b/src/lib/util/huffman.c
@@ -136,7 +136,7 @@
// MACROS
//**************************************************************************
-#define MAKE_LOOKUP(code,bits) (((code) << 5) | ((bits) & 0x1f))
+#define MAKE_LOOKUP(code,bits) (((code) << 5) | ((bits) & 0x1f))
@@ -151,12 +151,12 @@
huffman_context_base::huffman_context_base(int numcodes, int maxbits, lookup_value *lookup, UINT32 *histo, node_t *nodes)
: m_numcodes(numcodes),
- m_maxbits(maxbits),
- m_prevdata(0),
- m_rleremaining(0),
- m_lookup(lookup),
- m_datahisto(histo),
- m_huffnode(nodes)
+ m_maxbits(maxbits),
+ m_prevdata(0),
+ m_rleremaining(0),
+ m_lookup(lookup),
+ m_datahisto(histo),
+ m_huffnode(nodes)
{
// limit to 24 bits
if (maxbits > 24)
@@ -536,9 +536,9 @@ int CLIB_DECL huffman_context_base::tree_node_compare(const void *item1, const v
const node_t *node1 = *(const node_t **)item1;
const node_t *node2 = *(const node_t **)item2;
if (node2->m_weight != node1->m_weight)
- return node2->m_weight - node1->m_weight;
+ return node2->m_weight - node1->m_weight;
if (node2->m_bits - node1->m_bits == 0)
- fprintf(stderr, "identical node sort keys, should not happen!\n");
+ fprintf(stderr, "identical node sort keys, should not happen!\n");
return (int)node1->m_bits - (int)node2->m_bits;
}
diff --git a/src/lib/util/huffman.h b/src/lib/util/huffman.h
index 47525d82ed6..b0f24e62b58 100644
--- a/src/lib/util/huffman.h
+++ b/src/lib/util/huffman.h
@@ -78,11 +78,11 @@ protected:
// a node in the huffman tree
struct node_t
{
- node_t * m_parent; // pointer to parent node
- UINT32 m_count; // number of hits on this node
- UINT32 m_weight; // assigned weight of this node
- UINT32 m_bits; // bits used to encode the node
- UINT8 m_numbits; // number of bits needed for this node
+ node_t * m_parent; // pointer to parent node
+ UINT32 m_count; // number of hits on this node
+ UINT32 m_weight; // assigned weight of this node
+ UINT32 m_bits; // bits used to encode the node
+ UINT8 m_numbits; // number of bits needed for this node
};
// construction/destruction
@@ -108,13 +108,13 @@ protected:
protected:
// internal state
- UINT32 m_numcodes; // number of total codes being processed
- UINT8 m_maxbits; // maximum bits per code
- UINT8 m_prevdata; // value of the previous data (for delta-RLE encoding)
- int m_rleremaining; // number of RLE bytes remaining (for delta-RLE encoding)
- lookup_value * m_lookup; // pointer to the lookup table
- UINT32 * m_datahisto; // histogram of data values
- node_t * m_huffnode; // array of nodes
+ UINT32 m_numcodes; // number of total codes being processed
+ UINT8 m_maxbits; // maximum bits per code
+ UINT8 m_prevdata; // value of the previous data (for delta-RLE encoding)
+ int m_rleremaining; // number of RLE bytes remaining (for delta-RLE encoding)
+ lookup_value * m_lookup; // pointer to the lookup table
+ UINT32 * m_datahisto; // histogram of data values
+ node_t * m_huffnode; // array of nodes
};
@@ -141,8 +141,8 @@ public:
private:
// array versions of the info we need
- UINT32 m_datahisto_array[_NumCodes];
- node_t m_huffnode_array[_NumCodes * 2];
+ UINT32 m_datahisto_array[_NumCodes];
+ node_t m_huffnode_array[_NumCodes * 2];
};
@@ -166,8 +166,8 @@ public:
private:
// array versions of the info we need
- node_t m_huffnode_array[_NumCodes];
- lookup_value m_lookup_array[1 << _MaxBits];
+ node_t m_huffnode_array[_NumCodes];
+ lookup_value m_lookup_array[1 << _MaxBits];
};
diff --git a/src/lib/util/jedparse.c b/src/lib/util/jedparse.c
index e2eb36f7ea5..8e60d4d8ffd 100644
--- a/src/lib/util/jedparse.c
+++ b/src/lib/util/jedparse.c
@@ -57,7 +57,7 @@
DEBUGGING
***************************************************************************/
-#define LOG_PARSE 0
+#define LOG_PARSE 0
@@ -67,8 +67,8 @@
struct parse_info
{
- UINT16 checksum; /* checksum value */
- UINT32 explicit_numfuses; /* explicitly specified number of fuses */
+ UINT16 checksum; /* checksum value */
+ UINT32 explicit_numfuses; /* explicitly specified number of fuses */
};
@@ -459,4 +459,3 @@ size_t jedbin_output(const jed_data *data, void *result, size_t length)
/* return the final size */
return 4 + (data->numfuses + 7) / 8;
}
-
diff --git a/src/lib/util/jedparse.h b/src/lib/util/jedparse.h
index 05c9b61d510..4df071b058c 100644
--- a/src/lib/util/jedparse.h
+++ b/src/lib/util/jedparse.h
@@ -48,13 +48,13 @@
CONSTANTS
***************************************************************************/
-#define JED_MAX_FUSES (65536)
+#define JED_MAX_FUSES (65536)
/* error codes */
-#define JEDERR_NONE 0
-#define JEDERR_INVALID_DATA 1
-#define JEDERR_BAD_XMIT_SUM 2
-#define JEDERR_BAD_FUSE_SUM 3
+#define JEDERR_NONE 0
+#define JEDERR_INVALID_DATA 1
+#define JEDERR_BAD_XMIT_SUM 2
+#define JEDERR_BAD_FUSE_SUM 3
@@ -64,8 +64,8 @@
struct jed_data
{
- UINT32 numfuses; /* number of defined fuses */
- UINT8 fusemap[JED_MAX_FUSES / 8];/* array of bit-packed data */
+ UINT32 numfuses; /* number of defined fuses */
+ UINT8 fusemap[JED_MAX_FUSES / 8];/* array of bit-packed data */
};
@@ -113,4 +113,4 @@ INLINE void jed_set_fuse(jed_data *data, UINT32 fusenum, UINT8 value)
}
}
-#endif /* __JEDPARSE_H__ */
+#endif /* __JEDPARSE_H__ */
diff --git a/src/lib/util/md5.c b/src/lib/util/md5.c
index ba1406f6358..55ca7c70c1f 100644
--- a/src/lib/util/md5.c
+++ b/src/lib/util/md5.c
@@ -20,7 +20,7 @@
* Still in the public domain.
*/
-#include <string.h> /* for memcpy() */
+#include <string.h> /* for memcpy() */
#include "md5.h"
@@ -69,9 +69,9 @@ MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
t = ctx->bytes[0];
if ((ctx->bytes[0] = t + len) < t)
- ctx->bytes[1]++; /* Carry from low to high */
+ ctx->bytes[1]++; /* Carry from low to high */
- t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
+ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
if (t > len) {
memcpy((md5byte *)ctx->in + 64 - t, buf, len);
return;
@@ -103,7 +103,7 @@ MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
void
MD5Final(md5byte digest[16], struct MD5Context *ctx)
{
- int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
+ int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
md5byte *p = (md5byte *)ctx->in + count;
/* Set the first char of padding to 0x80. There is always room. */
@@ -112,7 +112,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
/* Bytes of padding needed to make 56 bytes (-8..55) */
count = 56 - 1 - count;
- if (count < 0) { /* Padding forces an extra block */
+ if (count < 0) { /* Padding forces an extra block */
memset(p, 0, count + 8);
byteSwap(ctx->in, 16);
MD5Transform(ctx->buf, ctx->in);
@@ -129,7 +129,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
byteSwap(ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
- memset(ctx, 0, sizeof(MD5Context)); /* In case it's sensitive */
+ memset(ctx, 0, sizeof(MD5Context)); /* In case it's sensitive */
}
#ifndef ASM_MD5
@@ -144,7 +144,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f,w,x,y,z,in,s) \
- (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
+ (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
@@ -236,4 +236,3 @@ MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
}
#endif
-
diff --git a/src/lib/util/md5.h b/src/lib/util/md5.h
index 4a41494e718..5270f1b4f95 100644
--- a/src/lib/util/md5.h
+++ b/src/lib/util/md5.h
@@ -39,4 +39,3 @@ void MD5Final(unsigned char digest[16], struct MD5Context *context);
void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
#endif /* !MD5_H */
-
diff --git a/src/lib/util/opresolv.c b/src/lib/util/opresolv.c
index d39bcc10c4e..4d093a955da 100644
--- a/src/lib/util/opresolv.c
+++ b/src/lib/util/opresolv.c
@@ -43,10 +43,10 @@ struct option_resolution
static optreserr_t resolve_single_param(const char *specification, int *param_value,
struct OptionRange *range, size_t range_count)
{
- int FLAG_IN_RANGE = 0x01;
- int FLAG_IN_DEFAULT = 0x02;
- int FLAG_DEFAULT_SPECIFIED = 0x04;
- int FLAG_HALF_RANGE = 0x08;
+ int FLAG_IN_RANGE = 0x01;
+ int FLAG_IN_DEFAULT = 0x02;
+ int FLAG_DEFAULT_SPECIFIED = 0x04;
+ int FLAG_HALF_RANGE = 0x08;
int last_value = 0;
int value = 0;
@@ -547,19 +547,18 @@ const char *option_resolution_error_string(optreserr_t err)
{
static const char *const errors[] =
{
- "The operation completed successfully", /* OPTIONRESOLUTION_ERROR_SUCCESS */
- "Out of memory", /* OPTIONRESOLUTION_ERROR_OUTOFMEMORY */
- "Parameter out of range", /* OPTIONRESOLUTION_ERROR_PARAMOUTOFRANGE */
- "Parameter not specified", /* OPTIONRESOLUTION_ERROR_PARAMNOTSPECIFIED */
- "Unknown parameter", /* OPTIONRESOLUTION_ERROR_PARAMNOTFOUND */
- "Parameter specified multiple times", /* OPTIONRESOLUTION_ERROR_PARAMALREADYSPECIFIED */
- "Invalid parameter", /* OPTIONRESOLUTION_ERROR_BADPARAM */
- "Syntax error", /* OPTIONRESOLUTION_ERROR_SYNTAX */
- "Internal error" /* OPTIONRESOLTUION_ERROR_INTERNAL */
+ "The operation completed successfully", /* OPTIONRESOLUTION_ERROR_SUCCESS */
+ "Out of memory", /* OPTIONRESOLUTION_ERROR_OUTOFMEMORY */
+ "Parameter out of range", /* OPTIONRESOLUTION_ERROR_PARAMOUTOFRANGE */
+ "Parameter not specified", /* OPTIONRESOLUTION_ERROR_PARAMNOTSPECIFIED */
+ "Unknown parameter", /* OPTIONRESOLUTION_ERROR_PARAMNOTFOUND */
+ "Parameter specified multiple times", /* OPTIONRESOLUTION_ERROR_PARAMALREADYSPECIFIED */
+ "Invalid parameter", /* OPTIONRESOLUTION_ERROR_BADPARAM */
+ "Syntax error", /* OPTIONRESOLUTION_ERROR_SYNTAX */
+ "Internal error" /* OPTIONRESOLTUION_ERROR_INTERNAL */
};
if ((err < 0) || (err >= ARRAY_LENGTH(errors)))
return NULL;
return errors[err];
}
-
diff --git a/src/lib/util/opresolv.h b/src/lib/util/opresolv.h
index 87066bb89af..3bd65801f24 100644
--- a/src/lib/util/opresolv.h
+++ b/src/lib/util/opresolv.h
@@ -65,28 +65,28 @@ struct option_guide
const char *display_name;
};
-#define OPTION_GUIDE_START(option_guide_) \
- const option_guide option_guide_[] = \
- { \
+#define OPTION_GUIDE_START(option_guide_) \
+ const option_guide option_guide_[] = \
+ { \
-#define OPTION_GUIDE_END \
- { OPTIONTYPE_END } \
- }; \
+#define OPTION_GUIDE_END \
+ { OPTIONTYPE_END } \
+ }; \
-#define OPTION_GUIDE_EXTERN(option_guide_) \
- extern const option_guide option_guide_[] \
+#define OPTION_GUIDE_EXTERN(option_guide_) \
+ extern const option_guide option_guide_[] \
-#define OPTION_INT(option_char, identifier, display_name) \
- { OPTIONTYPE_INT, (option_char), (identifier), (display_name) }, \
+#define OPTION_INT(option_char, identifier, display_name) \
+ { OPTIONTYPE_INT, (option_char), (identifier), (display_name) }, \
-#define OPTION_STRING(option_char, identifier, display_name) \
- { OPTIONTYPE_STRING, (option_char), (identifier), (display_name) }, \
+#define OPTION_STRING(option_char, identifier, display_name) \
+ { OPTIONTYPE_STRING, (option_char), (identifier), (display_name) }, \
-#define OPTION_ENUM_START(option_char, identifier, display_name) \
- { OPTIONTYPE_ENUM_BEGIN, (option_char), (identifier), (display_name) }, \
+#define OPTION_ENUM_START(option_char, identifier, display_name) \
+ { OPTIONTYPE_ENUM_BEGIN, (option_char), (identifier), (display_name) }, \
-#define OPTION_ENUM(value, identifier, display_name) \
- { OPTIONTYPE_ENUM_VALUE, (value), (identifier), (display_name) }, \
+#define OPTION_ENUM(value, identifier, display_name) \
+ { OPTIONTYPE_ENUM_VALUE, (value), (identifier), (display_name) }, \
#define OPTION_ENUM_END
@@ -156,4 +156,3 @@ int option_resolution_contains(const char *specification, int option_char);
const char *option_resolution_error_string(optreserr_t err);
#endif /* __OPRESOLV_H__ */
-
diff --git a/src/lib/util/options.c b/src/lib/util/options.c
index bd50ff45fdc..1182550fb36 100644
--- a/src/lib/util/options.c
+++ b/src/lib/util/options.c
@@ -81,11 +81,11 @@ const char *const core_options::s_option_unadorned[MAX_UNADORNED_OPTIONS] =
core_options::entry::entry(const options_entry &entrylist)
: m_next(NULL),
- m_flags(entrylist.flags),
- m_seqid(0),
- m_error_reported(false),
- m_priority(OPTION_PRIORITY_DEFAULT),
- m_description(entrylist.description)
+ m_flags(entrylist.flags),
+ m_seqid(0),
+ m_error_reported(false),
+ m_priority(OPTION_PRIORITY_DEFAULT),
+ m_description(entrylist.description)
{
// copy in the name(s) as appropriate
if (entrylist.name != NULL)
@@ -180,20 +180,20 @@ void core_options::entry::revert(int priority)
core_options::core_options()
: m_entrylist(NULL),
- m_entrylist_tailptr(&m_entrylist)
+ m_entrylist_tailptr(&m_entrylist)
{
}
core_options::core_options(const options_entry *entrylist)
: m_entrylist(NULL),
- m_entrylist_tailptr(&m_entrylist)
+ m_entrylist_tailptr(&m_entrylist)
{
add_entries(entrylist);
}
core_options::core_options(const options_entry *entrylist1, const options_entry *entrylist2)
: m_entrylist(NULL),
- m_entrylist_tailptr(&m_entrylist)
+ m_entrylist_tailptr(&m_entrylist)
{
add_entries(entrylist1);
add_entries(entrylist2);
@@ -201,7 +201,7 @@ core_options::core_options(const options_entry *entrylist1, const options_entry
core_options::core_options(const options_entry *entrylist1, const options_entry *entrylist2, const options_entry *entrylist3)
: m_entrylist(NULL),
- m_entrylist_tailptr(&m_entrylist)
+ m_entrylist_tailptr(&m_entrylist)
{
add_entries(entrylist1);
add_entries(entrylist2);
@@ -210,7 +210,7 @@ core_options::core_options(const options_entry *entrylist1, const options_entry
core_options::core_options(const core_options &src)
: m_entrylist(NULL),
- m_entrylist_tailptr(&m_entrylist)
+ m_entrylist_tailptr(&m_entrylist)
{
copyfrom(src);
}
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index 6a107cbfad4..8d8ea78a303 100644
--- a/src/lib/util/options.h
+++ b/src/lib/util/options.h
@@ -51,24 +51,24 @@
//**************************************************************************
// option types
-const UINT32 OPTION_TYPE_MASK = 0x0007; // up to 8 different types
+const UINT32 OPTION_TYPE_MASK = 0x0007; // up to 8 different types
enum
{
- OPTION_INVALID, // invalid
- OPTION_HEADER, // a header item
- OPTION_COMMAND, // a command
- OPTION_BOOLEAN, // boolean option
- OPTION_INTEGER, // integer option
- OPTION_FLOAT, // floating-point option
- OPTION_STRING // string option
+ OPTION_INVALID, // invalid
+ OPTION_HEADER, // a header item
+ OPTION_COMMAND, // a command
+ OPTION_BOOLEAN, // boolean option
+ OPTION_INTEGER, // integer option
+ OPTION_FLOAT, // floating-point option
+ OPTION_STRING // string option
};
// option priorities
-const int OPTION_PRIORITY_DEFAULT = 0; // defaults are at 0 priority
-const int OPTION_PRIORITY_LOW = 50; // low priority
-const int OPTION_PRIORITY_NORMAL = 100; // normal priority
-const int OPTION_PRIORITY_HIGH = 150; // high priority
-const int OPTION_PRIORITY_MAXIMUM = 255; // maximum priority
+const int OPTION_PRIORITY_DEFAULT = 0; // defaults are at 0 priority
+const int OPTION_PRIORITY_LOW = 50; // low priority
+const int OPTION_PRIORITY_NORMAL = 100; // normal priority
+const int OPTION_PRIORITY_HIGH = 150; // high priority
+const int OPTION_PRIORITY_MAXIMUM = 255; // maximum priority
@@ -79,10 +79,10 @@ const int OPTION_PRIORITY_MAXIMUM = 255; // maximum priority
// static structure describing a single option with its description and default value
struct options_entry
{
- const char * name; // name on the command line
- const char * defvalue; // default value of this argument
- UINT32 flags; // flags to describe the option
- const char * description; // description for -showusage
+ const char * name; // name on the command line
+ const char * defvalue; // default value of this argument
+ UINT32 flags; // flags to describe the option
+ const char * description; // description for -showusage
};
@@ -124,17 +124,17 @@ public:
private:
// internal state
- entry * m_next; // link to the next data
- UINT32 m_flags; // flags from the entry
- UINT32 m_seqid; // sequence ID; bumped on each change
- bool m_error_reported; // have we reported an error on this option yet?
- int m_priority; // priority of the data set
- const char * m_description; // description for this item
- astring m_name[4]; // up to 4 names for the item
- astring m_data; // data for this item
- astring m_defdata; // default data for this item
- astring m_minimum; // minimum value
- astring m_maximum; // maximum value
+ entry * m_next; // link to the next data
+ UINT32 m_flags; // flags from the entry
+ UINT32 m_seqid; // sequence ID; bumped on each change
+ bool m_error_reported; // have we reported an error on this option yet?
+ int m_priority; // priority of the data set
+ const char * m_description; // description for this item
+ astring m_name[4]; // up to 4 names for the item
+ astring m_data; // data for this item
+ astring m_defdata; // default data for this item
+ astring m_minimum; // minimum value
+ astring m_maximum; // maximum value
};
// construction/destruction
@@ -196,11 +196,11 @@ private:
bool validate_and_set_data(entry &curentry, const char *newdata, int priority, astring &error_string);
// internal state
- entry * m_entrylist; // head of list of entries
- entry ** m_entrylist_tailptr; // pointer to tail of entry list
- tagmap_t<entry *> m_entrymap; // map for fast lookup
- astring m_command; // command found
- static const char *const s_option_unadorned[]; // array of unadorned option "names"
+ entry * m_entrylist; // head of list of entries
+ entry ** m_entrylist_tailptr; // pointer to tail of entry list
+ tagmap_t<entry *> m_entrymap; // map for fast lookup
+ astring m_command; // command found
+ static const char *const s_option_unadorned[]; // array of unadorned option "names"
};
diff --git a/src/lib/util/palette.c b/src/lib/util/palette.c
index b44f0e8cdb1..86f783e23cb 100644
--- a/src/lib/util/palette.c
+++ b/src/lib/util/palette.c
@@ -50,43 +50,43 @@
/* object to track dirty states */
struct dirty_state
{
- UINT32 * dirty; /* bitmap of dirty entries */
- UINT32 mindirty; /* minimum dirty entry */
- UINT32 maxdirty; /* minimum dirty entry */
+ UINT32 * dirty; /* bitmap of dirty entries */
+ UINT32 mindirty; /* minimum dirty entry */
+ UINT32 maxdirty; /* minimum dirty entry */
};
/* a single palette client */
struct palette_client
{
- palette_client *next; /* pointer to next client */
- palette_t * palette; /* reference to the palette */
- dirty_state live; /* live dirty state */
- dirty_state previous; /* previous dirty state */
+ palette_client *next; /* pointer to next client */
+ palette_t * palette; /* reference to the palette */
+ dirty_state live; /* live dirty state */
+ dirty_state previous; /* previous dirty state */
};
/* a palette object */
struct palette_t
{
- UINT32 refcount; /* reference count on the palette */
- UINT32 numcolors; /* number of colors in the palette */
- UINT32 numgroups; /* number of groups in the palette */
+ UINT32 refcount; /* reference count on the palette */
+ UINT32 numcolors; /* number of colors in the palette */
+ UINT32 numgroups; /* number of groups in the palette */
- float brightness; /* overall brightness value */
- float contrast; /* overall contrast value */
- float gamma; /* overall gamma value */
- UINT8 gamma_map[256]; /* gamma map */
+ float brightness; /* overall brightness value */
+ float contrast; /* overall contrast value */
+ float gamma; /* overall gamma value */
+ UINT8 gamma_map[256]; /* gamma map */
- rgb_t * entry_color; /* array of raw colors */
- float * entry_contrast; /* contrast value for each entry */
- rgb_t * adjusted_color; /* array of adjusted colors */
- rgb_t * adjusted_rgb15; /* array of adjusted colors as RGB15 */
+ rgb_t * entry_color; /* array of raw colors */
+ float * entry_contrast; /* contrast value for each entry */
+ rgb_t * adjusted_color; /* array of adjusted colors */
+ rgb_t * adjusted_rgb15; /* array of adjusted colors as RGB15 */
- float * group_bright; /* brightness value for each group */
- float * group_contrast; /* contrast value for each group */
+ float * group_bright; /* brightness value for each group */
+ float * group_contrast; /* contrast value for each group */
- palette_client *client_list; /* list of clients for this palette */
+ palette_client *client_list; /* list of clients for this palette */
};
diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h
index d54ee279fbf..7823d5a24c6 100644
--- a/src/lib/util/palette.h
+++ b/src/lib/util/palette.h
@@ -68,18 +68,18 @@ struct palette_client;
***************************************************************************/
/* macros to assemble rgb_t values */
-#define MAKE_ARGB(a,r,g,b) ((((rgb_t)(a) & 0xff) << 24) | (((rgb_t)(r) & 0xff) << 16) | (((rgb_t)(g) & 0xff) << 8) | ((rgb_t)(b) & 0xff))
-#define MAKE_RGB(r,g,b) (MAKE_ARGB(255,r,g,b))
+#define MAKE_ARGB(a,r,g,b) ((((rgb_t)(a) & 0xff) << 24) | (((rgb_t)(r) & 0xff) << 16) | (((rgb_t)(g) & 0xff) << 8) | ((rgb_t)(b) & 0xff))
+#define MAKE_RGB(r,g,b) (MAKE_ARGB(255,r,g,b))
/* macros to extract components from rgb_t values */
-#define RGB_ALPHA(rgb) (((rgb) >> 24) & 0xff)
-#define RGB_RED(rgb) (((rgb) >> 16) & 0xff)
-#define RGB_GREEN(rgb) (((rgb) >> 8) & 0xff)
-#define RGB_BLUE(rgb) ((rgb) & 0xff)
+#define RGB_ALPHA(rgb) (((rgb) >> 24) & 0xff)
+#define RGB_RED(rgb) (((rgb) >> 16) & 0xff)
+#define RGB_GREEN(rgb) (((rgb) >> 8) & 0xff)
+#define RGB_BLUE(rgb) ((rgb) & 0xff)
/* common colors */
-#define RGB_BLACK (MAKE_ARGB(255,0,0,0))
-#define RGB_WHITE (MAKE_ARGB(255,255,255,255))
+#define RGB_BLACK (MAKE_ARGB(255,0,0,0))
+#define RGB_WHITE (MAKE_ARGB(255,255,255,255))
@@ -369,4 +369,4 @@ inline rgb_t pal888(UINT32 data, UINT8 rshift, UINT8 gshift, UINT8 bshift)
}
-#endif /* __PALETTE_H__ */
+#endif /* __PALETTE_H__ */
diff --git a/src/lib/util/plaparse.c b/src/lib/util/plaparse.c
index c3a2261c564..e60c7344788 100644
--- a/src/lib/util/plaparse.c
+++ b/src/lib/util/plaparse.c
@@ -50,7 +50,7 @@
DEBUGGING
***************************************************************************/
-#define LOG_PARSE 0
+#define LOG_PARSE 0
@@ -60,9 +60,9 @@
struct parse_info
{
- UINT32 inputs;
- UINT32 outputs;
- UINT32 terms;
+ UINT32 inputs;
+ UINT32 outputs;
+ UINT32 terms;
};
diff --git a/src/lib/util/plaparse.h b/src/lib/util/plaparse.h
index 4d3f9c94a9f..7f313cd91b2 100644
--- a/src/lib/util/plaparse.h
+++ b/src/lib/util/plaparse.h
@@ -53,4 +53,4 @@ int pla_parse(const void *data, size_t length, jed_data *result);
-#endif /* __PLAPARSE_H__ */
+#endif /* __PLAPARSE_H__ */
diff --git a/src/lib/util/png.c b/src/lib/util/png.c
index 5bb930713a1..1ac14b96485 100644
--- a/src/lib/util/png.c
+++ b/src/lib/util/png.c
@@ -52,19 +52,19 @@
struct image_data_chunk
{
- image_data_chunk * next;
- int length;
- UINT8 * data;
+ image_data_chunk * next;
+ int length;
+ UINT8 * data;
};
struct png_private
{
- png_info * pnginfo;
- image_data_chunk * idata;
- image_data_chunk ** idata_next;
- UINT8 bpp;
- UINT32 rowbytes;
+ png_info * pnginfo;
+ image_data_chunk * idata;
+ image_data_chunk ** idata_next;
+ UINT8 bpp;
+ UINT32 rowbytes;
};
@@ -815,8 +815,8 @@ static png_error write_deflated_chunk(core_file *fp, UINT8 *data, UINT32 type, U
{
UINT64 lengthpos = core_ftell(fp);
UINT8 tempbuff[8192];
- UINT32 zlength = 0;
- z_stream stream;
+ UINT32 zlength = 0;
+ z_stream stream;
UINT32 crc;
int zerr;
@@ -833,9 +833,9 @@ static png_error write_deflated_chunk(core_file *fp, UINT8 *data, UINT32 type, U
memset(&stream, 0, sizeof(stream));
stream.next_in = data;
stream.avail_in = length;
- zerr = deflateInit(&stream, Z_DEFAULT_COMPRESSION);
- if (zerr != Z_OK)
- return PNGERR_COMPRESS_ERROR;
+ zerr = deflateInit(&stream, Z_DEFAULT_COMPRESSION);
+ if (zerr != Z_OK)
+ return PNGERR_COMPRESS_ERROR;
/* now loop until we run out of data */
for ( ; ; )
@@ -1138,7 +1138,7 @@ png_error mng_capture_start(core_file *fp, bitmap_t &bitmap, double rate)
put_32bit(mhdr + 8, rate);
put_32bit(mhdr + 24, 0x0041); /* Simplicity profile */
/* frame count and play time unspecified because
- we don't know at this stage */
+ we don't know at this stage */
error = write_chunk(fp, mhdr, MNG_CN_MHDR, 28);
if (error != PNGERR_NONE)
return error;
diff --git a/src/lib/util/png.h b/src/lib/util/png.h
index ce7b7f7e261..d196de37ebd 100644
--- a/src/lib/util/png.h
+++ b/src/lib/util/png.h
@@ -56,35 +56,35 @@
#define MNG_Signature "\x8A\x4D\x4E\x47\x0D\x0A\x1A\x0A"
/* Chunk names */
-#define PNG_CN_IHDR 0x49484452L
-#define PNG_CN_PLTE 0x504C5445L
-#define PNG_CN_IDAT 0x49444154L
-#define PNG_CN_IEND 0x49454E44L
-#define PNG_CN_gAMA 0x67414D41L
-#define PNG_CN_sBIT 0x73424954L
-#define PNG_CN_cHRM 0x6348524DL
-#define PNG_CN_tRNS 0x74524E53L
-#define PNG_CN_bKGD 0x624B4744L
-#define PNG_CN_hIST 0x68495354L
-#define PNG_CN_tEXt 0x74455874L
-#define PNG_CN_zTXt 0x7A545874L
-#define PNG_CN_pHYs 0x70485973L
-#define PNG_CN_oFFs 0x6F464673L
-#define PNG_CN_tIME 0x74494D45L
-#define PNG_CN_sCAL 0x7343414CL
+#define PNG_CN_IHDR 0x49484452L
+#define PNG_CN_PLTE 0x504C5445L
+#define PNG_CN_IDAT 0x49444154L
+#define PNG_CN_IEND 0x49454E44L
+#define PNG_CN_gAMA 0x67414D41L
+#define PNG_CN_sBIT 0x73424954L
+#define PNG_CN_cHRM 0x6348524DL
+#define PNG_CN_tRNS 0x74524E53L
+#define PNG_CN_bKGD 0x624B4744L
+#define PNG_CN_hIST 0x68495354L
+#define PNG_CN_tEXt 0x74455874L
+#define PNG_CN_zTXt 0x7A545874L
+#define PNG_CN_pHYs 0x70485973L
+#define PNG_CN_oFFs 0x6F464673L
+#define PNG_CN_tIME 0x74494D45L
+#define PNG_CN_sCAL 0x7343414CL
/* MNG Chunk names */
-#define MNG_CN_MHDR 0x4D484452L
-#define MNG_CN_MEND 0x4D454E44L
-#define MNG_CN_TERM 0x5445524DL
-#define MNG_CN_BACK 0x4241434BL
+#define MNG_CN_MHDR 0x4D484452L
+#define MNG_CN_MEND 0x4D454E44L
+#define MNG_CN_TERM 0x5445524DL
+#define MNG_CN_BACK 0x4241434BL
/* Prediction filters */
-#define PNG_PF_None 0
-#define PNG_PF_Sub 1
-#define PNG_PF_Up 2
-#define PNG_PF_Average 3
-#define PNG_PF_Paeth 4
+#define PNG_PF_None 0
+#define PNG_PF_Sub 1
+#define PNG_PF_Up 2
+#define PNG_PF_Average 3
+#define PNG_PF_Paeth 4
/* Error types */
enum png_error
@@ -110,34 +110,34 @@ enum png_error
struct png_text
{
- png_text * next;
- const char * keyword; /* this is allocated */
- const char * text; /* this points to a part of keyword */
+ png_text * next;
+ const char * keyword; /* this is allocated */
+ const char * text; /* this points to a part of keyword */
};
struct png_info
{
- UINT8 * image;
- UINT32 width, height;
- UINT32 xres, yres;
- rectangle screen;
- double xscale, yscale;
- double source_gamma;
- UINT32 resolution_unit;
- UINT8 bit_depth;
- UINT8 color_type;
- UINT8 compression_method;
- UINT8 filter_method;
- UINT8 interlace_method;
-
- UINT8 * palette;
- UINT32 num_palette;
-
- UINT8 * trans;
- UINT32 num_trans;
-
- png_text * textlist;
+ UINT8 * image;
+ UINT32 width, height;
+ UINT32 xres, yres;
+ rectangle screen;
+ double xscale, yscale;
+ double source_gamma;
+ UINT32 resolution_unit;
+ UINT8 bit_depth;
+ UINT8 color_type;
+ UINT8 compression_method;
+ UINT8 filter_method;
+ UINT8 interlace_method;
+
+ UINT8 * palette;
+ UINT32 num_palette;
+
+ UINT8 * trans;
+ UINT32 num_trans;
+
+ png_text * textlist;
};
@@ -159,4 +159,4 @@ png_error mng_capture_start(core_file *fp, bitmap_t &bitmap, double rate);
png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t &bitmap, int palette_length, const UINT32 *palette);
png_error mng_capture_stop(core_file *fp);
-#endif /* __PNG_H__ */
+#endif /* __PNG_H__ */
diff --git a/src/lib/util/pool.c b/src/lib/util/pool.c
index ab0c0ef3270..35c39ef0722 100644
--- a/src/lib/util/pool.c
+++ b/src/lib/util/pool.c
@@ -48,8 +48,8 @@
CONSTANTS
***************************************************************************/
-#define OBJECT_ENTRY_BLOCK 256
-#define POOL_HASH_SIZE 3797
+#define OBJECT_ENTRY_BLOCK 256
+#define POOL_HASH_SIZE 3797
@@ -60,24 +60,24 @@
/* an object type entry */
struct objtype_entry
{
- objtype_entry * next;
- UINT32 type;
- const char * friendly;
- void (*destructor)(void *, size_t);
+ objtype_entry * next;
+ UINT32 type;
+ const char * friendly;
+ void (*destructor)(void *, size_t);
};
/* an entry in a pool */
struct object_entry
{
- object_entry * next;
- object_entry * globalnext;
- object_entry * globalprev;
- objtype_entry * type;
- void * object;
- size_t size;
- const char * file;
- int line;
+ object_entry * next;
+ object_entry * globalnext;
+ object_entry * globalprev;
+ objtype_entry * type;
+ void * object;
+ size_t size;
+ const char * file;
+ int line;
};
@@ -85,28 +85,28 @@ struct object_entry
struct object_entry_block
{
object_entry_block *next;
- object_entry entry[OBJECT_ENTRY_BLOCK];
+ object_entry entry[OBJECT_ENTRY_BLOCK];
};
/* the object pool itself */
struct object_pool
{
- object_entry * hashtable[POOL_HASH_SIZE];
- object_entry * globallist;
- object_entry * freelist;
+ object_entry * hashtable[POOL_HASH_SIZE];
+ object_entry * globallist;
+ object_entry * freelist;
object_entry_block *blocklist;
- objtype_entry * typelist;
- void (*fail)(const char *message);
+ objtype_entry * typelist;
+ void (*fail)(const char *message);
};
/* an iterator over objects in a pool */
struct object_pool_iterator
{
- object_pool * pool;
- object_type type;
- object_entry * last;
+ object_pool * pool;
+ object_type type;
+ object_entry * last;
};
diff --git a/src/lib/util/pool.h b/src/lib/util/pool.h
index 77bf7456da4..d1948c9d317 100644
--- a/src/lib/util/pool.h
+++ b/src/lib/util/pool.h
@@ -48,16 +48,16 @@
***************************************************************************/
/* helper macros for memory pools that pass file/line number */
-#define pool_malloc_lib(pool, size) pool_malloc_file_line((pool), (size), __FILE__, __LINE__)
-#define pool_realloc_lib(pool, ptr, size) pool_realloc_file_line((pool), (ptr), (size), __FILE__, __LINE__)
-#define pool_strdup_lib(pool, size) pool_strdup_file_line((pool), (size), __FILE__, __LINE__)
+#define pool_malloc_lib(pool, size) pool_malloc_file_line((pool), (size), __FILE__, __LINE__)
+#define pool_realloc_lib(pool, ptr, size) pool_realloc_file_line((pool), (ptr), (size), __FILE__, __LINE__)
+#define pool_strdup_lib(pool, size) pool_strdup_file_line((pool), (size), __FILE__, __LINE__)
/* macro to define a 4-character type for a pool */
-#define OBJECT_TYPE(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
+#define OBJECT_TYPE(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
/* built-in pool types */
-#define OBJTYPE_WILDCARD (0)
-#define OBJTYPE_MEMORY OBJECT_TYPE('m','e','m','o')
+#define OBJTYPE_WILDCARD (0)
+#define OBJTYPE_MEMORY OBJECT_TYPE('m','e','m','o')
diff --git a/src/lib/util/sha1.c b/src/lib/util/sha1.c
index edca0192103..0a3327d7fc0 100644
--- a/src/lib/util/sha1.c
+++ b/src/lib/util/sha1.c
@@ -97,8 +97,8 @@ static void WRITE_UINT32(unsigned char* data, UINT32 val)
for this information */
#define expand(W,i) ( W[ i & 15 ] = \
- ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \
- W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) )
+ ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \
+ W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) )
/* The prototype SHA sub-round. The fundamental sub-round is:
@@ -115,25 +115,25 @@ static void WRITE_UINT32(unsigned char* data, UINT32 val)
the next 20 values from the W[] array each time */
#define subRound(a, b, c, d, e, f, k, data) \
- ( e += ROTL( 5, a ) + f( b, c, d ) + k + data, b = ROTL( 30, b ) )
+ ( e += ROTL( 5, a ) + f( b, c, d ) + k + data, b = ROTL( 30, b ) )
/* Initialize the SHA values */
void
sha1_init(struct sha1_ctx *ctx)
{
- /* Set the h-vars to their initial values */
- ctx->digest[ 0 ] = h0init;
- ctx->digest[ 1 ] = h1init;
- ctx->digest[ 2 ] = h2init;
- ctx->digest[ 3 ] = h3init;
- ctx->digest[ 4 ] = h4init;
-
- /* Initialize bit count */
- ctx->count_low = ctx->count_high = 0;
-
- /* Initialize buffer */
- ctx->index = 0;
+ /* Set the h-vars to their initial values */
+ ctx->digest[ 0 ] = h0init;
+ ctx->digest[ 1 ] = h1init;
+ ctx->digest[ 2 ] = h2init;
+ ctx->digest[ 3 ] = h3init;
+ ctx->digest[ 4 ] = h4init;
+
+ /* Initialize bit count */
+ ctx->count_low = ctx->count_high = 0;
+
+ /* Initialize buffer */
+ ctx->index = 0;
}
/* Perform the SHA transformation. Note that this code, like MD5, seems to
@@ -146,156 +146,156 @@ sha1_init(struct sha1_ctx *ctx)
static void
sha1_transform(UINT32 *state, UINT32 *data)
{
- UINT32 A, B, C, D, E; /* Local vars */
-
- /* Set up first buffer and local data buffer */
- A = state[0];
- B = state[1];
- C = state[2];
- D = state[3];
- E = state[4];
-
- /* Heavy mangling, in 4 sub-rounds of 20 interations each. */
- subRound( A, B, C, D, E, f1, K1, data[ 0] );
- subRound( E, A, B, C, D, f1, K1, data[ 1] );
- subRound( D, E, A, B, C, f1, K1, data[ 2] );
- subRound( C, D, E, A, B, f1, K1, data[ 3] );
- subRound( B, C, D, E, A, f1, K1, data[ 4] );
- subRound( A, B, C, D, E, f1, K1, data[ 5] );
- subRound( E, A, B, C, D, f1, K1, data[ 6] );
- subRound( D, E, A, B, C, f1, K1, data[ 7] );
- subRound( C, D, E, A, B, f1, K1, data[ 8] );
- subRound( B, C, D, E, A, f1, K1, data[ 9] );
- subRound( A, B, C, D, E, f1, K1, data[10] );
- subRound( E, A, B, C, D, f1, K1, data[11] );
- subRound( D, E, A, B, C, f1, K1, data[12] );
- subRound( C, D, E, A, B, f1, K1, data[13] );
- subRound( B, C, D, E, A, f1, K1, data[14] );
- subRound( A, B, C, D, E, f1, K1, data[15] );
- subRound( E, A, B, C, D, f1, K1, expand( data, 16 ) );
- subRound( D, E, A, B, C, f1, K1, expand( data, 17 ) );
- subRound( C, D, E, A, B, f1, K1, expand( data, 18 ) );
- subRound( B, C, D, E, A, f1, K1, expand( data, 19 ) );
-
- subRound( A, B, C, D, E, f2, K2, expand( data, 20 ) );
- subRound( E, A, B, C, D, f2, K2, expand( data, 21 ) );
- subRound( D, E, A, B, C, f2, K2, expand( data, 22 ) );
- subRound( C, D, E, A, B, f2, K2, expand( data, 23 ) );
- subRound( B, C, D, E, A, f2, K2, expand( data, 24 ) );
- subRound( A, B, C, D, E, f2, K2, expand( data, 25 ) );
- subRound( E, A, B, C, D, f2, K2, expand( data, 26 ) );
- subRound( D, E, A, B, C, f2, K2, expand( data, 27 ) );
- subRound( C, D, E, A, B, f2, K2, expand( data, 28 ) );
- subRound( B, C, D, E, A, f2, K2, expand( data, 29 ) );
- subRound( A, B, C, D, E, f2, K2, expand( data, 30 ) );
- subRound( E, A, B, C, D, f2, K2, expand( data, 31 ) );
- subRound( D, E, A, B, C, f2, K2, expand( data, 32 ) );
- subRound( C, D, E, A, B, f2, K2, expand( data, 33 ) );
- subRound( B, C, D, E, A, f2, K2, expand( data, 34 ) );
- subRound( A, B, C, D, E, f2, K2, expand( data, 35 ) );
- subRound( E, A, B, C, D, f2, K2, expand( data, 36 ) );
- subRound( D, E, A, B, C, f2, K2, expand( data, 37 ) );
- subRound( C, D, E, A, B, f2, K2, expand( data, 38 ) );
- subRound( B, C, D, E, A, f2, K2, expand( data, 39 ) );
-
- subRound( A, B, C, D, E, f3, K3, expand( data, 40 ) );
- subRound( E, A, B, C, D, f3, K3, expand( data, 41 ) );
- subRound( D, E, A, B, C, f3, K3, expand( data, 42 ) );
- subRound( C, D, E, A, B, f3, K3, expand( data, 43 ) );
- subRound( B, C, D, E, A, f3, K3, expand( data, 44 ) );
- subRound( A, B, C, D, E, f3, K3, expand( data, 45 ) );
- subRound( E, A, B, C, D, f3, K3, expand( data, 46 ) );
- subRound( D, E, A, B, C, f3, K3, expand( data, 47 ) );
- subRound( C, D, E, A, B, f3, K3, expand( data, 48 ) );
- subRound( B, C, D, E, A, f3, K3, expand( data, 49 ) );
- subRound( A, B, C, D, E, f3, K3, expand( data, 50 ) );
- subRound( E, A, B, C, D, f3, K3, expand( data, 51 ) );
- subRound( D, E, A, B, C, f3, K3, expand( data, 52 ) );
- subRound( C, D, E, A, B, f3, K3, expand( data, 53 ) );
- subRound( B, C, D, E, A, f3, K3, expand( data, 54 ) );
- subRound( A, B, C, D, E, f3, K3, expand( data, 55 ) );
- subRound( E, A, B, C, D, f3, K3, expand( data, 56 ) );
- subRound( D, E, A, B, C, f3, K3, expand( data, 57 ) );
- subRound( C, D, E, A, B, f3, K3, expand( data, 58 ) );
- subRound( B, C, D, E, A, f3, K3, expand( data, 59 ) );
-
- subRound( A, B, C, D, E, f4, K4, expand( data, 60 ) );
- subRound( E, A, B, C, D, f4, K4, expand( data, 61 ) );
- subRound( D, E, A, B, C, f4, K4, expand( data, 62 ) );
- subRound( C, D, E, A, B, f4, K4, expand( data, 63 ) );
- subRound( B, C, D, E, A, f4, K4, expand( data, 64 ) );
- subRound( A, B, C, D, E, f4, K4, expand( data, 65 ) );
- subRound( E, A, B, C, D, f4, K4, expand( data, 66 ) );
- subRound( D, E, A, B, C, f4, K4, expand( data, 67 ) );
- subRound( C, D, E, A, B, f4, K4, expand( data, 68 ) );
- subRound( B, C, D, E, A, f4, K4, expand( data, 69 ) );
- subRound( A, B, C, D, E, f4, K4, expand( data, 70 ) );
- subRound( E, A, B, C, D, f4, K4, expand( data, 71 ) );
- subRound( D, E, A, B, C, f4, K4, expand( data, 72 ) );
- subRound( C, D, E, A, B, f4, K4, expand( data, 73 ) );
- subRound( B, C, D, E, A, f4, K4, expand( data, 74 ) );
- subRound( A, B, C, D, E, f4, K4, expand( data, 75 ) );
- subRound( E, A, B, C, D, f4, K4, expand( data, 76 ) );
- subRound( D, E, A, B, C, f4, K4, expand( data, 77 ) );
- subRound( C, D, E, A, B, f4, K4, expand( data, 78 ) );
- subRound( B, C, D, E, A, f4, K4, expand( data, 79 ) );
-
- /* Build message digest */
- state[0] += A;
- state[1] += B;
- state[2] += C;
- state[3] += D;
- state[4] += E;
+ UINT32 A, B, C, D, E; /* Local vars */
+
+ /* Set up first buffer and local data buffer */
+ A = state[0];
+ B = state[1];
+ C = state[2];
+ D = state[3];
+ E = state[4];
+
+ /* Heavy mangling, in 4 sub-rounds of 20 interations each. */
+ subRound( A, B, C, D, E, f1, K1, data[ 0] );
+ subRound( E, A, B, C, D, f1, K1, data[ 1] );
+ subRound( D, E, A, B, C, f1, K1, data[ 2] );
+ subRound( C, D, E, A, B, f1, K1, data[ 3] );
+ subRound( B, C, D, E, A, f1, K1, data[ 4] );
+ subRound( A, B, C, D, E, f1, K1, data[ 5] );
+ subRound( E, A, B, C, D, f1, K1, data[ 6] );
+ subRound( D, E, A, B, C, f1, K1, data[ 7] );
+ subRound( C, D, E, A, B, f1, K1, data[ 8] );
+ subRound( B, C, D, E, A, f1, K1, data[ 9] );
+ subRound( A, B, C, D, E, f1, K1, data[10] );
+ subRound( E, A, B, C, D, f1, K1, data[11] );
+ subRound( D, E, A, B, C, f1, K1, data[12] );
+ subRound( C, D, E, A, B, f1, K1, data[13] );
+ subRound( B, C, D, E, A, f1, K1, data[14] );
+ subRound( A, B, C, D, E, f1, K1, data[15] );
+ subRound( E, A, B, C, D, f1, K1, expand( data, 16 ) );
+ subRound( D, E, A, B, C, f1, K1, expand( data, 17 ) );
+ subRound( C, D, E, A, B, f1, K1, expand( data, 18 ) );
+ subRound( B, C, D, E, A, f1, K1, expand( data, 19 ) );
+
+ subRound( A, B, C, D, E, f2, K2, expand( data, 20 ) );
+ subRound( E, A, B, C, D, f2, K2, expand( data, 21 ) );
+ subRound( D, E, A, B, C, f2, K2, expand( data, 22 ) );
+ subRound( C, D, E, A, B, f2, K2, expand( data, 23 ) );
+ subRound( B, C, D, E, A, f2, K2, expand( data, 24 ) );
+ subRound( A, B, C, D, E, f2, K2, expand( data, 25 ) );
+ subRound( E, A, B, C, D, f2, K2, expand( data, 26 ) );
+ subRound( D, E, A, B, C, f2, K2, expand( data, 27 ) );
+ subRound( C, D, E, A, B, f2, K2, expand( data, 28 ) );
+ subRound( B, C, D, E, A, f2, K2, expand( data, 29 ) );
+ subRound( A, B, C, D, E, f2, K2, expand( data, 30 ) );
+ subRound( E, A, B, C, D, f2, K2, expand( data, 31 ) );
+ subRound( D, E, A, B, C, f2, K2, expand( data, 32 ) );
+ subRound( C, D, E, A, B, f2, K2, expand( data, 33 ) );
+ subRound( B, C, D, E, A, f2, K2, expand( data, 34 ) );
+ subRound( A, B, C, D, E, f2, K2, expand( data, 35 ) );
+ subRound( E, A, B, C, D, f2, K2, expand( data, 36 ) );
+ subRound( D, E, A, B, C, f2, K2, expand( data, 37 ) );
+ subRound( C, D, E, A, B, f2, K2, expand( data, 38 ) );
+ subRound( B, C, D, E, A, f2, K2, expand( data, 39 ) );
+
+ subRound( A, B, C, D, E, f3, K3, expand( data, 40 ) );
+ subRound( E, A, B, C, D, f3, K3, expand( data, 41 ) );
+ subRound( D, E, A, B, C, f3, K3, expand( data, 42 ) );
+ subRound( C, D, E, A, B, f3, K3, expand( data, 43 ) );
+ subRound( B, C, D, E, A, f3, K3, expand( data, 44 ) );
+ subRound( A, B, C, D, E, f3, K3, expand( data, 45 ) );
+ subRound( E, A, B, C, D, f3, K3, expand( data, 46 ) );
+ subRound( D, E, A, B, C, f3, K3, expand( data, 47 ) );
+ subRound( C, D, E, A, B, f3, K3, expand( data, 48 ) );
+ subRound( B, C, D, E, A, f3, K3, expand( data, 49 ) );
+ subRound( A, B, C, D, E, f3, K3, expand( data, 50 ) );
+ subRound( E, A, B, C, D, f3, K3, expand( data, 51 ) );
+ subRound( D, E, A, B, C, f3, K3, expand( data, 52 ) );
+ subRound( C, D, E, A, B, f3, K3, expand( data, 53 ) );
+ subRound( B, C, D, E, A, f3, K3, expand( data, 54 ) );
+ subRound( A, B, C, D, E, f3, K3, expand( data, 55 ) );
+ subRound( E, A, B, C, D, f3, K3, expand( data, 56 ) );
+ subRound( D, E, A, B, C, f3, K3, expand( data, 57 ) );
+ subRound( C, D, E, A, B, f3, K3, expand( data, 58 ) );
+ subRound( B, C, D, E, A, f3, K3, expand( data, 59 ) );
+
+ subRound( A, B, C, D, E, f4, K4, expand( data, 60 ) );
+ subRound( E, A, B, C, D, f4, K4, expand( data, 61 ) );
+ subRound( D, E, A, B, C, f4, K4, expand( data, 62 ) );
+ subRound( C, D, E, A, B, f4, K4, expand( data, 63 ) );
+ subRound( B, C, D, E, A, f4, K4, expand( data, 64 ) );
+ subRound( A, B, C, D, E, f4, K4, expand( data, 65 ) );
+ subRound( E, A, B, C, D, f4, K4, expand( data, 66 ) );
+ subRound( D, E, A, B, C, f4, K4, expand( data, 67 ) );
+ subRound( C, D, E, A, B, f4, K4, expand( data, 68 ) );
+ subRound( B, C, D, E, A, f4, K4, expand( data, 69 ) );
+ subRound( A, B, C, D, E, f4, K4, expand( data, 70 ) );
+ subRound( E, A, B, C, D, f4, K4, expand( data, 71 ) );
+ subRound( D, E, A, B, C, f4, K4, expand( data, 72 ) );
+ subRound( C, D, E, A, B, f4, K4, expand( data, 73 ) );
+ subRound( B, C, D, E, A, f4, K4, expand( data, 74 ) );
+ subRound( A, B, C, D, E, f4, K4, expand( data, 75 ) );
+ subRound( E, A, B, C, D, f4, K4, expand( data, 76 ) );
+ subRound( D, E, A, B, C, f4, K4, expand( data, 77 ) );
+ subRound( C, D, E, A, B, f4, K4, expand( data, 78 ) );
+ subRound( B, C, D, E, A, f4, K4, expand( data, 79 ) );
+
+ /* Build message digest */
+ state[0] += A;
+ state[1] += B;
+ state[2] += C;
+ state[3] += D;
+ state[4] += E;
}
static void
sha1_block(struct sha1_ctx *ctx, const UINT8 *block)
{
- UINT32 data[SHA1_DATA_LENGTH];
- int i;
+ UINT32 data[SHA1_DATA_LENGTH];
+ int i;
- /* Update block count */
- if (!++ctx->count_low)
- ++ctx->count_high;
+ /* Update block count */
+ if (!++ctx->count_low)
+ ++ctx->count_high;
- /* Endian independent conversion */
- for (i = 0; i<SHA1_DATA_LENGTH; i++, block += 4)
- data[i] = READ_UINT32(block);
+ /* Endian independent conversion */
+ for (i = 0; i<SHA1_DATA_LENGTH; i++, block += 4)
+ data[i] = READ_UINT32(block);
- sha1_transform(ctx->digest, data);
+ sha1_transform(ctx->digest, data);
}
void
sha1_update(struct sha1_ctx *ctx,
- unsigned length, const UINT8 *buffer)
+ unsigned length, const UINT8 *buffer)
{
- if (ctx->index)
- { /* Try to fill partial block */
- unsigned left = SHA1_DATA_SIZE - ctx->index;
- if (length < left)
+ if (ctx->index)
+ { /* Try to fill partial block */
+ unsigned left = SHA1_DATA_SIZE - ctx->index;
+ if (length < left)
{
- memcpy(ctx->block + ctx->index, buffer, length);
- ctx->index += length;
- return; /* Finished */
+ memcpy(ctx->block + ctx->index, buffer, length);
+ ctx->index += length;
+ return; /* Finished */
}
- else
+ else
{
- memcpy(ctx->block + ctx->index, buffer, left);
- sha1_block(ctx, ctx->block);
- buffer += left;
- length -= left;
+ memcpy(ctx->block + ctx->index, buffer, left);
+ sha1_block(ctx, ctx->block);
+ buffer += left;
+ length -= left;
}
- }
- while (length >= SHA1_DATA_SIZE)
- {
- sha1_block(ctx, buffer);
- buffer += SHA1_DATA_SIZE;
- length -= SHA1_DATA_SIZE;
- }
- ctx->index = length;
- if (length)
- /* Buffer leftovers */
- memcpy(ctx->block, buffer, length);
+ }
+ while (length >= SHA1_DATA_SIZE)
+ {
+ sha1_block(ctx, buffer);
+ buffer += SHA1_DATA_SIZE;
+ length -= SHA1_DATA_SIZE;
+ }
+ ctx->index = length;
+ if (length)
+ /* Buffer leftovers */
+ memcpy(ctx->block, buffer, length);
}
/* Final wrapup - pad to SHA1_DATA_SIZE-byte boundary with the bit pattern
@@ -304,84 +304,84 @@ sha1_update(struct sha1_ctx *ctx,
void
sha1_final(struct sha1_ctx *ctx)
{
- UINT32 data[SHA1_DATA_LENGTH];
- int i;
- int words;
+ UINT32 data[SHA1_DATA_LENGTH];
+ int i;
+ int words;
- i = ctx->index;
+ i = ctx->index;
- /* Set the first char of padding to 0x80. This is safe since there is
- always at least one byte free */
+ /* Set the first char of padding to 0x80. This is safe since there is
+ always at least one byte free */
- assert(i < SHA1_DATA_SIZE);
- ctx->block[i++] = 0x80;
+ assert(i < SHA1_DATA_SIZE);
+ ctx->block[i++] = 0x80;
- /* Fill rest of word */
- for( ; i & 3; i++)
- ctx->block[i] = 0;
+ /* Fill rest of word */
+ for( ; i & 3; i++)
+ ctx->block[i] = 0;
- /* i is now a multiple of the word size 4 */
- words = i >> 2;
- for (i = 0; i < words; i++)
- data[i] = READ_UINT32(ctx->block + 4*i);
+ /* i is now a multiple of the word size 4 */
+ words = i >> 2;
+ for (i = 0; i < words; i++)
+ data[i] = READ_UINT32(ctx->block + 4*i);
- if (words > (SHA1_DATA_LENGTH-2))
- { /* No room for length in this block. Process it and
+ if (words > (SHA1_DATA_LENGTH-2))
+ { /* No room for length in this block. Process it and
* pad with another one */
- for (i = words ; i < SHA1_DATA_LENGTH; i++)
+ for (i = words ; i < SHA1_DATA_LENGTH; i++)
data[i] = 0;
- sha1_transform(ctx->digest, data);
- for (i = 0; i < (SHA1_DATA_LENGTH-2); i++)
+ sha1_transform(ctx->digest, data);
+ for (i = 0; i < (SHA1_DATA_LENGTH-2); i++)
data[i] = 0;
- }
- else
- for (i = words ; i < SHA1_DATA_LENGTH - 2; i++)
- data[i] = 0;
-
- /* There are 512 = 2^9 bits in one block */
- data[SHA1_DATA_LENGTH-2] = (ctx->count_high << 9) | (ctx->count_low >> 23);
- data[SHA1_DATA_LENGTH-1] = (ctx->count_low << 9) | (ctx->index << 3);
- sha1_transform(ctx->digest, data);
+ }
+ else
+ for (i = words ; i < SHA1_DATA_LENGTH - 2; i++)
+ data[i] = 0;
+
+ /* There are 512 = 2^9 bits in one block */
+ data[SHA1_DATA_LENGTH-2] = (ctx->count_high << 9) | (ctx->count_low >> 23);
+ data[SHA1_DATA_LENGTH-1] = (ctx->count_low << 9) | (ctx->index << 3);
+ sha1_transform(ctx->digest, data);
}
void
sha1_digest(const struct sha1_ctx *ctx,
- unsigned length,
- UINT8 *digest)
+ unsigned length,
+ UINT8 *digest)
{
- unsigned i;
- unsigned words;
- unsigned leftover;
+ unsigned i;
+ unsigned words;
+ unsigned leftover;
- assert(length <= SHA1_DIGEST_SIZE);
+ assert(length <= SHA1_DIGEST_SIZE);
- words = length / 4;
- leftover = length % 4;
+ words = length / 4;
+ leftover = length % 4;
- for (i = 0; i < words; i++, digest += 4)
- WRITE_UINT32(digest, ctx->digest[i]);
+ for (i = 0; i < words; i++, digest += 4)
+ WRITE_UINT32(digest, ctx->digest[i]);
- if (leftover)
- {
- UINT32 word;
- unsigned j = leftover;
+ if (leftover)
+ {
+ UINT32 word;
+ unsigned j = leftover;
- assert(i < _SHA1_DIGEST_LENGTH);
+ assert(i < _SHA1_DIGEST_LENGTH);
- word = ctx->digest[i];
+ word = ctx->digest[i];
- switch (leftover)
+ switch (leftover)
{
default:
/* this is just here to keep the compiler happy; it can never happen */
case 3:
- digest[--j] = (word >> 8) & 0xff;
- /* Fall through */
+ digest[--j] = (word >> 8) & 0xff;
+ /* Fall through */
case 2:
- digest[--j] = (word >> 16) & 0xff;
- /* Fall through */
+ digest[--j] = (word >> 16) & 0xff;
+ /* Fall through */
case 1:
- digest[--j] = (word >> 24) & 0xff;
+ digest[--j] = (word >> 24) & 0xff;
+ }
}
- }
}
diff --git a/src/lib/util/sha1.h b/src/lib/util/sha1.h
index 028f3303cb1..dcec92e453d 100644
--- a/src/lib/util/sha1.h
+++ b/src/lib/util/sha1.h
@@ -36,10 +36,10 @@
struct sha1_ctx
{
- UINT32 digest[_SHA1_DIGEST_LENGTH]; /* Message digest */
- UINT32 count_low, count_high; /* 64-bit block count */
- UINT8 block[SHA1_DATA_SIZE]; /* SHA1 data buffer */
- unsigned int index; /* index into buffer */
+ UINT32 digest[_SHA1_DIGEST_LENGTH]; /* Message digest */
+ UINT32 count_low, count_high; /* 64-bit block count */
+ UINT8 block[SHA1_DATA_SIZE]; /* SHA1 data buffer */
+ unsigned int index; /* index into buffer */
};
void
@@ -47,15 +47,15 @@ sha1_init(struct sha1_ctx *ctx);
void
sha1_update(struct sha1_ctx *ctx,
- unsigned length,
- const UINT8 *data);
+ unsigned length,
+ const UINT8 *data);
void
sha1_final(struct sha1_ctx *ctx);
void
sha1_digest(const struct sha1_ctx *ctx,
- unsigned length,
- UINT8 *digest);
+ unsigned length,
+ UINT8 *digest);
#endif /* NETTLE_SHA1_H_INCLUDED */
diff --git a/src/lib/util/tagmap.h b/src/lib/util/tagmap.h
index 23fd72a5369..9fc7297f243 100644
--- a/src/lib/util/tagmap.h
+++ b/src/lib/util/tagmap.h
@@ -83,9 +83,9 @@ public:
// construction/destruction
entry_t(const char *tag, UINT32 fullhash, _ElementType object)
: m_next(NULL),
- m_fullhash(fullhash),
- m_tag(tag),
- m_object(object) { }
+ m_fullhash(fullhash),
+ m_tag(tag),
+ m_object(object) { }
// accessors
const astring &tag() const { return m_tag; }
@@ -100,10 +100,10 @@ public:
UINT32 fullhash() const { return m_fullhash; }
// internal state
- entry_t * m_next;
- UINT32 m_fullhash;
- astring m_tag;
- _ElementType m_object;
+ entry_t * m_next;
+ UINT32 m_fullhash;
+ astring m_tag;
+ _ElementType m_object;
};
// construction/destruction
@@ -204,7 +204,7 @@ private:
}
// internal state
- entry_t * m_table[_HashSize];
+ entry_t * m_table[_HashSize];
};
diff --git a/src/lib/util/un7z.c b/src/lib/util/un7z.c
index a391d0b82a2..d5fe9c3242e 100644
--- a/src/lib/util/un7z.c
+++ b/src/lib/util/un7z.c
@@ -103,7 +103,7 @@ WRes File_Read(CSzFile *p, void *data, size_t *size)
return 0;
// err =
- osd_read( p->_7z_osdfile, data, p->_7z_currfpos, originalSize, &read_length );
+ osd_read( p->_7z_osdfile, data, p->_7z_currfpos, originalSize, &read_length );
*size = read_length;
p->_7z_currfpos += read_length;
@@ -139,13 +139,13 @@ WRes File_GetLength(CSzFile *p, UInt64 *length)
static SRes FileSeqInStream_Read(void *pp, void *buf, size_t *size)
{
- CFileSeqInStream *p = (CFileSeqInStream *)pp;
- return File_Read(&p->file, buf, size) == 0 ? SZ_OK : SZ_ERROR_READ;
+ CFileSeqInStream *p = (CFileSeqInStream *)pp;
+ return File_Read(&p->file, buf, size) == 0 ? SZ_OK : SZ_ERROR_READ;
}
void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
{
- p->s.Read = FileSeqInStream_Read;
+ p->s.Read = FileSeqInStream_Read;
}
@@ -173,14 +173,14 @@ void FileInStream_CreateVTable(CFileInStream *p)
static size_t FileOutStream_Write(void *pp, const void *data, size_t size)
{
- CFileOutStream *p = (CFileOutStream *)pp;
- File_Write(&p->file, data, &size);
- return size;
+ CFileOutStream *p = (CFileOutStream *)pp;
+ File_Write(&p->file, data, &size);
+ return size;
}
void FileOutStream_CreateVTable(CFileOutStream *p)
{
- p->s.Write = FileOutStream_Write;
+ p->s.Write = FileOutStream_Write;
}
/***************************************************************************
@@ -188,7 +188,7 @@ void FileOutStream_CreateVTable(CFileOutStream *p)
***************************************************************************/
/* number of open files to cache */
-#define _7Z_CACHE_SIZE 8
+#define _7Z_CACHE_SIZE 8
/***************************************************************************
@@ -513,5 +513,3 @@ static void free__7z_file(_7z_file *_7z)
free(_7z);
}
}
-
-
diff --git a/src/lib/util/un7z.h b/src/lib/util/un7z.h
index f80bc4b12ab..9f7618a982e 100644
--- a/src/lib/util/un7z.h
+++ b/src/lib/util/un7z.h
@@ -59,8 +59,8 @@ void SZipFreeTemp(void *p, void *address);
struct CSzFile
{
long _7z_currfpos;
- UINT64 _7z_length;
- osd_file * _7z_osdfile; /* OSD file handle */
+ UINT64 _7z_length;
+ osd_file * _7z_osdfile; /* OSD file handle */
};
@@ -121,11 +121,11 @@ enum _7z_error
/* describes an open _7Z file */
struct _7z_file
{
- const char * filename; /* copy of _7Z filename (for caching) */
+ const char * filename; /* copy of _7Z filename (for caching) */
- int curr_file_idx; /* current file index */
- UINT64 uncompressed_length; /* current file uncompressed length */
- UINT64 crc; /* current file crc */
+ int curr_file_idx; /* current file index */
+ UINT64 uncompressed_length; /* current file uncompressed length */
+ UINT64 crc; /* current file crc */
CFileInStream archiveStream;
CLookToRead lookStream;
@@ -169,4 +169,4 @@ int _7z_search_crc_match(_7z_file *new_7z, UINT32 crc, const char *search_filena
_7z_error _7z_file_decompress(_7z_file *_7z, void *buffer, UINT32 length);
-#endif /* __UN_7Z_H__ */
+#endif /* __UN_7Z_H__ */
diff --git a/src/lib/util/unicode.h b/src/lib/util/unicode.h
index e59c6fe862b..aa3d3900845 100644
--- a/src/lib/util/unicode.h
+++ b/src/lib/util/unicode.h
@@ -60,30 +60,30 @@
/* these defines specify the maximum size of different types of Unicode
* character encodings */
-#define UTF8_CHAR_MAX 6
-#define UTF16_CHAR_MAX 2
+#define UTF8_CHAR_MAX 6
+#define UTF16_CHAR_MAX 2
/* these are UTF-8 encoded strings for common characters */
-#define UTF8_NBSP "\xc2\xa0" /* non-breaking space */
-#define UTF8_MULTIPLY "\xc3\x97" /* multiplication symbol */
-#define UTF8_DEGREES "\xc2\xb0" /* degrees symbol */
+#define UTF8_NBSP "\xc2\xa0" /* non-breaking space */
+#define UTF8_MULTIPLY "\xc3\x97" /* multiplication symbol */
+#define UTF8_DEGREES "\xc2\xb0" /* degrees symbol */
-#define a_RING "\xc3\xa5" /* small a with a ring */
-#define a_UMLAUT "\xc3\xa4" /* small a with an umlaut */
-#define o_UMLAUT "\xc3\xb6" /* small o with an umlaut */
-#define u_UMLAUT "\xc3\xbc" /* small u with an umlaut */
-#define e_ACUTE "\xc3\xa9" /* small e with an acute */
+#define a_RING "\xc3\xa5" /* small a with a ring */
+#define a_UMLAUT "\xc3\xa4" /* small a with an umlaut */
+#define o_UMLAUT "\xc3\xb6" /* small o with an umlaut */
+#define u_UMLAUT "\xc3\xbc" /* small u with an umlaut */
+#define e_ACUTE "\xc3\xa9" /* small e with an acute */
-#define A_RING "\xc3\x85" /* capital A with a ring */
-#define A_UMLAUT "\xc3\x84" /* capital A with an umlaut */
-#define O_UMLAUT "\xc3\x96" /* capital O with an umlaut */
-#define U_UMLAUT "\xc3\x9c" /* capital U with an umlaut */
-#define E_ACUTE "\xc3\x89" /* capital E with an acute */
+#define A_RING "\xc3\x85" /* capital A with a ring */
+#define A_UMLAUT "\xc3\x84" /* capital A with an umlaut */
+#define O_UMLAUT "\xc3\x96" /* capital O with an umlaut */
+#define U_UMLAUT "\xc3\x9c" /* capital U with an umlaut */
+#define E_ACUTE "\xc3\x89" /* capital E with an acute */
-#define UTF8_LEFT "\xe2\x86\x90" /* cursor left */
-#define UTF8_RIGHT "\xe2\x86\x92" /* cursor right */
-#define UTF8_UP "\xe2\x86\x91" /* cursor up */
-#define UTF8_DOWN "\xe2\x86\x93" /* cursor down */
+#define UTF8_LEFT "\xe2\x86\x90" /* cursor left */
+#define UTF8_RIGHT "\xe2\x86\x92" /* cursor right */
+#define UTF8_UP "\xe2\x86\x91" /* cursor up */
+#define UTF8_DOWN "\xe2\x86\x93" /* cursor down */
@@ -124,15 +124,15 @@ int utf8_is_valid_string(const char *utf8string);
***************************************************************************/
#ifdef LSB_FIRST
-#define uchar_from_utf16be uchar_from_utf16f
-#define uchar_from_utf16le uchar_from_utf16
-#define utf16be_from_uchar utf16f_from_uchar
-#define utf16le_from_uchar utf16_from_uchar
+#define uchar_from_utf16be uchar_from_utf16f
+#define uchar_from_utf16le uchar_from_utf16
+#define utf16be_from_uchar utf16f_from_uchar
+#define utf16le_from_uchar utf16_from_uchar
#else
-#define uchar_from_utf16be uchar_from_utf16
-#define uchar_from_utf16le uchar_from_utf16f
-#define utf16be_from_uchar utf16_from_uchar
-#define utf16le_from_uchar utf16f_from_uchar
+#define uchar_from_utf16be uchar_from_utf16
+#define uchar_from_utf16le uchar_from_utf16f
+#define utf16be_from_uchar utf16_from_uchar
+#define utf16le_from_uchar utf16f_from_uchar
#endif
#endif /* UNICODE_H */
diff --git a/src/lib/util/unzip.c b/src/lib/util/unzip.c
index 847d7615659..ab0fc2dc304 100644
--- a/src/lib/util/unzip.c
+++ b/src/lib/util/unzip.c
@@ -51,54 +51,54 @@
***************************************************************************/
/* number of open files to cache */
-#define ZIP_CACHE_SIZE 8
+#define ZIP_CACHE_SIZE 8
/* offsets in end of central directory structure */
-#define ZIPESIG 0x00
-#define ZIPEDSK 0x04
-#define ZIPECEN 0x06
-#define ZIPENUM 0x08
-#define ZIPECENN 0x0a
-#define ZIPECSZ 0x0c
-#define ZIPEOFST 0x10
-#define ZIPECOML 0x14
-#define ZIPECOM 0x16
+#define ZIPESIG 0x00
+#define ZIPEDSK 0x04
+#define ZIPECEN 0x06
+#define ZIPENUM 0x08
+#define ZIPECENN 0x0a
+#define ZIPECSZ 0x0c
+#define ZIPEOFST 0x10
+#define ZIPECOML 0x14
+#define ZIPECOM 0x16
/* offsets in central directory entry structure */
-#define ZIPCENSIG 0x00
-#define ZIPCVER 0x04
-#define ZIPCOS 0x05
-#define ZIPCVXT 0x06
-#define ZIPCEXOS 0x07
-#define ZIPCFLG 0x08
-#define ZIPCMTHD 0x0a
-#define ZIPCTIM 0x0c
-#define ZIPCDAT 0x0e
-#define ZIPCCRC 0x10
-#define ZIPCSIZ 0x14
-#define ZIPCUNC 0x18
-#define ZIPCFNL 0x1c
-#define ZIPCXTL 0x1e
-#define ZIPCCML 0x20
-#define ZIPDSK 0x22
-#define ZIPINT 0x24
-#define ZIPEXT 0x26
-#define ZIPOFST 0x2a
-#define ZIPCFN 0x2e
+#define ZIPCENSIG 0x00
+#define ZIPCVER 0x04
+#define ZIPCOS 0x05
+#define ZIPCVXT 0x06
+#define ZIPCEXOS 0x07
+#define ZIPCFLG 0x08
+#define ZIPCMTHD 0x0a
+#define ZIPCTIM 0x0c
+#define ZIPCDAT 0x0e
+#define ZIPCCRC 0x10
+#define ZIPCSIZ 0x14
+#define ZIPCUNC 0x18
+#define ZIPCFNL 0x1c
+#define ZIPCXTL 0x1e
+#define ZIPCCML 0x20
+#define ZIPDSK 0x22
+#define ZIPINT 0x24
+#define ZIPEXT 0x26
+#define ZIPOFST 0x2a
+#define ZIPCFN 0x2e
/* offsets in local file header structure */
-#define ZIPLOCSIG 0x00
-#define ZIPVER 0x04
-#define ZIPGENFLG 0x06
-#define ZIPMTHD 0x08
-#define ZIPTIME 0x0a
-#define ZIPDATE 0x0c
-#define ZIPCRC 0x0e
-#define ZIPSIZE 0x12
-#define ZIPUNCMP 0x16
-#define ZIPFNLN 0x1a
-#define ZIPXTRALN 0x1c
-#define ZIPNAME 0x1e
+#define ZIPLOCSIG 0x00
+#define ZIPVER 0x04
+#define ZIPGENFLG 0x06
+#define ZIPMTHD 0x08
+#define ZIPTIME 0x0a
+#define ZIPDATE 0x0c
+#define ZIPCRC 0x0e
+#define ZIPSIZE 0x12
+#define ZIPUNCMP 0x16
+#define ZIPFNLN 0x1a
+#define ZIPXTRALN 0x1c
+#define ZIPNAME 0x1e
@@ -368,37 +368,37 @@ const zip_file_header *zip_file_next_file(zip_file *zip)
zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length)
{
- zip_error ziperr;
- UINT64 offset;
+ zip_error ziperr;
+ UINT64 offset;
- /* if we don't have enough buffer, error */
- if (length < zip->header.uncompressed_length)
- return ZIPERR_BUFFER_TOO_SMALL;
+ /* if we don't have enough buffer, error */
+ if (length < zip->header.uncompressed_length)
+ return ZIPERR_BUFFER_TOO_SMALL;
- /* make sure the info in the header aligns with what we know */
+ /* make sure the info in the header aligns with what we know */
if (zip->header.start_disk_number != zip->ecd.disk_number)
return ZIPERR_UNSUPPORTED;
- /* get the compressed data offset */
- ziperr = get_compressed_data_offset(zip, &offset);
- if (ziperr != ZIPERR_NONE)
- return ziperr;
+ /* get the compressed data offset */
+ ziperr = get_compressed_data_offset(zip, &offset);
+ if (ziperr != ZIPERR_NONE)
+ return ziperr;
- /* handle compression types */
- switch (zip->header.compression)
- {
- case 0:
- ziperr = decompress_data_type_0(zip, offset, buffer, length);
- break;
+ /* handle compression types */
+ switch (zip->header.compression)
+ {
+ case 0:
+ ziperr = decompress_data_type_0(zip, offset, buffer, length);
+ break;
case 8:
- ziperr = decompress_data_type_8(zip, offset, buffer, length);
- break;
+ ziperr = decompress_data_type_8(zip, offset, buffer, length);
+ break;
- default:
- ziperr = ZIPERR_UNSUPPORTED;
- break;
- }
+ default:
+ ziperr = ZIPERR_UNSUPPORTED;
+ break;
+ }
return ziperr;
}
@@ -573,36 +573,36 @@ static zip_error decompress_data_type_0(zip_file *zip, UINT64 offset, void *buff
static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buffer, UINT32 length)
{
- UINT32 input_remaining = zip->header.compressed_length;
- UINT32 read_length;
- z_stream stream;
- int filerr;
- int zerr;
+ UINT32 input_remaining = zip->header.compressed_length;
+ UINT32 read_length;
+ z_stream stream;
+ int filerr;
+ int zerr;
/* make sure we don't need a newer mechanism */
if (zip->header.version_needed > 0x14)
return ZIPERR_UNSUPPORTED;
- /* reset the stream */
- memset(&stream, 0, sizeof(stream));
- stream.next_out = (Bytef *)buffer;
- stream.avail_out = length;
+ /* reset the stream */
+ memset(&stream, 0, sizeof(stream));
+ stream.next_out = (Bytef *)buffer;
+ stream.avail_out = length;
- /* initialize the decompressor */
- zerr = inflateInit2(&stream, -MAX_WBITS);
- if (zerr != Z_OK)
- return ZIPERR_DECOMPRESS_ERROR;
+ /* initialize the decompressor */
+ zerr = inflateInit2(&stream, -MAX_WBITS);
+ if (zerr != Z_OK)
+ return ZIPERR_DECOMPRESS_ERROR;
- /* loop until we're done */
- while (1)
+ /* loop until we're done */
+ while (1)
{
/* read in the next chunk of data */
filerr = osd_read(zip->file, zip->buffer, offset, MIN(input_remaining, sizeof(zip->buffer)), &read_length);
if (filerr != FILERR_NONE)
{
inflateEnd(&stream);
- return ZIPERR_FILE_ERROR;
- }
+ return ZIPERR_FILE_ERROR;
+ }
offset += read_length;
/* if we read nothing, but still have data left, the file is truncated */
@@ -622,15 +622,15 @@ static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buff
stream.avail_in++;
/* now inflate */
- zerr = inflate(&stream, Z_NO_FLUSH);
- if (zerr == Z_STREAM_END)
+ zerr = inflate(&stream, Z_NO_FLUSH);
+ if (zerr == Z_STREAM_END)
break;
if (zerr != Z_OK)
{
inflateEnd(&stream);
return ZIPERR_DECOMPRESS_ERROR;
}
- }
+ }
/* finish decompression */
zerr = inflateEnd(&stream);
diff --git a/src/lib/util/unzip.h b/src/lib/util/unzip.h
index e199e1c3b74..ecdc0ea7f90 100644
--- a/src/lib/util/unzip.h
+++ b/src/lib/util/unzip.h
@@ -49,7 +49,7 @@
CONSTANTS
***************************************************************************/
-#define ZIP_DECOMPRESS_BUFSIZE 16384
+#define ZIP_DECOMPRESS_BUFSIZE 16384
/* Error types */
enum zip_error
@@ -74,63 +74,63 @@ enum zip_error
/* contains extracted file header information */
struct zip_file_header
{
- UINT32 signature; /* central file header signature */
- UINT16 version_created; /* version made by */
- UINT16 version_needed; /* version needed to extract */
- UINT16 bit_flag; /* general purpose bit flag */
- UINT16 compression; /* compression method */
- UINT16 file_time; /* last mod file time */
- UINT16 file_date; /* last mod file date */
- UINT32 crc; /* crc-32 */
- UINT32 compressed_length; /* compressed size */
- UINT32 uncompressed_length; /* uncompressed size */
- UINT16 filename_length; /* filename length */
- UINT16 extra_field_length; /* extra field length */
- UINT16 file_comment_length; /* file comment length */
- UINT16 start_disk_number; /* disk number start */
- UINT16 internal_attributes; /* internal file attributes */
- UINT32 external_attributes; /* external file attributes */
- UINT32 local_header_offset; /* relative offset of local header */
- const char * filename; /* filename */
-
- UINT8 * raw; /* pointer to the raw data */
- UINT32 rawlength; /* length of the raw data */
- UINT8 saved; /* saved byte from after filename */
+ UINT32 signature; /* central file header signature */
+ UINT16 version_created; /* version made by */
+ UINT16 version_needed; /* version needed to extract */
+ UINT16 bit_flag; /* general purpose bit flag */
+ UINT16 compression; /* compression method */
+ UINT16 file_time; /* last mod file time */
+ UINT16 file_date; /* last mod file date */
+ UINT32 crc; /* crc-32 */
+ UINT32 compressed_length; /* compressed size */
+ UINT32 uncompressed_length; /* uncompressed size */
+ UINT16 filename_length; /* filename length */
+ UINT16 extra_field_length; /* extra field length */
+ UINT16 file_comment_length; /* file comment length */
+ UINT16 start_disk_number; /* disk number start */
+ UINT16 internal_attributes; /* internal file attributes */
+ UINT32 external_attributes; /* external file attributes */
+ UINT32 local_header_offset; /* relative offset of local header */
+ const char * filename; /* filename */
+
+ UINT8 * raw; /* pointer to the raw data */
+ UINT32 rawlength; /* length of the raw data */
+ UINT8 saved; /* saved byte from after filename */
};
/* contains extracted end of central directory information */
struct zip_ecd
{
- UINT32 signature; /* end of central dir signature */
- UINT16 disk_number; /* number of this disk */
- UINT16 cd_start_disk_number; /* number of the disk with the start of the central directory */
- UINT16 cd_disk_entries; /* total number of entries in the central directory on this disk */
- UINT16 cd_total_entries; /* total number of entries in the central directory */
- UINT32 cd_size; /* size of the central directory */
- UINT32 cd_start_disk_offset; /* offset of start of central directory with respect to the starting disk number */
- UINT16 comment_length; /* .ZIP file comment length */
- const char * comment; /* .ZIP file comment */
-
- UINT8 * raw; /* pointer to the raw data */
- UINT32 rawlength; /* length of the raw data */
+ UINT32 signature; /* end of central dir signature */
+ UINT16 disk_number; /* number of this disk */
+ UINT16 cd_start_disk_number; /* number of the disk with the start of the central directory */
+ UINT16 cd_disk_entries; /* total number of entries in the central directory on this disk */
+ UINT16 cd_total_entries; /* total number of entries in the central directory */
+ UINT32 cd_size; /* size of the central directory */
+ UINT32 cd_start_disk_offset; /* offset of start of central directory with respect to the starting disk number */
+ UINT16 comment_length; /* .ZIP file comment length */
+ const char * comment; /* .ZIP file comment */
+
+ UINT8 * raw; /* pointer to the raw data */
+ UINT32 rawlength; /* length of the raw data */
};
/* describes an open ZIP file */
struct zip_file
{
- const char * filename; /* copy of ZIP filename (for caching) */
- osd_file * file; /* OSD file handle */
- UINT64 length; /* length of zip file */
+ const char * filename; /* copy of ZIP filename (for caching) */
+ osd_file * file; /* OSD file handle */
+ UINT64 length; /* length of zip file */
- zip_ecd ecd; /* end of central directory */
+ zip_ecd ecd; /* end of central directory */
- UINT8 * cd; /* central directory raw data */
- UINT32 cd_pos; /* position in central directory */
- zip_file_header header; /* current file header */
+ UINT8 * cd; /* central directory raw data */
+ UINT32 cd_pos; /* position in central directory */
+ zip_file_header header; /* current file header */
- UINT8 buffer[ZIP_DECOMPRESS_BUFSIZE]; /* buffer for decompression */
+ UINT8 buffer[ZIP_DECOMPRESS_BUFSIZE]; /* buffer for decompression */
};
@@ -164,4 +164,4 @@ const zip_file_header *zip_file_next_file(zip_file *zip);
zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length);
-#endif /* __UNZIP_H__ */
+#endif /* __UNZIP_H__ */
diff --git a/src/lib/util/vbiparse.c b/src/lib/util/vbiparse.c
index 89a800fb683..7f530fe9a92 100644
--- a/src/lib/util/vbiparse.c
+++ b/src/lib/util/vbiparse.c
@@ -47,7 +47,7 @@
DEBUGGING
***************************************************************************/
-#define PRINTF_WHITE_FLAG 0
+#define PRINTF_WHITE_FLAG 0
@@ -55,8 +55,8 @@
CONSTANTS
***************************************************************************/
-#define MAX_SOURCE_WIDTH 1024
-#define MAX_CLOCK_DIFF 3
+#define MAX_SOURCE_WIDTH 1024
+#define MAX_CLOCK_DIFF 3
@@ -249,19 +249,19 @@ int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift)
}
/*
- At this point, there are two approaches that have been tried:
+ At this point, there are two approaches that have been tried:
- 1. Find the peak value and call it white if the peak is above
- the 90% line
+ 1. Find the peak value and call it white if the peak is above
+ the 90% line
- 2. Ignore the first and last 20% of the line and count how
- many pixels are above some threshold (75% line was used).
- Call it white if at least 80% of the pixels are above
- the threshold.
+ 2. Ignore the first and last 20% of the line and count how
+ many pixels are above some threshold (75% line was used).
+ Call it white if at least 80% of the pixels are above
+ the threshold.
- Both approaches agree 99% of the time, but the first tends to
- be more correct when there is a discrepancy.
- */
+ Both approaches agree 99% of the time, but the first tends to
+ be more correct when there is a discrepancy.
+ */
/* determine where the peak is */
peakval = 0;
@@ -403,4 +403,3 @@ void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *sourc
vbi->line18 = (source[10] << 16) | (source[11] << 8) | source[12];
vbi->line1718 = (source[13] << 16) | (source[14] << 8) | source[15];
}
-
diff --git a/src/lib/util/vbiparse.h b/src/lib/util/vbiparse.h
index b2fb6739f04..1a822e6cd22 100644
--- a/src/lib/util/vbiparse.h
+++ b/src/lib/util/vbiparse.h
@@ -48,29 +48,29 @@
***************************************************************************/
/* size of packed VBI data */
-#define VBI_PACKED_BYTES 16
+#define VBI_PACKED_BYTES 16
/* these codes are full 24-bit codes with no parameter data */
-#define VBI_CODE_LEADIN 0x88ffff
-#define VBI_CODE_LEADOUT 0x80eeee
-#define VBI_CODE_STOP 0x82cfff
-#define VBI_CODE_CLV 0x87ffff
+#define VBI_CODE_LEADIN 0x88ffff
+#define VBI_CODE_LEADOUT 0x80eeee
+#define VBI_CODE_STOP 0x82cfff
+#define VBI_CODE_CLV 0x87ffff
/* these codes require a mask because some bits are parameters */
-#define VBI_MASK_CAV_PICTURE 0xf00000
-#define VBI_CODE_CAV_PICTURE 0xf00000
-#define VBI_MASK_CHAPTER 0xf00fff
-#define VBI_CODE_CHAPTER 0x800ddd
-#define VBI_MASK_CLV_TIME 0xf0ff00
-#define VBI_CODE_CLV_TIME 0xf0dd00
-#define VBI_MASK_STATUS_CX_ON 0xfff000
-#define VBI_CODE_STATUS_CX_ON 0x8dc000
-#define VBI_MASK_STATUS_CX_OFF 0xfff000
-#define VBI_CODE_STATUS_CX_OFF 0x8bc000
-#define VBI_MASK_USER 0xf0f000
-#define VBI_CODE_USER 0x80d000
-#define VBI_MASK_CLV_PICTURE 0xf0f000
-#define VBI_CODE_CLV_PICTURE 0x80e000
+#define VBI_MASK_CAV_PICTURE 0xf00000
+#define VBI_CODE_CAV_PICTURE 0xf00000
+#define VBI_MASK_CHAPTER 0xf00fff
+#define VBI_CODE_CHAPTER 0x800ddd
+#define VBI_MASK_CLV_TIME 0xf0ff00
+#define VBI_CODE_CLV_TIME 0xf0dd00
+#define VBI_MASK_STATUS_CX_ON 0xfff000
+#define VBI_CODE_STATUS_CX_ON 0x8dc000
+#define VBI_MASK_STATUS_CX_OFF 0xfff000
+#define VBI_CODE_STATUS_CX_OFF 0x8bc000
+#define VBI_MASK_USER 0xf0f000
+#define VBI_CODE_USER 0x80d000
+#define VBI_MASK_CLV_PICTURE 0xf0f000
+#define VBI_CODE_CLV_PICTURE 0x80e000
@@ -78,8 +78,8 @@
MACROS
***************************************************************************/
-#define VBI_CAV_PICTURE(x) (((((x) >> 16) & 0x07) * 10000) + ((((x) >> 12) & 0x0f) * 1000) + ((((x) >> 8) & 0x0f) * 100) + ((((x) >> 4) & 0x0f) * 10) + ((((x) >> 0) & 0x0f) * 1))
-#define VBI_CHAPTER(x) (((((x) >> 16) & 0x07) * 10) + ((((x) >> 12) & 0x0f) * 1))
+#define VBI_CAV_PICTURE(x) (((((x) >> 16) & 0x07) * 10000) + ((((x) >> 12) & 0x0f) * 1000) + ((((x) >> 8) & 0x0f) * 100) + ((((x) >> 4) & 0x0f) * 10) + ((((x) >> 0) & 0x0f) * 1))
+#define VBI_CHAPTER(x) (((((x) >> 16) & 0x07) * 10) + ((((x) >> 12) & 0x0f) * 1))
@@ -89,11 +89,11 @@
struct vbi_metadata
{
- UINT8 white; /* white flag: on or off */
- UINT32 line16; /* line 16 code */
- UINT32 line17; /* line 17 code */
- UINT32 line18; /* line 18 code */
- UINT32 line1718; /* most plausible value from lines 17/18 */
+ UINT8 white; /* white flag: on or off */
+ UINT32 line16; /* line 16 code */
+ UINT32 line17; /* line 17 code */
+ UINT32 line18; /* line 18 code */
+ UINT32 line1718; /* most plausible value from lines 17/18 */
};
diff --git a/src/lib/util/xmlfile.c b/src/lib/util/xmlfile.c
index 94abcd6a199..de544c5810a 100644
--- a/src/lib/util/xmlfile.c
+++ b/src/lib/util/xmlfile.c
@@ -46,7 +46,7 @@
CONSTANTS
***************************************************************************/
-#define TEMP_BUFFER_SIZE 4096
+#define TEMP_BUFFER_SIZE 4096
@@ -56,10 +56,10 @@
struct xml_parse_info
{
- XML_Parser parser;
- xml_data_node * rootnode;
- xml_data_node * curnode;
- UINT32 flags;
+ XML_Parser parser;
+ xml_data_node * rootnode;
+ xml_data_node * curnode;
+ UINT32 flags;
};
diff --git a/src/lib/util/xmlfile.h b/src/lib/util/xmlfile.h
index b422cb0ff07..1b466e8f3f4 100644
--- a/src/lib/util/xmlfile.h
+++ b/src/lib/util/xmlfile.h
@@ -77,40 +77,40 @@ struct XML_ParserStruct;
/* a node representing an attribute */
struct xml_attribute_node
{
- xml_attribute_node * next; /* pointer to next attribute node */
- const char * name; /* pointer to copy of tag name */
- const char * value; /* pointer to copy of value string */
+ xml_attribute_node * next; /* pointer to next attribute node */
+ const char * name; /* pointer to copy of tag name */
+ const char * value; /* pointer to copy of value string */
};
/* a node representing a data item and its relationships */
struct xml_data_node
{
- xml_data_node * next; /* pointer to next sibling node */
- xml_data_node * parent; /* pointer to parent node */
- xml_data_node * child; /* pointer to first child node */
- const char * name; /* pointer to copy of tag name */
- const char * value; /* pointer to copy of value string */
- xml_attribute_node * attribute; /* pointer to array of attribute nodes */
- int line; /* line number for this node's start */
+ xml_data_node * next; /* pointer to next sibling node */
+ xml_data_node * parent; /* pointer to parent node */
+ xml_data_node * child; /* pointer to first child node */
+ const char * name; /* pointer to copy of tag name */
+ const char * value; /* pointer to copy of value string */
+ xml_attribute_node * attribute; /* pointer to array of attribute nodes */
+ int line; /* line number for this node's start */
};
/* extended error information from parsing */
struct xml_parse_error
{
- const char * error_message;
- int error_line;
- int error_column;
+ const char * error_message;
+ int error_line;
+ int error_column;
};
/* parsing options */
struct xml_parse_options
{
- xml_parse_error * error;
- void (*init_parser)(struct XML_ParserStruct *parser);
- UINT32 flags;
+ xml_parse_error * error;
+ void (*init_parser)(struct XML_ParserStruct *parser);
+ UINT32 flags;
};
@@ -194,4 +194,4 @@ xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *nam
/* normalize a string into something that can be written to an XML file */
const char *xml_normalize_string(const char *string);
-#endif /* __XMLFILE_H__ */
+#endif /* __XMLFILE_H__ */
diff --git a/src/lib/util/zippath.c b/src/lib/util/zippath.c
index 3f7d62ba2c3..c8c7fdee219 100644
--- a/src/lib/util/zippath.c
+++ b/src/lib/util/zippath.c
@@ -32,10 +32,10 @@ class zippath_directory
public:
zippath_directory()
: returned_parent(false),
- directory(NULL),
- called_zip_first(false),
- zipfile(NULL),
- returned_dirlist(NULL) { }
+ directory(NULL),
+ called_zip_first(false),
+ zipfile(NULL),
+ returned_dirlist(NULL) { }
/* common */
bool returned_parent;
@@ -481,9 +481,9 @@ static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const cha
i = 0;
j = 0;
last_char = '/';
- while(((c1 = next_path_char(header->filename, &i)) == (c2 = next_path_char(subpath, &j))) &&
- ( c1 != '\0' && c2 != '\0' ))
- last_char = c2;
+ while(((c1 = next_path_char(header->filename, &i)) == (c2 = next_path_char(subpath, &j))) &&
+ ( c1 != '\0' && c2 != '\0' ))
+ last_char = c2;
if (c2 == '\0')