summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Angelo Salese <angelosa@users.noreply.github.com>2012-02-19 15:23:23 +0000
committerGravatarGravatar Angelo Salese <angelosa@users.noreply.github.com>2012-02-19 15:23:23 +0000
commitcf4b58b6f630f0f7ef2d14be8f48de781de85170 (patch)
treefda19b40204c84e17d2c5965a7a1b7f15b6f85da
parent2f8094ea333d06e32d2694a467a4b40e0aa835c1 (diff)
Clean-ups and version bumpmame0145u1
-rw-r--r--src/emu/clifront.c4
-rw-r--r--src/emu/cpu/m68000/m68k_in.c4
-rw-r--r--src/emu/cpu/m68000/m68kmmu.h6
-rw-r--r--src/emu/emuopts.c2
-rw-r--r--src/emu/hash.c30
-rw-r--r--src/emu/machine/idectrl.c18
-rw-r--r--src/emu/machine/idectrl.h12
-rw-r--r--src/emu/machine/nscsi_bus.c6
-rw-r--r--src/emu/machine/nscsi_bus.h6
-rw-r--r--src/emu/machine/nscsi_hd.c2
-rw-r--r--src/emu/romload.c22
-rw-r--r--src/emu/sound/samples.c38
-rw-r--r--src/emu/sound/samples.h16
-rw-r--r--src/emu/sound/votrax.c22
-rw-r--r--src/emu/sound/votrax.h4
-rw-r--r--src/emu/video/pc_vga.c8
-rw-r--r--src/ldplayer/ldplayer.c4
-rw-r--r--src/lib/formats/pc_dsk.c2
-rw-r--r--src/lib/lib7z/7z.h6
-rw-r--r--src/lib/lib7z/7zCrc.c4
-rw-r--r--src/lib/lib7z/7zIn.c24
-rw-r--r--src/lib/lib7z/Aes.c6
-rw-r--r--src/lib/lib7z/Alloc.c4
-rw-r--r--src/lib/lib7z/Bra.c10
-rw-r--r--src/lib/lib7z/Bra.h8
-rw-r--r--src/lib/lib7z/BraIA64.c10
-rw-r--r--src/lib/lib7z/BwtSort.c16
-rw-r--r--src/lib/lib7z/CpuArch.c2
-rw-r--r--src/lib/lib7z/HuffEnc.c20
-rw-r--r--src/lib/lib7z/HuffEnc.h2
-rw-r--r--src/lib/lib7z/LzFind.c4
-rw-r--r--src/lib/lib7z/LzFindMt.c16
-rw-r--r--src/lib/lib7z/LzFindMt.h4
-rw-r--r--src/lib/lib7z/Lzma2Dec.c14
-rw-r--r--src/lib/lib7z/Lzma2Enc.c18
-rw-r--r--src/lib/lib7z/Lzma86Enc.c6
-rw-r--r--src/lib/lib7z/LzmaDec.c12
-rw-r--r--src/lib/lib7z/LzmaDec.h4
-rw-r--r--src/lib/lib7z/LzmaEnc.c40
-rw-r--r--src/lib/lib7z/LzmaLib.h4
-rw-r--r--src/lib/lib7z/MtCoder.c4
-rw-r--r--src/lib/lib7z/MtCoder.h4
-rw-r--r--src/lib/lib7z/Ppmd.h2
-rw-r--r--src/lib/lib7z/Ppmd7.c36
-rw-r--r--src/lib/lib7z/Ppmd7.h2
-rw-r--r--src/lib/lib7z/Ppmd7Dec.c4
-rw-r--r--src/lib/lib7z/Ppmd7Enc.c6
-rw-r--r--src/lib/lib7z/Ppmd8.c52
-rw-r--r--src/lib/lib7z/Ppmd8.h2
-rw-r--r--src/lib/lib7z/Ppmd8Dec.c4
-rw-r--r--src/lib/lib7z/Ppmd8Enc.c6
-rw-r--r--src/lib/lib7z/Sha256.c2
-rw-r--r--src/lib/lib7z/Xz.h2
-rw-r--r--src/lib/lib7z/XzDec.c24
-rw-r--r--src/lib/lib7z/XzEnc.c10
-rw-r--r--src/lib/lib7z/XzIn.c6
-rw-r--r--src/lib/lib7z/x7zFile.c20
-rw-r--r--src/lib/util/avhuff.c52
-rw-r--r--src/lib/util/avhuff.h20
-rw-r--r--src/lib/util/bitstream.h8
-rw-r--r--src/lib/util/cdrom.c2
-rw-r--r--src/lib/util/chd.c306
-rw-r--r--src/lib/util/chd.h148
-rw-r--r--src/lib/util/chdcodec.c58
-rw-r--r--src/lib/util/chdcodec.h18
-rw-r--r--src/lib/util/coretmpl.h4
-rw-r--r--src/lib/util/flac.c66
-rw-r--r--src/lib/util/flac.h16
-rw-r--r--src/lib/util/hashing.c82
-rw-r--r--src/lib/util/hashing.h102
-rw-r--r--src/lib/util/huffman.c46
-rw-r--r--src/lib/util/huffman.h16
-rw-r--r--src/lib/util/un7z.c20
-rw-r--r--src/mame/drivers/chihiro.c2
-rw-r--r--src/mame/drivers/coolridr.c22
-rw-r--r--src/mame/drivers/kungfur.c12
-rw-r--r--src/mame/drivers/namcos21.c4
-rw-r--r--src/mame/drivers/namcos23.c4
-rw-r--r--src/mame/drivers/naomi.c50
-rw-r--r--src/mame/drivers/neodrvr.c2
-rw-r--r--src/mame/drivers/taitogn.c2
-rw-r--r--src/mame/drivers/vamphalf.c4
-rw-r--r--src/mame/machine/n64.c30
-rw-r--r--src/mame/video/n64.c12
-rw-r--r--src/mame/video/n64.h12
-rw-r--r--src/mame/video/nmk16.c8
-rw-r--r--src/osd/sdl/sdl.mak4
-rw-r--r--src/osd/windows/winwork.c2
-rw-r--r--src/tools/chdman.c330
-rw-r--r--src/version.c2
90 files changed, 1046 insertions, 1046 deletions
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index 9a1b23554e2..35f4e51372f 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -1457,9 +1457,9 @@ void media_identifier::identify(const char *filename)
// crude, need real UTF16->UTF8 conversion ideally
for (int j=0;j<namelen;j++)
{
- temp3[j] = (UINT8)temp[j];
+ temp3[j] = (UINT8)temp[j];
}
-
+
if (!(f->IsDir) && (f->Size != 0))
{
UINT8 *data = global_alloc_array(UINT8, f->Size);
diff --git a/src/emu/cpu/m68000/m68k_in.c b/src/emu/cpu/m68000/m68k_in.c
index fd5e742a55d..2d0a2bd9bf6 100644
--- a/src/emu/cpu/m68000/m68k_in.c
+++ b/src/emu/cpu/m68000/m68k_in.c
@@ -10485,8 +10485,8 @@ M68KMAKE_OP(cinv, 32, ., .)
{
UINT16 ir = mc68kcpu->ir;
UINT8 cache = (ir >> 6) & 3;
-// UINT8 scope = (ir >> 3) & 3;
-// logerror("68040 %s: pc=%08x ir=%04x cache=%d scope=%d register=%d\n", ir & 0x0020 ? "cpush" : "cinv", REG_PPC(mc68kcpu), ir, cache, scope, ir & 7);
+// UINT8 scope = (ir >> 3) & 3;
+// logerror("68040 %s: pc=%08x ir=%04x cache=%d scope=%d register=%d\n", ir & 0x0020 ? "cpush" : "cinv", REG_PPC(mc68kcpu), ir, cache, scope, ir & 7);
switch (cache)
{
case 2:
diff --git a/src/emu/cpu/m68000/m68kmmu.h b/src/emu/cpu/m68000/m68kmmu.h
index 19e7442b4c5..8a961bfb6b0 100644
--- a/src/emu/cpu/m68000/m68kmmu.h
+++ b/src/emu/cpu/m68000/m68kmmu.h
@@ -610,11 +610,11 @@ INLINE UINT32 get_dt3_table_entry(m68ki_cpu_core *m68k, UINT32 tptr, UINT8 fc, U
static UINT32 psrp = 0, purp=0;
if(psrp != m68k->mmu_srp_aptr) {
psrp = m68k->mmu_srp_aptr;
-// fprintf(stderr, "srp = %08x\n", psrp);
+// fprintf(stderr, "srp = %08x\n", psrp);
}
if(purp != m68k->mmu_urp_aptr) {
purp = m68k->mmu_urp_aptr;
-// fprintf(stderr, "urp = %08x\n", purp);
+// fprintf(stderr, "urp = %08x\n", purp);
}
// is UDT marked valid?
@@ -791,7 +791,7 @@ void m68881_mmu_ops(m68ki_cpu_core *m68k)
}
else if ((m68k->ir & 0xffe0) == 0xf500)
{
-// logerror("68040 pflush: pc=%08x ir=%04x opmode=%d register=%d\n", REG_PPC(m68k), m68k->ir, (m68k->ir >> 3) & 3, m68k->ir & 7);
+// logerror("68040 pflush: pc=%08x ir=%04x opmode=%d register=%d\n", REG_PPC(m68k), m68k->ir, (m68k->ir >> 3) & 3, m68k->ir & 7);
pmmu_atc_flush(m68k);
}
else // the rest are 1111000xxxXXXXXX where xxx is the instruction family
diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c
index 50b2ca3ea66..ddea3ecdf9e 100644
--- a/src/emu/emuopts.c
+++ b/src/emu/emuopts.c
@@ -375,7 +375,7 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], astring &error_stri
result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
update_slot_options();
while (add_slot_options(false));
- add_device_options(true);
+ add_device_options(true);
result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
return result;
}
diff --git a/src/emu/hash.c b/src/emu/hash.c
index 5a00308cd7b..9d03e5cf9ba 100644
--- a/src/emu/hash.c
+++ b/src/emu/hash.c
@@ -179,7 +179,7 @@ bool hash_collection::add_from_string(char type, const char *buffer, int length)
// handle CRCs
if (type == HASH_CRC)
return m_has_crc32 = m_crc32.from_string(buffer, length);
-
+
// handle SHA1s
else if (type == HASH_SHA1)
return m_has_sha1 = m_sha1.from_string(buffer, length);
@@ -195,14 +195,14 @@ bool hash_collection::add_from_string(char type, const char *buffer, int length)
bool hash_collection::remove(char type)
{
bool result = false;
-
+
// handle CRCs
if (type == HASH_CRC)
{
result = m_has_crc32;
m_has_crc32 = false;
}
-
+
// handle SHA1s
else if (type == HASH_SHA1)
{
@@ -222,12 +222,12 @@ bool hash_collection::remove(char type)
const char *hash_collection::internal_string(astring &buffer) const
{
buffer.reset();
-
+
// handle CRCs
astring temp;
if (m_has_crc32)
buffer.cat(HASH_CRC).cat(m_crc32.as_string(temp));
-
+
// handle SHA1s
if (m_has_sha1)
buffer.cat(HASH_SHA1).cat(m_sha1.as_string(temp));
@@ -250,7 +250,7 @@ const char *hash_collection::macro_string(astring &buffer) const
astring temp;
if (m_has_crc32)
buffer.cat("CRC(").cat(m_crc32.as_string(temp)).cat(") ");
-
+
// handle SHA1s
if (m_has_sha1)
buffer.cat("SHA1(").cat(m_sha1.as_string(temp)).cat(") ");
@@ -277,7 +277,7 @@ const char *hash_collection::attribute_string(astring &buffer) const
astring temp;
if (m_has_crc32)
buffer.cat("crc=\"").cat(m_crc32.as_string(temp)).cat("\" ");
-
+
// handle SHA1s
if (m_has_sha1)
buffer.cat("sha1=\"").cat(m_sha1.as_string(temp)).cat("\" ");
@@ -352,7 +352,7 @@ void hash_collection::begin(const char *types)
// by default use all types
if (types == NULL)
m_creator->m_doing_crc32 = m_creator->m_doing_sha1 = true;
-
+
// otherwise, just allocate the ones that are specified
else
{
@@ -369,7 +369,7 @@ void hash_collection::begin(const char *types)
void hash_collection::buffer(const UINT8 *data, UINT32 length)
{
assert(m_creator != NULL);
-
+
// append to each active hash
if (m_creator->m_doing_crc32)
m_creator->m_crc32_creator.append(data, length);
@@ -385,24 +385,24 @@ void hash_collection::buffer(const UINT8 *data, UINT32 length)
void hash_collection::end()
{
assert(m_creator != NULL);
-
+
// default to getting nothing
m_has_crc32 = m_has_sha1 = false;
-
+
// finish up the CRC32
if (m_creator->m_doing_crc32)
{
m_has_crc32 = true;
m_crc32 = m_creator->m_crc32_creator.finish();
}
-
+
// finish up the SHA1
if (m_creator->m_doing_sha1)
{
m_has_sha1 = true;
m_sha1 = m_creator->m_sha1_creator.finish();
}
-
+
// nuke the creator
delete m_creator;
m_creator = NULL;
@@ -418,13 +418,13 @@ void hash_collection::copyfrom(const hash_collection &src)
{
// copy flags directly
m_flags = src.m_flags;
-
+
// copy hashes
m_has_crc32 = src.m_has_crc32;
m_crc32 = src.m_crc32;
m_has_sha1 = src.m_has_sha1;
m_sha1 = src.m_sha1;
- // don't copy creators
+ // don't copy creators
m_creator = NULL;
}
diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c
index 52cc6251b4d..c52272c064f 100644
--- a/src/emu/machine/idectrl.c
+++ b/src/emu/machine/idectrl.c
@@ -921,7 +921,7 @@ static void write_sector_done(ide_state *ide)
/* now do the write */
if (ide->drive[ide->cur_drive].slot) {
count = ide->drive[ide->cur_drive].slot->write_sector(lba, ide->buffer);
- }
+ }
/* by default, mark the buffer ready and the seek complete */
ide->status |= IDE_STATUS_BUFFER_READY;
@@ -1174,7 +1174,7 @@ static void handle_command(ide_state *ide, UINT8 command)
ide->status &= ~IDE_STATUS_ERROR;
ide->error = IDE_ERROR_NONE;
ide->drive[ide->cur_drive].slot->set_geometry(ide->sector_count,ide->drive[ide->cur_drive].cur_head + 1);
-
+
/* signal an interrupt */
signal_delayed_interrupt(ide, MINIMUM_COMMAND_TIME, 0);
break;
@@ -1921,7 +1921,7 @@ static DEVICE_START( ide_controller )
static DEVICE_RESET( ide_controller )
{
ide_state *ide = get_safe_token(device);
- LOG(("IDE controller reset performed\n"));
+ LOG(("IDE controller reset performed\n"));
/* reset the drive state */
ide->cur_drive = 0;
ide->status = IDE_STATUS_DRIVE_READY | IDE_STATUS_SEEK_COMPLETE;
@@ -1938,7 +1938,7 @@ SLOT_INTERFACE_START(ide_image_devices)
SLOT_INTERFACE_END
SLOT_INTERFACE_START(ide_devices)
- SLOT_INTERFACE("hdd", IDE_HARDDISK)
+ SLOT_INTERFACE("hdd", IDE_HARDDISK)
SLOT_INTERFACE_END
/*-------------------------------------------------
@@ -2060,7 +2060,7 @@ void ide_hdd_device::device_reset()
{
m_handle = get_disk_handle(machine(), owner()->tag());
m_disk = hard_disk_open(m_handle);
-
+
if (m_disk != NULL)
{
const hard_disk_info *hdinfo = hard_disk_get_info(m_disk);
@@ -2072,11 +2072,11 @@ void ide_hdd_device::device_reset()
if (PRINTF_IDE_COMMANDS) mame_printf_debug("CHS: %d %d %d\n", m_num_cylinders, m_num_heads, m_num_sectors);
mame_printf_debug("CHS: %d %d %d\n", m_num_cylinders, m_num_heads, m_num_sectors);
}
- // build the features page
+ // build the features page
UINT32 metalength;
if (m_handle->read_metadata (HARD_DISK_IDENT_METADATA_TAG, 0, m_features, IDE_DISK_SECTOR_SIZE, metalength) != CHDERR_NONE)
ide_build_features();
- }
+ }
}
//-------------------------------------------------
@@ -2137,7 +2137,7 @@ void ide_hdd_image_device::device_reset()
m_num_heads = hdinfo->heads;
if (PRINTF_IDE_COMMANDS) printf("CHS: %d %d %d\n", m_num_cylinders, m_num_heads, m_num_sectors);
}
- // build the features page
+ // build the features page
UINT32 metalength;
if (m_handle->read_metadata (HARD_DISK_IDENT_METADATA_TAG, 0, m_features, IDE_DISK_SECTOR_SIZE, metalength) != CHDERR_NONE)
ide_build_features();
@@ -2152,7 +2152,7 @@ void ide_hdd_image_device::device_reset()
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( hdd_image )
MCFG_HARDDISK_ADD( "harddisk" )
-MACHINE_CONFIG_END
+MACHINE_CONFIG_END
machine_config_constructor ide_hdd_image_device::device_mconfig_additions() const
{
diff --git a/src/emu/machine/idectrl.h b/src/emu/machine/idectrl.h
index 47c92ac511b..ae5ca6c52bb 100644
--- a/src/emu/machine/idectrl.h
+++ b/src/emu/machine/idectrl.h
@@ -33,8 +33,8 @@ public:
public:
virtual int read_sector(UINT32 lba, void *buffer) = 0;
virtual int write_sector(UINT32 lba, const void *buffer) = 0;
-
- UINT8 *get_features() { return m_features;}
+
+ UINT8 *get_features() { return m_features;}
UINT16 get_cylinders() { return m_num_cylinders; }
UINT16 get_sectors() { return m_num_sectors; }
@@ -59,12 +59,12 @@ public:
ide_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
int read_sector(UINT32 lba, void *buffer) { return (m_dev) ? m_dev->read_sector(lba,buffer) : 0; }
- int write_sector(UINT32 lba, const void *buffer) { return (m_dev) ? m_dev->write_sector(lba,buffer) : 0; }
- UINT8 *get_features() { return (m_dev) ? m_dev->get_features() : NULL;}
+ int write_sector(UINT32 lba, const void *buffer) { return (m_dev) ? m_dev->write_sector(lba,buffer) : 0; }
+ UINT8 *get_features() { return (m_dev) ? m_dev->get_features() : NULL;}
UINT16 get_cylinders() { return (m_dev) ? m_dev->get_cylinders() : 0; }
UINT16 get_sectors() { return (m_dev) ? m_dev->get_sectors() : 0; }
- UINT16 get_heads() { return (m_dev) ? m_dev->get_heads() : 0; }
+ UINT16 get_heads() { return (m_dev) ? m_dev->get_heads() : 0; }
void set_geometry(UINT8 sectors, UINT8 heads) { if (m_dev) m_dev->set_geometry(sectors,heads); }
bool is_ready() { return (m_dev) ? m_dev->is_ready() : false; }
void read_key(UINT8 key[]) { if (m_dev) m_dev->read_key(key); }
@@ -96,7 +96,7 @@ protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
-
+
void ide_build_features();
virtual bool is_ready() { return (m_disk != NULL); }
protected:
diff --git a/src/emu/machine/nscsi_bus.c b/src/emu/machine/nscsi_bus.c
index dc11575af82..816d7e26010 100644
--- a/src/emu/machine/nscsi_bus.c
+++ b/src/emu/machine/nscsi_bus.c
@@ -68,7 +68,7 @@ void nscsi_bus_device::regen_ctrl(int refid)
}
logerror("\n");
}
-
+
octrl = octrl ^ ctrl;
if(octrl)
for(int i=0; i<devcnt; i++)
@@ -357,7 +357,7 @@ void nscsi_full_device::step(bool timeout)
} else
target_recv_byte();
break;
-
+
default:
logerror("%s: step() unexpected state %d.%d\n",
tag(),
@@ -442,7 +442,7 @@ nscsi_full_device::control *nscsi_full_device::buf_control_pop()
buf_control_rpos++;
if(buf_control_rpos == buf_control_wpos)
buf_control_rpos = buf_control_wpos = 0;
- return c;
+ return c;
}
void nscsi_full_device::scsi_status_complete(UINT8 st)
diff --git a/src/emu/machine/nscsi_bus.h b/src/emu/machine/nscsi_bus.h
index ea34ad0cbe9..989bd95a965 100644
--- a/src/emu/machine/nscsi_bus.h
+++ b/src/emu/machine/nscsi_bus.h
@@ -7,7 +7,7 @@
MCFG_DEVICE_ADD(_tag, NSCSI_BUS, 0)
#define MCFG_NSCSI_DEVICE_ADD(_tag, _subtag, _type, _clock) \
- MCFG_DEVICE_ADD(_tag, NSCSI_CONNECTOR, 0) \
+ MCFG_DEVICE_ADD(_tag, NSCSI_CONNECTOR, 0) \
downcast<nscsi_connector *>(device)->set_fixed_device(_subtag); \
MCFG_DEVICE_ADD(_tag ":" _subtag, _type, _clock)
@@ -15,7 +15,7 @@
MCFG_NSCSI_DEVICE_ADD(_tag, _subtag, _type, _clock)
#define MCFG_NSCSI_ADD(_tag, _slot_intf, _def_slot, _def_inp) \
- MCFG_DEVICE_ADD(_tag, NSCSI_CONNECTOR, 0) \
+ MCFG_DEVICE_ADD(_tag, NSCSI_CONNECTOR, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp)
class nscsi_device;
@@ -336,7 +336,7 @@ private:
control *buf_control_push();
control *buf_control_pop();
-
+
void step(bool timeout);
void target_recv_byte();
void target_send_byte(UINT8 val);
diff --git a/src/emu/machine/nscsi_hd.c b/src/emu/machine/nscsi_hd.c
index 61642ed0468..de93636180d 100644
--- a/src/emu/machine/nscsi_hd.c
+++ b/src/emu/machine/nscsi_hd.c
@@ -83,7 +83,7 @@ void nscsi_harddisk_device::scsi_command()
bad_lun();
return;
}
-
+
int page = scsi_cmdbuf[2];
int size = scsi_cmdbuf[4];
switch(page) {
diff --git a/src/emu/romload.c b/src/emu/romload.c
index b8173ef9485..c51427f8366 100644
--- a/src/emu/romload.c
+++ b/src/emu/romload.c
@@ -456,13 +456,13 @@ static void dump_wrong_and_correct_checksums(rom_load_data *romdata, const hash_
romdata->errorstring.catprintf(" EXPECTED: %s\n", hashes.macro_string(tempstr));
romdata->errorstring.catprintf(" FOUND: %s\n", acthashes.macro_string(tempstr));
/*
- // warn about any ill-formed hashes
- for (hash_base *hash = hashes.first(); hash != NULL; hash = hash->next())
- if (hash->parse_error())
- {
- romdata->errorstring.catprintf("\tInvalid %s checksum treated as 0 (check leading zeros)\n", hash->name());
- romdata->warnings++;
- }
+ // warn about any ill-formed hashes
+ for (hash_base *hash = hashes.first(); hash != NULL; hash = hash->next())
+ if (hash->parse_error())
+ {
+ romdata->errorstring.catprintf("\tInvalid %s checksum treated as 0 (check leading zeros)\n", hash->name());
+ romdata->warnings++;
+ }
*/
}
@@ -1157,11 +1157,11 @@ static chd_error open_disk_diff(emu_options &options, const rom_entry *romp, chd
{
astring fullpath(diff_file.fullpath());
diff_file.close();
-
+
LOG(("Opening differencing image file: %s\n", fullpath.cstr()));
return diff_chd.open(fullpath, true, &source);
}
-
+
/* didn't work; try creating it instead */
LOG(("Creating differencing image: %s\n", fname.cstr()));
diff_file.set_openflags(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
@@ -1177,7 +1177,7 @@ static chd_error open_disk_diff(emu_options &options, const rom_entry *romp, chd
chd_error err = diff_chd.create(fullpath, source.logical_bytes(), source.hunk_bytes(), compression, source);
if (err != CHDERR_NONE)
return err;
-
+
return diff_chd.clone_all_metadata(source);
}
@@ -1199,7 +1199,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag,
if (ROMENTRY_ISFILE(romp))
{
open_chd *chd = global_alloc(open_chd(regiontag));
-
+
hash_collection hashes(ROM_GETHASHDATA(romp));
chd_error err;
diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c
index c5aeffaf518..055f4204450 100644
--- a/src/emu/sound/samples.c
+++ b/src/emu/sound/samples.c
@@ -6,17 +6,17 @@
****************************************************************************
- Playback of pre-recorded samples. Used for high-level simulation of
- discrete sound circuits where proper low-level simulation isn't
- available. Also used for tape loops and similar.
+ Playback of pre-recorded samples. Used for high-level simulation of
+ discrete sound circuits where proper low-level simulation isn't
+ available. Also used for tape loops and similar.
- Current limitations
- - Only supports single channel samples!
+ Current limitations
+ - Only supports single channel samples!
- Considerations
- - Maybe this should be part of the presentation layer
- (artwork etc.) with samples specified in .lay files instead of
- in drivers?
+ Considerations
+ - Maybe this should be part of the presentation layer
+ (artwork etc.) with samples specified in .lay files instead of
+ in drivers?
****************************************************************************
@@ -135,7 +135,7 @@ void samples_device::start(UINT8 channel, UINT32 samplenum, bool loop)
//-------------------------------------------------
-// start_raw - start playing an externally
+// start_raw - start playing an externally
// provided sample
//-------------------------------------------------
@@ -249,7 +249,7 @@ UINT32 samples_device::base_frequency(UINT8 channel) const
//-------------------------------------------------
// playing - return true if a sample is still
-// playing on the given channel
+// playing on the given channel
//-------------------------------------------------
bool samples_device::playing(UINT8 channel) const
@@ -318,7 +318,7 @@ void samples_device::device_reset()
//-------------------------------------------------
// device_post_load - handle updating after a
-// restore
+// restore
//-------------------------------------------------
void samples_device::device_post_load()
@@ -422,7 +422,7 @@ void samples_device::sound_stream_update(sound_stream &stream, stream_sample_t *
//**************************************************************************
//-------------------------------------------------
-// read_sample - read a WAV or FLAC file as a
+// read_sample - read a WAV or FLAC file as a
// sample
//-------------------------------------------------
@@ -436,7 +436,7 @@ bool samples_device::read_sample(emu_file &file, loaded_sample &sample)
mame_printf_warning("Unable to read %s, 0-byte file?\n", file.filename());
return false;
}
-
+
// look for the appropriate RIFF tag
if (memcmp(&buf[0], "RIFF", 4) == 0)
return read_wav_sample(file, sample);
@@ -458,7 +458,7 @@ bool samples_device::read_wav_sample(emu_file &file, loaded_sample &sample)
printf("Reading %s as WAV\n", file.filename());
// we already read the opening 'WAVE' header
UINT32 offset = 4;
-
+
// get the total size
UINT32 filesize;
offset += file.read(&filesize, 4);
@@ -593,12 +593,12 @@ printf("Reading %s as FLAC\n", file.filename());
return false;
if (decoder.bits_per_sample() != 16)
return false;
-
+
// resize the array and read
sample.data.resize(sample.length);
if (!decoder.decode_interleaved(sample.data, sample.length))
return false;
-
+
// finish up and clean up
decoder.finish();
return true;
@@ -615,7 +615,7 @@ void samples_device::load_samples()
// if the user doesn't want to use samples, bail
if (!machine().options().samples())
return;
-
+
// iterate over ourself
const char *basename = machine().basename();
samples_iterator iter(*this);
@@ -634,7 +634,7 @@ printf("Sample %d = %s\n", index, samplename);
file_error filerr = file.open(basename, PATH_SEPARATOR, samplename, ".flac");
if (filerr != FILERR_NONE && altbasename != NULL)
filerr = file.open(altbasename, PATH_SEPARATOR, samplename, ".flac");
-
+
// if not, try as WAV
if (filerr != FILERR_NONE)
filerr = file.open(basename, PATH_SEPARATOR, samplename, ".wav");
diff --git a/src/emu/sound/samples.h b/src/emu/sound/samples.h
index 8aee978a86a..b9acbaea729 100644
--- a/src/emu/sound/samples.h
+++ b/src/emu/sound/samples.h
@@ -79,7 +79,7 @@ struct samples_interface
// ======================> samples_device
-class samples_device : public device_t,
+class samples_device : public device_t,
public device_sound_interface,
public samples_interface
{
@@ -100,11 +100,11 @@ public:
void pause(UINT8 channel, bool pause = true);
void stop(UINT8 channel);
void stop_all();
-
+
// dynamic control
void set_frequency(UINT8 channel, UINT32 frequency);
void set_volume(UINT8 channel, float volume);
-
+
protected:
// subclasses can do it this way
samples_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
@@ -123,7 +123,7 @@ private:
{
// shouldn't need a copy, but in case it happens, catch it here
loaded_sample &operator=(const loaded_sample &rhs) { assert(false); return *this; }
-
+
UINT32 length; // length in samples
UINT32 frequency; // frequency of the sample
dynamic_array<INT16> data; // 16-bit signed data
@@ -142,7 +142,7 @@ private:
bool loop;
bool paused;
};
-
+
// internal helpers
bool read_sample(emu_file &file, loaded_sample &sample);
bool read_wav_sample(emu_file &file, loaded_sample &sample);
@@ -172,7 +172,7 @@ public:
samples_iterator(samples_interface &intf)
: m_intf(intf),
m_current(-1) { }
-
+
// getters
const char *altbasename() const { return (m_intf.m_names != NULL && m_intf.m_names[0] != NULL && m_intf.m_names[0][0] == '*') ? &m_intf.m_names[0][1] : NULL; }
@@ -181,7 +181,7 @@ public:
{
if (m_intf.m_names == NULL || m_intf.m_names[0] == NULL)
return NULL;
- m_current = 0;
+ m_current = 0;
if (m_intf.m_names[0][0] == '*')
m_current++;
return m_intf.m_names[m_current++];
@@ -193,7 +193,7 @@ public:
return NULL;
return m_intf.m_names[m_current++];
}
-
+
// counting
int count()
{
diff --git a/src/emu/sound/votrax.c b/src/emu/sound/votrax.c
index f4d0abb0a8c..4f8e146c6ee 100644
--- a/src/emu/sound/votrax.c
+++ b/src/emu/sound/votrax.c
@@ -52,14 +52,14 @@ const device_type VOTRAX = &device_creator<votrax_device>;
const char *const votrax_device::s_phoneme_table[64] =
{
- "EH3", "EH2", "EH1", " "/*PA0*/"DT", "A1", "A2", "ZH",
- "AH2", "I3", "I2", "I1", "M", "N", "B", "V",
- "CH", "SH", "Z", "AW1", "NG", "AH1", "OO1", "OO",
- "L", "K", "J", "H", "G", "F", "D", "S",
- "A", "AY", "Y1", "UH3", "AH", "P", "O", "I",
- "U", "Y", "T", "R", "E", "W", "AE", "AE1",
- "AW2", "UH2", "UH1", "UH", "O2", "O1", "IU", "U1",
- "THV", "TH", "ER", "EH", "E1", "AW", " "/*PA1*/, "."/*STOP*/
+ "EH3", "EH2", "EH1", " "/*PA0*/"DT", "A1", "A2", "ZH",
+ "AH2", "I3", "I2", "I1", "M", "N", "B", "V",
+ "CH", "SH", "Z", "AW1", "NG", "AH1", "OO1", "OO",
+ "L", "K", "J", "H", "G", "F", "D", "S",
+ "A", "AY", "Y1", "UH3", "AH", "P", "O", "I",
+ "U", "Y", "T", "R", "E", "W", "AE", "AE1",
+ "AW2", "UH2", "UH1", "UH", "O2", "O1", "IU", "U1",
+ "THV", "TH", "ER", "EH", "E1", "AW", " "/*PA1*/, "."/*STOP*/
};
@@ -103,7 +103,7 @@ WRITE8_MEMBER( votrax_device::write )
{
// append to the current string
m_current.cat(s_phoneme_table[data & 0x3f]);
-
+
// look for a match in our sample table
for (int index = 0; m_votrax_map[index].phoneme != NULL; index++)
if (m_current.find(m_votrax_map[index].phoneme) != -1)
@@ -117,7 +117,7 @@ WRITE8_MEMBER( votrax_device::write )
m_current.reset();
return;
}
-
+
// if we got a stop and didn't find a match, print it
if ((data & 0x3f) == 0x3f)
{
@@ -157,7 +157,7 @@ void votrax_device::device_start()
m_channels = 1;
m_names = m_sample_list;
m_start = NULL;
-
+
// let the samples device do the rest
samples_device::device_start();
}
diff --git a/src/emu/sound/votrax.h b/src/emu/sound/votrax.h
index fb549ca6ee4..ffde9eeabdd 100644
--- a/src/emu/sound/votrax.h
+++ b/src/emu/sound/votrax.h
@@ -76,7 +76,7 @@ struct votrax_interface
// ======================> votrax_device
-class votrax_device : public samples_device,
+class votrax_device : public samples_device,
public votrax_interface
{
public:
@@ -89,7 +89,7 @@ public:
// writers
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ_LINE_MEMBER( status );
-
+
protected:
// device-level overrides
virtual void device_start();
diff --git a/src/emu/video/pc_vga.c b/src/emu/video/pc_vga.c
index ac0f0cc71b4..e32b7ee4931 100644
--- a/src/emu/video/pc_vga.c
+++ b/src/emu/video/pc_vga.c
@@ -1072,8 +1072,8 @@ static void recompute_params(running_machine &machine)
static void crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data)
{
/* Doom does this */
-// if(vga.crtc.protect_enable && index <= 0x07)
-// printf("write to protected address %02x\n",index);
+// if(vga.crtc.protect_enable && index <= 0x07)
+// printf("write to protected address %02x\n",index);
switch(index)
{
@@ -1260,7 +1260,7 @@ static UINT8 vga_vblank(running_machine &machine)
res = 1;
}
-// popmessage("%d %d %d",vblank_start,vblank_end,vga.crtc.vert_total);
+// popmessage("%d %d %d",vblank_start,vblank_end,vga.crtc.vert_total);
return res;
}
@@ -2234,7 +2234,7 @@ WRITE8_HANDLER(tseng_et4k_03d0_w)
vga.crtc.data[vga.crtc.index] = data;
tseng_crtc_reg_write(space->machine(),vga.crtc.index,data);
//if((vga.crtc.index & 0xfe) != 0x0e)
- // printf("%02x %02x %d\n",vga.crtc.index,data,space->machine().primary_screen->vpos());
+ // printf("%02x %02x %d\n",vga.crtc.index,data,space->machine().primary_screen->vpos());
break;
case 8:
et4k.reg_3d8 = data;
diff --git a/src/ldplayer/ldplayer.c b/src/ldplayer/ldplayer.c
index 6b0a059b2ee..b7de0776b94 100644
--- a/src/ldplayer/ldplayer.c
+++ b/src/ldplayer/ldplayer.c
@@ -184,9 +184,9 @@ chd_file *ldplayer_state::get_disc()
{
astring fullpath(image_file->fullpath();
image_file.close();
-
+
// try to open the CHD
-
+
if (set_disk_handle(machine(), "laserdisc", fullpath) == CHDERR_NONE)
{
m_filename.cpy(dir->name);
diff --git a/src/lib/formats/pc_dsk.c b/src/lib/formats/pc_dsk.c
index 0841c66ebff..7ef11bfb861 100644
--- a/src/lib/formats/pc_dsk.c
+++ b/src/lib/formats/pc_dsk.c
@@ -300,7 +300,7 @@ bool pc_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
const format &f = formats[type];
if(!f.desc)
return false;
-
+
UINT8 sectdata[36*512];
desc_s sectors[36];
for(int i=0; i<f.sector_count; i++) {
diff --git a/src/lib/lib7z/7z.h b/src/lib/lib7z/7z.h
index 01c4cac6a7b..91c8b3ff021 100644
--- a/src/lib/lib7z/7z.h
+++ b/src/lib/lib7z/7z.h
@@ -136,17 +136,17 @@ void SzAr_Free(CSzAr *p, ISzAlloc *alloc);
*outBufferSize
You can consider "*outBuffer" as cache of solid block. If your archive is solid,
it will increase decompression speed.
-
+
If you use external function, you can declare these 3 cache variables
(blockIndex, outBuffer, outBufferSize) as static in that external function.
-
+
Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
*/
typedef struct
{
CSzAr db;
-
+
UInt64 startPosAfterHeader;
UInt64 dataPos;
diff --git a/src/lib/lib7z/7zCrc.c b/src/lib/lib7z/7zCrc.c
index cd94201be97..d82bc7ec5af 100644
--- a/src/lib/lib7z/7zCrc.c
+++ b/src/lib/lib7z/7zCrc.c
@@ -52,11 +52,11 @@ void MY_FAST_CALL CrcGenerateTable()
UInt32 r = g_CrcTable[i - 256];
g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
}
-
+
#ifdef MY_CPU_LE
g_CrcUpdate = CrcUpdateT4;
-
+
#if CRC_NUM_TABLES == 8
if (!CPU_Is_InOrder())
g_CrcUpdate = CrcUpdateT8;
diff --git a/src/lib/lib7z/7zIn.c b/src/lib/lib7z/7zIn.c
index ec93a43ffec..d7256dde718 100644
--- a/src/lib/lib7z/7zIn.c
+++ b/src/lib/lib7z/7zIn.c
@@ -537,12 +537,12 @@ static SRes SzGetNextFolderItem(CSzData *sd, CSzFolder *folder, ISzAlloc *alloc)
{
UInt32 numCoders, numBindPairs, numPackStreams, i;
UInt32 numInStreams = 0, numOutStreams = 0;
-
+
RINOK(SzReadNumber32(sd, &numCoders));
if (numCoders > NUM_FOLDER_CODERS_MAX)
return SZ_ERROR_UNSUPPORTED;
folder->NumCoders = numCoders;
-
+
MY_ALLOC(CSzCoderInfo, folder->Coders, (size_t)numCoders, alloc);
for (i = 0; i < numCoders; i++)
@@ -810,7 +810,7 @@ static SRes SzReadSubStreamsInfo(
numDigests += numSubstreams;
}
-
+
si = 0;
for (;;)
{
@@ -963,8 +963,8 @@ static SRes SzReadHeader2(
RINOK(SzReadArchiveProperties(sd));
RINOK(SzReadID(sd, &type));
}
-
-
+
+
if (type == k7zIdMainStreamsInfo)
{
RINOK(SzReadStreamsInfo(sd,
@@ -982,7 +982,7 @@ static SRes SzReadHeader2(
return SZ_OK;
if (type != k7zIdFilesInfo)
return SZ_ERROR_ARCHIVE;
-
+
RINOK(SzReadNumber32(sd, &numFiles));
p->db.NumFiles = numFiles;
@@ -1165,19 +1165,19 @@ static SRes SzReadAndDecodePackedStreams2(
RINOK(SzReadStreamsInfo(sd, &dataStartPos, p,
&numUnpackStreams, unpackSizes, digestsDefined, digests,
allocTemp, allocTemp));
-
+
dataStartPos += baseOffset;
if (p->NumFolders != 1)
return SZ_ERROR_ARCHIVE;
folder = p->Folders;
unpackSize = SzFolder_GetUnpackSize(folder);
-
+
RINOK(LookInStream_SeekTo(inStream, dataStartPos));
if (!Buf_Create(outBuffer, (size_t)unpackSize, allocTemp))
return SZ_ERROR_MEM;
-
+
res = SzFolder_Decode(folder, p->PackSizes,
inStream, dataStartPos,
outBuffer->data, (size_t)unpackSize, allocTemp);
@@ -1240,7 +1240,7 @@ static SRes SzArEx_Open2(
nextHeaderCRC = GetUi32(header + 28);
p->startPosAfterHeader = startArcPos + k7zStartHeaderSize;
-
+
if (CrcCalc(header + 12, 20) != GetUi32(header + 8))
return SZ_ERROR_CRC;
@@ -1356,9 +1356,9 @@ SRes SzArEx_Extract(
*blockIndex = folderIndex;
IAlloc_Free(allocMain, *outBuffer);
*outBuffer = 0;
-
+
RINOK(LookInStream_SeekTo(inStream, startOffset));
-
+
if (res == SZ_OK)
{
*outBufferSize = unpackSize;
diff --git a/src/lib/lib7z/Aes.c b/src/lib/lib7z/Aes.c
index e7221cd2b2e..2bdfc9b9af9 100644
--- a/src/lib/lib7z/Aes.c
+++ b/src/lib/lib7z/Aes.c
@@ -228,9 +228,9 @@ void MY_FAST_CALL AesCbc_Encode(UInt32 *p, Byte *data, size_t numBlocks)
p[1] ^= GetUi32(data + 4);
p[2] ^= GetUi32(data + 8);
p[3] ^= GetUi32(data + 12);
-
+
Aes_Encode(p + 4, p, p);
-
+
SetUi32(data, p[0]);
SetUi32(data + 4, p[1]);
SetUi32(data + 8, p[2]);
@@ -254,7 +254,7 @@ void MY_FAST_CALL AesCbc_Decode(UInt32 *p, Byte *data, size_t numBlocks)
SetUi32(data + 4, p[1] ^ out[1]);
SetUi32(data + 8, p[2] ^ out[2]);
SetUi32(data + 12, p[3] ^ out[3]);
-
+
p[0] = in[0];
p[1] = in[1];
p[2] = in[2];
diff --git a/src/lib/lib7z/Alloc.c b/src/lib/lib7z/Alloc.c
index df7412afe79..651ada46961 100644
--- a/src/lib/lib7z/Alloc.c
+++ b/src/lib/lib7z/Alloc.c
@@ -99,7 +99,7 @@ void *BigAlloc(size_t size)
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++);
#endif
-
+
#ifdef _7ZIP_LARGE_PAGES
if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
{
@@ -118,7 +118,7 @@ void BigFree(void *address)
if (address != 0)
fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
#endif
-
+
if (address == 0)
return;
VirtualFree(address, 0, MEM_RELEASE);
diff --git a/src/lib/lib7z/Bra.c b/src/lib/lib7z/Bra.c
index 2e47b1413c1..e78e6f97b37 100644
--- a/src/lib/lib7z/Bra.c
+++ b/src/lib/lib7z/Bra.c
@@ -48,14 +48,14 @@ SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
((UInt32)data[i + 0] << 11) |
(((UInt32)data[i + 3] & 0x7) << 8) |
(data[i + 2]);
-
+
src <<= 1;
if (encoding)
dest = ip + (UInt32)i + src;
else
dest = src - (ip + (UInt32)i);
dest >>= 1;
-
+
data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7));
data[i + 0] = (Byte)(dest >> 11);
data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7));
@@ -80,7 +80,7 @@ SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
((UInt32)data[i + 1] << 16) |
((UInt32)data[i + 2] << 8) |
((UInt32)data[i + 3] & (~3));
-
+
UInt32 dest;
if (encoding)
dest = ip + (UInt32)i + src;
@@ -113,14 +113,14 @@ SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
((UInt32)data[i + 2] << 8) |
((UInt32)data[i + 3]);
UInt32 dest;
-
+
src <<= 2;
if (encoding)
dest = ip + i + src;
else
dest = src - (ip + i);
dest >>= 2;
-
+
dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000;
data[i + 0] = (Byte)(dest >> 24);
diff --git a/src/lib/lib7z/Bra.h b/src/lib/lib7z/Bra.h
index 5748c1c051d..aac20a6961d 100644
--- a/src/lib/lib7z/Bra.h
+++ b/src/lib/lib7z/Bra.h
@@ -13,23 +13,23 @@ extern "C" {
/*
These functions convert relative addresses to absolute addresses
in CALL instructions to increase the compression ratio.
-
+
In:
data - data buffer
size - size of data
ip - current virtual Instruction Pinter (IP) value
state - state variable for x86 converter
encoding - 0 (for decoding), 1 (for encoding)
-
+
Out:
state - state variable for x86 converter
Returns:
The number of processed bytes. If you call these functions with multiple calls,
you must start next call with first byte after block of processed bytes.
-
+
Type Endian Alignment LookAhead
-
+
x86 little 1 4
ARMT little 2 2
ARM little 4 0
diff --git a/src/lib/lib7z/BraIA64.c b/src/lib/lib7z/BraIA64.c
index 0b4ee85bc76..07fa7ba40fa 100644
--- a/src/lib/lib7z/BraIA64.c
+++ b/src/lib/lib7z/BraIA64.c
@@ -42,20 +42,20 @@ SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF);
UInt32 dest;
src |= ((UInt32)(instNorm >> 36) & 1) << 20;
-
+
src <<= 4;
-
+
if (encoding)
dest = ip + (UInt32)i + src;
else
dest = src - (ip + (UInt32)i);
-
+
dest >>= 4;
-
+
instNorm &= ~((UInt64)(0x8FFFFF) << 13);
instNorm |= ((UInt64)(dest & 0xFFFFF) << 13);
instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20));
-
+
instruction &= (1 << bitRes) - 1;
instruction |= (instNorm << bitRes);
for (j = 0; j < 6; j++)
diff --git a/src/lib/lib7z/BwtSort.c b/src/lib/lib7z/BwtSort.c
index 207305072d7..482f41285f0 100644
--- a/src/lib/lib7z/BwtSort.c
+++ b/src/lib/lib7z/BwtSort.c
@@ -96,7 +96,7 @@ UInt32 NO_INLINE SortGroup(UInt32 BlockSize, UInt32 NumSortedBytes, UInt32 group
gPrev = Groups[sp];
temp[0] = (gPrev << NumRefBits);
}
-
+
for (j = 1; j < groupSize; j++)
{
UInt32 sp = ind2[j] + NumSortedBytes;
@@ -114,11 +114,11 @@ UInt32 NO_INLINE SortGroup(UInt32 BlockSize, UInt32 NumSortedBytes, UInt32 group
return 1;
}
}
-
+
HeapSort(temp, groupSize);
mask = ((1 << NumRefBits) - 1);
thereAreGroups = 0;
-
+
group = groupOffset;
cg = (temp[0] >> NumRefBits);
temp[0] = ind2[temp[0] & mask];
@@ -129,12 +129,12 @@ UInt32 NO_INLINE SortGroup(UInt32 BlockSize, UInt32 NumSortedBytes, UInt32 group
#else
UInt32 prevGroupStart = 0;
#endif
-
+
for (j = 1; j < groupSize; j++)
{
UInt32 val = temp[j];
UInt32 cgCur = (val >> NumRefBits);
-
+
if (cgCur != cg)
{
cg = cgCur;
@@ -398,7 +398,7 @@ UInt32 BlockSort(UInt32 *Indices, const Byte *data, UInt32 blockSize)
for (i = 0; i < blockSize - 1; i++)
Indices[counters[((UInt32)data[i] << 8) | data[i + 1]]++] = i;
Indices[counters[((UInt32)data[i] << 8) | data[0]]++] = i;
-
+
#ifndef BLOCK_SORT_EXTERNAL_FLAGS
{
UInt32 prev = 0;
@@ -441,7 +441,7 @@ UInt32 BlockSort(UInt32 *Indices, const Byte *data, UInt32 blockSize)
for (groupSize = 1;
(Flags[(i + groupSize) >> kNumFlagsBits] & (1 << ((i + groupSize) & kFlagsMask))) != 0;
groupSize++);
-
+
groupSize++;
#else
@@ -473,7 +473,7 @@ UInt32 BlockSort(UInt32 *Indices, const Byte *data, UInt32 blockSize)
}
#endif
-
+
if (NumSortedBytes >= blockSize)
{
UInt32 j;
diff --git a/src/lib/lib7z/CpuArch.c b/src/lib/lib7z/CpuArch.c
index 787af6e62fc..2896300d235 100644
--- a/src/lib/lib7z/CpuArch.c
+++ b/src/lib/lib7z/CpuArch.c
@@ -81,7 +81,7 @@ static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d)
: "0" (function)) ;
#endif
-
+
#else
int CPUInfo[4];
diff --git a/src/lib/lib7z/HuffEnc.c b/src/lib/lib7z/HuffEnc.c
index 561c7e5da82..9e6a139506f 100644
--- a/src/lib/lib7z/HuffEnc.c
+++ b/src/lib/lib7z/HuffEnc.c
@@ -18,9 +18,9 @@ void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 numSymb
/* if (maxLen > 10) maxLen = 10; */
{
UInt32 i;
-
+
#ifdef HUFFMAN_SPEED_OPT
-
+
UInt32 counters[NUM_COUNTERS];
for (i = 0; i < NUM_COUNTERS; i++)
counters[i] = 0;
@@ -29,7 +29,7 @@ void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 numSymb
UInt32 freq = freqs[i];
counters[(freq < NUM_COUNTERS - 1) ? freq : NUM_COUNTERS - 1]++;
}
-
+
for (i = 1; i < NUM_COUNTERS; i++)
{
UInt32 temp = counters[i];
@@ -47,7 +47,7 @@ void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 numSymb
}
counters[0] = 0;
HeapSort(p + counters[NUM_COUNTERS - 2], counters[NUM_COUNTERS - 1] - counters[NUM_COUNTERS - 2]);
-
+
#else
for (i = 0; i < numSymbols; i++)
@@ -78,10 +78,10 @@ void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 numSymb
lens[minCode] = lens[maxCode] = 1;
return;
}
-
+
{
UInt32 b, e, i;
-
+
i = b = e = 0;
do
{
@@ -96,12 +96,12 @@ void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 numSymb
e++;
}
while (num - e > 1);
-
+
{
UInt32 lenCounters[kMaxLen + 1];
for (i = 0; i <= kMaxLen; i++)
lenCounters[i] = 0;
-
+
p[--e] &= MASK;
lenCounters[1] = 2;
while (e > 0)
@@ -113,7 +113,7 @@ void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 numSymb
lenCounters[len]--;
lenCounters[len + 1] += 2;
}
-
+
{
UInt32 len;
i = 0;
@@ -124,7 +124,7 @@ void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 numSymb
lens[p[i++] & MASK] = (Byte)len;
}
}
-
+
{
UInt32 nextCodes[kMaxLen + 1];
{
diff --git a/src/lib/lib7z/HuffEnc.h b/src/lib/lib7z/HuffEnc.h
index 9cf4bfde817..d0aa13cdc8d 100644
--- a/src/lib/lib7z/HuffEnc.h
+++ b/src/lib/lib7z/HuffEnc.h
@@ -17,7 +17,7 @@ Conditions:
maxLen <= 16 = kMaxLen
Num_Items(p) >= HUFFMAN_TEMP_SIZE(num)
*/
-
+
void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 num, UInt32 maxLen);
#ifdef __cplusplus
diff --git a/src/lib/lib7z/LzFind.c b/src/lib/lib7z/LzFind.c
index e3ecb05420e..e753d04c692 100644
--- a/src/lib/lib7z/LzFind.c
+++ b/src/lib/lib7z/LzFind.c
@@ -512,7 +512,7 @@ static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
delta2 = p->pos - p->hash[hash2Value];
curMatch = p->hash[kFix3HashSize + hashValue];
-
+
p->hash[hash2Value] =
p->hash[kFix3HashSize + hashValue] = p->pos;
@@ -546,7 +546,7 @@ static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
delta2 = p->pos - p->hash[ hash2Value];
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
curMatch = p->hash[kFix4HashSize + hashValue];
-
+
p->hash[ hash2Value] =
p->hash[kFix3HashSize + hash3Value] =
p->hash[kFix4HashSize + hashValue] = p->pos;
diff --git a/src/lib/lib7z/LzFindMt.c b/src/lib/lib7z/LzFindMt.c
index aa41ed98a57..0f7b314f4c5 100644
--- a/src/lib/lib7z/LzFindMt.c
+++ b/src/lib/lib7z/LzFindMt.c
@@ -58,7 +58,7 @@ void MtSync_StopWriting(CMtSync *p)
p->csWasEntered = False;
}
Semaphore_Release1(&p->freeSemaphore);
-
+
Event_Wait(&p->wasStopped);
while (myNumBlocks++ != p->numProcessedBlocks)
@@ -108,12 +108,12 @@ static SRes MtSync_Create2(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void
RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart));
RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStarted));
RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped));
-
+
RINOK_THREAD(Semaphore_Create(&p->freeSemaphore, numBlocks, numBlocks));
RINOK_THREAD(Semaphore_Create(&p->filledSemaphore, 0, numBlocks));
p->needStart = True;
-
+
RINOK_THREAD(Thread_Create(&p->thread, startAddress, obj));
p->wasCreated = True;
return SZ_OK;
@@ -385,7 +385,7 @@ void BtFillBlock(CMatchFinderMt *p, UInt32 globalBlockIndex)
CriticalSection_Enter(&sync->cs);
sync->csWasEntered = True;
}
-
+
BtGetMatches(p, p->btBuf + (globalBlockIndex & kMtBtNumBlocksMask) * kMtBtBlockSize);
if (p->pos > kMtMaxValForNormalize - kMtBtBlockSize)
@@ -561,7 +561,7 @@ UInt32 * MixMatches2(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
const Byte *cur = p->pointerToCurPos;
UInt32 lzPos = p->lzPos;
MT_HASH2_CALC
-
+
curMatch2 = hash[hash2Value];
hash[hash2Value] = lzPos;
@@ -584,7 +584,7 @@ UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
curMatch2 = hash[ hash2Value];
curMatch3 = hash[kFix3HashSize + hash3Value];
-
+
hash[ hash2Value] =
hash[kFix3HashSize + hash3Value] =
lzPos;
@@ -616,11 +616,11 @@ UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
const Byte *cur = p->pointerToCurPos;
UInt32 lzPos = p->lzPos;
MT_HASH4_CALC
-
+
curMatch2 = hash[ hash2Value];
curMatch3 = hash[kFix3HashSize + hash3Value];
curMatch4 = hash[kFix4HashSize + hash4Value];
-
+
hash[ hash2Value] =
hash[kFix3HashSize + hash3Value] =
hash[kFix4HashSize + hash4Value] =
diff --git a/src/lib/lib7z/LzFindMt.h b/src/lib/lib7z/LzFindMt.h
index b985af5fee2..63133b1b909 100644
--- a/src/lib/lib7z/LzFindMt.h
+++ b/src/lib/lib7z/LzFindMt.h
@@ -62,7 +62,7 @@ typedef struct _CMatchFinderMt
const UInt32 *crc;
Mf_Mix_Matches MixMatchesFunc;
-
+
/* LZ + BT */
CMtSync btSync;
Byte btDummy[kMtCacheLineDummy];
@@ -85,7 +85,7 @@ typedef struct _CMatchFinderMt
/* BT + Hash */
CMtSync hashSync;
/* Byte hashDummy[kMtCacheLineDummy]; */
-
+
/* Hash */
Mf_GetHeads GetHeadsFunc;
CMatchFinder *MatchFinder;
diff --git a/src/lib/lib7z/Lzma2Dec.c b/src/lib/lib7z/Lzma2Dec.c
index f3a6b821daf..d2f8c8884c9 100644
--- a/src/lib/lib7z/Lzma2Dec.c
+++ b/src/lib/lib7z/Lzma2Dec.c
@@ -114,17 +114,17 @@ static ELzma2State Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b)
else
p->unpackSize = (UInt32)(p->control & 0x1F) << 16;
return LZMA2_STATE_UNPACK0;
-
+
case LZMA2_STATE_UNPACK0:
p->unpackSize |= (UInt32)b << 8;
return LZMA2_STATE_UNPACK1;
-
+
case LZMA2_STATE_UNPACK1:
p->unpackSize |= (UInt32)b;
p->unpackSize++;
PRF(printf(" %8d", p->unpackSize));
return (LZMA2_IS_UNCOMPRESSED_STATE(p)) ? LZMA2_STATE_DATA : LZMA2_STATE_PACK0;
-
+
case LZMA2_STATE_PACK0:
p->packSize = (UInt32)b << 8;
return LZMA2_STATE_PACK1;
@@ -199,7 +199,7 @@ SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
SizeT destSizeCur = dicLimit - dicPos;
SizeT srcSizeCur = inSize - *srcLen;
ELzmaFinishMode curFinishMode = LZMA_FINISH_ANY;
-
+
if (p->unpackSize <= destSizeCur)
{
destSizeCur = (SizeT)p->unpackSize;
@@ -250,7 +250,7 @@ SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
Bool initState = (mode > 0);
if ((!initDic && p->needInitDic) || (!initState && p->needInitState))
return SZ_ERROR_DATA;
-
+
LzmaDec_InitDicAndState(&p->decoder, initDic, initState);
p->needInitDic = False;
p->needInitState = False;
@@ -258,9 +258,9 @@ SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
}
if (srcSizeCur > p->packSize)
srcSizeCur = (SizeT)p->packSize;
-
+
res = LzmaDec_DecodeToDic(&p->decoder, dicPos + destSizeCur, src, &srcSizeCur, curFinishMode, status);
-
+
src += srcSizeCur;
*srcLen += srcSizeCur;
p->packSize -= (UInt32)srcSizeCur;
diff --git a/src/lib/lib7z/Lzma2Enc.c b/src/lib/lib7z/Lzma2Enc.c
index e97597f63d5..86869551668 100644
--- a/src/lib/lib7z/Lzma2Enc.c
+++ b/src/lib/lib7z/Lzma2Enc.c
@@ -83,11 +83,11 @@ static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf,
if (packSize < lzHeaderSize)
return SZ_ERROR_OUTPUT_EOF;
packSize -= lzHeaderSize;
-
+
LzmaEnc_SaveState(p->enc);
res = LzmaEnc_CodeOneMemBlock(p->enc, p->needInitState,
outBuf + lzHeaderSize, &packSize, LZMA2_PACK_SIZE_MAX, &unpackSize);
-
+
PRF(printf("\npackSize = %7d unpackSize = %7d ", packSize, unpackSize));
if (unpackSize == 0)
@@ -146,10 +146,10 @@ static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf,
outBuf[destPos++] = (Byte)u;
outBuf[destPos++] = (Byte)(pm >> 8);
outBuf[destPos++] = (Byte)pm;
-
+
if (p->needInitProp)
outBuf[destPos++] = p->props;
-
+
p->needInitProp = False;
p->needInitState = False;
destPos += packSize;
@@ -244,7 +244,7 @@ typedef struct
{
Byte propEncoded;
CLzma2EncProps props;
-
+
Byte *outBuf;
ISzAlloc *alloc;
@@ -322,10 +322,10 @@ static SRes MtCallbackImp_Code(void *pp, unsigned index, Byte *dest, size_t *des
if (srcSize != 0)
{
RINOK(Lzma2EncInt_Init(p, &mainEncoder->props));
-
+
RINOK(LzmaEnc_MemPrepare(p->enc, src, srcSize, LZMA2_KEEP_WINDOW_SIZE,
mainEncoder->alloc, mainEncoder->allocBig));
-
+
while (p->srcPos < srcSize)
{
size_t packSize = destLim - *destSize;
@@ -460,7 +460,7 @@ SRes Lzma2Enc_Encode(CLzma2EncHandle pp,
mtCallback.funcTable.Code = MtCallbackImp_Code;
mtCallback.lzma2Enc = p;
-
+
p->mtCoder.progress = progress;
p->mtCoder.inStream = inStream;
p->mtCoder.outStream = outStream;
@@ -470,7 +470,7 @@ SRes Lzma2Enc_Encode(CLzma2EncHandle pp,
p->mtCoder.blockSize = p->props.blockSize;
p->mtCoder.destBlockSize = p->props.blockSize + (p->props.blockSize >> 10) + 16;
p->mtCoder.numThreads = p->props.numBlockThreads;
-
+
return MtCoder_Code(&p->mtCoder);
}
#endif
diff --git a/src/lib/lib7z/Lzma86Enc.c b/src/lib/lib7z/Lzma86Enc.c
index 2ea4ac2da45..45b96b68e43 100644
--- a/src/lib/lib7z/Lzma86Enc.c
+++ b/src/lib/lib7z/Lzma86Enc.c
@@ -26,7 +26,7 @@ int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
LzmaEncProps_Init(&props);
props.level = level;
props.dictSize = dictSize;
-
+
*destLen = 0;
if (outSize2 < LZMA86_HEADER_SIZE)
return SZ_ERROR_OUTPUT_EOF;
@@ -78,12 +78,12 @@ int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
break;
if (useFilter && i == 0)
curModeIsFiltered = True;
-
+
curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed,
curModeIsFiltered ? filteredStream : src, srcLen,
&props, dest + 1, &outPropsSize, 0,
NULL, &g_Alloc, &g_Alloc);
-
+
if (curRes != SZ_ERROR_OUTPUT_EOF)
{
if (curRes != SZ_OK)
diff --git a/src/lib/lib7z/LzmaDec.c b/src/lib/lib7z/LzmaDec.c
index a85edb7dfd0..14d0f2d3250 100644
--- a/src/lib/lib7z/LzmaDec.c
+++ b/src/lib/lib7z/LzmaDec.c
@@ -141,7 +141,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
Byte *dic = p->dic;
SizeT dicBufSize = p->dicBufSize;
SizeT dicPos = p->dicPos;
-
+
UInt32 processedPos = p->processedPos;
UInt32 checkDicSize = p->checkDicSize;
unsigned len = 0;
@@ -324,7 +324,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
{
NORMALIZE
range >>= 1;
-
+
{
UInt32 t;
code -= range;
@@ -723,7 +723,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
SizeT inSize = *srcLen;
(*srcLen) = 0;
LzmaDec_WriteRem(p, dicLimit);
-
+
*status = LZMA_STATUS_NOT_SPECIFIED;
while (p->remainLen != kMatchSpecLenStart)
@@ -769,7 +769,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
if (p->needInitState)
LzmaDec_InitStateReal(p);
-
+
if (p->tempBufSize == 0)
{
SizeT processed;
@@ -900,12 +900,12 @@ SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
{
UInt32 dicSize;
Byte d;
-
+
if (size < LZMA_PROPS_SIZE)
return SZ_ERROR_UNSUPPORTED;
else
dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
-
+
if (dicSize < LZMA_DIC_MIN)
dicSize = LZMA_DIC_MIN;
p->dicSize = dicSize;
diff --git a/src/lib/lib7z/LzmaDec.h b/src/lib/lib7z/LzmaDec.h
index bf7f084ba3d..7927acd0d4e 100644
--- a/src/lib/lib7z/LzmaDec.h
+++ b/src/lib/lib7z/LzmaDec.h
@@ -130,7 +130,7 @@ LzmaDec_Allocate* can return:
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_UNSUPPORTED - Unsupported properties
*/
-
+
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
@@ -159,7 +159,7 @@ void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
*/
/* LzmaDec_DecodeToDic
-
+
The decoding to internal dictionary buffer (CLzmaDec::dic).
You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
diff --git a/src/lib/lib7z/LzmaEnc.c b/src/lib/lib7z/LzmaEnc.c
index ef26e0cfdbd..17d63f38cd2 100644
--- a/src/lib/lib7z/LzmaEnc.c
+++ b/src/lib/lib7z/LzmaEnc.c
@@ -119,7 +119,7 @@ void LzmaEnc_FastPosInit(Byte *g_FastPos)
int c = 2, slotFast;
g_FastPos[0] = 0;
g_FastPos[1] = 1;
-
+
for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++)
{
UInt32 k = (1 << ((slotFast >> 1) - 1));
@@ -256,7 +256,7 @@ typedef struct
CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
CLzmaProb posAlignEncoder[1 << kNumAlignBits];
-
+
CLenPriceEnc lenEnc;
CLenPriceEnc repLenEnc;
@@ -279,7 +279,7 @@ typedef struct
#ifndef _7ZIP_ST
Byte pad[128];
#endif
-
+
UInt32 optimumEndIndex;
UInt32 optimumCurrentIndex;
@@ -287,7 +287,7 @@ typedef struct
UInt32 numPairs;
UInt32 numAvail;
COptimal opt[kNumOpts];
-
+
#ifndef LZMA_LOG_BSR
Byte g_FastPos[1 << kNumLogBits];
#endif
@@ -321,14 +321,14 @@ typedef struct
CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
CLzmaProb posAlignEncoder[1 << kNumAlignBits];
-
+
CLenPriceEnc lenEnc;
CLenPriceEnc repLenEnc;
unsigned lclp;
Bool fastMode;
-
+
CRangeEnc rc;
Bool writeEndMark;
@@ -917,10 +917,10 @@ static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur)
{
UInt32 posPrev = posMem;
UInt32 backCur = backMem;
-
+
backMem = p->opt[posPrev].backPrev;
posMem = p->opt[posPrev].posPrev;
-
+
p->opt[posPrev].backPrev = backCur;
p->opt[posPrev].posPrev = cur;
cur = posPrev;
@@ -951,7 +951,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
return lenRes;
}
p->optimumCurrentIndex = p->optimumEndIndex = 0;
-
+
if (p->additionalOffset == 0)
mainLen = ReadMatchDistances(p, &numPairs);
else
@@ -1249,7 +1249,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]);
repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]);
-
+
if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0))
{
UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState);
@@ -1311,7 +1311,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
}
}
}
-
+
startLen = 2; /* speed optimization */
{
UInt32 repIndex;
@@ -1342,10 +1342,10 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
}
while (--lenTest >= 2);
lenTest = lenTestTemp;
-
+
if (repIndex == 0)
startLen = lenTest + 1;
-
+
/* if (_maxMode) */
{
UInt32 lenTest2 = lenTest + 1;
@@ -1369,7 +1369,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
nextRepMatchPrice = curAndLenCharPrice +
GET_PRICE_1(p->isMatch[state2][posStateNext]) +
GET_PRICE_1(p->isRep[state2]);
-
+
/* for (; lenTest2 >= 2; lenTest2--) */
{
UInt32 curAndLenPrice;
@@ -1424,7 +1424,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
curAndLenPrice += p->distancesPrices[lenToPosState][curBack];
else
curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask];
-
+
opt = &p->opt[cur + lenTest];
if (curAndLenPrice < opt->price)
{
@@ -1458,7 +1458,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
nextRepMatchPrice = curAndLenCharPrice +
GET_PRICE_1(p->isMatch[state2][posStateNext]) +
GET_PRICE_1(p->isRep[state2]);
-
+
/* for (; lenTest2 >= 2; lenTest2--) */
{
UInt32 offset = cur + lenTest + 1 + lenTest2;
@@ -1570,7 +1570,7 @@ static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes)
MovePos(p, repLen - 1);
return repLen;
}
-
+
if (mainLen < 2 || numAvail <= 2)
return 1;
@@ -1584,7 +1584,7 @@ static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes)
(p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist)))
return 1;
}
-
+
data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
for (i = 0; i < LZMA_NUM_REPS; i++)
{
@@ -1845,7 +1845,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
pos -= LZMA_NUM_REPS;
GetPosSlot(pos, posSlot);
RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot);
-
+
if (posSlot >= kStartPosModelIndex)
{
UInt32 footerBits = ((posSlot >> 1) - 1);
@@ -2150,7 +2150,7 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
p->rc.outStream = &outStream.funcTable;
res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize);
-
+
*unpackSize = (UInt32)(p->nowPos64 - nowPos64);
*destLen -= outStream.rem;
if (outStream.overflow)
diff --git a/src/lib/lib7z/LzmaLib.h b/src/lib/lib7z/LzmaLib.h
index 76c99ce758d..2a3efe161c1 100644
--- a/src/lib/lib7z/LzmaLib.h
+++ b/src/lib/lib7z/LzmaLib.h
@@ -38,7 +38,7 @@ outPropsSize -
LZMA Encoder will use defult values for any parameter, if it is
-1 for any from: level, loc, lp, pb, fb, numThreads
0 for dictSize
-
+
level - compression level: 0 <= level <= 9;
level dictSize algo fb
@@ -50,7 +50,7 @@ level - compression level: 0 <= level <= 9;
5: 16 MB 1 32
6: 32 MB 1 32
7+: 64 MB 1 64
-
+
The default value for "level" is 5.
algo = 0 means fast method
diff --git a/src/lib/lib7z/MtCoder.c b/src/lib/lib7z/MtCoder.c
index 946fbbc7076..c6a992a64ba 100644
--- a/src/lib/lib7z/MtCoder.c
+++ b/src/lib/lib7z/MtCoder.c
@@ -190,9 +190,9 @@ static SRes MtThread_Process(CMtThread *p, Bool *stop)
*stop = True;
if (Event_Wait(&p->canRead) != 0)
return SZ_ERROR_THREAD;
-
+
next = GET_NEXT_THREAD(p);
-
+
if (p->stopReading)
{
next->stopReading = True;
diff --git a/src/lib/lib7z/MtCoder.h b/src/lib/lib7z/MtCoder.h
index f0f06da281f..e2cbdc3ab2e 100644
--- a/src/lib/lib7z/MtCoder.h
+++ b/src/lib/lib7z/MtCoder.h
@@ -14,7 +14,7 @@ typedef struct
CAutoResetEvent startEvent;
CAutoResetEvent finishedEvent;
int stop;
-
+
THREAD_FUNC_TYPE func;
LPVOID param;
THREAD_FUNC_RET_TYPE res;
@@ -75,7 +75,7 @@ typedef struct _CMtCoder
size_t blockSize;
size_t destBlockSize;
unsigned numThreads;
-
+
ISeqInStream *inStream;
ISeqOutStream *outStream;
ICompressProgress *progress;
diff --git a/src/lib/lib7z/Ppmd.h b/src/lib/lib7z/Ppmd.h
index 9cbc46647b8..db8a16d6371 100644
--- a/src/lib/lib7z/Ppmd.h
+++ b/src/lib/lib7z/Ppmd.h
@@ -82,5 +82,5 @@ typedef
p[i+7] = p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = ~(size_t)0; }}
EXTERN_C_END
-
+
#endif
diff --git a/src/lib/lib7z/Ppmd7.c b/src/lib/lib7z/Ppmd7.c
index bba4d06f0ab..58244e13610 100644
--- a/src/lib/lib7z/Ppmd7.c
+++ b/src/lib/lib7z/Ppmd7.c
@@ -148,7 +148,7 @@ static void GlueFreeBlocks(CPpmd7 *p)
#else
CPpmd7_Node_Ref head = p->AlignOffset + p->Size;
#endif
-
+
CPpmd7_Node_Ref n = head;
unsigned i;
@@ -175,7 +175,7 @@ static void GlueFreeBlocks(CPpmd7 *p)
NODE(n)->Prev = head;
if (p->LoUnit != p->HiUnit)
((CPpmd7_Node *)p->LoUnit)->Stamp = 1;
-
+
/* Glue free blocks */
while (n != head)
{
@@ -193,7 +193,7 @@ static void GlueFreeBlocks(CPpmd7 *p)
}
n = node->Next;
}
-
+
/* Fill lists of free blocks */
for (n = NODE(head)->Next; n != head;)
{
@@ -319,7 +319,7 @@ static void RestartModel(CPpmd7 *p)
for (m = 0; m < 64; m += 8)
dest[m] = val;
}
-
+
for (i = 0; i < 25; i++)
for (k = 0; k < 16; k++)
{
@@ -345,10 +345,10 @@ static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip)
CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
CPpmd_State *ps[PPMD7_MAX_ORDER];
unsigned numPs = 0;
-
+
if (!skip)
ps[numPs++] = p->FoundState;
-
+
while (c->Suffix)
{
CPpmd_Void_Ref successor;
@@ -370,10 +370,10 @@ static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip)
}
ps[numPs++] = s;
}
-
+
upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch);
SetSuccessor(&upState, upBranch + 1);
-
+
if (c->NumStats == 1)
upState.Freq = ONE_STATE(c)->Freq;
else
@@ -407,7 +407,7 @@ static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip)
c = c1;
}
while (numPs != 0);
-
+
return c;
}
@@ -423,11 +423,11 @@ static void UpdateModel(CPpmd7 *p)
CPpmd_Void_Ref successor, fSuccessor = SUCCESSOR(p->FoundState);
CTX_PTR c;
unsigned s0, ns;
-
+
if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0)
{
c = SUFFIX(p->MinContext);
-
+
if (c->NumStats == 1)
{
CPpmd_State *s = ONE_STATE(c);
@@ -465,7 +465,7 @@ static void UpdateModel(CPpmd7 *p)
SetSuccessor(p->FoundState, REF(p->MinContext));
return;
}
-
+
*p->Text++ = p->FoundState->Symbol;
successor = REF(p->Text);
if (p->Text >= p->UnitsStart)
@@ -473,7 +473,7 @@ static void UpdateModel(CPpmd7 *p)
RestartModel(p);
return;
}
-
+
if (fSuccessor)
{
if (fSuccessor <= successor)
@@ -497,9 +497,9 @@ static void UpdateModel(CPpmd7 *p)
SetSuccessor(p->FoundState, successor);
fSuccessor = REF(p->MinContext);
}
-
+
s0 = p->MinContext->SummFreq - (ns = p->MinContext->NumStats) - (p->FoundState->Freq - 1);
-
+
for (c = p->MaxContext; c != p->MinContext; c = SUFFIX(c))
{
unsigned ns1;
@@ -566,7 +566,7 @@ static void UpdateModel(CPpmd7 *p)
}
p->MaxContext = p->MinContext = CTX(fSuccessor);
}
-
+
static void Rescale(CPpmd7 *p)
{
unsigned i, adder, sumFreq, escFreq;
@@ -583,7 +583,7 @@ static void Rescale(CPpmd7 *p)
adder = (p->OrderFall != 0);
s->Freq = (Byte)((s->Freq + adder) >> 1);
sumFreq = s->Freq;
-
+
i = p->MinContext->NumStats - 1;
do
{
@@ -601,7 +601,7 @@ static void Rescale(CPpmd7 *p)
}
}
while (--i);
-
+
if (s->Freq == 0)
{
unsigned numStats = p->MinContext->NumStats;
diff --git a/src/lib/lib7z/Ppmd7.h b/src/lib/lib7z/Ppmd7.h
index 96521c31f11..fa4225e2d35 100644
--- a/src/lib/lib7z/Ppmd7.h
+++ b/src/lib/lib7z/Ppmd7.h
@@ -136,5 +136,5 @@ void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p);
void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol);
EXTERN_C_END
-
+
#endif
diff --git a/src/lib/lib7z/Ppmd7Dec.c b/src/lib/lib7z/Ppmd7Dec.c
index 68438d5ce4e..dc31b4f3a82 100644
--- a/src/lib/lib7z/Ppmd7Dec.c
+++ b/src/lib/lib7z/Ppmd7Dec.c
@@ -160,11 +160,11 @@ int Ppmd7_DecodeSymbol(CPpmd7 *p, IPpmd7_RangeDec *rc)
i -= k;
}
while (i != num);
-
+
see = Ppmd7_MakeEscFreq(p, numMasked, &freqSum);
freqSum += hiCnt;
count = rc->GetThreshold(rc, freqSum);
-
+
if (count < hiCnt)
{
Byte symbol;
diff --git a/src/lib/lib7z/Ppmd7Enc.c b/src/lib/lib7z/Ppmd7Enc.c
index 8247757d09d..51a36b0178d 100644
--- a/src/lib/lib7z/Ppmd7Enc.c
+++ b/src/lib/lib7z/Ppmd7Enc.c
@@ -104,7 +104,7 @@ void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol)
sum += s->Freq;
}
while (--i);
-
+
p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol];
PPMD_SetAllBitsIn256Bytes(charMask);
MASK(s->Symbol) = 0;
@@ -149,7 +149,7 @@ void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol)
p->MinContext = Ppmd7_GetContext(p, p->MinContext->Suffix);
}
while (p->MinContext->NumStats == numMasked);
-
+
see = Ppmd7_MakeEscFreq(p, numMasked, &escFreq);
s = Ppmd7_GetStats(p, p->MinContext);
sum = 0;
@@ -178,7 +178,7 @@ void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol)
s++;
}
while (--i);
-
+
RangeEnc_Encode(rc, sum, escFreq, sum + escFreq);
see->Summ = (UInt16)(see->Summ + sum + escFreq);
}
diff --git a/src/lib/lib7z/Ppmd8.c b/src/lib/lib7z/Ppmd8.c
index 9187a88ef1e..8bec6f560f1 100644
--- a/src/lib/lib7z/Ppmd8.c
+++ b/src/lib/lib7z/Ppmd8.c
@@ -146,7 +146,7 @@ static void GlueFreeBlocks(CPpmd8 *p)
p->GlueCount = 1 << 13;
memset(p->Stamps, 0, sizeof(p->Stamps));
-
+
/* Order-0 context is always at top UNIT, so we don't need guard NODE at the end.
All blocks up to p->LoUnit can be free, so we need guard NODE at LoUnit. */
if (p->LoUnit != p->HiUnit)
@@ -175,7 +175,7 @@ static void GlueFreeBlocks(CPpmd8 *p)
}
}
*prev = 0;
-
+
/* Fill lists of free blocks */
while (head != 0)
{
@@ -298,7 +298,7 @@ static void ExpandTextArea(CPpmd8 *p)
memset(count, 0, sizeof(count));
if (p->LoUnit != p->HiUnit)
((CPpmd8_Node *)p->LoUnit)->Stamp = 0;
-
+
{
CPpmd8_Node *node = (CPpmd8_Node *)p->UnitsStart;
for (; node->Stamp == EMPTY_NODE; node += node->NU)
@@ -308,7 +308,7 @@ static void ExpandTextArea(CPpmd8 *p)
}
p->UnitsStart = (Byte *)node;
}
-
+
for (i = 0; i < PPMD_NUM_INDEXES; i++)
{
CPpmd8_Node_Ref *next = (CPpmd8_Node_Ref *)&p->FreeList[i];
@@ -440,7 +440,7 @@ static CPpmd_Void_Ref CutOff(CPpmd8 *p, CTX_PTR ctx, unsigned order)
int i;
unsigned tmp;
CPpmd_State *s;
-
+
if (!ctx->NumStats)
{
s = ONE_STATE(ctx);
@@ -470,7 +470,7 @@ static CPpmd_Void_Ref CutOff(CPpmd8 *p, CTX_PTR ctx, unsigned order)
SetSuccessor(s, CutOff(p, CTX(SUCCESSOR(s)), order + 1));
else
SetSuccessor(s, 0);
-
+
if (i != ctx->NumStats && order)
{
ctx->NumStats = (Byte)i;
@@ -521,7 +521,7 @@ static CPpmd_Void_Ref RemoveBinContexts(CPpmd8 *p, CTX_PTR ctx, unsigned order)
SetSuccessor(s, RemoveBinContexts(p, CTX(SUCCESSOR(s)), order + 1));
else
SetSuccessor(s, 0);
-
+
return REF(ctx);
}
#endif
@@ -561,7 +561,7 @@ static void RestoreModel(CPpmd8 *p, CTX_PTR c1
}
else
Refresh(p, c, (c->NumStats+3) >> 1, 0);
-
+
for (; c != p->MinContext; c = SUFFIX(c))
if (!c->NumStats)
ONE_STATE(c)->Freq -= ONE_STATE(c)->Freq >> 1;
@@ -610,10 +610,10 @@ static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c
/* fixed over Shkarin's code. Maybe it could work without + 1 too. */
CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
unsigned numPs = 0;
-
+
if (!skip)
ps[numPs++] = p->FoundState;
-
+
while (c->Suffix)
{
CPpmd_Void_Ref successor;
@@ -648,7 +648,7 @@ static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c
}
ps[numPs++] = s;
}
-
+
upState.Symbol = *(const Byte *)Ppmd8_GetPtr(p, upBranch);
SetSuccessor(&upState, upBranch + 1);
flags = 0x10 * (p->FoundState->Symbol >= 0x40) + 0x08 * (upState.Symbol >= 0x40);
@@ -687,7 +687,7 @@ static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c
c = c1;
}
while (numPs != 0);
-
+
return c;
}
@@ -696,7 +696,7 @@ static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
CPpmd_State *s = NULL;
CTX_PTR c1 = c;
CPpmd_Void_Ref upBranch = REF(p->Text);
-
+
#ifdef PPMD8_FREEZE_SUPPORT
/* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
@@ -754,7 +754,7 @@ static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
SetSuccessor(s, upBranch);
p->OrderFall++;
}
-
+
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
@@ -779,7 +779,7 @@ static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
SetSuccessor(s, REF(successor));
p->FoundState = s1;
}
-
+
if (p->OrderFall == 1 && c1 == p->MaxContext)
{
SetSuccessor(p->FoundState, SUCCESSOR(s));
@@ -797,11 +797,11 @@ static void UpdateModel(CPpmd8 *p)
unsigned s0, ns, fFreq = p->FoundState->Freq;
Byte flag, fSymbol = p->FoundState->Symbol;
CPpmd_State *s = NULL;
-
+
if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0)
{
c = SUFFIX(p->MinContext);
-
+
if (c->NumStats == 0)
{
s = ONE_STATE(c);
@@ -827,7 +827,7 @@ static void UpdateModel(CPpmd8 *p)
}
}
}
-
+
c = p->MaxContext;
if (p->OrderFall == 0 && fSuccessor)
{
@@ -844,7 +844,7 @@ static void UpdateModel(CPpmd8 *p)
}
return;
}
-
+
*p->Text++ = p->FoundState->Symbol;
successor = REF(p->Text);
if (p->Text >= p->UnitsStart)
@@ -852,7 +852,7 @@ static void UpdateModel(CPpmd8 *p)
RESTORE_MODEL(c, CTX(fSuccessor)); /* check it */
return;
}
-
+
if (!fSuccessor)
{
CTX_PTR cs = ReduceOrder(p, s, p->MinContext);
@@ -873,7 +873,7 @@ static void UpdateModel(CPpmd8 *p)
}
fSuccessor = REF(cs);
}
-
+
if (--p->OrderFall == 0)
{
successor = fSuccessor;
@@ -887,10 +887,10 @@ static void UpdateModel(CPpmd8 *p)
p->OrderFall = 0;
}
#endif
-
+
s0 = p->MinContext->SummFreq - (ns = p->MinContext->NumStats) - fFreq;
flag = 0x08 * (fSymbol >= 0x40);
-
+
for (; c != p->MinContext; c = SUFFIX(c))
{
unsigned ns1;
@@ -958,7 +958,7 @@ static void UpdateModel(CPpmd8 *p)
}
p->MaxContext = p->MinContext = CTX(fSuccessor);
}
-
+
static void Rescale(CPpmd8 *p)
{
unsigned i, adder, sumFreq, escFreq;
@@ -979,7 +979,7 @@ static void Rescale(CPpmd8 *p)
);
s->Freq = (Byte)((s->Freq + adder) >> 1);
sumFreq = s->Freq;
-
+
i = p->MinContext->NumStats;
do
{
@@ -997,7 +997,7 @@ static void Rescale(CPpmd8 *p)
}
}
while (--i);
-
+
if (s->Freq == 0)
{
unsigned numStats = p->MinContext->NumStats;
diff --git a/src/lib/lib7z/Ppmd8.h b/src/lib/lib7z/Ppmd8.h
index 7dcfc91613b..813254cd462 100644
--- a/src/lib/lib7z/Ppmd8.h
+++ b/src/lib/lib7z/Ppmd8.h
@@ -133,5 +133,5 @@ void Ppmd8_RangeEnc_FlushData(CPpmd8 *p);
void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol); /* symbol = -1 means EndMarker */
EXTERN_C_END
-
+
#endif
diff --git a/src/lib/lib7z/Ppmd8Dec.c b/src/lib/lib7z/Ppmd8Dec.c
index c54e02ab205..12fd7ec0d79 100644
--- a/src/lib/lib7z/Ppmd8Dec.c
+++ b/src/lib/lib7z/Ppmd8Dec.c
@@ -128,11 +128,11 @@ int Ppmd8_DecodeSymbol(CPpmd8 *p)
i -= k;
}
while (i != num);
-
+
see = Ppmd8_MakeEscFreq(p, numMasked, &freqSum);
freqSum += hiCnt;
count = RangeDec_GetThreshold(p, freqSum);
-
+
if (count < hiCnt)
{
Byte symbol;
diff --git a/src/lib/lib7z/Ppmd8Enc.c b/src/lib/lib7z/Ppmd8Enc.c
index 8da727eb25a..f433fe9ee0a 100644
--- a/src/lib/lib7z/Ppmd8Enc.c
+++ b/src/lib/lib7z/Ppmd8Enc.c
@@ -81,7 +81,7 @@ void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol)
sum += s->Freq;
}
while (--i);
-
+
PPMD_SetAllBitsIn256Bytes(charMask);
MASK(s->Symbol) = 0;
i = p->MinContext->NumStats;
@@ -125,7 +125,7 @@ void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol)
p->MinContext = Ppmd8_GetContext(p, p->MinContext->Suffix);
}
while (p->MinContext->NumStats == numMasked);
-
+
see = Ppmd8_MakeEscFreq(p, numMasked, &escFreq);
s = Ppmd8_GetStats(p, p->MinContext);
sum = 0;
@@ -154,7 +154,7 @@ void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol)
s++;
}
while (--i);
-
+
RangeEnc_Encode(p, sum, escFreq, sum + escFreq);
see->Summ = (UInt16)(see->Summ + sum + escFreq);
}
diff --git a/src/lib/lib7z/Sha256.c b/src/lib/lib7z/Sha256.c
index eb4fc61fc9d..8b824744ced 100644
--- a/src/lib/lib7z/Sha256.c
+++ b/src/lib/lib7z/Sha256.c
@@ -133,7 +133,7 @@ static void Sha256_Transform(UInt32 *state, const UInt32 *data)
for (j = 0; j < 8; j++)
state[j] += T[j];
#endif
-
+
/* Wipe variables */
/* memset(W, 0, sizeof(W)); */
/* memset(T, 0, sizeof(T)); */
diff --git a/src/lib/lib7z/Xz.h b/src/lib/lib7z/Xz.h
index 0f7a822c37e..45481cfdf6d 100644
--- a/src/lib/lib7z/Xz.h
+++ b/src/lib/lib7z/Xz.h
@@ -199,7 +199,7 @@ typedef struct
unsigned indexPreSize;
CXzStreamFlags streamFlags;
-
+
UInt32 blockHeaderSize;
UInt64 packSize;
UInt64 unpackSize;
diff --git a/src/lib/lib7z/XzDec.c b/src/lib/lib7z/XzDec.c
index 113e2cdf0f0..5a4a9a1ca0e 100644
--- a/src/lib/lib7z/XzDec.c
+++ b/src/lib/lib7z/XzDec.c
@@ -421,7 +421,7 @@ SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen,
const Byte *srcCur;
int srcFinishedCur;
int encodingWasFinished;
-
+
if (i == 0)
{
srcCur = src;
@@ -434,7 +434,7 @@ SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen,
srcLenCur = p->size[i - 1] - p->pos[i - 1];
srcFinishedCur = p->finished[i - 1];
}
-
+
if (i == p->numCoders - 1)
{
destCur = dest;
@@ -447,7 +447,7 @@ SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen,
destCur = p->buf + (CODER_BUF_SIZE * i);
destLenCur = CODER_BUF_SIZE;
}
-
+
res = coder->Code(coder->p, destCur, &destLenCur, srcCur, &srcLenCur, srcFinishedCur, finishMode, &encodingWasFinished);
if (!encodingWasFinished)
@@ -474,7 +474,7 @@ SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen,
p->pos[i] = 0;
p->finished[i] = encodingWasFinished;
}
-
+
if (res != SZ_OK)
return res;
@@ -637,20 +637,20 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
*status = CODER_STATUS_NOT_FINISHED;
return SZ_OK;
}
-
+
res = MixCoder_Code(&p->decoder, dest, &destLen2, src, &srcLen2, False, finishMode, status);
XzCheck_Update(&p->check, dest, destLen2);
-
+
(*srcLen) += srcLen2;
src += srcLen2;
p->packSize += srcLen2;
-
+
(*destLen) += destLen2;
dest += destLen2;
p->unpackSize += destLen2;
-
+
RINOK(res);
-
+
if (*status == CODER_STATUS_FINISHED_WITH_MARK)
{
Byte temp[32];
@@ -659,14 +659,14 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
Sha256_Update(&p->sha, temp, num);
p->indexSize += num;
p->numBlocks++;
-
+
p->state = XZ_STATE_BLOCK_FOOTER;
p->pos = 0;
p->alignPos = 0;
}
else if (srcLen2 == 0 && destLen2 == 0)
return SZ_OK;
-
+
continue;
}
@@ -872,7 +872,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
}
break;
}
-
+
case XZ_STATE_BLOCK: break; /* to disable GCC warning */
}
}
diff --git a/src/lib/lib7z/XzEnc.c b/src/lib/lib7z/XzEnc.c
index 56cfd579c69..8a206f4b9af 100644
--- a/src/lib/lib7z/XzEnc.c
+++ b/src/lib/lib7z/XzEnc.c
@@ -409,10 +409,10 @@ static SRes Xz_Compress(CXzStream *xz, CLzma2WithFilters *lzmaf,
int filterIndex = 0;
CXzFilter *filter = NULL;
const CXzFilterProps *fp = props->filterProps;
-
+
XzBlock_ClearFlags(&block);
XzBlock_SetNumFilters(&block, 1 + (fp ? 1 : 0));
-
+
if (fp)
{
filter = &block.filters[filterIndex++];
@@ -440,13 +440,13 @@ static SRes Xz_Compress(CXzStream *xz, CLzma2WithFilters *lzmaf,
seqSizeOutStream.p.Write = MyWrite;
seqSizeOutStream.realStream = outStream;
seqSizeOutStream.processed = 0;
-
+
RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.p));
-
+
checkInStream.p.Read = SeqCheckInStream_Read;
checkInStream.realStream = inStream;
SeqCheckInStream_Init(&checkInStream, XzFlags_GetCheckType(xz->flags));
-
+
if (fp)
{
#ifdef USE_SUBBLOCK
diff --git a/src/lib/lib7z/XzIn.c b/src/lib/lib7z/XzIn.c
index 4ba87a2cfc6..adb24c0eaac 100644
--- a/src/lib/lib7z/XzIn.c
+++ b/src/lib/lib7z/XzIn.c
@@ -88,7 +88,7 @@ static SRes Xz_ReadIndex2(CXzStream *p, const Byte *buf, size_t size, ISzAlloc *
if (numBlocks != numBlocks64 || numBlocks * 2 > size)
return SZ_ERROR_ARCHIVE;
}
-
+
crcStartPos = pos;
Xz_Free(p, alloc);
if (numBlocks != 0)
@@ -149,7 +149,7 @@ static SRes Xz_ReadBackward(CXzStream *p, ILookInStream *stream, Int64 *startOff
RINOK(SeekFromCur(stream, startOffset));
RINOK(LookInStream_Read2(stream, buf, XZ_STREAM_FOOTER_SIZE, SZ_ERROR_NO_ARCHIVE));
-
+
if (memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) != 0)
{
UInt32 total = 0;
@@ -185,7 +185,7 @@ static SRes Xz_ReadBackward(CXzStream *p, ILookInStream *stream, Int64 *startOff
if (memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) != 0)
return SZ_ERROR_NO_ARCHIVE;
}
-
+
p->flags = (CXzStreamFlags)GetBe16(buf + 8);
if (!XzFlags_IsSupported(p->flags))
diff --git a/src/lib/lib7z/x7zFile.c b/src/lib/lib7z/x7zFile.c
index a66c9e9d08e..8eb02b5020c 100644
--- a/src/lib/lib7z/x7zFile.c
+++ b/src/lib/lib7z/x7zFile.c
@@ -120,12 +120,12 @@ WRes File_Read(CSzFile *p, void *data, size_t *size)
return 0;
#else
-
+
*size = fread(data, 1, originalSize, p->file);
if (*size == originalSize)
return 0;
return ferror(p->file);
-
+
#endif
}
@@ -134,7 +134,7 @@ WRes File_Write(CSzFile *p, const void *data, size_t *size)
size_t originalSize = *size;
if (originalSize == 0)
return 0;
-
+
#ifdef USE_WINDOWS_FILE
*size = 0;
@@ -160,7 +160,7 @@ WRes File_Write(CSzFile *p, const void *data, size_t *size)
if (*size == originalSize)
return 0;
return ferror(p->file);
-
+
#endif
}
@@ -190,7 +190,7 @@ WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
return 0;
#else
-
+
int moveMethod;
int res;
switch (origin)
@@ -203,14 +203,14 @@ WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
res = fseek(p->file, (long)*pos, moveMethod);
*pos = ftell(p->file);
return res;
-
+
#endif
}
WRes File_GetLength(CSzFile *p, UInt64 *length)
{
#ifdef USE_WINDOWS_FILE
-
+
DWORD sizeHigh;
DWORD sizeLow = GetFileSize(p->handle, &sizeHigh);
if (sizeLow == 0xFFFFFFFF)
@@ -221,15 +221,15 @@ WRes File_GetLength(CSzFile *p, UInt64 *length)
}
*length = (((UInt64)sizeHigh) << 32) + sizeLow;
return 0;
-
+
#else
-
+
long pos = ftell(p->file);
int res = fseek(p->file, 0, SEEK_END);
*length = ftell(p->file);
fseek(p->file, pos, SEEK_SET);
return res;
-
+
#endif
}
diff --git a/src/lib/util/avhuff.c b/src/lib/util/avhuff.c
index 3e1126abea6..753d839b4c9 100644
--- a/src/lib/util/avhuff.c
+++ b/src/lib/util/avhuff.c
@@ -60,8 +60,8 @@
+02 = samples (2 bytes) - number of samples per audio stream
+04 = width (2 bytes) - width of video data
+06 = height (2 bytes) - height of video data
- +08 = audio huffman size (2 bytes) - size of audio huffman tables
- (0x0000 => uncompressed deltas are used)
+ +08 = audio huffman size (2 bytes) - size of audio huffman tables
+ (0x0000 => uncompressed deltas are used)
+0A = str0size (2 bytes) - compressed size of stream 0
+0C = str1size (2 bytes) - compressed size of stream 1
...
@@ -214,7 +214,7 @@ m_flac_encoder.set_strip_metadata(true);
//-------------------------------------------------
-// encode_data - encode a block of data into a
+// encode_data - encode a block of data into a
// compressed data stream
//-------------------------------------------------
@@ -343,12 +343,12 @@ avhuff_error avhuff_encoder::assemble_data(UINT8 *dest, UINT32 dlength, bitmap_y
*dest++ = bitmap.width() & 0xff;
*dest++ = bitmap.height() >> 8;
*dest++ = bitmap.height() & 0xff;
-
+
// copy the metadata
if (metadatasize > 0)
memcpy(dest, metadata, metadatasize);
dest += metadatasize;
-
+
// copy the audio streams
for (UINT8 curchan = 0; curchan < channels; curchan++)
for (UINT32 cursamp = 0; cursamp < numsamples; cursamp++)
@@ -356,7 +356,7 @@ avhuff_error avhuff_encoder::assemble_data(UINT8 *dest, UINT32 dlength, bitmap_y
*dest++ = samples[curchan][cursamp] >> 8;
*dest++ = samples[curchan][cursamp] & 0xff;
}
-
+
// copy the video data
for (INT32 y = 0; y < bitmap.height(); y++)
{
@@ -372,7 +372,7 @@ avhuff_error avhuff_encoder::assemble_data(UINT8 *dest, UINT32 dlength, bitmap_y
//-------------------------------------------------
-// encode_audio - encode raw audio data to the
+// encode_audio - encode raw audio data to the
// destination
//-------------------------------------------------
@@ -384,20 +384,20 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
UINT16 be_test = 0;
*(UINT8 *)&be_test = 1;
bool swap_endian = (be_test == 1);
-
+
// set huffman tree size to 0xffff to indicate FLAC
sizes[0] = 0xff;
sizes[1] = 0xff;
-
+
// set the block size for this round and iterate over channels
m_flac_encoder.set_block_size(samples);
- for (int chnum = 0; chnum < channels; chnum++)
+ for (int chnum = 0; chnum < channels; chnum++)
{
// encode the data
m_flac_encoder.reset(dest, samples * 2);
if (!m_flac_encoder.encode_interleaved(reinterpret_cast<const INT16 *>(source) + chnum * samples, samples, swap_endian))
return AVHERR_COMPRESSION_ERROR;
-
+
// set the size for this channel
UINT32 cursize = m_flac_encoder.finish();
sizes[chnum * 2 + 2] = cursize >> 8;
@@ -495,7 +495,7 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int
//-------------------------------------------------
-// encode_video - encode raw video data to the
+// encode_video - encode raw video data to the
// destination
//-------------------------------------------------
@@ -516,7 +516,7 @@ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int widt
// set up the output; first byte is 0x80 to indicate lossless encoding
bitstream_out bitbuf(dest, width * height * 2);
bitbuf.write(0x80, 8);
-
+
// compute the histograms for the data
UINT16 *yrle = m_ycontext.rle_and_histo_bitmap(source + 0, width, 2, height);
UINT16 *cbrle = m_cbcontext.rle_and_histo_bitmap(source + 1, width / 2, 4, height);
@@ -563,7 +563,7 @@ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int widt
//**************************************************************************
//-------------------------------------------------
-// rle_and_histo_bitmap - RLE compress and
+// rle_and_histo_bitmap - RLE compress and
// histogram a bitmap's worth of data
//-------------------------------------------------
@@ -584,12 +584,12 @@ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *sour
// fetch current data
UINT8 curdelta = *source - prevdata;
prevdata = *source;
-
+
// 0 deltas scan forward for a count
if (curdelta == 0)
{
int zerocount = 1;
-
+
// count the number of consecutive values
const UINT8 *scandata;
for (scandata = source + item_advance; scandata < end; scandata += item_advance)
@@ -597,7 +597,7 @@ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *sour
zerocount++;
else
break;
-
+
// if we hit the end of a row, maximize the count
if (scandata >= end && zerocount >= 8)
zerocount = 100000;
@@ -609,16 +609,16 @@ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *sour
// advance past the run
source += (code_to_rlecount(rlecode) - 1) * item_advance;
}
-
+
// otherwise, encode the actual data
else
m_encoder.histo_one(*dest++ = curdelta);
}
-
+
// advance to the next row
source = end;
}
-
+
// compute the tree for our histogram
m_encoder.compute_tree_from_histo();
return m_rlebuffer;
@@ -787,7 +787,7 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
//-------------------------------------------------
-// decode_audio - decode audio from a compressed
+// decode_audio - decode audio from a compressed
// data stream
//-------------------------------------------------
@@ -827,7 +827,7 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
// finish up
m_flac_decoder.finish();
}
-
+
// advance to the next channel's data
source += size;
}
@@ -881,7 +881,7 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
curdest += 2;
}
}
-
+
// otherwise, Huffman-decode the data
else
{
@@ -902,7 +902,7 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
return AVHERR_INVALID_DATA;
}
}
-
+
// advance to the next channel's data
source += size;
}
@@ -911,7 +911,7 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
//-------------------------------------------------
-// decode_video - decode video from a compressed
+// decode_video - decode video from a compressed
// data stream
//-------------------------------------------------
@@ -969,7 +969,7 @@ avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const
m_cbcontext.flush_rle();
m_crcontext.flush_rle();
}
-
+
// check for errors if we overflowed or decoded too little data
if (bitbuf.overflow() || bitbuf.flush() != complength)
return AVHERR_INVALID_DATA;
diff --git a/src/lib/util/avhuff.h b/src/lib/util/avhuff.h
index 6b192d3338e..e4425837c88 100644
--- a/src/lib/util/avhuff.h
+++ b/src/lib/util/avhuff.h
@@ -129,7 +129,7 @@ private:
// construction/destruction
deltarle_encoder()
: m_rlecount(0) { }
-
+
// histogramming
UINT16 *rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count);
@@ -150,10 +150,10 @@ private:
avhuff_error encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength);
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;
+ // video encoding contexts
+ deltarle_encoder m_ycontext;
+ deltarle_encoder m_cbcontext;
+ deltarle_encoder m_crcontext;
// audio encoding contexts
dynamic_buffer m_audiobuffer;
@@ -189,7 +189,7 @@ private:
// construction/destruction
deltarle_decoder()
: m_rlecount(0), m_prevdata(0) { }
-
+
// general
void reset() { m_rlecount = m_prevdata = 0; }
@@ -212,12 +212,12 @@ 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;
diff --git a/src/lib/util/bitstream.h b/src/lib/util/bitstream.h
index e8aa8fa1184..1c1859199d7 100644
--- a/src/lib/util/bitstream.h
+++ b/src/lib/util/bitstream.h
@@ -55,11 +55,11 @@ class bitstream_in
public:
// construction/destruction
bitstream_in(const void *src, UINT32 srclength);
-
+
// getters
bool overflow() const { return ((m_doffset - m_bits / 8) > m_dlength); }
UINT32 read_offset() const;
-
+
// operations
UINT32 read(int numbits);
UINT32 peek(int numbits);
@@ -82,10 +82,10 @@ class bitstream_out
public:
// construction/destruction
bitstream_out(void *dest, UINT32 destlength);
-
+
// getters
bool overflow() const { return (m_doffset > m_dlength); }
-
+
// operations
void write(UINT32 newbits, int numbits);
UINT32 flush();
diff --git a/src/lib/util/cdrom.c b/src/lib/util/cdrom.c
index 47e5c9ff627..d0977a1f534 100644
--- a/src/lib/util/cdrom.c
+++ b/src/lib/util/cdrom.c
@@ -380,7 +380,7 @@ UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer)
UINT32 chdsector = physical_to_chd_lba(file, lbasector, tracknum);
if (file->cdtoc.tracks[tracknum].subsize == 0)
return 1;
-
+
// read the data
chd_error err = read_partial_sector(file, buffer, chdsector, tracknum, file->cdtoc.tracks[tracknum].datasize, file->cdtoc.tracks[tracknum].subsize);
return (err == CHDERR_NONE);
diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c
index 53665056ea3..61fc8641ef4 100644
--- a/src/lib/util/chd.c
+++ b/src/lib/util/chd.c
@@ -90,7 +90,7 @@ enum
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)
@@ -125,8 +125,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
};
@@ -179,7 +179,7 @@ inline sha1_t chd_file::be_read_sha1(const UINT8 *base)
//-------------------------------------------------
-// be_write_sha1 - write a sha1_t to a data
+// be_write_sha1 - write a sha1_t to a data
// stream in bigendian order
//-------------------------------------------------
@@ -199,7 +199,7 @@ inline void chd_file::file_read(UINT64 offset, void *dest, UINT32 length)
// no file = failure
if (m_file == NULL)
throw CHDERR_NOT_OPEN;
-
+
// seek and read
core_fseek(m_file, offset, SEEK_SET);
UINT32 count = core_fread(m_file, dest, length);
@@ -218,7 +218,7 @@ inline void chd_file::file_write(UINT64 offset, const void *source, UINT32 lengt
// no file = failure
if (m_file == NULL)
throw CHDERR_NOT_OPEN;
-
+
// seek and write
core_fseek(m_file, offset, SEEK_SET);
UINT32 count = core_fwrite(m_file, source, length);
@@ -229,7 +229,7 @@ inline void chd_file::file_write(UINT64 offset, const void *source, UINT32 lengt
//-------------------------------------------------
// file_append - append to the file at the given
-// offset, ensuring we start at the given
+// offset, ensuring we start at the given
// alignment; on failure throw an error
//-------------------------------------------------
@@ -346,7 +346,7 @@ sha1_t chd_file::raw_sha1()
// determine offset within the file for data-only
if (m_rawsha1_offset == 0)
throw CHDERR_UNSUPPORTED_VERSION;
-
+
// read the big-endian version
UINT8 rawbuf[sizeof(sha1_t)];
file_read(m_rawsha1_offset, rawbuf, sizeof(rawbuf));
@@ -371,7 +371,7 @@ sha1_t chd_file::parent_sha1()
// determine offset within the file
if (m_parentsha1_offset == 0)
throw CHDERR_UNSUPPORTED_VERSION;
-
+
// read the big-endian version
UINT8 rawbuf[sizeof(sha1_t)];
file_read(m_parentsha1_offset, rawbuf, sizeof(rawbuf));
@@ -395,7 +395,7 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32
// error if invalid
if (hunknum >= m_hunkcount)
return CHDERR_HUNK_OUT_OF_RANGE;
-
+
// get the map pointer
UINT8 *rawmap;
switch (m_version)
@@ -410,17 +410,17 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32
compressor = CHD_CODEC_ZLIB;
compbytes = be_read(&rawmap[12], 2) + (rawmap[14] << 16);
break;
-
+
case V34_MAP_ENTRY_TYPE_UNCOMPRESSED:
compressor = CHD_CODEC_NONE;
compbytes = m_hunkbytes;
break;
-
+
case V34_MAP_ENTRY_TYPE_MINI:
compressor = CHD_CODEC_MINI;
compbytes = 0;
break;
-
+
case V34_MAP_ENTRY_TYPE_SELF_HUNK:
compressor = CHD_CODEC_SELF;
compbytes = 0;
@@ -432,7 +432,7 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32
break;
}
break;
-
+
// v5 map entries
case 5:
rawmap = m_rawmap + m_mapentrybytes * hunknum;
@@ -452,7 +452,7 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32
}
break;
}
-
+
// compressed case
switch (rawmap[0])
{
@@ -473,7 +473,7 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32
compressor = CHD_CODEC_SELF;
compbytes = 0;
break;
-
+
case COMPRESSION_PARENT:
compressor = CHD_CODEC_PARENT;
compbytes = 0;
@@ -494,12 +494,12 @@ void chd_file::set_raw_sha1(sha1_t rawdata)
// create a big-endian version
UINT8 rawbuf[sizeof(sha1_t)];
be_write_sha1(rawbuf, rawdata);
-
+
// write to the header
UINT64 offset = (m_rawsha1_offset != 0) ? m_rawsha1_offset : m_sha1_offset;
assert(offset != 0);
file_write(offset, rawbuf, sizeof(rawbuf));
-
+
// if we have a separate rawsha1_offset, update the full sha1 as well
if (m_rawsha1_offset != 0)
metadata_update_hash();
@@ -519,7 +519,7 @@ void chd_file::set_parent_sha1(sha1_t parent)
// create a big-endian version
UINT8 rawbuf[sizeof(sha1_t)];
be_write_sha1(rawbuf, parent);
-
+
// write to the header
assert(m_parentsha1_offset != 0);
file_write(m_parentsha1_offset, rawbuf, sizeof(rawbuf));
@@ -602,7 +602,7 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun
// create the file normally, then claim the file
chd_error chderr = create(*file, logicalbytes, hunkbytes, unitbytes, compression);
m_owns_file = true;
-
+
// if an error happened, close and delete the file
if (chderr != CHDERR_NONE)
{
@@ -633,7 +633,7 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun
// create the file normally, then claim the file
chd_error chderr = create(*file, logicalbytes, hunkbytes, compression, parent);
m_owns_file = true;
-
+
// if an error happened, close and delete the file
if (chderr != CHDERR_NONE)
{
@@ -669,7 +669,7 @@ chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent)
core_fclose(file);
return err;
}
-
+
// we now own this file
m_owns_file = true;
return err;
@@ -708,7 +708,7 @@ void chd_file::close()
m_owns_file = false;
m_allow_reads = false;
m_allow_writes = false;
-
+
// reset core parameters from the header
m_version = HEADER_VERSION;
m_logicalbytes = 0;
@@ -759,7 +759,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
// punt if no file
if (m_file == NULL)
throw CHDERR_NOT_OPEN;
-
+
// return an error if out of range
if (hunknum >= m_hunkcount)
throw CHDERR_HUNK_OUT_OF_RANGE;
@@ -787,13 +787,13 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
if (!(rawmap[15] & V34_MAP_ENTRY_FLAG_NO_CRC) && dest != NULL && crc32_creator::simple(dest, m_hunkbytes) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
return CHDERR_NONE;
-
+
case V34_MAP_ENTRY_TYPE_UNCOMPRESSED:
file_read(blockoffs, dest, m_hunkbytes);
if (!(rawmap[15] & V34_MAP_ENTRY_FLAG_NO_CRC) && crc32_creator::simple(dest, m_hunkbytes) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
return CHDERR_NONE;
-
+
case V34_MAP_ENTRY_TYPE_MINI:
be_write(dest, blockoffs, 8);
for (UINT32 bytes = 8; bytes < m_hunkbytes; bytes++)
@@ -801,7 +801,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
if (!(rawmap[15] & V34_MAP_ENTRY_FLAG_NO_CRC) && crc32_creator::simple(dest, m_hunkbytes) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
return CHDERR_NONE;
-
+
case V34_MAP_ENTRY_TYPE_SELF_HUNK:
return read_hunk(blockoffs, dest);
@@ -811,7 +811,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
return m_parent->read_hunk(blockoffs, dest);
}
break;
-
+
// v5 map entries
case 5:
rawmap = m_rawmap + m_mapentrybytes * hunknum;
@@ -819,7 +819,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
// uncompressed case
if (!compressed())
{
- blockoffs = UINT64(be_read(rawmap, 4)) * UINT64(m_hunkbytes);
+ blockoffs = UINT64(be_read(rawmap, 4)) * UINT64(m_hunkbytes);
if (blockoffs != 0)
file_read(blockoffs, dest, m_hunkbytes);
else if (m_parent_missing)
@@ -830,7 +830,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
memset(dest, 0, m_hunkbytes);
return CHDERR_NONE;
}
-
+
// compressed case
blocklen = be_read(&rawmap[1], 3);
blockoffs = be_read(&rawmap[4], 6);
@@ -857,7 +857,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
case COMPRESSION_SELF:
return read_hunk(blockoffs, dest);
-
+
case COMPRESSION_PARENT:
if (m_parent_missing)
throw CHDERR_REQUIRES_PARENT;
@@ -865,11 +865,11 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
}
break;
}
-
+
// if we get here, something was wrong
throw CHDERR_READ_ERROR;
}
-
+
// just return errors
catch (chd_error &err)
{
@@ -902,7 +902,7 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
// uncompressed writes only via this interface
if (compressed())
throw CHDERR_FILE_NOT_WRITEABLE;
-
+
// see if we have allocated the space on disk for this hunk
UINT8 *rawmap = m_rawmap + hunknum * 4;
UINT32 rawentry = be_read(rawmap, 4);
@@ -919,29 +919,29 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
all_zeros = false;
break;
}
-
+
// if it's all zeros, do nothing more
if (all_zeros)
return CHDERR_NONE;
-
+
// append new data to the end of the file, aligning the first chunk
rawentry = file_append(buffer, m_hunkbytes, m_hunkbytes) / m_hunkbytes;
-
+
// write the map entry back
be_write(rawmap, rawentry, 4);
file_write(m_mapoffset + hunknum * 4, rawmap, 4);
-
+
// update the cached hunk if we just wrote it
if (hunknum == m_cachehunk && buffer != m_cache)
memcpy(m_cache, buffer, m_hunkbytes);
}
-
+
// otherwise, just overwrite
else
file_write(UINT64(rawentry) * UINT64(m_hunkbytes), buffer, m_hunkbytes);
return CHDERR_NONE;
}
-
+
// just return errors
catch (chd_error &err)
{
@@ -973,7 +973,7 @@ chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count
//-------------------------------------------------
-// read_bytes - read from the CHD at a byte level,
+// read_bytes - read from the CHD at a byte level,
// using the cache to handle partial hunks
//-------------------------------------------------
@@ -988,12 +988,12 @@ chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes)
// determine start/end boundaries
UINT32 startoffs = (curhunk == first_hunk) ? (offset % m_hunkbytes) : 0;
UINT32 endoffs = (curhunk == last_hunk) ? ((offset + bytes - 1) % m_hunkbytes) : (m_hunkbytes - 1);
-
+
// if it's a full block, just read directly from disk unless it's the cached hunk
chd_error err = CHDERR_NONE;
if (startoffs == 0 && endoffs == m_hunkbytes - 1 && curhunk != m_cachehunk)
err = read_hunk(curhunk, dest);
-
+
// otherwise, read from the cache
else
{
@@ -1032,12 +1032,12 @@ chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes)
// determine start/end boundaries
UINT32 startoffs = (curhunk == first_hunk) ? (offset % m_hunkbytes) : 0;
UINT32 endoffs = (curhunk == last_hunk) ? ((offset + bytes - 1) % m_hunkbytes) : (m_hunkbytes - 1);
-
+
// if it's a full block, just write directly to disk unless it's the cached hunk
chd_error err = CHDERR_NONE;
if (startoffs == 0 && endoffs == m_hunkbytes - 1 && curhunk != m_cachehunk)
err = write_hunk(curhunk, source);
-
+
// otherwise, write from the cache
else
{
@@ -1080,7 +1080,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
file_read(metaentry.offset + METADATA_HEADER_SIZE, output.stringbuffer(metaentry.length), metaentry.length);
return CHDERR_NONE;
}
-
+
// just return errors
catch (chd_error &err)
{
@@ -1103,7 +1103,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
file_read(metaentry.offset + METADATA_HEADER_SIZE, output, metaentry.length);
return CHDERR_NONE;
}
-
+
// just return errors
catch (chd_error &err)
{
@@ -1126,7 +1126,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
file_read(metaentry.offset + METADATA_HEADER_SIZE, output, MIN(outputlen, resultlen));
return CHDERR_NONE;
}
-
+
// just return errors
catch (chd_error &err)
{
@@ -1151,7 +1151,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
resultflags = metaentry.flags;
return CHDERR_NONE;
}
-
+
// just return errors
catch (chd_error &err)
{
@@ -1191,16 +1191,16 @@ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, c
be_write(length, inputlen, 3);
file_write(metaentry.offset + 5, length, sizeof(length));
}
-
+
// indicate we did everything
finished = true;
}
-
+
// if it doesn't fit, unlink the current entry
else
metadata_set_previous_next(metaentry.prev, metaentry.next);
}
-
+
// if not yet done, create a new entry and append
if (!finished)
{
@@ -1210,7 +1210,7 @@ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, c
raw_meta_header[4] = flags;
be_write(&raw_meta_header[5], (inputlen & 0x00ffffff) | (flags << 24), 3);
be_write(&raw_meta_header[8], 0, 8);
-
+
// append the new header, then the data
UINT64 offset = file_append(raw_meta_header, sizeof(raw_meta_header));
file_append(inputbuf, inputlen);
@@ -1223,7 +1223,7 @@ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, c
metadata_update_hash();
return CHDERR_NONE;
}
-
+
// return any errors
catch (chd_error &err)
{
@@ -1246,12 +1246,12 @@ chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex)
metadata_entry metaentry;
if (!metadata_find(metatag, metaindex, metaentry))
throw CHDERR_METADATA_NOT_FOUND;
-
+
// point the previous to the next, unlinking us
metadata_set_previous_next(metaentry.prev, metaentry.next);
return CHDERR_NONE;
}
-
+
// return any errors
catch (chd_error &err)
{
@@ -1261,7 +1261,7 @@ chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex)
//-------------------------------------------------
-// clone_all_metadata - clone the metadata from
+// clone_all_metadata - clone the metadata from
// one CHD to a second
//-------------------------------------------------
@@ -1282,7 +1282,7 @@ chd_error chd_file::clone_all_metadata(chd_file &source)
// read the metadata item
filedata.resize(metaentry.length);
source.file_read(metaentry.offset + METADATA_HEADER_SIZE, filedata, metaentry.length);
-
+
// write it to the destination
chd_error err = write_metadata(metaentry.metatag, (UINT32)-1, filedata, metaentry.length, metaentry.flags);
if (err != CHDERR_NONE)
@@ -1290,7 +1290,7 @@ chd_error chd_file::clone_all_metadata(chd_file &source)
}
return CHDERR_NONE;
}
-
+
// return any errors
catch (chd_error &err)
{
@@ -1363,7 +1363,7 @@ chd_error chd_file::codec_configure(chd_codec_type codec, int param, void *confi
}
return CHDERR_INVALID_PARAMETER;
}
-
+
// return any errors
catch (chd_error &err)
{
@@ -1425,7 +1425,7 @@ const char *chd_file::error_string(chd_error err)
//-------------------------------------------------
// guess_unitbytes - for older CHD formats, take
-// a guess at the bytes/unit based on metadata
+// a guess at the bytes/unit based on metadata
//-------------------------------------------------
UINT32 chd_file::guess_unitbytes()
@@ -1441,7 +1441,7 @@ UINT32 chd_file::guess_unitbytes()
read_metadata(CDROM_TRACK_METADATA_TAG, 0, metadata) == CHDERR_NONE ||
read_metadata(CDROM_TRACK_METADATA2_TAG, 0, metadata) == CHDERR_NONE)
return CD_FRAME_SIZE;
-
+
// otherwise, just map 1:1 with the hunk size
return m_hunkbytes;
}
@@ -1464,7 +1464,7 @@ void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1)
m_metaoffset = be_read(&rawheader[36], 8);
m_hunkbytes = be_read(&rawheader[76], 4);
m_hunkcount = be_read(&rawheader[24], 4);
-
+
// extract parent SHA-1
UINT32 flags = be_read(&rawheader[16], 4);
if ((flags & 2) && m_allow_writes)
@@ -1480,21 +1480,21 @@ void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1)
default: throw CHDERR_UNKNOWN_COMPRESSION;
}
m_compression[1] = m_compression[2] = m_compression[3] = CHD_CODEC_NONE;
-
+
// describe the format
m_mapoffset_offset = 0;
m_metaoffset_offset = 36;
m_sha1_offset = 80;
m_rawsha1_offset = 0;
m_parentsha1_offset = 100;
-
+
// determine properties of map entries
m_mapentrybytes = 16;
// extract parent SHA-1
if (flags & 1)
parentsha1 = be_read_sha1(&rawheader[m_parentsha1_offset]);
-
+
// guess at the units based on snooping the metadata
m_unitbytes = guess_unitbytes();
m_unitcount = (m_logicalbytes + m_unitbytes - 1) / m_unitbytes;
@@ -1518,7 +1518,7 @@ void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1)
m_metaoffset = be_read(&rawheader[36], 8);
m_hunkbytes = be_read(&rawheader[44], 4);
m_hunkcount = be_read(&rawheader[24], 4);
-
+
// extract parent SHA-1
UINT32 flags = be_read(&rawheader[16], 4);
if ((flags & 2) && m_allow_writes)
@@ -1534,21 +1534,21 @@ void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1)
default: throw CHDERR_UNKNOWN_COMPRESSION;
}
m_compression[1] = m_compression[2] = m_compression[3] = CHD_CODEC_NONE;
-
+
// describe the format
m_mapoffset_offset = 0;
m_metaoffset_offset = 36;
m_sha1_offset = 48;
m_rawsha1_offset = 88;
m_parentsha1_offset = 68;
-
+
// determine properties of map entries
m_mapentrybytes = 16;
// extract parent SHA-1
if (flags & 1)
parentsha1 = be_read_sha1(&rawheader[m_parentsha1_offset]);
-
+
// guess at the units based on snooping the metadata
m_unitbytes = guess_unitbytes();
m_unitcount = (m_logicalbytes + m_unitbytes - 1) / m_unitbytes;
@@ -1574,20 +1574,20 @@ void chd_file::parse_v5_header(UINT8 *rawheader, sha1_t &parentsha1)
m_hunkcount = (m_logicalbytes + m_hunkbytes - 1) / m_hunkbytes;
m_unitbytes = be_read(&rawheader[60], 4);
m_unitcount = (m_logicalbytes + m_unitbytes - 1) / m_unitbytes;
-
+
// determine compression
m_compression[0] = be_read(&rawheader[16], 4);
m_compression[1] = be_read(&rawheader[20], 4);
m_compression[2] = be_read(&rawheader[24], 4);
m_compression[3] = be_read(&rawheader[28], 4);
-
+
// describe the format
m_mapoffset_offset = 40;
m_metaoffset_offset = 48;
m_sha1_offset = 84;
m_rawsha1_offset = 64;
m_parentsha1_offset = 104;
-
+
// determine properties of map entries
m_mapentrybytes = compressed() ? 12 : 4;
@@ -1608,10 +1608,10 @@ chd_error chd_file::compress_v5_map()
// first get a CRC-16 of the original rawmap
crc16_t mapcrc = crc16_creator::simple(m_rawmap, m_hunkcount * 12);
- // create a buffer to hold the RLE data
+ // create a buffer to hold the RLE data
dynamic_buffer compression_rle(m_hunkcount);
UINT8 *dest = compression_rle;
-
+
// use a huffman encoder for 16 different codes, maximum length is 8 bits
huffman_encoder<16, 8> encoder;
encoder.histo_reset();
@@ -1627,7 +1627,7 @@ chd_error chd_file::compress_v5_map()
for (int hunknum = 0; hunknum < m_hunkcount; hunknum++)
{
UINT8 curcomp = m_rawmap[hunknum * 12 + 0];
-
+
// promote self block references to more compact forms
if (curcomp == COMPRESSION_SELF)
{
@@ -1655,15 +1655,15 @@ chd_error chd_file::compress_v5_map()
max_parent = MAX(max_parent, refunit);
last_parent = refunit;
}
-
+
// track maximum compressed length
else //if (curcomp >= COMPRESSION_TYPE_0 && curcomp <= COMPRESSION_TYPE_3)
max_complen = MAX(max_complen, be_read(&m_rawmap[hunknum * 12 + 1], 3));
-
+
// track repeats
if (curcomp == lastcomp)
count++;
-
+
// if no repeat, or we're at the end, flush it
if (curcomp != lastcomp || hunknum == m_hunkcount - 1)
{
@@ -1690,7 +1690,7 @@ chd_error chd_file::compress_v5_map()
encoder.histo_one(*dest++ = lastcomp = curcomp);
}
}
-
+
// compute a tree and export it to the buffer
dynamic_buffer compressed(m_hunkcount * 6);
bitstream_out bitbuf(&compressed[16], compressed.count() - 16);
@@ -1704,7 +1704,7 @@ chd_error chd_file::compress_v5_map()
// encode the data
for (UINT8 *src = compression_rle; src < dest; src++)
encoder.encode_one(bitbuf, *src);
-
+
// determine the number of bits we need to hold the a length
// and a hunk index
UINT8 lengthbits = bits_for_value(max_complen);
@@ -1722,7 +1722,7 @@ chd_error chd_file::compress_v5_map()
UINT32 length = be_read(&rawmap[1], 3);
UINT64 offset = be_read(&rawmap[4], 6);
UINT16 crc = be_read(&rawmap[10], 2);
-
+
// if no count remaining, fetch the next entry
if (count == 0)
{
@@ -1736,7 +1736,7 @@ chd_error chd_file::compress_v5_map()
}
else
count--;
-
+
// output additional data needed for this entry
switch (lastcomp)
{
@@ -1750,23 +1750,23 @@ chd_error chd_file::compress_v5_map()
if (firstoffs == 0)
firstoffs = offset;
break;
-
+
case COMPRESSION_NONE:
bitbuf.write(crc, 16);
if (firstoffs == 0)
firstoffs = offset;
break;
-
+
case COMPRESSION_SELF:
assert(offset < (UINT64(1) << selfbits));
bitbuf.write(offset, selfbits);
break;
-
+
case COMPRESSION_PARENT:
assert(offset < (UINT64(1) << parentbits));
bitbuf.write(offset, parentbits);
break;
-
+
case COMPRESSION_SELF_0:
case COMPRESSION_SELF_1:
case COMPRESSION_PARENT_SELF:
@@ -1775,7 +1775,7 @@ chd_error chd_file::compress_v5_map()
break;
}
}
-
+
// write the map header
UINT32 complen = bitbuf.flush();
assert(!bitbuf.overflow());
@@ -1785,10 +1785,10 @@ chd_error chd_file::compress_v5_map()
compressed[12] = lengthbits;
compressed[13] = selfbits;
compressed[14] = parentbits;
-
+
// write the result
m_mapoffset = file_append(compressed, complen + 16);
-
+
// then write the map offset
UINT8 rawbuf[sizeof(UINT64)];
be_write(rawbuf, m_mapoffset, 8);
@@ -1824,12 +1824,12 @@ void chd_file::decompress_v5_map()
UINT8 lengthbits = rawbuf[12];
UINT8 selfbits = rawbuf[13];
UINT8 parentbits = rawbuf[14];
-
+
// now read the map
dynamic_buffer compressed(mapbytes);
file_read(m_mapoffset + 16, compressed, mapbytes);
bitstream_in bitbuf(compressed, compressed.count());
-
+
// first decode the compression types
huffman_decoder<16, 8> decoder;
huffman_error err = decoder.import_tree_rle(bitbuf);
@@ -1853,7 +1853,7 @@ void chd_file::decompress_v5_map()
rawmap[0] = lastcomp = val;
}
}
-
+
// then iterate through the hunks and extract the needed data
UINT64 curoffset = firstoffs;
UINT32 last_self = 0;
@@ -1874,21 +1874,21 @@ void chd_file::decompress_v5_map()
curoffset += length = bitbuf.read(lengthbits);
crc = bitbuf.read(16);
break;
-
+
case COMPRESSION_NONE:
curoffset += length = m_hunkbytes;
crc = bitbuf.read(16);
break;
-
+
case COMPRESSION_SELF:
last_self = offset = bitbuf.read(selfbits);
break;
-
+
case COMPRESSION_PARENT:
offset = bitbuf.read(parentbits);
last_parent = offset;
break;
-
+
// pseudo-types; convert into base types
case COMPRESSION_SELF_1:
last_self++;
@@ -1896,12 +1896,12 @@ void chd_file::decompress_v5_map()
rawmap[0] = COMPRESSION_SELF;
offset = last_self;
break;
-
+
case COMPRESSION_PARENT_SELF:
rawmap[0] = COMPRESSION_PARENT;
last_parent = offset = (UINT64(hunknum) * UINT64(m_hunkbytes)) / m_unitbytes;
break;
-
+
case COMPRESSION_PARENT_1:
last_parent += m_hunkbytes / m_unitbytes;
case COMPRESSION_PARENT_0:
@@ -1913,12 +1913,12 @@ void chd_file::decompress_v5_map()
be_write(&rawmap[4], offset, 6);
be_write(&rawmap[10], crc, 2);
}
-
+
// verify the final CRC
if (crc16_creator::simple(m_rawmap, m_hunkcount * 12) != mapcrc)
throw CHDERR_DECOMPRESSION_ERROR;
}
-
+
//-------------------------------------------------
// create_common - command path when creating a
@@ -1933,17 +1933,17 @@ chd_error chd_file::create_common()
// if we have a parent, it must be V3 or later
if (m_parent != NULL && m_parent->version() < 3)
throw CHDERR_UNSUPPORTED_VERSION;
-
+
// must be an even number of units per hunk
if (m_hunkbytes % m_unitbytes != 0)
throw CHDERR_INVALID_PARAMETER;
if (m_parent != NULL && m_unitbytes != m_parent->unit_bytes())
throw CHDERR_INVALID_PARAMETER;
-
+
// writes are obviously permitted; reads only if uncompressed
m_allow_writes = true;
m_allow_reads = !compressed();
-
+
// verify the compression types
bool found_zero = false;
for (int codecnum = 0; codecnum < ARRAY_LENGTH(m_compression); codecnum++)
@@ -1978,11 +1978,11 @@ chd_error chd_file::create_common()
// write the resulting header
file_write(0, rawheader, sizeof(rawheader));
-
+
// parse it back out to set up fields appropriately
sha1_t parentsha1;
parse_v5_header(rawheader, parentsha1);
-
+
// write out the map (if not compressed)
if (!compressed())
{
@@ -2001,7 +2001,7 @@ chd_error chd_file::create_common()
// finish opening the file
create_open_common();
}
-
+
// handle errors by closing ourself
catch (chd_error &err)
{
@@ -2030,20 +2030,20 @@ chd_error chd_file::open_common(bool writeable)
// reads are always permitted; writes possibly as well
m_allow_reads = true;
m_allow_writes = writeable;
-
+
// read the raw header
UINT8 rawheader[MAX_HEADER_SIZE];
file_read(0, rawheader, sizeof(rawheader));
-
+
// verify the signature
if (memcmp(rawheader, "MComprHD", 8) != 0)
throw CHDERR_INVALID_FILE;
-
+
// only allow writes to the most recent version
m_version = be_read(&rawheader[12], 4);
if (m_allow_writes && m_version < HEADER_VERSION)
throw CHDERR_UNSUPPORTED_VERSION;
-
+
// read the header if we support it
sha1_t parentsha1 = sha1_t::null;
switch (m_version)
@@ -2051,9 +2051,9 @@ chd_error chd_file::open_common(bool writeable)
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;
+ default: throw CHDERR_UNSUPPORTED_VERSION;
}
-
+
// make sure we have a parent if we need one (and don't if we don't)
if (parentsha1 != sha1_t::null)
{
@@ -2064,12 +2064,12 @@ chd_error chd_file::open_common(bool writeable)
}
else if (parentsha1 == sha1_t::null && m_parent != NULL)
throw CHDERR_INVALID_PARAMETER;
-
+
// finish opening the file
create_open_common();
return CHDERR_NONE;
}
-
+
// handle errors by closing ourself
catch (chd_error &err)
{
@@ -2093,7 +2093,7 @@ void chd_file::create_open_common()
if (m_decompressor[decompnum] == NULL && m_compression[decompnum] != 0)
throw CHDERR_UNKNOWN_COMPRESSION;
}
-
+
// read the map; v5+ compressed drives need to read and decompress their map
m_rawmap.resize(m_hunkcount * m_mapentrybytes);
if (m_version >= 5 && compressed())
@@ -2135,16 +2135,16 @@ void chd_file::verify_proper_compression_append(UINT32 hunknum)
UINT8 *rawmap = &m_rawmap[hunknum * 12];
if (rawmap[0] != 0xff)
throw CHDERR_COMPRESSION_ERROR;
-
+
// if this isn't the first block, only permitted to write immediately
// after the previous one
if (hunknum != 0 && rawmap[-12] == 0xff)
throw CHDERR_COMPRESSION_ERROR;
}
-
+
//-------------------------------------------------
-// hunk_write_compressed - write a hunk to a
+// hunk_write_compressed - write a hunk to a
// compressed CHD, discovering the best
// technique
//-------------------------------------------------
@@ -2153,10 +2153,10 @@ void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UIN
{
// verify that we are appending properly to a compressed file
verify_proper_compression_append(hunknum);
-
+
// write the final result
UINT64 offset = file_append(compressed, complength);
-
+
// update the map entry
UINT8 *rawmap = &m_rawmap[hunknum * 12];
rawmap[0] = (compression == -1) ? COMPRESSION_NONE : compression;
@@ -2175,10 +2175,10 @@ void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk)
{
// verify that we are appending properly to a compressed file
verify_proper_compression_append(hunknum);
-
+
// only permitted to reference prior hunks
if (otherhunk >= hunknum)
- throw CHDERR_INVALID_PARAMETER;
+ throw CHDERR_INVALID_PARAMETER;
// update the map entry
UINT8 *rawmap = &m_rawmap[hunknum * 12];
@@ -2273,11 +2273,11 @@ void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset)
// otherwise, update the link in the previous header
else
offset = prevoffset + 8;
-
+
// create a big-endian version
UINT8 rawbuf[sizeof(UINT64)];
be_write(rawbuf, nextoffset, 8);
-
+
// write to the header and update our local copy
file_write(offset, rawbuf, sizeof(rawbuf));
}
@@ -2296,11 +2296,11 @@ void chd_file::metadata_update_hash()
// compute the new overall hash
sha1_t fullsha1 = compute_overall_sha1(raw_sha1());
-
+
// create a big-endian version
UINT8 rawbuf[sizeof(sha1_t)];
be_write_sha1(&rawbuf[0], fullsha1);
-
+
// write to the header
file_write(m_sha1_offset, rawbuf, sizeof(rawbuf));
}
@@ -2356,7 +2356,7 @@ chd_file_compressor::~chd_file_compressor()
// free the work queues
osd_work_queue_free(m_read_queue);
osd_work_queue_free(m_work_queue);
-
+
// delete allocated arrays
for (int codecnum = 0; codecnum < ARRAY_LENGTH(m_codecs); codecnum++)
delete m_codecs[codecnum];
@@ -2374,16 +2374,16 @@ void chd_file_compressor::compress_begin()
m_total_in = 0;
m_total_out = 0;
m_compsha1.reset();
-
+
// reset our maps
m_parent_map.reset();
m_current_map.reset();
-
+
// reset read state
m_read_queue_offset = 0;
m_read_done_offset = 0;
m_read_error = false;
-
+
// reset work item state
m_work_buffer.resize(hunk_bytes() * (WORK_BUFFER_HUNKS + 1));
m_compressed_buffer.resize(hunk_bytes() * WORK_BUFFER_HUNKS);
@@ -2395,14 +2395,14 @@ void chd_file_compressor::compress_begin()
item.m_compressed = m_compressed_buffer + hunk_bytes() * itemnum;
item.m_hash.resize(hunk_bytes() / unit_bytes());
}
-
+
// initialize codec instances
for (int instance = 0; instance < ARRAY_LENGTH(m_codecs); instance++)
{
delete m_codecs[instance];
m_codecs[instance] = new chd_compressor_group(*this, m_compression);
}
-
+
// reset write state
m_write_hunk = 0;
}
@@ -2429,10 +2429,10 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
if (m_work_item[curitem % WORK_BUFFER_HUNKS].m_status != WS_READY)
break;
- // if it's not all clear, defer
+ // if it's not all clear, defer
if (curitem != enditem)
break;
-
+
// if we're walking the parent, we want one more item to have cleared so we
// can read an extra hunk there
if (m_walking_parent && m_work_item[curitem % WORK_BUFFER_HUNKS].m_status != WS_READY)
@@ -2444,12 +2444,12 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
osd_work_item_queue(m_read_queue, async_read_static, this, WORK_ITEM_FLAG_AUTO_RELEASE);
m_read_queue_offset += WORK_BUFFER_HUNKS * hunk_bytes() / 2;
}
-
+
// flush out any finished items
while (m_work_item[m_write_hunk % WORK_BUFFER_HUNKS].m_status == WS_COMPLETE)
{
work_item &item = m_work_item[m_write_hunk % WORK_BUFFER_HUNKS];
-
+
// free any OSD work item
if (item.m_osd != NULL)
osd_work_item_release(item.m_osd);
@@ -2466,22 +2466,22 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
if (m_parent_map.find(item.m_hash[unit].m_crc16, item.m_hash[unit].m_sha1) == hashmap::NOT_FOUND)
m_parent_map.add(item.m_hunknum * uph + unit, item.m_hash[unit].m_crc16, item.m_hash[unit].m_sha1);
}
-
+
// if we're uncompressed, use regular writes
else if (!compressed())
{
chd_error err = write_hunk(item.m_hunknum, item.m_data);
if (err != CHDERR_NONE)
return err;
-
- // writes of all-0 data don't actually take space, so see if we count this
+
+ // writes of all-0 data don't actually take space, so see if we count this
chd_codec_type codec = CHD_CODEC_NONE;
UINT32 complen;
hunk_info(item.m_hunknum, codec, complen);
if (codec == CHD_CODEC_NONE)
m_total_out += m_hunkbytes;
}
-
+
// for compressing, process the result
else do
{
@@ -2492,7 +2492,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
hunk_copy_from_self(item.m_hunknum, selfhunk);
break;
}
-
+
// if not, see if it's in the parent map
if (m_parent != NULL)
{
@@ -2503,17 +2503,17 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
break;
}
}
-
+
// otherwise, append it compressed and add to the self map
hunk_write_compressed(item.m_hunknum, item.m_compression, item.m_compressed, item.m_complen, item.m_hash[0].m_crc16);
m_total_out += item.m_complen;
m_current_map.add(item.m_hunknum, item.m_hash[0].m_crc16, item.m_hash[0].m_sha1);
} while (0);
-
+
// reset the item and advance
item.m_status = WS_READY;
m_write_hunk++;
-
+
// if we hit the end, finalize
if (m_write_hunk == m_hunkcount)
{
@@ -2526,7 +2526,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
for (int itemnum = 0; itemnum < WORK_BUFFER_HUNKS; itemnum++)
m_work_item[itemnum].m_status = WS_READY;
}
-
+
// wait for all reads to finish and if we're compressed, write the final SHA1 and map
else
{
@@ -2538,7 +2538,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
}
}
}
-
+
// update progress and ratio
if (m_walking_parent)
progress = double(m_read_done_offset) / double(logical_bytes());
@@ -2582,7 +2582,7 @@ void chd_file_compressor::async_walk_parent(work_item &item)
//-------------------------------------------------
-// async_compress_hunk - handle asynchronous
+// async_compress_hunk - handle asynchronous
// hunk compression
//-------------------------------------------------
@@ -2615,7 +2615,7 @@ void chd_file_compressor::async_compress_hunk(work_item &item, int threadid)
//-------------------------------------------------
-// async_read - handle asynchronous source file
+// async_read - handle asynchronous source file
// reading
//-------------------------------------------------
@@ -2655,11 +2655,11 @@ void chd_file_compressor::async_read()
curdest += hunk_bytes();
}
}
-
+
// otherwise, call the virtual function
else
read_data(dest, m_read_done_offset, numbytes);
-
+
// spawn off work for each hunk
for (UINT64 curoffs = m_read_done_offset; curoffs < end_offset; curoffs += hunk_bytes())
{
@@ -2678,7 +2678,7 @@ void chd_file_compressor::async_read()
m_compsha1.append(dest, numbytes);
m_total_in += numbytes;
}
-
+
// advance the read pointer
m_read_done_offset += numbytes;
}
@@ -2730,7 +2730,7 @@ void chd_file_compressor::hashmap::reset()
delete block;
}
m_block_list->m_nextalloc = 0;
-
+
// reset the hash
memset(m_map, 0, sizeof(m_map));
}
diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h
index 743d3774b93..4eb54371e09 100644
--- a/src/lib/util/chd.h
+++ b/src/lib/util/chd.h
@@ -55,7 +55,7 @@
Compressed Hunks of Data header format. All numbers are stored in
Motorola (big-endian) byte ordering.
-
+
=========================================================================
V1 header:
@@ -78,15 +78,15 @@
0x00000001 - set if this drive has a parent
0x00000002 - set if this drive allows writes
- Compression types:
- CHDCOMPRESSION_NONE = 0
- CHDCOMPRESSION_ZLIB = 1
-
+ Compression types:
+ CHDCOMPRESSION_NONE = 0
+ CHDCOMPRESSION_ZLIB = 1
+
V1 map format:
-
- [ 0] UINT64 offset : 44; // starting offset within the file
- [ 0] UINT64 length : 20; // length of data; if == hunksize, data is uncompressed
-
+
+ [ 0] UINT64 offset : 44; // starting offset within the file
+ [ 0] UINT64 length : 20; // length of data; if == hunksize, data is uncompressed
+
=========================================================================
V2 header:
@@ -105,9 +105,9 @@
[ 60] UINT8 parentmd5[16]; // MD5 checksum of parent file
[ 76] UINT32 seclen; // number of bytes per sector
[ 80] (V2 header length)
-
+
Flags and map format are same as V1
-
+
=========================================================================
V3 header:
@@ -126,21 +126,21 @@
[ 80] UINT8 sha1[20]; // SHA1 checksum of raw data
[100] UINT8 parentsha1[20];// SHA1 checksum of parent file
[120] (V3 header length)
-
+
Flags are the same as V1
- Compression types:
- CHDCOMPRESSION_NONE = 0
- CHDCOMPRESSION_ZLIB = 1
- CHDCOMPRESSION_ZLIB_PLUS = 2
-
+ Compression types:
+ CHDCOMPRESSION_NONE = 0
+ CHDCOMPRESSION_ZLIB = 1
+ CHDCOMPRESSION_ZLIB_PLUS = 2
+
V3 map format:
[ 0] UINT64 offset; // starting offset within the file
- [ 8] UINT32 crc32; // 32-bit CRC of the uncompressed data
- [ 12] UINT16 length_lo; // lower 16 bits of length
- [ 14] UINT8 length_hi; // upper 8 bits of length
- [ 15] UINT8 flags; // flags, indicating compression info
+ [ 8] UINT32 crc32; // 32-bit CRC of the uncompressed data
+ [ 12] UINT16 length_lo; // lower 16 bits of length
+ [ 14] UINT8 length_hi; // upper 8 bits of length
+ [ 15] UINT8 flags; // flags, indicating compression info
=========================================================================
@@ -159,21 +159,21 @@
[ 68] UINT8 parentsha1[20];// combined raw+meta SHA1 of parent
[ 88] UINT8 rawsha1[20]; // raw data SHA1
[108] (V4 header length)
-
+
Flags are the same as V1
-
- Compression types:
- CHDCOMPRESSION_NONE = 0
- CHDCOMPRESSION_ZLIB = 1
- CHDCOMPRESSION_ZLIB_PLUS = 2
- CHDCOMPRESSION_AV = 3
-
+
+ Compression types:
+ CHDCOMPRESSION_NONE = 0
+ CHDCOMPRESSION_ZLIB = 1
+ CHDCOMPRESSION_ZLIB_PLUS = 2
+ CHDCOMPRESSION_AV = 3
+
Map format is the same as V3
-
+
=========================================================================
V5 header:
-
+
[ 0] char tag[8]; // 'MComprHD'
[ 8] UINT32 length; // length of header (including tag and length fields)
[ 12] UINT32 version; // drive format version
@@ -188,30 +188,30 @@
[104] UINT8 parentsha1[20];// combined raw+meta SHA1 of parent
[124] (V5 header length)
- If parentsha1 != 0, we have a parent (no need for flags)
- If compressors[0] == 0, we are uncompressed (including maps)
-
+ If parentsha1 != 0, we have a parent (no need for flags)
+ If compressors[0] == 0, we are uncompressed (including maps)
+
V5 uncompressed map format:
-
- [ 0] UINT32 offset; // starting offset / hunk size
-
+
+ [ 0] UINT32 offset; // starting offset / hunk size
+
V5 compressed map format header:
-
- [ 0] UINT32 length; // length of compressed map
- [ 4] UINT48 datastart; // offset of first block
- [ 10] UINT16 crc; // crc-16 of the map
- [ 12] UINT8 lengthbits; // bits used to encode complength
- [ 13] UINT8 hunkbits; // bits used to encode self-refs
- [ 14] UINT8 parentunitbits; // bits used to encode parent unit refs
- [ 15] UINT8 reserved; // future use
+
+ [ 0] UINT32 length; // length of compressed map
+ [ 4] UINT48 datastart; // offset of first block
+ [ 10] UINT16 crc; // crc-16 of the map
+ [ 12] UINT8 lengthbits; // bits used to encode complength
+ [ 13] UINT8 hunkbits; // bits used to encode self-refs
+ [ 14] UINT8 parentunitbits; // bits used to encode parent unit refs
+ [ 15] UINT8 reserved; // future use
[ 16] (compressed header length)
-
+
Each compressed map entry, once expanded, looks like:
-
- [ 0] UINT8 compression; // compression type
- [ 1] UINT24 complength; // compressed length
- [ 4] UINT48 offset; // offset
- [ 10] UINT16 crc; // crc-16 of the data
+
+ [ 0] UINT8 compression; // compression type
+ [ 1] UINT24 complength; // compressed length
+ [ 4] UINT48 offset; // offset
+ [ 10] UINT16 crc; // crc-16 of the data
***************************************************************************/
@@ -222,7 +222,7 @@
// 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_PARENT = 2; // copy of a parent's hunk
const chd_codec_type CHD_CODEC_MINI = 3; // legacy "mini" 8-byte repeat
// core types
@@ -322,7 +322,7 @@ class chd_file
static const UINT32 V4_HEADER_SIZE = 108;
static const UINT32 V5_HEADER_SIZE = 124;
static const UINT32 MAX_HEADER_SIZE = V5_HEADER_SIZE;
-
+
public:
// construction/destruction
chd_file();
@@ -360,7 +360,7 @@ public:
// file open
chd_error open(const char *filename, bool writeable = false, chd_file *parent = NULL);
chd_error open(core_file &file, bool writeable = false, chd_file *parent = NULL);
-
+
// file close
void close();
@@ -382,20 +382,20 @@ public:
chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const dynamic_buffer &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input, input.count(), flags = CHD_MDFLAGS_CHECKSUM); }
chd_error delete_metadata(chd_metadata_tag metatag, UINT32 metaindex);
chd_error clone_all_metadata(chd_file &source);
-
+
// hashing helper
sha1_t compute_overall_sha1(sha1_t rawsha1);
// codec interfaces
chd_error codec_configure(chd_codec_type codec, int param, void *config);
-
+
// static helpers
static const char *error_string(chd_error err);
private:
struct metadata_entry;
struct metadata_hash;
-
+
// inline helpers
UINT64 be_read(const UINT8 *base, int numbytes);
void be_write(UINT8 *base, UINT64 value, int numbytes);
@@ -430,7 +430,7 @@ private:
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
@@ -443,14 +443,14 @@ private:
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
-
+
// map information
UINT32 m_mapentrybytes; // length of each entry in a map
dynamic_buffer m_rawmap; // raw map data
@@ -458,7 +458,7 @@ private:
// compression management
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?
@@ -474,7 +474,7 @@ public:
// construction/destruction
chd_file_compressor();
virtual ~chd_file_compressor();
-
+
// compression management
void compress_begin();
chd_error compress_continue(double &progress, double &ratio);
@@ -482,7 +482,7 @@ public:
protected:
// required override: read more data
virtual UINT32 read_data(void *dest, UINT64 offset, UINT32 length) = 0;
-
+
private:
// hash map for looking up values
class hashmap
@@ -491,12 +491,12 @@ private:
// construction/destruction
hashmap();
~hashmap();
-
+
// operations
void reset();
UINT64 find(crc16_t crc16, sha1_t sha1);
void add(UINT64 itemnum, crc16_t crc16, sha1_t sha1);
-
+
// constants
static const UINT64 NOT_FOUND = ~UINT64(0);
private:
@@ -507,13 +507,13 @@ private:
UINT64 m_itemnum; // item number
sha1_t m_sha1; // SHA-1 of the block
};
-
+
// block of entries
struct entry_block
{
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
@@ -532,7 +532,7 @@ private:
WS_QUEUED,
WS_COMPLETE
};
-
+
// a CRC-16/SHA-1 pair
struct hash_pair
{
@@ -540,7 +540,7 @@ private:
sha1_t m_sha1; // calculated SHA-1
};
- // a single work item
+ // a single work item
struct work_item
{
osd_work_item * m_osd; // OSD work item running on this block
@@ -554,7 +554,7 @@ private:
chd_compressor_group *m_codecs; // codec instance
dynamic_array<hash_pair> m_hash; // array of hashes
};
-
+
// internal helpers
static void *async_walk_parent_static(void *param, int threadid);
void async_walk_parent(work_item &item);
@@ -563,15 +563,15 @@ private:
static void *async_read_static(void *param, int threadid);
void async_read();
- // current compression status
- bool m_walking_parent; // are we building the parent map?
+ // 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
// 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
diff --git a/src/lib/util/chdcodec.c b/src/lib/util/chdcodec.c
index 19c7f14b0cf..45c1727d629 100644
--- a/src/lib/util/chdcodec.c
+++ b/src/lib/util/chdcodec.c
@@ -64,7 +64,7 @@ public:
// construction/destruction
chd_zlib_allocator();
~chd_zlib_allocator();
-
+
// installation
void install(z_stream &stream);
@@ -150,7 +150,7 @@ public:
// core functionality
virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest);
-
+
// helpers
static void configure_properties(CLzmaEncProps &props, chd_file &chd);
@@ -346,7 +346,7 @@ class chd_avhuff_compressor : public chd_compressor
public:
// construction/destruction
chd_avhuff_compressor(chd_file &chd, bool lossy);
-
+
// core functionality
virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest);
@@ -368,7 +368,7 @@ class chd_avhuff_decompressor : public chd_decompressor
public:
// construction/destruction
chd_avhuff_decompressor(chd_file &chd, bool lossy);
-
+
// core functionality
virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen);
virtual void configure(int param, void *config);
@@ -420,7 +420,7 @@ chd_codec::chd_codec(chd_file &file, bool lossy)
chd_codec::~chd_codec()
{
}
-
+
//-------------------------------------------------
// configure - configuration
@@ -597,7 +597,7 @@ INT8 chd_compressor_group::find_best_compressor(const UINT8 *src, UINT8 *compres
catch (...)
{
}
-
+
if (memcmp(src, m_decompressed, m_hunkbytes) != 0)
{
compbytes = m_compressor[codecnum]->compress(src, m_hunkbytes, m_compress_test);
@@ -621,13 +621,13 @@ printf(" codec%d=%d bytes \n", codecnum, compbytes);
}
catch (...) { }
}
-
+
// if the best is none, copy it over
if (compression == -1)
memcpy(compressed, src, m_hunkbytes);
return compression;
}
-
+
//**************************************************************************
@@ -832,7 +832,7 @@ chd_zlib_decompressor::~chd_zlib_decompressor()
//-------------------------------------------------
-// decompress - decompress data using the ZLIB
+// decompress - decompress data using the ZLIB
// codec
//-------------------------------------------------
@@ -869,7 +869,7 @@ chd_lzma_allocator::chd_lzma_allocator()
{
// reset pointer list
memset(m_allocptr, 0, sizeof(m_allocptr));
-
+
// set our pointers
Alloc = &chd_lzma_allocator::fast_alloc;
Free = &chd_lzma_allocator::fast_free;
@@ -936,7 +936,7 @@ void chd_lzma_allocator::fast_free(void *p, void *address)
{
if (address == NULL)
return;
-
+
chd_lzma_allocator *codec = reinterpret_cast<chd_lzma_allocator *>(p);
// find the hunk
@@ -994,7 +994,7 @@ UINT32 chd_lzma_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *des
SRes res = LzmaEnc_SetProps(encoder, &m_props);
if (res != SZ_OK)
throw CHDERR_COMPRESSION_ERROR;
-
+
// run it
SizeT complen = srclen;
res = LzmaEnc_MemEncode(encoder, dest, &complen, src, srclen, 0, NULL, &m_allocator, &m_allocator);
@@ -1046,14 +1046,14 @@ chd_lzma_decompressor::chd_lzma_decompressor(chd_file &chd, bool lossy)
// configure the properties like the compressor did
CLzmaEncProps encoder_props;
chd_lzma_compressor::configure_properties(encoder_props, chd);
-
+
// convert to decoder properties
CLzmaProps decoder_props;
decoder_props.lc = encoder_props.lc;
decoder_props.lp = encoder_props.lp;
decoder_props.pb = encoder_props.pb;
decoder_props.dicSize = encoder_props.dictSize;
-
+
// do memory allocations
SRes res = LzmaDec_Allocate_MAME(&m_decoder, &decoder_props, &m_allocator);
if (res != SZ_OK)
@@ -1073,7 +1073,7 @@ chd_lzma_decompressor::~chd_lzma_decompressor()
//-------------------------------------------------
-// decompress - decompress data using the LZMA
+// decompress - decompress data using the LZMA
// codec
//-------------------------------------------------
@@ -1081,7 +1081,7 @@ void chd_lzma_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *
{
// initialize
LzmaDec_Init(&m_decoder);
-
+
// decode
SizeT consumedlen = complen;
SizeT decodedlen = destlen;
@@ -1108,7 +1108,7 @@ chd_huffman_compressor::chd_huffman_compressor(chd_file &chd, bool lossy)
//-------------------------------------------------
-// compress - compress data using the Huffman
+// compress - compress data using the Huffman
// codec
//-------------------------------------------------
@@ -1137,7 +1137,7 @@ chd_huffman_decompressor::chd_huffman_decompressor(chd_file &chd, bool lossy)
//-------------------------------------------------
-// decompress - decompress data using the Huffman
+// decompress - decompress data using the Huffman
// codec
//-------------------------------------------------
@@ -1167,7 +1167,7 @@ chd_flac_compressor::chd_flac_compressor(chd_file &chd, bool lossy, bool bigendi
m_swap_endian = bigendian;
else
m_swap_endian = !bigendian;
-
+
// configure the encoder
m_encoder.set_sample_rate(44100);
m_encoder.set_num_channels(2);
@@ -1218,7 +1218,7 @@ chd_flac_decompressor::chd_flac_decompressor(chd_file &chd, bool lossy, bool big
//-------------------------------------------------
-// decompress - decompress data using the FLAC
+// decompress - decompress data using the FLAC
// codec
//-------------------------------------------------
@@ -1256,7 +1256,7 @@ chd_cd_flac_compressor::chd_cd_flac_compressor(chd_file &chd, bool lossy)
UINT16 native_endian = 0;
*reinterpret_cast<UINT8 *>(&native_endian) = 1;
m_swap_endian = (native_endian == 1);
-
+
// configure the encoder
m_encoder.set_sample_rate(44100);
m_encoder.set_num_channels(2);
@@ -1310,7 +1310,7 @@ UINT32 chd_cd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *
// finish up
UINT32 complen = m_encoder.finish();
-
+
// deflate the subcode data
m_deflater.next_in = const_cast<Bytef *>(&m_buffer[frames * CD_MAX_SECTOR_DATA]);
m_deflater.avail_in = frames * CD_MAX_SUBCODE_DATA;
@@ -1380,7 +1380,7 @@ chd_cd_flac_decompressor::~chd_cd_flac_decompressor()
//-------------------------------------------------
-// decompress - decompress data using the FLAC
+// decompress - decompress data using the FLAC
// codec
//-------------------------------------------------
@@ -1410,7 +1410,7 @@ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT
zerr = inflate(&m_inflater, Z_FINISH);
if (m_inflater.total_out != frames * CD_MAX_SUBCODE_DATA)
throw CHDERR_DECOMPRESSION_ERROR;
-
+
// reassemble the data
for (UINT32 framenum = 0; framenum < frames; framenum++)
{
@@ -1474,8 +1474,8 @@ UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *d
//-------------------------------------------------
-// postinit - actual initialization of avhuff
-// happens here, on the first attempt to compress
+// postinit - actual initialization of avhuff
+// happens here, on the first attempt to compress
// or decompress data
//-------------------------------------------------
@@ -1520,7 +1520,7 @@ chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, bool lossy)
//-------------------------------------------------
-// decompress - decompress data using the A/V
+// decompress - decompress data using the A/V
// codec
//-------------------------------------------------
@@ -1542,7 +1542,7 @@ void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8
//-------------------------------------------------
-// config - codec-specific configuration for the
+// config - codec-specific configuration for the
// A/V codec
//-------------------------------------------------
@@ -1551,7 +1551,7 @@ void chd_avhuff_decompressor::configure(int param, void *config)
// if we're getting the decompression configuration, apply it now
if (param == AVHUFF_CODEC_DECOMPRESS_CONFIG)
m_decoder.configure(*reinterpret_cast<avhuff_decompress_config *>(config));
-
+
// anything else is invalid
else
throw CHDERR_INVALID_PARAMETER;
diff --git a/src/lib/util/chdcodec.h b/src/lib/util/chdcodec.h
index 1d63c6966be..4f7c7918df5 100644
--- a/src/lib/util/chdcodec.h
+++ b/src/lib/util/chdcodec.h
@@ -75,7 +75,7 @@ class chd_codec
protected:
// can't create these directly
chd_codec(chd_file &file, bool lossy);
-
+
public:
// allow public deletion
virtual ~chd_codec();
@@ -133,7 +133,7 @@ public:
// create compressors or decompressors
static chd_compressor *new_compressor(chd_codec_type type, chd_file &file);
static chd_decompressor *new_decompressor(chd_codec_type type, chd_file &file);
-
+
// utilities
static bool codec_exists(chd_codec_type type) { return (find_in_list(type) != NULL); }
static const char *codec_name(chd_codec_type type);
@@ -151,7 +151,7 @@ private:
// internal helper functions
static const codec_entry *find_in_list(chd_codec_type type);
-
+
template<class _CompressorClass>
static chd_compressor *construct_compressor(chd_file &chd, bool lossy) { return new _CompressorClass(chd, lossy); }
@@ -172,10 +172,10 @@ public:
// construction/destruction
chd_compressor_group(chd_file &file, chd_codec_type compressor_list[4]);
~chd_compressor_group();
-
+
// find the best compressor
INT8 find_best_compressor(const UINT8 *src, UINT8 *compressed, UINT32 &complen);
-
+
private:
// internal state
UINT32 m_hunkbytes; // number of bytes in a hunk
@@ -197,10 +197,10 @@ private:
const chd_codec_type CHD_CODEC_NONE = 0;
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_BE = CHD_MAKE_TAG('f','l','c','b');
-const chd_codec_type CHD_CODEC_FLAC_LE = CHD_MAKE_TAG('f','l','c','l');
-const chd_codec_type CHD_CODEC_CD_FLAC = CHD_MAKE_TAG('c','d','f','l');
+const chd_codec_type CHD_CODEC_HUFFMAN = CHD_MAKE_TAG('h','u','f','f');
+const chd_codec_type CHD_CODEC_FLAC_BE = CHD_MAKE_TAG('f','l','c','b');
+const chd_codec_type CHD_CODEC_FLAC_LE = CHD_MAKE_TAG('f','l','c','l');
+const chd_codec_type CHD_CODEC_CD_FLAC = CHD_MAKE_TAG('c','d','f','l');
const chd_codec_type CHD_CODEC_AVHUFF = CHD_MAKE_TAG('a','v','h','u');
// A/V codec configuration parameters
diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h
index 59e012fe753..7daee5eadff 100644
--- a/src/lib/util/coretmpl.h
+++ b/src/lib/util/coretmpl.h
@@ -59,7 +59,7 @@ private:
public:
// construction/destruction
- dynamic_array(int initial = 0)
+ dynamic_array(int initial = 0)
: m_array(NULL),
m_count(0),
m_allocated(0) { if (initial != 0) expand_internal(initial); m_count = initial; }
@@ -73,7 +73,7 @@ public:
// simple getters
int count() const { return m_count; }
-
+
// helpers
void append(const _ElementType &element) { if (m_count == m_allocated) expand_internal((m_allocated == 0) ? 16 : (m_allocated << 1), true); m_array[m_count++] = element; }
void reset() { delete[] m_array; m_array = NULL; m_count = m_allocated = 0; }
diff --git a/src/lib/util/flac.c b/src/lib/util/flac.c
index 99c73a11ff5..817e39047d9 100644
--- a/src/lib/util/flac.c
+++ b/src/lib/util/flac.c
@@ -82,7 +82,7 @@ flac_encoder::~flac_encoder()
//-------------------------------------------------
-// reset - reset state with the original
+// reset - reset state with the original
// parameters
//-------------------------------------------------
@@ -96,7 +96,7 @@ bool flac_encoder::reset()
// configure the encoder in a standard way
// note we do this on each reset; if we don't, results are NOT consistent!
FLAC__stream_encoder_set_verify(m_encoder, false);
-// FLAC__stream_encoder_set_do_md5(m_encoder, false);
+// FLAC__stream_encoder_set_do_md5(m_encoder, false);
FLAC__stream_encoder_set_compression_level(m_encoder, 8);
FLAC__stream_encoder_set_channels(m_encoder, m_channels);
FLAC__stream_encoder_set_bits_per_sample(m_encoder, 16);
@@ -161,7 +161,7 @@ bool flac_encoder::encode_interleaved(const INT16 *samples, UINT32 samples_per_c
for (UINT32 sampnum = 0; sampnum < cur_samples; sampnum++)
for (int channel = 0; channel < num_channels; channel++, srcindex++)
*dest++ = INT16((UINT16(samples[srcindex]) << shift) | (UINT16(samples[srcindex]) >> shift));
-
+
// process this batch
if (!FLAC__stream_encoder_process_interleaved(m_encoder, converted_buffer, cur_samples))
return false;
@@ -194,7 +194,7 @@ bool flac_encoder::encode(INT16 *const *samples, UINT32 samples_per_channel, boo
for (UINT32 sampnum = 0; sampnum < cur_samples; sampnum++, srcindex++)
for (int channel = 0; channel < num_channels; channel++)
*dest++ = INT16((UINT16(samples[channel][srcindex]) << shift) | (UINT16(samples[channel][srcindex]) >> shift));
-
+
// process this batch
if (!FLAC__stream_encoder_process_interleaved(m_encoder, converted_buffer, cur_samples))
return false;
@@ -205,7 +205,7 @@ bool flac_encoder::encode(INT16 *const *samples, UINT32 samples_per_channel, boo
//-------------------------------------------------
-// finish - complete encoding and flush the
+// finish - complete encoding and flush the
// stream
//-------------------------------------------------
@@ -227,7 +227,7 @@ void flac_encoder::init_common()
m_encoder = FLAC__stream_encoder_new();
if (m_encoder == NULL)
throw std::bad_alloc();
-
+
// initialize default state
m_file = NULL;
m_compressed_offset = 0;
@@ -243,7 +243,7 @@ void flac_encoder::init_common()
//-------------------------------------------------
-// write_callback - handle writes to the
+// write_callback - handle writes to the
// output stream
//-------------------------------------------------
@@ -265,7 +265,7 @@ FLAC__StreamEncoderWriteStatus flac_encoder::write_callback(const FLAC__byte buf
offset += ignore;
m_ignore_bytes -= ignore;
}
-
+
// if we haven't hit the end of metadata, process a new piece
else if (!m_found_audio)
{
@@ -275,7 +275,7 @@ FLAC__StreamEncoderWriteStatus flac_encoder::write_callback(const FLAC__byte buf
offset += 4;
}
- // otherwise process as audio data and copy to the output
+ // otherwise process as audio data and copy to the output
else
{
int count = bytes - offset;
@@ -360,21 +360,21 @@ flac_decoder::~flac_decoder()
//-------------------------------------------------
-// reset - reset state with the original
+// reset - reset state with the original
// parameters
//-------------------------------------------------
bool flac_decoder::reset()
{
m_compressed_offset = 0;
- if (FLAC__stream_decoder_init_stream(m_decoder,
- &flac_decoder::read_callback_static,
- NULL,
- &flac_decoder::tell_callback_static,
- NULL,
- NULL,
- &flac_decoder::write_callback_static,
- &flac_decoder::metadata_callback_static,
+ if (FLAC__stream_decoder_init_stream(m_decoder,
+ &flac_decoder::read_callback_static,
+ NULL,
+ &flac_decoder::tell_callback_static,
+ NULL,
+ NULL,
+ &flac_decoder::write_callback_static,
+ &flac_decoder::metadata_callback_static,
&flac_decoder::error_callback_static, this) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
return false;
return FLAC__stream_decoder_process_until_end_of_metadata(m_decoder);
@@ -407,15 +407,15 @@ bool flac_decoder::reset(UINT32 sample_rate, UINT8 num_channels, UINT32 block_si
static const UINT8 s_header_template[0x2a] =
{
0x66, 0x4C, 0x61, 0x43, // +00: 'fLaC' stream header
- 0x80, // +04: metadata block type 0 (STREAMINFO),
+ 0x80, // +04: metadata block type 0 (STREAMINFO),
// flagged as last block
- 0x00, 0x00, 0x22, // +05: metadata block length = 0x22
+ 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),
+ 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 //
@@ -466,7 +466,7 @@ bool flac_decoder::decode_interleaved(INT16 *samples, UINT32 num_samples, bool s
m_uncompressed_offset = 0;
m_uncompressed_length = num_samples;
m_uncompressed_swap = swap_endian;
-
+
// loop until we get everything we want
while (m_uncompressed_offset < m_uncompressed_length)
if (!FLAC__stream_decoder_process_single(m_decoder))
@@ -494,7 +494,7 @@ bool flac_decoder::decode(INT16 **samples, UINT32 num_samples, bool swap_endian)
m_uncompressed_offset = 0;
m_uncompressed_length = num_samples;
m_uncompressed_swap = swap_endian;
-
+
// loop until we get everything we want
while (m_uncompressed_offset < m_uncompressed_length)
if (!FLAC__stream_decoder_process_single(m_decoder))
@@ -513,7 +513,7 @@ UINT32 flac_decoder::finish()
FLAC__uint64 position = 0;
FLAC__stream_decoder_get_decode_position(m_decoder, &position);
FLAC__stream_decoder_finish(m_decoder);
-
+
// adjust position if we provided the header
if (position == 0)
return 0;
@@ -536,11 +536,11 @@ FLAC__StreamDecoderReadStatus flac_decoder::read_callback_static(const FLAC__Str
FLAC__StreamDecoderReadStatus flac_decoder::read_callback(FLAC__byte buffer[], size_t *bytes)
{
UINT32 expected = *bytes;
-
+
// if a file, just read
if (m_file != NULL)
*bytes = core_fread(m_file, buffer, expected);
-
+
// otherwise, copy from memory
else
{
@@ -553,7 +553,7 @@ FLAC__StreamDecoderReadStatus flac_decoder::read_callback(FLAC__byte buffer[], s
outputpos += bytes_to_copy;
m_compressed_offset += bytes_to_copy;
}
-
+
// once we're out of that, copy from the secondary buffer
if (outputpos < *bytes && m_compressed_offset < m_compressed_length + m_compressed2_length)
{
@@ -579,7 +579,7 @@ void flac_decoder::metadata_callback_static(const FLAC__StreamDecoder *decoder,
// ignore all but STREAMINFO metadata
if (metadata->type != FLAC__METADATA_TYPE_STREAMINFO)
return;
-
+
// parse out the data we care about
flac_decoder *fldecoder = reinterpret_cast<flac_decoder *>(client_data);
fldecoder->m_sample_rate = metadata->data.stream_info.sample_rate;
@@ -613,7 +613,7 @@ FLAC__StreamDecoderWriteStatus flac_decoder::write_callback_static(const FLAC__S
FLAC__StreamDecoderWriteStatus flac_decoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[])
{
assert(frame->header.channels == channels());
-
+
// interleaved case
int shift = m_uncompressed_swap ? 8 : 0;
int blocksize = frame->header.blocksize;
@@ -624,7 +624,7 @@ FLAC__StreamDecoderWriteStatus flac_decoder::write_callback(const ::FLAC__Frame
for (int chan = 0; chan < frame->header.channels; chan++)
*dest++ = INT16((UINT16(buffer[chan][sampnum]) << shift) | (UINT16(buffer[chan][sampnum]) >> shift));
}
-
+
// non-interleaved case
else
{
diff --git a/src/lib/util/flac.h b/src/lib/util/flac.h
index add4e506525..911b7269424 100644
--- a/src/lib/util/flac.h
+++ b/src/lib/util/flac.h
@@ -67,16 +67,16 @@ public:
void set_num_channels(UINT8 num_channels) { m_channels = num_channels; }
void set_block_size(UINT32 block_size) { m_block_size = block_size; }
void set_strip_metadata(bool strip) { m_strip_metadata = strip; }
-
+
// getters (valid after reset)
FLAC__StreamEncoderState state() const { return FLAC__stream_encoder_get_state(m_encoder); }
const char *state_string() const { return FLAC__stream_encoder_get_resolved_state_string(m_encoder); }
-
+
// reset
bool reset();
bool reset(void *buffer, UINT32 buflength);
bool reset(core_file &file);
-
+
// encode a buffer
bool encode_interleaved(const INT16 *samples, UINT32 samples_per_channel, bool swap_endian = false);
bool encode(INT16 *const *samples, UINT32 samples_per_channel, bool swap_endian = false);
@@ -96,14 +96,14 @@ private:
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
// header stripping
- bool m_strip_metadata; // strip the the metadata?
+ 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?
};
@@ -119,7 +119,7 @@ public:
flac_decoder(const void *buffer, UINT32 length, const void *buffer2 = NULL, UINT32 length2 = 0);
flac_decoder(core_file &file);
~flac_decoder();
-
+
// getters (valid after reset)
UINT32 sample_rate() const { return m_sample_rate; }
UINT8 channels() const { return m_channels; }
@@ -127,13 +127,13 @@ public:
UINT32 total_samples() const { return FLAC__stream_decoder_get_total_samples(m_decoder); }
FLAC__StreamDecoderState state() const { return FLAC__stream_decoder_get_state(m_decoder); }
const char *state_string() const { return FLAC__stream_decoder_get_resolved_state_string(m_decoder); }
-
+
// reset
bool reset();
bool reset(const void *buffer, UINT32 length, const void *buffer2 = NULL, UINT32 length2 = 0);
bool reset(UINT32 sample_rate, UINT8 num_channels, UINT32 block_size, const void *buffer, UINT32 length);
bool reset(core_file &file);
-
+
// decode to a buffer; num_samples must be a multiple of the block size
bool decode_interleaved(INT16 *samples, UINT32 num_samples, bool swap_endian = false);
bool decode(INT16 **samples, UINT32 num_samples, bool swap_endian = false);
diff --git a/src/lib/util/hashing.c b/src/lib/util/hashing.c
index 3935438bfcb..a1e3112adc6 100644
--- a/src/lib/util/hashing.c
+++ b/src/lib/util/hashing.c
@@ -1,39 +1,39 @@
/***************************************************************************
- hashing.c
+ hashing.c
- Hashing helper classes.
+ Hashing helper classes.
****************************************************************************
- Copyright Aaron Giles
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name 'MAME' nor the names of its contributors may be
- used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ Copyright Aaron Giles
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name 'MAME' nor the names of its contributors may be
+ used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
@@ -57,7 +57,7 @@ const sha1_t sha1_t::null = { { 0 } };
//**************************************************************************
//-------------------------------------------------
-// char_to_hex - return the hex value of a
+// char_to_hex - return the hex value of a
// character
//-------------------------------------------------
@@ -89,7 +89,7 @@ bool sha1_t::from_string(const char *string, int length)
length = strlen(string);
if (length < 2 * sizeof(m_raw))
return false;
-
+
// iterate through our raw buffer
for (int bytenum = 0; bytenum < sizeof(m_raw); bytenum++)
{
@@ -111,7 +111,7 @@ const char *sha1_t::as_string(astring &buffer) const
{
buffer.reset();
for (int i = 0; i < ARRAY_LENGTH(m_raw); i++)
- buffer.catformat("%02x", m_raw[i]);
+ buffer.catformat("%02x", m_raw[i]);
return buffer;
}
@@ -131,7 +131,7 @@ bool md5_t::from_string(const char *string, int length)
length = strlen(string);
if (length < 2 * sizeof(m_raw))
return false;
-
+
// iterate through our raw buffer
for (int bytenum = 0; bytenum < sizeof(m_raw); bytenum++)
{
@@ -153,7 +153,7 @@ const char *md5_t::as_string(astring &buffer) const
{
buffer.reset();
for (int i = 0; i < ARRAY_LENGTH(m_raw); i++)
- buffer.catformat("%02x", m_raw[i]);
+ buffer.catformat("%02x", m_raw[i]);
return buffer;
}
@@ -174,7 +174,7 @@ bool crc32_t::from_string(const char *string, int length)
length = strlen(string);
if (length < 2 * sizeof(m_raw))
return false;
-
+
// iterate through our raw buffer
m_raw = 0;
for (int bytenum = 0; bytenum < sizeof(m_raw) * 2; bytenum++)
@@ -199,7 +199,7 @@ const char *crc32_t::as_string(astring &buffer) const
//-------------------------------------------------
-// append - hash a block of data, appending to
+// append - hash a block of data, appending to
// the currently-accumulated value
//-------------------------------------------------
@@ -225,7 +225,7 @@ bool crc16_t::from_string(const char *string, int length)
length = strlen(string);
if (length < 2 * sizeof(m_raw))
return false;
-
+
// iterate through our raw buffer
m_raw = 0;
for (int bytenum = 0; bytenum < sizeof(m_raw) * 2; bytenum++)
@@ -250,13 +250,13 @@ const char *crc16_t::as_string(astring &buffer) const
//-------------------------------------------------
-// append - hash a block of data, appending to
+// append - hash a block of data, appending to
// the currently-accumulated value
//-------------------------------------------------
void crc16_creator::append(const void *data, UINT32 length)
{
- static const UINT16 s_table[256] =
+ static const UINT16 s_table[256] =
{
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
@@ -293,7 +293,7 @@ void crc16_creator::append(const void *data, UINT32 length)
};
const UINT8 *src = reinterpret_cast<const UINT8 *>(data);
-
+
// fetch the current value into a local and rip through the source data
UINT16 crc = m_accum.m_raw;
while (length-- != 0)
diff --git a/src/lib/util/hashing.h b/src/lib/util/hashing.h
index b3976a46415..cebaba95b18 100644
--- a/src/lib/util/hashing.h
+++ b/src/lib/util/hashing.h
@@ -1,39 +1,39 @@
/***************************************************************************
- hashing.h
+ hashing.h
- Hashing helper classes.
+ Hashing helper classes.
****************************************************************************
- Copyright Aaron Giles
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name 'MAME' nor the names of its contributors may be
- used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ Copyright Aaron Giles
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name 'MAME' nor the names of its contributors may be
+ used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
@@ -73,13 +73,13 @@ class sha1_creator
public:
// construction/destruction
sha1_creator() { reset(); }
-
+
// reset
void reset() { sha1_init(&m_context); }
-
+
// append data
void append(const void *data, UINT32 length) { sha1_update(&m_context, length, reinterpret_cast<const UINT8 *>(data)); }
-
+
// finalize and compute the final digest
sha1_t finish()
{
@@ -92,8 +92,8 @@ public:
// static wrapper to just get the digest from a block
static sha1_t simple(const void *data, UINT32 length)
{
- sha1_creator creator;
- creator.append(data, length);
+ sha1_creator creator;
+ creator.append(data, length);
return creator.finish();
}
@@ -124,13 +124,13 @@ class md5_creator
public:
// construction/destruction
md5_creator() { reset(); }
-
+
// reset
void reset() { MD5Init(&m_context); }
-
+
// append data
void append(const void *data, UINT32 length) { MD5Update(&m_context, reinterpret_cast<const unsigned char *>(data), length); }
-
+
// finalize and compute the final digest
md5_t finish()
{
@@ -142,14 +142,14 @@ public:
// static wrapper to just get the digest from a block
static md5_t simple(const void *data, UINT32 length)
{
- md5_creator creator;
- creator.append(data, length);
+ md5_creator creator;
+ creator.append(data, length);
return creator.finish();
}
protected:
// internal state
- struct MD5Context m_context; // internal context
+ struct MD5Context m_context; // internal context
};
@@ -175,21 +175,21 @@ class crc32_creator
public:
// construction/destruction
crc32_creator() { reset(); }
-
+
// reset
void reset() { m_accum.m_raw = 0; }
-
+
// append data
void append(const void *data, UINT32 length);
-
+
// finalize and compute the final digest
crc32_t finish() { return m_accum; }
// static wrapper to just get the digest from a block
static crc32_t simple(const void *data, UINT32 length)
{
- crc32_creator creator;
- creator.append(data, length);
+ crc32_creator creator;
+ creator.append(data, length);
return creator.finish();
}
@@ -221,21 +221,21 @@ class crc16_creator
public:
// construction/destruction
crc16_creator() { reset(); }
-
+
// reset
void reset() { m_accum.m_raw = 0xffff; }
-
+
// append data
void append(const void *data, UINT32 length);
-
+
// finalize and compute the final digest
crc16_t finish() { return m_accum; }
// static wrapper to just get the digest from a block
static crc16_t simple(const void *data, UINT32 length)
{
- crc16_creator creator;
- creator.append(data, length);
+ crc16_creator creator;
+ creator.append(data, length);
return creator.finish();
}
diff --git a/src/lib/util/huffman.c b/src/lib/util/huffman.c
index b672a7a0d89..21ef7adc029 100644
--- a/src/lib/util/huffman.c
+++ b/src/lib/util/huffman.c
@@ -165,7 +165,7 @@ huffman_context_base::huffman_context_base(int numcodes, int maxbits, lookup_val
//-------------------------------------------------
-// import_tree_rle - import an RLE-encoded
+// import_tree_rle - import an RLE-encoded
// huffman tree from a source data stream
//-------------------------------------------------
@@ -215,7 +215,7 @@ huffman_error huffman_context_base::import_tree_rle(bitstream_in &bitbuf)
huffman_error error = assign_canonical_codes();
if (error != HUFFERR_NONE)
return error;
-
+
// build the lookup table
build_lookup_table();
@@ -267,7 +267,7 @@ huffman_error huffman_context_base::export_tree_rle(bitstream_out &bitbuf)
//-------------------------------------------------
-// import_tree_huffman - import a huffman-encoded
+// import_tree_huffman - import a huffman-encoded
// huffman tree from a source data stream
//-------------------------------------------------
@@ -288,13 +288,13 @@ huffman_error huffman_context_base::import_tree_huffman(bitstream_in &bitbuf)
smallhuff.m_huffnode[index].m_numbits = (count == 7) ? 0 : count;
}
}
-
+
// then regenerate the tree
huffman_error error = smallhuff.assign_canonical_codes();
if (error != HUFFERR_NONE)
return error;
smallhuff.build_lookup_table();
-
+
// determine the maximum length of an RLE count
UINT32 temp = m_numcodes - 9;
UINT8 rlefullbits = 0;
@@ -337,7 +337,7 @@ huffman_error huffman_context_base::import_tree_huffman(bitstream_in &bitbuf)
//-------------------------------------------------
-// export_tree_huffman - export a huffman tree to
+// export_tree_huffman - export a huffman tree to
// a huffman target data stream
//-------------------------------------------------
@@ -350,7 +350,7 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
UINT16 *lengths = rle_lengths;
int last = ~0;
int repcount = 0;
-
+
// use a small huffman context to create a tree (ignoring RLE lengths)
huffman_encoder<24, 6> smallhuff;
@@ -363,14 +363,14 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
{
if (repcount == 1)
smallhuff.histo_one(*dest++ = last + 1);
- else
+ else
smallhuff.histo_one(*dest++ = 0), *lengths++ = repcount - 2;
}
-
+
// if same as last, just track repeats
if (newval == last)
repcount++;
-
+
// otherwise, write it and start a new run
else
{
@@ -385,7 +385,7 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
{
if (repcount == 1)
smallhuff.histo_one(*dest++ = last + 1);
- else
+ else
smallhuff.histo_one(*dest++ = 0), *lengths++ = repcount - 2;
}
@@ -413,7 +413,7 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
for (int index = first_non_zero; index <= last_non_zero; index++)
bitbuf.write(smallhuff.m_huffnode[index].m_numbits, 3);
bitbuf.write(7, 3);
-
+
// determine the maximum length of an RLE count
UINT32 temp = m_numcodes - 9;
UINT8 rlefullbits = 0;
@@ -427,7 +427,7 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
// encode the data
UINT8 data = *src;
smallhuff.encode_one(bitbuf, data);
-
+
// if this is an RLE token, encode the length following
if (data == 0)
{
@@ -438,7 +438,7 @@ huffman_error huffman_context_base::export_tree_huffman(bitstream_out &bitbuf)
bitbuf.write(7, 3), bitbuf.write(count - 7, rlefullbits);
}
}
-
+
// flush the final buffer
return bitbuf.overflow() ? HUFFERR_OUTPUT_BUFFER_TOO_SMALL : HUFFERR_NONE;
}
@@ -540,7 +540,7 @@ int CLIB_DECL huffman_context_base::tree_node_compare(const void *item1, const v
//-------------------------------------------------
-// build_tree - build a huffman tree based on the
+// build_tree - build a huffman tree based on the
// data distribution
//-------------------------------------------------
@@ -616,8 +616,8 @@ int huffman_context_base::build_tree(UINT32 totaldata, UINT32 totalweight)
//-------------------------------------------------
-// assign_canonical_codes - assign canonical codes
-// to all the nodes based on the number of bits
+// assign_canonical_codes - assign canonical codes
+// to all the nodes based on the number of bits
// in each
//-------------------------------------------------
@@ -696,7 +696,7 @@ void huffman_context_base::build_lookup_table()
huffman_8bit_encoder::huffman_8bit_encoder()
{
}
-
+
//-------------------------------------------------
// encode - encode a full buffer
@@ -713,13 +713,13 @@ huffman_error huffman_8bit_encoder::encode(const UINT8 *source, UINT32 slength,
huffman_error err = compute_tree_from_histo();
if (err != HUFFERR_NONE)
return err;
-
+
// export the tree
bitstream_out bitbuf(dest, dlength);
err = export_tree_huffman(bitbuf);
if (err != HUFFERR_NONE)
return err;
-
+
// then encode the data
for (UINT32 cur = 0; cur < slength; cur++)
encode_one(bitbuf, source[cur]);
@@ -727,7 +727,7 @@ huffman_error huffman_8bit_encoder::encode(const UINT8 *source, UINT32 slength,
return bitbuf.overflow() ? HUFFERR_OUTPUT_BUFFER_TOO_SMALL : HUFFERR_NONE;
}
-
+
//**************************************************************************
// 8-BIT DECODER
@@ -740,7 +740,7 @@ huffman_error huffman_8bit_encoder::encode(const UINT8 *source, UINT32 slength,
huffman_8bit_decoder::huffman_8bit_decoder()
{
}
-
+
//-------------------------------------------------
// decode - decode a full buffer
@@ -753,7 +753,7 @@ huffman_error huffman_8bit_decoder::decode(const UINT8 *source, UINT32 slength,
huffman_error err = import_tree_huffman(bitbuf);
if (err != HUFFERR_NONE)
return err;
-
+
// then decode the data
for (UINT32 cur = 0; cur < dlength; cur++)
dest[cur] = decode_one(bitbuf);
diff --git a/src/lib/util/huffman.h b/src/lib/util/huffman.h
index 10dc301e7df..47525d82ed6 100644
--- a/src/lib/util/huffman.h
+++ b/src/lib/util/huffman.h
@@ -84,7 +84,7 @@ protected:
UINT32 m_bits; // bits used to encode the node
UINT8 m_numbits; // number of bits needed for this node
};
-
+
// construction/destruction
huffman_context_base(int numcodes, int maxbits, lookup_value *lookup, UINT32 *histo, node_t *nodes);
@@ -133,12 +133,12 @@ public:
void histo_reset() { memset(m_datahisto_array, 0, sizeof(m_datahisto_array)); }
void histo_one(UINT32 data);
void encode_one(bitstream_out &bitbuf, UINT32 data);
-
+
// expose tree computation and export
using huffman_context_base::compute_tree_from_histo;
using huffman_context_base::export_tree_rle;
using huffman_context_base::export_tree_huffman;
-
+
private:
// array versions of the info we need
UINT32 m_datahisto_array[_NumCodes];
@@ -159,11 +159,11 @@ public:
// single item operations
UINT32 decode_one(bitstream_in &bitbuf);
-
+
// expose tree import
using huffman_context_base::import_tree_rle;
using huffman_context_base::import_tree_huffman;
-
+
private:
// array versions of the info we need
node_t m_huffnode_array[_NumCodes];
@@ -179,12 +179,12 @@ class huffman_8bit_encoder : public huffman_encoder<>
public:
// construction/destruction
huffman_8bit_encoder();
-
+
// operations
huffman_error encode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 destlength, UINT32 &complength);
};
-
+
// ======================> huffman_8bit_decoder
// generic 8-bit encoder/decoder
@@ -193,7 +193,7 @@ class huffman_8bit_decoder : public huffman_decoder<>
public:
// construction/destruction
huffman_8bit_decoder();
-
+
// operations
huffman_error decode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 destlength);
};
diff --git a/src/lib/util/un7z.c b/src/lib/util/un7z.c
index 5bd8a605630..c0724687836 100644
--- a/src/lib/util/un7z.c
+++ b/src/lib/util/un7z.c
@@ -91,7 +91,7 @@ WRes File_Close(CSzFile *p)
WRes File_Read(CSzFile *p, void *data, size_t *size)
{
-// file_error err;
+// file_error err;
UINT32 read_length;
if (!p->_7z_osdfile)
@@ -104,7 +104,7 @@ WRes File_Read(CSzFile *p, void *data, size_t *size)
if (originalSize == 0)
return 0;
-// err =
+// err =
osd_read( p->_7z_osdfile, data, p->_7z_currfpos, originalSize, &read_length );
*size = read_length;
p->_7z_currfpos += read_length;
@@ -127,7 +127,7 @@ WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
if (origin==2) p->_7z_currfpos = p->_7z_length - *pos;
*pos = p->_7z_currfpos;
-
+
return 0;
}
@@ -263,11 +263,11 @@ int _7z_search_crc_match(_7z_file *new_7z, UINT32 search_crc, const char* search
if ((zn>=0x41) && (zn<=0x5a)) zn+=0x20;
if (sn != zn) break;
- }
+ }
if (j==search_filename_length) namematch = true;
}
-
+
/* Check for a CRC match */
if (crc==search_crc) crcmatch = true;
@@ -289,9 +289,9 @@ int _7z_search_crc_match(_7z_file *new_7z, UINT32 search_crc, const char* search
found = true;
}
- if (found)
+ if (found)
{
- // printf("found %S %d %08x %08x %08x %s %d\n", temp, len, crc, search_crc, size, search_filename, search_filename_length);
+ // printf("found %S %d %08x %08x %08x %s %d\n", temp, len, crc, search_crc, size, search_filename, search_filename_length);
new_7z->curr_file_idx = i;
new_7z->uncompressed_length = size;
new_7z->crc = crc;
@@ -364,7 +364,7 @@ _7z_error _7z_file_open(const char *filename, _7z_file **_7z)
FileInStream_CreateVTable(&new_7z->archiveStream);
LookToRead_CreateVTable(&new_7z->lookStream, False);
-
+
new_7z->lookStream.realStream = &new_7z->archiveStream.s;
LookToRead_Init(&new_7z->lookStream);
@@ -478,7 +478,7 @@ _7z_error _7z_file_decompress(_7z_file *new_7z, void *buffer, UINT32 length)
&new_7z->blockIndex, &new_7z->outBuffer, &new_7z->outBufferSize,
&offset, &outSizeProcessed,
&new_7z->allocImp, &new_7z->allocTempImp);
-
+
if (res != SZ_OK)
return _7ZERR_FILE_ERROR;
@@ -510,7 +510,7 @@ static void free__7z_file(_7z_file *_7z)
if (_7z->outBuffer) IAlloc_Free(&_7z->allocImp, _7z->outBuffer);
if (_7z->inited) SzArEx_Free(&_7z->db, &_7z->allocImp);
-
+
free(_7z);
}
diff --git a/src/mame/drivers/chihiro.c b/src/mame/drivers/chihiro.c
index 99b2364f3d3..7615a47b371 100644
--- a/src/mame/drivers/chihiro.c
+++ b/src/mame/drivers/chihiro.c
@@ -829,7 +829,7 @@ class ide_baseboard_device : public ide_hdd_device
public:
// construction/destruction
ide_baseboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
+
virtual int read_sector(UINT32 lba, void *buffer);
virtual int write_sector(UINT32 lba, const void *buffer);
virtual bool is_ready() { return true; }
diff --git a/src/mame/drivers/coolridr.c b/src/mame/drivers/coolridr.c
index a73b462b135..3f30caf7c61 100644
--- a/src/mame/drivers/coolridr.c
+++ b/src/mame/drivers/coolridr.c
@@ -430,7 +430,7 @@ static WRITE32_HANDLER( sysh1_txt_blit_w )
case 0x04:
{
state->m_blitterMode = (data & 0x00ff0000) >> 16;
-
+
if (state->m_blitterMode == 0xf4)
{
// Some sort of addressing state.
@@ -456,7 +456,7 @@ static WRITE32_HANDLER( sysh1_txt_blit_w )
}
break;
}
-
+
// The data register
case 0x05:
{
@@ -470,9 +470,9 @@ static WRITE32_HANDLER( sysh1_txt_blit_w )
// DEBUG: Uncomment to see the ASCII strings as they are being blitted
//if (state->m_blitterSerialCount >= state->m_textBytesToWrite)
//{
- // for (int i = 0; i < state->m_textBytesToWrite+1; i++)
- // printf("%c", space->read_byte(0x03f40000 + state->m_textOffset + i));
- // printf("\n");
+ // for (int i = 0; i < state->m_textBytesToWrite+1; i++)
+ // printf("%c", space->read_byte(0x03f40000 + state->m_textOffset + i));
+ // printf("\n");
//}
}
else if (state->m_blitterMode == 0x30 || state->m_blitterMode == 0x90)
@@ -511,8 +511,8 @@ static WRITE32_HANDLER( sysh1_txt_blit_w )
}
else if (state->m_blitterSerialCount == 11)
{
- const UINT32 memOffset = data;
-
+ const UINT32 memOffset = data;
+
// Splat some sprites
for (int h = 0; h < state->m_hCellCount; h++)
{
@@ -520,11 +520,11 @@ static WRITE32_HANDLER( sysh1_txt_blit_w )
{
const int pixelOffsetX = state->m_hPosition + (h*16);
const int pixelOffsetY = state->m_vPosition + (v*16);
-
+
// It's unknown if it's row-major or column-major
// TODO: Study the CRT test and "Cool Riders" logo for clues.
UINT8 spriteNumber = space->read_byte(memOffset + h + (v*h));
-
+
// DEBUG: For demo purposes, skip spaces and NULL characters
if (spriteNumber == 0x20 || spriteNumber == 0x00)
continue;
@@ -541,7 +541,7 @@ static WRITE32_HANDLER( sysh1_txt_blit_w )
color = 0xff00ff00;
else if (state->m_colorNumber == 0x5e)
color = 0xff0000ff;
- else
+ else
color = 0xff00ffff;
state->m_temp_bitmap_sprites.pix32(pixelOffsetY+y, pixelOffsetX+x) = color;
}
@@ -549,7 +549,7 @@ static WRITE32_HANDLER( sysh1_txt_blit_w )
}
}
}
-
+
state->m_blitterSerialCount++;
}
break;
diff --git a/src/mame/drivers/kungfur.c b/src/mame/drivers/kungfur.c
index c3f346dfffc..99342900464 100644
--- a/src/mame/drivers/kungfur.c
+++ b/src/mame/drivers/kungfur.c
@@ -150,7 +150,7 @@ static WRITE8_DEVICE_HANDLER( kungfur_latch3_w )
static WRITE8_DEVICE_HANDLER( kungfur_control_w )
{
kungfur_state *state = device->machine().driver_data<kungfur_state>();
-
+
// d0-d3: N/C
// d4: irq ack
if (~data & 0x10)
@@ -193,7 +193,7 @@ static void kfr_adpcm1_int(device_t *device)
kungfur_state *state = device->machine().driver_data<kungfur_state>();
UINT8 *ROM = device->machine().region("adpcm1")->base();
UINT8 data = ROM[state->m_adpcm_pos[0] & 0x1ffff];
-
+
msm5205_data_w(device, state->m_adpcm_sel[0] ? data & 0xf : data >> 4 & 0xf);
state->m_adpcm_pos[0] += state->m_adpcm_sel[0];
state->m_adpcm_sel[0] ^= 1;
@@ -204,7 +204,7 @@ static void kfr_adpcm2_int(device_t *device)
kungfur_state *state = device->machine().driver_data<kungfur_state>();
UINT8 *ROM = device->machine().region("adpcm2")->base();
UINT8 data = ROM[state->m_adpcm_pos[1] & 0x3ffff];
-
+
msm5205_data_w(device, state->m_adpcm_sel[1] ? data & 0xf : data >> 4 & 0xf);
state->m_adpcm_pos[1] += state->m_adpcm_sel[1];
state->m_adpcm_sel[1] ^= 1;
@@ -244,10 +244,10 @@ static INPUT_PORTS_START( kungfur )
PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_2C ) )
-// PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) // dupe
+// PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) // dupe
PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) )
-// PORT_DIPSETTING( 0x00, DEF_STR( 1C_3C ) ) // dupe
-// PORT_DIPSETTING( 0x04, DEF_STR( 0C_0C ) ) // invalid
+// PORT_DIPSETTING( 0x00, DEF_STR( 1C_3C ) ) // dupe
+// PORT_DIPSETTING( 0x04, DEF_STR( 0C_0C ) ) // invalid
PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
diff --git a/src/mame/drivers/namcos21.c b/src/mame/drivers/namcos21.c
index b9d65494229..3bd12da65a1 100644
--- a/src/mame/drivers/namcos21.c
+++ b/src/mame/drivers/namcos21.c
@@ -2152,7 +2152,7 @@ ROM_START( winrun )
ROM_LOAD("wrvoi-0.11b", 0x040000, 0x40000, CRC(8040b645) SHA1(7ccafb3073fa79910e26cf9b8b6e8e9ae22e55fc) )
ROM_LOAD("wrvoi-1.11c", 0x0c0000, 0x40000, CRC(d347e904) SHA1(620cd07e6230322c306283e45a43fa1e217028d4) )
ROM_LOAD("wrvoi-2.11d", 0x140000, 0x40000, CRC(b34747af) SHA1(7e0b55631bffa0583bf4f7f5368db9f09e411ba1) )
- ROM_LOAD("wrvoi-3.11e", 0x1c0000, 0x40000, CRC(43085303) SHA1(9f743055c20df3548879118194244e37a0b91f7e) )
+ ROM_LOAD("wrvoi-3.11e", 0x1c0000, 0x40000, CRC(43085303) SHA1(9f743055c20df3548879118194244e37a0b91f7e) )
ROM_REGION( 0x1000, "pals", 0 )
/* Main PCB (2252960101) */
@@ -2541,4 +2541,4 @@ GAME( 1991, starblad, 0, poly_c140_typeA, s21default, starblad, ROT0,
GAME( 1992, aircomb, 0, poly_c140_typeB, aircombt, aircombt, ROT0, "Namco", "Air Combat (US)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
GAME( 1992, aircombj, aircomb, poly_c140_typeB, aircombt, aircombt, ROT0, "Namco", "Air Combat (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
GAME( 1993, cybsled, 0, poly_c140_typeA, cybsled, cybsled, ROT0, "Namco", "Cyber Sled (US)", GAME_IMPERFECT_GRAPHICS )
-GAME( 1993, cybsledj, cybsled, poly_c140_typeA, cybsled, cybsled, ROT0, "Namco", "Cyber Sled (Japan)", GAME_IMPERFECT_GRAPHICS ) \ No newline at end of file
+GAME( 1993, cybsledj, cybsled, poly_c140_typeA, cybsled, cybsled, ROT0, "Namco", "Cyber Sled (Japan)", GAME_IMPERFECT_GRAPHICS )
diff --git a/src/mame/drivers/namcos23.c b/src/mame/drivers/namcos23.c
index 05727c22fa1..cc499fd0721 100644
--- a/src/mame/drivers/namcos23.c
+++ b/src/mame/drivers/namcos23.c
@@ -967,8 +967,8 @@ Notes:
J104 - 6 pin connector joined with a cable to J6 on the V198 EMI PCB. This cable is the I/O connection to/from the main board.
J105 - 110VAC power input
J106 - DC variable power output to feed-back motor
-
-
+
+
Namco Gorgon-based games
------------------------
diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c
index 254b558f4f3..fb57a5d5736 100644
--- a/src/mame/drivers/naomi.c
+++ b/src/mame/drivers/naomi.c
@@ -6861,7 +6861,7 @@ ROM_START( initdv3e )
ROM_REGION( 0x4300, "pic", ROMREGION_ERASEFF)
//PIC16C622A (317-0384-COM)
- ROM_LOAD( "317-0384-com.pic", 0x000000, 0x004300, CRC(081ccd51) SHA1(598b3bd9e8b16f5954d15738c1ca55703609b690) )
+ ROM_LOAD( "317-0384-com.pic", 0x000000, 0x004300, CRC(081ccd51) SHA1(598b3bd9e8b16f5954d15738c1ca55703609b690) )
ROM_END
/*
@@ -7062,29 +7062,29 @@ ROM_START( soulsurf )
ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF)
// Cart has a Sega factory EPROM sticker stating "EPR-23838C" and a Sega factory sticker stating "Rev. A". Seriously.
- ROM_LOAD( "epr-23838c.ic22", 0x000000, 0x400000, CRC(5e5fb00f) SHA1(c5e81ebead9072cc08f09d1715d609cb0f7631ba) )
+ ROM_LOAD( "epr-23838c.ic22", 0x000000, 0x400000, CRC(5e5fb00f) SHA1(c5e81ebead9072cc08f09d1715d609cb0f7631ba) )
ROM_RELOAD( 0x400000, 0x400000)
- ROM_LOAD( "ssf01.ic1s", 0x0800000, 0x800000, CRC(4f12f789) SHA1(7b79b687fc61e2e981b9e5e8e0939c4ad24a98f0) )
- ROM_LOAD( "ssf02.ic2s", 0x1000000, 0x800000, CRC(a255d41a) SHA1(3e932527eb68edf3e8538c1ad264a1c599f6a9d5) )
- ROM_LOAD( "ssf03.ic3s", 0x1800000, 0x800000, CRC(0f8d6577) SHA1(afaf440e667bacc941c0a5418a0e3b0f2bb725b7) )
- ROM_LOAD( "ssf04.ic4s", 0x2000000, 0x800000, CRC(bdf25bd0) SHA1(f79b1fdba9c48969c49617c43c1919637adb13ba) )
- ROM_LOAD( "ssf05.ic5s", 0x2800000, 0x800000, CRC(a74b3bb4) SHA1(0ce7cef849061a9af7a61d69dc633f6971a3a63d) )
- ROM_LOAD( "ssf06.ic6s", 0x3000000, 0x800000, CRC(3cd1f5d5) SHA1(77573c3a60af64e6e6a0eb85d5b8176ed98b0723) )
- ROM_LOAD( "ssf07.ic7s", 0x3800000, 0x800000, CRC(00d240f5) SHA1(43010fc596f2cdffdff35a6122f2ab02a5251bc0) )
- ROM_LOAD( "ssf08.ic8s", 0x4000000, 0x800000, CRC(d4907fa1) SHA1(79b1c771819f6e4baa048010bfb940a45370eba2) )
- ROM_LOAD( "ssf09.ic9s", 0x4800000, 0x800000, CRC(6327d49e) SHA1(a10e3c27f70dbf18e63cf51962b6a79a52eba26c) )
- ROM_LOAD( "ssf10.ic10s", 0x5000000, 0x800000, CRC(7975dc80) SHA1(81bda50968f0153a0c4432d8d81e817c1e82e5b2) )
- ROM_LOAD( "ssf11.ic11s", 0x5800000, 0x800000, CRC(a242f682) SHA1(435ea5bb1b3667f9ef3d7de081b15f4e8e6a0d01) )
- ROM_LOAD( "ssf12.ic12s", 0x6000000, 0x800000, CRC(45fa259e) SHA1(8d7e708e7a2cbc2d60b68715dd79bac28d894d4c) )
- ROM_LOAD( "ssf13.ic13s", 0x6800000, 0x800000, CRC(e9578063) SHA1(618f66d01f6bdacbf2a3242774a316b130594e02) )
- ROM_LOAD( "ssf14.ic14s", 0x7000000, 0x800000, CRC(2edc1311) SHA1(bceb54dd29012580e2e6f15f16c6b31195010153) )
- ROM_LOAD( "ssf15.ic15s", 0x7800000, 0x800000, CRC(416db320) SHA1(34536716a35260d9457703704bb9174fb1616d60) )
- ROM_LOAD( "ssf16.ic16s", 0x8000000, 0x800000, CRC(2530cc04) SHA1(6425c031e5a129a3c9451bc694b5da8553f154c2) )
- ROM_LOAD( "ssf17.ic17s", 0x8800000, 0x800000, CRC(9e6afcc2) SHA1(4fb69d834ea12c82e897af47a22dcc47f3c83768) )
- ROM_LOAD( "ssf18.ic18s", 0x9000000, 0x800000, CRC(854ed5e5) SHA1(e445599f6a9e9d05c279259307edc08bce5d6d1f) )
- ROM_LOAD( "ssf19.ic19s", 0x9800000, 0x800000, CRC(4f8ec86a) SHA1(406ab9eeccd99fa5515d4a2c229c8db1a5cb8f83) )
- ROM_LOAD( "ssf20.ic20s", 0xa000000, 0x800000, CRC(c90b960d) SHA1(66e9f09d1f7f6a991371574a2e095c0e22fb7031) )
- ROM_LOAD( "ssf21.ic21s", 0xa800000, 0x800000, CRC(1477c064) SHA1(87fb8d8a91d6bed70b246a8df88fa77fbf3db443) )
+ ROM_LOAD( "ssf01.ic1s", 0x0800000, 0x800000, CRC(4f12f789) SHA1(7b79b687fc61e2e981b9e5e8e0939c4ad24a98f0) )
+ ROM_LOAD( "ssf02.ic2s", 0x1000000, 0x800000, CRC(a255d41a) SHA1(3e932527eb68edf3e8538c1ad264a1c599f6a9d5) )
+ ROM_LOAD( "ssf03.ic3s", 0x1800000, 0x800000, CRC(0f8d6577) SHA1(afaf440e667bacc941c0a5418a0e3b0f2bb725b7) )
+ ROM_LOAD( "ssf04.ic4s", 0x2000000, 0x800000, CRC(bdf25bd0) SHA1(f79b1fdba9c48969c49617c43c1919637adb13ba) )
+ ROM_LOAD( "ssf05.ic5s", 0x2800000, 0x800000, CRC(a74b3bb4) SHA1(0ce7cef849061a9af7a61d69dc633f6971a3a63d) )
+ ROM_LOAD( "ssf06.ic6s", 0x3000000, 0x800000, CRC(3cd1f5d5) SHA1(77573c3a60af64e6e6a0eb85d5b8176ed98b0723) )
+ ROM_LOAD( "ssf07.ic7s", 0x3800000, 0x800000, CRC(00d240f5) SHA1(43010fc596f2cdffdff35a6122f2ab02a5251bc0) )
+ ROM_LOAD( "ssf08.ic8s", 0x4000000, 0x800000, CRC(d4907fa1) SHA1(79b1c771819f6e4baa048010bfb940a45370eba2) )
+ ROM_LOAD( "ssf09.ic9s", 0x4800000, 0x800000, CRC(6327d49e) SHA1(a10e3c27f70dbf18e63cf51962b6a79a52eba26c) )
+ ROM_LOAD( "ssf10.ic10s", 0x5000000, 0x800000, CRC(7975dc80) SHA1(81bda50968f0153a0c4432d8d81e817c1e82e5b2) )
+ ROM_LOAD( "ssf11.ic11s", 0x5800000, 0x800000, CRC(a242f682) SHA1(435ea5bb1b3667f9ef3d7de081b15f4e8e6a0d01) )
+ ROM_LOAD( "ssf12.ic12s", 0x6000000, 0x800000, CRC(45fa259e) SHA1(8d7e708e7a2cbc2d60b68715dd79bac28d894d4c) )
+ ROM_LOAD( "ssf13.ic13s", 0x6800000, 0x800000, CRC(e9578063) SHA1(618f66d01f6bdacbf2a3242774a316b130594e02) )
+ ROM_LOAD( "ssf14.ic14s", 0x7000000, 0x800000, CRC(2edc1311) SHA1(bceb54dd29012580e2e6f15f16c6b31195010153) )
+ ROM_LOAD( "ssf15.ic15s", 0x7800000, 0x800000, CRC(416db320) SHA1(34536716a35260d9457703704bb9174fb1616d60) )
+ ROM_LOAD( "ssf16.ic16s", 0x8000000, 0x800000, CRC(2530cc04) SHA1(6425c031e5a129a3c9451bc694b5da8553f154c2) )
+ ROM_LOAD( "ssf17.ic17s", 0x8800000, 0x800000, CRC(9e6afcc2) SHA1(4fb69d834ea12c82e897af47a22dcc47f3c83768) )
+ ROM_LOAD( "ssf18.ic18s", 0x9000000, 0x800000, CRC(854ed5e5) SHA1(e445599f6a9e9d05c279259307edc08bce5d6d1f) )
+ ROM_LOAD( "ssf19.ic19s", 0x9800000, 0x800000, CRC(4f8ec86a) SHA1(406ab9eeccd99fa5515d4a2c229c8db1a5cb8f83) )
+ ROM_LOAD( "ssf20.ic20s", 0xa000000, 0x800000, CRC(c90b960d) SHA1(66e9f09d1f7f6a991371574a2e095c0e22fb7031) )
+ ROM_LOAD( "ssf21.ic21s", 0xa800000, 0x800000, CRC(1477c064) SHA1(87fb8d8a91d6bed70b246a8df88fa77fbf3db443) )
ROM_END
/*
@@ -7855,7 +7855,7 @@ ROM_END
/* 0062 */ GAME( 2002, clubkrte, naomi2, naomi2, naomi, naomi2, ROT0, "Sega", "Club Kart: European Session (Rev D)", GAME_UNEMULATED_PROTECTION|GAME_FLAGS )
/* 0080 */ GAME( 2002, vf4cart, naomi2, naomi2m2, naomi, naomi2, ROT0, "Sega", "Virtua Fighter 4 (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_FLAGS )
/* 0087 */ GAME( 2002, kingrt66, naomi2, naomi2, naomi, naomi2, ROT0, "Sega", "King of Route 66 (Rev A)", GAME_UNEMULATED_PROTECTION|GAME_FLAGS )
-/* 0095 */ GAME( 2002, soulsurf, naomi2, naomi2, naomi, naomi2, ROT0, "Sega", "Soul Surfer (Rev A)", GAME_FLAGS )
+/* 0095 */ GAME( 2002, soulsurf, naomi2, naomi2, naomi, naomi2, ROT0, "Sega", "Soul Surfer (Rev A)", GAME_FLAGS )
/* 0106 */ GAME( 2002, vf4evoct, naomi2, naomi2m1, naomi, vf4evoct, ROT0, "Sega", "Virtua Fighter 4 Evolution (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_FLAGS )
// 0129 Club Kart Prize
@@ -7948,7 +7948,7 @@ ROM_END
// 0032A Initial D Arcade Stage Ver. 3 (Japan) (Rev A)
/* 0032B */ GAME( 2004, initdv3jb, initdv3j, naomigd, naomi, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Japan) (Rev. B) (GDS-0032B)", GAME_FLAGS )
/* 0032C */ GAME( 2004, initdv3j, naomi2, naomi2gd,naomi, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Japan) (Rev. C) (GDS-0032C)", GAME_FLAGS )
-/* 0033 */ GAME( 2004, initdv3e, naomi2, naomi2gd,naomi, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Export) (GDS-0033)", GAME_FLAGS )
+/* 0033 */ GAME( 2004, initdv3e, naomi2, naomi2gd,naomi, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Export) (GDS-0033)", GAME_FLAGS )
// 0034
// 0035
// 0036 Virtua Fighter 4 Final Tuned
diff --git a/src/mame/drivers/neodrvr.c b/src/mame/drivers/neodrvr.c
index f6f09e60101..2caf40402a4 100644
--- a/src/mame/drivers/neodrvr.c
+++ b/src/mame/drivers/neodrvr.c
@@ -8889,7 +8889,7 @@ ROM_START( sbp ) /* Unlicensed, no official game ID # */
ROM_REGION( 0x800000, "ymsnd", 0 )
ROM_LOAD( "12a.bin", 0x000000, 0x400000, CRC(c96723b9) SHA1(52eec88550781d45f84efbf9b905d7e7912e96fa) )
- ROM_LOAD( "13a.bin", 0x400000, 0x400000, CRC(08c339a5) SHA1(badc9510ae243ef2a7877977eb36efa81b1489fe) )
+ ROM_LOAD( "13a.bin", 0x400000, 0x400000, CRC(08c339a5) SHA1(badc9510ae243ef2a7877977eb36efa81b1489fe) )
NO_DELTAT_REGION
diff --git a/src/mame/drivers/taitogn.c b/src/mame/drivers/taitogn.c
index e5b72ddb8de..a74a42fff73 100644
--- a/src/mame/drivers/taitogn.c
+++ b/src/mame/drivers/taitogn.c
@@ -451,7 +451,7 @@ static WRITE32_HANDLER(rf5c296_mem_w)
taitogn_state *state = space->machine().driver_data<taitogn_state>();
if(offset >= 0x140 && offset <= 0x144) {
- dynamic_buffer key;
+ dynamic_buffer key;
int pos = (offset - 0x140)*2;
UINT8 v, k;
diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c
index af44f349452..b2a690ec919 100644
--- a/src/mame/drivers/vamphalf.c
+++ b/src/mame/drivers/vamphalf.c
@@ -1654,8 +1654,8 @@ ROM_END
ROM_START( wyvernwga )
ROM_REGION32_BE( 0x100000, "user1", ROMREGION_ERASE00 ) /* Hyperstone CPU Code */
- ROM_LOAD( "rom1_alt.rom", 0x000000, 0x080000, CRC(586881fd) SHA1(d335bbd91def8fa4935eb2375c9b00471a1f40eb) )
- ROM_LOAD( "rom2_alt.rom", 0x080000, 0x080000, CRC(938049ec) SHA1(cc10944c99ceb388dd4aafc93377c40540861d14) )
+ ROM_LOAD( "rom1_alt.rom", 0x000000, 0x080000, CRC(586881fd) SHA1(d335bbd91def8fa4935eb2375c9b00471a1f40eb) )
+ ROM_LOAD( "rom2_alt.rom", 0x080000, 0x080000, CRC(938049ec) SHA1(cc10944c99ceb388dd4aafc93377c40540861d14) )
ROM_REGION( 0x020000, "audiocpu", 0 ) /* QDSP ('51) Code */
ROM_LOAD( "u7", 0x0000, 0x20000, CRC(00a3f705) SHA1(f0a6bafd16bea53d4c05c8cc108983cbd41e5757) )
diff --git a/src/mame/machine/n64.c b/src/mame/machine/n64.c
index 8aed17384c2..cb011fd6430 100644
--- a/src/mame/machine/n64.c
+++ b/src/mame/machine/n64.c
@@ -1927,13 +1927,13 @@ void n64_periphs::handle_pif()
{
//printf("Before:\n");
/*for(int i = 0; i < 0x40; i++)
- {
- printf("%02x ", pif_cmd[i]);
- if((i & 0xf) == 0xf)
- {
- printf("\n");
- }
- }*/
+ {
+ printf("%02x ", pif_cmd[i]);
+ if((i & 0xf) == 0xf)
+ {
+ printf("\n");
+ }
+ }*/
if(pif_cmd[0x3f] == 0x1) // only handle the command if the last byte is 1
{
int channel = 0;
@@ -2005,14 +2005,14 @@ void n64_periphs::handle_pif()
}
/*printf("After:\n");
- for(int i = 0; i < 0x40; i++)
- {
- printf("%02x ", pif_ram[i]);
- if((i & 0xf) == 0xf)
- {
- printf("\n");
- }
- }*/
+ for(int i = 0; i < 0x40; i++)
+ {
+ printf("%02x ", pif_ram[i]);
+ if((i & 0xf) == 0xf)
+ {
+ printf("\n");
+ }
+ }*/
}
void n64_periphs::pif_dma(int direction)
diff --git a/src/mame/video/n64.c b/src/mame/video/n64.c
index 34c45108dad..c252331d54c 100644
--- a/src/mame/video/n64.c
+++ b/src/mame/video/n64.c
@@ -68,7 +68,7 @@ void n64_rdp::GetAlphaCvg(UINT8 *comb_alpha, rdp_span_aux *userdata, const rdp_p
{
temp3 = (temp * temp2) + 4;
userdata->CurrentPixCvg = (temp3 >> 8) & 0xf;
- }
+ }
if (object.OtherModes.alpha_cvg_select)
{
temp = (OtherModes.cvg_times_alpha) ? (temp3 >> 3) : (temp2 << 5);
@@ -157,11 +157,11 @@ void n64_rdp::VideoUpdate16(n64_periphs *n64, bitmap_rgb32 &bitmap)
//if(divot)
//{
- // if(i > 0 && i < (hres - 1))
- // {
- // prev_cvg = ((frame_buffer[(pixels - 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels - 1)^BYTE_ADDR_XOR] & 3);
- // next_cvg = ((frame_buffer[(pixels + 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels + 1)^BYTE_ADDR_XOR] & 3);
- // }
+ // if(i > 0 && i < (hres - 1))
+ // {
+ // prev_cvg = ((frame_buffer[(pixels - 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels - 1)^BYTE_ADDR_XOR] & 3);
+ // next_cvg = ((frame_buffer[(pixels + 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels + 1)^BYTE_ADDR_XOR] & 3);
+ // }
//}
c.i.r = ((pix >> 8) & 0xf8) | (pix >> 13);
c.i.g = ((pix >> 3) & 0xf8) | ((pix >> 8) & 0x07);
diff --git a/src/mame/video/n64.h b/src/mame/video/n64.h
index 2ab0a542ad4..1f6e9fbd366 100644
--- a/src/mame/video/n64.h
+++ b/src/mame/video/n64.h
@@ -370,7 +370,7 @@ struct rdp_span_aux
INT32 m_precomp_t;
UINT8 BlendEnable;
bool PreWrap;
- INT32 m_dzpix_enc;
+ INT32 m_dzpix_enc;
UINT8 *m_tmem; /* pointer to texture cache for this polygon */
bool m_start_span;
};
@@ -594,14 +594,14 @@ class n64_rdp : public poly_manager<UINT32, rdp_poly_state, 8, 32000>
UINT8 ReplicatedRGBA[32];
- Rectangle Scissor;
+ Rectangle Scissor;
SpanBaseT SpanBase;
- rectangle visarea;
+ rectangle visarea;
void DrawTriangle(bool shade, bool texture, bool zbuffer, bool rect);
- void compute_cvg_noflip(extent_t *Spans, INT32* majorx, INT32* minorx, INT32* majorxint, INT32* minorxint, INT32 scanline, INT32 yh, INT32 yl, INT32 base);
- void compute_cvg_flip(extent_t *Spans, INT32* majorx, INT32* minorx, INT32* majorxint, INT32* minorxint, INT32 scanline, INT32 yh, INT32 yl, INT32 base);
+ void compute_cvg_noflip(extent_t *Spans, INT32* majorx, INT32* minorx, INT32* majorxint, INT32* minorxint, INT32 scanline, INT32 yh, INT32 yl, INT32 base);
+ void compute_cvg_flip(extent_t *Spans, INT32* majorx, INT32* minorx, INT32* majorxint, INT32* minorxint, INT32 scanline, INT32 yh, INT32 yl, INT32 base);
void* AuxBuf;
UINT32 AuxBufPtr;
@@ -611,7 +611,7 @@ class n64_rdp : public poly_manager<UINT32, rdp_poly_state, 8, 32000>
UINT32 ExtentBufPtr[2];
UINT32 ExtentBufIndex;
- bool rdp_range_check(UINT32 addr);
+ bool rdp_range_check(UINT32 addr);
N64Tile m_tiles[8];
diff --git a/src/mame/video/nmk16.c b/src/mame/video/nmk16.c
index ecb83b69d57..dfef641875c 100644
--- a/src/mame/video/nmk16.c
+++ b/src/mame/video/nmk16.c
@@ -638,10 +638,10 @@ SCREEN_UPDATE_IND16( hachamf )
0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
};
nmk16_draw_sprites2(screen.machine(), bitmap,cliprect, hachamf_swaptbl);
-/* nmk16_draw_sprites(screen.machine(), bitmap,cliprect,3);
- nmk16_draw_sprites(screen.machine(), bitmap,cliprect,2);
- nmk16_draw_sprites(screen.machine(), bitmap,cliprect,1);
- nmk16_draw_sprites(screen.machine(), bitmap,cliprect,0);*/
+/* nmk16_draw_sprites(screen.machine(), bitmap,cliprect,3);
+ nmk16_draw_sprites(screen.machine(), bitmap,cliprect,2);
+ nmk16_draw_sprites(screen.machine(), bitmap,cliprect,1);
+ nmk16_draw_sprites(screen.machine(), bitmap,cliprect,0);*/
state->m_tx_tilemap->draw(bitmap, cliprect, 0,0);
return 0;
diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak
index d9766db40fb..9c2251fa5e8 100644
--- a/src/osd/sdl/sdl.mak
+++ b/src/osd/sdl/sdl.mak
@@ -58,7 +58,7 @@ USE_DISPATCH_GL = 1
# uncomment the next line to use couriersud's multi-keyboard patch for sdl2.0
# SDL2_MULTIAPI = 1
-# uncomment the next line to specify where you have installed
+# uncomment the next line to specify where you have installed
# SDL. Equivalent to the ./configure --prefix=<path>
# SDL_INSTALL_ROOT = /usr/local/sdl13
@@ -382,7 +382,7 @@ ifdef SDL_INSTALL_ROOT
# FIXME: remove the directfb ref. later. This is just there for now to work around an issue with SDL1.3 and SDL2.0
INCPATH += -I$(SDL_INSTALL_ROOT)/include/directfb
endif
-endif
+endif
INCPATH += `pkg-config --cflags fontconfig`
LIBS += `pkg-config --libs fontconfig`
diff --git a/src/osd/windows/winwork.c b/src/osd/windows/winwork.c
index 18c54f06e84..f71ccceba10 100644
--- a/src/osd/windows/winwork.c
+++ b/src/osd/windows/winwork.c
@@ -324,7 +324,7 @@ osd_work_queue *osd_work_queue_alloc(int flags)
// on an n-CPU system, create n threads for multi queues, and 1 thread for everything else
else
queue->threads = (flags & WORK_QUEUE_FLAG_MULTI) ? numprocs : 1;
-
+
// multi-queues with high frequency items should top out at 4 for now
// since we have scaling problems above that
if ((flags & WORK_QUEUE_FLAG_HIGH_FREQ) && queue->threads > 1)
diff --git a/src/tools/chdman.c b/src/tools/chdman.c
index f6fe613cb7a..594bff3a519 100644
--- a/src/tools/chdman.c
+++ b/src/tools/chdman.c
@@ -215,7 +215,7 @@ public:
: m_file(file),
m_offset(offset),
m_maxoffset(MIN(maxoffset, (file != NULL) ? core_fsize(file) : 0)) { }
-
+
// read interface
virtual UINT32 read_data(void *dest, UINT64 offset, UINT32 length)
{
@@ -247,7 +247,7 @@ public:
m_offset(offset),
m_maxoffset(MIN(maxoffset, file.logical_bytes())) { }
- // read interface
+ // read interface
virtual UINT32 read_data(void *dest, UINT64 offset, UINT32 length)
{
offset += m_offset;
@@ -279,24 +279,24 @@ public:
: m_file(NULL),
m_toc(toc),
m_info(info) { }
-
+
~chd_cd_compressor()
{
if (m_file != NULL)
core_fclose(m_file);
}
- // read interface
+ // read interface
virtual UINT32 read_data(void *_dest, UINT64 offset, UINT32 length)
{
// verify assumptions made below
assert(offset % CD_FRAME_SIZE == 0);
assert(length % CD_FRAME_SIZE == 0);
-
+
// initialize destination to 0 so that unused areas are filled
UINT8 *dest = reinterpret_cast<UINT8 *>(_dest);
memset(dest, 0, length);
-
+
// find out which track we're starting in
UINT64 startoffs = 0;
UINT32 length_remaining = length;
@@ -316,7 +316,7 @@ public:
if (filerr != FILERR_NONE)
report_error(1, "Error opening input file (%s)'", m_lastfile.cstr());
}
-
+
// iterate over frames
UINT32 bytesperframe = trackinfo.datasize + trackinfo.subsize;
UINT64 src_track_start = m_info.track[tracknum].offset;
@@ -332,7 +332,7 @@ public:
UINT32 count = core_fread(m_file, dest, bytesperframe);
if (count != bytesperframe)
report_error(1, "Error reading input file (%s)'", m_lastfile.cstr());
-
+
// swap if appropriate
if (m_info.track[tracknum].swap)
for (UINT32 swapindex = 0; swapindex < 2352; swapindex += 2)
@@ -342,7 +342,7 @@ public:
dest[swapindex + 1] = temp;
}
}
-
+
// advance
offset += CD_FRAME_SIZE;
dest += CD_FRAME_SIZE;
@@ -351,7 +351,7 @@ public:
break;
}
}
-
+
// next track starts after the previous one
startoffs = endoffs;
}
@@ -381,11 +381,11 @@ public:
m_frame_count(num_frames),
m_ldframedata(num_frames * VBI_PACKED_BYTES),
m_rawdata(info.bytes_per_frame) { }
-
+
// getters
const dynamic_buffer &ldframedata() const { return m_ldframedata; }
-
- // read interface
+
+ // read interface
virtual UINT32 read_data(void *_dest, UINT64 offset, UINT32 length)
{
UINT8 *dest = reinterpret_cast<UINT8 *>(_dest);
@@ -402,7 +402,7 @@ public:
INT32 effframe = m_start_frame + framenum;
UINT32 first_sample = (UINT64(m_info.rate) * UINT64(effframe) * UINT64(1000000) + m_info.fps_times_1million - 1) / UINT64(m_info.fps_times_1million);
UINT32 samples = (UINT64(m_info.rate) * UINT64(effframe + 1) * UINT64(1000000) + m_info.fps_times_1million - 1) / UINT64(m_info.fps_times_1million) - first_sample;
-
+
// loop over channels and read the samples
int channels = MIN(m_info.channels, ARRAY_LENGTH(m_audio));
INT16 *samplesptr[ARRAY_LENGTH(m_audio)];
@@ -437,13 +437,13 @@ public:
UINT32 rawsize = avhuff_encoder::raw_data_size(m_rawdata);
if (rawsize < m_rawdata.count())
memset(&m_rawdata[rawsize], 0, m_rawdata.count() - rawsize);
-
+
// copy to the destination
UINT64 start_offset = UINT64(framenum) * UINT64(m_info.bytes_per_frame);
UINT64 end_offset = start_offset + m_info.bytes_per_frame;
UINT32 bytes_to_copy = MIN(length_remaining, end_offset - offset);
memcpy(dest, &m_rawdata[offset - start_offset], bytes_to_copy);
-
+
// advance
offset += bytes_to_copy;
dest += bytes_to_copy;
@@ -519,29 +519,29 @@ static const option_description s_options[] =
// descriptions for each command
static const command_description s_commands[] =
{
- { COMMAND_INFO, do_info, ": displays information about a CHD",
+ { COMMAND_INFO, do_info, ": displays information about a CHD",
{
REQUIRED OPTION_INPUT,
OPTION_VERBOSE
- }
+ }
},
-
- { COMMAND_VERIFY, do_verify, ": verifies a CHD's integrity",
+
+ { COMMAND_VERIFY, do_verify, ": verifies a CHD's integrity",
{
REQUIRED OPTION_INPUT,
OPTION_INPUT_PARENT
- }
+ }
},
-
- { COMMAND_CREATE_RAW, do_create_raw, ": create a raw CHD from the input file",
+
+ { COMMAND_CREATE_RAW, do_create_raw, ": create a raw CHD from the input file",
{
- REQUIRED OPTION_OUTPUT,
+ REQUIRED OPTION_OUTPUT,
OPTION_OUTPUT_PARENT,
OPTION_OUTPUT_FORCE,
- REQUIRED OPTION_INPUT,
- OPTION_INPUT_START_BYTE,
- OPTION_INPUT_START_HUNK,
- OPTION_INPUT_LENGTH_BYTES,
+ REQUIRED OPTION_INPUT,
+ OPTION_INPUT_START_BYTE,
+ OPTION_INPUT_START_HUNK,
+ OPTION_INPUT_LENGTH_BYTES,
OPTION_INPUT_LENGTH_HUNKS,
REQUIRED OPTION_HUNK_SIZE,
REQUIRED OPTION_UNIT_SIZE,
@@ -551,16 +551,16 @@ static const command_description s_commands[] =
#endif
}
},
-
- { COMMAND_CREATE_HD, do_create_hd, ": create a hard disk CHD from the input file",
+
+ { COMMAND_CREATE_HD, do_create_hd, ": create a hard disk CHD from the input file",
{
- REQUIRED OPTION_OUTPUT,
+ REQUIRED OPTION_OUTPUT,
OPTION_OUTPUT_PARENT,
OPTION_OUTPUT_FORCE,
- OPTION_INPUT,
- OPTION_INPUT_START_BYTE,
- OPTION_INPUT_START_HUNK,
- OPTION_INPUT_LENGTH_BYTES,
+ OPTION_INPUT,
+ OPTION_INPUT_START_BYTE,
+ OPTION_INPUT_START_HUNK,
+ OPTION_INPUT_LENGTH_BYTES,
OPTION_INPUT_LENGTH_HUNKS,
OPTION_HUNK_SIZE,
OPTION_COMPRESSION,
@@ -572,13 +572,13 @@ static const command_description s_commands[] =
#endif
}
},
-
- { COMMAND_CREATE_CD, do_create_cd, ": create a CD CHD from the input file",
+
+ { COMMAND_CREATE_CD, do_create_cd, ": create a CD CHD from the input file",
{
- REQUIRED OPTION_OUTPUT,
+ REQUIRED OPTION_OUTPUT,
OPTION_OUTPUT_PARENT,
OPTION_OUTPUT_FORCE,
- REQUIRED OPTION_INPUT,
+ REQUIRED OPTION_INPUT,
OPTION_HUNK_SIZE,
OPTION_COMPRESSION,
#if NUM_PROCESSORS_SUPPORTED
@@ -586,13 +586,13 @@ static const command_description s_commands[] =
#endif
}
},
-
- { COMMAND_CREATE_LD, do_create_ld, ": create a laserdisc CHD from the input file",
+
+ { COMMAND_CREATE_LD, do_create_ld, ": create a laserdisc CHD from the input file",
{
- REQUIRED OPTION_OUTPUT,
+ REQUIRED OPTION_OUTPUT,
OPTION_OUTPUT_PARENT,
OPTION_OUTPUT_FORCE,
- REQUIRED OPTION_INPUT,
+ REQUIRED OPTION_INPUT,
OPTION_INPUT_START_FRAME,
OPTION_INPUT_LENGTH_FRAMES,
OPTION_HUNK_SIZE,
@@ -602,63 +602,63 @@ static const command_description s_commands[] =
#endif
}
},
-
- { COMMAND_EXTRACT_RAW, do_extract_raw, ": extract raw file from a CHD input file",
+
+ { COMMAND_EXTRACT_RAW, do_extract_raw, ": extract raw file from a CHD input file",
{
- REQUIRED OPTION_OUTPUT,
+ REQUIRED OPTION_OUTPUT,
OPTION_OUTPUT_FORCE,
- REQUIRED OPTION_INPUT,
- OPTION_INPUT_PARENT,
- OPTION_INPUT_START_BYTE,
- OPTION_INPUT_START_HUNK,
- OPTION_INPUT_LENGTH_BYTES,
+ REQUIRED OPTION_INPUT,
+ OPTION_INPUT_PARENT,
+ OPTION_INPUT_START_BYTE,
+ OPTION_INPUT_START_HUNK,
+ OPTION_INPUT_LENGTH_BYTES,
OPTION_INPUT_LENGTH_HUNKS
}
},
-
- { COMMAND_EXTRACT_HD, do_extract_raw, ": extract raw hard disk file from a CHD input file",
+
+ { COMMAND_EXTRACT_HD, do_extract_raw, ": extract raw hard disk file from a CHD input file",
{
- REQUIRED OPTION_OUTPUT,
+ REQUIRED OPTION_OUTPUT,
OPTION_OUTPUT_FORCE,
- REQUIRED OPTION_INPUT,
- OPTION_INPUT_PARENT,
- OPTION_INPUT_START_BYTE,
- OPTION_INPUT_START_HUNK,
- OPTION_INPUT_LENGTH_BYTES,
+ REQUIRED OPTION_INPUT,
+ OPTION_INPUT_PARENT,
+ OPTION_INPUT_START_BYTE,
+ OPTION_INPUT_START_HUNK,
+ OPTION_INPUT_LENGTH_BYTES,
OPTION_INPUT_LENGTH_HUNKS
}
},
-
- { COMMAND_EXTRACT_CD, do_extract_cd, ": extract CD file from a CHD input file",
+
+ { COMMAND_EXTRACT_CD, do_extract_cd, ": extract CD file from a CHD input file",
{
- REQUIRED OPTION_OUTPUT,
- OPTION_OUTPUT_BIN,
+ REQUIRED OPTION_OUTPUT,
+ OPTION_OUTPUT_BIN,
OPTION_OUTPUT_FORCE,
REQUIRED OPTION_INPUT,
- OPTION_INPUT_PARENT,
+ OPTION_INPUT_PARENT,
}
},
-
- { COMMAND_EXTRACT_LD, do_extract_ld, ": extract laserdisc AVI from a CHD input file",
+
+ { COMMAND_EXTRACT_LD, do_extract_ld, ": extract laserdisc AVI from a CHD input file",
{
- REQUIRED OPTION_OUTPUT,
+ REQUIRED OPTION_OUTPUT,
OPTION_OUTPUT_FORCE,
- REQUIRED OPTION_INPUT,
- OPTION_INPUT_PARENT,
- OPTION_INPUT_START_FRAME,
+ REQUIRED OPTION_INPUT,
+ OPTION_INPUT_PARENT,
+ OPTION_INPUT_START_FRAME,
OPTION_INPUT_LENGTH_FRAMES
}
},
-
- { COMMAND_COPY, do_copy, ": copy data from one CHD to another of the same type",
+
+ { COMMAND_COPY, do_copy, ": copy data from one CHD to another of the same type",
{
- REQUIRED OPTION_OUTPUT,
+ REQUIRED OPTION_OUTPUT,
OPTION_OUTPUT_PARENT,
OPTION_OUTPUT_FORCE,
- REQUIRED OPTION_INPUT,
+ REQUIRED OPTION_INPUT,
OPTION_INPUT_PARENT,
- OPTION_INPUT_START_BYTE,
- OPTION_INPUT_START_HUNK,
+ OPTION_INPUT_START_BYTE,
+ OPTION_INPUT_START_HUNK,
OPTION_INPUT_LENGTH_BYTES,
OPTION_INPUT_LENGTH_HUNKS,
OPTION_HUNK_SIZE,
@@ -668,10 +668,10 @@ static const command_description s_commands[] =
#endif
}
},
-
- { COMMAND_ADD_METADATA, do_add_metadata, ": add metadata to the CHD",
+
+ { COMMAND_ADD_METADATA, do_add_metadata, ": add metadata to the CHD",
{
- REQUIRED OPTION_INPUT,
+ REQUIRED OPTION_INPUT,
REQUIRED OPTION_TAG,
OPTION_INDEX,
OPTION_VALUE_TEXT,
@@ -679,10 +679,10 @@ static const command_description s_commands[] =
OPTION_NO_CHECKSUM
}
},
-
- { COMMAND_DEL_METADATA, do_del_metadata, ": remove metadata from the CHD",
+
+ { COMMAND_DEL_METADATA, do_del_metadata, ": remove metadata from the CHD",
{
- REQUIRED OPTION_INPUT,
+ REQUIRED OPTION_INPUT,
REQUIRED OPTION_TAG,
OPTION_INDEX
}
@@ -708,7 +708,7 @@ static void report_error(int error, const char *format, ...)
fflush(stderr);
va_end(arg);
fprintf(stderr, "\n");
-
+
// reset time for progress and return the error
lastprogress = 0;
throw fatal_error(error);
@@ -782,7 +782,7 @@ static int print_help(const char *argv0, const command_description &desc, const
bool required = (option[0] == REQUIRED[0]);
if (required)
option++;
-
+
// find the option
for (int optnum = 0; optnum < ARRAY_LENGTH(s_options); optnum++)
if (strcmp(option, s_options[optnum].name) == 0)
@@ -807,7 +807,7 @@ const char *big_int_string(astring &string, UINT64 intvalue)
// 0 is a special case
if (intvalue == 0)
return string.cpy("0");
-
+
// loop until all chunks are done
string.reset();
bool first = true;
@@ -815,7 +815,7 @@ const char *big_int_string(astring &string, UINT64 intvalue)
{
int chunk = intvalue % 1000;
intvalue /= 1000;
-
+
astring insert;
insert.format((intvalue != 0) ? "%03d" : "%d", chunk);
@@ -850,7 +850,7 @@ UINT64 parse_number(const char *string)
int length = strlen(string);
if (length == 0)
return 0;
-
+
// scan forward over digits
UINT64 result = 0;
while (isdigit(*string))
@@ -858,7 +858,7 @@ UINT64 parse_number(const char *string)
result = (result * 10) + (*string - '0');
string++;
}
-
+
// handle multipliers
if (*string == 'k' || *string == 'K')
result *= 1024;
@@ -866,7 +866,7 @@ UINT64 parse_number(const char *string)
result *= 1024 * 1024;
if (*string == 'g' || *string == 'G')
result *= 1024 * 1024 * 1024;
-
+
return result;
}
@@ -881,7 +881,7 @@ static void guess_chs(astring *filename, UINT64 filesize, int sectorsize, UINT32
// if this is a direct physical drive read, handle it specially
if (filename != NULL && osd_get_physical_drive_geometry(*filename, &cylinders, &heads, &sectors, &bps))
return;
-
+
// if we have no length to work with, we can't guess
if (filesize == 0)
report_error(1, "Can't guess CHS values because there is no input file");
@@ -913,7 +913,7 @@ static void guess_chs(astring *filename, UINT64 filesize, int sectorsize, UINT32
//-------------------------------------------------
-// parse_input_chd_parameters - parse the
+// parse_input_chd_parameters - parse the
// standard set of input CHD parameters
//-------------------------------------------------
@@ -962,7 +962,7 @@ static void parse_input_start_end(const parameters_t &params, UINT64 logical_siz
input_start = parse_number(*input_start_frame_str) * framebytes;
if (input_start >= input_end)
report_error(1, "Input start offset greater than input file size");
-
+
// process input length
astring *input_length_bytes_str = params.find(OPTION_INPUT_LENGTH_BYTES);
astring *input_length_hunks_str = params.find(OPTION_INPUT_LENGTH_HUNKS);
@@ -1001,7 +1001,7 @@ static void check_existing_output_file(const parameters_t &params, const char *f
//-------------------------------------------------
-// parse_output_chd_parameters - parse the
+// parse_output_chd_parameters - parse the
// standard set of output CHD parameters
//-------------------------------------------------
@@ -1025,7 +1025,7 @@ static astring *parse_output_chd_parameters(const parameters_t &params, chd_file
//-------------------------------------------------
-// parse_hunk_size - parse the hunk_size
+// parse_hunk_size - parse the hunk_size
// parameter in a standard way
//-------------------------------------------------
@@ -1044,7 +1044,7 @@ static void parse_hunk_size(const parameters_t &params, UINT32 required_granular
//-------------------------------------------------
-// parse_compression - parse a standard
+// parse_compression - parse a standard
// compression parameter string
//-------------------------------------------------
@@ -1061,7 +1061,7 @@ static void parse_compression(const parameters_t &params, chd_codec_type compres
compression[0] = compression[1] = compression[2] = compression[3] = CHD_CODEC_NONE;
return;
}
-
+
// iterate through compressors
int index = 0;
for (int start = 0, end = compression_str->chr(0, ','); index < 4; start = end + 1, end = compression_str->chr(end + 1, ','))
@@ -1112,7 +1112,7 @@ static const char *compression_string(astring &string, chd_codec_type compressio
string.reset();
if (compression[0] == CHD_CODEC_NONE)
return string.cpy("none");
-
+
// iterate over types
for (int index = 0; index < 4; index++)
{
@@ -1126,7 +1126,7 @@ static const char *compression_string(astring &string, chd_codec_type compressio
}
return string;
}
-
+
//-------------------------------------------------
// compress_common - standard compression loop
@@ -1137,7 +1137,7 @@ static void compress_common(chd_file_compressor &chd)
// begin compressing
chd.compress_begin();
- // loop until done
+ // loop until done
double complete, ratio;
chd_error err;
while ((err = chd.compress_continue(complete, ratio)) == CHDERR_WALKING_PARENT || err == CHDERR_COMPRESSING)
@@ -1190,7 +1190,7 @@ void output_track_metadata(bool cuemode, core_file *file, int tracknum, const cd
tempstr.cpy("AUDIO");
break;
}
-
+
// output TRACK entry
core_fprintf(file, " TRACK %02d %s\n", tracknum + 1, tempstr.cstr());
@@ -1205,7 +1205,7 @@ void output_track_metadata(bool cuemode, core_file *file, int tracknum, const cd
if (info.postgap > 0)
core_fprintf(file, " POSTGAP %s\n", msf_string_from_frames(tempstr, info.postgap));
}
-
+
// non-CUE mode
else
{
@@ -1304,7 +1304,7 @@ static void do_info(parameters_t &params)
chd_error err = input_chd.read_metadata(CHDMETATAG_WILDCARD, index, buffer, metatag, metaflags);
if (err != CHDERR_NONE)
break;
-
+
// determine our index
UINT32 metaindex = ~0;
for (int cur = 0; cur < info.count(); cur++)
@@ -1313,7 +1313,7 @@ static void do_info(parameters_t &params)
metaindex = ++info[cur].index;
break;
}
-
+
// if not found, add to our tracking
if (metaindex == ~0)
{
@@ -1335,7 +1335,7 @@ static void do_info(parameters_t &params)
printf("%c", isprint(UINT8(buffer[chnum])) ? buffer[chnum] : '.');
printf("\n");
}
-
+
// print compression stats if verbose
if (params.find(OPTION_VERBOSE) != NULL)
{
@@ -1348,7 +1348,7 @@ static void do_info(parameters_t &params)
chd_error err = input_chd.hunk_info(hunknum, codec, compbytes);
if (err != CHDERR_NONE)
report_error(1, "Error getting info on hunk %d: %s", hunknum, chd_file::error_string(err));
-
+
// decode into our data
if (codec > CHD_CODEC_MINI)
for (int comptype = 0; comptype < 4; comptype++)
@@ -1359,11 +1359,11 @@ static void do_info(parameters_t &params)
}
if (codec > ARRAY_LENGTH(compression_types))
codec = ARRAY_LENGTH(compression_types) - 1;
-
+
// count stats
compression_types[codec]++;
}
-
+
// output the stats
printf("\n");
printf(" Hunks Percent Name\n");
@@ -1385,10 +1385,10 @@ static void do_info(parameters_t &params)
name = chd_codec_list::codec_name(input_chd.compression(index));
break;
}
-
+
// output the stats
astring tempstr;
- printf("%10s %5.1f%% %-40s\n",
+ printf("%10s %5.1f%% %-40s\n",
big_int_string(tempstr, compression_types[comptype]),
100.0 * double(compression_types[comptype]) / double(input_chd.hunk_count()),
name);
@@ -1417,7 +1417,7 @@ static void do_verify(parameters_t &params)
// create an array to read into
dynamic_buffer buffer((TEMP_BUFFER_SIZE / input_chd.hunk_bytes()) * input_chd.hunk_bytes());
-
+
// read all the data and build up an SHA-1
sha1_creator rawsha1;
for (UINT64 offset = 0; offset < input_chd.logical_bytes(); )
@@ -1429,13 +1429,13 @@ static void do_verify(parameters_t &params)
chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read);
if (err != CHDERR_NONE)
report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err));
-
+
// add to the checksum
rawsha1.append(buffer, bytes_to_read);
offset += bytes_to_read;
}
sha1_t computed_sha1 = rawsha1.finish();
-
+
// finish up
if (raw_sha1 != computed_sha1)
{
@@ -1453,7 +1453,7 @@ static void do_verify(parameters_t &params)
else
{
printf("Raw SHA1 verification successful!\n");
-
+
// now include the metadata for >= v4
if (input_chd.version() >= 4)
{
@@ -1498,7 +1498,7 @@ static void do_create_raw(parameters_t &params)
// process output CHD
chd_file output_parent;
astring *output_chd_str = parse_output_chd_parameters(params, output_parent);
-
+
// process hunk size
UINT32 hunk_size = output_parent.opened() ? output_parent.hunk_bytes() : 0;
parse_hunk_size(params, 1, hunk_size);
@@ -1517,12 +1517,12 @@ static void do_create_raw(parameters_t &params)
UINT64 input_start;
UINT64 input_end;
parse_input_start_end(params, core_fsize(input_file), hunk_size, hunk_size, input_start, input_end);
-
+
// process compression
chd_codec_type compression[4];
memcpy(compression, s_default_raw_compression, sizeof(compression));
parse_compression(params, compression);
-
+
// process numprocessors
parse_numprocessors(params);
@@ -1553,7 +1553,7 @@ static void do_create_raw(parameters_t &params)
err = chd.create(*output_chd_str, input_end - input_start, hunk_size, unit_size, compression);
if (err != CHDERR_NONE)
report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err));
-
+
// if we have a parent, copy forward all the metadata
if (output_parent.opened())
chd.clone_all_metadata(output_parent);
@@ -1588,11 +1588,11 @@ static void do_create_hd(parameters_t &params)
if (filerr != FILERR_NONE)
report_error(1, "Unable to open file (%s)", input_file_str->cstr());
}
-
+
// process output CHD
chd_file output_parent;
astring *output_chd_str = parse_output_chd_parameters(params, output_parent);
-
+
// process sectorsize
UINT32 sector_size = output_parent.opened() ? output_parent.unit_bytes() : IDE_SECTOR_SIZE;
astring *sectorsize_str = params.find(OPTION_SECTOR_SIZE);
@@ -1602,16 +1602,16 @@ static void do_create_hd(parameters_t &params)
report_error(1, "Sector size does not apply when creating a diff from the parent");
sector_size = parse_number(*sectorsize_str);
}
-
+
// process hunk size (needs to know sector_size)
UINT32 hunk_size = output_parent.opened() ? output_parent.hunk_bytes() : MAX((4096 / sector_size) * sector_size, sector_size);
parse_hunk_size(params, sector_size, hunk_size);
-
+
// process input start/end (needs to know hunk_size)
UINT64 input_start;
UINT64 input_end;
parse_input_start_end(params, core_fsize(input_file), hunk_size, hunk_size, input_start, input_end);
-
+
// process compression
chd_codec_type compression[4];
memcpy(compression, s_default_hd_compression, sizeof(compression));
@@ -1656,7 +1656,7 @@ static void do_create_hd(parameters_t &params)
heads = (identdata[7] << 8) | identdata[6];
sectors = (identdata[13] << 8) | identdata[12];
}
-
+
// extract geometry from the parent if we have one
if (output_parent.opened() && cylinders == 0)
{
@@ -1666,7 +1666,7 @@ static void do_create_hd(parameters_t &params)
if (sscanf(metadata, HARD_DISK_METADATA_FORMAT, &cylinders, &heads, &sectors, &sector_size) != 4)
report_error(1, "Error parsing hard disk metadata in parent CHD");
}
-
+
// if no CHS values, try to guess them
if (cylinders == 0)
{
@@ -1675,7 +1675,7 @@ static void do_create_hd(parameters_t &params)
guess_chs(input_file_str, input_end - input_start, sector_size, cylinders, heads, sectors, sector_size);
}
UINT32 totalsectors = cylinders * heads * sectors;
-
+
// print some info
astring tempstr;
printf("Output CHD: %s\n", output_chd_str->cstr());
@@ -1758,7 +1758,7 @@ static void do_create_cd(parameters_t &params)
if (err != CHDERR_NONE)
report_error(1, "Error parsing input file (%s: %s\n", input_file_str->cstr(), chd_file::error_string(err));
}
-
+
// process output CHD
chd_file output_parent;
astring *output_chd_str = parse_output_chd_parameters(params, output_parent);
@@ -1766,7 +1766,7 @@ static void do_create_cd(parameters_t &params)
// process hunk size
UINT32 hunk_size = output_parent.opened() ? output_parent.hunk_bytes() : CD_FRAMES_PER_HUNK * CD_FRAME_SIZE;
parse_hunk_size(params, CD_FRAME_SIZE, hunk_size);
-
+
// process compression
chd_codec_type compression[4];
memcpy(compression, s_default_cd_compression, sizeof(compression));
@@ -1847,16 +1847,16 @@ static void do_create_ld(parameters_t &params)
report_error(1, "Error opening AVI file (%s): %s\n", input_file_str->cstr(), avi_error_string(avierr));
}
const avi_movie_info *aviinfo = avi_get_movie_info(input_file);
-
+
// process output CHD
chd_file output_parent;
astring *output_chd_str = parse_output_chd_parameters(params, output_parent);
-
+
// process input start/end
UINT64 input_start;
UINT64 input_end;
parse_input_start_end(params, aviinfo->video_numsamples, 0, 1, input_start, input_end);
-
+
// determine parameters of the incoming video stream
avi_info info;
info.fps_times_1million = UINT64(aviinfo->video_timescale) * 1000000 / aviinfo->video_sampletime;
@@ -1878,11 +1878,11 @@ static void do_create_ld(parameters_t &params)
// determine the number of bytes per frame
info.max_samples_per_frame = (UINT64(info.rate) * 1000000 + info.fps_times_1million - 1) / info.fps_times_1million;
info.bytes_per_frame = avhuff_encoder::raw_data_size(info.width, info.height, info.channels, info.max_samples_per_frame);
-
+
// process hunk size
UINT32 hunk_size = output_parent.opened() ? output_parent.hunk_bytes() : info.bytes_per_frame;
parse_hunk_size(params, info.bytes_per_frame, hunk_size);
-
+
// process compression
chd_codec_type compression[4];
memcpy(compression, s_default_ld_compression, sizeof(compression));
@@ -1932,7 +1932,7 @@ static void do_create_ld(parameters_t &params)
// create the compressor and then run it generically
compress_common(chd);
-
+
// write the final LD metadata
if (info.height == 524/2 || info.height == 624/2)
{
@@ -1972,13 +1972,13 @@ static void do_copy(parameters_t &params)
// process output CHD
chd_file output_parent;
astring *output_chd_str = parse_output_chd_parameters(params, output_parent);
-
+
// process hunk size
UINT32 hunk_size = input_chd.hunk_bytes();
parse_hunk_size(params, 1, hunk_size);
if (hunk_size % input_chd.hunk_bytes() != 0 && input_chd.hunk_bytes() % hunk_size != 0)
report_error(1, "Hunk size is not an even multiple or divisor of input hunk size");
-
+
// process compression; we default to our current preferences using metadata to pick the type
chd_codec_type compression[4];
{
@@ -2041,13 +2041,13 @@ static void do_copy(parameters_t &params)
redo_cd = true;
continue;
}
-
+
// otherwise, clone it
err = chd.write_metadata(metatag, CHDMETAINDEX_APPEND, metadata);
if (err != CHDERR_NONE)
report_error(1, "Error writing cloned metadata: %s", chd_file::error_string(err));
}
-
+
// if we need to re-do the CD metadata, do it now
if (redo_cd)
{
@@ -2059,7 +2059,7 @@ static void do_copy(parameters_t &params)
if (err != CHDERR_NONE)
report_error(1, "Error writing upgraded CD metadata: %s", chd_file::error_string(err));
}
-
+
// compress it generically
compress_common(chd);
}
@@ -2090,12 +2090,12 @@ static void do_extract_raw(parameters_t &params)
UINT64 input_start;
UINT64 input_end;
parse_input_start_end(params, input_chd.logical_bytes(), input_chd.hunk_bytes(), input_chd.hunk_bytes(), input_start, input_end);
-
+
// verify output file doesn't exist
astring *output_file_str = params.find(OPTION_OUTPUT);
if (output_file_str != NULL)
check_existing_output_file(params, *output_file_str);
-
+
// print some info
astring tempstr;
printf("Output File: %s\n", output_file_str->cstr());
@@ -2126,7 +2126,7 @@ static void do_extract_raw(parameters_t &params)
chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read);
if (err != CHDERR_NONE)
report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err));
-
+
// write to the output
UINT32 count = core_fwrite(output_file, buffer, bytes_to_read);
if (count != bytes_to_read)
@@ -2135,7 +2135,7 @@ static void do_extract_raw(parameters_t &params)
// advance
offset += bytes_to_read;
}
-
+
// finish up
core_fclose(output_file);
printf("Extraction complete \n");
@@ -2170,7 +2170,7 @@ static void do_extract_cd(parameters_t &params)
if (cdrom == NULL)
report_error(1, "Unable to recognize CHD file as a CD");
const cdrom_toc *toc = cdrom_get_toc(cdrom);
-
+
// verify output file doesn't exist
astring *output_file_str = params.find(OPTION_OUTPUT);
if (output_file_str != NULL)
@@ -2186,7 +2186,7 @@ static void do_extract_cd(parameters_t &params)
if (output_bin_file_str == NULL)
output_bin_file_str = &default_name;
check_existing_output_file(params, *output_bin_file_str);
-
+
// print some info
astring tempstr;
printf("Output TOC: %s\n", output_file_str->cstr());
@@ -2213,7 +2213,7 @@ static void do_extract_cd(parameters_t &params)
UINT64 total_bytes = 0;
for (int tracknum = 0; tracknum < toc->numtrks; tracknum++)
total_bytes += toc->tracks[tracknum].frames * (toc->tracks[tracknum].datasize + toc->tracks[tracknum].subsize);
-
+
// iterate over tracks and copy all data
UINT64 outputoffs = 0;
UINT32 discoffs = 0;
@@ -2227,7 +2227,7 @@ static void do_extract_cd(parameters_t &params)
// resize the buffer for the track
UINT32 output_frame_size = trackinfo.datasize + ((trackinfo.subtype != CD_SUB_NONE) ? trackinfo.subsize : 0);
buffer.resize((TEMP_BUFFER_SIZE / output_frame_size) * output_frame_size);
-
+
// now read and output the actual data
UINT32 bufferoffs = 0;
for (int frame = 0; frame < trackinfo.frames; frame++)
@@ -2267,7 +2267,7 @@ static void do_extract_cd(parameters_t &params)
}
}
}
-
+
// finish up
core_fclose(output_bin_file);
core_fclose(output_toc_file);
@@ -2328,7 +2328,7 @@ static void do_extract_ld(parameters_t &params)
frame_bytes = avhuff_encoder::raw_data_size(width, height, channels, max_samples_per_frame);
if (frame_bytes != input_chd.hunk_bytes())
report_error(1, "Frame size does not match hunk size for this CHD");
-
+
// parse out input start/end
UINT64 input_start;
UINT64 input_end;
@@ -2386,7 +2386,7 @@ static void do_extract_ld(parameters_t &params)
audio_data[chnum].resize(max_samples_per_frame);
avconfig.audio[chnum] = audio_data[chnum];
}
-
+
// iterate over frames
bitmap_yuy16 fullbitmap(width, height * interlace_factor);
for (int framenum = input_start; framenum < input_end; framenum++)
@@ -2396,7 +2396,7 @@ static void do_extract_ld(parameters_t &params)
// set up the fake bitmap for this frame
avconfig.video.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor);
input_chd.codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig);
-
+
// read the hunk into the buffers
chd_error err = input_chd.read_hunk(framenum, NULL);
if (err != CHDERR_NONE)
@@ -2454,13 +2454,13 @@ static void do_add_metadata(parameters_t &params)
tag_str->cat(" ");
tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]);
}
-
+
// process index
UINT32 index = 0;
astring *index_str = params.find(OPTION_INDEX);
if (index_str != NULL)
index = atoi(*index_str);
-
+
// process text input
astring *text_str = params.find(OPTION_VALUE_TEXT);
astring text;
@@ -2470,7 +2470,7 @@ static void do_add_metadata(parameters_t &params)
if (text[0] == '"' && text[text.len() - 1] == '"')
text.substr(1, text.len() - 2);
}
-
+
// process file input
astring *file_str = params.find(OPTION_VALUE_FILE);
dynamic_buffer file;
@@ -2480,18 +2480,18 @@ static void do_add_metadata(parameters_t &params)
if (filerr != FILERR_NONE)
report_error(1, "Error reading metadata file (%s)", file_str->cstr());
}
-
+
// make sure we have one or the other
if (text_str == NULL && file_str == NULL)
report_error(1, "Error: missing either --valuetext/-vt or --valuefile/-vf parameters");
if (text_str != NULL && file_str != NULL)
report_error(1, "Error: both --valuetext/-vt or --valuefile/-vf parameters specified; only one permitted");
-
+
// process no checksum
UINT8 flags = CHD_MDFLAGS_CHECKSUM;
if (params.find(OPTION_NO_CHECKSUM) != NULL)
flags &= ~CHD_MDFLAGS_CHECKSUM;
-
+
// print some info
astring tempstr;
printf("Input file: %s\n", params.find(OPTION_INPUT)->cstr());
@@ -2516,7 +2516,7 @@ static void do_add_metadata(parameters_t &params)
//-------------------------------------------------
-// do_del_metadata - remove metadata from a CHD
+// do_del_metadata - remove metadata from a CHD
//-------------------------------------------------
static void do_del_metadata(parameters_t &params)
@@ -2534,13 +2534,13 @@ static void do_del_metadata(parameters_t &params)
tag_str->cat(" ");
tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]);
}
-
+
// process index
UINT32 index = 0;
astring *index_str = params.find(OPTION_INDEX);
if (index_str != NULL)
index = atoi(*index_str);
-
+
// print some info
astring tempstr;
printf("Input file: %s\n", params.find(OPTION_INPUT)->cstr());
@@ -2578,13 +2578,13 @@ int CLIB_DECL main(int argc, char *argv[])
return print_help(argv[0]);
command = argv[argnum++];
}
-
+
// iterate over commands to find our match
for (int cmdnum = 0; cmdnum < ARRAY_LENGTH(s_commands); cmdnum++)
if (strcmp(command, s_commands[cmdnum].name) == 0)
{
const command_description &desc = s_commands[cmdnum];
-
+
// print help if that was requested
if (help)
return print_help(argv[0], desc);
@@ -2629,7 +2629,7 @@ int CLIB_DECL main(int argc, char *argv[])
return print_help(argv[0], desc, "Option is missing parameter");
param = argv[argnum++];
}
-
+
// add to the map
if (parameters.add(odesc.name, new astring(param)) == TMERR_DUPLICATE)
return print_help(argv[0], desc, "Multiple parameters of the same type specified");
@@ -2641,7 +2641,7 @@ int CLIB_DECL main(int argc, char *argv[])
if (valid == ARRAY_LENGTH(desc.valid_options))
return print_help(argv[0], desc, "Option not valid for this command");
}
-
+
// make sure we got all our required parameters
for (int valid = 0; valid < ARRAY_LENGTH(desc.valid_options); valid++)
{
@@ -2651,7 +2651,7 @@ int CLIB_DECL main(int argc, char *argv[])
if (*validname == REQUIRED[0] && parameters.find(++validname) == NULL)
return print_help(argv[0], desc, "Required parameters missing");
}
-
+
// all clear, run the command
try
{
@@ -2673,7 +2673,7 @@ int CLIB_DECL main(int argc, char *argv[])
return 1;
}
}
-
+
// print generic help if nothing found
return print_help(argv[0]);
}
diff --git a/src/version.c b/src/version.c
index fd5b8478480..935f0121e4f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -38,4 +38,4 @@
***************************************************************************/
extern const char build_version[];
-const char build_version[] = "0.145 ("__DATE__")";
+const char build_version[] = "0.145u1 ("__DATE__")";