summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2012-04-08 14:12:02 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2012-04-08 14:12:02 +0000
commit35e09dd41cd03aff312a57959b893d3f6a028667 (patch)
tree8f3722f6d0de9c0df55b8fc84c939316460b692e /src/lib
parent8d66a9445a44da9438637aa17f3cd421564c8f5a (diff)
Clean-ups and version bumpmame0145u6
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/cdrom.c28
-rw-r--r--src/lib/util/chdcodec.c16
2 files changed, 22 insertions, 22 deletions
diff --git a/src/lib/util/cdrom.c b/src/lib/util/cdrom.c
index 5974373803e..8515ee7d182 100644
--- a/src/lib/util/cdrom.c
+++ b/src/lib/util/cdrom.c
@@ -72,7 +72,7 @@ void CLIB_DECL logerror(const char *text,...);
const int SYNC_OFFSET = 0x000; // offset within sector
const int SYNC_NUM_BYTES = 12; // 12 bytes
-const int MODE_OFFSET = 0x00f; // offset within sector
+const int MODE_OFFSET = 0x00f; // offset within sector
const int ECC_P_OFFSET = 0x81c; // offset within sector
const int ECC_P_NUM_BYTES = 86; // 2 lots of 86
@@ -897,7 +897,7 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc)
//-------------------------------------------------
// ECC lookup tables
-// pre-calculated tables for ECC data calcs
+// pre-calculated tables for ECC data calcs
//-------------------------------------------------
static const UINT8 ecclow[256] =
@@ -942,10 +942,10 @@ static const UINT8 ecchigh[256] =
//-------------------------------------------------
-// poffsets - each row represents the addresses
+// poffsets - each row represents the addresses
// used to calculate a byte of the ECC P data
-// 86 (*2) ECC P bytes, 24 values represented by
-// each
+// 86 (*2) ECC P bytes, 24 values represented by
+// each
//-------------------------------------------------
static const UINT16 poffsets[ECC_P_NUM_BYTES][ECC_P_COMP] =
@@ -1040,10 +1040,10 @@ static const UINT16 poffsets[ECC_P_NUM_BYTES][ECC_P_COMP] =
//-------------------------------------------------
-// qoffsets - each row represents the addresses
+// qoffsets - each row represents the addresses
// used to calculate a byte of the ECC Q data
-// 52 (*2) ECC Q bytes, 43 values represented by
-// each
+// 52 (*2) ECC Q bytes, 43 values represented by
+// each
//-------------------------------------------------
static const UINT16 qoffsets[ECC_Q_NUM_BYTES][ECC_Q_COMP] =
@@ -1105,7 +1105,7 @@ static const UINT16 qoffsets[ECC_Q_NUM_BYTES][ECC_Q_COMP] =
//-------------------------------------------------
// ecc_source_byte - return data from the sector
-// at the given offset, masking anything
+// at the given offset, masking anything
// particular to a mode
//-------------------------------------------------
@@ -1117,7 +1117,7 @@ inline UINT8 ecc_source_byte(const UINT8 *sector, UINT32 offset)
//-------------------------------------------------
-// ecc_compute_bytes - calculate an ECC value
+// ecc_compute_bytes - calculate an ECC value
// (P or Q)
//-------------------------------------------------
@@ -1150,7 +1150,7 @@ bool ecc_verify(const UINT8 *sector)
if (sector[ECC_P_OFFSET + byte] != val1 || sector[ECC_P_OFFSET + ECC_P_NUM_BYTES + byte] != val2)
return false;
}
-
+
// then verify Q bytes
for (int byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
{
@@ -1164,7 +1164,7 @@ bool ecc_verify(const UINT8 *sector)
//-------------------------------------------------
-// ecc_generate - generate the P and Q ECC codes
+// ecc_generate - generate the P and Q ECC codes
// for a sector, overwriting any existing codes
//-------------------------------------------------
@@ -1173,7 +1173,7 @@ void ecc_generate(UINT8 *sector)
// first verify P bytes
for (int byte = 0; byte < ECC_P_NUM_BYTES; byte++)
ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, sector[ECC_P_OFFSET + byte], sector[ECC_P_OFFSET + ECC_P_NUM_BYTES + byte]);
-
+
// then verify Q bytes
for (int byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, sector[ECC_Q_OFFSET + byte], sector[ECC_Q_OFFSET + ECC_Q_NUM_BYTES + byte]);
@@ -1182,7 +1182,7 @@ void ecc_generate(UINT8 *sector)
//-------------------------------------------------
// ecc_clear - erase the ECC P and Q cods to 0
-// within a sector
+// within a sector
//-------------------------------------------------
void ecc_clear(UINT8 *sector)
diff --git a/src/lib/util/chdcodec.c b/src/lib/util/chdcodec.c
index f9212f27d5e..0ae3b91ed62 100644
--- a/src/lib/util/chdcodec.c
+++ b/src/lib/util/chdcodec.c
@@ -55,8 +55,8 @@ extern "C" SRes LzmaDec_Allocate_MAME(CLzmaDec *p, const CLzmaProps *propNew, IS
// GLOBAL VARIABLES
//**************************************************************************
-static const UINT8 s_cd_sync_header[12] = { 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00 };
-
+static const UINT8 s_cd_sync_header[12] = { 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00 };
+
//**************************************************************************
@@ -342,10 +342,10 @@ public:
UINT32 complen_bytes = (srclen < 65536) ? 2 : 3;
UINT32 ecc_bytes = (frames + 7) / 8;
UINT32 header_bytes = ecc_bytes + complen_bytes;
-
+
// clear out destination header
memset(dest, 0, header_bytes);
-
+
// copy audio data followed by subcode data
for (UINT32 framenum = 0; framenum < frames; framenum++)
{
@@ -361,12 +361,12 @@ public:
ecc_clear(sector);
}
}
-
+
// encode the base portion
UINT32 complen = m_base_compressor.compress(&m_buffer[0], frames * CD_MAX_SECTOR_DATA, &dest[header_bytes]);
if (complen >= srclen)
throw CHDERR_COMPRESSION_ERROR;
-
+
// write compressed length
dest[ecc_bytes + 0] = complen >> ((complen_bytes - 1) * 8);
dest[ecc_bytes + 1] = complen >> ((complen_bytes - 2) * 8);
@@ -411,12 +411,12 @@ public:
UINT32 complen_bytes = (destlen < 65536) ? 2 : 3;
UINT32 ecc_bytes = (frames + 7) / 8;
UINT32 header_bytes = ecc_bytes + complen_bytes;
-
+
// extract compressed length of base
UINT32 complen_base = (src[ecc_bytes + 0] << 8) | src[ecc_bytes + 1];
if (complen_bytes > 2)
complen_base = (complen_base << 8) | src[ecc_bytes + 2];
-
+
// reset and decode
m_base_decompressor.decompress(&src[header_bytes], complen_base, &m_buffer[0], frames * CD_MAX_SECTOR_DATA);
m_subcode_decompressor.decompress(&src[header_bytes + complen_base], complen - complen_base - header_bytes, &m_buffer[frames * CD_MAX_SECTOR_DATA], frames * CD_MAX_SUBCODE_DATA);