summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/formats/2d_dsk.h6
-rw-r--r--src/lib/formats/a26_cas.cpp4
-rw-r--r--src/lib/formats/a5105_dsk.h6
-rw-r--r--src/lib/formats/abc800_dsk.h6
-rw-r--r--src/lib/formats/abcfd2_dsk.h6
-rw-r--r--src/lib/formats/ace_tap.cpp10
-rw-r--r--src/lib/formats/adam_cas.cpp4
-rw-r--r--src/lib/formats/adam_dsk.h6
-rw-r--r--src/lib/formats/ami_dsk.h16
-rw-r--r--src/lib/formats/ap2_dsk.cpp42
-rw-r--r--src/lib/formats/ap2_dsk.h40
-rw-r--r--src/lib/formats/ap_dsk35.cpp22
-rw-r--r--src/lib/formats/ap_dsk35.h16
-rw-r--r--src/lib/formats/apf_apt.cpp8
-rw-r--r--src/lib/formats/apollo_dsk.h8
-rw-r--r--src/lib/formats/applix_dsk.h6
-rw-r--r--src/lib/formats/apridisk.h16
-rw-r--r--src/lib/formats/asst128_dsk.h6
-rw-r--r--src/lib/formats/atari_dsk.cpp4
-rw-r--r--src/lib/formats/atom_dsk.h6
-rw-r--r--src/lib/formats/atom_tap.cpp2
-rw-r--r--src/lib/formats/basicdsk.cpp6
-rw-r--r--src/lib/formats/bbc_dsk.h46
-rw-r--r--src/lib/formats/bw12_dsk.h6
-rw-r--r--src/lib/formats/bw2_dsk.h6
-rw-r--r--src/lib/formats/c3040_dsk.h14
-rw-r--r--src/lib/formats/c4040_dsk.h12
-rw-r--r--src/lib/formats/c8280_dsk.h6
-rw-r--r--src/lib/formats/camplynx_cas.cpp6
-rw-r--r--src/lib/formats/camplynx_dsk.h6
-rw-r--r--src/lib/formats/cassimg.cpp26
-rw-r--r--src/lib/formats/cbm_tap.cpp12
-rw-r--r--src/lib/formats/ccvf_dsk.cpp2
-rw-r--r--src/lib/formats/ccvf_dsk.h12
-rw-r--r--src/lib/formats/cd90_640_dsk.h6
-rw-r--r--src/lib/formats/cgen_cas.cpp4
-rw-r--r--src/lib/formats/cgenie_dsk.h10
-rw-r--r--src/lib/formats/coco_cas.cpp4
-rw-r--r--src/lib/formats/comx35_dsk.h6
-rw-r--r--src/lib/formats/concept_dsk.h16
-rw-r--r--src/lib/formats/coupedsk.h16
-rw-r--r--src/lib/formats/cpis_dsk.h6
-rw-r--r--src/lib/formats/cqm_dsk.cpp2
-rw-r--r--src/lib/formats/cqm_dsk.h16
-rw-r--r--src/lib/formats/csw_cas.cpp14
-rw-r--r--src/lib/formats/d64_dsk.cpp2
-rw-r--r--src/lib/formats/d64_dsk.h16
-rw-r--r--src/lib/formats/d71_dsk.h6
-rw-r--r--src/lib/formats/d80_dsk.cpp4
-rw-r--r--src/lib/formats/d80_dsk.h18
-rw-r--r--src/lib/formats/d81_dsk.h8
-rw-r--r--src/lib/formats/d82_dsk.h6
-rw-r--r--src/lib/formats/d88_dsk.cpp4
-rw-r--r--src/lib/formats/d88_dsk.h16
-rw-r--r--src/lib/formats/dcp_dsk.cpp2
-rw-r--r--src/lib/formats/dcp_dsk.h12
-rw-r--r--src/lib/formats/dfi_dsk.h12
-rw-r--r--src/lib/formats/dim_dsk.h16
-rw-r--r--src/lib/formats/dip_dsk.cpp2
-rw-r--r--src/lib/formats/dip_dsk.h12
-rw-r--r--src/lib/formats/dmk_dsk.h16
-rw-r--r--src/lib/formats/dmv_dsk.h6
-rw-r--r--src/lib/formats/dsk_dsk.cpp6
-rw-r--r--src/lib/formats/dsk_dsk.h12
-rw-r--r--src/lib/formats/ep64_dsk.h6
-rw-r--r--src/lib/formats/esq16_dsk.h16
-rw-r--r--src/lib/formats/esq8_dsk.h16
-rw-r--r--src/lib/formats/excali64_dsk.h6
-rw-r--r--src/lib/formats/fc100_cas.cpp4
-rw-r--r--src/lib/formats/fdd_dsk.h12
-rw-r--r--src/lib/formats/fdi_dsk.cpp2
-rw-r--r--src/lib/formats/flex_dsk.h12
-rw-r--r--src/lib/formats/flopimg.cpp58
-rw-r--r--src/lib/formats/flopimg.h8
-rw-r--r--src/lib/formats/fm7_cas.cpp4
-rw-r--r--src/lib/formats/fmsx_cas.cpp2
-rw-r--r--src/lib/formats/fmtowns_dsk.h6
-rw-r--r--src/lib/formats/fsd_dsk.cpp180
-rw-r--r--src/lib/formats/fsd_dsk.h43
-rw-r--r--src/lib/formats/g64_dsk.cpp2
-rw-r--r--src/lib/formats/g64_dsk.h16
-rw-r--r--src/lib/formats/gtp_cas.cpp8
-rw-r--r--src/lib/formats/guab_dsk.h6
-rw-r--r--src/lib/formats/hect_dsk.cpp6
-rw-r--r--src/lib/formats/hect_tap.cpp14
-rw-r--r--src/lib/formats/hector_minidisc.h6
-rw-r--r--src/lib/formats/hxcmfm_dsk.h16
-rw-r--r--src/lib/formats/imageutl.cpp2
-rw-r--r--src/lib/formats/imageutl.h8
-rw-r--r--src/lib/formats/imd_dsk.cpp12
-rw-r--r--src/lib/formats/imd_dsk.h12
-rw-r--r--src/lib/formats/ioprocs.cpp4
-rw-r--r--src/lib/formats/ipf_dsk.cpp9
-rw-r--r--src/lib/formats/ipf_dsk.h12
-rw-r--r--src/lib/formats/iq151_dsk.h6
-rw-r--r--src/lib/formats/itt3030_dsk.h6
-rw-r--r--src/lib/formats/jvc_dsk.h16
-rw-r--r--src/lib/formats/kaypro_dsk.h12
-rw-r--r--src/lib/formats/kc85_dsk.h6
-rw-r--r--src/lib/formats/kc_cas.cpp18
-rw-r--r--src/lib/formats/kim1_cas.cpp8
-rw-r--r--src/lib/formats/lviv_lvt.cpp2
-rw-r--r--src/lib/formats/m20_dsk.h16
-rw-r--r--src/lib/formats/m5_dsk.h6
-rw-r--r--src/lib/formats/mbee_cas.cpp4
-rw-r--r--src/lib/formats/mfi_dsk.cpp4
-rw-r--r--src/lib/formats/mfi_dsk.h16
-rw-r--r--src/lib/formats/mfm_hd.h19
-rw-r--r--src/lib/formats/mm_dsk.h12
-rw-r--r--src/lib/formats/msx_dsk.h6
-rw-r--r--src/lib/formats/mz_cas.cpp4
-rw-r--r--src/lib/formats/nanos_dsk.h6
-rw-r--r--src/lib/formats/nascom_dsk.h6
-rw-r--r--src/lib/formats/naslite_dsk.h8
-rw-r--r--src/lib/formats/nes_dsk.cpp4
-rw-r--r--src/lib/formats/nfd_dsk.h12
-rw-r--r--src/lib/formats/orao_cas.cpp8
-rw-r--r--src/lib/formats/oric_dsk.h16
-rw-r--r--src/lib/formats/oric_tap.cpp2
-rw-r--r--src/lib/formats/p6001_cas.cpp4
-rw-r--r--src/lib/formats/pasti_dsk.cpp8
-rw-r--r--src/lib/formats/pasti_dsk.h12
-rw-r--r--src/lib/formats/pc98_dsk.h6
-rw-r--r--src/lib/formats/pc98fdi_dsk.cpp2
-rw-r--r--src/lib/formats/pc98fdi_dsk.h12
-rw-r--r--src/lib/formats/pc_dsk.cpp2
-rw-r--r--src/lib/formats/pc_dsk.h6
-rw-r--r--src/lib/formats/phc25_cas.cpp4
-rw-r--r--src/lib/formats/pk8020_dsk.h6
-rw-r--r--src/lib/formats/pmd_cas.cpp4
-rw-r--r--src/lib/formats/primoptp.cpp2
-rw-r--r--src/lib/formats/pyldin_dsk.h6
-rw-r--r--src/lib/formats/ql_dsk.h6
-rw-r--r--src/lib/formats/rk_cas.cpp18
-rw-r--r--src/lib/formats/rx50_dsk.h16
-rw-r--r--src/lib/formats/sc3000_bit.cpp2
-rw-r--r--src/lib/formats/sf7000_dsk.h6
-rw-r--r--src/lib/formats/smx_dsk.h6
-rw-r--r--src/lib/formats/sol_cas.cpp4
-rw-r--r--src/lib/formats/sorc_cas.cpp4
-rw-r--r--src/lib/formats/sorc_dsk.cpp4
-rw-r--r--src/lib/formats/sord_cas.cpp2
-rw-r--r--src/lib/formats/spc1000_cas.cpp8
-rw-r--r--src/lib/formats/st_dsk.h28
-rw-r--r--src/lib/formats/svi_cas.cpp2
-rw-r--r--src/lib/formats/svi_dsk.h16
-rw-r--r--src/lib/formats/tandy2k_dsk.h6
-rw-r--r--src/lib/formats/td0_dsk.cpp14
-rw-r--r--src/lib/formats/td0_dsk.h14
-rw-r--r--src/lib/formats/thom_cas.cpp12
-rw-r--r--src/lib/formats/thom_dsk.cpp14
-rw-r--r--src/lib/formats/ti99_dsk.h43
-rw-r--r--src/lib/formats/tiki100_dsk.h6
-rw-r--r--src/lib/formats/trd_dsk.h6
-rw-r--r--src/lib/formats/trs80_dsk.h8
-rw-r--r--src/lib/formats/trs_cas.cpp6
-rw-r--r--src/lib/formats/tvc_cas.cpp2
-rw-r--r--src/lib/formats/tvc_dsk.h6
-rw-r--r--src/lib/formats/tzx_cas.cpp38
-rw-r--r--src/lib/formats/uef_cas.cpp18
-rw-r--r--src/lib/formats/upd765_dsk.cpp4
-rw-r--r--src/lib/formats/upd765_dsk.h10
-rw-r--r--src/lib/formats/vdk_dsk.h16
-rw-r--r--src/lib/formats/vector06_dsk.h6
-rw-r--r--src/lib/formats/vg5k_cas.cpp14
-rw-r--r--src/lib/formats/victor9k_dsk.h16
-rw-r--r--src/lib/formats/vt_cas.cpp8
-rw-r--r--src/lib/formats/wd177x_dsk.cpp2
-rw-r--r--src/lib/formats/wd177x_dsk.h8
-rw-r--r--src/lib/formats/x07_cas.cpp4
-rw-r--r--src/lib/formats/x1_tap.cpp2
-rw-r--r--src/lib/formats/xdf_dsk.h6
-rw-r--r--src/lib/formats/zx81_p.cpp4
-rw-r--r--src/lib/netlist/analog/nld_bjt.h22
-rw-r--r--src/lib/netlist/analog/nld_fourterm.h30
-rw-r--r--src/lib/netlist/analog/nld_twoterm.h40
-rw-r--r--src/lib/netlist/devices/nld_cmos.h6
-rw-r--r--src/lib/netlist/devices/nld_signal.h10
-rw-r--r--src/lib/netlist/devices/nld_system.h58
-rw-r--r--src/lib/netlist/devices/nld_truthtable.h12
-rw-r--r--src/lib/netlist/nl_base.cpp4
-rw-r--r--src/lib/netlist/nl_base.h72
-rw-r--r--src/lib/netlist/nl_factory.h2
-rw-r--r--src/lib/netlist/nl_parser.h2
-rw-r--r--src/lib/netlist/nl_setup.cpp2
-rw-r--r--src/lib/netlist/nl_setup.h8
-rw-r--r--src/lib/netlist/plib/pfmtlog.h4
-rw-r--r--src/lib/netlist/plib/poptions.h8
-rw-r--r--src/lib/netlist/plib/pstream.h32
-rw-r--r--src/lib/netlist/prg/nltool.cpp2
-rw-r--r--src/lib/netlist/solver/nld_ms_direct.h8
-rw-r--r--src/lib/netlist/solver/nld_ms_direct1.h2
-rw-r--r--src/lib/netlist/solver/nld_ms_direct2.h2
-rw-r--r--src/lib/netlist/solver/nld_ms_direct_lu.h8
-rw-r--r--src/lib/netlist/solver/nld_ms_gmres.h4
-rw-r--r--src/lib/netlist/solver/nld_ms_sor.h4
-rw-r--r--src/lib/netlist/solver/nld_ms_sor_mat.h4
-rw-r--r--src/lib/netlist/solver/nld_solver.h16
-rw-r--r--src/lib/netlist/tools/nl_convert.h6
-rw-r--r--src/lib/util/avhuff.cpp20
-rw-r--r--src/lib/util/avhuff.h8
-rw-r--r--src/lib/util/aviio.cpp176
-rw-r--r--src/lib/util/bitmap.cpp24
-rw-r--r--src/lib/util/bitmap.h2
-rw-r--r--src/lib/util/cdrom.cpp56
-rw-r--r--src/lib/util/cdrom.h6
-rw-r--r--src/lib/util/chd.cpp114
-rw-r--r--src/lib/util/chd.h16
-rw-r--r--src/lib/util/chdcd.cpp30
-rw-r--r--src/lib/util/chdcd.h2
-rw-r--r--src/lib/util/chdcodec.cpp80
-rw-r--r--src/lib/util/chdcodec.h2
-rw-r--r--src/lib/util/corealloc.cpp70
-rw-r--r--src/lib/util/corefile.cpp54
-rw-r--r--src/lib/util/corestr.cpp14
-rw-r--r--src/lib/util/coretmpl.h89
-rw-r--r--src/lib/util/cstrpool.cpp12
-rw-r--r--src/lib/util/delegate.h104
-rw-r--r--src/lib/util/flac.cpp48
-rw-r--r--src/lib/util/flac.h4
-rw-r--r--src/lib/util/harddisk.cpp12
-rw-r--r--src/lib/util/hashing.cpp16
-rw-r--r--src/lib/util/huffman.cpp4
-rw-r--r--src/lib/util/huffman.h4
-rw-r--r--src/lib/util/jedparse.h4
-rw-r--r--src/lib/util/md5.cpp2
-rw-r--r--src/lib/util/opresolv.cpp34
-rw-r--r--src/lib/util/options.cpp116
-rw-r--r--src/lib/util/options.h12
-rw-r--r--src/lib/util/palette.cpp14
-rw-r--r--src/lib/util/png.cpp106
-rw-r--r--src/lib/util/pool.cpp70
-rw-r--r--src/lib/util/tagmap.cpp20
-rw-r--r--src/lib/util/tagmap.h266
-rw-r--r--src/lib/util/un7z.cpp48
-rw-r--r--src/lib/util/unicode.cpp4
-rw-r--r--src/lib/util/unzip.cpp52
-rw-r--r--src/lib/util/vbiparse.cpp2
-rw-r--r--src/lib/util/xmlfile.cpp144
-rw-r--r--src/lib/util/zippath.cpp104
240 files changed, 2110 insertions, 2119 deletions
diff --git a/src/lib/formats/2d_dsk.h b/src/lib/formats/2d_dsk.h
index ab70b95f21a..95ee8dbbf20 100644
--- a/src/lib/formats/2d_dsk.h
+++ b/src/lib/formats/2d_dsk.h
@@ -20,9 +20,9 @@ class _2d_format : public wd177x_format
public:
_2d_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/a26_cas.cpp b/src/lib/formats/a26_cas.cpp
index 557a128a7af..d13b5270b45 100644
--- a/src/lib/formats/a26_cas.cpp
+++ b/src/lib/formats/a26_cas.cpp
@@ -129,7 +129,7 @@ static int a26_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
}
static int a26_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
- return a26_cas_do_work( NULL, casdata );
+ return a26_cas_do_work( nullptr, casdata );
}
static const struct CassetteLegacyWaveFiller a26_legacy_fill_wave = {
@@ -160,7 +160,7 @@ static const struct CassetteFormat a26_cassette_format = {
"a26",
a26_cassette_identify,
a26_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(a26_cassette_formats)
diff --git a/src/lib/formats/a5105_dsk.h b/src/lib/formats/a5105_dsk.h
index 6f987a81199..cfe7a2f6a0e 100644
--- a/src/lib/formats/a5105_dsk.h
+++ b/src/lib/formats/a5105_dsk.h
@@ -17,9 +17,9 @@ class a5105_format : public upd765_format {
public:
a5105_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/abc800_dsk.h b/src/lib/formats/abc800_dsk.h
index 96a15d3817e..28d5e5b01ad 100644
--- a/src/lib/formats/abc800_dsk.h
+++ b/src/lib/formats/abc800_dsk.h
@@ -17,9 +17,9 @@ class abc800_format : public wd177x_format {
public:
abc800_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/abcfd2_dsk.h b/src/lib/formats/abcfd2_dsk.h
index a97e46cb5ed..b9eacfb55ba 100644
--- a/src/lib/formats/abcfd2_dsk.h
+++ b/src/lib/formats/abcfd2_dsk.h
@@ -17,9 +17,9 @@ class abc_fd2_format : public wd177x_format {
public:
abc_fd2_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/ace_tap.cpp b/src/lib/formats/ace_tap.cpp
index 3479d6ba1f5..e247b0803d6 100644
--- a/src/lib/formats/ace_tap.cpp
+++ b/src/lib/formats/ace_tap.cpp
@@ -26,7 +26,7 @@ static int cas_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-INLINE int ace_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
+static inline int ace_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
{
int i = 0;
@@ -48,7 +48,7 @@ INLINE int ace_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
}
-INLINE int ace_tap_silence(INT16 *buffer, int sample_pos, int samples)
+static inline int ace_tap_silence(INT16 *buffer, int sample_pos, int samples)
{
int i = 0;
@@ -64,7 +64,7 @@ INLINE int ace_tap_silence(INT16 *buffer, int sample_pos, int samples)
}
-INLINE int ace_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int ace_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
{
int i, samples;
@@ -151,7 +151,7 @@ static int ace_tap_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen;
- return ace_handle_tap( NULL, casdata );
+ return ace_handle_tap( nullptr, casdata );
}
@@ -184,7 +184,7 @@ static const struct CassetteFormat ace_tap_format =
"tap",
ace_tap_identify,
ace_tap_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/adam_cas.cpp b/src/lib/formats/adam_cas.cpp
index 54d7427242d..644be2cd0cc 100644
--- a/src/lib/formats/adam_cas.cpp
+++ b/src/lib/formats/adam_cas.cpp
@@ -86,7 +86,7 @@ casserr_t coladam_put_byte(cassette_image *cass, int channel, double *time_index
casserr_t coladam_put_block(cassette_image *cass, int channel, double *time_index, int *prev_sign, int block_index, UINT8 *buffer, int layout_type)
{
int i, checksum_16=0;
- UINT8 header[] = { 0x16, 0x48, 0x45, 0x00, block_index, 0xff, (0xff - block_index), 0x00, 0x80, 0xf4 };
+ UINT8 header[] = { 0x16, 0x48, 0x45, 0x00, static_cast<UINT8>(block_index), 0xff, static_cast<UINT8>(0xff - block_index), 0x00, 0x80, 0xf4 };
casserr_t err;
if (layout_type == TYPE_GW)
{
@@ -204,7 +204,7 @@ static casserr_t coladam_ddp_load( cassette_image *cass )
static const struct CassetteFormat coladam_ddp =
-{ "ddp", coladam_ddp_identify, coladam_ddp_load, NULL /* no save */ };
+{ "ddp", coladam_ddp_identify, coladam_ddp_load, nullptr /* no save */ };
CASSETTE_FORMATLIST_START(coleco_adam_cassette_formats)
CASSETTE_FORMAT(coladam_ddp)
diff --git a/src/lib/formats/adam_dsk.h b/src/lib/formats/adam_dsk.h
index 717c81cbe7f..0f378edcb58 100644
--- a/src/lib/formats/adam_dsk.h
+++ b/src/lib/formats/adam_dsk.h
@@ -17,9 +17,9 @@ class adam_format : public wd177x_format {
public:
adam_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/ami_dsk.h b/src/lib/formats/ami_dsk.h
index 9ee86f059cc..f10ac007d71 100644
--- a/src/lib/formats/ami_dsk.h
+++ b/src/lib/formats/ami_dsk.h
@@ -18,14 +18,14 @@ class adf_format : public floppy_image_format_t
public:
adf_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
private:
static UINT32 g32(const UINT8 *trackbuf, int track_size, int pos);
diff --git a/src/lib/formats/ap2_dsk.cpp b/src/lib/formats/ap2_dsk.cpp
index 885332882f9..774d4785735 100644
--- a/src/lib/formats/ap2_dsk.cpp
+++ b/src/lib/formats/ap2_dsk.cpp
@@ -232,7 +232,7 @@ static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, i
nibble = (UINT8 *)buffer;
nibble += sector * APPLE2_SMALL_NIBBLE_SIZE;
- disk_decode_nib(sector_buffer, nibble, NULL, NULL, NULL);
+ disk_decode_nib(sector_buffer, nibble, nullptr, nullptr, nullptr);
floppy_write_sector(floppy, head, track, sector, 0, sector_buffer, sizeof(sector_buffer), 0);
}
@@ -249,7 +249,7 @@ static FLOPPY_IDENTIFY(apple2_nib_identify)
{
UINT64 size;
size = floppy_image_size(floppy);
- *vote = (size == APPLE2_TRACK_COUNT * APPLE2_SECTOR_COUNT * APPLE2_NIBBLE_SIZE) ? 100 : 0;
+ *vote = ((size == APPLE2_TRACK_COUNT * APPLE2_SECTOR_COUNT * APPLE2_NIBBLE_SIZE) || (size == (APPLE2_TRACK_COUNT + 1) * APPLE2_SECTOR_COUNT * APPLE2_NIBBLE_SIZE)) ? 100 : 0;
return FLOPPY_ERROR_SUCCESS;
}
@@ -264,7 +264,7 @@ static FLOPPY_CONSTRUCT(apple2_nib_construct)
static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
{
- if ((head != 0) || (track < 0) || (track >= APPLE2_TRACK_COUNT))
+ if ((head != 0) || (track < 0) || (track > APPLE2_TRACK_COUNT))
return FLOPPY_ERROR_SEEKERROR;
if (offset != 0)
return FLOPPY_ERROR_UNSUPPORTED;
@@ -276,7 +276,7 @@ static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, in
static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen)
{
- if ((head != 0) || (track < 0) || (track >= APPLE2_TRACK_COUNT))
+ if ((head != 0) || (track < 0) || (track > APPLE2_TRACK_COUNT))
return FLOPPY_ERROR_SEEKERROR;
if (offset != 0)
return FLOPPY_ERROR_UNSUPPORTED;
@@ -376,14 +376,14 @@ static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, i
if (buflen != APPLE2_SECTOR_SIZE)
return FLOPPY_ERROR_INTERNAL;
- err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, NULL);
+ err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, nullptr);
if (err)
return err;
track_data = (UINT8 *) track_data_v;
nibble = track_data + (sector * APPLE2_NIBBLE_SIZE);
- if (disk_decode_nib((UINT8 *)buffer, nibble, NULL, NULL, NULL))
+ if (disk_decode_nib((UINT8 *)buffer, nibble, nullptr, nullptr, nullptr))
return FLOPPY_ERROR_INVALIDIMAGE;
return FLOPPY_ERROR_SUCCESS;
@@ -465,7 +465,7 @@ static floperr_t apple2_nib_write_sector(floppy_image_legacy *floppy, int head,
if (buflen != APPLE2_SECTOR_SIZE)
return FLOPPY_ERROR_INTERNAL;
- err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, NULL);
+ err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, nullptr);
if (err)
return err;
track_data = (UINT8 *) track_data_v;
@@ -494,19 +494,19 @@ static UINT32 apple2_get_track_size(floppy_image_legacy *floppy, int head, int t
/* ----------------------------------------------------------------------- */
LEGACY_FLOPPY_OPTIONS_START( apple2 )
- LEGACY_FLOPPY_OPTION( apple2_do, "do,dsk,bin", "Apple ][ DOS order disk image", apple2_dsk_identify, apple2_do_construct, NULL,
+ LEGACY_FLOPPY_OPTION( apple2_do, "do,dsk,bin", "Apple ][ DOS order disk image", apple2_dsk_identify, apple2_do_construct, nullptr,
HEADS([1])
TRACKS([35])
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([0]))
- LEGACY_FLOPPY_OPTION( apple2_po, "po,dsk,bin", "Apple ][ ProDOS order disk image", apple2_dsk_identify, apple2_po_construct, NULL,
+ LEGACY_FLOPPY_OPTION( apple2_po, "po,dsk,bin", "Apple ][ ProDOS order disk image", apple2_dsk_identify, apple2_po_construct, nullptr,
HEADS([1])
TRACKS([35])
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([0]))
- LEGACY_FLOPPY_OPTION( apple2_nib, "dsk,nib", "Apple ][ Nibble order disk image", apple2_nib_identify, apple2_nib_construct, NULL,
+ LEGACY_FLOPPY_OPTION( apple2_nib, "dsk,nib", "Apple ][ Nibble order disk image", apple2_nib_identify, apple2_nib_construct, nullptr,
HEADS([1])
TRACKS([35])
SECTORS([16])
@@ -535,7 +535,7 @@ static const UINT8 prodos_skewing[] =
};
-a2_16sect_format::a2_16sect_format() : floppy_image_format_t()
+a2_16sect_format::a2_16sect_format() : floppy_image_format_t(), m_prodos_order(false)
{
}
@@ -774,9 +774,9 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
#define DATAGOOD 8
// data postamble is good
#define DATAPOST 16
- for (int i = 0; i < 16; i++) {
+ for (auto & elem : visualgrid) {
for (int j = 0; j < 35; j++) {
- visualgrid[i][j] = 0;
+ elem[j] = 0;
}
}
image->get_actual_geometry(g_tracks, g_heads);
@@ -822,8 +822,8 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
if(hb == 4) {
UINT8 h[11];
- for(int i=0; i<11; i++)
- h[i] = gb(buf, ts, pos, wrap);
+ for(auto & elem : h)
+ elem = gb(buf, ts, pos, wrap);
//UINT8 v2 = gcr6bw_tb[h[2]];
UINT8 vl = gcr4_decode(h[0],h[1]);
UINT8 tr = gcr4_decode(h[2],h[3]);
@@ -1140,9 +1140,9 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
#define DATAGOOD 8
// data postamble is good
#define DATAPOST 16
- for (int i = 0; i < 18; i++) {
+ for (auto & elem : visualgrid) {
for (int j = 0; j < 35; j++) {
- visualgrid[i][j] = 0;
+ elem[j] = 0;
}
}
image->get_actual_geometry(g_tracks, g_heads);
@@ -1182,8 +1182,8 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
if(hb == 4) {
UINT8 h[11];
- for(int i=0; i<11; i++)
- h[i] = gb(buf, ts, pos, wrap);
+ for(auto & elem : h)
+ elem = gb(buf, ts, pos, wrap);
//UINT8 v2 = gcr6bw_tb[h[2]];
UINT8 vl = gcr4_decode(h[0],h[1]);
UINT8 tr = gcr4_decode(h[2],h[3]);
@@ -1345,8 +1345,8 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
oldpos=pos;
UINT8 h[7];
// grab exactly 7 bytes: should be Track, Sector, Checksum, AA, FF and FF and the Br0derbund Title ID
- for(int i=0; i<7; i++)
- h[i] = gb(buf, ts, pos, wrap);
+ for(auto & elem : h)
+ elem = gb(buf, ts, pos, wrap);
UINT8 tr = gcr6bw_tb[h[0]];
UINT8 se = gcr6bw_tb[h[1]];
UINT8 chk = gcr6bw_tb[h[2]];
diff --git a/src/lib/formats/ap2_dsk.h b/src/lib/formats/ap2_dsk.h
index a5bd53f0926..19e55e05ff0 100644
--- a/src/lib/formats/ap2_dsk.h
+++ b/src/lib/formats/ap2_dsk.h
@@ -39,14 +39,14 @@ class a2_16sect_format : public floppy_image_format_t
public:
a2_16sect_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
private:
static const desc_e mac_gcr[];
@@ -64,14 +64,14 @@ class a2_rwts18_format : public floppy_image_format_t
public:
a2_rwts18_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
private:
static const desc_e mac_gcr[];
@@ -88,13 +88,13 @@ class a2_edd_format : public floppy_image_format_t
public:
a2_edd_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool supports_save() const override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static UINT8 pick(const UINT8 *data, int pos);
diff --git a/src/lib/formats/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp
index 9efd835120d..ff8cef2e08a 100644
--- a/src/lib/formats/ap_dsk35.cpp
+++ b/src/lib/formats/ap_dsk35.cpp
@@ -488,7 +488,7 @@ static UINT32 apple35_get_offset(floppy_image_legacy *floppy, int head, int trac
static floperr_t apple35_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
UINT32 data_offset;
- data_offset = apple35_get_offset(floppy, head, track, sector, NULL);
+ data_offset = apple35_get_offset(floppy, head, track, sector, nullptr);
if (data_offset == ~0)
{
return FLOPPY_ERROR_SEEKERROR;
@@ -503,7 +503,7 @@ static floperr_t apple35_write_sector(floppy_image_legacy *floppy, int head, int
{
UINT32 data_offset;
- data_offset = apple35_get_offset(floppy, head, track, sector, NULL);
+ data_offset = apple35_get_offset(floppy, head, track, sector, nullptr);
if (data_offset == ~0)
return FLOPPY_ERROR_SEEKERROR;
floppy_image_write(floppy, buffer, data_offset, buflen);
@@ -976,7 +976,7 @@ static floperr_t apple35_diskcopy_headerdecode(floppy_image_legacy *floppy, UINT
static FLOPPY_IDENTIFY(apple35_diskcopy_identify)
{
- *vote = apple35_diskcopy_headerdecode(floppy, NULL, NULL, NULL, NULL, NULL, NULL) ? 0 : 100;
+ *vote = apple35_diskcopy_headerdecode(floppy, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) ? 0 : 100;
return FLOPPY_ERROR_SUCCESS;
}
@@ -1121,7 +1121,7 @@ static floperr_t apple35_2img_decode(floppy_image_legacy *floppy, UINT32 *image_
static FLOPPY_IDENTIFY(apple35_2img_identify)
{
- *vote = apple35_2img_decode(floppy, NULL, NULL, NULL) ? 0 : 100;
+ *vote = apple35_2img_decode(floppy, nullptr, nullptr, nullptr) ? 0 : 100;
return FLOPPY_ERROR_SUCCESS;
}
@@ -1175,12 +1175,12 @@ static FLOPPY_CONSTRUCT(apple35_2img_construct)
LEGACY_FLOPPY_OPTIONS_START( apple35_mac )
- LEGACY_FLOPPY_OPTION( apple35_raw, "dsk,img,image", "Apple raw 3.5\" disk image", apple35_raw_identify, apple35_raw_construct, NULL,
+ LEGACY_FLOPPY_OPTION( apple35_raw, "dsk,img,image", "Apple raw 3.5\" disk image", apple35_raw_identify, apple35_raw_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])
FIRST_SECTOR_ID([0]))
- LEGACY_FLOPPY_OPTION( apple35_dc, "dc,dc42,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, NULL,
+ LEGACY_FLOPPY_OPTION( apple35_dc, "dc,dc42,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])
@@ -1188,17 +1188,17 @@ LEGACY_FLOPPY_OPTIONS_START( apple35_mac )
LEGACY_FLOPPY_OPTIONS_END
LEGACY_FLOPPY_OPTIONS_START( apple35_iigs )
- LEGACY_FLOPPY_OPTION( apple35_raw, "dsk,img,image,po", "Apple raw 3.5\" disk image", apple35_raw_identify, apple35_raw_construct, NULL,
+ LEGACY_FLOPPY_OPTION( apple35_raw, "dsk,img,image,po", "Apple raw 3.5\" disk image", apple35_raw_identify, apple35_raw_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])
FIRST_SECTOR_ID([0]))
- LEGACY_FLOPPY_OPTION( apple35_dc, "dc,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, NULL,
+ LEGACY_FLOPPY_OPTION( apple35_dc, "dc,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])
FIRST_SECTOR_ID([0]))
- LEGACY_FLOPPY_OPTION( apple35_2img, "2img,2mg", "Apple ][gs 2IMG disk image", apple35_2img_identify, apple35_2img_construct, NULL,
+ LEGACY_FLOPPY_OPTION( apple35_2img, "2img,2mg", "Apple ][gs 2IMG disk image", apple35_2img_identify, apple35_2img_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])
@@ -1410,8 +1410,8 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
if(hb == 4) {
UINT8 h[7];
- for(int i=0; i<7; i++)
- h[i] = gb(buf, ts, pos, wrap);
+ for(auto & elem : h)
+ elem = gb(buf, ts, pos, wrap);
UINT8 v2 = gcr6bw_tb[h[2]];
UINT8 v3 = gcr6bw_tb[h[3]];
UINT8 tr = gcr6bw_tb[h[0]] | (v2 & 1 ? 0x40 : 0x00);
diff --git a/src/lib/formats/ap_dsk35.h b/src/lib/formats/ap_dsk35.h
index 432eed42d8e..533307e2708 100644
--- a/src/lib/formats/ap_dsk35.h
+++ b/src/lib/formats/ap_dsk35.h
@@ -28,14 +28,14 @@ class dc42_format : public floppy_image_format_t
public:
dc42_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
private:
static const desc_e mac_gcr[];
diff --git a/src/lib/formats/apf_apt.cpp b/src/lib/formats/apf_apt.cpp
index b609a109ef6..f1a333f2c77 100644
--- a/src/lib/formats/apf_apt.cpp
+++ b/src/lib/formats/apf_apt.cpp
@@ -172,14 +172,14 @@ static int apf_apt_calculate_size_in_samples(const UINT8 *bytes, int length)
{
apf_image_size = length;
- return apf_apt_handle_cassette(NULL, bytes);
+ return apf_apt_handle_cassette(nullptr, bytes);
}
static int apf_cpf_calculate_size_in_samples(const UINT8 *bytes, int length)
{
apf_image_size = length;
- return apf_cpf_handle_cassette(NULL, bytes);
+ return apf_cpf_handle_cassette(nullptr, bytes);
}
//*********************************************************************************
@@ -210,7 +210,7 @@ static const struct CassetteFormat apf_cpf_format =
"cas,cpf",
apf_cpf_identify,
apf_cpf_load,
- NULL
+ nullptr
};
//*********************************************************************************
@@ -241,7 +241,7 @@ static const struct CassetteFormat apf_apt_format =
"apt",
apf_apt_identify,
apf_apt_load,
- NULL
+ nullptr
};
//*********************************************************************************
diff --git a/src/lib/formats/apollo_dsk.h b/src/lib/formats/apollo_dsk.h
index 05013d79055..51f9eb4aebc 100644
--- a/src/lib/formats/apollo_dsk.h
+++ b/src/lib/formats/apollo_dsk.h
@@ -17,10 +17,10 @@ class apollo_format : public upd765_format {
public:
apollo_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/applix_dsk.h b/src/lib/formats/applix_dsk.h
index 1a833fa55e6..c56213ade74 100644
--- a/src/lib/formats/applix_dsk.h
+++ b/src/lib/formats/applix_dsk.h
@@ -17,9 +17,9 @@ class applix_format : public wd177x_format {
public:
applix_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/apridisk.h b/src/lib/formats/apridisk.h
index 6eb5fc4617e..4faf756fd5a 100644
--- a/src/lib/formats/apridisk.h
+++ b/src/lib/formats/apridisk.h
@@ -20,14 +20,14 @@ class apridisk_format : public floppy_image_format_t
public:
apridisk_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
-
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+ virtual bool supports_save() const override;
private:
static const int APR_HEADER_SIZE = 128;
diff --git a/src/lib/formats/asst128_dsk.h b/src/lib/formats/asst128_dsk.h
index 32b455fa1f7..b19aab50f27 100644
--- a/src/lib/formats/asst128_dsk.h
+++ b/src/lib/formats/asst128_dsk.h
@@ -17,9 +17,9 @@ class asst128_format : public upd765_format {
public:
asst128_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/atari_dsk.cpp b/src/lib/formats/atari_dsk.cpp
index f5ccd03c952..d73cbf8185f 100644
--- a/src/lib/formats/atari_dsk.cpp
+++ b/src/lib/formats/atari_dsk.cpp
@@ -31,7 +31,7 @@ LEGACY_FLOPPY_OPTIONS_START( atari_only )
"Atari floppy disk image",
atari_dsk_identify,
atari_dsk_construct,
- NULL,
- NULL
+ nullptr,
+ nullptr
)
LEGACY_FLOPPY_OPTIONS_END0
diff --git a/src/lib/formats/atom_dsk.h b/src/lib/formats/atom_dsk.h
index 45187205f1c..7f64810e87c 100644
--- a/src/lib/formats/atom_dsk.h
+++ b/src/lib/formats/atom_dsk.h
@@ -9,9 +9,9 @@ class atom_format : public wd177x_format
public:
atom_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/atom_tap.cpp b/src/lib/formats/atom_tap.cpp
index 06d614a10b3..917500eace1 100644
--- a/src/lib/formats/atom_tap.cpp
+++ b/src/lib/formats/atom_tap.cpp
@@ -138,7 +138,7 @@ const struct CassetteFormat atom_tap_format =
"tap",
atom_tap_identify,
atom_tap_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START( atom_cassette_formats )
diff --git a/src/lib/formats/basicdsk.cpp b/src/lib/formats/basicdsk.cpp
index ee3ed133e91..9c08c97cc2b 100644
--- a/src/lib/formats/basicdsk.cpp
+++ b/src/lib/formats/basicdsk.cpp
@@ -184,7 +184,7 @@ static floperr_t basicdsk_format_track(floppy_image_legacy *floppy, int head, in
{
floperr_t err = FLOPPY_ERROR_SUCCESS;
UINT8 local_buffer[512];
- void *alloc_buffer = NULL;
+ void *alloc_buffer = nullptr;
void *buffer;
UINT32 sector_length;
int sector;
@@ -206,7 +206,7 @@ static floperr_t basicdsk_format_track(floppy_image_legacy *floppy, int head, in
}
else
{
- alloc_buffer = NULL;
+ alloc_buffer = nullptr;
buffer = local_buffer;
}
@@ -245,7 +245,7 @@ static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int hea
{
floperr_t err;
- err = get_offset(floppy, head, track, sector, FALSE, NULL);
+ err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
diff --git a/src/lib/formats/bbc_dsk.h b/src/lib/formats/bbc_dsk.h
index 28bba03e61b..9378a25ec81 100644
--- a/src/lib/formats/bbc_dsk.h
+++ b/src/lib/formats/bbc_dsk.h
@@ -20,12 +20,12 @@ class bbc_dfs_format : public wd177x_format
public:
bbc_dfs_format();
- virtual int find_size(io_generic *io, UINT32 form_factor);
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual int get_image_offset(const format &f, int head, int track);
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual int find_size(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int get_image_offset(const format &f, int head, int track) override;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
@@ -36,12 +36,12 @@ class bbc_adfs_format : public wd177x_format
public:
bbc_adfs_format();
- virtual int find_size(io_generic *io, UINT32 form_factor);
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual int get_image_offset(const format &f, int head, int track);
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual int find_size(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int get_image_offset(const format &f, int head, int track) override;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
@@ -52,12 +52,12 @@ class bbc_dos_format : public wd177x_format
public:
bbc_dos_format();
- virtual int find_size(io_generic *io, UINT32 form_factor);
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual int get_image_offset(const format &f, int head, int track);
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual int find_size(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int get_image_offset(const format &f, int head, int track) override;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
@@ -68,11 +68,11 @@ class bbc_cpm_format : public wd177x_format
public:
bbc_cpm_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual int get_image_offset(const format &f, int head, int track);
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int get_image_offset(const format &f, int head, int track) override;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/bw12_dsk.h b/src/lib/formats/bw12_dsk.h
index c9455463486..ca43914ffb0 100644
--- a/src/lib/formats/bw12_dsk.h
+++ b/src/lib/formats/bw12_dsk.h
@@ -17,9 +17,9 @@ class bw12_format : public upd765_format {
public:
bw12_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/bw2_dsk.h b/src/lib/formats/bw2_dsk.h
index d5fa5c66187..edf184ca4ae 100644
--- a/src/lib/formats/bw2_dsk.h
+++ b/src/lib/formats/bw2_dsk.h
@@ -17,9 +17,9 @@ class bw2_format : public upd765_format {
public:
bw2_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/c3040_dsk.h b/src/lib/formats/c3040_dsk.h
index cbf320273a8..659b2748571 100644
--- a/src/lib/formats/c3040_dsk.h
+++ b/src/lib/formats/c3040_dsk.h
@@ -17,15 +17,15 @@ class c3040_format : public d64_format {
public:
c3040_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
protected:
- virtual int get_sectors_per_track(const format &f, int track) { return c3040_sectors_per_track[track]; }
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
- virtual int get_gap2(const format &f, int head, int track) { return c3040_gap2[track]; }
- virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size);
+ virtual int get_sectors_per_track(const format &f, int track) override { return c3040_sectors_per_track[track]; }
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) override;
+ virtual int get_gap2(const format &f, int head, int track) override { return c3040_gap2[track]; }
+ virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size) override;
static const format file_formats[];
diff --git a/src/lib/formats/c4040_dsk.h b/src/lib/formats/c4040_dsk.h
index 231b961c765..591fcd42925 100644
--- a/src/lib/formats/c4040_dsk.h
+++ b/src/lib/formats/c4040_dsk.h
@@ -17,14 +17,14 @@ class c4040_format : public d64_format {
public:
c4040_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
protected:
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
- virtual int get_gap2(const format &f, int head, int track) { return c4040_gap2[track]; }
- virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size);
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) override;
+ virtual int get_gap2(const format &f, int head, int track) override { return c4040_gap2[track]; }
+ virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size) override;
static const format file_formats[];
diff --git a/src/lib/formats/c8280_dsk.h b/src/lib/formats/c8280_dsk.h
index eed34f5d846..b30ea667241 100644
--- a/src/lib/formats/c8280_dsk.h
+++ b/src/lib/formats/c8280_dsk.h
@@ -17,9 +17,9 @@ class c8280_format : public wd177x_format {
public:
c8280_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/camplynx_cas.cpp b/src/lib/formats/camplynx_cas.cpp
index a525f18d3cb..15ed26c8201 100644
--- a/src/lib/formats/camplynx_cas.cpp
+++ b/src/lib/formats/camplynx_cas.cpp
@@ -150,7 +150,7 @@ static int camplynx_cassette_calculate_size_in_samples(const UINT8 *bytes, int l
{
camplynx_image_size = length;
- return camplynx_handle_cassette(NULL, bytes);
+ return camplynx_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller lynx48k_legacy_fill_wave =
@@ -200,7 +200,7 @@ static const struct CassetteFormat lynx48k_cassette_image_format =
"tap",
lynx48k_cassette_identify,
lynx48k_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat lynx128k_cassette_image_format =
@@ -208,7 +208,7 @@ static const struct CassetteFormat lynx128k_cassette_image_format =
"tap",
lynx128k_cassette_identify,
lynx128k_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(lynx48k_cassette_formats)
diff --git a/src/lib/formats/camplynx_dsk.h b/src/lib/formats/camplynx_dsk.h
index 96efac0b60b..ccbc7015d5b 100644
--- a/src/lib/formats/camplynx_dsk.h
+++ b/src/lib/formats/camplynx_dsk.h
@@ -17,9 +17,9 @@ class camplynx_format : public wd177x_format {
public:
camplynx_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/cassimg.cpp b/src/lib/formats/cassimg.cpp
index 3154def299a..a591de070b1 100644
--- a/src/lib/formats/cassimg.cpp
+++ b/src/lib/formats/cassimg.cpp
@@ -100,7 +100,7 @@ static void cassette_finishinit(casserr_t err, cassette_image *cassette, cassett
if (cassette && (err || !outcassette))
{
cassette_close(cassette);
- cassette = NULL;
+ cassette = nullptr;
}
if (outcassette)
*outcassette = cassette;
@@ -133,7 +133,7 @@ casserr_t cassette_open_choices(void *file, const struct io_procs *procs, const
formats = cassette_default_formats;
/* create the cassette object */
- cassette = cassette_init(NULL, file, procs, flags);
+ cassette = cassette_init(nullptr, file, procs, flags);
if (!cassette)
{
err = CASSETTE_ERROR_OUTOFMEMORY;
@@ -141,7 +141,7 @@ casserr_t cassette_open_choices(void *file, const struct io_procs *procs, const
}
/* identify the image */
- format = NULL;
+ format = nullptr;
for (i = 0; !format && formats[i]; i++)
{
if (good_format(formats[i], extension, flags))
@@ -150,7 +150,7 @@ casserr_t cassette_open_choices(void *file, const struct io_procs *procs, const
memset(&opts, 0, sizeof(opts));
err = format->identify(cassette, &opts);
if (err == CASSETTE_ERROR_INVALIDIMAGE)
- format = NULL;
+ format = nullptr;
else if (err)
goto done;
}
@@ -189,8 +189,8 @@ casserr_t cassette_open(void *file, const struct io_procs *procs,
{
const struct CassetteFormat *formats[2];
formats[0] = format;
- formats[1] = NULL;
- return cassette_open_choices(file, procs, NULL, formats, flags, outcassette);
+ formats[1] = nullptr;
+ return cassette_open_choices(file, procs, nullptr, formats, flags, outcassette);
}
@@ -207,7 +207,7 @@ casserr_t cassette_create(void *file, const struct io_procs *procs, const struct
return CASSETTE_ERROR_INVALIDIMAGE;
/* is this a good format? */
- if (!good_format(format, NULL, flags))
+ if (!good_format(format, nullptr, flags))
return CASSETTE_ERROR_INVALIDIMAGE;
/* normalize arguments */
@@ -278,8 +278,10 @@ void cassette_close(cassette_image *cassette)
{
if ((cassette->flags & CASSETTE_FLAG_DIRTY) && (cassette->flags & CASSETTE_FLAG_SAVEONEXIT))
cassette_save(cassette);
- for (unsigned int i = 0; i < cassette->blocks.size(); i++)
- global_free(cassette->blocks[i]);
+ for (auto & elem : cassette->blocks)
+ {
+ global_free(elem);
+ }
global_free(cassette);
}
}
@@ -374,7 +376,7 @@ static casserr_t compute_manipulation_ranges(cassette_image *cassette, int chann
static casserr_t lookup_sample(cassette_image *cassette, int channel, size_t sample, INT32 **ptr)
{
- *ptr = NULL;
+ *ptr = nullptr;
size_t sample_blocknum = (sample / SAMPLES_PER_BLOCK) * cassette->channels + channel;
size_t sample_index = sample % SAMPLES_PER_BLOCK;
@@ -385,7 +387,7 @@ static casserr_t lookup_sample(cassette_image *cassette, int channel, size_t sam
memset(&cassette->blocks[osize], 0, (cassette->blocks.size()-osize)*sizeof(cassette->blocks[0]));
}
- if (cassette->blocks[sample_blocknum] == NULL)
+ if (cassette->blocks[sample_blocknum] == nullptr)
cassette->blocks[sample_blocknum] = global_alloc(sample_block);
sample_block &block = *cassette->blocks[sample_blocknum];
@@ -763,7 +765,7 @@ casserr_t cassette_read_modulated_data(cassette_image *cassette, int channel, do
casserr_t err;
UINT8 buffer_stack[1024];
UINT8 *buffer;
- UINT8 *alloc_buffer = NULL;
+ UINT8 *alloc_buffer = nullptr;
double delta;
double total_displacement = 0.0;
size_t this_length;
diff --git a/src/lib/formats/cbm_tap.cpp b/src/lib/formats/cbm_tap.cpp
index 23b8a8846ed..1293d3c531d 100644
--- a/src/lib/formats/cbm_tap.cpp
+++ b/src/lib/formats/cbm_tap.cpp
@@ -135,7 +135,7 @@ static int len;
/* This in fact gives the number of samples for half of the pulse */
-INLINE int tap_data_to_samplecount(int data, int frequency)
+static inline int tap_data_to_samplecount(int data, int frequency)
{
// return (int) (0.5 * (0.5 + (((double)CBM_WAV_FREQUENCY / frequency) * (double)data))); // MESS TZX formula
return (int) (0.5 * (((double)CBM_WAV_FREQUENCY / frequency) * (double)((data) + 0.5))); // tap2wav formula
@@ -157,7 +157,7 @@ static void toggle_wave_data(void )
static void cbm_output_wave( INT16 **buffer, int length )
{
- if (buffer == NULL)
+ if (buffer == nullptr)
return;
for( ; length > 0; length-- )
@@ -187,7 +187,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
/* int waveamp_high, waveamp_low; */
/* Log .TAP info but only once */
- if (!(buffer == NULL))
+ if (!(buffer == nullptr))
{
LOG_FORMATS("TAP version : %d\n", version);
LOG_FORMATS("Machine type : %d\n", system);
@@ -204,7 +204,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
}
/* is the .tap file corrupted? */
- if ((data == NULL) || (length <= CBM_HEADER_SIZE))
+ if ((data == nullptr) || (length <= CBM_HEADER_SIZE))
return -1;
@@ -321,7 +321,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
static int cbm_tap_to_wav_size( const UINT8 *tapdata, int taplen )
{
- int size = cbm_tap_do_work(NULL, taplen, tapdata);
+ int size = cbm_tap_do_work(nullptr, taplen, tapdata);
len = taplen;
return size;
@@ -364,7 +364,7 @@ static const struct CassetteFormat cbm_tap_cassette_format = {
"tap",
cbm_cassette_identify,
cbm_cassette_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/ccvf_dsk.cpp b/src/lib/formats/ccvf_dsk.cpp
index 09119a4b632..8e30dcfff33 100644
--- a/src/lib/formats/ccvf_dsk.cpp
+++ b/src/lib/formats/ccvf_dsk.cpp
@@ -109,7 +109,7 @@ bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if (byteoffs==78720) break;
hex[0]=line[byte * 2];
hex[1]=line[(byte * 2) + 1];
- bytes[byteoffs++] = strtol(hex, NULL, 16);
+ bytes[byteoffs++] = strtol(hex, nullptr, 16);
}
}
start = end + 1;
diff --git a/src/lib/formats/ccvf_dsk.h b/src/lib/formats/ccvf_dsk.h
index 9577c180c24..671b0c0f88c 100644
--- a/src/lib/formats/ccvf_dsk.h
+++ b/src/lib/formats/ccvf_dsk.h
@@ -32,13 +32,13 @@ public:
ccvf_format();
ccvf_format(const format *formats);
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool supports_save() const override;
protected:
const format *formats;
diff --git a/src/lib/formats/cd90_640_dsk.h b/src/lib/formats/cd90_640_dsk.h
index ccf80508047..489942788be 100644
--- a/src/lib/formats/cd90_640_dsk.h
+++ b/src/lib/formats/cd90_640_dsk.h
@@ -20,9 +20,9 @@ class cd90_640_format : public wd177x_format
public:
cd90_640_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/cgen_cas.cpp b/src/lib/formats/cgen_cas.cpp
index d9165441618..5cd4c3e1b0e 100644
--- a/src/lib/formats/cgen_cas.cpp
+++ b/src/lib/formats/cgen_cas.cpp
@@ -111,7 +111,7 @@ static int cgenie_cas_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen;
- return cgenie_handle_cas( NULL, casdata );
+ return cgenie_handle_cas( nullptr, casdata );
}
static const struct CassetteLegacyWaveFiller cgenie_cas_legacy_fill_wave =
@@ -143,7 +143,7 @@ static const struct CassetteFormat cgenie_cas_format =
"cas",
cgenie_cas_identify,
cgenie_cas_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/cgenie_dsk.h b/src/lib/formats/cgenie_dsk.h
index 1eda22404c5..0cd402225d9 100644
--- a/src/lib/formats/cgenie_dsk.h
+++ b/src/lib/formats/cgenie_dsk.h
@@ -20,13 +20,13 @@ class cgenie_format : public wd177x_format
public:
cgenie_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
protected:
- virtual int get_track_dam_fm(const format &f, int head, int track);
- virtual int get_track_dam_mfm(const format &f, int head, int track);
+ virtual int get_track_dam_fm(const format &f, int head, int track) override;
+ virtual int get_track_dam_mfm(const format &f, int head, int track) override;
private:
static const format formats[];
diff --git a/src/lib/formats/coco_cas.cpp b/src/lib/formats/coco_cas.cpp
index e70b28d69c0..d9599aa8c5a 100644
--- a/src/lib/formats/coco_cas.cpp
+++ b/src/lib/formats/coco_cas.cpp
@@ -277,7 +277,7 @@ const struct CassetteFormat coco_cas_format =
"cas",
coco_cas_identify,
coco_cas_load,
- NULL
+ nullptr
};
const struct CassetteFormat alice32_cas_format =
@@ -285,7 +285,7 @@ const struct CassetteFormat alice32_cas_format =
"cas,c10,k7",
coco_cas_identify,
alice32_cas_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/comx35_dsk.h b/src/lib/formats/comx35_dsk.h
index 03a298673e5..1dc91806e3c 100644
--- a/src/lib/formats/comx35_dsk.h
+++ b/src/lib/formats/comx35_dsk.h
@@ -17,9 +17,9 @@ class comx35_format : public wd177x_format {
public:
comx35_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/concept_dsk.h b/src/lib/formats/concept_dsk.h
index 171798c0fc6..87444c31ab0 100644
--- a/src/lib/formats/concept_dsk.h
+++ b/src/lib/formats/concept_dsk.h
@@ -18,14 +18,14 @@ class cc525dsdd_format : public floppy_image_format_t
public:
cc525dsdd_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
static const desc_e cc_9_desc[];
diff --git a/src/lib/formats/coupedsk.h b/src/lib/formats/coupedsk.h
index 9345ded421a..19f2d7ddac5 100644
--- a/src/lib/formats/coupedsk.h
+++ b/src/lib/formats/coupedsk.h
@@ -18,14 +18,14 @@ class mgt_format : public floppy_image_format_t
public:
mgt_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
static const floppy_image_format_t::desc_e desc_10[];
};
diff --git a/src/lib/formats/cpis_dsk.h b/src/lib/formats/cpis_dsk.h
index 3879c6a17c6..98d303c85fe 100644
--- a/src/lib/formats/cpis_dsk.h
+++ b/src/lib/formats/cpis_dsk.h
@@ -17,9 +17,9 @@ class cpis_format : public upd765_format {
public:
cpis_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/cqm_dsk.cpp b/src/lib/formats/cqm_dsk.cpp
index 5ecf4da3186..ff191aec56c 100644
--- a/src/lib/formats/cqm_dsk.cpp
+++ b/src/lib/formats/cqm_dsk.cpp
@@ -128,7 +128,7 @@ static floperr_t cqm_read_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t cqm_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
- err = get_offset(floppy, head, track, sector, FALSE, NULL);
+ err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
diff --git a/src/lib/formats/cqm_dsk.h b/src/lib/formats/cqm_dsk.h
index e07577c1e4c..48bc8d5521c 100644
--- a/src/lib/formats/cqm_dsk.h
+++ b/src/lib/formats/cqm_dsk.h
@@ -18,14 +18,14 @@ class cqm_format : public floppy_image_format_t
public:
cqm_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_CQM_FORMAT;
diff --git a/src/lib/formats/csw_cas.cpp b/src/lib/formats/csw_cas.cpp
index 94a45edde1f..336a9dde7cd 100644
--- a/src/lib/formats/csw_cas.cpp
+++ b/src/lib/formats/csw_cas.cpp
@@ -110,9 +110,9 @@ static int csw_cas_to_wav_size( const UINT8 *casdata, int caslen )
d_stream.avail_out = 1;
d_stream.total_out=0;
- d_stream.zalloc = 0;
- d_stream.zfree = 0;
- d_stream.opaque = 0;
+ d_stream.zalloc = nullptr;
+ d_stream.zfree = nullptr;
+ d_stream.opaque = nullptr;
d_stream.data_type=0;
err = inflateInit( &d_stream );
@@ -218,9 +218,9 @@ static int csw_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
d_stream.avail_out = 1;
d_stream.total_out=0;
- d_stream.zalloc = 0;
- d_stream.zfree = 0;
- d_stream.opaque = 0;
+ d_stream.zalloc = nullptr;
+ d_stream.zfree = nullptr;
+ d_stream.opaque = nullptr;
d_stream.data_type=0;
err = inflateInit( &d_stream );
@@ -300,7 +300,7 @@ static const struct CassetteFormat csw_cassette_format = {
"csw",
csw_cassette_identify,
csw_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(csw_cassette_formats)
diff --git a/src/lib/formats/d64_dsk.cpp b/src/lib/formats/d64_dsk.cpp
index 531ce441b99..b637d44c48c 100644
--- a/src/lib/formats/d64_dsk.cpp
+++ b/src/lib/formats/d64_dsk.cpp
@@ -79,7 +79,7 @@ const int d64_format::speed_zone[] =
0, 0 // 41-42
};
-int d64_format::find_size(io_generic *io, UINT32 form_factor)
+int d64_format::find_size(io_generic *io, UINT32 form_factor) const
{
UINT64 size = io_generic_size(io);
for(int i=0; formats[i].sector_count; i++) {
diff --git a/src/lib/formats/d64_dsk.h b/src/lib/formats/d64_dsk.h
index ec99a36251b..c5bef4b3313 100644
--- a/src/lib/formats/d64_dsk.h
+++ b/src/lib/formats/d64_dsk.h
@@ -30,14 +30,14 @@ public:
d64_format();
d64_format(const format *formats);
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
- virtual bool supports_save() const { return true; }
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+ virtual bool supports_save() const override { return true; }
protected:
enum
@@ -58,7 +58,7 @@ protected:
const format *formats;
- int find_size(io_generic *io, UINT32 form_factor);
+ int find_size(io_generic *io, UINT32 form_factor) const;
virtual int get_physical_track(const format &f, int head, int track);
virtual UINT32 get_cell_size(const format &f, int track);
virtual int get_sectors_per_track(const format &f, int track);
diff --git a/src/lib/formats/d71_dsk.h b/src/lib/formats/d71_dsk.h
index 5dc8a356186..eff2cff2c2a 100644
--- a/src/lib/formats/d71_dsk.h
+++ b/src/lib/formats/d71_dsk.h
@@ -17,9 +17,9 @@ class d71_format : public d64_format {
public:
d71_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
protected:
static const format formats[];
diff --git a/src/lib/formats/d80_dsk.cpp b/src/lib/formats/d80_dsk.cpp
index 222ef488544..12ea14ad80f 100644
--- a/src/lib/formats/d80_dsk.cpp
+++ b/src/lib/formats/d80_dsk.cpp
@@ -12,11 +12,11 @@
#include "formats/d80_dsk.h"
-d80_format::d80_format() : d64_format(file_formats)
+d80_format::d80_format() : d64_format(file_formats), formats(nullptr)
{
}
-d80_format::d80_format(const format *_formats) : d64_format(_formats)
+d80_format::d80_format(const format *_formats) : d64_format(_formats), formats(nullptr)
{
}
diff --git a/src/lib/formats/d80_dsk.h b/src/lib/formats/d80_dsk.h
index e48984b2322..d823b85a9bc 100644
--- a/src/lib/formats/d80_dsk.h
+++ b/src/lib/formats/d80_dsk.h
@@ -18,19 +18,19 @@ public:
d80_format();
d80_format(const format *formats);
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
protected:
const format *formats;
- virtual int get_physical_track(const format &f, int head, int track);
- virtual UINT32 get_cell_size(const format &f, int track);
- virtual int get_sectors_per_track(const format &f, int track);
- virtual int get_disk_id_offset(const format &f);
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
- virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size);
+ virtual int get_physical_track(const format &f, int head, int track) override;
+ virtual UINT32 get_cell_size(const format &f, int track) override;
+ virtual int get_sectors_per_track(const format &f, int track) override;
+ virtual int get_disk_id_offset(const format &f) override;
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) override;
+ virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size) override;
static const format file_formats[];
diff --git a/src/lib/formats/d81_dsk.h b/src/lib/formats/d81_dsk.h
index 6ea96c70b17..80c95b2a91d 100644
--- a/src/lib/formats/d81_dsk.h
+++ b/src/lib/formats/d81_dsk.h
@@ -17,11 +17,11 @@ class d81_format : public wd177x_format {
public:
d81_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
- virtual floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int &current_size, int &end_gap_index);
+ virtual floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int &current_size, int &end_gap_index) override;
private:
static const format formats[];
diff --git a/src/lib/formats/d82_dsk.h b/src/lib/formats/d82_dsk.h
index 8753fc62d0c..8919deee775 100644
--- a/src/lib/formats/d82_dsk.h
+++ b/src/lib/formats/d82_dsk.h
@@ -17,9 +17,9 @@ class d82_format : public d80_format {
public:
d82_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
protected:
static const format file_formats[];
diff --git a/src/lib/formats/d88_dsk.cpp b/src/lib/formats/d88_dsk.cpp
index f8383191e6d..b676db7fd21 100644
--- a/src/lib/formats/d88_dsk.cpp
+++ b/src/lib/formats/d88_dsk.cpp
@@ -319,7 +319,7 @@ FLOPPY_IDENTIFY(d88_dsk_identify)
{
UINT32 size;
- d88_get_header(floppy,&size,NULL,NULL,NULL);
+ d88_get_header(floppy,&size,nullptr,nullptr,nullptr);
if(floppy_image_size(floppy) == size)
{
@@ -517,7 +517,7 @@ bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sdatapos += size;
} else
- sects[i].data = NULL;
+ sects[i].data = nullptr;
}
build_pc_track_mfm(track, head, image, cell_count, sector_count, sects, calc_default_pc_gap3_size(form_factor, sects[0].actual_size));
diff --git a/src/lib/formats/d88_dsk.h b/src/lib/formats/d88_dsk.h
index 5b12f8eb600..2ab8db763f6 100644
--- a/src/lib/formats/d88_dsk.h
+++ b/src/lib/formats/d88_dsk.h
@@ -19,14 +19,14 @@ class d88_format : public floppy_image_format_t
public:
d88_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_D88_FORMAT;
diff --git a/src/lib/formats/dcp_dsk.cpp b/src/lib/formats/dcp_dsk.cpp
index fa805979d7b..4e2c305e6f6 100644
--- a/src/lib/formats/dcp_dsk.cpp
+++ b/src/lib/formats/dcp_dsk.cpp
@@ -205,7 +205,7 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
int ssize;
- for (ssize = 0; (128 << ssize) < bps; ssize++);
+ for (ssize = 0; (128 << ssize) < bps; ssize++) {};
desc_pc_sector sects[256];
UINT8 sect_data[65536];
diff --git a/src/lib/formats/dcp_dsk.h b/src/lib/formats/dcp_dsk.h
index d6e169809cf..92e447741f5 100644
--- a/src/lib/formats/dcp_dsk.h
+++ b/src/lib/formats/dcp_dsk.h
@@ -19,13 +19,13 @@ class dcp_format : public floppy_image_format_t
public:
dcp_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_DCP_FORMAT;
diff --git a/src/lib/formats/dfi_dsk.h b/src/lib/formats/dfi_dsk.h
index 72de8695ae2..b25278275f3 100644
--- a/src/lib/formats/dfi_dsk.h
+++ b/src/lib/formats/dfi_dsk.h
@@ -10,14 +10,14 @@ class dfi_format : public floppy_image_format_t
public:
dfi_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
// virtual bool save(io_generic *io, floppy_image *image);
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_DFI_FORMAT;
diff --git a/src/lib/formats/dim_dsk.h b/src/lib/formats/dim_dsk.h
index c7d4cea0d34..54f84aff471 100644
--- a/src/lib/formats/dim_dsk.h
+++ b/src/lib/formats/dim_dsk.h
@@ -24,14 +24,14 @@ class dim_format : public floppy_image_format_t
public:
dim_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_DIM_FORMAT;
diff --git a/src/lib/formats/dip_dsk.cpp b/src/lib/formats/dip_dsk.cpp
index e7c7aa072e9..9e6570f8071 100644
--- a/src/lib/formats/dip_dsk.cpp
+++ b/src/lib/formats/dip_dsk.cpp
@@ -61,7 +61,7 @@ bool dip_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
int ssize;
- for (ssize = 0; (128 << ssize) < bps; ssize++);
+ for (ssize = 0; (128 << ssize) < bps; ssize++) {};
desc_pc_sector sects[256];
UINT8 sect_data[65536];
diff --git a/src/lib/formats/dip_dsk.h b/src/lib/formats/dip_dsk.h
index e2ca876dff0..dba5e4afee9 100644
--- a/src/lib/formats/dip_dsk.h
+++ b/src/lib/formats/dip_dsk.h
@@ -19,13 +19,13 @@ class dip_format : public floppy_image_format_t
public:
dip_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_DIP_FORMAT;
diff --git a/src/lib/formats/dmk_dsk.h b/src/lib/formats/dmk_dsk.h
index f89fed8f95d..5a2f2f6cb7c 100644
--- a/src/lib/formats/dmk_dsk.h
+++ b/src/lib/formats/dmk_dsk.h
@@ -20,14 +20,14 @@ class dmk_format : public floppy_image_format_t
public:
dmk_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_DMK_FORMAT;
diff --git a/src/lib/formats/dmv_dsk.h b/src/lib/formats/dmv_dsk.h
index 31551ffc627..022a6e1e489 100644
--- a/src/lib/formats/dmv_dsk.h
+++ b/src/lib/formats/dmv_dsk.h
@@ -17,9 +17,9 @@ class dmv_format : public upd765_format {
public:
dmv_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/dsk_dsk.cpp b/src/lib/formats/dsk_dsk.cpp
index 6922071de25..4987a5bb52b 100644
--- a/src/lib/formats/dsk_dsk.cpp
+++ b/src/lib/formats/dsk_dsk.cpp
@@ -162,7 +162,7 @@ static floperr_t dsk_write_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t dsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
- err = get_offset(floppy, head, track, sector, FALSE, NULL);
+ err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@@ -179,7 +179,7 @@ static floperr_t dsk_get_indexed_sector_info(floppy_image_legacy *floppy, int he
UINT8 sector_info[0x100];
int pos;
- retVal = get_offset(floppy, head, track, sector_index, FALSE, NULL);
+ retVal = get_offset(floppy, head, track, sector_index, FALSE, nullptr);
offset = dsk_get_track_offset(floppy,head,track);
pos = 0x18 + (sector_index << 3);
floppy_image_read(floppy, sector_info, offset, 0x100);
@@ -419,7 +419,7 @@ bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sdatapos += sects[j].actual_size;
} else
- sects[j].data = NULL;
+ sects[j].data = nullptr;
if(extendformat)
pos += sector.data_length;
diff --git a/src/lib/formats/dsk_dsk.h b/src/lib/formats/dsk_dsk.h
index d92784f78e8..fc27c0c5030 100644
--- a/src/lib/formats/dsk_dsk.h
+++ b/src/lib/formats/dsk_dsk.h
@@ -18,13 +18,13 @@ class dsk_format : public floppy_image_format_t
public:
dsk_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_DSK_FORMAT;
diff --git a/src/lib/formats/ep64_dsk.h b/src/lib/formats/ep64_dsk.h
index e6e3fdda21a..47d05594964 100644
--- a/src/lib/formats/ep64_dsk.h
+++ b/src/lib/formats/ep64_dsk.h
@@ -17,9 +17,9 @@ class ep64_format : public wd177x_format {
public:
ep64_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/esq16_dsk.h b/src/lib/formats/esq16_dsk.h
index caf02f7995d..696db98345c 100644
--- a/src/lib/formats/esq16_dsk.h
+++ b/src/lib/formats/esq16_dsk.h
@@ -20,14 +20,14 @@ class esqimg_format : public floppy_image_format_t
public:
esqimg_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
static const desc_e esq_10_desc[];
diff --git a/src/lib/formats/esq8_dsk.h b/src/lib/formats/esq8_dsk.h
index 4646fcc225c..5fb998bf3b0 100644
--- a/src/lib/formats/esq8_dsk.h
+++ b/src/lib/formats/esq8_dsk.h
@@ -22,14 +22,14 @@ class esq8img_format : public floppy_image_format_t
public:
esq8img_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
static const desc_e esq_6_desc[];
diff --git a/src/lib/formats/excali64_dsk.h b/src/lib/formats/excali64_dsk.h
index b25698a3ffa..c2800d18875 100644
--- a/src/lib/formats/excali64_dsk.h
+++ b/src/lib/formats/excali64_dsk.h
@@ -17,9 +17,9 @@ class excali64_format : public wd177x_format {
public:
excali64_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/fc100_cas.cpp b/src/lib/formats/fc100_cas.cpp
index 415d3fb01db..01986e789bf 100644
--- a/src/lib/formats/fc100_cas.cpp
+++ b/src/lib/formats/fc100_cas.cpp
@@ -119,7 +119,7 @@ static int fc100_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
{
fc100_image_size = length;
- return fc100_handle_cassette(NULL, bytes);
+ return fc100_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller fc100_legacy_fill_wave =
@@ -148,7 +148,7 @@ static const struct CassetteFormat fc100_cassette_image_format =
"cas",
fc100_cassette_identify,
fc100_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(fc100_cassette_formats)
diff --git a/src/lib/formats/fdd_dsk.h b/src/lib/formats/fdd_dsk.h
index 9e43479565e..6a7faa57669 100644
--- a/src/lib/formats/fdd_dsk.h
+++ b/src/lib/formats/fdd_dsk.h
@@ -19,13 +19,13 @@ class fdd_format : public floppy_image_format_t
public:
fdd_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_FDD_FORMAT;
diff --git a/src/lib/formats/fdi_dsk.cpp b/src/lib/formats/fdi_dsk.cpp
index 05d3d7807b7..b766671ecb8 100644
--- a/src/lib/formats/fdi_dsk.cpp
+++ b/src/lib/formats/fdi_dsk.cpp
@@ -131,7 +131,7 @@ struct fdi_pulse_track_header
INLINE FUNCTIONS
***************************************************************************/
-INLINE struct fdidsk_tag *get_tag(floppy_image_legacy *floppy)
+static inline struct fdidsk_tag *get_tag(floppy_image_legacy *floppy)
{
return (fdidsk_tag *)floppy_tag(floppy);
}
diff --git a/src/lib/formats/flex_dsk.h b/src/lib/formats/flex_dsk.h
index 95a03a78f15..bade0115c56 100644
--- a/src/lib/formats/flex_dsk.h
+++ b/src/lib/formats/flex_dsk.h
@@ -15,12 +15,12 @@ class flex_format : public floppy_image_format_t {
public:
flex_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool supports_save() const override;
private:
struct sysinfo_sector
diff --git a/src/lib/formats/flopimg.cpp b/src/lib/formats/flopimg.cpp
index e66df68cdbc..f8cf7c83780 100644
--- a/src/lib/formats/flopimg.cpp
+++ b/src/lib/formats/flopimg.cpp
@@ -81,11 +81,11 @@ static floppy_image_legacy *floppy_init(void *fp, const struct io_procs *procs,
floppy = (floppy_image_legacy *)malloc(sizeof(floppy_image_legacy));
if (!floppy)
- return NULL;
+ return nullptr;
memset(floppy, 0, sizeof(*floppy));
- floppy->tags = pool_alloc_lib(NULL);
- floppy->tag_data = NULL;
+ floppy->tags = pool_alloc_lib(nullptr);
+ floppy->tag_data = nullptr;
floppy->io.file = fp;
floppy->io.procs = procs;
floppy->io.filler = 0xFF;
@@ -151,7 +151,7 @@ static floperr_t floppy_open_internal(void *fp, const struct io_procs *procs, co
if (outfloppy)
{
/* call the format constructor */
- err = floppy_options[best_option].construct(floppy, &floppy_options[best_option], NULL);
+ err = floppy_options[best_option].construct(floppy, &floppy_options[best_option], nullptr);
if (err)
goto done;
@@ -168,7 +168,7 @@ done:
if (floppy && (!outfloppy || err))
{
floppy_close_internal(floppy, FALSE);
- floppy = NULL;
+ floppy = nullptr;
}
if (outoption)
@@ -183,7 +183,7 @@ done:
floperr_t floppy_identify(void *fp, const struct io_procs *procs, const char *extension,
const struct FloppyFormat *formats, int *identified_format)
{
- return floppy_open_internal(fp, procs, extension, formats, INT_MAX, FLOPPY_FLAGS_READONLY, NULL, identified_format);
+ return floppy_open_internal(fp, procs, extension, formats, INT_MAX, FLOPPY_FLAGS_READONLY, nullptr, identified_format);
}
@@ -191,7 +191,7 @@ floperr_t floppy_identify(void *fp, const struct io_procs *procs, const char *ex
floperr_t floppy_open(void *fp, const struct io_procs *procs, const char *extension,
const struct FloppyFormat *format, int flags, floppy_image_legacy **outfloppy)
{
- return floppy_open_internal(fp, procs, extension, format, 1, flags, outfloppy, NULL);
+ return floppy_open_internal(fp, procs, extension, format, 1, flags, outfloppy, nullptr);
}
@@ -199,7 +199,7 @@ floperr_t floppy_open(void *fp, const struct io_procs *procs, const char *extens
floperr_t floppy_open_choices(void *fp, const struct io_procs *procs, const char *extension,
const struct FloppyFormat *formats, int flags, floppy_image_legacy **outfloppy)
{
- return floppy_open_internal(fp, procs, extension, formats, INT_MAX, flags, outfloppy, NULL);
+ return floppy_open_internal(fp, procs, extension, formats, INT_MAX, flags, outfloppy, nullptr);
}
@@ -231,11 +231,11 @@ static floperr_t option_to_floppy_error(optreserr_t oerr)
floperr_t floppy_create(void *fp, const struct io_procs *procs, const struct FloppyFormat *format, option_resolution *parameters, floppy_image_legacy **outfloppy)
{
- floppy_image_legacy *floppy = NULL;
+ floppy_image_legacy *floppy = nullptr;
optreserr_t oerr;
floperr_t err;
int heads, tracks, h, t;
- option_resolution *alloc_resolution = NULL;
+ option_resolution *alloc_resolution = nullptr;
assert(format);
@@ -307,7 +307,7 @@ done:
if (err && floppy)
{
floppy_close_internal(floppy, FALSE);
- floppy = NULL;
+ floppy = nullptr;
}
if (outfloppy)
@@ -474,7 +474,7 @@ static floperr_t floppy_readwrite_sector(floppy_image_legacy *floppy, int head,
{
/* find out the size of this sector */
if (indexed)
- err = fmt->get_indexed_sector_info(floppy, head, track, sector, NULL, NULL, NULL, &sector_length, NULL);
+ err = fmt->get_indexed_sector_info(floppy, head, track, sector, nullptr, nullptr, nullptr, &sector_length, nullptr);
else
err = fmt->get_sector_length(floppy, head, track, sector, &sector_length);
if (err)
@@ -683,7 +683,7 @@ floperr_t floppy_format_track(floppy_image_legacy *floppy, int head, int track,
{
floperr_t err;
struct FloppyCallbacks *format;
- option_resolution *alloc_resolution = NULL;
+ option_resolution *alloc_resolution = nullptr;
optreserr_t oerr;
/* supported? */
@@ -785,7 +785,7 @@ floperr_t floppy_get_sector_count(floppy_image_legacy *floppy, int head, int tra
do
{
- err = floppy_get_indexed_sector_info(floppy, head, track, sector_index, NULL, NULL, NULL, NULL, NULL);
+ err = floppy_get_indexed_sector_info(floppy, head, track, sector_index, nullptr, nullptr, nullptr, nullptr, nullptr);
if (!err)
sector_index++;
}
@@ -867,7 +867,7 @@ floperr_t floppy_load_track(floppy_image_legacy *floppy, int head, int track, in
error:
if (track_data)
- *track_data = NULL;
+ *track_data = nullptr;
if (track_length)
*track_length = 0;
return err;
@@ -923,7 +923,7 @@ const char *floppy_error(floperr_t err)
};
if ((err < 0) || (err >= ARRAY_LENGTH(error_messages)))
- return NULL;
+ return nullptr;
return error_messages[err];
}
@@ -958,7 +958,7 @@ floppy_image::~floppy_image()
{
}
-void floppy_image::get_maximal_geometry(int &_tracks, int &_heads)
+void floppy_image::get_maximal_geometry(int &_tracks, int &_heads) const
{
_tracks = tracks;
_heads = heads;
@@ -1017,7 +1017,7 @@ const char *floppy_image::get_variant_name(UINT32 form_factor, UINT32 variant)
floppy_image_format_t::floppy_image_format_t()
{
- next = 0;
+ next = nullptr;
}
floppy_image_format_t::~floppy_image_format_t()
@@ -1097,7 +1097,7 @@ bool floppy_image_format_t::type_data_mfm(int type, int p1, const gen_crc_info *
(type == CRC && (crcs[p1].type == CRC_CCITT || crcs[p1].type == CRC_AMIGA));
}
-void floppy_image_format_t::collect_crcs(const desc_e *desc, gen_crc_info *crcs)
+void floppy_image_format_t::collect_crcs(const desc_e *desc, gen_crc_info *crcs) const
{
memset(crcs, 0, MAX_CRC_COUNT * sizeof(*crcs));
for(int i=0; i != MAX_CRC_COUNT; i++)
@@ -1134,7 +1134,7 @@ void floppy_image_format_t::collect_crcs(const desc_e *desc, gen_crc_info *crcs)
for(int i=0; desc[i].type != END; i++)
if(desc[i].type == CRC) {
int j;
- for(j = i+1; desc[j].type != END && type_no_data(desc[j].type); j++);
+ for(j = i+1; desc[j].type != END && type_no_data(desc[j].type); j++) {};
crcs[desc[i].p1].fixup_mfm_clock = type_data_mfm(desc[j].type, desc[j].p1, crcs);
}
}
@@ -1545,7 +1545,7 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
case SIZE_ID: {
int size = sect[sector_idx].size;
int id;
- for(id = 0; size > 128; size >>=1, id++);
+ for(id = 0; size > 128; size >>=1, id++) {};
mfm_w(buffer, 8, id);
break;
}
@@ -1553,7 +1553,7 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
case SIZE_ID_FM: {
int size = sect[sector_idx].size;
int id;
- for(id = 0; size > 128; size >>=1, id++);
+ for(id = 0; size > 128; size >>=1, id++) {};
fm_w(buffer, 8, id);
break;
}
@@ -1763,8 +1763,8 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, std:
// Also check if all MG values are valid
int transition_count = 0;
- for(unsigned int i=0; i<trackbuf.size(); i++) {
- switch(trackbuf[i] & floppy_image::MG_MASK) {
+ for(auto & elem : trackbuf) {
+ switch(elem & floppy_image::MG_MASK) {
case MG_1:
transition_count++;
break;
@@ -1809,9 +1809,9 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, std:
UINT32 cbit = floppy_image::MG_A;
UINT32 count = 0;
- for(unsigned int i=0; i<trackbuf.size(); i++) {
- UINT32 bit = trackbuf[i] & floppy_image::MG_MASK;
- UINT32 time = trackbuf[i] & floppy_image::TIME_MASK;
+ for(auto & elem : trackbuf) {
+ UINT32 bit = elem & floppy_image::MG_MASK;
+ UINT32 time = elem & floppy_image::TIME_MASK;
if(bit == MG_0) {
count += time;
continue;
@@ -1824,7 +1824,7 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, std:
continue;
}
dest.push_back(cbit | count);
- dest.push_back(trackbuf[i]);
+ dest.push_back(elem);
count = 0;
}
@@ -2184,7 +2184,7 @@ const floppy_image_format_t::desc_e *floppy_image_format_t::atari_st_fcp_get_des
case 11:
return atari_st_fcp_11;
}
- return 0;
+ return nullptr;
}
// Amiga layouts
diff --git a/src/lib/formats/flopimg.h b/src/lib/formats/flopimg.h
index c3e42c5c96d..0f8c1a605a9 100644
--- a/src/lib/formats/flopimg.h
+++ b/src/lib/formats/flopimg.h
@@ -607,7 +607,7 @@ private:
void fixup_crc_victor_header(std::vector<UINT32> &buffer, const gen_crc_info *crc);
void fixup_crc_victor_data(std::vector<UINT32> &buffer, const gen_crc_info *crc);
void fixup_crcs(std::vector<UINT32> &buffer, gen_crc_info *crcs);
- void collect_crcs(const desc_e *desc, gen_crc_info *crcs);
+ void collect_crcs(const desc_e *desc, gen_crc_info *crcs) const;
int sbit_r(const UINT8 *bitstream, int pos);
int sbit_rp(const UINT8 *bitstream, int &pos, int track_size);
@@ -721,9 +721,9 @@ public:
virtual ~floppy_image();
//! @return the form factor.
- UINT32 get_form_factor() { return form_factor; }
+ UINT32 get_form_factor() const { return form_factor; }
//! @return the variant.
- UINT32 get_variant() { return variant; }
+ UINT32 get_variant() const { return variant; }
//! @param v the variant.
void set_variant(UINT32 v) { variant = v; }
@@ -751,7 +751,7 @@ public:
//! @return the current write splice position.
UINT32 get_write_splice_position(int track, int head, int subtrack = 0) const { return track_array[track*4+subtrack][head].write_splice; }
//! @return the maximal geometry supported by this format.
- void get_maximal_geometry(int &tracks, int &heads);
+ void get_maximal_geometry(int &tracks, int &heads) const;
//! @return the current geometry of the loaded image.
void get_actual_geometry(int &tracks, int &heads);
diff --git a/src/lib/formats/fm7_cas.cpp b/src/lib/formats/fm7_cas.cpp
index b1ce8f397b4..52892fdea2e 100644
--- a/src/lib/formats/fm7_cas.cpp
+++ b/src/lib/formats/fm7_cas.cpp
@@ -65,7 +65,7 @@ static int fm7_cas_to_wav_size (const UINT8 *casdata, int caslen)
{
cas_size = caslen;
- return fm7_handle_t77(NULL,casdata);
+ return fm7_handle_t77(nullptr,casdata);
}
/*******************************************************************
@@ -104,7 +104,7 @@ static const struct CassetteFormat fm7_cassette_format = {
"t77",
fm7_cas_identify,
fm7_cas_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(fm7_cassette_formats)
diff --git a/src/lib/formats/fmsx_cas.cpp b/src/lib/formats/fmsx_cas.cpp
index 10a26d2e232..c135880dc79 100644
--- a/src/lib/formats/fmsx_cas.cpp
+++ b/src/lib/formats/fmsx_cas.cpp
@@ -136,7 +136,7 @@ static const struct CassetteFormat fmsx_cas_format =
"tap,cas",
fmsx_cas_identify,
fmsx_cas_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/fmtowns_dsk.h b/src/lib/formats/fmtowns_dsk.h
index ae11ef78961..4bf20990ec9 100644
--- a/src/lib/formats/fmtowns_dsk.h
+++ b/src/lib/formats/fmtowns_dsk.h
@@ -15,9 +15,9 @@ class fmtowns_format : public wd177x_format {
public:
fmtowns_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/fsd_dsk.cpp b/src/lib/formats/fsd_dsk.cpp
new file mode 100644
index 00000000000..bed5a780275
--- /dev/null
+++ b/src/lib/formats/fsd_dsk.cpp
@@ -0,0 +1,180 @@
+// license:BSD-3-Clause
+// copyright-holders:Nigel Barnes
+/***************************************************************************
+
+ BBC Micro 8271 protected disk image format
+
+ Disk image format
+
+***************************************************************************/
+
+#include "emu.h"
+#include "fsd_dsk.h"
+
+
+/*********************************************************************
+
+ BBC Micro 8271 protected disk image format
+
+ Header:
+ =======
+ Identifier: "FSD" string literal 3 bytes
+ Creator: 5 bytes; date of creation/author
+ Title: Character string (unlimited length; may contain any but null)
+ Title_End: 0x00 byte literal 1 byte
+ Num_Tr: xx 1 byte, number of tracks
+
+ For each track
+ ==============
+ track_num: 1 byte
+ num_sec: 1 byte (00 == unformatted)
+ readable: 1 byte (00 == unreadable, ff ==readable)
+
+ If readable:
+ For each sector
+ ===============
+ Track_ID: 1 byte
+ Head_number: 1 byte
+ Sector_ID: 1 byte
+ reported_size: 1 byte (2^{7+x}; 0 ==>128, 1 ==> 256, 2==>512, 3==>1024 etc)
+ real_size: 1 byte (2^{7+x})
+ error_code: 1 byte (0==No Error, &20==Deleted Data; &0E = Data CRC Error)
+ data: <real_size> bytes
+ Note that error_code matches the OSWORD &7F result byte
+
+ If unreadable:
+ Track_ID: 1 byte
+ Head_number: 1 byte
+ Sector_ID: 1 byte
+ reported_size: 1 byte
+
+ Decoding of the "creator" 5 byte field:
+ =======================================
+ (byte1 byte2 byte3 byte4 byte5)
+
+ Date_DD = (byte1 AND &F8)/8
+ Date_MM = (byte3 AND &0F)
+ Date_YYYY = (byte1 AND &07)*256+byte2
+ Creator_ID = (byte3 AND &F0)/16
+ Release_num = ((byte5 AND &C0)/64)*256 + byte4
+
+*********************************************************************/
+
+fsd_format::fsd_format()
+{
+}
+
+const char *fsd_format::name() const
+{
+ return "fsd";
+}
+
+const char *fsd_format::description() const
+{
+ return "BBC Micro 8271 protected disk image";
+}
+
+const char *fsd_format::extensions() const
+{
+ return "fsd";
+}
+
+bool fsd_format::supports_save() const
+{
+ return false;
+}
+
+int fsd_format::identify(io_generic *io, UINT32 form_factor)
+{
+ UINT8 h[3];
+
+ io_generic_read(io, h, 0, 3);
+ if (memcmp(h, "FSD", 3) == 0) {
+ return 100;
+ }
+ return 0;
+}
+
+bool fsd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+{
+ UINT64 size = io_generic_size(io);
+ dynamic_buffer img(size);
+ io_generic_read(io, &img[0], 0, size);
+
+ UINT64 pos;
+ std::string title;
+ for(pos=8; pos < size && img[pos] != '\0'; pos++)
+ title += char(img[pos]);
+ pos++;
+
+ if(pos >= size)
+ return false;
+
+ //popmessage("Loading image of '%s'\n", title);
+
+ desc_pc_sector sects[10];
+ UINT8 total_tracks = img[pos++];
+ UINT8 tnum, hnum, snum, ssize, error;
+
+ hnum = 0;
+ //osd_printf_verbose("%d Tracks\n", total_tracks+1);
+ //osd_printf_verbose("Tr.# No.S Sec.# Tr.ID Head# SecID IDsiz REsiz Error\n");
+ for(int curr_track=0; curr_track <= total_tracks; curr_track++)
+ {
+ UINT8 track = img[pos++];
+ UINT8 spt = img[pos++];
+ //osd_printf_verbose("%x %x\n", track, spt);
+ if (spt > 0) // formatted
+ {
+ UINT8 readable = img[pos++];
+ for (int i = 0; i < spt; i++)
+ {
+ tnum = img[pos++]; // logical track
+ hnum = img[pos++]; // head number
+ snum = img[pos++]; // logical sector
+ ssize = img[pos++]; // reported size
+ sects[i].track = tnum;
+ sects[i].head = hnum;
+ sects[i].sector = snum;
+ sects[i].size = ssize;
+ if (readable == 0xff)
+ {
+ sects[i].actual_size = 1 << (img[pos++] + 7);
+ error = img[pos++];
+ sects[i].deleted = (error & 0x20) == 0x20;
+ sects[i].bad_crc = (error & 0x0e) == 0x0e;
+ sects[i].data = &img[pos];
+ pos += sects[i].actual_size;
+ //osd_printf_verbose("Read %x %x %x %x %x %x %x\n", i, sects[i].track, sects[i].head, sects[i].sector, sects[i].size, sects[i].actual_size, error);
+ }
+ else
+ {
+ throw emu_fatalerror("fsd_format: Unsupported unreadable sector on track %d sector %d head %d", track, i, hnum);
+
+ // Unreadable sectors not supported!!
+ //sects[i].track = track;
+ //sects[i].head = 0;
+ //sects[i].sector = i;
+ //sects[i].size = 0;
+ //sects[i].actual_size = 0;
+ //sects[i].deleted = false;
+ //sects[i].bad_crc = false;
+ //sects[i].data = NULL;
+ //osd_printf_verbose("Unread %x %x %x %x %x %x %x\n", i, sects[i].track, sects[i].head, sects[i].sector, sects[i].size, sects[i].actual_size, 0);
+ }
+ }
+ }
+ else // unformatted
+ {
+ sects[0].track = curr_track;
+ sects[0].head = hnum;
+ sects[0].sector = 0;
+ sects[0].size = 0;
+ //osd_printf_verbose("Unform %x %x %x %x %x %x %x\n", 0, sects[0].track, sects[0].head, sects[0].sector, sects[0].size, sects[0].actual_size, 0);
+ }
+ build_wd_track_fm(curr_track, hnum, image, 50000, spt, sects, 10, 40, 10);
+ }
+ return true;
+}
+
+const floppy_format_type FLOPPY_FSD_FORMAT = &floppy_image_format_creator<fsd_format>;
diff --git a/src/lib/formats/fsd_dsk.h b/src/lib/formats/fsd_dsk.h
new file mode 100644
index 00000000000..fdfb6fb3d27
--- /dev/null
+++ b/src/lib/formats/fsd_dsk.h
@@ -0,0 +1,43 @@
+// license:BSD-3-Clause
+// copyright-holders:Nigel Barnes
+/***************************************************************************
+
+ BBC Micro
+
+ Disk image formats
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __FSD_DSK_H__
+#define __FSD_DSK_H__
+
+#include "flopimg.h"
+#include "wd177x_dsk.h"
+
+/**************************************************************************/
+
+LEGACY_FLOPPY_OPTIONS_EXTERN(fsd);
+
+/**************************************************************************/
+
+
+
+class fsd_format : public floppy_image_format_t
+{
+public:
+ fsd_format();
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
+
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+};
+
+extern const floppy_format_type FLOPPY_FSD_FORMAT;
+
+#endif // __FSD_DSK_H__
diff --git a/src/lib/formats/g64_dsk.cpp b/src/lib/formats/g64_dsk.cpp
index 6cbb345adc8..e85b5c34682 100644
--- a/src/lib/formats/g64_dsk.cpp
+++ b/src/lib/formats/g64_dsk.cpp
@@ -108,7 +108,7 @@ bool g64_format::save(io_generic *io, floppy_image *image)
tracks = TRACK_COUNT * heads;
// write header
- UINT8 header[] = { 'G', 'C', 'R', '-', '1', '5', '4', '1', 0x00, tracks, TRACK_LENGTH & 0xff, TRACK_LENGTH >> 8 };
+ UINT8 header[] = { 'G', 'C', 'R', '-', '1', '5', '4', '1', 0x00, static_cast<UINT8>(tracks), TRACK_LENGTH & 0xff, TRACK_LENGTH >> 8 };
io_generic_write(io, header, POS_SIGNATURE, sizeof(header));
// write tracks
diff --git a/src/lib/formats/g64_dsk.h b/src/lib/formats/g64_dsk.h
index f7f06548ede..ddc12636b7e 100644
--- a/src/lib/formats/g64_dsk.h
+++ b/src/lib/formats/g64_dsk.h
@@ -18,14 +18,14 @@ class g64_format : public floppy_image_format_t {
public:
g64_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const { return true; }
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override { return true; }
protected:
enum
diff --git a/src/lib/formats/gtp_cas.cpp b/src/lib/formats/gtp_cas.cpp
index 1711a0a76b5..4cdb546ea6b 100644
--- a/src/lib/formats/gtp_cas.cpp
+++ b/src/lib/formats/gtp_cas.cpp
@@ -33,7 +33,7 @@ static INT16 len;
static void gtp_output_wave( INT16 **buffer, int length ) {
- if ( buffer == NULL ) {
+ if ( buffer == nullptr ) {
return;
}
@@ -111,7 +111,7 @@ static int gtp_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
int size,n;
size = 0;
n = 0;
- if (casdata == NULL) return -1;
+ if (casdata == nullptr) return -1;
while(n<caslen) {
int block_type = casdata[n];
int block_size = casdata[n+2]*256 + casdata[n+1];
@@ -132,7 +132,7 @@ static int gtp_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
int i,size,n;
size = 0;
n = 0;
- if (bytes == NULL) return -1;
+ if (bytes == nullptr) return -1;
while(n<len)
{
int block_type = bytes[n];
@@ -192,7 +192,7 @@ static const struct CassetteFormat gtp_cassette_format = {
"gtp",
gtp_cassette_identify,
gtp_cassette_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/guab_dsk.h b/src/lib/formats/guab_dsk.h
index 36280ddd88f..3fe6e2a670e 100644
--- a/src/lib/formats/guab_dsk.h
+++ b/src/lib/formats/guab_dsk.h
@@ -20,9 +20,9 @@ class guab_format : public wd177x_format
public:
guab_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/hect_dsk.cpp b/src/lib/formats/hect_dsk.cpp
index 8dfe445e6e4..4cd36008540 100644
--- a/src/lib/formats/hect_dsk.cpp
+++ b/src/lib/formats/hect_dsk.cpp
@@ -94,7 +94,7 @@ static FLOPPY_CONSTRUCT(hector_disc2_dsk800_construct)
}
LEGACY_FLOPPY_OPTIONS_START( hector_disc2 )
- LEGACY_FLOPPY_OPTION( hector_dsk, "HE2", "hector disc2 floppy disk image 200K", hector_disc2_dsk200_identify, hector_disc2_dsk200_construct, NULL, NULL)
- LEGACY_FLOPPY_OPTION( hector_dsk, "HE7", "hector disc2 floppy disk image 720K", hector_disc2_dsk720_identify, hector_disc2_dsk720_construct, NULL, NULL)
- LEGACY_FLOPPY_OPTION( hector_dsk, "HE8", "hector disc2 floppy disk image 800K", hector_disc2_dsk800_identify, hector_disc2_dsk800_construct, NULL, NULL)
+ LEGACY_FLOPPY_OPTION( hector_dsk, "HE2", "hector disc2 floppy disk image 200K", hector_disc2_dsk200_identify, hector_disc2_dsk200_construct, nullptr, nullptr)
+ LEGACY_FLOPPY_OPTION( hector_dsk, "HE7", "hector disc2 floppy disk image 720K", hector_disc2_dsk720_identify, hector_disc2_dsk720_construct, nullptr, nullptr)
+ LEGACY_FLOPPY_OPTION( hector_dsk, "HE8", "hector disc2 floppy disk image 800K", hector_disc2_dsk800_identify, hector_disc2_dsk800_construct, nullptr, nullptr)
LEGACY_FLOPPY_OPTIONS_END
diff --git a/src/lib/formats/hect_tap.cpp b/src/lib/formats/hect_tap.cpp
index 9110f07cc8c..ba79afe1180 100644
--- a/src/lib/formats/hect_tap.cpp
+++ b/src/lib/formats/hect_tap.cpp
@@ -40,7 +40,7 @@ enum
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-INLINE int hector_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
+static inline int hector_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
{
int i = 0;
@@ -62,7 +62,7 @@ INLINE int hector_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
}
-INLINE int hector_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int hector_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
{
/* Writing an entire byte */
int i, samples;
@@ -81,7 +81,7 @@ INLINE int hector_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
}
-INLINE int hector_tap_synchro(INT16 *buffer, int sample_pos, int nb_synchro)
+static inline int hector_tap_synchro(INT16 *buffer, int sample_pos, int nb_synchro)
{
/* Writing an entire byte */
int i, samples;
@@ -217,7 +217,7 @@ static int hector_tap_forth_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen ;
- return hector_handle_forth_tap( NULL, casdata );
+ return hector_handle_forth_tap( nullptr, casdata );
}
/*******************************************************************
@@ -236,7 +236,7 @@ static int hector_tap_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen ;
- return hector_handle_tap( NULL, casdata );//forth removed here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ return hector_handle_tap( nullptr, casdata );//forth removed here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
@@ -291,7 +291,7 @@ static const struct CassetteFormat hector_k7_format =
"k7,cin",
hector_k7_identify,
hector_k7_load,
- NULL
+ nullptr
};
static const struct CassetteFormat hector_k7Forth_format =
@@ -299,7 +299,7 @@ static const struct CassetteFormat hector_k7Forth_format =
"for",
hector_k7forth_identify,
hector_k7forth_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/hector_minidisc.h b/src/lib/formats/hector_minidisc.h
index d850573f2b6..54162508dd8 100644
--- a/src/lib/formats/hector_minidisc.h
+++ b/src/lib/formats/hector_minidisc.h
@@ -20,9 +20,9 @@ class hmd_format : public upd765_format
public:
hmd_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/hxcmfm_dsk.h b/src/lib/formats/hxcmfm_dsk.h
index edaac320d69..63238ab2006 100644
--- a/src/lib/formats/hxcmfm_dsk.h
+++ b/src/lib/formats/hxcmfm_dsk.h
@@ -18,14 +18,14 @@ class mfm_format : public floppy_image_format_t
public:
mfm_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_MFM_FORMAT;
diff --git a/src/lib/formats/imageutl.cpp b/src/lib/formats/imageutl.cpp
index e6386da44c8..2bf17be849c 100644
--- a/src/lib/formats/imageutl.cpp
+++ b/src/lib/formats/imageutl.cpp
@@ -168,7 +168,7 @@ void image_specify_extension(char *buffer, size_t buffer_len, const char *extens
len = strlen(buffer);
/* be aware that extension can be NULL */
- if (extension != NULL)
+ if (extension != nullptr)
{
while(extension[extension_pos] != '\0')
{
diff --git a/src/lib/formats/imageutl.h b/src/lib/formats/imageutl.h
index 8b51adebabf..a2369e8284a 100644
--- a/src/lib/formats/imageutl.h
+++ b/src/lib/formats/imageutl.h
@@ -25,7 +25,7 @@ unsigned short ccitt_crc16_one( unsigned short crc, const unsigned char data );
* Alignment-friendly integer placement
* ----------------------------------------------------------------------- */
-INLINE void place_integer_be(void *ptr, size_t offset, size_t size, UINT64 value)
+static inline void place_integer_be(void *ptr, size_t offset, size_t size, UINT64 value)
{
UINT8 *byte_ptr = ((UINT8 *) ptr) + offset;
UINT16 val16;
@@ -56,7 +56,7 @@ INLINE void place_integer_be(void *ptr, size_t offset, size_t size, UINT64 value
}
}
-INLINE UINT64 pick_integer_be(const void *ptr, size_t offset, size_t size)
+static inline UINT64 pick_integer_be(const void *ptr, size_t offset, size_t size)
{
UINT64 result = 0;
const UINT8 *byte_ptr = ((const UINT8 *) ptr) + offset;
@@ -93,7 +93,7 @@ INLINE UINT64 pick_integer_be(const void *ptr, size_t offset, size_t size)
return result;
}
-INLINE void place_integer_le(void *ptr, size_t offset, size_t size, UINT64 value)
+static inline void place_integer_le(void *ptr, size_t offset, size_t size, UINT64 value)
{
UINT8 *byte_ptr = ((UINT8 *) ptr) + offset;
UINT16 val16;
@@ -124,7 +124,7 @@ INLINE void place_integer_le(void *ptr, size_t offset, size_t size, UINT64 value
}
}
-INLINE UINT64 pick_integer_le(const void *ptr, size_t offset, size_t size)
+static inline UINT64 pick_integer_le(const void *ptr, size_t offset, size_t size)
{
UINT64 result = 0;
const UINT8 *byte_ptr = ((const UINT8 *) ptr) + offset;
diff --git a/src/lib/formats/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp
index 2d74c87f9ef..8f660b91535 100644
--- a/src/lib/formats/imd_dsk.cpp
+++ b/src/lib/formats/imd_dsk.cpp
@@ -155,7 +155,7 @@ static floperr_t imd_expand_file(floppy_image_legacy *floppy , UINT64 offset , s
return FLOPPY_ERROR_SUCCESS;
}
- UINT8 *buffer = global_alloc_array(UINT8 , size_after_off);
+ auto buffer = global_alloc_array(UINT8 , size_after_off);
// Read the part of file after offset
floppy_image_read(floppy , buffer , offset , size_after_off);
@@ -225,7 +225,7 @@ static floperr_t imd_write_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t imd_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
- err = get_offset(floppy, head, track, sector, FALSE, NULL);
+ err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@@ -427,7 +427,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
io_generic_read(io, &img[0], 0, size);
UINT64 pos;
- for(pos=0; pos < size && img[pos] != 0x1a; pos++);
+ for(pos=0; pos < size && img[pos] != 0x1a; pos++) {};
pos++;
if(pos >= size)
@@ -453,10 +453,10 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
const UINT8 *snum = &img[pos];
pos += sector_count;
- const UINT8 *tnum = head & 0x80 ? &img[pos] : NULL;
+ const UINT8 *tnum = head & 0x80 ? &img[pos] : nullptr;
if(tnum)
pos += sector_count;
- const UINT8 *hnum = head & 0x40 ? &img[pos] : NULL;
+ const UINT8 *hnum = head & 0x40 ? &img[pos] : nullptr;
if(hnum)
pos += sector_count;
@@ -475,7 +475,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sects[i].actual_size = actual_size;
if(stype == 0 || stype > 8) {
- sects[i].data = NULL;
+ sects[i].data = nullptr;
} else {
sects[i].deleted = stype == 3 || stype == 4 || stype == 7 || stype == 8;
diff --git a/src/lib/formats/imd_dsk.h b/src/lib/formats/imd_dsk.h
index a993a061050..5f26de88d75 100644
--- a/src/lib/formats/imd_dsk.h
+++ b/src/lib/formats/imd_dsk.h
@@ -19,13 +19,13 @@ class imd_format : public floppy_image_format_t
public:
imd_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
private:
void fixnum(char *start, char *end) const;
diff --git a/src/lib/formats/ioprocs.cpp b/src/lib/formats/ioprocs.cpp
index 2d75bff8b9f..24f92060a82 100644
--- a/src/lib/formats/ioprocs.cpp
+++ b/src/lib/formats/ioprocs.cpp
@@ -55,7 +55,7 @@ const struct io_procs stdio_ioprocs =
const struct io_procs stdio_ioprocs_noclose =
{
- NULL,
+ nullptr,
stdio_seekproc,
stdio_readproc,
stdio_writeproc,
@@ -109,7 +109,7 @@ const struct io_procs corefile_ioprocs =
const struct io_procs corefile_ioprocs_noclose =
{
- NULL,
+ nullptr,
corefile_seekproc,
corefile_readproc,
corefile_writeproc,
diff --git a/src/lib/formats/ipf_dsk.cpp b/src/lib/formats/ipf_dsk.cpp
index afb4c4ce9f3..e7b8aad9137 100644
--- a/src/lib/formats/ipf_dsk.cpp
+++ b/src/lib/formats/ipf_dsk.cpp
@@ -5,7 +5,8 @@
const floppy_format_type FLOPPY_IPF_FORMAT = &floppy_image_format_creator<ipf_format>;
-ipf_format::ipf_format()
+ipf_format::ipf_format(): tinfos(nullptr), tcount(0), type(0), release(0), revision(0), encoder_type(0),
+encoder_revision(0), origin(0), min_cylinder(0), max_cylinder(0), min_head(0), max_head(0), credit_day(0), credit_time(0)
{
}
@@ -88,7 +89,7 @@ bool ipf_format::parse(dynamic_buffer &data, floppy_image *image)
if(res)
res = generate_tracks(image);
global_free_array(tinfos);
- tinfos = NULL;
+ tinfos = nullptr;
return res;
}
@@ -118,9 +119,9 @@ bool ipf_format::parse_info(const UINT8 *info)
ipf_format::track_info *ipf_format::get_index(UINT32 idx)
{
if(idx > 1000)
- return 0;
+ return nullptr;
if(idx >= tcount) {
- track_info *ti1 = global_alloc_array_clear(track_info, idx+1);
+ auto ti1 = global_alloc_array_clear(track_info, idx+1);
memcpy(ti1, tinfos, tcount*sizeof(tinfos));
global_free_array(tinfos);
tcount = idx+1;
diff --git a/src/lib/formats/ipf_dsk.h b/src/lib/formats/ipf_dsk.h
index f3152e8c5c4..a0a16d36daf 100644
--- a/src/lib/formats/ipf_dsk.h
+++ b/src/lib/formats/ipf_dsk.h
@@ -10,13 +10,13 @@ class ipf_format : public floppy_image_format_t
public:
ipf_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
private:
struct track_info {
diff --git a/src/lib/formats/iq151_dsk.h b/src/lib/formats/iq151_dsk.h
index 9f2b69d7617..472cbaf64f9 100644
--- a/src/lib/formats/iq151_dsk.h
+++ b/src/lib/formats/iq151_dsk.h
@@ -17,9 +17,9 @@ class iq151_format : public upd765_format {
public:
iq151_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/itt3030_dsk.h b/src/lib/formats/itt3030_dsk.h
index a43c9c1cd20..49ee5ed95b3 100644
--- a/src/lib/formats/itt3030_dsk.h
+++ b/src/lib/formats/itt3030_dsk.h
@@ -17,9 +17,9 @@ class itt3030_format : public wd177x_format {
public:
itt3030_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/jvc_dsk.h b/src/lib/formats/jvc_dsk.h
index eaeeefb84aa..244c84a8592 100644
--- a/src/lib/formats/jvc_dsk.h
+++ b/src/lib/formats/jvc_dsk.h
@@ -32,14 +32,14 @@ public:
int header_size;
};
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
-
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+ virtual bool supports_save() const override;
private:
bool parse_header(io_generic *io, int &header_size, int &tracks, int &heads, int &sectors, int &sector_size, int &base_sector_id);
diff --git a/src/lib/formats/kaypro_dsk.h b/src/lib/formats/kaypro_dsk.h
index 589d16fc150..f65b410bcc8 100644
--- a/src/lib/formats/kaypro_dsk.h
+++ b/src/lib/formats/kaypro_dsk.h
@@ -17,9 +17,9 @@ class kayproii_format : public upd765_format {
public:
kayproii_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
@@ -29,9 +29,9 @@ class kaypro2x_format : public upd765_format {
public:
kaypro2x_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
};
diff --git a/src/lib/formats/kc85_dsk.h b/src/lib/formats/kc85_dsk.h
index f13ba7f6a0d..c941a9e7647 100644
--- a/src/lib/formats/kc85_dsk.h
+++ b/src/lib/formats/kc85_dsk.h
@@ -17,9 +17,9 @@ class kc85_format : public upd765_format {
public:
kc85_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/kc_cas.cpp b/src/lib/formats/kc_cas.cpp
index 32d7901cad5..3e3d36e3f8b 100644
--- a/src/lib/formats/kc_cas.cpp
+++ b/src/lib/formats/kc_cas.cpp
@@ -43,7 +43,7 @@ static int kc_image_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-INLINE int kc_cas_cycle(INT16 *buffer, int sample_pos, int len)
+static inline int kc_cas_cycle(INT16 *buffer, int sample_pos, int len)
{
int num_samples = KC_WAV_FREQUENCY / (len * 2);
@@ -63,7 +63,7 @@ INLINE int kc_cas_cycle(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate n samples of silence
********************************************************************/
-INLINE int kc_cas_silence(INT16 *buffer, int sample_pos, int len)
+static inline int kc_cas_silence(INT16 *buffer, int sample_pos, int len)
{
int i = 0;
@@ -78,7 +78,7 @@ INLINE int kc_cas_silence(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate samples for 1 byte
********************************************************************/
-INLINE int kc_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int kc_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
{
int samples = 0;
@@ -245,7 +245,7 @@ static int kc_kcc_to_wav_size(const UINT8 *casdata, int caslen)
{
kc_image_size = caslen ;
- return kc_handle_kcc( NULL, casdata );
+ return kc_handle_kcc( nullptr, casdata );
}
@@ -277,7 +277,7 @@ static const struct CassetteFormat kc_kcc_format =
"kcc,kcb",
kc_kcc_identify,
kc_kcc_load,
- NULL
+ nullptr
};
@@ -297,7 +297,7 @@ static int kc_tap_to_wav_size(const UINT8 *casdata, int caslen)
{
kc_image_size = caslen ;
- return kc_handle_tap( NULL, casdata );
+ return kc_handle_tap( nullptr, casdata );
}
@@ -329,7 +329,7 @@ static const struct CassetteFormat kc_tap_format =
"tap,853,854,855,tp2,kcm",
kc_tap_identify,
kc_tap_load,
- NULL
+ nullptr
};
@@ -349,7 +349,7 @@ static int kc_sss_to_wav_size(const UINT8 *casdata, int caslen)
{
kc_image_size = caslen ;
- return kc_handle_sss( NULL, casdata );
+ return kc_handle_sss( nullptr, casdata );
}
@@ -380,7 +380,7 @@ static const struct CassetteFormat kc_sss_format =
"sss",
kc_sss_identify,
kc_sss_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/kim1_cas.cpp b/src/lib/formats/kim1_cas.cpp
index b8527e10462..ed9a1a36a0e 100644
--- a/src/lib/formats/kim1_cas.cpp
+++ b/src/lib/formats/kim1_cas.cpp
@@ -11,7 +11,7 @@
static int cas_size;
-INLINE int kim1_output_signal( INT16 *buffer, int sample_pos, int high )
+static inline int kim1_output_signal( INT16 *buffer, int sample_pos, int high )
{
int sample_count, i, j;
@@ -62,7 +62,7 @@ INLINE int kim1_output_signal( INT16 *buffer, int sample_pos, int high )
}
-INLINE int kim1_output_byte( INT16 *buffer, int sample_pos, UINT8 byte )
+static inline int kim1_output_byte( INT16 *buffer, int sample_pos, UINT8 byte )
{
int i;
int sample_count = 0;
@@ -156,7 +156,7 @@ static int kim1_kim_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen;
- return kim1_handle_kim( NULL, casdata );
+ return kim1_handle_kim( nullptr, casdata );
}
static const struct CassetteLegacyWaveFiller kim1_kim_legacy_fill_wave =
@@ -188,7 +188,7 @@ static const struct CassetteFormat kim1_kim_format =
"kim,kim1",
kim1_kim_identify,
kim1_kim_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/lviv_lvt.cpp b/src/lib/formats/lviv_lvt.cpp
index ecb1940eb6e..03172f6ac36 100644
--- a/src/lib/formats/lviv_lvt.cpp
+++ b/src/lib/formats/lviv_lvt.cpp
@@ -143,7 +143,7 @@ static const struct CassetteFormat lviv_lvt_image_format =
"lvt,lvr,lv0,lv1,lv2,lv3",
lviv_lvt_identify,
lviv_lvt_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/m20_dsk.h b/src/lib/formats/m20_dsk.h
index e3f8c9cf411..0ed3deda5ef 100644
--- a/src/lib/formats/m20_dsk.h
+++ b/src/lib/formats/m20_dsk.h
@@ -17,14 +17,14 @@ class m20_format : public floppy_image_format_t {
public:
m20_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_M20_FORMAT;
diff --git a/src/lib/formats/m5_dsk.h b/src/lib/formats/m5_dsk.h
index 15b806b6035..08350c61339 100644
--- a/src/lib/formats/m5_dsk.h
+++ b/src/lib/formats/m5_dsk.h
@@ -17,9 +17,9 @@ class m5_format : public upd765_format {
public:
m5_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/mbee_cas.cpp b/src/lib/formats/mbee_cas.cpp
index fe0a2ffbc24..58a8f81232a 100644
--- a/src/lib/formats/mbee_cas.cpp
+++ b/src/lib/formats/mbee_cas.cpp
@@ -224,7 +224,7 @@ static int mbee_tap_calculate_size_in_samples(const UINT8 *bytes, int length)
{
mbee_image_size = length;
- return mbee_handle_tap(NULL, bytes);
+ return mbee_handle_tap(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller mbee_tap_config =
@@ -253,7 +253,7 @@ static const struct CassetteFormat mbee_tap_image_format =
"tap",
mbee_tap_identify,
mbee_tap_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(mbee_cassette_formats)
diff --git a/src/lib/formats/mfi_dsk.cpp b/src/lib/formats/mfi_dsk.cpp
index 043d61b0d3d..b6d0f11e2c7 100644
--- a/src/lib/formats/mfi_dsk.cpp
+++ b/src/lib/formats/mfi_dsk.cpp
@@ -187,8 +187,8 @@ bool mfi_format::save(io_generic *io, floppy_image *image)
int pos = sizeof(header) + (tracks << resolution)*heads*sizeof(entry);
int epos = 0;
- UINT32 *precomp = global_alloc_array(UINT32, max_track_size);
- UINT8 *postcomp = global_alloc_array(UINT8, max_track_size*4 + 1000);
+ auto precomp = global_alloc_array(UINT32, max_track_size);
+ auto postcomp = global_alloc_array(UINT8, max_track_size*4 + 1000);
for(int track=0; track <= (tracks-1) << 2; track += 4 >> resolution)
for(int head=0; head<heads; head++) {
diff --git a/src/lib/formats/mfi_dsk.h b/src/lib/formats/mfi_dsk.h
index c9e26337ca6..dfac913d4c1 100644
--- a/src/lib/formats/mfi_dsk.h
+++ b/src/lib/formats/mfi_dsk.h
@@ -10,14 +10,14 @@ class mfi_format : public floppy_image_format_t
public:
mfi_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
private:
enum {
diff --git a/src/lib/formats/mfm_hd.h b/src/lib/formats/mfm_hd.h
index dfa4d3ffba7..4e583f46db8 100644
--- a/src/lib/formats/mfm_hd.h
+++ b/src/lib/formats/mfm_hd.h
@@ -80,7 +80,7 @@ public:
int headerlen;
int ecctype; // -1 is CRC
- bool sane_rec()
+ bool sane_rec() const
{
return ((interleave > 0 && interleave < 32) && (cylskew >= 0 && cylskew < 32) && (headskew >= 0 && headskew < 32)
&& (write_precomp_cylinder >= -1 && write_precomp_cylinder < 100000)
@@ -93,7 +93,7 @@ public:
write_precomp_cylinder = reduced_wcurr_cylinder = -1;
}
- bool sane_gap()
+ bool sane_gap() const
{
return ((gap1 >= 1 && gap1 < 1000) && (gap2 >= 1 && gap2 < 20) && (gap3 >= 1 && gap3 < 1000)
&& (sync >= 10 && sync < 20)
@@ -105,7 +105,7 @@ public:
gap1 = gap2 = gap3 = sync = headerlen = ecctype = 0;
}
- bool equals_rec(mfmhd_layout_params* other)
+ bool equals_rec(mfmhd_layout_params* other) const
{
return ((interleave == other->interleave) &&
(cylskew == other->cylskew) &&
@@ -114,7 +114,7 @@ public:
(reduced_wcurr_cylinder == other->reduced_wcurr_cylinder));
}
- bool equals_gap(mfmhd_layout_params* other)
+ bool equals_gap(mfmhd_layout_params* other) const
{
return ((gap1 == other->gap1) &&
(gap2 == other->gap2) &&
@@ -146,7 +146,8 @@ enum mfmhd_param_t
class mfmhd_image_format_t
{
public:
- mfmhd_image_format_t() { m_devtag = std::string("mfmhd_image_format_t"); };
+ mfmhd_image_format_t(): m_lastbit(false), m_current_crc(0)
+ { m_devtag = std::string("mfmhd_image_format_t"); };
virtual ~mfmhd_image_format_t() {};
// Load the image.
@@ -195,12 +196,12 @@ class mfmhd_generic_format : public mfmhd_image_format_t
{
public:
mfmhd_generic_format() { m_devtag = std::string("mfmhd_generic_format"); };
- chd_error load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head);
- chd_error save(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head);
+ chd_error load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) override;
+ chd_error save(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) override;
// Yes, we want to save all parameters
- virtual bool save_param(mfmhd_param_t type) { return true; }
- virtual int get_default(mfmhd_param_t type);
+ virtual bool save_param(mfmhd_param_t type) override { return true; }
+ virtual int get_default(mfmhd_param_t type) override;
protected:
virtual UINT8 cylinder_to_ident(int cylinder);
diff --git a/src/lib/formats/mm_dsk.h b/src/lib/formats/mm_dsk.h
index ad72b23d4e9..84b29ab259f 100644
--- a/src/lib/formats/mm_dsk.h
+++ b/src/lib/formats/mm_dsk.h
@@ -17,9 +17,9 @@ class mm1_format : public upd765_format {
public:
mm1_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
@@ -29,9 +29,9 @@ class mm2_format : public upd765_format {
public:
mm2_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/msx_dsk.h b/src/lib/formats/msx_dsk.h
index 94a5411c51a..d776620624d 100644
--- a/src/lib/formats/msx_dsk.h
+++ b/src/lib/formats/msx_dsk.h
@@ -19,9 +19,9 @@ class msx_format: public upd765_format {
public:
msx_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/mz_cas.cpp b/src/lib/formats/mz_cas.cpp
index 154c4ae91c9..3a6b934b882 100644
--- a/src/lib/formats/mz_cas.cpp
+++ b/src/lib/formats/mz_cas.cpp
@@ -306,7 +306,7 @@ static const struct CassetteLegacyWaveFiller mz700_legacy_fill_wave =
fill_wave, /* fill_wave */
1, /* chunk_size */
2 * BYTE_SAMPLES, /* chunk_samples */
- NULL, /* chunk_sample_calc */
+ nullptr, /* chunk_sample_calc */
4400, // sample_frequency (tested ok with MZ-80K, MZ-80A, MZ-700, MZ-800, MZ-1500)
MZ700_WAVESAMPLES_HEADER, /* header_samples */
1 /* trailer_samples */
@@ -333,7 +333,7 @@ static const struct CassetteFormat mz700_cas_format =
"m12,mzf,mzt",
mz700_cas_identify,
mz700_cas_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/nanos_dsk.h b/src/lib/formats/nanos_dsk.h
index 97767aa9a59..5a638a0782a 100644
--- a/src/lib/formats/nanos_dsk.h
+++ b/src/lib/formats/nanos_dsk.h
@@ -17,9 +17,9 @@ class nanos_format : public upd765_format {
public:
nanos_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/nascom_dsk.h b/src/lib/formats/nascom_dsk.h
index 95b1e80e49e..a1c3653cdac 100644
--- a/src/lib/formats/nascom_dsk.h
+++ b/src/lib/formats/nascom_dsk.h
@@ -20,9 +20,9 @@ class nascom_format : public wd177x_format
public:
nascom_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/naslite_dsk.h b/src/lib/formats/naslite_dsk.h
index e9ab87488f0..00f9df1567e 100644
--- a/src/lib/formats/naslite_dsk.h
+++ b/src/lib/formats/naslite_dsk.h
@@ -17,14 +17,14 @@ class naslite_format : public upd765_format {
public:
naslite_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
protected:
static const format formats[];
- virtual void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors, int track, int head) const;
+ virtual void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors, int track, int head) const override;
};
extern const floppy_format_type FLOPPY_NASLITE_FORMAT;
diff --git a/src/lib/formats/nes_dsk.cpp b/src/lib/formats/nes_dsk.cpp
index 5fc263a5f26..f6560d5f053 100644
--- a/src/lib/formats/nes_dsk.cpp
+++ b/src/lib/formats/nes_dsk.cpp
@@ -69,7 +69,7 @@ LEGACY_FLOPPY_OPTIONS_START( nes_only )
"NES floppy disk image",
nes_dsk_identify,
nes_dsk_construct,
- NULL,
- NULL
+ nullptr,
+ nullptr
)
LEGACY_FLOPPY_OPTIONS_END0
diff --git a/src/lib/formats/nfd_dsk.h b/src/lib/formats/nfd_dsk.h
index 5bf460f9084..005196399ba 100644
--- a/src/lib/formats/nfd_dsk.h
+++ b/src/lib/formats/nfd_dsk.h
@@ -19,13 +19,13 @@ class nfd_format : public floppy_image_format_t
public:
nfd_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_NFD_FORMAT;
diff --git a/src/lib/formats/orao_cas.cpp b/src/lib/formats/orao_cas.cpp
index 9e88119d825..784f9563cc0 100644
--- a/src/lib/formats/orao_cas.cpp
+++ b/src/lib/formats/orao_cas.cpp
@@ -23,7 +23,7 @@ static INT16 wave_data;
static int len;
static void orao_output_wave( INT16 **buffer, int length ) {
- if ( buffer == NULL ) {
+ if ( buffer == nullptr ) {
return;
}
@@ -36,7 +36,7 @@ static int orao_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
int i,j,size;
UINT8 b;
- if (casdata == NULL) return -1;
+ if (casdata == nullptr) return -1;
if (caslen <= ORAO_HEADER_SIZE) {
return -1;
}
@@ -59,7 +59,7 @@ static int orao_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
int i,j,size;
UINT8 b;
size = 0;
- if (bytes == NULL) return -1;
+ if (bytes == nullptr) return -1;
for (i=ORAO_HEADER_SIZE;i<len-ORAO_HEADER_SIZE;i++) {
for (j=0;j<8;j++) {
b = (bytes[i] >> j) & 1;
@@ -113,7 +113,7 @@ static const struct CassetteFormat orao_cassette_format = {
"tap",
orao_cassette_identify,
orao_cassette_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/oric_dsk.h b/src/lib/formats/oric_dsk.h
index 97bd6e35408..3eeb719eed0 100644
--- a/src/lib/formats/oric_dsk.h
+++ b/src/lib/formats/oric_dsk.h
@@ -17,14 +17,14 @@ class oric_dsk_format : public floppy_image_format_t
{
public:
oric_dsk_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_ORIC_DSK_FORMAT;
diff --git a/src/lib/formats/oric_tap.cpp b/src/lib/formats/oric_tap.cpp
index 9dbf378db9b..ed2a7841076 100644
--- a/src/lib/formats/oric_tap.cpp
+++ b/src/lib/formats/oric_tap.cpp
@@ -513,7 +513,7 @@ static const struct CassetteFormat oric_tap_format =
"tap",
oric_tap_identify,
oric_tap_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/p6001_cas.cpp b/src/lib/formats/p6001_cas.cpp
index a0ce656e4eb..e91e4b40748 100644
--- a/src/lib/formats/p6001_cas.cpp
+++ b/src/lib/formats/p6001_cas.cpp
@@ -50,7 +50,7 @@ static int pc6001_cas_to_wav_size (const UINT8 *casdata, int caslen)
{
cas_size = caslen*8;
- return pc6001_handle_cas(NULL,casdata);
+ return pc6001_handle_cas(nullptr,casdata);
}
/*******************************************************************
@@ -89,7 +89,7 @@ static const struct CassetteFormat pc6001_cassette_format = {
"cas",
pc6001_cas_identify,
pc6001_cas_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(pc6001_cassette_formats)
diff --git a/src/lib/formats/pasti_dsk.cpp b/src/lib/formats/pasti_dsk.cpp
index 6fa53b2590d..78e016991d9 100644
--- a/src/lib/formats/pasti_dsk.cpp
+++ b/src/lib/formats/pasti_dsk.cpp
@@ -90,7 +90,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
io_generic_read(io, &raw_track[0], pos+16, entry_len-16);
- UINT8 *fuzz = fuzz_len ? &raw_track[16*sect] : 0;
+ UINT8 *fuzz = fuzz_len ? &raw_track[16*sect] : nullptr;
UINT8 *bdata = fuzz ? fuzz+fuzz_len : &raw_track[16*sect];
UINT8 *tdata = bdata;
@@ -105,7 +105,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
tsize = tdata[0] | (tdata[1] << 8);
tdata += 2;
} else
- tdata = 0;
+ tdata = nullptr;
if(0) {
printf("Track %2d.%d: el=%d fl=%d sect=%d flags=%04x tlen=%d/%d tnum=%d flags2=%02x sync=%x\n",
@@ -133,7 +133,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int s_flags = sh[14] | (sh[15] << 8);
obs.sectors[s].data = bdata + s_off;
- obs.sectors[s].fuzzy_mask = 0;
+ obs.sectors[s].fuzzy_mask = nullptr;
memcpy(obs.sectors[s].id, sh+8, 6);
obs.sectors[s].time_ratio = s_time ? s_time / 16384.0 : 1;
obs.sectors[s].position = s_pos/8-12;
@@ -175,7 +175,7 @@ void pasti_format::wd_generate_unsynced_gap(std::vector<UINT32> &track, const wd
for(int i=tstart; i != tend;) {
unsigned char v = obs.track_data[i];
int j;
- for(j=i+1; j != tend && obs.track_data[j] == v; j++);
+ for(j=i+1; j != tend && obs.track_data[j] == v; j++) {};
int size = j-i;
if(size < 4) {
mfm_w(track, 8, v, cell_size);
diff --git a/src/lib/formats/pasti_dsk.h b/src/lib/formats/pasti_dsk.h
index 0d1165f48b4..fe724fb1fb5 100644
--- a/src/lib/formats/pasti_dsk.h
+++ b/src/lib/formats/pasti_dsk.h
@@ -10,13 +10,13 @@ class pasti_format : public floppy_image_format_t
public:
pasti_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
static const desc_e xdesc[];
diff --git a/src/lib/formats/pc98_dsk.h b/src/lib/formats/pc98_dsk.h
index 5655d187399..d948b19ddcc 100644
--- a/src/lib/formats/pc98_dsk.h
+++ b/src/lib/formats/pc98_dsk.h
@@ -22,9 +22,9 @@ class pc98_format : public upd765_format
public:
pc98_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/pc98fdi_dsk.cpp b/src/lib/formats/pc98fdi_dsk.cpp
index 83433606400..1e6f1809536 100644
--- a/src/lib/formats/pc98fdi_dsk.cpp
+++ b/src/lib/formats/pc98fdi_dsk.cpp
@@ -63,7 +63,7 @@ bool pc98fdi_format::load(io_generic *io, UINT32 form_factor, floppy_image *imag
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
int ssize;
- for(ssize=0; (128 << ssize) < sector_size; ssize++);
+ for(ssize=0; (128 << ssize) < sector_size; ssize++) {};
desc_pc_sector sects[256];
UINT8 sect_data[65536];
diff --git a/src/lib/formats/pc98fdi_dsk.h b/src/lib/formats/pc98fdi_dsk.h
index c71c4c587fd..05fd1ccc361 100644
--- a/src/lib/formats/pc98fdi_dsk.h
+++ b/src/lib/formats/pc98fdi_dsk.h
@@ -19,13 +19,13 @@ class pc98fdi_format : public floppy_image_format_t
public:
pc98fdi_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_PC98FDI_FORMAT;
diff --git a/src/lib/formats/pc_dsk.cpp b/src/lib/formats/pc_dsk.cpp
index 19e0f21e08e..0ab32aff7b3 100644
--- a/src/lib/formats/pc_dsk.cpp
+++ b/src/lib/formats/pc_dsk.cpp
@@ -134,7 +134,7 @@ static FLOPPY_CONSTRUCT(pc_dsk_construct)
/* ----------------------------------------------------------------------- */
LEGACY_FLOPPY_OPTIONS_START( pc )
- LEGACY_FLOPPY_OPTION( pc_dsk, "dsk,ima,img,ufi,360", "PC floppy disk image", pc_dsk_identify, pc_dsk_construct, NULL,
+ LEGACY_FLOPPY_OPTION( pc_dsk, "dsk,ima,img,ufi,360", "PC floppy disk image", pc_dsk_identify, pc_dsk_construct, nullptr,
HEADS([1]-2)
TRACKS(40/[80])
SECTORS(8/[9]/10/15/18/36))
diff --git a/src/lib/formats/pc_dsk.h b/src/lib/formats/pc_dsk.h
index f6e1fbc5637..381ad49e99a 100644
--- a/src/lib/formats/pc_dsk.h
+++ b/src/lib/formats/pc_dsk.h
@@ -24,9 +24,9 @@ class pc_format : public upd765_format
public:
pc_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/phc25_cas.cpp b/src/lib/formats/phc25_cas.cpp
index 1253bd98a3a..73dfdb17ff3 100644
--- a/src/lib/formats/phc25_cas.cpp
+++ b/src/lib/formats/phc25_cas.cpp
@@ -144,7 +144,7 @@ static int phc25_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
{
phc25_image_size = length;
- return phc25_handle_cassette(NULL, bytes);
+ return phc25_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller phc25_legacy_fill_wave =
@@ -173,7 +173,7 @@ static const struct CassetteFormat phc25_cassette_image_format =
"phc",
phc25_cassette_identify,
phc25_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(phc25_cassette_formats)
diff --git a/src/lib/formats/pk8020_dsk.h b/src/lib/formats/pk8020_dsk.h
index 1700530c781..7a9da57651a 100644
--- a/src/lib/formats/pk8020_dsk.h
+++ b/src/lib/formats/pk8020_dsk.h
@@ -20,9 +20,9 @@ class pk8020_format : public wd177x_format
public:
pk8020_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/pmd_cas.cpp b/src/lib/formats/pmd_cas.cpp
index ba5baee1a65..4643eaf9251 100644
--- a/src/lib/formats/pmd_cas.cpp
+++ b/src/lib/formats/pmd_cas.cpp
@@ -181,7 +181,7 @@ static int pmd85_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
{
pmd85_image_size = length;
- return pmd85_handle_cassette(NULL, bytes);
+ return pmd85_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller pmd85_legacy_fill_wave =
@@ -210,7 +210,7 @@ static const struct CassetteFormat pmd85_cassette_image_format =
"pmd,tap,ptp",
pmd85_cassette_identify,
pmd85_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(pmd85_cassette_formats)
diff --git a/src/lib/formats/primoptp.cpp b/src/lib/formats/primoptp.cpp
index 635f66d25ac..23aab613c29 100644
--- a/src/lib/formats/primoptp.cpp
+++ b/src/lib/formats/primoptp.cpp
@@ -241,7 +241,7 @@ static const struct CassetteFormat primo_ptp_image_format =
"ptp",
primo_ptp_identify,
primo_ptp_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(primo_ptp_format)
diff --git a/src/lib/formats/pyldin_dsk.h b/src/lib/formats/pyldin_dsk.h
index 485a5c1e3fe..9ff5482e974 100644
--- a/src/lib/formats/pyldin_dsk.h
+++ b/src/lib/formats/pyldin_dsk.h
@@ -17,9 +17,9 @@ class pyldin_format : public upd765_format {
public:
pyldin_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/ql_dsk.h b/src/lib/formats/ql_dsk.h
index 7c7f52be852..96003df6984 100644
--- a/src/lib/formats/ql_dsk.h
+++ b/src/lib/formats/ql_dsk.h
@@ -17,9 +17,9 @@ class ql_format : public wd177x_format {
public:
ql_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/rk_cas.cpp b/src/lib/formats/rk_cas.cpp
index 03139e1515d..968b8afdc23 100644
--- a/src/lib/formats/rk_cas.cpp
+++ b/src/lib/formats/rk_cas.cpp
@@ -217,63 +217,63 @@ static const struct CassetteFormat rku_cassette_format = {
"rku",
rk20_cassette_identify,
rk20_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat rk8_cassette_format = {
"rk8",
rk60_cassette_identify,
rk60_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat rks_cassette_format = {
"rks",
rk20_cassette_identify,
rk20_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat rko_cassette_format = {
"rko",
rk20_cassette_identify,
rk20_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat rkr_cassette_format = {
"rk,rkr",
rk20_cassette_identify,
rk20_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat rka_cassette_format = {
"rka",
rk20_cassette_identify,
rk20_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat rkm_cassette_format = {
"rkm",
rk22_cassette_identify,
rk22_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat rkp_cassette_format = {
"rkp",
rk20_cassette_identify,
rk20_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat gam_cassette_format = {
"gam,g16,pki",
gam_cassette_identify,
gam_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(rku_cassette_formats)
diff --git a/src/lib/formats/rx50_dsk.h b/src/lib/formats/rx50_dsk.h
index 2fd09429c9a..37decb2fa09 100644
--- a/src/lib/formats/rx50_dsk.h
+++ b/src/lib/formats/rx50_dsk.h
@@ -22,14 +22,14 @@ class rx50img_format : public floppy_image_format_t
public:
rx50img_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
-
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
static const desc_e rx50_10_desc[];
diff --git a/src/lib/formats/sc3000_bit.cpp b/src/lib/formats/sc3000_bit.cpp
index 2b5fd635db5..f15488bda68 100644
--- a/src/lib/formats/sc3000_bit.cpp
+++ b/src/lib/formats/sc3000_bit.cpp
@@ -98,7 +98,7 @@ const struct CassetteFormat sc3000_bit_format =
"bit",
sc3000_bit_identify,
sc3000_bit_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START( sc3000_cassette_formats )
diff --git a/src/lib/formats/sf7000_dsk.h b/src/lib/formats/sf7000_dsk.h
index df84e36fe22..75f7ff7e314 100644
--- a/src/lib/formats/sf7000_dsk.h
+++ b/src/lib/formats/sf7000_dsk.h
@@ -17,9 +17,9 @@ class sf7000_format : public upd765_format {
public:
sf7000_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/smx_dsk.h b/src/lib/formats/smx_dsk.h
index 0b8aba5ac07..36a3bd251b5 100644
--- a/src/lib/formats/smx_dsk.h
+++ b/src/lib/formats/smx_dsk.h
@@ -17,9 +17,9 @@ class smx_format : public wd177x_format {
public:
smx_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/sol_cas.cpp b/src/lib/formats/sol_cas.cpp
index 26f1bdccf00..1f22cd68a9f 100644
--- a/src/lib/formats/sol_cas.cpp
+++ b/src/lib/formats/sol_cas.cpp
@@ -342,7 +342,7 @@ static int sol20_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
{
sol20_image_size = length;
- return sol20_handle_cassette(NULL, bytes);
+ return sol20_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller sol20_legacy_fill_wave =
@@ -371,7 +371,7 @@ static const struct CassetteFormat sol20_cassette_image_format =
"svt",
sol20_cassette_identify,
sol20_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(sol20_cassette_formats)
diff --git a/src/lib/formats/sorc_cas.cpp b/src/lib/formats/sorc_cas.cpp
index 6983dd0ba74..a900f77d5e5 100644
--- a/src/lib/formats/sorc_cas.cpp
+++ b/src/lib/formats/sorc_cas.cpp
@@ -121,7 +121,7 @@ static int sorcerer_cassette_calculate_size_in_samples(const UINT8 *bytes, int l
{
sorcerer_image_size = length;
- return sorcerer_handle_cassette(NULL, bytes);
+ return sorcerer_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller sorcerer_legacy_fill_wave =
@@ -150,7 +150,7 @@ static const struct CassetteFormat sorcerer_cassette_image_format =
"tape",
sorcerer_cassette_identify,
sorcerer_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(sorcerer_cassette_formats)
diff --git a/src/lib/formats/sorc_dsk.cpp b/src/lib/formats/sorc_dsk.cpp
index 5e59d30cdb1..27dc4270f05 100644
--- a/src/lib/formats/sorc_dsk.cpp
+++ b/src/lib/formats/sorc_dsk.cpp
@@ -107,7 +107,7 @@ static floperr_t sorc_write_indexed_sector(floppy_image_legacy *floppy, int head
static floperr_t sorc_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
- err = get_offset(floppy, head, track, sector, FALSE, NULL);
+ err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@@ -156,5 +156,5 @@ static FLOPPY_CONSTRUCT(sorc_dsk_construct)
/* ----------------------------------------------------------------------- */
LEGACY_FLOPPY_OPTIONS_START( sorcerer )
- LEGACY_FLOPPY_OPTION( sorc_dsk, "dsk", "Exidy Sorcerer floppy disk image", sorc_dsk_identify, sorc_dsk_construct, NULL, NULL)
+ LEGACY_FLOPPY_OPTION( sorc_dsk, "dsk", "Exidy Sorcerer floppy disk image", sorc_dsk_identify, sorc_dsk_construct, nullptr, nullptr)
LEGACY_FLOPPY_OPTIONS_END
diff --git a/src/lib/formats/sord_cas.cpp b/src/lib/formats/sord_cas.cpp
index eb8a27bdba4..39de0fbca84 100644
--- a/src/lib/formats/sord_cas.cpp
+++ b/src/lib/formats/sord_cas.cpp
@@ -133,7 +133,7 @@ static const struct CassetteFormat sordm5_cas_format =
"cas",
sordm5_tap_identify,
sordm5_tap_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(sordm5_cassette_formats)
diff --git a/src/lib/formats/spc1000_cas.cpp b/src/lib/formats/spc1000_cas.cpp
index b05844b6ee7..3c86305e8a8 100644
--- a/src/lib/formats/spc1000_cas.cpp
+++ b/src/lib/formats/spc1000_cas.cpp
@@ -108,14 +108,14 @@ static int spc1000_tap_calculate_size_in_samples(const UINT8 *bytes, int length)
{
spc1000_image_size = length;
- return spc1000_handle_tap(NULL, bytes);
+ return spc1000_handle_tap(nullptr, bytes);
}
static int spc1000_cas_calculate_size_in_samples(const UINT8 *bytes, int length)
{
spc1000_image_size = length;
- return spc1000_handle_cas(NULL, bytes);
+ return spc1000_handle_cas(nullptr, bytes);
}
@@ -151,7 +151,7 @@ static const struct CassetteFormat spc1000_tap_cassette_image_format =
"tap",
spc1000_tap_cassette_identify,
spc1000_tap_cassette_load,
- NULL
+ nullptr
};
@@ -182,7 +182,7 @@ static const struct CassetteFormat spc1000_cas_cassette_image_format =
"cas",
spc1000_cas_cassette_identify,
spc1000_cas_cassette_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/st_dsk.h b/src/lib/formats/st_dsk.h
index 0888c980c72..242d7e9cf5b 100644
--- a/src/lib/formats/st_dsk.h
+++ b/src/lib/formats/st_dsk.h
@@ -18,14 +18,14 @@ class st_format : public floppy_image_format_t
public:
st_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
private:
void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
@@ -36,14 +36,14 @@ class msa_format : public floppy_image_format_t
public:
msa_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
private:
bool uncompress(UINT8 *buffer, int csize, int usize);
diff --git a/src/lib/formats/svi_cas.cpp b/src/lib/formats/svi_cas.cpp
index dd2bde8d5a1..a95c3b97fb5 100644
--- a/src/lib/formats/svi_cas.cpp
+++ b/src/lib/formats/svi_cas.cpp
@@ -203,7 +203,7 @@ static const struct CassetteFormat svi_cas_format =
"cas",
svi_cas_identify,
svi_cas_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/svi_dsk.h b/src/lib/formats/svi_dsk.h
index 6ffd74619a1..9ae933572df 100644
--- a/src/lib/formats/svi_dsk.h
+++ b/src/lib/formats/svi_dsk.h
@@ -20,14 +20,14 @@ class svi_format : public floppy_image_format_t
public:
svi_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
-
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_SVI_FORMAT;
diff --git a/src/lib/formats/tandy2k_dsk.h b/src/lib/formats/tandy2k_dsk.h
index c306018fa48..e69eead2e55 100644
--- a/src/lib/formats/tandy2k_dsk.h
+++ b/src/lib/formats/tandy2k_dsk.h
@@ -17,9 +17,9 @@ class tandy2k_format : public upd765_format {
public:
tandy2k_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/td0_dsk.cpp b/src/lib/formats/td0_dsk.cpp
index 185bb21cfed..69b3e5bfc14 100644
--- a/src/lib/formats/td0_dsk.cpp
+++ b/src/lib/formats/td0_dsk.cpp
@@ -298,7 +298,7 @@ static floperr_t td0_read_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
- err = get_offset(floppy, head, track, sector, FALSE, NULL);
+ err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@@ -510,7 +510,7 @@ void td0dsk_t::reconst()
for (i = 0, j = N_CHAR; j < T; i += 2, j++) {
k = i + 1;
f = freq[j] = freq[i] + freq[k];
- for (k = j - 1; f < freq[k]; k--);
+ for (k = j - 1; f < freq[k]; k--) {};
k++;
l = (j - k) * 2;
@@ -550,7 +550,7 @@ void td0dsk_t::update(int c)
/* swap nodes to keep the tree freq-ordered */
if (k > freq[l = c + 1]) {
- while (k > freq[++l]);
+ while (k > freq[++l]) {};
l--;
freq[c] = freq[l];
freq[l] = k;
@@ -699,7 +699,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
return FLOPPY_ERROR_OUTOFMEMORY;
tag->data = (UINT8*)malloc(floppy_image_size(floppy));
- if (tag->data==NULL) {
+ if (tag->data==nullptr) {
return FLOPPY_ERROR_OUTOFMEMORY;
}
floppy_image_read(floppy, tag->data, 0, floppy_image_size(floppy));
@@ -720,7 +720,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
memcpy(obuf,tag->data,12);
free(tag->data);
tag->data = (UINT8*)malloc(size+12);
- if (tag->data==NULL) {
+ if (tag->data==nullptr) {
return FLOPPY_ERROR_OUTOFMEMORY;
}
memcpy(tag->data,obuf,12);
@@ -786,7 +786,7 @@ FLOPPY_DESTRUCT( td0_dsk_destruct )
{
struct td0dsk_tag *tag = get_tag(floppy);
free(tag->data);
- tag->data = NULL;
+ tag->data = nullptr;
return FLOPPY_ERROR_SUCCESS;
}
@@ -999,7 +999,7 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sdatapos += size;
}
else
- sects[i].data = NULL;
+ sects[i].data = nullptr;
}
track_count = track;
diff --git a/src/lib/formats/td0_dsk.h b/src/lib/formats/td0_dsk.h
index a714d1d9e1c..eae873e30e0 100644
--- a/src/lib/formats/td0_dsk.h
+++ b/src/lib/formats/td0_dsk.h
@@ -11,14 +11,14 @@ class td0_format : public floppy_image_format_t
public:
td0_format();
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
};
extern const floppy_format_type FLOPPY_TD0_FORMAT;
diff --git a/src/lib/formats/thom_cas.cpp b/src/lib/formats/thom_cas.cpp
index 9fd6d6f0208..799e96c38ca 100644
--- a/src/lib/formats/thom_cas.cpp
+++ b/src/lib/formats/thom_cas.cpp
@@ -119,7 +119,7 @@ static casserr_t to7_k7_load( cassette_image *cass )
if ( to7_k7_bits )
{
free( to7_k7_bits );
- to7_k7_bits = NULL;
+ to7_k7_bits = nullptr;
}
to7_k7_bitsize = 0;
@@ -366,7 +366,7 @@ static casserr_t to7_k7_load( cassette_image *cass )
static const struct CassetteFormat to7_k7 =
-{ "k7", to7_k7_identify, to7_k7_load, NULL /* no save */ };
+{ "k7", to7_k7_identify, to7_k7_load, nullptr /* no save */ };
@@ -392,7 +392,7 @@ static casserr_t to7_wav_load ( cassette_image *cass )
if ( to7_k7_bits )
{
free( to7_k7_bits );
- to7_k7_bits = NULL;
+ to7_k7_bits = nullptr;
}
if ( e != CASSETTE_ERROR_SUCCESS )
@@ -730,7 +730,7 @@ static casserr_t mo5_k5_load( cassette_image *cass )
static const struct CassetteFormat mo5_k5 =
-{ "k5,k7", mo5_k5_identify, mo5_k5_load, NULL /* no save */ };
+{ "k5,k7", mo5_k5_identify, mo5_k5_load, nullptr /* no save */ };
/********************* MO5 WAV format ************************/
@@ -781,8 +781,8 @@ static const struct CassetteFormat mo5_wav =
const struct CassetteFormat *const to7_cassette_formats[] =
-{ &to7_wav, &to7_k7, NULL };
+{ &to7_wav, &to7_k7, nullptr };
const struct CassetteFormat *const mo5_cassette_formats[] =
-{ &mo5_wav, &mo5_k5, NULL };
+{ &mo5_wav, &mo5_k5, nullptr };
diff --git a/src/lib/formats/thom_dsk.cpp b/src/lib/formats/thom_dsk.cpp
index ed9d977b723..da7187d65f8 100644
--- a/src/lib/formats/thom_dsk.cpp
+++ b/src/lib/formats/thom_dsk.cpp
@@ -175,7 +175,7 @@ static floperr_t sap_write_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t sap_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
- err = get_offset(floppy, head, track, sector, FALSE, NULL);
+ err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@@ -353,37 +353,37 @@ static FLOPPY_CONSTRUCT(qdd_dsk_construct)
LEGACY_FLOPPY_OPTIONS_START(thomson)
- LEGACY_FLOPPY_OPTION(fdmfm2, "fd", "Thomson FD (MFM) 80 tracks disk image (3\"1/2 DD)", basicdsk_identify_default, basicdsk_construct_default, NULL,
+ LEGACY_FLOPPY_OPTION(fdmfm2, "fd", "Thomson FD (MFM) 80 tracks disk image (3\"1/2 DD)", basicdsk_identify_default, basicdsk_construct_default, nullptr,
HEADS([1])
TRACKS([80])
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([1]))
- LEGACY_FLOPPY_OPTION(fdmfm, "fd", "Thomson FD (MFM) 40 tracks disk image (5\"1/4 DD)", basicdsk_identify_default, basicdsk_construct_default, NULL,
+ LEGACY_FLOPPY_OPTION(fdmfm, "fd", "Thomson FD (MFM) 40 tracks disk image (5\"1/4 DD)", basicdsk_identify_default, basicdsk_construct_default, nullptr,
HEADS([1])
TRACKS([40])
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([1]))
- LEGACY_FLOPPY_OPTION(fd2, "fd", "Thomson FD (FM) 80 tracks disk image (3\"1/2 SD)", basicdsk_identify_default, basicdsk_construct_default, NULL,
+ LEGACY_FLOPPY_OPTION(fd2, "fd", "Thomson FD (FM) 80 tracks disk image (3\"1/2 SD)", basicdsk_identify_default, basicdsk_construct_default, nullptr,
HEADS([1])
TRACKS([80])
SECTORS([16])
SECTOR_LENGTH([128])
FIRST_SECTOR_ID([1]))
- LEGACY_FLOPPY_OPTION(fd, "fd", "Thomson FD (FM) 40 tracks disk image (5\"1/4 SD)", basicdsk_identify_default, basicdsk_construct_default, NULL,
+ LEGACY_FLOPPY_OPTION(fd, "fd", "Thomson FD (FM) 40 tracks disk image (5\"1/4 SD)", basicdsk_identify_default, basicdsk_construct_default, nullptr,
HEADS([1])
TRACKS([40])
SECTORS([16])
SECTOR_LENGTH([128])
FIRST_SECTOR_ID([1]))
- LEGACY_FLOPPY_OPTION(sap,"sap", "Thomson SAP floppy disk image", sap_dsk_identify, sap_dsk_construct, NULL, NULL)
+ LEGACY_FLOPPY_OPTION(sap,"sap", "Thomson SAP floppy disk image", sap_dsk_identify, sap_dsk_construct, nullptr, nullptr)
- LEGACY_FLOPPY_OPTION(qdd,"qd", "Thomson QDD floppy disk image (2\"8 SD)", qdd_dsk_identify, qdd_dsk_construct, NULL,
+ LEGACY_FLOPPY_OPTION(qdd,"qd", "Thomson QDD floppy disk image (2\"8 SD)", qdd_dsk_identify, qdd_dsk_construct, nullptr,
HEADS([1])
TRACKS([1])
SECTORS([400])
diff --git a/src/lib/formats/ti99_dsk.h b/src/lib/formats/ti99_dsk.h
index a61d3da1a69..64285c1dcce 100644
--- a/src/lib/formats/ti99_dsk.h
+++ b/src/lib/formats/ti99_dsk.h
@@ -19,9 +19,9 @@
class ti99_floppy_format : public floppy_image_format_t
{
public:
- bool supports_save() const { return true; }
- bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- bool save(io_generic *io, floppy_image *image);
+ bool supports_save() const override { return true; }
+ bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ bool save(io_generic *io, floppy_image *image) override;
protected:
int decode_bitstream(const UINT8 *bitstream, UINT8 *trackdata, int *sector, int cell_count, int encoding, UINT8 gapbytes, int track_size);
@@ -35,7 +35,6 @@ protected:
virtual void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) =0;
int get_encoding(int cell_size);
- int get_track_size(int cell_size);
void generate_track_fm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image);
void generate_track_mfm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image);
@@ -52,19 +51,19 @@ protected:
class ti99_sdf_format : public ti99_floppy_format
{
public:
- int identify(io_generic *io, UINT32 form_factor);
- const char *name() const;
- const char *description() const;
- const char *extensions() const;
+ int identify(io_generic *io, UINT32 form_factor) override;
+ const char *name() const override;
+ const char *description() const override;
+ const char *extensions() const override;
private:
- void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads);
- int get_track_size(int cell_size, int sector_count);
- void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes);
- void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int sectorcount, int trackcount, int cellsize);
+ void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads) override;
+ int get_track_size(int cell_size, int sector_count) override;
+ void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
+ void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int sectorcount, int trackcount, int cellsize) override;
// This format supports single-sided images
- int min_heads() { return 1; }
+ int min_heads() override { return 1; }
struct ti99vib
{
@@ -91,19 +90,19 @@ extern const floppy_format_type FLOPPY_TI99_SDF_FORMAT;
class ti99_tdf_format : public ti99_floppy_format
{
public:
- int identify(io_generic *io, UINT32 form_factor);
- const char *name() const;
- const char *description() const;
- const char *extensions() const;
+ int identify(io_generic *io, UINT32 form_factor) override;
+ const char *name() const override;
+ const char *description() const override;
+ const char *extensions() const override;
private:
- void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads);
- void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int sectorcount, int trackcount, int cellsize);
- void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes);
- int get_track_size(int cell_size, int sector_count);
+ void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads) override;
+ void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int sectorcount, int trackcount, int cellsize) override;
+ void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
+ int get_track_size(int cell_size, int sector_count) override;
// This format only supports double-sided images
- int min_heads() { return 2; }
+ int min_heads() override { return 2; }
};
extern const floppy_format_type FLOPPY_TI99_TDF_FORMAT;
diff --git a/src/lib/formats/tiki100_dsk.h b/src/lib/formats/tiki100_dsk.h
index e3899f97ef9..4037ec5fe77 100644
--- a/src/lib/formats/tiki100_dsk.h
+++ b/src/lib/formats/tiki100_dsk.h
@@ -17,9 +17,9 @@ class tiki100_format : public wd177x_format {
public:
tiki100_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/trd_dsk.h b/src/lib/formats/trd_dsk.h
index 1d830c6d6c5..de4b7ff63d5 100644
--- a/src/lib/formats/trd_dsk.h
+++ b/src/lib/formats/trd_dsk.h
@@ -17,9 +17,9 @@ class trd_format : public wd177x_format {
public:
trd_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/trs80_dsk.h b/src/lib/formats/trs80_dsk.h
index 988d7ee2a7d..73583ca0f48 100644
--- a/src/lib/formats/trs80_dsk.h
+++ b/src/lib/formats/trs80_dsk.h
@@ -20,12 +20,12 @@ class trs80_format : public wd177x_format
public:
trs80_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
protected:
- virtual int get_track_dam_fm(const format &f, int head, int track);
+ virtual int get_track_dam_fm(const format &f, int head, int track) override;
private:
static const format formats[];
diff --git a/src/lib/formats/trs_cas.cpp b/src/lib/formats/trs_cas.cpp
index a4f748dea05..ec8bea116a7 100644
--- a/src/lib/formats/trs_cas.cpp
+++ b/src/lib/formats/trs_cas.cpp
@@ -21,7 +21,7 @@ static int cas_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-INLINE int trs80l2_cas_cycle(INT16 *buffer, int sample_pos, int silence, int high, int low)
+static inline int trs80l2_cas_cycle(INT16 *buffer, int sample_pos, int silence, int high, int low)
{
int i = 0;
@@ -96,7 +96,7 @@ static int trs80l2_cas_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen;
- return trs80l2_handle_cas( NULL, casdata );
+ return trs80l2_handle_cas( nullptr, casdata );
}
static const struct CassetteLegacyWaveFiller trs80l2_cas_legacy_fill_wave =
@@ -128,7 +128,7 @@ static const struct CassetteFormat trs80l2_cas_format =
"cas",
trs80l2_cas_identify,
trs80l2_cas_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/tvc_cas.cpp b/src/lib/formats/tvc_cas.cpp
index a33fba687b9..7dad5dac819 100644
--- a/src/lib/formats/tvc_cas.cpp
+++ b/src/lib/formats/tvc_cas.cpp
@@ -221,7 +221,7 @@ static const struct CassetteFormat tvc64_cassette_image_format =
"cas",
tvc64_cassette_identify,
tvc64_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(tvc64_cassette_formats)
diff --git a/src/lib/formats/tvc_dsk.h b/src/lib/formats/tvc_dsk.h
index f6796639d03..67df189b3da 100644
--- a/src/lib/formats/tvc_dsk.h
+++ b/src/lib/formats/tvc_dsk.h
@@ -17,9 +17,9 @@ class tvc_format : public wd177x_format {
public:
tvc_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp
index 225184b7bd0..d78fee1595f 100644
--- a/src/lib/formats/tzx_cas.cpp
+++ b/src/lib/formats/tzx_cas.cpp
@@ -66,7 +66,7 @@ static const UINT8 TZX_HEADER[8] = { 'Z','X','T','a','p','e','!',0x1a };
static INT16 wave_data = 0;
static int block_count = 0;
-static UINT8** blocks = NULL;
+static UINT8** blocks = nullptr;
static float t_scale = 1; /* for scaling T-states to the 4MHz CPC */
static void toggle_wave_data(void)
@@ -207,19 +207,19 @@ static void tzx_cas_get_blocks( const UINT8 *casdata, int caslen )
}
}
-INLINE int millisec_to_samplecount( int millisec )
+static inline int millisec_to_samplecount( int millisec )
{
return (int) (millisec * ((double)TZX_WAV_FREQUENCY / 1000.0));
}
-INLINE int tcycles_to_samplecount( int tcycles )
+static inline int tcycles_to_samplecount( int tcycles )
{
return (int) ((0.5 + (((double)TZX_WAV_FREQUENCY / 3500000) * (double)tcycles)) * (double) t_scale);
}
static void tzx_output_wave( INT16 **buffer, int length )
{
- if (buffer == NULL)
+ if (buffer == nullptr)
{
return;
}
@@ -335,14 +335,14 @@ static int tzx_handle_direct(INT16 **buffer, const UINT8 *bytes, int pause, int
}
-INLINE int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8 symbol, int maxp)
+static inline int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8 symbol, int maxp)
{
int size = 0;
const UINT8 *cursymb = symtable + (2 * maxp + 1)*symbol;
UINT8 starttype = cursymb[0];
-// printf("start polarity %01x (max number of symbols is %d)\n", starttype, maxp);
+// printf("start polarity %01x (max number of symbols is %d)\n", starttype, maxp);
switch (starttype)
{
@@ -371,13 +371,11 @@ INLINE int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8 symbol
for (int i = 0; i < maxp; i++)
{
UINT16 pulse_length = cursymb[1 + (i*2)] | (cursymb[2 + (i*2)] << 8);
- // printf("pulse_length %04x\n", pulse_length);
+ // printf("pulse_length %04x\n", pulse_length);
// shorter lists can be terminated with a pulse_length of 0
if (pulse_length != 0)
{
-
-
int samples = tcycles_to_samplecount(pulse_length);
tzx_output_wave(buffer, samples);
size += samples;
@@ -397,7 +395,7 @@ INLINE int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8 symbol
return size;
}
-INLINE int stream_get_bit(const UINT8 *bytes, UINT8 &stream_bit, UINT32 &stream_byte)
+static inline int stream_get_bit(const UINT8 *bytes, UINT8 &stream_bit, UINT32 &stream_byte)
{
// get bit here
UINT8 retbit = 0;
@@ -425,7 +423,7 @@ static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause,
if (totp > 0)
{
- // printf("pilot block table %04x\n", totp);
+ // printf("pilot block table %04x\n", totp);
const UINT8 *symtable = bytes;
const UINT8 *table2 = symtable + (2 * npp + 1)*asp;
@@ -440,7 +438,7 @@ static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause,
for (int j = 0; j < repetitions; j++)
{
size += tzx_handle_symbol(buffer, symtable, symbol, npp);
- // toggle_wave_data();
+ // toggle_wave_data();
}
@@ -470,7 +468,7 @@ static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause,
for (int i = 0; i < totd; i++)
{
UINT8 symbol = 0;
-
+
for (int j = 0; j < NB; j++)
{
symbol |= stream_get_bit(table2, stream_bit, stream_byte) << j;
@@ -750,12 +748,12 @@ static int tzx_cas_do_work( INT16 **buffer )
data_size = cur_block[1] + (cur_block[2] << 8) + (cur_block[3] << 16) + (cur_block[4] << 24);
pause_time= cur_block[5] + (cur_block[6] << 8);
-
+
UINT32 totp = cur_block[7] + (cur_block[8] << 8) + (cur_block[9] << 16) + (cur_block[10] << 24);
int npp = cur_block[11];
int asp = cur_block[12];
if (asp == 0) asp = 256;
-
+
UINT32 totd = cur_block[13] + (cur_block[14] << 8) + (cur_block[15] << 16) + (cur_block[16] << 24);
int npd = cur_block[17];
int asd = cur_block[18];
@@ -807,7 +805,7 @@ static int tzx_cas_to_wav_size( const UINT8 *casdata, int caslen )
goto cleanup;
}
- size = tzx_cas_do_work(NULL);
+ size = tzx_cas_do_work(nullptr);
return size;
@@ -845,7 +843,7 @@ static int tap_cas_to_wav_size( const UINT8 *casdata, int caslen )
// int pilot_length = (p[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */
LOG_FORMATS("tap_cas_to_wav_size: Handling TAP block containing 0x%X bytes", data_size);
p += 2;
- size += tzx_cas_handle_block(NULL, p, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8);
+ size += tzx_cas_handle_block(nullptr, p, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8);
LOG_FORMATS(", total size is now: %d\n", size);
p += data_size;
}
@@ -938,7 +936,7 @@ static const struct CassetteFormat tzx_cassette_format =
"tzx",
tzx_cassette_identify,
tzx_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat tap_cassette_format =
@@ -946,7 +944,7 @@ static const struct CassetteFormat tap_cassette_format =
"tap,blk",
tap_cassette_identify,
tap_cassette_load,
- NULL
+ nullptr
};
static const struct CassetteFormat cdt_cassette_format =
@@ -954,7 +952,7 @@ static const struct CassetteFormat cdt_cassette_format =
"cdt",
cdt_cassette_identify,
cdt_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(tzx_cassette_formats)
diff --git a/src/lib/formats/uef_cas.cpp b/src/lib/formats/uef_cas.cpp
index f078ae776c4..6db1716348b 100644
--- a/src/lib/formats/uef_cas.cpp
+++ b/src/lib/formats/uef_cas.cpp
@@ -50,7 +50,7 @@ static const UINT8* skip_gz_header( const UINT8 *p ) {
method = *p; p++;
flags = *p; p++;
if ( method != Z_DEFLATED || ( flags & RESERVED ) != 0 ) {
- return NULL;
+ return nullptr;
}
/* Skip time, xflags and OS code */
p += 6;
@@ -75,7 +75,7 @@ static const UINT8* skip_gz_header( const UINT8 *p ) {
return p;
}
-static UINT8 *gz_ptr = NULL;
+static UINT8 *gz_ptr = nullptr;
static float get_uef_float( const UINT8 *Float)
{
@@ -114,14 +114,14 @@ static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
int inflate_size = ( casdata[ caslen - 1 ] << 24 ) | ( casdata[ caslen - 2 ] << 16 ) | ( casdata[ caslen - 3 ] << 8 ) | casdata[ caslen - 4 ];
const UINT8 *in_ptr = skip_gz_header( casdata );
- if ( in_ptr == NULL ) {
+ if ( in_ptr == nullptr ) {
goto cleanup;
}
gz_ptr = (UINT8 *)malloc( inflate_size );
- d_stream.zalloc = 0;
- d_stream.zfree = 0;
- d_stream.opaque = 0;
+ d_stream.zalloc = nullptr;
+ d_stream.zfree = nullptr;
+ d_stream.opaque = nullptr;
d_stream.next_in = (unsigned char *)in_ptr;
d_stream.avail_in = caslen - ( in_ptr - casdata );
d_stream.next_out = gz_ptr;
@@ -207,7 +207,7 @@ static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
cleanup:
if ( gz_ptr ) {
free( gz_ptr );
- gz_ptr = NULL;
+ gz_ptr = nullptr;
}
return -1;
}
@@ -232,7 +232,7 @@ static int uef_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
INT16 *p = buffer;
if ( bytes[0] == 0x1f && bytes[1] == 0x8b ) {
- if ( gz_ptr == NULL ) {
+ if ( gz_ptr == nullptr ) {
return 1;
}
bytes = gz_ptr;
@@ -327,7 +327,7 @@ const struct CassetteFormat uef_cassette_format = {
"uef",
uef_cassette_identify,
uef_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(uef_cassette_formats)
diff --git a/src/lib/formats/upd765_dsk.cpp b/src/lib/formats/upd765_dsk.cpp
index eef28c23a4b..d9da1c5bd21 100644
--- a/src/lib/formats/upd765_dsk.cpp
+++ b/src/lib/formats/upd765_dsk.cpp
@@ -16,7 +16,7 @@ upd765_format::upd765_format(const format *_formats)
formats = _formats;
}
-int upd765_format::find_size(io_generic *io, UINT32 form_factor)
+int upd765_format::find_size(io_generic *io, UINT32 form_factor) const
{
UINT64 size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
@@ -232,7 +232,7 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
{
// Count the number of formats
int formats_count;
- for(formats_count=0; formats[formats_count].form_factor; formats_count++);
+ for(formats_count=0; formats[formats_count].form_factor; formats_count++) {};
// Allocate the storage for the list of testable formats for a
// given cell size
diff --git a/src/lib/formats/upd765_dsk.h b/src/lib/formats/upd765_dsk.h
index 6f36d1225a5..a108931d89b 100644
--- a/src/lib/formats/upd765_dsk.h
+++ b/src/lib/formats/upd765_dsk.h
@@ -38,15 +38,15 @@ public:
// End the array with {}
upd765_format(const format *formats);
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+ virtual bool supports_save() const override;
protected:
floppy_image_format_t::desc_e* get_desc_fm(const format &f, int &current_size, int &end_gap_index);
floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int &current_size, int &end_gap_index);
- int find_size(io_generic *io, UINT32 form_factor);
+ int find_size(io_generic *io, UINT32 form_factor) const;
int compute_track_size(const format &f) const;
virtual void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors, int track, int head) const;
void check_compatibility(floppy_image *image, std::vector<int> &candidates);
diff --git a/src/lib/formats/vdk_dsk.h b/src/lib/formats/vdk_dsk.h
index 5570c14eab8..b685cb32f8b 100644
--- a/src/lib/formats/vdk_dsk.h
+++ b/src/lib/formats/vdk_dsk.h
@@ -22,14 +22,14 @@ class vdk_format : public floppy_image_format_t
public:
vdk_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
-
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
- virtual bool supports_save() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+ virtual bool supports_save() const override;
private:
static const int SECTOR_SIZE = 256;
diff --git a/src/lib/formats/vector06_dsk.h b/src/lib/formats/vector06_dsk.h
index cad2fa3ddf3..f884d79cf78 100644
--- a/src/lib/formats/vector06_dsk.h
+++ b/src/lib/formats/vector06_dsk.h
@@ -20,9 +20,9 @@ class vector06_format : public wd177x_format
public:
vector06_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/vg5k_cas.cpp b/src/lib/formats/vg5k_cas.cpp
index ef648707fd8..2933f77f8c0 100644
--- a/src/lib/formats/vg5k_cas.cpp
+++ b/src/lib/formats/vg5k_cas.cpp
@@ -20,7 +20,7 @@ static int k7_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-INLINE int vg5k_cas_cycle(INT16 *buffer, int sample_pos, int len)
+static inline int vg5k_cas_cycle(INT16 *buffer, int sample_pos, int len)
{
int i = 0;
@@ -45,7 +45,7 @@ INLINE int vg5k_cas_cycle(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate n samples of silence
********************************************************************/
-INLINE int vg5k_cas_silence(INT16 *buffer, int sample_pos, int len)
+static inline int vg5k_cas_silence(INT16 *buffer, int sample_pos, int len)
{
int i = 0;
@@ -60,7 +60,7 @@ INLINE int vg5k_cas_silence(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate the end-byte samples
********************************************************************/
-INLINE int vg5k_cas_eob(INT16 *buffer, int sample_pos)
+static inline int vg5k_cas_eob(INT16 *buffer, int sample_pos)
{
int i, samples = 0;
@@ -73,7 +73,7 @@ INLINE int vg5k_cas_eob(INT16 *buffer, int sample_pos)
}
-INLINE int vg5k_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int vg5k_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
{
/* Writing an entire byte */
int i, samples;
@@ -100,7 +100,7 @@ INLINE int vg5k_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
/*******************************************************************
Generate n sample of synchro
********************************************************************/
-INLINE int vg5k_k7_synchro(INT16 *buffer, int sample_pos, int len)
+static inline int vg5k_k7_synchro(INT16 *buffer, int sample_pos, int len)
{
int i, samples = 0;
@@ -196,7 +196,7 @@ static int vg5k_k7_to_wav_size(const UINT8 *casdata, int caslen)
{
k7_size = caslen ;
- return vg5k_handle_tap( NULL, casdata );
+ return vg5k_handle_tap( nullptr, casdata );
}
@@ -228,7 +228,7 @@ static const struct CassetteFormat vg5k_k7_format =
"k7",
vg5k_k7_identify,
vg5k_k7_load,
- NULL
+ nullptr
};
diff --git a/src/lib/formats/victor9k_dsk.h b/src/lib/formats/victor9k_dsk.h
index 1564f1474f7..5664e66155b 100644
--- a/src/lib/formats/victor9k_dsk.h
+++ b/src/lib/formats/victor9k_dsk.h
@@ -27,14 +27,14 @@ public:
victor9k_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
-
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
- virtual bool supports_save() const { return true; }
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+ virtual bool supports_save() const override { return true; }
static int get_rpm(int head, int track);
diff --git a/src/lib/formats/vt_cas.cpp b/src/lib/formats/vt_cas.cpp
index d0910efcc84..91e5f69ba64 100644
--- a/src/lib/formats/vt_cas.cpp
+++ b/src/lib/formats/vt_cas.cpp
@@ -102,7 +102,7 @@ static const struct CassetteLegacyWaveFiller vtech1_legacy_fill_wave =
vtech1_cassette_fill_wave, /* fill_wave */
1, /* chunk_size */
V1_BYTESAMPLES, /* chunk_samples */
- NULL, /* chunk_sample_calc */
+ nullptr, /* chunk_sample_calc */
600*V1_BITSAMPLES, /* sample_frequency */
600*V1_BITSAMPLES, /* header_samples */
600*V1_BITSAMPLES /* trailer_samples */
@@ -123,7 +123,7 @@ static const struct CassetteFormat vtech1_cas_format =
"cas",
vtech1_cas_identify,
vtech1_cas_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(vtech1_cassette_formats)
@@ -197,7 +197,7 @@ static const struct CassetteLegacyWaveFiller vtech2_legacy_fill_wave =
vtech2_cassette_fill_wave, /* fill_wave */
1, /* chunk_size */
VT2_BYTESAMPLES, /* chunk_samples */
- NULL, /* chunk_sample_calc */
+ nullptr, /* chunk_sample_calc */
600*VT2_BITSAMPLES, /* sample_frequency */
600*VT2_BITSAMPLES, /* header_samples */
600*VT2_BITSAMPLES /* trailer_samples */
@@ -218,7 +218,7 @@ static const struct CassetteFormat vtech2_cas_format =
"cas",
vtech2_cas_identify,
vtech2_cas_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(vtech2_cassette_formats)
diff --git a/src/lib/formats/wd177x_dsk.cpp b/src/lib/formats/wd177x_dsk.cpp
index 69458af0335..527fb69a234 100644
--- a/src/lib/formats/wd177x_dsk.cpp
+++ b/src/lib/formats/wd177x_dsk.cpp
@@ -227,7 +227,7 @@ bool wd177x_format::save(io_generic *io, floppy_image *image)
{
// Count the number of formats
int formats_count;
- for(formats_count=0; formats[formats_count].form_factor; formats_count++);
+ for(formats_count=0; formats[formats_count].form_factor; formats_count++) {};
// Allocate the storage for the list of testable formats for a
// given cell size
diff --git a/src/lib/formats/wd177x_dsk.h b/src/lib/formats/wd177x_dsk.h
index a932beb1ced..6c93000b02c 100644
--- a/src/lib/formats/wd177x_dsk.h
+++ b/src/lib/formats/wd177x_dsk.h
@@ -37,10 +37,10 @@ public:
// End the array with {}
wd177x_format(const format *formats);
- virtual int identify(io_generic *io, UINT32 form_factor);
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
- virtual bool save(io_generic *io, floppy_image *image);
- virtual bool supports_save() const;
+ virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+ virtual bool supports_save() const override;
protected:
enum { FM_DAM = 0xf56f, FM_DDAM = 0xf56a, MFM_DAM = 0xfb, MFM_DDAM = 0xf8 };
diff --git a/src/lib/formats/x07_cas.cpp b/src/lib/formats/x07_cas.cpp
index 54f46acd488..0c36ad7c3e8 100644
--- a/src/lib/formats/x07_cas.cpp
+++ b/src/lib/formats/x07_cas.cpp
@@ -137,7 +137,7 @@ static int x07_cassette_calculate_size_in_samples(const UINT8 *bytes, int length
{
x07_image_size = length;
- return x07_handle_cassette(NULL, bytes);
+ return x07_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller x07_legacy_fill_wave =
@@ -166,7 +166,7 @@ static const struct CassetteFormat x07_cassette_image_format =
"k7,lst,cas",
x07_cassette_identify,
x07_cassette_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(x07_cassette_formats)
diff --git a/src/lib/formats/x1_tap.cpp b/src/lib/formats/x1_tap.cpp
index 5cf6f9fef94..f66ca7d4431 100644
--- a/src/lib/formats/x1_tap.cpp
+++ b/src/lib/formats/x1_tap.cpp
@@ -131,7 +131,7 @@ static const struct CassetteFormat x1_cassette_format = {
"tap",
x1_cas_identify,
x1_cas_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(x1_cassette_formats)
diff --git a/src/lib/formats/xdf_dsk.h b/src/lib/formats/xdf_dsk.h
index 628d998be87..8ef01c846e4 100644
--- a/src/lib/formats/xdf_dsk.h
+++ b/src/lib/formats/xdf_dsk.h
@@ -17,9 +17,9 @@ class xdf_format : public upd765_format {
public:
xdf_format();
- virtual const char *name() const;
- virtual const char *description() const;
- virtual const char *extensions() const;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
private:
static const format formats[];
diff --git a/src/lib/formats/zx81_p.cpp b/src/lib/formats/zx81_p.cpp
index 9a556f05ce5..5e6af375468 100644
--- a/src/lib/formats/zx81_p.cpp
+++ b/src/lib/formats/zx81_p.cpp
@@ -226,7 +226,7 @@ static const struct CassetteFormat zx81_p_image_format =
"p,81",
zx81_p_identify,
zx81_p_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(zx81_p_format)
@@ -289,7 +289,7 @@ static const struct CassetteFormat zx80_o_image_format =
"o,80",
zx80_o_identify,
zx80_o_load,
- NULL
+ nullptr
};
CASSETTE_FORMATLIST_START(zx80_o_format)
diff --git a/src/lib/netlist/analog/nld_bjt.h b/src/lib/netlist/analog/nld_bjt.h
index 520321f2db2..07f5923c17c 100644
--- a/src/lib/netlist/analog/nld_bjt.h
+++ b/src/lib/netlist/analog/nld_bjt.h
@@ -47,9 +47,9 @@ public:
inline bool is_qtype(q_type atype) const { return m_qtype == atype; }
inline void set_qtype(q_type atype) { m_qtype = atype; }
protected:
- virtual void start();
- virtual void reset();
- ATTR_HOT void update();
+ virtual void start() override;
+ virtual void reset() override;
+ ATTR_HOT void update() override;
param_model_t m_model;
private:
@@ -102,7 +102,7 @@ public:
m_gB(NETLIST_GMIN_DEFAULT), m_gC(NETLIST_GMIN_DEFAULT), m_V(0.0), m_state_on(0) { }
- ATTR_HOT void virtual update();
+ ATTR_HOT void virtual update() override;
nld_twoterm m_RB;
nld_twoterm m_RC;
@@ -113,9 +113,9 @@ public:
protected:
- virtual void start();
- ATTR_HOT virtual void update_param();
- virtual void reset();
+ virtual void start() override;
+ ATTR_HOT virtual void update_param() override;
+ virtual void reset() override;
NETLIB_UPDATE_TERMINALSI();
nl_double m_gB; // base conductance / switch on
@@ -145,10 +145,10 @@ public:
protected:
- virtual void start();
- virtual void reset();
- ATTR_HOT void update_param();
- ATTR_HOT void virtual update();
+ virtual void start() override;
+ virtual void reset() override;
+ ATTR_HOT void update_param() override;
+ ATTR_HOT void virtual update() override;
NETLIB_UPDATE_TERMINALSI();
generic_diode m_gD_BC;
diff --git a/src/lib/netlist/analog/nld_fourterm.h b/src/lib/netlist/analog/nld_fourterm.h
index 591df68dd79..7bed4e71a52 100644
--- a/src/lib/netlist/analog/nld_fourterm.h
+++ b/src/lib/netlist/analog/nld_fourterm.h
@@ -63,10 +63,10 @@ public:
param_double_t m_RI;
protected:
- virtual void start();
- virtual void reset();
- virtual void update_param();
- ATTR_HOT virtual void update();
+ virtual void start() override;
+ virtual void reset() override;
+ virtual void update_param() override;
+ ATTR_HOT virtual void update() override;
ATTR_COLD void start_internal(const nl_double def_RI);
@@ -95,10 +95,10 @@ public:
param_double_t m_cur_limit; /* current limit */
protected:
- virtual void start();
- virtual void reset();
- virtual void update_param();
- ATTR_HOT virtual void update();
+ virtual void start() override;
+ virtual void reset() override;
+ virtual void update_param() override;
+ ATTR_HOT virtual void update() override;
NETLIB_UPDATE_TERMINALSI();
nl_double m_vi;
@@ -134,10 +134,10 @@ public:
: NETLIB_NAME(VCCS)(CCCS), m_gfac(1.0) { }
protected:
- virtual void start();
- virtual void reset();
- virtual void update_param();
- ATTR_HOT void update();
+ virtual void start() override;
+ virtual void reset() override;
+ virtual void update_param() override;
+ ATTR_HOT void update() override;
nl_double m_gfac;
};
@@ -180,9 +180,9 @@ public:
param_double_t m_RO;
protected:
- virtual void start();
- virtual void reset();
- virtual void update_param();
+ virtual void start() override;
+ virtual void reset() override;
+ virtual void update_param() override;
//ATTR_HOT void update();
terminal_t m_OP2;
diff --git a/src/lib/netlist/analog/nld_twoterm.h b/src/lib/netlist/analog/nld_twoterm.h
index 27da8ba258e..9a716094163 100644
--- a/src/lib/netlist/analog/nld_twoterm.h
+++ b/src/lib/netlist/analog/nld_twoterm.h
@@ -133,9 +133,9 @@ public:
}
protected:
- virtual void start();
- virtual void reset();
- ATTR_HOT void update();
+ virtual void start() override;
+ virtual void reset() override;
+ ATTR_HOT void update() override;
private:
};
@@ -155,9 +155,9 @@ public:
}
protected:
- virtual void start();
- virtual void reset();
- ATTR_HOT void update();
+ virtual void start() override;
+ virtual void reset() override;
+ ATTR_HOT void update() override;
};
NETLIB_DEVICE_WITH_PARAMS_DERIVED(R, R_base,
@@ -196,15 +196,15 @@ class NETLIB_NAME(C) : public NETLIB_NAME(twoterm)
public:
ATTR_COLD NETLIB_NAME(C)() : NETLIB_NAME(twoterm)(CAPACITOR), m_GParallel(0.0) { }
- ATTR_HOT void step_time(const nl_double st);
+ ATTR_HOT void step_time(const nl_double st) override;
param_double_t m_C;
protected:
- virtual void start();
- virtual void reset();
- virtual void update_param();
- ATTR_HOT void update();
+ virtual void start() override;
+ virtual void reset() override;
+ virtual void update_param() override;
+ ATTR_HOT void update() override;
private:
nl_double m_GParallel;
@@ -298,9 +298,9 @@ public:
param_model_t m_model;
protected:
- virtual void start();
- virtual void update_param();
- ATTR_HOT void update();
+ virtual void start() override;
+ virtual void update_param() override;
+ ATTR_HOT void update() override;
generic_diode m_D;
};
@@ -317,9 +317,9 @@ public:
ATTR_COLD NETLIB_NAME(VS)() : NETLIB_NAME(twoterm)(VS) { }
protected:
- virtual void start();
- virtual void reset();
- ATTR_HOT void update();
+ virtual void start() override;
+ virtual void reset() override;
+ ATTR_HOT void update() override;
param_double_t m_R;
param_double_t m_V;
@@ -335,9 +335,9 @@ public:
ATTR_COLD NETLIB_NAME(CS)() : NETLIB_NAME(twoterm)(CS) { }
protected:
- virtual void start();
- virtual void reset();
- ATTR_HOT void update();
+ virtual void start() override;
+ virtual void reset() override;
+ ATTR_HOT void update() override;
param_double_t m_I;
};
diff --git a/src/lib/netlist/devices/nld_cmos.h b/src/lib/netlist/devices/nld_cmos.h
index 6883993a794..61e1e8f7dae 100644
--- a/src/lib/netlist/devices/nld_cmos.h
+++ b/src/lib/netlist/devices/nld_cmos.h
@@ -24,13 +24,13 @@ class nld_vdd_vss : public device_t
analog_input_t m_vss;
protected:
- ATTR_HOT void update() {};
- ATTR_HOT void start()
+ ATTR_HOT void update() override {};
+ ATTR_HOT void start() override
{
register_input("VDD", m_vdd);
register_input("VSS", m_vss);
};
- ATTR_HOT void reset() {};
+ ATTR_HOT void reset() override {};
public:
ATTR_HOT inline nl_double vdd() { return INPANALOG(m_vdd); }
diff --git a/src/lib/netlist/devices/nld_signal.h b/src/lib/netlist/devices/nld_signal.h
index fa8e9e6265b..0e659557e02 100644
--- a/src/lib/netlist/devices/nld_signal.h
+++ b/src/lib/netlist/devices/nld_signal.h
@@ -37,7 +37,7 @@ public:
{
}
- void start()
+ void start() override
{
const char *sIN[8] = { "A", "B", "C", "D", "E", "F", "G", "H" };
@@ -49,7 +49,7 @@ public:
save(NLNAME(m_active));
}
- void reset()
+ void reset() override
{
m_Q[0].initial(0);
m_active = 1;
@@ -72,7 +72,7 @@ public:
return _check ^ _invert;
}
- ATTR_HOT virtual void inc_active()
+ ATTR_HOT virtual void inc_active() override
{
const netlist_time times[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22)};
nl_assert(netlist().use_deactivate());
@@ -90,7 +90,7 @@ public:
}
}
- ATTR_HOT virtual void dec_active()
+ ATTR_HOT virtual void dec_active() override
{
nl_assert(netlist().use_deactivate());
if (--m_active == 0)
@@ -100,7 +100,7 @@ public:
}
}
- virtual void update()
+ virtual void update() override
{
const netlist_time times[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22)};
diff --git a/src/lib/netlist/devices/nld_system.h b/src/lib/netlist/devices/nld_system.h
index 2ea6fbed4d4..a50860c3ac4 100644
--- a/src/lib/netlist/devices/nld_system.h
+++ b/src/lib/netlist/devices/nld_system.h
@@ -136,7 +136,7 @@ NETLIB_DEVICE_WITH_PARAMS(extclock,
NETLIB_DEVICE_WITH_PARAMS(logic_input,
- virtual void stop();
+ virtual void stop() override;
logic_output_t m_Q;
param_logic_t m_IN;
@@ -163,16 +163,16 @@ public:
protected:
- void start()
+ void start() override
{
register_output("Q", m_Q);
}
- void reset()
+ void reset() override
{
}
- void update()
+ void update() override
{
OUTANALOG(m_Q, 0.0);
}
@@ -196,16 +196,16 @@ public:
protected:
- void start()
+ void start() override
{
register_input("I", m_I);
}
- void reset()
+ void reset() override
{
}
- void update()
+ void update() override
{
}
@@ -228,7 +228,7 @@ public:
protected:
- void start()
+ void start() override
{
register_param("RIN", m_p_RIN, 1.0e6);
register_param("ROUT", m_p_ROUT, 50.0);
@@ -244,13 +244,13 @@ protected:
connect_late(m_Q, m_ROUT.m_P);
}
- void reset()
+ void reset() override
{
m_RIN.set(1.0 / m_p_RIN.Value(),0,0);
m_ROUT.set(1.0 / m_p_ROUT.Value(),0,0);
}
- void update()
+ void update() override
{
OUTANALOG(m_Q, INPANALOG(m_I));
}
@@ -281,9 +281,9 @@ public:
protected:
- void start();
- void reset();
- void update();
+ void start() override;
+ void reset() override;
+ void update() override;
private:
@@ -331,10 +331,10 @@ public:
protected:
- void start();
- void reset();
- ATTR_HOT void update();
- ATTR_HOT void update_param();
+ void start() override;
+ void reset() override;
+ ATTR_HOT void update() override;
+ ATTR_HOT void update_param() override;
private:
UINT8 m_last_state;
@@ -391,17 +391,17 @@ public:
logic_output_t m_Q;
protected:
- void start()
+ void start() override
{
register_input("I", m_I);
register_output("Q", m_Q);
}
- void reset()
+ void reset() override
{
}
- ATTR_HOT void update()
+ ATTR_HOT void update() override
{
if (m_I.Q_Analog() > logic_family().m_high_thresh_V)
OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(1));
@@ -432,7 +432,7 @@ protected:
{
}
- virtual void start()
+ virtual void start() override
{
register_input("I", m_I);
}
@@ -456,11 +456,11 @@ public:
virtual ~nld_d_to_a_proxy() {}
protected:
- virtual void start();
+ virtual void start() override;
- virtual void reset();
+ virtual void reset() override;
- ATTR_HOT void update();
+ ATTR_HOT void update() override;
private:
analog_output_t m_Q;
@@ -484,20 +484,20 @@ public:
public:
dummy(const pstring &dev_name) : device_t(), m_dev_name(dev_name) { }
protected:
- virtual void init(netlist_t &anetlist, const pstring &aname)
+ virtual void init(netlist_t &anetlist, const pstring &aname) override
{
anetlist.setup().namespace_push(aname);
anetlist.setup().include(m_dev_name);
anetlist.setup().namespace_pop();
}
- void start() { }
- void reset() { }
- void update() { }
+ void start() override { }
+ void reset() override { }
+ void update() override { }
pstring m_dev_name;
};
- ATTR_COLD device_t *Create()
+ ATTR_COLD device_t *Create() override
{
device_t *r = palloc(dummy(this->name()));
return r;
diff --git a/src/lib/netlist/devices/nld_truthtable.h b/src/lib/netlist/devices/nld_truthtable.h
index b5a90d8125c..47e479a0256 100644
--- a/src/lib/netlist/devices/nld_truthtable.h
+++ b/src/lib/netlist/devices/nld_truthtable.h
@@ -126,7 +126,7 @@ public:
m_desc = desc;
}
- virtual void start()
+ virtual void start() override
{
pstring header = m_desc[0];
@@ -181,7 +181,7 @@ public:
save(NLNAME(m_active));
}
- void reset()
+ void reset() override
{
m_active = 0;
m_ign = 0;
@@ -242,12 +242,12 @@ public:
}
}
- ATTR_HOT void update()
+ ATTR_HOT void update() override
{
process<true>();
}
- ATTR_HOT void inc_active()
+ ATTR_HOT void inc_active() override
{
nl_assert(netlist().use_deactivate());
if (has_state == 0)
@@ -257,7 +257,7 @@ public:
}
}
- ATTR_HOT void dec_active()
+ ATTR_HOT void dec_active() override
{
nl_assert(netlist().use_deactivate());
/* FIXME:
@@ -321,7 +321,7 @@ public:
const pstring &def_param)
: netlist_base_factory_truthtable_t(name, classname, def_param) { }
- device_t *Create()
+ device_t *Create() override
{
typedef nld_truthtable_t<m_NI, m_NO, has_state> tt_type;
device_t *r = palloc(tt_type(&m_ttbl, m_desc));
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index ce818e0d94f..f39de181da1 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -37,7 +37,7 @@ public:
m_R_high = 130.0;
m_is_static = true;
}
- virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const
+ virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const override
{
return palloc(devices::nld_d_to_a_proxy(proxied));
}
@@ -58,7 +58,7 @@ public:
m_R_high = 10.0;
m_is_static = true;
}
- virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const
+ virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const override
{
return palloc(devices::nld_d_to_a_proxy(proxied));
}
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index 4bc152e253f..a47ca7c6fc5 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -190,7 +190,7 @@ typedef UINT8 netlist_sig_t;
#define NETLIB_FUNC_VOID(_chip, _name, _params) ATTR_HOT void NETLIB_NAME(_chip) :: _name _params
#define NETLIB_UPDATE_TERMINALS(_chip) ATTR_HOT void NETLIB_NAME(_chip) :: update_terminals(void)
-#define NETLIB_UPDATE_TERMINALSI() ATTR_HOT void update_terminals(void)
+#define NETLIB_UPDATE_TERMINALSI() ATTR_HOT void update_terminals(void) override
#define NETLIB_UPDATEI() ATTR_HOT void update(void)
#define NETLIB_DEVICE_BASE(_name, _pclass, _extra, _priv) \
@@ -201,9 +201,9 @@ typedef UINT8 netlist_sig_t;
: _pclass() { } \
protected: \
_extra \
- ATTR_HOT void update(); \
- ATTR_HOT void start(); \
- ATTR_HOT void reset(); \
+ ATTR_HOT void update() override; \
+ ATTR_HOT void start() override; \
+ ATTR_HOT void reset() override; \
_priv \
}
@@ -224,25 +224,25 @@ typedef UINT8 netlist_sig_t;
: device_t() \
{ } \
/*protected:*/ \
- ATTR_HOT void update(); \
- ATTR_HOT void start(); \
- ATTR_HOT void reset(); \
+ ATTR_HOT void update() override; \
+ ATTR_HOT void start() override; \
+ ATTR_HOT void reset() override; \
public: \
_priv \
}
#define NETLIB_DEVICE_WITH_PARAMS(_name, _priv) \
NETLIB_DEVICE_BASE(NETLIB_NAME(_name), device_t, \
- ATTR_HOT void update_param(); \
+ ATTR_HOT void update_param() override; \
, _priv)
#define NETLIB_DEVICE_WITH_PARAMS_DERIVED(_name, _pclass, _priv) \
NETLIB_DEVICE_BASE(NETLIB_NAME(_name), NETLIB_NAME(_pclass), \
- ATTR_HOT void update_param(); \
+ ATTR_HOT void update_param() override; \
, _priv)
#define NETLIB_LOGIC_FAMILY(_fam) \
-virtual logic_family_desc_t *default_logic_family() \
+virtual logic_family_desc_t *default_logic_family() override \
{ \
return netlist_family_ ## _fam; \
}
@@ -497,7 +497,7 @@ namespace netlist
ATTR_HOT /* inline */ void update_dev(const UINT32 mask);
protected:
- virtual void save_register()
+ virtual void save_register() override
{
save(NLNAME(m_state));
device_object_t::save_register();
@@ -548,9 +548,9 @@ namespace netlist
terminal_t *m_otherterm;
protected:
- virtual void save_register();
+ virtual void save_register() override;
- virtual void reset();
+ virtual void reset() override;
private:
ATTR_HOT void set_ptr(nl_double *ptr, const nl_double val)
{
@@ -624,7 +624,7 @@ namespace netlist
ATTR_HOT void activate_lh();
protected:
- virtual void reset()
+ virtual void reset() override
{
//netlist_core_terminal_t::reset();
set_state(STATE_INP_ACTIVE);
@@ -648,7 +648,7 @@ namespace netlist
ATTR_HOT nl_double Q_Analog() const;
protected:
- virtual void reset()
+ virtual void reset() override
{
//netlist_core_terminal_t::reset();
set_state(STATE_INP_ACTIVE);
@@ -716,8 +716,8 @@ namespace netlist
protected: //FIXME: needed by current solver code
- virtual void save_register();
- virtual void reset();
+ virtual void save_register() override;
+ virtual void reset() override;
netlist_sig_t m_new_Q;
netlist_sig_t m_cur_Q;
@@ -789,8 +789,8 @@ namespace netlist
protected: //FIXME: needed by current solver code
- virtual void save_register();
- virtual void reset();
+ virtual void save_register() override;
+ virtual void reset() override;
private:
@@ -826,8 +826,8 @@ namespace netlist
protected:
- virtual void save_register();
- virtual void reset();
+ virtual void save_register() override;
+ virtual void reset() override;
private:
@@ -852,7 +852,7 @@ namespace netlist
ATTR_COLD logic_output_t();
ATTR_COLD void init_object(core_device_t &dev, const pstring &aname);
- virtual void reset()
+ virtual void reset() override
{
set_state(STATE_OUT);
}
@@ -876,7 +876,7 @@ namespace netlist
ATTR_COLD analog_output_t();
ATTR_COLD void init_object(core_device_t &dev, const pstring &aname);
- virtual void reset()
+ virtual void reset() override
{
set_state(STATE_OUT);
}
@@ -914,7 +914,7 @@ namespace netlist
protected:
- virtual void reset() { }
+ virtual void reset() override { }
private:
const param_type_t m_param_type;
@@ -938,7 +938,7 @@ namespace netlist
ATTR_HOT C Value() const { return m_param; }
protected:
- virtual void save_register()
+ virtual void save_register() override
{
/* pstrings not yet supported, these need special logic */
if (T != param_t::STRING && T != param_t::MODEL)
@@ -973,7 +973,7 @@ namespace netlist
ATTR_COLD const pstring model_value_str(const pstring &entity);
ATTR_COLD const pstring model_type();
protected:
- void changed()
+ void changed() override
{
m_map.clear();
}
@@ -1089,7 +1089,7 @@ namespace netlist
virtual ~device_t();
- virtual void init(netlist_t &anetlist, const pstring &name);
+ virtual void init(netlist_t &anetlist, const pstring &name) override;
ATTR_COLD setup_t &setup();
@@ -1110,9 +1110,9 @@ namespace netlist
protected:
- ATTR_HOT virtual void update() { }
- ATTR_HOT virtual void start() { }
- ATTR_HOT virtual void update_terminals() { }
+ ATTR_HOT virtual void update() override { }
+ ATTR_HOT virtual void start() override { }
+ ATTR_HOT virtual void update_terminals() override { }
template <class C, class T>
ATTR_COLD void register_param(const pstring &sname, C &param, const T initialVal);
@@ -1134,11 +1134,11 @@ namespace netlist
protected:
- void reset() {}
+ void reset() override {}
- void register_state(pstate_manager_t &manager, const pstring &module);
- void on_pre_save();
- void on_post_load();
+ void register_state(pstate_manager_t &manager, const pstring &module) override;
+ void on_pre_save() override;
+ void on_post_load() override;
private:
struct names_t { char m_buf[64]; };
@@ -1243,8 +1243,8 @@ namespace netlist
// virtual void vlog(const plog_level &l, const pstring &ls) = 0;
/* from netlist_object */
- virtual void reset();
- virtual void save_register();
+ virtual void reset() override;
+ virtual void save_register() override;
#if (NL_KEEP_STATISTICS)
// performance
diff --git a/src/lib/netlist/nl_factory.h b/src/lib/netlist/nl_factory.h
index b758941dd71..cc007960c6e 100644
--- a/src/lib/netlist/nl_factory.h
+++ b/src/lib/netlist/nl_factory.h
@@ -54,7 +54,7 @@ namespace netlist
const pstring &def_param)
: base_factory_t(name, classname, def_param) { }
- ATTR_COLD device_t *Create()
+ ATTR_COLD device_t *Create() override
{
device_t *r = palloc(C);
//r->init(setup, name);
diff --git a/src/lib/netlist/nl_parser.h b/src/lib/netlist/nl_parser.h
index 73c6cf66837..b11d89f5ff1 100644
--- a/src/lib/netlist/nl_parser.h
+++ b/src/lib/netlist/nl_parser.h
@@ -42,7 +42,7 @@ namespace netlist
/* for debugging messages */
netlist_t &netlist() { return m_setup.netlist(); }
- virtual void verror(const pstring &msg, int line_num, const pstring &line);
+ virtual void verror(const pstring &msg, int line_num, const pstring &line) override;
private:
nl_double eval_param(const token_t tok);
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index 94cb85ced03..99874a0a06d 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -886,7 +886,7 @@ class logic_family_std_proxy_t : public logic_family_desc_t
{
public:
logic_family_std_proxy_t() { }
- virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const
+ virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const override
{
return palloc(devices::nld_d_to_a_proxy(proxied));
}
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index 5f056439b3b..4dd12b59854 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -252,7 +252,7 @@ namespace netlist
{
}
- bool parse(setup_t &setup, const pstring &name);
+ bool parse(setup_t &setup, const pstring &name) override;
private:
pstring m_str;
@@ -267,7 +267,7 @@ namespace netlist
{
}
- bool parse(setup_t &setup, const pstring &name);
+ bool parse(setup_t &setup, const pstring &name) override;
private:
pstring m_filename;
@@ -281,7 +281,7 @@ namespace netlist
{
}
- bool parse(setup_t &setup, const pstring &name);
+ bool parse(setup_t &setup, const pstring &name) override;
private:
pstring m_str;
@@ -297,7 +297,7 @@ namespace netlist
{
}
- bool parse(setup_t &setup, const pstring &name)
+ bool parse(setup_t &setup, const pstring &name) override
{
if (name == m_setup_func_name)
{
diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h
index 058152a91cc..7a63d14fc3a 100644
--- a/src/lib/netlist/plib/pfmtlog.h
+++ b/src/lib/netlist/plib/pfmtlog.h
@@ -158,7 +158,7 @@ public:
protected:
- void format_element(const char *f, const char *l, const char *fmt_spec, ...);
+ void format_element(const char *f, const char *l, const char *fmt_spec, ...) override;
private:
@@ -243,7 +243,7 @@ public:
virtual ~plog_channel() { }
protected:
- virtual void vdowrite(const pstring &ls) const;
+ virtual void vdowrite(const pstring &ls) const override;
private:
plog_dispatch_intf *m_base;
diff --git a/src/lib/netlist/plib/poptions.h b/src/lib/netlist/plib/poptions.h
index b082504930d..c6daa3b2596 100644
--- a/src/lib/netlist/plib/poptions.h
+++ b/src/lib/netlist/plib/poptions.h
@@ -52,7 +52,7 @@ public:
: poption(ashort, along, help, true, parent), m_val(defval)
{}
- virtual int parse(pstring argument) { m_val = argument; return 0; }
+ virtual int parse(pstring argument) override { m_val = argument; return 0; }
pstring operator ()() { return m_val; }
private:
@@ -66,7 +66,7 @@ public:
: poption(ashort, along, help, true, parent), m_val(defval), m_limit(limit, ":")
{}
- virtual int parse(pstring argument)
+ virtual int parse(pstring argument) override
{
if (m_limit.contains(argument))
{
@@ -90,7 +90,7 @@ public:
: poption(ashort, along, help, false, parent), m_val(false)
{}
- virtual int parse(ATTR_UNUSED pstring argument) { m_val = true; return 0; }
+ virtual int parse(ATTR_UNUSED pstring argument) override { m_val = true; return 0; }
bool operator ()() { return m_val; }
private:
@@ -104,7 +104,7 @@ public:
: poption(ashort, along, help, true, parent), m_val(defval)
{}
- virtual int parse(pstring argument)
+ virtual int parse(pstring argument) override
{
bool err = false;
m_val = argument.as_double(&err);
diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h
index 61f0959cadd..6cc4c6a30a7 100644
--- a/src/lib/netlist/plib/pstream.h
+++ b/src/lib/netlist/plib/pstream.h
@@ -184,9 +184,9 @@ public:
protected:
/* write n bytes to stream */
- virtual void vwrite(const void *buf, const unsigned n);
- virtual void vseek(const pos_type n);
- virtual pos_type vtell();
+ virtual void vwrite(const void *buf, const unsigned n) override;
+ virtual void vseek(const pos_type n) override;
+ virtual pos_type vtell() override;
private:
pos_type m_pos;
@@ -208,12 +208,12 @@ public:
protected:
/* write n bytes to stream */
- virtual void vwrite(const void *buf, const unsigned n)
+ virtual void vwrite(const void *buf, const unsigned n) override
{
m_buf.cat(buf, n);
}
- virtual void vseek(const pos_type n) { }
- virtual pos_type vtell() { return m_buf.len(); }
+ virtual void vseek(const pos_type n) override { }
+ virtual pos_type vtell() override { return m_buf.len(); }
private:
pstringbuffer m_buf;
@@ -236,9 +236,9 @@ public:
protected:
pofilestream(void *file, const bool do_close);
/* write n bytes to stream */
- virtual void vwrite(const void *buf, const unsigned n);
- virtual void vseek(const pos_type n);
- virtual pos_type vtell();
+ virtual void vwrite(const void *buf, const unsigned n) override;
+ virtual void vseek(const pos_type n) override;
+ virtual pos_type vtell() override;
private:
void *m_file;
@@ -288,9 +288,9 @@ protected:
pifilestream(void *file, const bool do_close);
/* read up to n bytes from stream */
- virtual unsigned vread(void *buf, const unsigned n);
- virtual void vseek(const pos_type n);
- virtual pos_type vtell();
+ virtual unsigned vread(void *buf, const unsigned n) override;
+ virtual void vseek(const pos_type n) override;
+ virtual pos_type vtell() override;
private:
void *m_file;
@@ -327,9 +327,9 @@ public:
protected:
/* read up to n bytes from stream */
- virtual unsigned vread(void *buf, const unsigned n);
- virtual void vseek(const pos_type n);
- virtual pos_type vtell();
+ virtual unsigned vread(void *buf, const unsigned n) override;
+ virtual void vseek(const pos_type n) override;
+ virtual pos_type vtell() override;
private:
pos_type m_pos;
@@ -366,7 +366,7 @@ public:
virtual ~pstream_fmt_writer_t() { }
protected:
- virtual void vdowrite(const pstring &ls) const
+ virtual void vdowrite(const pstring &ls) const override
{
m_strm.write(ls);
}
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index 3510f70e7f2..bbe5e8b3039 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -194,7 +194,7 @@ public:
protected:
- void vlog(const plog_level &l, const pstring &ls) const
+ void vlog(const plog_level &l, const pstring &ls) const override
{
pout("{}: {}\n", l.name().cstr(), ls.cstr());
if (l == plog_level::FATAL)
diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h
index 9116f92d53f..8bb578ec6cd 100644
--- a/src/lib/netlist/solver/nld_ms_direct.h
+++ b/src/lib/netlist/solver/nld_ms_direct.h
@@ -28,17 +28,17 @@ public:
virtual ~matrix_solver_direct_t();
- virtual void vsetup(analog_net_t::list_t &nets);
- virtual void reset() { matrix_solver_t::reset(); }
+ virtual void vsetup(analog_net_t::list_t &nets) override;
+ virtual void reset() override { matrix_solver_t::reset(); }
ATTR_HOT inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson);
protected:
- virtual void add_term(int net_idx, terminal_t *term);
+ virtual void add_term(int net_idx, terminal_t *term) override;
- ATTR_HOT virtual nl_double vsolve();
+ ATTR_HOT virtual nl_double vsolve() override;
ATTR_HOT int solve_non_dynamic(const bool newton_raphson);
ATTR_HOT void build_LE_A();
diff --git a/src/lib/netlist/solver/nld_ms_direct1.h b/src/lib/netlist/solver/nld_ms_direct1.h
index 9f895a6c3f3..3aa79de45da 100644
--- a/src/lib/netlist/solver/nld_ms_direct1.h
+++ b/src/lib/netlist/solver/nld_ms_direct1.h
@@ -22,7 +22,7 @@ public:
{}
ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson);
protected:
- ATTR_HOT virtual nl_double vsolve();
+ ATTR_HOT virtual nl_double vsolve() override;
private:
};
diff --git a/src/lib/netlist/solver/nld_ms_direct2.h b/src/lib/netlist/solver/nld_ms_direct2.h
index f78c36770e6..06f00302d3c 100644
--- a/src/lib/netlist/solver/nld_ms_direct2.h
+++ b/src/lib/netlist/solver/nld_ms_direct2.h
@@ -22,7 +22,7 @@ public:
{}
ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson);
protected:
- ATTR_HOT virtual nl_double vsolve();
+ ATTR_HOT virtual nl_double vsolve() override;
private:
};
diff --git a/src/lib/netlist/solver/nld_ms_direct_lu.h b/src/lib/netlist/solver/nld_ms_direct_lu.h
index d988942058e..877e0b56cd8 100644
--- a/src/lib/netlist/solver/nld_ms_direct_lu.h
+++ b/src/lib/netlist/solver/nld_ms_direct_lu.h
@@ -30,17 +30,17 @@ public:
virtual ~matrix_solver_direct_t();
- virtual void vsetup(analog_net_t::list_t &nets);
- virtual void reset() { matrix_solver_t::reset(); }
+ virtual void vsetup(analog_net_t::list_t &nets) override;
+ virtual void reset() override { matrix_solver_t::reset(); }
ATTR_HOT inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson);
protected:
- virtual void add_term(int net_idx, terminal_t *term);
+ virtual void add_term(int net_idx, terminal_t *term) override;
- ATTR_HOT virtual nl_double vsolve();
+ ATTR_HOT virtual nl_double vsolve() override;
ATTR_HOT int solve_non_dynamic(const bool newton_raphson);
ATTR_HOT void build_LE_A();
diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h
index 5983cb1a968..6124f7e527d 100644
--- a/src/lib/netlist/solver/nld_ms_gmres.h
+++ b/src/lib/netlist/solver/nld_ms_gmres.h
@@ -53,10 +53,10 @@ public:
delete[] m_v[i];
}
- virtual void vsetup(analog_net_t::list_t &nets);
+ virtual void vsetup(analog_net_t::list_t &nets) override;
ATTR_HOT virtual int vsolve_non_dynamic(const bool newton_raphson);
protected:
- ATTR_HOT virtual nl_double vsolve();
+ ATTR_HOT virtual nl_double vsolve() override;
private:
diff --git a/src/lib/netlist/solver/nld_ms_sor.h b/src/lib/netlist/solver/nld_ms_sor.h
index 41074284152..59b1efffca7 100644
--- a/src/lib/netlist/solver/nld_ms_sor.h
+++ b/src/lib/netlist/solver/nld_ms_sor.h
@@ -32,10 +32,10 @@ public:
virtual ~matrix_solver_SOR_t() {}
- virtual void vsetup(analog_net_t::list_t &nets);
+ virtual void vsetup(analog_net_t::list_t &nets) override;
ATTR_HOT virtual int vsolve_non_dynamic(const bool newton_raphson);
protected:
- ATTR_HOT virtual nl_double vsolve();
+ ATTR_HOT virtual nl_double vsolve() override;
private:
nl_double m_lp_fact;
diff --git a/src/lib/netlist/solver/nld_ms_sor_mat.h b/src/lib/netlist/solver/nld_ms_sor_mat.h
index bbf8706a139..5ef00ae396c 100644
--- a/src/lib/netlist/solver/nld_ms_sor_mat.h
+++ b/src/lib/netlist/solver/nld_ms_sor_mat.h
@@ -35,11 +35,11 @@ public:
virtual ~matrix_solver_SOR_mat_t() {}
- virtual void vsetup(analog_net_t::list_t &nets);
+ virtual void vsetup(analog_net_t::list_t &nets) override;
ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson);
protected:
- ATTR_HOT virtual nl_double vsolve();
+ ATTR_HOT virtual nl_double vsolve() override;
private:
nl_double m_Vdelta[_storage_N];
diff --git a/src/lib/netlist/solver/nld_solver.h b/src/lib/netlist/solver/nld_solver.h
index 040866c5736..2de12bb77f1 100644
--- a/src/lib/netlist/solver/nld_solver.h
+++ b/src/lib/netlist/solver/nld_solver.h
@@ -125,9 +125,9 @@ public:
}
/* netdevice functions */
- ATTR_HOT virtual void update();
- virtual void start();
- virtual void reset();
+ ATTR_HOT virtual void update() override;
+ virtual void start() override;
+ virtual void reset() override;
ATTR_COLD int get_net_idx(net_t *net);
@@ -186,15 +186,15 @@ public:
virtual ~NETLIB_NAME(solver)();
ATTR_COLD void post_start();
- ATTR_COLD void stop();
+ ATTR_COLD void stop() override;
ATTR_HOT inline nl_double gmin() { return m_gmin.Value(); }
protected:
- ATTR_HOT void update();
- ATTR_HOT void start();
- ATTR_HOT void reset();
- ATTR_HOT void update_param();
+ ATTR_HOT void update() override;
+ ATTR_HOT void start() override;
+ ATTR_HOT void reset() override;
+ ATTR_HOT void update_param() override;
logic_input_t m_fb_step;
logic_output_t m_Q_step;
diff --git a/src/lib/netlist/tools/nl_convert.h b/src/lib/netlist/tools/nl_convert.h
index 7a410bb2f47..3b86c5ec1ad 100644
--- a/src/lib/netlist/tools/nl_convert.h
+++ b/src/lib/netlist/tools/nl_convert.h
@@ -144,7 +144,7 @@ public:
{
}
- void convert(const pstring &contents);
+ void convert(const pstring &contents) override;
protected:
@@ -197,7 +197,7 @@ public:
protected:
- void verror(const pstring &msg, int line_num, const pstring &line)
+ void verror(const pstring &msg, int line_num, const pstring &line) override
{
m_convert.out("{} (line {}): {}\n", msg.cstr(), line_num, line.cstr());
}
@@ -207,7 +207,7 @@ public:
nl_convert_eagle_t &m_convert;
};
- void convert(const pstring &contents);
+ void convert(const pstring &contents) override;
protected:
diff --git a/src/lib/util/avhuff.cpp b/src/lib/util/avhuff.cpp
index b9b9057193c..277f056c7ad 100644
--- a/src/lib/util/avhuff.cpp
+++ b/src/lib/util/avhuff.cpp
@@ -754,7 +754,7 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
// if we are decoding raw, set up the output parameters
UINT8 *metastart, *videostart, *audiostart[16];
UINT32 audioxor, videoxor, videostride;
- if (dest != NULL)
+ if (dest != nullptr)
{
// create a header
dest[0] = 'c';
@@ -793,7 +793,7 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
metastart = m_config.metadata;
for (int chnum = 0; chnum < channels; chnum++)
audiostart[chnum] = (UINT8 *)m_config.audio[chnum];
- videostart = (m_config.video.valid()) ? reinterpret_cast<UINT8 *>(&m_config.video.pix(0)) : NULL;
+ videostart = (m_config.video.valid()) ? reinterpret_cast<UINT8 *>(&m_config.video.pix(0)) : nullptr;
videostride = (m_config.video.valid()) ? m_config.video.rowpixels() * 2 : 0;
// data is assumed to be native-endian
@@ -805,22 +805,22 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
if (m_config.video.valid() && (m_config.video.width() < width || m_config.video.height() < height))
return AVHERR_VIDEO_TOO_LARGE;
for (int chnum = 0; chnum < channels; chnum++)
- if (m_config.audio[chnum] != NULL && m_config.maxsamples < samples)
+ if (m_config.audio[chnum] != nullptr && m_config.maxsamples < samples)
return AVHERR_AUDIO_TOO_LARGE;
- if (m_config.metadata != NULL && m_config.maxmetalength < metasize)
+ if (m_config.metadata != nullptr && m_config.maxmetalength < metasize)
return AVHERR_METADATA_TOO_LARGE;
// set the output values
- if (m_config.actsamples != NULL)
+ if (m_config.actsamples != nullptr)
*m_config.actsamples = samples;
- if (m_config.actmetalength != NULL)
+ if (m_config.actmetalength != nullptr)
*m_config.actmetalength = metasize;
}
// copy the metadata first
if (metasize > 0)
{
- if (metastart != NULL)
+ if (metastart != nullptr)
memcpy(metastart, source + srcoffs, metasize);
srcoffs += metasize;
}
@@ -842,7 +842,7 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
}
// decode the video data
- if (width > 0 && height > 0 && videostart != NULL)
+ if (width > 0 && height > 0 && videostart != nullptr)
{
// decode the video
avhuff_error err = decode_video(width, height, source + srcoffs, complength - srcoffs, videostart, videostride, videoxor);
@@ -897,7 +897,7 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
// only process if the data is requested
UINT8 *curdest = dest[chnum];
- if (curdest != NULL)
+ if (curdest != nullptr)
{
// reset and decode
if (!m_flac_decoder.reset(48000, 1, samples, source, size))
@@ -941,7 +941,7 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8
// only process if the data is requested
UINT8 *curdest = dest[chnum];
- if (curdest != NULL)
+ if (curdest != nullptr)
{
INT16 prevsample = 0;
diff --git a/src/lib/util/avhuff.h b/src/lib/util/avhuff.h
index 26873292fdc..cdaa3ec5f3a 100644
--- a/src/lib/util/avhuff.h
+++ b/src/lib/util/avhuff.h
@@ -57,10 +57,10 @@ class avhuff_decompress_config
public:
avhuff_decompress_config()
: maxsamples(0),
- actsamples(NULL),
+ actsamples(nullptr),
maxmetalength(0),
- actmetalength(NULL),
- metadata(NULL)
+ actmetalength(nullptr),
+ metadata(nullptr)
{
memset(audio, 0, sizeof(audio));
}
@@ -90,7 +90,7 @@ public:
// static helpers
static UINT32 raw_data_size(const UINT8 *data);
static UINT32 raw_data_size(UINT32 width, UINT32 height, UINT8 channels, UINT32 numsamples, UINT32 metadatasize = 0) { return 12 + channels * numsamples * 2 + width * height * 2; }
- static avhuff_error assemble_data(dynamic_buffer &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata = NULL, UINT32 metadatasize = 0);
+ static avhuff_error assemble_data(dynamic_buffer &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata = nullptr, UINT32 metadatasize = 0);
private:
// delta-RLE Huffman encoder
diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp
index 06b603e0e31..90918c06673 100644
--- a/src/lib/util/aviio.cpp
+++ b/src/lib/util/aviio.cpp
@@ -471,7 +471,7 @@ static void printf_chunk_recursive(avi_file *file, avi_chunk *chunk, int indent)
-------------------------------------------------*/
/**
- * @fn INLINE UINT16 fetch_16bits(const UINT8 *data)
+ * @fn static inline UINT16 fetch_16bits(const UINT8 *data)
*
* @brief Fetches the 16bits.
*
@@ -480,7 +480,7 @@ static void printf_chunk_recursive(avi_file *file, avi_chunk *chunk, int indent)
* @return The 16bits.
*/
-INLINE UINT16 fetch_16bits(const UINT8 *data)
+static inline UINT16 fetch_16bits(const UINT8 *data)
{
return data[0] | (data[1] << 8);
}
@@ -492,7 +492,7 @@ INLINE UINT16 fetch_16bits(const UINT8 *data)
-------------------------------------------------*/
/**
- * @fn INLINE UINT32 fetch_32bits(const UINT8 *data)
+ * @fn static inline UINT32 fetch_32bits(const UINT8 *data)
*
* @brief Fetches the 32bits.
*
@@ -501,7 +501,7 @@ INLINE UINT16 fetch_16bits(const UINT8 *data)
* @return The 32bits.
*/
-INLINE UINT32 fetch_32bits(const UINT8 *data)
+static inline UINT32 fetch_32bits(const UINT8 *data)
{
return data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
}
@@ -513,7 +513,7 @@ INLINE UINT32 fetch_32bits(const UINT8 *data)
-------------------------------------------------*/
/**
- * @fn INLINE UINT64 fetch_64bits(const UINT8 *data)
+ * @fn static inline UINT64 fetch_64bits(const UINT8 *data)
*
* @brief Fetches the 64bits.
*
@@ -522,7 +522,7 @@ INLINE UINT32 fetch_32bits(const UINT8 *data)
* @return The 64bits.
*/
-INLINE UINT64 fetch_64bits(const UINT8 *data)
+static inline UINT64 fetch_64bits(const UINT8 *data)
{
return (UINT64)data[0] | ((UINT64)data[1] << 8) |
((UINT64)data[2] << 16) | ((UINT64)data[3] << 24) |
@@ -537,7 +537,7 @@ INLINE UINT64 fetch_64bits(const UINT8 *data)
-------------------------------------------------*/
/**
- * @fn INLINE void put_16bits(UINT8 *data, UINT16 value)
+ * @fn static inline void put_16bits(UINT8 *data, UINT16 value)
*
* @brief Puts the 16bits.
*
@@ -545,7 +545,7 @@ INLINE UINT64 fetch_64bits(const UINT8 *data)
* @param value The value.
*/
-INLINE void put_16bits(UINT8 *data, UINT16 value)
+static inline void put_16bits(UINT8 *data, UINT16 value)
{
data[0] = value >> 0;
data[1] = value >> 8;
@@ -558,7 +558,7 @@ INLINE void put_16bits(UINT8 *data, UINT16 value)
-------------------------------------------------*/
/**
- * @fn INLINE void put_32bits(UINT8 *data, UINT32 value)
+ * @fn static inline void put_32bits(UINT8 *data, UINT32 value)
*
* @brief Puts the 32bits.
*
@@ -566,7 +566,7 @@ INLINE void put_16bits(UINT8 *data, UINT16 value)
* @param value The value.
*/
-INLINE void put_32bits(UINT8 *data, UINT32 value)
+static inline void put_32bits(UINT8 *data, UINT32 value)
{
data[0] = value >> 0;
data[1] = value >> 8;
@@ -581,7 +581,7 @@ INLINE void put_32bits(UINT8 *data, UINT32 value)
-------------------------------------------------*/
/**
- * @fn INLINE void put_64bits(UINT8 *data, UINT64 value)
+ * @fn static inline void put_64bits(UINT8 *data, UINT64 value)
*
* @brief Puts the 64bits.
*
@@ -589,7 +589,7 @@ INLINE void put_32bits(UINT8 *data, UINT32 value)
* @param value The value.
*/
-INLINE void put_64bits(UINT8 *data, UINT64 value)
+static inline void put_64bits(UINT8 *data, UINT64 value)
{
data[0] = value >> 0;
data[1] = value >> 8;
@@ -608,7 +608,7 @@ INLINE void put_64bits(UINT8 *data, UINT64 value)
-------------------------------------------------*/
/**
- * @fn INLINE avi_stream *get_video_stream(avi_file *file)
+ * @fn static inline avi_stream *get_video_stream(avi_file *file)
*
* @brief Gets video stream.
*
@@ -617,7 +617,7 @@ INLINE void put_64bits(UINT8 *data, UINT64 value)
* @return null if it fails, else the video stream.
*/
-INLINE avi_stream *get_video_stream(avi_file *file)
+static inline avi_stream *get_video_stream(avi_file *file)
{
int streamnum;
@@ -626,7 +626,7 @@ INLINE avi_stream *get_video_stream(avi_file *file)
if (file->stream[streamnum].type == STREAMTYPE_VIDS)
return &file->stream[streamnum];
- return NULL;
+ return nullptr;
}
@@ -636,7 +636,7 @@ INLINE avi_stream *get_video_stream(avi_file *file)
-------------------------------------------------*/
/**
- * @fn INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset)
+ * @fn static inline avi_stream *get_audio_stream(avi_file *file, int channel, int *offset)
*
* @brief Gets audio stream.
*
@@ -647,7 +647,7 @@ INLINE avi_stream *get_video_stream(avi_file *file)
* @return null if it fails, else the audio stream.
*/
-INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset)
+static inline avi_stream *get_audio_stream(avi_file *file, int channel, int *offset)
{
int streamnum;
@@ -657,14 +657,14 @@ INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset)
{
if (channel < file->stream[streamnum].channels)
{
- if (offset != NULL)
+ if (offset != nullptr)
*offset = channel;
return &file->stream[streamnum];
}
channel -= file->stream[streamnum].channels;
}
- return NULL;
+ return nullptr;
}
@@ -674,7 +674,7 @@ INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset)
-------------------------------------------------*/
/**
- * @fn INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 offset, UINT32 length)
+ * @fn static inline avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 offset, UINT32 length)
*
* @brief Sets stream chunk information.
*
@@ -686,16 +686,16 @@ INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset)
* @return An avi_error.
*/
-INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 offset, UINT32 length)
+static inline avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 offset, UINT32 length)
{
/* if we need to allocate more, allocate more */
if (index >= stream->chunksalloc)
{
UINT32 newcount = MAX(index, stream->chunksalloc + 1000);
avi_chunk_list *newchunks = (avi_chunk_list *)malloc(newcount * sizeof(stream->chunk[0]));
- if (newchunks == NULL)
+ if (newchunks == nullptr)
return AVIERR_NO_MEMORY;
- if (stream->chunk != NULL)
+ if (stream->chunk != nullptr)
{
memcpy(newchunks, stream->chunk, stream->chunksalloc * sizeof(stream->chunk[0]));
free(stream->chunk);
@@ -720,7 +720,7 @@ INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64
-------------------------------------------------*/
/**
- * @fn INLINE UINT32 compute_idx1_size(avi_file *file)
+ * @fn static inline UINT32 compute_idx1_size(avi_file *file)
*
* @brief Calculates the index 1 size.
*
@@ -729,7 +729,7 @@ INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64
* @return The calculated index 1 size.
*/
-INLINE UINT32 compute_idx1_size(avi_file *file)
+static inline UINT32 compute_idx1_size(avi_file *file)
{
int chunks = 0;
int strnum;
@@ -748,7 +748,7 @@ INLINE UINT32 compute_idx1_size(avi_file *file)
-------------------------------------------------*/
/**
- * @fn INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream)
+ * @fn static inline UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream)
*
* @brief Gets chunkid for stream.
*
@@ -758,7 +758,7 @@ INLINE UINT32 compute_idx1_size(avi_file *file)
* @return The chunkid for stream.
*/
-INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream)
+static inline UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream)
{
UINT32 chunkid;
@@ -778,7 +778,7 @@ INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream)
-------------------------------------------------*/
/**
- * @fn INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum)
+ * @fn static inline UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum)
*
* @brief Framenum to samplenum.
*
@@ -788,7 +788,7 @@ INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream)
* @return An UINT32.
*/
-INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum)
+static inline UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum)
{
return ((UINT64)file->info.audio_samplerate * (UINT64)framenum * (UINT64)file->info.video_sampletime + file->info.video_timescale - 1) / (UINT64)file->info.video_timescale;
}
@@ -801,7 +801,7 @@ INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum)
-------------------------------------------------*/
/**
- * @fn INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length)
+ * @fn static inline avi_error expand_tempbuffer(avi_file *file, UINT32 length)
*
* @brief Expand tempbuffer.
*
@@ -811,16 +811,16 @@ INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum)
* @return An avi_error.
*/
-INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length)
+static inline avi_error expand_tempbuffer(avi_file *file, UINT32 length)
{
/* expand the tempbuffer to hold the data if necessary */
if (length > file->tempbuffersize)
{
file->tempbuffersize = 2 * length;
UINT8 *newbuffer = (UINT8 *)malloc(file->tempbuffersize);
- if (newbuffer == NULL)
+ if (newbuffer == nullptr)
return AVIERR_NO_MEMORY;
- if (file->tempbuffer != NULL)
+ if (file->tempbuffer != nullptr)
free(file->tempbuffer);
file->tempbuffer = newbuffer;
}
@@ -850,14 +850,14 @@ INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length)
avi_error avi_open(const char *filename, avi_file **file)
{
- avi_file *newfile = NULL;
+ avi_file *newfile = nullptr;
file_error filerr;
avi_error avierr;
UINT64 length;
/* allocate the file */
newfile = (avi_file *)malloc(sizeof(*newfile));
- if (newfile == NULL)
+ if (newfile == nullptr)
return AVIERR_NO_MEMORY;
memset(newfile, 0, sizeof(*newfile));
newfile->type = FILETYPE_READ;
@@ -886,9 +886,9 @@ avi_error avi_open(const char *filename, avi_file **file)
error:
/* clean up after an error */
- if (newfile != NULL)
+ if (newfile != nullptr)
{
- if (newfile->file != NULL)
+ if (newfile->file != nullptr)
osd_close(newfile->file);
free(newfile);
}
@@ -914,7 +914,7 @@ error:
avi_error avi_create(const char *filename, const avi_movie_info *info, avi_file **file)
{
- avi_file *newfile = NULL;
+ avi_file *newfile = nullptr;
file_error filerr;
avi_stream *stream;
avi_error avierr;
@@ -935,7 +935,7 @@ avi_error avi_create(const char *filename, const avi_movie_info *info, avi_file
/* allocate the file */
newfile = (avi_file *)malloc(sizeof(*newfile));
- if (newfile == NULL)
+ if (newfile == nullptr)
return AVIERR_NO_MEMORY;
memset(newfile, 0, sizeof(*newfile));
newfile->type = FILETYPE_CREATE;
@@ -955,7 +955,7 @@ avi_error avi_create(const char *filename, const avi_movie_info *info, avi_file
/* allocate two streams */
newfile->stream = (avi_stream *)malloc(2 * sizeof(newfile->stream[0]));
- if (newfile->stream == NULL)
+ if (newfile->stream == nullptr)
{
avierr = AVIERR_NO_MEMORY;
goto error;
@@ -1000,11 +1000,11 @@ avi_error avi_create(const char *filename, const avi_movie_info *info, avi_file
error:
/* clean up after an error */
- if (newfile != NULL)
+ if (newfile != nullptr)
{
- if (newfile->stream != NULL)
+ if (newfile->stream != nullptr)
free(newfile->stream);
- if (newfile->file != NULL)
+ if (newfile->file != nullptr)
{
osd_close(newfile->file);
osd_rmfile(filename);
@@ -1073,26 +1073,26 @@ avi_error avi_close(avi_file *file)
for (strnum = 0; strnum < file->streams; strnum++)
{
avi_stream *stream = &file->stream[strnum];
- if (stream->huffyuv != NULL)
+ if (stream->huffyuv != nullptr)
{
huffyuv_data *huffyuv = stream->huffyuv;
int table;
for (table = 0; table < ARRAY_LENGTH(huffyuv->table); table++)
- if (huffyuv->table[table].extralookup != NULL)
+ if (huffyuv->table[table].extralookup != nullptr)
free(huffyuv->table[table].extralookup);
free(huffyuv);
}
- if (stream->chunk != NULL)
+ if (stream->chunk != nullptr)
free(stream->chunk);
}
/* free the file itself */
- if (file->soundbuf != NULL)
+ if (file->soundbuf != nullptr)
free(file->soundbuf);
- if (file->stream != NULL)
+ if (file->stream != nullptr)
free(file->stream);
- if (file->tempbuffer != NULL)
+ if (file->tempbuffer != nullptr)
free(file->tempbuffer);
free(file);
return avierr;
@@ -1228,7 +1228,7 @@ avi_error avi_read_video_frame(avi_file *file, UINT32 framenum, bitmap_yuy16 &bi
/* get the video stream */
stream = get_video_stream(file);
- if (stream == NULL)
+ if (stream == nullptr)
return AVIERR_INVALID_STREAM;
/* validate our ability to handle the data */
@@ -1301,7 +1301,7 @@ avi_error avi_read_sound_samples(avi_file *file, int channel, UINT32 firstsample
/* get the audio stream */
stream = get_audio_stream(file, channel, &offset);
- if (stream == NULL)
+ if (stream == nullptr)
return AVIERR_INVALID_STREAM;
/* validate our ability to handle the data */
@@ -1579,7 +1579,7 @@ static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 *
/* allocate memory for the data */
*buffer = (UINT8 *)malloc(chunk->size);
- if (*buffer == NULL)
+ if (*buffer == nullptr)
return AVIERR_NO_MEMORY;
/* read from the file */
@@ -1587,7 +1587,7 @@ static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 *
if (filerr != FILERR_NONE || bytes_read != chunk->size)
{
free(*buffer);
- *buffer = NULL;
+ *buffer = nullptr;
return AVIERR_READ_ERROR;
}
@@ -1614,8 +1614,8 @@ static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 *
static avi_error get_first_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk)
{
- UINT64 startoffset = (parent != NULL && parent->type != 0) ? parent->offset + 12 : 0;
- if (parent != NULL && parent->type != CHUNKTYPE_LIST && parent->type != CHUNKTYPE_RIFF && parent->type != 0)
+ UINT64 startoffset = (parent != nullptr && parent->type != 0) ? parent->offset + 12 : 0;
+ if (parent != nullptr && parent->type != CHUNKTYPE_LIST && parent->type != CHUNKTYPE_RIFF && parent->type != 0)
return AVIERR_INVALID_DATA;
return get_next_chunk_internal(file, parent, newchunk, startoffset);
}
@@ -1790,7 +1790,7 @@ static avi_error get_next_chunk_internal(avi_file *file, const avi_chunk *parent
UINT32 bytesread;
/* NULL parent implies the root */
- if (parent == NULL)
+ if (parent == nullptr)
parent = &file->rootchunk;
/* start at the current offset */
@@ -1843,7 +1843,7 @@ static avi_error read_movie_data(avi_file *file)
int strindex;
/* find the RIFF chunk */
- avierr = find_first_chunk(file, CHUNKTYPE_RIFF, NULL, &riff);
+ avierr = find_first_chunk(file, CHUNKTYPE_RIFF, nullptr, &riff);
if (avierr != AVIERR_NONE)
goto error;
@@ -1954,7 +1954,7 @@ static avi_error extract_movie_info(avi_file *file)
/* get the video stream */
stream = get_video_stream(file);
- if (stream != NULL)
+ if (stream != nullptr)
{
/* fill in the info */
file->info.video_format = stream->format;
@@ -1966,8 +1966,8 @@ static avi_error extract_movie_info(avi_file *file)
}
/* get the first audio stream */
- stream = get_audio_stream(file, 0, NULL);
- if (stream != NULL)
+ stream = get_audio_stream(file, 0, nullptr);
+ if (stream != nullptr)
{
/* fill in the info */
file->info.audio_format = stream->format;
@@ -1984,8 +1984,8 @@ static avi_error extract_movie_info(avi_file *file)
while (1)
{
/* get the stream info */
- stream = get_audio_stream(file, file->info.audio_channels, NULL);
- if (stream == NULL)
+ stream = get_audio_stream(file, file->info.audio_channels, nullptr);
+ if (stream == nullptr)
break;
file->info.audio_channels++;
@@ -2021,7 +2021,7 @@ static avi_error extract_movie_info(avi_file *file)
static avi_error parse_avih_chunk(avi_file *file, avi_chunk *avih)
{
- UINT8 *chunkdata = NULL;
+ UINT8 *chunkdata = nullptr;
avi_error avierr;
/* read the data */
@@ -2034,12 +2034,12 @@ static avi_error parse_avih_chunk(avi_file *file, avi_chunk *avih)
/* allocate memory for the streams */
file->stream = (avi_stream *)malloc(sizeof(*file->stream) * file->streams);
- if (file->stream == NULL)
+ if (file->stream == nullptr)
goto error;
memset(file->stream, 0, sizeof(*file->stream) * file->streams);
error:
- if (chunkdata != NULL)
+ if (chunkdata != nullptr)
free(chunkdata);
return avierr;
}
@@ -2064,7 +2064,7 @@ error:
static avi_error parse_strh_chunk(avi_file *file, avi_stream *stream, avi_chunk *strh)
{
- UINT8 *chunkdata = NULL;
+ UINT8 *chunkdata = nullptr;
avi_error avierr;
/* read the data */
@@ -2079,7 +2079,7 @@ static avi_error parse_strh_chunk(avi_file *file, avi_stream *stream, avi_chunk
stream->samples = fetch_32bits(&chunkdata[32]);
error:
- if (chunkdata != NULL)
+ if (chunkdata != nullptr)
free(chunkdata);
return avierr;
}
@@ -2104,7 +2104,7 @@ error:
static avi_error parse_strf_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf)
{
- UINT8 *chunkdata = NULL;
+ UINT8 *chunkdata = nullptr;
avi_error avierr;
/* read the data */
@@ -2136,7 +2136,7 @@ static avi_error parse_strf_chunk(avi_file *file, avi_stream *stream, avi_chunk
}
error:
- if (chunkdata != NULL)
+ if (chunkdata != nullptr)
free(chunkdata);
return avierr;
}
@@ -2161,7 +2161,7 @@ error:
static avi_error parse_indx_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf)
{
UINT32 entries, entry;
- UINT8 *chunkdata = NULL;
+ UINT8 *chunkdata = nullptr;
UINT16 longs_per_entry;
UINT8 type;
UINT64 baseoffset;
@@ -2238,7 +2238,7 @@ static avi_error parse_indx_chunk(avi_file *file, avi_stream *stream, avi_chunk
}
error:
- if (chunkdata != NULL)
+ if (chunkdata != nullptr)
free(chunkdata);
return avierr;
}
@@ -2262,7 +2262,7 @@ error:
static avi_error parse_idx1_chunk(avi_file *file, UINT64 baseoffset, avi_chunk *idx1)
{
- UINT8 *chunkdata = NULL;
+ UINT8 *chunkdata = nullptr;
avi_error avierr;
UINT32 entries;
UINT32 entry;
@@ -2300,7 +2300,7 @@ static avi_error parse_idx1_chunk(avi_file *file, UINT64 baseoffset, avi_chunk *
}
error:
- if (chunkdata != NULL)
+ if (chunkdata != nullptr)
free(chunkdata);
return avierr;
}
@@ -2841,7 +2841,7 @@ static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initia
/* allocate memory */
tempbuf = (UINT8 *)malloc(24 + 8 * chunks_this_index);
- if (tempbuf == NULL)
+ if (tempbuf == nullptr)
return AVIERR_NO_MEMORY;
memset(tempbuf, 0, 24 + 8 * chunks_this_index);
@@ -2920,7 +2920,7 @@ static avi_error write_idx1_chunk(avi_file *file)
/* allocate a temporary buffer */
tempbuf = (UINT8 *)malloc(tempbuflength);
- if (tempbuf == NULL)
+ if (tempbuf == nullptr)
return AVIERR_NO_MEMORY;
/* fill it in */
@@ -2971,15 +2971,15 @@ static avi_error write_idx1_chunk(avi_file *file)
static avi_error soundbuf_initialize(avi_file *file)
{
- avi_stream *audio = get_audio_stream(file, 0, NULL);
+ avi_stream *audio = get_audio_stream(file, 0, nullptr);
avi_stream *video = get_video_stream(file);
/* we require a video stream */
- if (video == NULL)
+ if (video == nullptr)
return AVIERR_UNSUPPORTED_VIDEO_FORMAT;
/* skip if no audio stream */
- if (audio == NULL)
+ if (audio == nullptr)
return AVIERR_NONE;
/* determine the number of samples we want in our buffer; 2 seconds should be enough */
@@ -2987,7 +2987,7 @@ static avi_error soundbuf_initialize(avi_file *file)
/* allocate a buffer */
file->soundbuf = (INT16 *)malloc(file->soundbuf_samples * file->info.audio_channels * sizeof(file->soundbuf[0]));
- if (file->soundbuf == NULL)
+ if (file->soundbuf == nullptr)
return AVIERR_NO_MEMORY;
memset(file->soundbuf, 0, file->soundbuf_samples * file->info.audio_channels * sizeof(file->soundbuf[0]));
@@ -3015,12 +3015,12 @@ static avi_error soundbuf_initialize(avi_file *file)
static avi_error soundbuf_write_chunk(avi_file *file, UINT32 framenum)
{
- avi_stream *stream = get_audio_stream(file, 0, NULL);
+ avi_stream *stream = get_audio_stream(file, 0, nullptr);
avi_error avierr;
UINT32 length;
/* skip if no audio stream */
- if (stream == NULL)
+ if (stream == nullptr)
return AVIERR_NONE;
/* determine the length of this chunk */
@@ -3058,7 +3058,7 @@ static avi_error soundbuf_write_chunk(avi_file *file, UINT32 framenum)
static avi_error soundbuf_flush(avi_file *file, int only_flush_full)
{
- avi_stream *stream = get_audio_stream(file, 0, NULL);
+ avi_stream *stream = get_audio_stream(file, 0, nullptr);
INT32 channelsamples = file->soundbuf_samples;
INT32 processedsamples = 0;
UINT32 bytes_per_sample;
@@ -3069,7 +3069,7 @@ static avi_error soundbuf_flush(avi_file *file, int only_flush_full)
int channel;
/* skip if no stream */
- if (stream == NULL)
+ if (stream == nullptr)
return AVIERR_NONE;
/* get the chunk ID for this stream */
@@ -3337,7 +3337,7 @@ static avi_error huffyuv_extract_tables(avi_stream *stream, const UINT8 *chunkda
/* allocate memory for the data */
stream->huffyuv = (huffyuv_data *)malloc(sizeof(*stream->huffyuv));
- if (stream->huffyuv == NULL)
+ if (stream->huffyuv == nullptr)
{
avierr = AVIERR_NO_MEMORY;
goto error;
@@ -3425,7 +3425,7 @@ static avi_error huffyuv_extract_tables(avi_stream *stream, const UINT8 *chunkda
if (bitsat16 > 0)
{
table->extralookup = (UINT16 *)malloc(bitsat16 * 65536 * sizeof(table->extralookup[0]));
- if (table->extralookup == NULL)
+ if (table->extralookup == nullptr)
{
avierr = AVIERR_NO_MEMORY;
goto error;
@@ -3454,10 +3454,10 @@ static avi_error huffyuv_extract_tables(avi_stream *stream, const UINT8 *chunkda
}
error:
- if (avierr != AVIERR_NONE && stream->huffyuv != NULL)
+ if (avierr != AVIERR_NONE && stream->huffyuv != nullptr)
{
free(stream->huffyuv);
- stream->huffyuv = NULL;
+ stream->huffyuv = nullptr;
}
return avierr;
}
@@ -3759,7 +3759,7 @@ static void printf_chunk_recursive(avi_file *file, avi_chunk *container, int ind
/* print data within the chunk */
if (chunksize > 0 && curchunk.size < 1024 * 1024)
{
- UINT8 *data = NULL;
+ UINT8 *data = nullptr;
int i;
/* read the data for a chunk */
diff --git a/src/lib/util/bitmap.cpp b/src/lib/util/bitmap.cpp
index aeb9852ca1c..2436e474136 100644
--- a/src/lib/util/bitmap.cpp
+++ b/src/lib/util/bitmap.cpp
@@ -77,11 +77,11 @@ inline void bitmap_t::compute_base(int xslop, int yslop)
*/
bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop)
- : m_alloc(NULL),
+ : m_alloc(nullptr),
m_allocbytes(0),
m_format(format),
m_bpp(bpp),
- m_palette(NULL)
+ m_palette(nullptr)
{
// allocate intializes all other fields
allocate(width, height, xslop, yslop);
@@ -101,7 +101,7 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xsl
*/
bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels)
- : m_alloc(NULL),
+ : m_alloc(nullptr),
m_allocbytes(0),
m_base(base),
m_rowpixels(rowpixels),
@@ -109,7 +109,7 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int hei
m_height(height),
m_format(format),
m_bpp(bpp),
- m_palette(NULL),
+ m_palette(nullptr),
m_cliprect(0, width - 1, 0, height - 1)
{
}
@@ -126,7 +126,7 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int hei
*/
bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect)
- : m_alloc(NULL),
+ : m_alloc(nullptr),
m_allocbytes(0),
m_base(source.raw_pixptr(subrect.min_y, subrect.min_x)),
m_rowpixels(source.m_rowpixels),
@@ -134,7 +134,7 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectan
m_height(subrect.height()),
m_format(format),
m_bpp(bpp),
- m_palette(NULL),
+ m_palette(nullptr),
m_cliprect(0, subrect.width() - 1, 0, subrect.height() - 1)
{
assert(format == source.m_format);
@@ -258,10 +258,10 @@ void bitmap_t::resize(int width, int height, int xslop, int yslop)
void bitmap_t::reset()
{
// delete any existing stuff
- set_palette(NULL);
+ set_palette(nullptr);
delete[] m_alloc;
- m_alloc = NULL;
- m_base = NULL;
+ m_alloc = nullptr;
+ m_base = nullptr;
// reset all fields
m_rowpixels = 0;
@@ -339,14 +339,14 @@ void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect)
void bitmap_t::set_palette(palette_t *palette)
{
// first dereference any existing palette
- if (m_palette != NULL)
+ if (m_palette != nullptr)
{
m_palette->deref();
- m_palette = NULL;
+ m_palette = nullptr;
}
// then reference any new palette
- if (palette != NULL)
+ if (palette != nullptr)
{
palette->ref();
m_palette = palette;
diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h
index 91d693124e1..23d05af90df 100644
--- a/src/lib/util/bitmap.h
+++ b/src/lib/util/bitmap.h
@@ -141,7 +141,7 @@ public:
INT32 rowbytes() const { return m_rowpixels * m_bpp / 8; }
UINT8 bpp() const { return m_bpp; }
bitmap_format format() const { return m_format; }
- bool valid() const { return (m_base != NULL); }
+ bool valid() const { return (m_base != nullptr); }
palette_t *palette() const { return m_palette; }
const rectangle &cliprect() const { return m_cliprect; }
diff --git a/src/lib/util/cdrom.cpp b/src/lib/util/cdrom.cpp
index e3cb14e8f0c..a9a60ef97bd 100644
--- a/src/lib/util/cdrom.cpp
+++ b/src/lib/util/cdrom.cpp
@@ -130,7 +130,7 @@ struct cdrom_file
-------------------------------------------------*/
/**
- * @fn INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum)
+ * @fn static inline UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum)
*
* @brief Physical to chd lba.
*
@@ -141,7 +141,7 @@ struct cdrom_file
* @return An UINT32.
*/
-INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum)
+static inline UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum)
{
UINT32 chdlba;
int track;
@@ -164,7 +164,7 @@ INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &trac
-------------------------------------------------*/
/**
- * @fn INLINE UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum)
+ * @fn static inline UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum)
*
* @brief Logical to chd lba.
*
@@ -175,7 +175,7 @@ INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &trac
* @return An UINT32.
*/
-INLINE UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum)
+static inline UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum)
{
UINT32 chdlba, physlba;
int track;
@@ -225,8 +225,8 @@ cdrom_file *cdrom_open(const char *inputfile)
/* allocate memory for the CD-ROM file */
file = new cdrom_file();
- if (file == NULL)
- return NULL;
+ if (file == nullptr)
+ return nullptr;
/* setup the CDROM module and get the disc info */
chd_error err = chdcd_parse_toc(inputfile, file->cdtoc, file->track_info);
@@ -234,11 +234,11 @@ cdrom_file *cdrom_open(const char *inputfile)
{
fprintf(stderr, "Error reading input file: %s\n", chd_file::error_string(err));
delete file;
- return NULL;
+ return nullptr;
}
/* fill in the data */
- file->chd = NULL;
+ file->chd = nullptr;
LOG(("CD has %d tracks\n", file->cdtoc.numtrks));
@@ -249,7 +249,7 @@ cdrom_file *cdrom_open(const char *inputfile)
{
fprintf(stderr, "Unable to open file: %s\n", file->track_info.track[i].fname.c_str());
cdrom_close(file);
- return NULL;
+ return nullptr;
}
}
/* calculate the starting frame for each track, keeping in mind that CHDMAN
@@ -322,18 +322,18 @@ cdrom_file *cdrom_open(chd_file *chd)
/* punt if no CHD */
if (!chd)
- return NULL;
+ return nullptr;
/* validate the CHD information */
if (chd->hunk_bytes() % CD_FRAME_SIZE != 0)
- return NULL;
+ return nullptr;
if (chd->unit_bytes() != CD_FRAME_SIZE)
- return NULL;
+ return nullptr;
/* allocate memory for the CD-ROM file */
file = new cdrom_file();
- if (file == NULL)
- return NULL;
+ if (file == nullptr)
+ return nullptr;
/* fill in the data */
file->chd = chd;
@@ -343,7 +343,7 @@ cdrom_file *cdrom_open(chd_file *chd)
if (err != CHDERR_NONE)
{
delete file;
- return NULL;
+ return nullptr;
}
LOG(("CD has %d tracks\n", file->cdtoc.numtrks));
@@ -411,10 +411,10 @@ cdrom_file *cdrom_open(chd_file *chd)
void cdrom_close(cdrom_file *file)
{
- if (file == NULL)
+ if (file == nullptr)
return;
- if (file->chd == NULL)
+ if (file->chd == nullptr)
{
for (int i = 0; i < file->cdtoc.numtrks; i++)
{
@@ -461,7 +461,7 @@ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UI
}
// if a CHD, just read
- if (file->chd != NULL)
+ if (file->chd != nullptr)
{
result = file->chd->read_bytes(UINT64(chdsector) * UINT64(CD_FRAME_SIZE) + startoffs, dest, length);
/* swap CDDA in the case of LE GDROMs */
@@ -521,7 +521,7 @@ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UI
UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype, bool phys)
{
- if (file == NULL)
+ if (file == nullptr)
return 0;
// compute CHD sector and tracknumber
@@ -606,7 +606,7 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32
UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool phys)
{
- if (file == NULL)
+ if (file == nullptr)
return ~0;
// compute CHD sector and tracknumber
@@ -656,7 +656,7 @@ UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame)
{
UINT32 track = 0;
- if (file == NULL)
+ if (file == nullptr)
return ~0;
/* convert to a CHD sector offset and get track information */
@@ -684,7 +684,7 @@ UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame)
UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track)
{
- if (file == NULL)
+ if (file == nullptr)
return ~0;
/* handle lead-out specially */
@@ -712,7 +712,7 @@ UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track)
UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track)
{
- if (file == NULL)
+ if (file == nullptr)
return ~0;
/* handle lead-out specially */
@@ -743,7 +743,7 @@ UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track)
int cdrom_get_last_track(cdrom_file *file)
{
- if (file == NULL)
+ if (file == nullptr)
return -1;
return file->cdtoc.numtrks;
@@ -768,7 +768,7 @@ int cdrom_get_last_track(cdrom_file *file)
int cdrom_get_adr_control(cdrom_file *file, int track)
{
- if (file == NULL)
+ if (file == nullptr)
return -1;
if (track == 0xaa || file->cdtoc.tracks[track].trktype == CD_TRACK_AUDIO)
@@ -797,7 +797,7 @@ int cdrom_get_adr_control(cdrom_file *file, int track)
int cdrom_get_track_type(cdrom_file *file, int track)
{
- if (file == NULL)
+ if (file == nullptr)
return -1;
return file->cdtoc.tracks[track].trktype;
@@ -821,8 +821,8 @@ int cdrom_get_track_type(cdrom_file *file, int track)
const cdrom_toc *cdrom_get_toc(cdrom_file *file)
{
- if (file == NULL)
- return NULL;
+ if (file == nullptr)
+ return nullptr;
return &file->cdtoc;
}
diff --git a/src/lib/util/cdrom.h b/src/lib/util/cdrom.h
index c0115701e35..c495a405513 100644
--- a/src/lib/util/cdrom.h
+++ b/src/lib/util/cdrom.h
@@ -145,12 +145,12 @@ void ecc_clear(UINT8 *sector);
INLINE FUNCTIONS
***************************************************************************/
-INLINE UINT32 msf_to_lba(UINT32 msf)
+static inline UINT32 msf_to_lba(UINT32 msf)
{
return ( ((msf&0x00ff0000)>>16) * 60 * 75) + (((msf&0x0000ff00)>>8) * 75) + ((msf&0x000000ff)>>0);
}
-INLINE UINT32 lba_to_msf(UINT32 lba)
+static inline UINT32 lba_to_msf(UINT32 lba)
{
UINT8 m, s, f;
@@ -167,7 +167,7 @@ INLINE UINT32 lba_to_msf(UINT32 lba)
// segacd needs it like this.. investigate
// Angelo also says PCE tracks often start playing at the
// wrong address.. related?
-INLINE UINT32 lba_to_msf_alt(int lba)
+static inline UINT32 lba_to_msf_alt(int lba)
{
UINT32 ret = 0;
diff --git a/src/lib/util/chd.cpp b/src/lib/util/chd.cpp
index 07e98d03b85..38881cc8d81 100644
--- a/src/lib/util/chd.cpp
+++ b/src/lib/util/chd.cpp
@@ -186,7 +186,7 @@ inline void chd_file::be_write_sha1(UINT8 *base, sha1_t value)
inline void chd_file::file_read(UINT64 offset, void *dest, UINT32 length)
{
// no file = failure
- if (m_file == NULL)
+ if (m_file == nullptr)
throw CHDERR_NOT_OPEN;
// seek and read
@@ -205,7 +205,7 @@ inline void chd_file::file_read(UINT64 offset, void *dest, UINT32 length)
inline void chd_file::file_write(UINT64 offset, const void *source, UINT32 length)
{
// no file = failure
- if (m_file == NULL)
+ if (m_file == nullptr)
throw CHDERR_NOT_OPEN;
// seek and write
@@ -225,7 +225,7 @@ inline void chd_file::file_write(UINT64 offset, const void *source, UINT32 lengt
inline UINT64 chd_file::file_append(const void *source, UINT32 length, UINT32 alignment)
{
// no file = failure
- if (m_file == NULL)
+ if (m_file == nullptr)
throw CHDERR_NOT_OPEN;
// seek to the end and align if necessary
@@ -288,7 +288,7 @@ inline UINT8 chd_file::bits_for_value(UINT64 value)
*/
chd_file::chd_file()
- : m_file(NULL),
+ : m_file(nullptr),
m_owns_file(false)
{
// reset state
@@ -554,7 +554,7 @@ void chd_file::set_raw_sha1(sha1_t rawdata)
void chd_file::set_parent_sha1(sha1_t parent)
{
// if no file, fail
- if (m_file == NULL)
+ if (m_file == nullptr)
throw CHDERR_INVALID_FILE;
// create a big-endian version
@@ -585,7 +585,7 @@ void chd_file::set_parent_sha1(sha1_t parent)
chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4])
{
// make sure we don't already have a file open
- if (m_file != NULL)
+ if (m_file != nullptr)
return CHDERR_ALREADY_OPEN;
// set the header parameters
@@ -593,7 +593,7 @@ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbyte
m_hunkbytes = hunkbytes;
m_unitbytes = unitbytes;
memcpy(m_compression, compression, sizeof(m_compression));
- m_parent = NULL;
+ m_parent = nullptr;
// take ownership of the file
m_file = &file;
@@ -620,7 +620,7 @@ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbyte
chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent)
{
// make sure we don't already have a file open
- if (m_file != NULL)
+ if (m_file != nullptr)
return CHDERR_ALREADY_OPEN;
// set the header parameters
@@ -655,11 +655,11 @@ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbyte
chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4])
{
// make sure we don't already have a file open
- if (m_file != NULL)
+ if (m_file != nullptr)
return CHDERR_ALREADY_OPEN;
// create the new file
- core_file *file = NULL;
+ core_file *file = nullptr;
file_error filerr = core_fopen(filename, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
if (filerr != FILERR_NONE)
return CHDERR_FILE_NOT_FOUND;
@@ -696,11 +696,11 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun
chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent)
{
// make sure we don't already have a file open
- if (m_file != NULL)
+ if (m_file != nullptr)
return CHDERR_ALREADY_OPEN;
// create the new file
- core_file *file = NULL;
+ core_file *file = nullptr;
file_error filerr = core_fopen(filename, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
if (filerr != FILERR_NONE)
return CHDERR_FILE_NOT_FOUND;
@@ -735,12 +735,12 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun
chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent)
{
// make sure we don't already have a file open
- if (m_file != NULL)
+ if (m_file != nullptr)
return CHDERR_ALREADY_OPEN;
// open the file
UINT32 openflags = writeable ? (OPEN_FLAG_READ | OPEN_FLAG_WRITE) : OPEN_FLAG_READ;
- core_file *file = NULL;
+ core_file *file = nullptr;
file_error filerr = core_fopen(filename, openflags, &file);
if (filerr != FILERR_NONE)
return CHDERR_FILE_NOT_FOUND;
@@ -775,7 +775,7 @@ chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent)
chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent)
{
// make sure we don't already have a file open
- if (m_file != NULL)
+ if (m_file != nullptr)
return CHDERR_ALREADY_OPEN;
// open the file
@@ -796,9 +796,9 @@ chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent)
void chd_file::close()
{
// reset file characteristics
- if (m_owns_file && m_file != NULL)
+ if (m_owns_file && m_file != nullptr)
core_fclose(m_file);
- m_file = NULL;
+ m_file = nullptr;
m_owns_file = false;
m_allow_reads = false;
m_allow_writes = false;
@@ -813,7 +813,7 @@ void chd_file::close()
m_unitbytes = 0;
m_unitcount = 0;
memset(m_compression, 0, sizeof(m_compression));
- m_parent = NULL;
+ m_parent = nullptr;
m_parent_missing = false;
// reset key offsets within the header
@@ -828,10 +828,10 @@ void chd_file::close()
m_rawmap.clear();
// reset compression management
- for (int decompnum = 0; decompnum < ARRAY_LENGTH(m_decompressor); decompnum++)
+ for (auto & elem : m_decompressor)
{
- delete m_decompressor[decompnum];
- m_decompressor[decompnum] = NULL;
+ delete elem;
+ elem = nullptr;
}
m_compressed.clear();
@@ -869,7 +869,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
try
{
// punt if no file
- if (m_file == NULL)
+ if (m_file == nullptr)
throw CHDERR_NOT_OPEN;
// return an error if out of range
@@ -896,7 +896,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
blocklen = be_read(&rawmap[12], 2) + (rawmap[14] << 16);
file_read(blockoffs, &m_compressed[0], blocklen);
m_decompressor[0]->decompress(&m_compressed[0], blocklen, dest, m_hunkbytes);
- if (!(rawmap[15] & V34_MAP_ENTRY_FLAG_NO_CRC) && dest != NULL && crc32_creator::simple(dest, m_hunkbytes) != blockcrc)
+ if (!(rawmap[15] & V34_MAP_ENTRY_FLAG_NO_CRC) && dest != nullptr && crc32_creator::simple(dest, m_hunkbytes) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
return CHDERR_NONE;
@@ -936,7 +936,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
file_read(blockoffs, dest, m_hunkbytes);
else if (m_parent_missing)
throw CHDERR_REQUIRES_PARENT;
- else if (m_parent != NULL)
+ else if (m_parent != nullptr)
m_parent->read_hunk(hunknum, dest);
else
memset(dest, 0, m_hunkbytes);
@@ -955,7 +955,7 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer)
case COMPRESSION_TYPE_3:
file_read(blockoffs, &m_compressed[0], blocklen);
m_decompressor[rawmap[0]]->decompress(&m_compressed[0], blocklen, dest, m_hunkbytes);
- if (!m_decompressor[rawmap[0]]->lossy() && dest != NULL && crc16_creator::simple(dest, m_hunkbytes) != blockcrc)
+ if (!m_decompressor[rawmap[0]]->lossy() && dest != nullptr && crc16_creator::simple(dest, m_hunkbytes) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
if (m_decompressor[rawmap[0]]->lossy() && crc16_creator::simple(&m_compressed[0], blocklen) != blockcrc)
throw CHDERR_DECOMPRESSION_ERROR;
@@ -1014,7 +1014,7 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer)
try
{
// punt if no file
- if (m_file == NULL)
+ if (m_file == nullptr)
throw CHDERR_NOT_OPEN;
// return an error if out of range
@@ -1249,7 +1249,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
// read the metadata
// TODO: how to properly allocate a dynamic char buffer?
- char* metabuf = new char[metaentry.length+1];
+ auto metabuf = new char[metaentry.length+1];
memset(metabuf, 0x00, metaentry.length+1);
file_read(metaentry.offset + METADATA_HEADER_SIZE, metabuf, metaentry.length);
output.assign(metabuf);
@@ -2268,25 +2268,25 @@ chd_error chd_file::create_common()
m_metaoffset = 0;
// if we have a parent, it must be V3 or later
- if (m_parent != NULL && m_parent->version() < 3)
+ if (m_parent != nullptr && 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())
+ if (m_parent != nullptr && m_unitbytes != m_parent->unit_bytes())
throw CHDERR_INVALID_PARAMETER;
// verify the compression types
bool found_zero = false;
- for (int codecnum = 0; codecnum < ARRAY_LENGTH(m_compression); codecnum++)
+ for (auto & elem : m_compression)
{
// once we hit an empty slot, all later slots must be empty as well
- if (m_compression[codecnum] == CHD_CODEC_NONE)
+ if (elem == CHD_CODEC_NONE)
found_zero = true;
else if (found_zero)
throw CHDERR_INVALID_PARAMETER;
- else if (!chd_codec_list::codec_exists(m_compression[codecnum]))
+ else if (!chd_codec_list::codec_exists(elem))
throw CHDERR_UNKNOWN_COMPRESSION;
}
@@ -2306,7 +2306,7 @@ chd_error chd_file::create_common()
be_write(&rawheader[60], m_unitbytes, 4);
be_write_sha1(&rawheader[64], sha1_t::null);
be_write_sha1(&rawheader[84], sha1_t::null);
- be_write_sha1(&rawheader[104], (m_parent != NULL) ? m_parent->sha1() : sha1_t::null);
+ be_write_sha1(&rawheader[104], (m_parent != nullptr) ? m_parent->sha1() : sha1_t::null);
// write the resulting header
file_write(0, rawheader, sizeof(rawheader));
@@ -2412,12 +2412,12 @@ chd_error chd_file::open_common(bool writeable)
// make sure we have a parent if we need one (and don't if we don't)
if (parentsha1 != sha1_t::null)
{
- if (m_parent == NULL)
+ if (m_parent == nullptr)
m_parent_missing = true;
else if (m_parent->sha1() != parentsha1)
throw CHDERR_INVALID_PARENT;
}
- else if (m_parent != NULL)
+ else if (m_parent != nullptr)
throw CHDERR_INVALID_PARAMETER;
// finish opening the file
@@ -2450,7 +2450,7 @@ void chd_file::create_open_common()
for (int decompnum = 0; decompnum < ARRAY_LENGTH(m_compression); decompnum++)
{
m_decompressor[decompnum] = chd_codec_list::new_decompressor(m_compression[decompnum], *this);
- if (m_decompressor[decompnum] == NULL && m_compression[decompnum] != 0)
+ if (m_decompressor[decompnum] == nullptr && m_compression[decompnum] != 0)
throw CHDERR_UNKNOWN_COMPRESSION;
}
@@ -2488,7 +2488,7 @@ void chd_file::create_open_common()
void chd_file::verify_proper_compression_append(UINT32 hunknum)
{
// punt if no file
- if (m_file == NULL)
+ if (m_file == nullptr)
throw CHDERR_NOT_OPEN;
// return an error if out of range
@@ -2751,11 +2751,11 @@ chd_file_compressor::chd_file_compressor()
: m_walking_parent(false),
m_total_in(0),
m_total_out(0),
- m_read_queue(NULL),
+ m_read_queue(nullptr),
m_read_queue_offset(0),
m_read_done_offset(0),
m_read_error(false),
- m_work_queue(NULL),
+ m_work_queue(nullptr),
m_write_hunk(0)
{
// zap arrays
@@ -2781,8 +2781,8 @@ chd_file_compressor::~chd_file_compressor()
osd_work_queue_free(m_work_queue);
// delete allocated arrays
- for (int codecnum = 0; codecnum < ARRAY_LENGTH(m_codecs); codecnum++)
- delete m_codecs[codecnum];
+ for (auto & elem : m_codecs)
+ delete elem;
}
/**
@@ -2796,7 +2796,7 @@ chd_file_compressor::~chd_file_compressor()
void chd_file_compressor::compress_begin()
{
// reset state
- m_walking_parent = (m_parent != NULL);
+ m_walking_parent = (m_parent != nullptr);
m_total_in = 0;
m_total_out = 0;
m_compsha1.reset();
@@ -2824,10 +2824,10 @@ void chd_file_compressor::compress_begin()
}
// initialize codec instances
- for (int instance = 0; instance < ARRAY_LENGTH(m_codecs); instance++)
+ for (auto & elem : m_codecs)
{
- delete m_codecs[instance];
- m_codecs[instance] = new chd_compressor_group(*this, m_compression);
+ delete elem;
+ elem = new chd_compressor_group(*this, m_compression);
}
// reset write state
@@ -2886,9 +2886,9 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
work_item &item = m_work_item[m_write_hunk % WORK_BUFFER_HUNKS];
// free any OSD work item
- if (item.m_osd != NULL)
+ if (item.m_osd != nullptr)
osd_work_item_release(item.m_osd);
- item.m_osd = NULL;
+ item.m_osd = nullptr;
// for parent walking, just add to the hashmap
if (m_walking_parent)
@@ -2929,7 +2929,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
}
// if not, see if it's in the parent map
- if (m_parent != NULL)
+ if (m_parent != nullptr)
{
UINT64 parentunit = m_parent_map.find(item.m_hash[0].m_crc16, item.m_hash[0].m_sha1);
if (parentunit != hashmap::NOT_FOUND)
@@ -2958,8 +2958,8 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
m_walking_parent = false;
m_read_queue_offset = m_read_done_offset = 0;
m_write_hunk = 0;
- for (int itemnum = 0; itemnum < WORK_BUFFER_HUNKS; itemnum++)
- atomic_exchange32(&m_work_item[itemnum].m_status, WS_READY);
+ for (auto & elem : m_work_item)
+ atomic_exchange32(&elem.m_status, WS_READY);
}
// wait for all reads to finish and if we're compressed, write the final SHA1 and map
@@ -2982,7 +2982,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio
ratio = (m_total_in == 0) ? 1.0 : double(m_total_out) / double(m_total_in);
// if we're waiting for work, wait
- while (m_work_item[m_write_hunk % WORK_BUFFER_HUNKS].m_status != WS_COMPLETE && m_work_item[m_write_hunk % WORK_BUFFER_HUNKS].m_osd != NULL)
+ while (m_work_item[m_write_hunk % WORK_BUFFER_HUNKS].m_status != WS_COMPLETE && m_work_item[m_write_hunk % WORK_BUFFER_HUNKS].m_osd != nullptr)
osd_work_item_wait(m_work_item[m_write_hunk % WORK_BUFFER_HUNKS].m_osd, osd_ticks_per_second());
return m_walking_parent ? CHDERR_WALKING_PARENT : CHDERR_COMPRESSING;
@@ -3005,7 +3005,7 @@ void *chd_file_compressor::async_walk_parent_static(void *param, int threadid)
{
work_item *item = reinterpret_cast<work_item *>(param);
item->m_compressor->async_walk_parent(*item);
- return NULL;
+ return nullptr;
}
/**
@@ -3047,7 +3047,7 @@ void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid)
{
work_item *item = reinterpret_cast<work_item *>(param);
item->m_compressor->async_compress_hunk(*item, threadid);
- return NULL;
+ return nullptr;
}
/**
@@ -3096,7 +3096,7 @@ void chd_file_compressor::async_compress_hunk(work_item &item, int threadid)
void *chd_file_compressor::async_read_static(void *param, int threadid)
{
reinterpret_cast<chd_file_compressor *>(param)->async_read();
- return NULL;
+ return nullptr;
}
/**
@@ -3189,7 +3189,7 @@ void chd_file_compressor::async_read()
*/
chd_file_compressor::hashmap::hashmap()
- : m_block_list(new entry_block(NULL))
+ : m_block_list(new entry_block(nullptr))
{
// initialize the map to empty
memset(m_map, 0, sizeof(m_map));
@@ -3220,7 +3220,7 @@ chd_file_compressor::hashmap::~hashmap()
void chd_file_compressor::hashmap::reset()
{
// delete all the blocks
- while (m_block_list->m_next != NULL)
+ while (m_block_list->m_next != nullptr)
{
entry_block *block = m_block_list;
m_block_list = block->m_next;
@@ -3248,7 +3248,7 @@ void chd_file_compressor::hashmap::reset()
UINT64 chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1)
{
// look up the entry in the map
- for (entry_t *entry = m_map[crc16]; entry != NULL; entry = entry->m_next)
+ for (entry_t *entry = m_map[crc16]; entry != nullptr; entry = entry->m_next)
if (entry->m_sha1 == sha1)
return entry->m_itemnum;
return NOT_FOUND;
diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h
index d767c0889e0..114a29a5b5e 100644
--- a/src/lib/util/chd.h
+++ b/src/lib/util/chd.h
@@ -307,7 +307,7 @@ public:
operator core_file *() { return m_file; }
// getters
- bool opened() const { return (m_file != NULL); }
+ bool opened() const { return (m_file != nullptr); }
UINT32 version() const { return m_version; }
UINT64 logical_bytes() const { return m_logicalbytes; }
UINT32 hunk_bytes() const { return m_hunkbytes; }
@@ -333,8 +333,8 @@ public:
chd_error create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent);
// 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);
+ chd_error open(const char *filename, bool writeable = false, chd_file *parent = nullptr);
+ chd_error open(core_file &file, bool writeable = false, chd_file *parent = nullptr);
// file close
void close();
@@ -519,14 +519,14 @@ private:
struct work_item
{
work_item()
- : m_osd(NULL)
- , m_compressor(NULL)
+ : m_osd(nullptr)
+ , m_compressor(nullptr)
, m_status(WS_READY)
- , m_data(NULL)
- , m_compressed(NULL)
+ , m_data(nullptr)
+ , m_compressed(nullptr)
, m_complen(0)
, m_compression(0)
- , m_codecs(NULL)
+ , m_codecs(nullptr)
{ }
osd_work_item * m_osd; // OSD work item running on this block
diff --git a/src/lib/util/chdcd.cpp b/src/lib/util/chdcd.cpp
index e267c613d1d..eeb196d242f 100644
--- a/src/lib/util/chdcd.cpp
+++ b/src/lib/util/chdcd.cpp
@@ -475,7 +475,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_
infile = fopen(tocfname, "rb");
path = get_file_path(path);
- if (infile == (FILE *)NULL)
+ if (infile == (FILE *)nullptr)
{
return CHDERR_FILE_NOT_FOUND;
}
@@ -657,7 +657,7 @@ chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
infile = fopen(tocfname, "rb");
path = get_file_path(path);
- if (infile == (FILE *)NULL)
+ if (infile == (FILE *)nullptr)
{
return CHDERR_FILE_NOT_FOUND;
}
@@ -736,7 +736,7 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_
infile = fopen(tocfname, "rt");
path = get_file_path(path);
- if (infile == (FILE *)NULL)
+ if (infile == (FILE *)nullptr)
{
return CHDERR_FILE_NOT_FOUND;
}
@@ -771,13 +771,13 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_
outtoc.tracks[trknum].subsize = 0;
outtoc.tracks[trknum].pgsub = CD_SUB_NONE;
- tok=strtok(NULL," ");
+ tok=strtok(nullptr," ");
outtoc.tracks[trknum].physframeofs=atoi(tok);
- tok=strtok(NULL," ");
+ tok=strtok(nullptr," ");
trktype=atoi(tok);
- tok=strtok(NULL," ");
+ tok=strtok(nullptr," ");
trksize=atoi(tok);
if(trktype==4 && trksize==2352)
@@ -799,16 +799,16 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_
std::string name;
- tok=strtok(NULL," ");
+ tok=strtok(nullptr," ");
name = tok;
if (tok[0]=='"') {
do {
- tok=strtok(NULL," ");
- if (tok!=NULL) {
+ tok=strtok(nullptr," ");
+ if (tok!=nullptr) {
name += " ";
name += tok;
}
- } while(tok!=NULL && (strrchr(tok,'"')-tok !=(strlen(tok)-1)));
+ } while(tok!=nullptr && (strrchr(tok,'"')-tok !=(strlen(tok)-1)));
strdelchr(name,'"');
}
outinfo.track[trknum].fname.assign(path).append(name);
@@ -869,7 +869,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
infile = fopen(tocfname, "rt");
path = get_file_path(path);
- if (infile == (FILE *)NULL)
+ if (infile == (FILE *)nullptr)
{
return CHDERR_FILE_NOT_FOUND;
}
@@ -931,7 +931,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
{
/* get the track number */
TOKENIZE
- trknum = strtoul(token, NULL, 10) - 1;
+ trknum = strtoul(token, nullptr, 10) - 1;
/* next token on the line is the track type */
TOKENIZE
@@ -978,7 +978,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
/* get index number */
TOKENIZE
- idx = strtoul(token, NULL, 10);
+ idx = strtoul(token, nullptr, 10);
/* get index */
TOKENIZE
@@ -1191,7 +1191,7 @@ chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
infile = fopen(tocfname, "rt");
path = get_file_path(path);
- if (infile == (FILE *)NULL)
+ if (infile == (FILE *)nullptr)
{
return CHDERR_FILE_NOT_FOUND;
}
@@ -1241,7 +1241,7 @@ chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
if (token[0] == '#')
{
/* it's a decimal offset, use it */
- f = strtoul(&token[1], NULL, 10);
+ f = strtoul(&token[1], nullptr, 10);
}
else if (isdigit((UINT8)token[0]))
{
diff --git a/src/lib/util/chdcd.h b/src/lib/util/chdcd.h
index be585aad87e..6adcf29ce7b 100644
--- a/src/lib/util/chdcd.h
+++ b/src/lib/util/chdcd.h
@@ -27,7 +27,7 @@ struct chdcd_track_input_entry
struct chdcd_track_input_info
{
- void reset() { for (int i = 0; i < CD_MAX_TRACKS; i++) track[i].reset(); }
+ void reset() { for (auto & elem : track) elem.reset(); }
chdcd_track_input_entry track[CD_MAX_TRACKS];
};
diff --git a/src/lib/util/chdcodec.cpp b/src/lib/util/chdcodec.cpp
index 9f013609133..be1d2022cd7 100644
--- a/src/lib/util/chdcodec.cpp
+++ b/src/lib/util/chdcodec.cpp
@@ -67,7 +67,7 @@ public:
~chd_zlib_compressor();
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest);
+ virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
private:
// internal state
@@ -87,7 +87,7 @@ public:
~chd_zlib_decompressor();
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen);
+ virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
private:
// internal state
@@ -127,7 +127,7 @@ public:
~chd_lzma_compressor();
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest);
+ virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
// helpers
static void configure_properties(CLzmaEncProps &props, UINT32 hunkbytes);
@@ -150,7 +150,7 @@ public:
~chd_lzma_decompressor();
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen);
+ virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
private:
// internal state
@@ -169,7 +169,7 @@ public:
chd_huffman_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest);
+ virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
private:
// internal state
@@ -187,7 +187,7 @@ public:
chd_huffman_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen);
+ virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
private:
// internal state
@@ -205,7 +205,7 @@ public:
chd_flac_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest);
+ virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
// static helpers
static UINT32 blocksize(UINT32 bytes);
@@ -227,7 +227,7 @@ public:
chd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen);
+ virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
private:
// internal state
@@ -247,7 +247,7 @@ public:
~chd_cd_flac_compressor();
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest);
+ virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
// static helpers
static UINT32 blocksize(UINT32 bytes);
@@ -273,7 +273,7 @@ public:
~chd_cd_flac_decompressor();
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen);
+ virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
private:
// internal state
@@ -304,7 +304,7 @@ public:
}
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest)
+ virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override
{
// determine header bytes
UINT32 frames = srclen / CD_FRAME_SIZE;
@@ -373,7 +373,7 @@ public:
}
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen)
+ virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override
{
// determine header bytes
UINT32 frames = destlen / CD_FRAME_SIZE;
@@ -424,7 +424,7 @@ public:
chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
// core functionality
- virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest);
+ virtual UINT32 compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) override;
private:
// internal helpers
@@ -446,8 +446,8 @@ public:
chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy);
// core functionality
- virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen);
- virtual void configure(int param, void *config);
+ virtual void decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) override;
+ virtual void configure(int param, void *config) override;
private:
// internal state
@@ -560,7 +560,7 @@ chd_compressor *chd_codec_list::new_compressor(chd_codec_type type, chd_file &ch
{
// find in the list and construct the class
const codec_entry *entry = find_in_list(type);
- return (entry == NULL) ? NULL : (*entry->m_construct_compressor)(chd, chd.hunk_bytes(), entry->m_lossy);
+ return (entry == nullptr) ? nullptr : (*entry->m_construct_compressor)(chd, chd.hunk_bytes(), entry->m_lossy);
}
@@ -573,7 +573,7 @@ chd_decompressor *chd_codec_list::new_decompressor(chd_codec_type type, chd_file
{
// find in the list and construct the class
const codec_entry *entry = find_in_list(type);
- return (entry == NULL) ? NULL : (*entry->m_construct_decompressor)(chd, chd.hunk_bytes(), entry->m_lossy);
+ return (entry == nullptr) ? nullptr : (*entry->m_construct_decompressor)(chd, chd.hunk_bytes(), entry->m_lossy);
}
@@ -586,7 +586,7 @@ const char *chd_codec_list::codec_name(chd_codec_type type)
{
// find in the list and construct the class
const codec_entry *entry = find_in_list(type);
- return (entry == NULL) ? NULL : entry->m_name;
+ return (entry == nullptr) ? nullptr : entry->m_name;
}
@@ -598,10 +598,10 @@ const char *chd_codec_list::codec_name(chd_codec_type type)
const chd_codec_list::codec_entry *chd_codec_list::find_in_list(chd_codec_type type)
{
// find in the list and construct the class
- for (int listnum = 0; listnum < ARRAY_LENGTH(s_codec_list); listnum++)
- if (s_codec_list[listnum].m_type == type)
- return &s_codec_list[listnum];
- return NULL;
+ for (auto & elem : s_codec_list)
+ if (elem.m_type == type)
+ return &elem;
+ return nullptr;
}
@@ -624,11 +624,11 @@ chd_compressor_group::chd_compressor_group(chd_file &chd, UINT32 compressor_list
// verify the compression types and initialize the codecs
for (int codecnum = 0; codecnum < ARRAY_LENGTH(m_compressor); codecnum++)
{
- m_compressor[codecnum] = NULL;
+ m_compressor[codecnum] = nullptr;
if (compressor_list[codecnum] != CHD_CODEC_NONE)
{
m_compressor[codecnum] = chd_codec_list::new_compressor(compressor_list[codecnum], chd);
- if (m_compressor[codecnum] == NULL)
+ if (m_compressor[codecnum] == nullptr)
throw CHDERR_UNKNOWN_COMPRESSION;
#if CHDCODEC_VERIFY_COMPRESSION
m_decompressor[codecnum] = chd_codec_list::new_decompressor(compressor_list[codecnum], chd);
@@ -647,8 +647,8 @@ chd_compressor_group::chd_compressor_group(chd_file &chd, UINT32 compressor_list
chd_compressor_group::~chd_compressor_group()
{
// delete the codecs and the test buffer
- for (int codecnum = 0; codecnum < ARRAY_LENGTH(m_compressor); codecnum++)
- delete m_compressor[codecnum];
+ for (auto & elem : m_compressor)
+ delete elem;
}
@@ -664,7 +664,7 @@ INT8 chd_compressor_group::find_best_compressor(const UINT8 *src, UINT8 *compres
complen = m_hunkbytes;
INT8 compression = -1;
for (int codecnum = 0; codecnum < ARRAY_LENGTH(m_compressor); codecnum++)
- if (m_compressor[codecnum] != NULL)
+ if (m_compressor[codecnum] != nullptr)
{
// attempt to compress, swallowing errors
try
@@ -735,8 +735,8 @@ chd_zlib_allocator::chd_zlib_allocator()
chd_zlib_allocator::~chd_zlib_allocator()
{
// free our memory
- for (int memindex = 0; memindex < ARRAY_LENGTH(m_allocptr); memindex++)
- delete[] m_allocptr[memindex];
+ for (auto & elem : m_allocptr)
+ delete[] elem;
}
@@ -769,7 +769,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
for (int scan = 0; scan < MAX_ZLIB_ALLOCS; scan++)
{
UINT32 *ptr = codec->m_allocptr[scan];
- if (ptr != NULL && size == *ptr)
+ if (ptr != nullptr && size == *ptr)
{
// set the low bit of the size so we don't match next time
*ptr |= 1;
@@ -780,7 +780,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size)
// alloc a new one and put it into the list
UINT32 *ptr = reinterpret_cast<UINT32 *>(new UINT8[size + sizeof(UINT32)]);
for (int scan = 0; scan < MAX_ZLIB_ALLOCS; scan++)
- if (codec->m_allocptr[scan] == NULL)
+ if (codec->m_allocptr[scan] == nullptr)
{
codec->m_allocptr[scan] = ptr;
break;
@@ -968,8 +968,8 @@ chd_lzma_allocator::chd_lzma_allocator()
chd_lzma_allocator::~chd_lzma_allocator()
{
// free our memory
- for (int memindex = 0; memindex < ARRAY_LENGTH(m_allocptr); memindex++)
- delete[] m_allocptr[memindex];
+ for (auto & elem : m_allocptr)
+ delete[] elem;
}
@@ -989,7 +989,7 @@ void *chd_lzma_allocator::fast_alloc(void *p, size_t size)
for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++)
{
UINT32 *ptr = codec->m_allocptr[scan];
- if (ptr != NULL && size == *ptr)
+ if (ptr != nullptr && size == *ptr)
{
// set the low bit of the size so we don't match next time
*ptr |= 1;
@@ -1000,7 +1000,7 @@ void *chd_lzma_allocator::fast_alloc(void *p, size_t size)
// alloc a new one and put it into the list
UINT32 *ptr = reinterpret_cast<UINT32 *>(new UINT8[size + sizeof(UINT32)]);
for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++)
- if (codec->m_allocptr[scan] == NULL)
+ if (codec->m_allocptr[scan] == nullptr)
{
codec->m_allocptr[scan] = ptr;
break;
@@ -1019,7 +1019,7 @@ void *chd_lzma_allocator::fast_alloc(void *p, size_t size)
void chd_lzma_allocator::fast_free(void *p, void *address)
{
- if (address == NULL)
+ if (address == nullptr)
return;
chd_lzma_allocator *codec = reinterpret_cast<chd_lzma_allocator *>(p);
@@ -1070,7 +1070,7 @@ UINT32 chd_lzma_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *des
{
// allocate the encoder
CLzmaEncHandle encoder = LzmaEnc_Create(&m_allocator);
- if (encoder == NULL)
+ if (encoder == nullptr)
throw CHDERR_COMPRESSION_ERROR;
try
@@ -1082,7 +1082,7 @@ UINT32 chd_lzma_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *des
// run it
SizeT complen = srclen;
- res = LzmaEnc_MemEncode(encoder, dest, &complen, src, srclen, 0, NULL, &m_allocator, &m_allocator);
+ res = LzmaEnc_MemEncode(encoder, dest, &complen, src, srclen, 0, nullptr, &m_allocator, &m_allocator);
if (res != SZ_OK)
throw CHDERR_COMPRESSION_ERROR;
@@ -1645,7 +1645,7 @@ UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *d
postinit();
// make sure short frames are padded with 0
- if (src != NULL)
+ if (src != nullptr)
{
int size = avhuff_encoder::raw_data_size(src);
while (size < srclen)
@@ -1745,7 +1745,7 @@ void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8
throw CHDERR_DECOMPRESSION_ERROR;
// pad short frames with 0
- if (dest != NULL)
+ if (dest != nullptr)
{
int size = avhuff_encoder::raw_data_size(dest);
if (size < destlen)
diff --git a/src/lib/util/chdcodec.h b/src/lib/util/chdcodec.h
index 144fba8641f..f517cdedeeb 100644
--- a/src/lib/util/chdcodec.h
+++ b/src/lib/util/chdcodec.h
@@ -108,7 +108,7 @@ public:
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 bool codec_exists(chd_codec_type type) { return (find_in_list(type) != nullptr); }
static const char *codec_name(chd_codec_type type);
private:
diff --git a/src/lib/util/corealloc.cpp b/src/lib/util/corealloc.cpp
index a635803e463..38f21846f96 100644
--- a/src/lib/util/corealloc.cpp
+++ b/src/lib/util/corealloc.cpp
@@ -27,6 +27,10 @@
// define this to zap memory to a fixed non-0 value before freeing
//#define OVERWRITE_FREED_MEMORY
+// compatibility with non-clang compilers
+#ifndef __has_feature
+ #define __has_feature(x) 0
+#endif
//**************************************************************************
@@ -90,11 +94,11 @@ const zeromem_t zeromem = { };
// globals for memory_entry
UINT64 memory_entry::s_curid = 1;
-osd_lock *memory_entry::s_lock = NULL;
+osd_lock *memory_entry::s_lock = nullptr;
bool memory_entry::s_lock_alloc = false;
bool memory_entry::s_tracking = false;
-memory_entry *memory_entry::s_hash[memory_entry::k_hash_prime] = { NULL };
-memory_entry *memory_entry::s_freehead = NULL;
+memory_entry *memory_entry::s_hash[memory_entry::k_hash_prime] = { nullptr };
+memory_entry *memory_entry::s_freehead = nullptr;
//**************************************************************************
// OPERATOR REPLACEMENTS
@@ -103,15 +107,15 @@ memory_entry *memory_entry::s_freehead = NULL;
#ifndef NO_MEM_TRACKING
// standard new/delete operators (try to avoid using)
-void *operator new(std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, false, true, false); }
-void *operator new[](std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, NULL, 0, true, true, false); }
-void operator delete(void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, false); }
-void operator delete[](void *ptr) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, true); }
+void *operator new(std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, nullptr, 0, false, true, false); }
+void *operator new[](std::size_t size) throw (std::bad_alloc) { return malloc_file_line(size, nullptr, 0, true, true, false); }
+void operator delete(void *ptr) throw() { if (ptr != nullptr) free_file_line(ptr, nullptr, 0, false); }
+void operator delete[](void *ptr) throw() { if (ptr != nullptr) free_file_line(ptr, nullptr, 0, true); }
-void* operator new(std::size_t size,const std::nothrow_t&) throw() { return malloc_file_line(size, NULL, 0, false, false, false); }
-void* operator new[](std::size_t size, const std::nothrow_t&) throw() { return malloc_file_line(size, NULL, 0, true, false, false); }
-void operator delete(void* ptr, const std::nothrow_t&) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, false); }
-void operator delete[](void* ptr, const std::nothrow_t&) throw() { if (ptr != NULL) free_file_line(ptr, NULL, 0, true); }
+void* operator new(std::size_t size,const std::nothrow_t&) throw() { return malloc_file_line(size, nullptr, 0, false, false, false); }
+void* operator new[](std::size_t size, const std::nothrow_t&) throw() { return malloc_file_line(size, nullptr, 0, true, false, false); }
+void operator delete(void* ptr, const std::nothrow_t&) throw() { if (ptr != nullptr) free_file_line(ptr, nullptr, 0, false); }
+void operator delete[](void* ptr, const std::nothrow_t&) throw() { if (ptr != nullptr) free_file_line(ptr, nullptr, 0, true); }
#endif
@@ -122,14 +126,14 @@ void operator delete[](void* ptr, const std::nothrow_t&) throw() { if (ptr != NU
// file/line new/delete operators
void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, false); }
void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, false); }
-void operator delete(void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
-void operator delete[](void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+void operator delete(void *ptr, const char *file, int line) { if (ptr != nullptr) free_file_line(ptr, file, line, false); }
+void operator delete[](void *ptr, const char *file, int line) { if (ptr != nullptr) free_file_line(ptr, file, line, true); }
// file/line new/delete operators with zeroing
void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, true); }
void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, true); }
-void operator delete(void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
-void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+void operator delete(void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != nullptr) free_file_line(ptr, file, line, false); }
+void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != nullptr) free_file_line(ptr, file, line, true); }
@@ -146,13 +150,13 @@ void *malloc_file_line(size_t size, const char *file, int line, bool array, bool
{
// allocate the memory and fail if we can't
void *result = array ? osd_malloc_array(size) : osd_malloc(size);
- if (result == NULL)
+ if (result == nullptr)
{
fprintf(stderr, "Failed to allocate %d bytes (%s:%d)\n", UINT32(size), file, line);
osd_break_into_debugger("Failed to allocate RAM");
if (throw_on_fail)
throw std::bad_alloc();
- return NULL;
+ return nullptr;
}
// zap the memory if requested
@@ -183,7 +187,7 @@ void free_file_line(void *memory, const char *file, int line, bool array)
memory_entry *entry = memory_entry::find(memory);
// warn about untracked frees
- if (entry == NULL)
+ if (entry == nullptr)
{
fprintf(stderr, "Error: attempt to free untracked memory %p in %s(%d)!\n", memory, file, line);
osd_break_into_debugger("Error: attempt to free untracked memory");
@@ -267,7 +271,7 @@ void memory_entry::acquire_lock()
{
// allocate a lock on first usage
// note that osd_lock_alloc() may re-enter this path, so protect against recursion!
- if (s_lock == NULL)
+ if (s_lock == nullptr)
{
if (s_lock_alloc)
return;
@@ -298,14 +302,14 @@ memory_entry *memory_entry::allocate(size_t size, void *base, const char *file,
acquire_lock();
// if we're out of free entries, allocate a new chunk
- if (s_freehead == NULL)
+ if (s_freehead == nullptr)
{
// create a new chunk, and fail if we can't
memory_entry *entry = reinterpret_cast<memory_entry *>(osd_malloc_array(memory_block_alloc_chunk * sizeof(memory_entry)));
- if (entry == NULL)
+ if (entry == nullptr)
{
release_lock();
- return NULL;
+ return nullptr;
}
// add all the entries to the list
@@ -323,7 +327,7 @@ memory_entry *memory_entry::allocate(size_t size, void *base, const char *file,
// populate it
entry->m_size = size;
entry->m_base = base;
- entry->m_file = s_tracking ? file : NULL;
+ entry->m_file = s_tracking ? file : nullptr;
entry->m_line = s_tracking ? line : 0;
entry->m_id = s_curid++;
entry->m_array = array;
@@ -333,9 +337,9 @@ memory_entry *memory_entry::allocate(size_t size, void *base, const char *file,
// add it to the alloc list
int hashval = reinterpret_cast<FPTR>(base) % k_hash_prime;
entry->m_next = s_hash[hashval];
- if (entry->m_next != NULL)
+ if (entry->m_next != nullptr)
entry->m_next->m_prev = entry;
- entry->m_prev = NULL;
+ entry->m_prev = nullptr;
s_hash[hashval] = entry;
release_lock();
@@ -350,15 +354,15 @@ memory_entry *memory_entry::allocate(size_t size, void *base, const char *file,
memory_entry *memory_entry::find(void *ptr)
{
// NULL maps to nothing
- if (ptr == NULL)
- return NULL;
+ if (ptr == nullptr)
+ return nullptr;
// scan the list under the lock
acquire_lock();
int hashval = reinterpret_cast<FPTR>(ptr) % k_hash_prime;
memory_entry *entry;
- for (entry = s_hash[hashval]; entry != NULL; entry = entry->m_next)
+ for (entry = s_hash[hashval]; entry != nullptr; entry = entry->m_next)
if (entry->m_base == ptr)
break;
@@ -380,11 +384,11 @@ void memory_entry::release(memory_entry *entry, const char *file, int line)
// remove ourselves from the alloc list
int hashval = reinterpret_cast<FPTR>(entry->m_base) % k_hash_prime;
- if (entry->m_prev != NULL)
+ if (entry->m_prev != nullptr)
entry->m_prev->m_next = entry->m_next;
else
s_hash[hashval] = entry->m_next;
- if (entry->m_next != NULL)
+ if (entry->m_next != nullptr)
entry->m_next->m_prev = entry->m_prev;
// add ourself to the free list
@@ -411,9 +415,9 @@ void memory_entry::report_unfreed(UINT64 start)
// check for leaked memory
UINT32 total = 0;
- for (int hashnum = 0; hashnum < k_hash_prime; hashnum++)
- for (memory_entry *entry = s_hash[hashnum]; entry != NULL; entry = entry->m_next)
- if (entry->m_file != NULL && entry->m_id >= start)
+ for (auto entry : s_hash)
+ for (; entry != nullptr; entry = entry->m_next)
+ if (entry->m_file != nullptr && entry->m_id >= start)
{
if (total == 0)
fprintf(stderr, "--- memory leak warning ---\n");
diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp
index 797805ac768..a2242c133c6 100644
--- a/src/lib/util/corefile.cpp
+++ b/src/lib/util/corefile.cpp
@@ -104,7 +104,7 @@ static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64
works for most platforms
-------------------------------------------------*/
-INLINE int is_directory_separator(char c)
+static inline int is_directory_separator(char c)
{
return (c == '\\' || c == '/' || c == ':');
}
@@ -126,7 +126,7 @@ file_error core_fopen(const char *filename, UINT32 openflags, core_file **file)
/* allocate the file itself */
*file = (core_file *)malloc(sizeof(**file));
- if (*file == NULL)
+ if (*file == nullptr)
return FILERR_OUT_OF_MEMORY;
memset(*file, 0, sizeof(**file));
@@ -138,7 +138,7 @@ file_error core_fopen(const char *filename, UINT32 openflags, core_file **file)
if (filerr != FILERR_NONE)
{
core_fclose(*file);
- *file = NULL;
+ *file = nullptr;
}
return filerr;
}
@@ -160,7 +160,7 @@ static file_error core_fopen_ram_internal(const void *data, size_t length, int c
/* allocate the file itself */
*file = (core_file *)malloc(sizeof(**file) + (copy_buffer ? length : 0));
- if (*file == NULL)
+ if (*file == nullptr)
return FILERR_OUT_OF_MEMORY;
memset(*file, 0, sizeof(**file));
@@ -210,11 +210,11 @@ file_error core_fopen_ram_copy(const void *data, size_t length, UINT32 openflags
void core_fclose(core_file *file)
{
/* close files and free memory */
- if (file->zdata != NULL)
+ if (file->zdata != nullptr)
core_fcompress(file, FCOMPRESS_NONE);
- if (file->file != NULL)
+ if (file->file != nullptr)
osd_close(file->file);
- if (file->data != NULL && file->data_allocated)
+ if (file->data != nullptr && file->data_allocated)
free(file->data);
free(file);
}
@@ -235,7 +235,7 @@ file_error core_fcompress(core_file *file, int level)
return FILERR_INVALID_ACCESS;
/* if we have been compressing, flush and free the data */
- if (file->zdata != NULL && level == FCOMPRESS_NONE)
+ if (file->zdata != nullptr && level == FCOMPRESS_NONE)
{
int zerr = Z_OK;
@@ -273,17 +273,17 @@ file_error core_fcompress(core_file *file, int level)
/* free memory */
free(file->zdata);
- file->zdata = NULL;
+ file->zdata = nullptr;
}
/* if we are just starting to compress, allocate a new buffer */
- if (file->zdata == NULL && level > FCOMPRESS_NONE)
+ if (file->zdata == nullptr && level > FCOMPRESS_NONE)
{
int zerr;
/* allocate memory */
file->zdata = (zlib_data *)malloc(sizeof(*file->zdata));
- if (file->zdata == NULL)
+ if (file->zdata == nullptr)
return FILERR_OUT_OF_MEMORY;
memset(file->zdata, 0, sizeof(*file->zdata));
@@ -301,7 +301,7 @@ file_error core_fcompress(core_file *file, int level)
if (zerr != Z_OK)
{
free(file->zdata);
- file->zdata = NULL;
+ file->zdata = nullptr;
return FILERR_OUT_OF_MEMORY;
}
@@ -331,7 +331,7 @@ int core_fseek(core_file *file, INT64 offset, int whence)
int err = 0;
/* error if compressing */
- if (file->zdata != NULL)
+ if (file->zdata != nullptr)
return 1;
/* flush any buffered char */
@@ -412,7 +412,7 @@ UINT32 core_fread(core_file *file, void *buffer, UINT32 length)
file->back_char_tail = 0;
/* handle real files */
- if (file->file && file->data == NULL)
+ if (file->file && file->data == nullptr)
{
/* if we're within the buffer, consume that first */
if (file->offset >= file->bufferbase && file->offset < file->bufferbase + file->bufferbytes)
@@ -638,7 +638,7 @@ char *core_fgets(char *s, int n, core_file *file)
/* if we put nothing in, return NULL */
if (cur == s)
- return NULL;
+ return nullptr;
/* otherwise, terminate */
if (n > 0)
@@ -659,13 +659,13 @@ const void *core_fbuffer(core_file *file)
UINT32 read_length;
/* if we already have data, just return it */
- if (file->data != NULL || !file->length)
+ if (file->data != nullptr || !file->length)
return file->data;
/* allocate some memory */
file->data = (UINT8 *)malloc(file->length);
- if (file->data == NULL)
- return NULL;
+ if (file->data == nullptr)
+ return nullptr;
file->data_allocated = TRUE;
/* read the file */
@@ -673,13 +673,13 @@ const void *core_fbuffer(core_file *file)
if (filerr != FILERR_NONE || read_length != file->length)
{
free(file->data);
- file->data = NULL;
- return NULL;
+ file->data = nullptr;
+ return nullptr;
}
/* close the file because we don't need it anymore */
osd_close(file->file);
- file->file = NULL;
+ file->file = nullptr;
return file->data;
}
@@ -692,7 +692,7 @@ const void *core_fbuffer(core_file *file)
file_error core_fload(const char *filename, void **data, UINT32 *length)
{
- core_file *file = NULL;
+ core_file *file = nullptr;
file_error err;
UINT64 size;
@@ -711,7 +711,7 @@ file_error core_fload(const char *filename, void **data, UINT32 *length)
/* allocate memory */
*data = osd_malloc(size);
- if (length != NULL)
+ if (length != nullptr)
*length = (UINT32)size;
/* read the data */
@@ -729,7 +729,7 @@ file_error core_fload(const char *filename, void **data, UINT32 *length)
file_error core_fload(const char *filename, dynamic_buffer &data)
{
- core_file *file = NULL;
+ core_file *file = nullptr;
file_error err;
UINT64 size;
@@ -777,7 +777,7 @@ UINT32 core_fwrite(core_file *file, const void *buffer, UINT32 length)
UINT32 bytes_written = 0;
/* can't write to RAM-based stuff */
- if (file->data != NULL)
+ if (file->data != nullptr)
return 0;
/* flush any buffered char */
@@ -978,7 +978,7 @@ static UINT32 safe_buffer_copy(const void *source, UINT32 sourceoffs, UINT32 sou
static file_error osd_or_zlib_read(core_file *file, void *buffer, UINT64 offset, UINT32 length, UINT32 *actual)
{
/* if no compression, just pass through */
- if (file->zdata == NULL)
+ if (file->zdata == nullptr)
return osd_read(file->file, buffer, offset, length, actual);
/* if the offset doesn't match the next offset, fail */
@@ -1045,7 +1045,7 @@ static file_error osd_or_zlib_read(core_file *file, void *buffer, UINT64 offset,
static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64 offset, UINT32 length, UINT32 *actual)
{
/* if no compression, just pass through */
- if (file->zdata == NULL)
+ if (file->zdata == nullptr)
return osd_write(file->file, buffer, offset, length, actual);
/* if the offset doesn't match the next offset, fail */
diff --git a/src/lib/util/corestr.cpp b/src/lib/util/corestr.cpp
index b4a75a3bc48..336d788cabb 100644
--- a/src/lib/util/corestr.cpp
+++ b/src/lib/util/corestr.cpp
@@ -114,11 +114,11 @@ int core_strwildcmp(const char *sp1, const char *sp2)
char *core_strdup(const char *str)
{
- char *cpy = NULL;
- if (str != NULL)
+ char *cpy = nullptr;
+ if (str != nullptr)
{
cpy = (char *)osd_malloc_array(strlen(str) + 1);
- if (cpy != NULL)
+ if (cpy != nullptr)
strcpy(cpy, str);
}
return cpy;
@@ -261,18 +261,18 @@ void strdelchr(std::string& str, char chr)
void strreplacechr(std::string& str, char ch, char newch)
{
- for (size_t i = 0; i < str.length(); i++)
+ for (auto & elem : str)
{
- if (str[i] == ch) str[i] = newch;
+ if (elem == ch) elem = newch;
}
}
std::string strtrimspace(std::string& str)
{
int start = 0;
- for (size_t i = 0; i < str.length(); i++)
+ for (auto & elem : str)
{
- if (!isspace(UINT8(str[i]))) break;
+ if (!isspace(UINT8(elem))) break;
start++;
}
int end = str.length();
diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h
index 60c4e5f059e..afbd3dcf9a1 100644
--- a/src/lib/util/coretmpl.h
+++ b/src/lib/util/coretmpl.h
@@ -25,41 +25,6 @@
#endif
-// ======================> auto_pointer
-
-// an object that transparently wraps a pointer and auto-frees it upon destruction
-template<class _ElementType>
-class auto_pointer
-{
-private:
- // we don't support deep copying
- auto_pointer(const auto_pointer &);
- auto_pointer &operator=(const auto_pointer &);
-
-public:
- // construction/destruction
- auto_pointer(_ElementType *value = NULL)
- : m_ptr(value) { }
- virtual ~auto_pointer() { reset(); }
-
- // operators
- operator _ElementType *() const { return m_ptr; }
- _ElementType &operator*() const { assert(m_ptr != NULL); return *m_ptr; }
- _ElementType *operator->() const { return m_ptr; }
-
- // simple getters
- _ElementType *get() const { return m_ptr; }
-
- // core operations
- void reset(_ElementType *ptr = NULL) { if (m_ptr != ptr) { global_free(m_ptr); m_ptr = ptr; } }
-
-private:
- // internal state
- _ElementType * m_ptr; // pointer we are tracking
-};
-
-
-
typedef std::vector<UINT8> dynamic_buffer;
@@ -77,8 +42,8 @@ class simple_list
public:
// construction/destruction
simple_list()
- : m_head(NULL),
- m_tail(NULL),
+ : m_head(nullptr),
+ m_tail(nullptr),
m_count(0) { }
virtual ~simple_list() { reset(); }
@@ -91,7 +56,7 @@ public:
// remove (free) all objects in the list, leaving an empty list
void reset()
{
- while (m_head != NULL)
+ while (m_head != nullptr)
remove(*m_head);
}
@@ -100,7 +65,7 @@ public:
{
object.m_next = m_head;
m_head = &object;
- if (m_tail == NULL)
+ if (m_tail == nullptr)
m_tail = m_head;
m_count++;
return object;
@@ -116,7 +81,7 @@ public:
_ElementType *head = list.detach_all();
tail->m_next = m_head;
m_head = head;
- if (m_tail == NULL)
+ if (m_tail == nullptr)
m_tail = tail;
m_count += count;
}
@@ -124,8 +89,8 @@ public:
// add the given object to the tail of the list
_ElementType &append(_ElementType &object)
{
- object.m_next = NULL;
- if (m_tail != NULL)
+ object.m_next = nullptr;
+ if (m_tail != nullptr)
m_tail = m_tail->m_next = &object;
else
m_tail = m_head = &object;
@@ -141,7 +106,7 @@ public:
return;
_ElementType *tail = list.last();
_ElementType *head = list.detach_all();
- if (m_tail != NULL)
+ if (m_tail != nullptr)
m_tail->m_next = head;
else
m_head = head;
@@ -152,7 +117,7 @@ public:
// insert the given object after a particular object (NULL means prepend)
_ElementType &insert_after(_ElementType &object, _ElementType *insert_after)
{
- if (insert_after == NULL)
+ if (insert_after == nullptr)
return prepend(object);
object.m_next = insert_after->m_next;
insert_after->m_next = &object;
@@ -165,9 +130,9 @@ public:
// insert the given object before a particular object (NULL means append)
_ElementType &insert_before(_ElementType &object, _ElementType *insert_before)
{
- if (insert_before == NULL)
+ if (insert_before == nullptr)
return append(object);
- for (_ElementType **curptr = &m_head; *curptr != NULL; curptr = &(*curptr)->m_next)
+ for (_ElementType **curptr = &m_head; *curptr != nullptr; curptr = &(*curptr)->m_next)
if (*curptr == insert_before)
{
object.m_next = insert_before;
@@ -183,11 +148,11 @@ public:
// replace an item in the list at the same location, and remove it
_ElementType &replace_and_remove(_ElementType &object, _ElementType &toreplace)
{
- _ElementType *prev = NULL;
- for (_ElementType *cur = m_head; cur != NULL; prev = cur, cur = cur->m_next)
+ _ElementType *prev = nullptr;
+ for (_ElementType *cur = m_head; cur != nullptr; prev = cur, cur = cur->m_next)
if (cur == &toreplace)
{
- if (prev != NULL)
+ if (prev != nullptr)
prev->m_next = &object;
else
m_head = &object;
@@ -204,12 +169,12 @@ public:
_ElementType *detach_head()
{
_ElementType *result = m_head;
- if (result != NULL)
+ if (result != nullptr)
{
m_head = result->m_next;
m_count--;
- if (m_head == NULL)
- m_tail = NULL;
+ if (m_head == nullptr)
+ m_tail = nullptr;
}
return result;
}
@@ -217,11 +182,11 @@ public:
// detach the given item from the list, but don't free its memory
_ElementType &detach(_ElementType &object)
{
- _ElementType *prev = NULL;
- for (_ElementType *cur = m_head; cur != NULL; prev = cur, cur = cur->m_next)
+ _ElementType *prev = nullptr;
+ for (_ElementType *cur = m_head; cur != nullptr; prev = cur, cur = cur->m_next)
if (cur == &object)
{
- if (prev != NULL)
+ if (prev != nullptr)
prev->m_next = object.m_next;
else
m_head = object.m_next;
@@ -237,7 +202,7 @@ public:
_ElementType *detach_all()
{
_ElementType *result = m_head;
- m_head = m_tail = NULL;
+ m_head = m_tail = nullptr;
m_count = 0;
return result;
}
@@ -251,17 +216,17 @@ public:
// find an object by index in the list
_ElementType *find(int index) const
{
- for (_ElementType *cur = m_head; cur != NULL; cur = cur->m_next)
+ for (_ElementType *cur = m_head; cur != nullptr; cur = cur->m_next)
if (index-- == 0)
return cur;
- return NULL;
+ return nullptr;
}
// return the index of the given object in the list
int indexof(const _ElementType &object) const
{
int index = 0;
- for (_ElementType *cur = m_head; cur != NULL; cur = cur->m_next)
+ for (_ElementType *cur = m_head; cur != nullptr; cur = cur->m_next)
{
if (cur == &object)
return index;
@@ -291,7 +256,7 @@ public:
// construction/destruction
simple_list_wrapper(_ObjectType *object)
- : m_next(NULL),
+ : m_next(nullptr),
m_object(object) { }
// operators
@@ -329,13 +294,13 @@ public:
_ItemType *alloc()
{
_ItemType *result = m_freelist.detach_head();
- if (result == NULL)
+ if (result == nullptr)
result = global_alloc(_ItemType);
return result;
}
// reclaim an item by adding it to the free list
- void reclaim(_ItemType *item) { if (item != NULL) m_freelist.append(*item); }
+ void reclaim(_ItemType *item) { if (item != nullptr) m_freelist.append(*item); }
void reclaim(_ItemType &item) { m_freelist.append(item); }
// reclaim all items from a list
diff --git a/src/lib/util/cstrpool.cpp b/src/lib/util/cstrpool.cpp
index dfb41e25232..242c33380de 100644
--- a/src/lib/util/cstrpool.cpp
+++ b/src/lib/util/cstrpool.cpp
@@ -37,16 +37,16 @@ const char *const_string_pool::add(const char *string)
return string;
// scan to find space
- for (pool_chunk *chunk = m_chunklist.first(); chunk != NULL; chunk = chunk->next())
+ for (pool_chunk *chunk = m_chunklist.first(); chunk != nullptr; chunk = chunk->next())
{
const char *result = chunk->add(string);
- if (result != NULL)
+ if (result != nullptr)
return result;
}
// no space anywhere, create a new pool and prepend it (so it gets used first)
const char *result = m_chunklist.prepend(*global_alloc(pool_chunk)).add(string);
- assert(result != NULL);
+ assert(result != nullptr);
return result;
}
@@ -63,7 +63,7 @@ bool const_string_pool::contains(const char *string)
return true;
// scan to find it
- for (pool_chunk *chunk = m_chunklist.first(); chunk != NULL; chunk = chunk->next())
+ for (pool_chunk *chunk = m_chunklist.first(); chunk != nullptr; chunk = chunk->next())
if (chunk->contains(string))
return true;
@@ -79,7 +79,7 @@ bool const_string_pool::contains(const char *string)
*/
const_string_pool::pool_chunk::pool_chunk()
- : m_next(NULL),
+ : m_next(nullptr),
m_used(0)
{
}
@@ -104,7 +104,7 @@ const char *const_string_pool::pool_chunk::add(const char *string)
// if too big, return NULL
if (m_used + bytes > POOL_SIZE)
- return NULL;
+ return nullptr;
// allocate, copy, and return the memory
char *dest = &m_buffer[m_used];
diff --git a/src/lib/util/delegate.h b/src/lib/util/delegate.h
index 1c57fd25d28..b576d2f063d 100644
--- a/src/lib/util/delegate.h
+++ b/src/lib/util/delegate.h
@@ -90,12 +90,12 @@
// types of delegates supported
#define DELEGATE_TYPE_COMPATIBLE 0
#define DELEGATE_TYPE_INTERNAL 1
+#define DELEGATE_TYPE_MSVC 2
// select which one we will be using
#if defined(__GNUC__)
- /* does not work in versions over 4.7.x of 32bit MINGW */
- #if defined(__MINGW32__) && !defined(__x86_64) && defined(__i386__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
- //#define USE_DELEGATE_TYPE DELEGATE_TYPE_COMPATIBLE
+ /* 32bit MINGW asks for different convention */
+ #if defined(__MINGW32__) && !defined(__x86_64) && defined(__i386__)
#define USE_DELEGATE_TYPE DELEGATE_TYPE_INTERNAL
#define MEMBER_ABI __thiscall
#define HAS_DIFFERENT_ABI 1
@@ -110,6 +110,10 @@
#define MEMBER_ABI
#define HAS_DIFFERENT_ABI 0
#endif
+#elif defined(_MSC_VER) && defined (PTR64)
+#define MEMBER_ABI
+#define HAS_DIFFERENT_ABI 0
+#define USE_DELEGATE_TYPE DELEGATE_TYPE_MSVC
#else
#define USE_DELEGATE_TYPE DELEGATE_TYPE_COMPATIBLE
#endif
@@ -541,6 +545,64 @@ private:
int m_this_delta; // delta to apply to the 'this' pointer
};
+#elif (USE_DELEGATE_TYPE == DELEGATE_TYPE_MSVC)
+
+// ======================> delegate_mfp
+const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (delegate_generic_class::*)());
+
+// struct describing the contents of a member function pointer
+class delegate_mfp
+{
+public:
+ // default constructor
+ delegate_mfp()
+ : m_function(0) { }
+
+ // copy constructor
+ delegate_mfp(const delegate_mfp &src)
+ : m_function(src.m_function) { }
+
+ // construct from any member function pointer
+ template<typename _MemberFunctionType, class _MemberFunctionClass, typename _ReturnType, typename _StaticFunctionType>
+ delegate_mfp(_MemberFunctionType mfp, _MemberFunctionClass *, _ReturnType *, _StaticFunctionType)
+ {
+ //assert(sizeof(mfp) == 12 || sizeof(mfp) == 16);
+ m_size = sizeof(mfp);
+ *reinterpret_cast<_MemberFunctionType *>(this) = mfp;
+ }
+
+ // comparison helpers
+ bool operator==(const delegate_mfp &rhs) const { return (m_function == rhs.m_function); }
+ bool isnull() const { return (m_function == 0); }
+
+ // getters
+ delegate_generic_class *real_object(delegate_generic_class *original) const { return original; }
+
+ // binding helper
+ template<typename _FunctionType>
+ void update_after_bind(_FunctionType &funcptr, delegate_generic_class *&object)
+ {
+ funcptr = reinterpret_cast<_FunctionType>(m_function);
+ if (m_size == SINGLE_MEMFUNCPTR_SIZE + sizeof(int))
+ object = reinterpret_cast<delegate_generic_class *>(reinterpret_cast<UINT8 *>(object) + m_this_delta);
+ }
+
+private:
+ // extract the generic function and adjust the object pointer
+ delegate_generic_function convert_to_generic(delegate_generic_class *&object) const;
+
+ // actual state
+ FPTR m_function; // first item can be one of two things:
+ // if even, it's a pointer to the function
+ // if odd, it's the byte offset into the vtable
+ int m_this_delta; // delta to apply to the 'this' pointer
+
+ int m_dummy1;
+ int m_dummy2;
+
+ int m_size;
+};
+
#endif
@@ -568,16 +630,16 @@ public:
typedef MEMBER_ABI generic_static_func generic_member_func;
// generic constructor
delegate_base()
- : m_function(NULL),
- m_object(NULL),
- m_name(NULL),
- m_latebinder(NULL),
- m_raw_function(NULL) { }
+ : m_function(nullptr),
+ m_object(nullptr),
+ m_name(nullptr),
+ m_latebinder(nullptr),
+ m_raw_function(nullptr) { }
// copy constructor
delegate_base(const delegate_base &src)
: m_function(src.m_function),
- m_object(NULL),
+ m_object(nullptr),
m_name(src.m_name),
m_latebinder(src.m_latebinder),
m_raw_function(src.m_raw_function),
@@ -589,7 +651,7 @@ public:
// copy constructor with late bind
delegate_base(const delegate_base &src, delegate_late_bind &object)
: m_function(src.m_function),
- m_object(NULL),
+ m_object(nullptr),
m_name(src.m_name),
m_latebinder(src.m_latebinder),
m_raw_function(src.m_raw_function),
@@ -601,12 +663,12 @@ public:
// construct from member function with object pointer
template<class _FunctionClass>
delegate_base(typename traits<_FunctionClass>::member_func_type funcptr, const char *name, _FunctionClass *object)
- : m_function(NULL),
- m_object(NULL),
+ : m_function(nullptr),
+ m_object(nullptr),
m_name(name),
m_latebinder(&late_bind_helper<_FunctionClass>),
- m_raw_function(NULL),
- m_raw_mfp(funcptr, object, (_ReturnType *)0, (generic_static_func)0)
+ m_raw_function(nullptr),
+ m_raw_mfp(funcptr, object, (_ReturnType *)nullptr, (generic_static_func)nullptr)
{
bind(reinterpret_cast<delegate_generic_class *>(object));
}
@@ -615,7 +677,7 @@ public:
template<class _FunctionClass>
delegate_base(typename traits<_FunctionClass>::static_func_type funcptr, const char *name, _FunctionClass *object)
: m_function(reinterpret_cast<generic_static_func>(funcptr)),
- m_object(NULL),
+ m_object(nullptr),
m_name(name),
m_latebinder(&late_bind_helper<_FunctionClass>),
m_raw_function(reinterpret_cast<generic_static_func>(funcptr))
@@ -627,7 +689,7 @@ public:
template<class _FunctionClass>
delegate_base(typename traits<_FunctionClass>::static_ref_func_type funcptr, const char *name, _FunctionClass *object)
: m_function(reinterpret_cast<generic_static_func>(funcptr)),
- m_object(NULL),
+ m_object(nullptr),
m_name(name),
m_latebinder(&late_bind_helper<_FunctionClass>),
m_raw_function(reinterpret_cast<generic_static_func>(funcptr))
@@ -641,7 +703,7 @@ public:
if (this != &src)
{
m_function = src.m_function;
- m_object = NULL;
+ m_object = nullptr;
m_name = src.m_name;
m_latebinder = src.m_latebinder;
m_raw_function = src.m_raw_function;
@@ -681,11 +743,11 @@ public:
_ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4, _P5Type p5, _P6Type p6, _P7Type p7, _P8Type p8, _P9Type p9, _P10Type p10, _P11Type p11, _P12Type p12) const { DELEGATE_CALL((m_object, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12)); }
// getters
- bool has_object() const { return (object() != NULL); }
+ bool has_object() const { return (object() != nullptr); }
const char *name() const { return m_name; }
// helpers
- bool isnull() const { return (m_raw_function == NULL && m_raw_mfp.isnull()); }
+ bool isnull() const { return (m_raw_function == nullptr && m_raw_mfp.isnull()); }
bool is_mfp() const { return !m_raw_mfp.isnull(); }
// late binding
@@ -703,7 +765,7 @@ protected:
static delegate_generic_class *late_bind_helper(delegate_late_bind &object)
{
_FunctionClass *result = dynamic_cast<_FunctionClass *>(&object);
- if (result == NULL) {
+ if (result == nullptr) {
throw binding_type_exception(typeid(_FunctionClass), typeid(object));
}
return reinterpret_cast<delegate_generic_class *>(result);
@@ -715,7 +777,7 @@ protected:
m_object = object;
// if we're wrapping a member function pointer, handle special stuff
- if (m_object != NULL && is_mfp())
+ if (m_object != nullptr && is_mfp())
m_raw_mfp.update_after_bind(m_function, m_object);
}
diff --git a/src/lib/util/flac.cpp b/src/lib/util/flac.cpp
index 49fc667a184..f70ae709978 100644
--- a/src/lib/util/flac.cpp
+++ b/src/lib/util/flac.cpp
@@ -78,7 +78,7 @@ bool flac_encoder::reset()
FLAC__stream_encoder_set_blocksize(m_encoder, m_block_size);
// re-start processing
- return (FLAC__stream_encoder_init_stream(m_encoder, write_callback_static, NULL, NULL, NULL, this) == FLAC__STREAM_ENCODER_INIT_STATUS_OK);
+ return (FLAC__stream_encoder_init_stream(m_encoder, write_callback_static, nullptr, nullptr, nullptr, this) == FLAC__STREAM_ENCODER_INIT_STATUS_OK);
}
@@ -91,7 +91,7 @@ bool flac_encoder::reset(void *buffer, UINT32 buflength)
// configure the output
m_compressed_start = reinterpret_cast<FLAC__byte *>(buffer);
m_compressed_length = buflength;
- m_file = NULL;
+ m_file = nullptr;
return reset();
}
@@ -103,7 +103,7 @@ bool flac_encoder::reset(void *buffer, UINT32 buflength)
bool flac_encoder::reset(core_file &file)
{
// configure the output
- m_compressed_start = NULL;
+ m_compressed_start = nullptr;
m_compressed_length = 0;
m_file = &file;
return reset();
@@ -185,7 +185,7 @@ UINT32 flac_encoder::finish()
{
// process the data and return the amount written
FLAC__stream_encoder_finish(m_encoder);
- return (m_file != NULL) ? core_ftell(m_file) : m_compressed_offset;
+ return (m_file != nullptr) ? core_ftell(m_file) : m_compressed_offset;
}
@@ -197,13 +197,13 @@ void flac_encoder::init_common()
{
// allocate the encoder
m_encoder = FLAC__stream_encoder_new();
- if (m_encoder == NULL)
+ if (m_encoder == nullptr)
throw std::bad_alloc();
// initialize default state
- m_file = NULL;
+ m_file = nullptr;
m_compressed_offset = 0;
- m_compressed_start = NULL;
+ m_compressed_start = nullptr;
m_compressed_length = 0;
m_sample_rate = 44100;
m_channels = 2;
@@ -251,7 +251,7 @@ FLAC__StreamEncoderWriteStatus flac_encoder::write_callback(const FLAC__byte buf
else
{
int count = bytes - offset;
- if (m_file != NULL)
+ if (m_file != nullptr)
core_fwrite(m_file, buffer, count);
else
{
@@ -277,11 +277,11 @@ FLAC__StreamEncoderWriteStatus flac_encoder::write_callback(const FLAC__byte buf
flac_decoder::flac_decoder()
: m_decoder(FLAC__stream_decoder_new()),
- m_file(NULL),
+ m_file(nullptr),
m_compressed_offset(0),
- m_compressed_start(NULL),
+ m_compressed_start(nullptr),
m_compressed_length(0),
- m_compressed2_start(NULL),
+ m_compressed2_start(nullptr),
m_compressed2_length(0)
{
}
@@ -293,7 +293,7 @@ flac_decoder::flac_decoder()
flac_decoder::flac_decoder(const void *buffer, UINT32 length, const void *buffer2, UINT32 length2)
: m_decoder(FLAC__stream_decoder_new()),
- m_file(NULL),
+ m_file(nullptr),
m_compressed_offset(0),
m_compressed_start(reinterpret_cast<const FLAC__byte *>(buffer)),
m_compressed_length(length),
@@ -312,9 +312,9 @@ flac_decoder::flac_decoder(core_file &file)
: m_decoder(FLAC__stream_decoder_new()),
m_file(&file),
m_compressed_offset(0),
- m_compressed_start(NULL),
+ m_compressed_start(nullptr),
m_compressed_length(0),
- m_compressed2_start(NULL),
+ m_compressed2_start(nullptr),
m_compressed2_length(0)
{
reset();
@@ -341,10 +341,10 @@ bool flac_decoder::reset()
m_compressed_offset = 0;
if (FLAC__stream_decoder_init_stream(m_decoder,
&flac_decoder::read_callback_static,
- NULL,
+ nullptr,
&flac_decoder::tell_callback_static,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&flac_decoder::write_callback_static,
&flac_decoder::metadata_callback_static,
&flac_decoder::error_callback_static, this) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
@@ -359,7 +359,7 @@ bool flac_decoder::reset()
bool flac_decoder::reset(const void *buffer, UINT32 length, const void *buffer2, UINT32 length2)
{
- m_file = NULL;
+ m_file = nullptr;
m_compressed_start = reinterpret_cast<const FLAC__byte *>(buffer);
m_compressed_length = length;
m_compressed2_start = reinterpret_cast<const FLAC__byte *>(buffer2);
@@ -401,7 +401,7 @@ bool flac_decoder::reset(UINT32 sample_rate, UINT8 num_channels, UINT32 block_si
m_custom_header[0x14] = (sample_rate << 4) | ((num_channels - 1) << 1);
// configure the header ahead of the provided buffer
- m_file = NULL;
+ m_file = nullptr;
m_compressed_start = reinterpret_cast<const FLAC__byte *>(m_custom_header);
m_compressed_length = sizeof(m_custom_header);
m_compressed2_start = reinterpret_cast<const FLAC__byte *>(buffer);
@@ -417,9 +417,9 @@ bool flac_decoder::reset(UINT32 sample_rate, UINT8 num_channels, UINT32 block_si
bool flac_decoder::reset(core_file &file)
{
m_file = &file;
- m_compressed_start = NULL;
+ m_compressed_start = nullptr;
m_compressed_length = 0;
- m_compressed2_start = NULL;
+ m_compressed2_start = nullptr;
m_compressed2_length = 0;
return reset();
}
@@ -510,7 +510,7 @@ FLAC__StreamDecoderReadStatus flac_decoder::read_callback(FLAC__byte buffer[], s
UINT32 expected = *bytes;
// if a file, just read
- if (m_file != NULL)
+ if (m_file != nullptr)
*bytes = core_fread(m_file, buffer, expected);
// otherwise, copy from memory
@@ -589,7 +589,7 @@ FLAC__StreamDecoderWriteStatus flac_decoder::write_callback(const ::FLAC__Frame
// interleaved case
int shift = m_uncompressed_swap ? 8 : 0;
int blocksize = frame->header.blocksize;
- if (m_uncompressed_start[1] == NULL)
+ if (m_uncompressed_start[1] == nullptr)
{
INT16 *dest = m_uncompressed_start[0] + m_uncompressed_offset * frame->header.channels;
for (int sampnum = 0; sampnum < blocksize && m_uncompressed_offset < m_uncompressed_length; sampnum++, m_uncompressed_offset++)
@@ -602,7 +602,7 @@ FLAC__StreamDecoderWriteStatus flac_decoder::write_callback(const ::FLAC__Frame
{
for (int sampnum = 0; sampnum < blocksize && m_uncompressed_offset < m_uncompressed_length; sampnum++, m_uncompressed_offset++)
for (int chan = 0; chan < frame->header.channels; chan++)
- if (m_uncompressed_start[chan] != NULL)
+ if (m_uncompressed_start[chan] != nullptr)
m_uncompressed_start[chan][m_uncompressed_offset] = INT16((UINT16(buffer[chan][sampnum]) << shift) | (UINT16(buffer[chan][sampnum]) >> shift));
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
diff --git a/src/lib/util/flac.h b/src/lib/util/flac.h
index 24290b7649e..563c40974e0 100644
--- a/src/lib/util/flac.h
+++ b/src/lib/util/flac.h
@@ -92,7 +92,7 @@ class flac_decoder
public:
// construction/destruction
flac_decoder();
- flac_decoder(const void *buffer, UINT32 length, const void *buffer2 = NULL, UINT32 length2 = 0);
+ flac_decoder(const void *buffer, UINT32 length, const void *buffer2 = nullptr, UINT32 length2 = 0);
flac_decoder(core_file &file);
~flac_decoder();
@@ -106,7 +106,7 @@ public:
// reset
bool reset();
- bool reset(const void *buffer, UINT32 length, const void *buffer2 = NULL, UINT32 length2 = 0);
+ bool reset(const void *buffer, UINT32 length, const void *buffer2 = nullptr, UINT32 length2 = 0);
bool reset(UINT32 sample_rate, UINT8 num_channels, UINT32 block_size, const void *buffer, UINT32 length);
bool reset(core_file &file);
diff --git a/src/lib/util/harddisk.cpp b/src/lib/util/harddisk.cpp
index b1082f3234f..6bb121f36b2 100644
--- a/src/lib/util/harddisk.cpp
+++ b/src/lib/util/harddisk.cpp
@@ -44,22 +44,22 @@ hard_disk_file *hard_disk_open(chd_file *chd)
chd_error err;
/* punt if no CHD */
- if (chd == NULL)
- return NULL;
+ if (chd == nullptr)
+ return nullptr;
/* read the hard disk metadata */
err = chd->read_metadata(HARD_DISK_METADATA_TAG, 0, metadata);
if (err != CHDERR_NONE)
- return NULL;
+ return nullptr;
/* parse the metadata */
if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &cylinders, &heads, &sectors, &sectorbytes) != 4)
- return NULL;
+ return nullptr;
/* allocate memory for the hard disk file */
file = (hard_disk_file *)malloc(sizeof(hard_disk_file));
- if (file == NULL)
- return NULL;
+ if (file == nullptr)
+ return nullptr;
/* fill in the data */
file->chd = chd;
diff --git a/src/lib/util/hashing.cpp b/src/lib/util/hashing.cpp
index e7f315ecc53..785127e01e8 100644
--- a/src/lib/util/hashing.cpp
+++ b/src/lib/util/hashing.cpp
@@ -63,13 +63,13 @@ bool sha1_t::from_string(const char *string, int length)
return false;
// iterate through our raw buffer
- for (int bytenum = 0; bytenum < sizeof(m_raw); bytenum++)
+ for (auto & elem : m_raw)
{
int upper = char_to_hex(*string++);
int lower = char_to_hex(*string++);
if (upper == -1 || lower == -1)
return false;
- m_raw[bytenum] = (upper << 4) | lower;
+ elem = (upper << 4) | lower;
}
return true;
}
@@ -82,8 +82,8 @@ bool sha1_t::from_string(const char *string, int length)
const char *sha1_t::as_string(std::string &buffer) const
{
buffer.clear();
- for (int i = 0; i < ARRAY_LENGTH(m_raw); i++)
- strcatprintf(buffer, "%02x", m_raw[i]);
+ for (auto & elem : m_raw)
+ strcatprintf(buffer, "%02x", elem);
return buffer.c_str();
}
@@ -106,13 +106,13 @@ bool md5_t::from_string(const char *string, int length)
return false;
// iterate through our raw buffer
- for (int bytenum = 0; bytenum < sizeof(m_raw); bytenum++)
+ for (auto & elem : m_raw)
{
int upper = char_to_hex(*string++);
int lower = char_to_hex(*string++);
if (upper == -1 || lower == -1)
return false;
- m_raw[bytenum] = (upper << 4) | lower;
+ elem = (upper << 4) | lower;
}
return true;
}
@@ -125,8 +125,8 @@ bool md5_t::from_string(const char *string, int length)
const char *md5_t::as_string(std::string &buffer) const
{
buffer.clear();
- for (int i = 0; i < ARRAY_LENGTH(m_raw); i++)
- strcatprintf(buffer, "%02x", m_raw[i]);
+ for (auto & elem : m_raw)
+ strcatprintf(buffer, "%02x", elem);
return buffer.c_str();
}
diff --git a/src/lib/util/huffman.cpp b/src/lib/util/huffman.cpp
index 9205264f9eb..8aa32bd3b4d 100644
--- a/src/lib/util/huffman.cpp
+++ b/src/lib/util/huffman.cpp
@@ -563,7 +563,7 @@ int huffman_context_base::build_tree(UINT32 totaldata, UINT32 totalweight)
// create new node
node_t &newnode = m_huffnode[nextalloc++];
- newnode.m_parent = NULL;
+ newnode.m_parent = nullptr;
node0.m_parent = node1.m_parent = &newnode;
newnode.m_weight = node0.m_weight + node1.m_weight;
@@ -591,7 +591,7 @@ int huffman_context_base::build_tree(UINT32 totaldata, UINT32 totalweight)
if (node.m_weight > 0)
{
// determine the number of bits for this node
- for (node_t *curnode = &node; curnode->m_parent != NULL; curnode = curnode->m_parent)
+ for (node_t *curnode = &node; curnode->m_parent != nullptr; curnode = curnode->m_parent)
node.m_numbits++;
if (node.m_numbits == 0)
node.m_numbits = 1;
diff --git a/src/lib/util/huffman.h b/src/lib/util/huffman.h
index 76ee1b9c23b..a2bed42bbf9 100644
--- a/src/lib/util/huffman.h
+++ b/src/lib/util/huffman.h
@@ -98,7 +98,7 @@ class huffman_encoder : public huffman_context_base
public:
// pass through to the underlying constructor
huffman_encoder()
- : huffman_context_base(_NumCodes, _MaxBits, NULL, m_datahisto_array, m_huffnode_array) { histo_reset(); }
+ : huffman_context_base(_NumCodes, _MaxBits, nullptr, m_datahisto_array, m_huffnode_array) { histo_reset(); }
// single item operations
void histo_reset() { memset(m_datahisto_array, 0, sizeof(m_datahisto_array)); }
@@ -126,7 +126,7 @@ class huffman_decoder : public huffman_context_base
public:
// pass through to the underlying constructor
huffman_decoder()
- : huffman_context_base(_NumCodes, _MaxBits, m_lookup_array, NULL, m_huffnode_array) { }
+ : huffman_context_base(_NumCodes, _MaxBits, m_lookup_array, nullptr, m_huffnode_array) { }
// single item operations
UINT32 decode_one(bitstream_in &bitbuf);
diff --git a/src/lib/util/jedparse.h b/src/lib/util/jedparse.h
index 1615f25af34..0f23462b995 100644
--- a/src/lib/util/jedparse.h
+++ b/src/lib/util/jedparse.h
@@ -63,7 +63,7 @@ size_t jedbin_output(const jed_data *data, void *result, size_t length);
INLINE FUNCTIONS
***************************************************************************/
-INLINE int jed_get_fuse(const jed_data *data, UINT32 fusenum)
+static inline int jed_get_fuse(const jed_data *data, UINT32 fusenum)
{
if (fusenum < JED_MAX_FUSES)
return (data->fusemap[fusenum / 8] >> (fusenum % 8)) & 1;
@@ -72,7 +72,7 @@ INLINE int jed_get_fuse(const jed_data *data, UINT32 fusenum)
}
-INLINE void jed_set_fuse(jed_data *data, UINT32 fusenum, UINT8 value)
+static inline void jed_set_fuse(jed_data *data, UINT32 fusenum, UINT8 value)
{
if (fusenum < JED_MAX_FUSES)
{
diff --git a/src/lib/util/md5.cpp b/src/lib/util/md5.cpp
index 3c0abb33b30..712bd4a23f3 100644
--- a/src/lib/util/md5.cpp
+++ b/src/lib/util/md5.cpp
@@ -166,7 +166,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
void
MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
{
- register UWORD32 a, b, c, d;
+ UWORD32 a, b, c, d;
a = buf[0];
b = buf[1];
diff --git a/src/lib/util/opresolv.cpp b/src/lib/util/opresolv.cpp
index 91c6f1a9cbd..4764d6955e3 100644
--- a/src/lib/util/opresolv.cpp
+++ b/src/lib/util/opresolv.cpp
@@ -116,7 +116,7 @@ static optreserr_t resolve_single_param(const char *specification, int *param_va
range++;
flags &= ~FLAG_HALF_RANGE;
if (--range_count == 0)
- range = NULL;
+ range = nullptr;
}
}
else if (*s == ';')
@@ -179,14 +179,14 @@ static const char *lookup_in_specification(const char *specification, const opti
{
const char *s;
s = strchr(specification, option->parameter);
- return s ? s + 1 : NULL;
+ return s ? s + 1 : nullptr;
}
option_resolution *option_resolution_create(const option_guide *guide, const char *specification)
{
- option_resolution *resolution = NULL;
+ option_resolution *resolution = nullptr;
const option_guide *guide_entry;
int option_count;
int opt = -1;
@@ -198,7 +198,7 @@ option_resolution *option_resolution_create(const option_guide *guide, const cha
option_count = option_resolution_countoptions(guide, specification);
/* create a memory pool for this structure */
- pool = pool_alloc_lib(NULL);
+ pool = pool_alloc_lib(nullptr);
if (!pool)
goto outofmemory;
@@ -244,7 +244,7 @@ unexpected:
outofmemory:
if (resolution)
option_resolution_close(resolution);
- return NULL;
+ return nullptr;
}
@@ -255,7 +255,7 @@ optreserr_t option_resolution_add_param(option_resolution *resolution, const cha
int must_resolve;
optreserr_t err;
const char *option_specification;
- struct option_resolution_entry *entry = NULL;
+ struct option_resolution_entry *entry = nullptr;
for (i = 0; i < resolution->option_count; i++)
{
@@ -317,7 +317,7 @@ optreserr_t option_resolution_add_param(option_resolution *resolution, const cha
if (must_resolve)
{
option_specification = lookup_in_specification(resolution->specification, entry->guide_entry);
- err = resolve_single_param(option_specification, &entry->u.int_value, NULL, 0);
+ err = resolve_single_param(option_specification, &entry->u.int_value, nullptr, 0);
if (err)
goto done;
@@ -363,7 +363,7 @@ optreserr_t option_resolution_finish(option_resolution *resolution)
option_specification = lookup_in_specification(resolution->specification, entry->guide_entry);
assert(option_specification);
entry->u.int_value = -1;
- err = resolve_single_param(option_specification, &entry->u.int_value, NULL, 0);
+ err = resolve_single_param(option_specification, &entry->u.int_value, nullptr, 0);
if (err)
return err;
break;
@@ -403,10 +403,10 @@ static const struct option_resolution_entry *option_resolution_lookup_entry(opti
default:
assert(FALSE);
- return NULL;
+ return nullptr;
}
}
- return NULL;
+ return nullptr;
}
@@ -424,7 +424,7 @@ const char *option_resolution_lookup_string(option_resolution *resolution, int o
{
const struct option_resolution_entry *entry;
entry = option_resolution_lookup_entry(resolution, option_char);
- return entry ? entry->u.str_value : NULL;
+ return entry ? entry->u.str_value : nullptr;
}
@@ -440,7 +440,7 @@ const option_guide *option_resolution_find_option(option_resolution *resolution,
{
const struct option_resolution_entry *entry;
entry = option_resolution_lookup_entry(resolution, option_char);
- return entry ? entry->guide_entry : NULL;
+ return entry ? entry->guide_entry : nullptr;
}
@@ -448,7 +448,7 @@ const option_guide *option_resolution_find_option(option_resolution *resolution,
const option_guide *option_resolution_index_option(option_resolution *resolution, int indx)
{
if ((indx < 0) || (indx >= resolution->option_count))
- return NULL;
+ return nullptr;
return resolution->entries[indx].guide_entry;
}
@@ -495,7 +495,7 @@ optreserr_t option_resolution_listranges(const char *specification, int option_c
return OPTIONRESOLUTION_ERROR_SYNTAX;
}
- return resolve_single_param(specification + 1, NULL, range, range_count);
+ return resolve_single_param(specification + 1, nullptr, range, range_count);
}
@@ -513,7 +513,7 @@ optreserr_t option_resolution_getdefault(const char *specification, int option_c
return OPTIONRESOLUTION_ERROR_SYNTAX;
}
- return resolve_single_param(specification + 1, val, NULL, 0);
+ return resolve_single_param(specification + 1, val, nullptr, 0);
}
@@ -549,7 +549,7 @@ optreserr_t option_resolution_isvalidvalue(const char *specification, int option
int option_resolution_contains(const char *specification, int option_char)
{
- return strchr(specification, option_char) != NULL;
+ return strchr(specification, option_char) != nullptr;
}
/**
@@ -578,6 +578,6 @@ const char *option_resolution_error_string(optreserr_t err)
};
if ((err < 0) || (err >= ARRAY_LENGTH(errors)))
- return NULL;
+ return nullptr;
return errors[err];
}
diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp
index 69e7189f50b..0e02b7dc735 100644
--- a/src/lib/util/options.cpp
+++ b/src/lib/util/options.cpp
@@ -53,7 +53,7 @@ const char *const core_options::s_option_unadorned[MAX_UNADORNED_OPTIONS] =
//-------------------------------------------------
core_options::entry::entry(const char *name, const char *description, UINT32 flags, const char *defvalue)
- : m_next(NULL),
+ : m_next(nullptr),
m_flags(flags),
m_seqid(0),
m_error_reported(false),
@@ -61,7 +61,7 @@ core_options::entry::entry(const char *name, const char *description, UINT32 fla
m_description(description)
{
// copy in the name(s) as appropriate
- if (name != NULL)
+ if (name != nullptr)
{
// first extract any range
std::string namestr(name);
@@ -90,7 +90,7 @@ core_options::entry::entry(const char *name, const char *description, UINT32 fla
}
// set the default value
- if (defvalue != NULL)
+ if (defvalue != nullptr)
m_defdata = defvalue;
m_data = m_defdata;
}
@@ -225,7 +225,7 @@ core_options &core_options::operator=(const core_options &rhs)
bool core_options::operator==(const core_options &rhs)
{
// iterate over options in the first list
- for (entry *curentry = m_entrylist.first(); curentry != NULL; curentry = curentry->next())
+ for (entry *curentry = m_entrylist.first(); curentry != nullptr; curentry = curentry->next())
if (!curentry->is_header())
{
// if the values differ, return false
@@ -255,13 +255,14 @@ bool core_options::operator!=(const core_options &rhs)
void core_options::add_entry(const char *name, const char *description, UINT32 flags, const char *defvalue, bool override_existing)
{
// allocate a new entry
- entry *newentry = global_alloc(entry(name, description, flags, defvalue));
- if (newentry->name() != NULL)
+ auto newentry = global_alloc(entry(name, description, flags, defvalue));
+ if (newentry->name() != nullptr)
{
// see if we match an existing entry
- entry *existing = m_entrymap.find(newentry->name());
- if (existing != NULL)
+ auto checkentry = m_entrymap.find(newentry->name());
+ if (checkentry != m_entrymap.end())
{
+ entry *existing = checkentry->second;
// if we're overriding existing entries, then remove the old one
if (override_existing)
m_entrylist.remove(*existing);
@@ -289,7 +290,7 @@ void core_options::add_entry(const char *name, const char *description, UINT32 f
void core_options::add_entries(const options_entry *entrylist, bool override_existing)
{
// loop over entries until we hit a NULL name
- for ( ; entrylist->name != NULL || (entrylist->flags & OPTION_HEADER) != 0; entrylist++)
+ for ( ; entrylist->name != nullptr || (entrylist->flags & OPTION_HEADER) != 0; entrylist++)
add_entry(*entrylist, override_existing);
}
@@ -302,12 +303,12 @@ void core_options::add_entries(const options_entry *entrylist, bool override_exi
void core_options::set_default_value(const char *name, const char *defvalue)
{
// find the entry and bail if we can't
- entry *curentry = m_entrymap.find(name);
- if (curentry == NULL)
+ auto curentry = m_entrymap.find(name);
+ if (curentry == m_entrymap.end())
return;
// update the data and default data
- curentry->set_default_value(defvalue);
+ curentry->second->set_default_value(defvalue);
}
@@ -319,12 +320,12 @@ void core_options::set_default_value(const char *name, const char *defvalue)
void core_options::set_description(const char *name, const char *description)
{
// find the entry and bail if we can't
- entry *curentry = m_entrymap.find(name);
- if (curentry == NULL)
+ auto curentry = m_entrymap.find(name);
+ if (curentry == m_entrymap.end())
return;
// update the data and default data
- curentry->set_description(description);
+ curentry->second->set_description(description);
}
@@ -350,8 +351,8 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, std::
const char *optionname = is_unadorned ? core_options::unadorned(unadorned_index++) : &curarg[1];
// find our entry; if not found, indicate invalid option
- entry *curentry = m_entrymap.find(optionname);
- if (curentry == NULL)
+ auto curentry = m_entrymap.find(optionname);
+ if (curentry == m_entrymap.end())
{
strcatprintf(error_string, "Error: unknown option: %s\n", curarg);
retval = false;
@@ -360,7 +361,7 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, std::
}
// process commands first
- if (curentry->type() == OPTION_COMMAND)
+ if (curentry->second->type() == OPTION_COMMAND)
{
// can only have one command
if (!m_command.empty())
@@ -368,13 +369,13 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, std::
strcatprintf(error_string,"Error: multiple commands specified -%s and %s\n", m_command.c_str(), curarg);
return false;
}
- m_command = curentry->name();
+ m_command = curentry->second->name();
continue;
}
// get the data for this argument, special casing booleans
const char *newdata;
- if (curentry->type() == OPTION_BOOLEAN)
+ if (curentry->second->type() == OPTION_BOOLEAN)
newdata = (strncmp(&curarg[1], "no", 2) == 0) ? "0" : "1";
else if (is_unadorned)
newdata = curarg;
@@ -387,7 +388,7 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, std::
}
// set the new data
- validate_and_set_data(*curentry, newdata, priority, error_string);
+ validate_and_set_data(*curentry->second, newdata, priority, error_string);
}
return retval;
}
@@ -402,7 +403,7 @@ bool core_options::parse_ini_file(core_file &inifile, int priority, int ignore_p
{
// loop over lines in the file
char buffer[4096];
- while (core_fgets(buffer, ARRAY_LENGTH(buffer), &inifile) != NULL)
+ while (core_fgets(buffer, ARRAY_LENGTH(buffer), &inifile) != nullptr)
{
// find the extent of the name
char *optionname;
@@ -443,8 +444,8 @@ bool core_options::parse_ini_file(core_file &inifile, int priority, int ignore_p
*temp = 0;
// find our entry
- entry *curentry = m_entrymap.find(optionname);
- if (curentry == NULL)
+ auto curentry = m_entrymap.find(optionname);
+ if (curentry == m_entrymap.end())
{
if (priority >= ignore_priority)
strcatprintf(error_string, "Warning: unknown option in INI: %s\n", optionname);
@@ -452,7 +453,7 @@ bool core_options::parse_ini_file(core_file &inifile, int priority, int ignore_p
}
// set the new data
- validate_and_set_data(*curentry, optiondata, priority, error_string);
+ validate_and_set_data(*curentry->second, optiondata, priority, error_string);
}
return true;
}
@@ -466,7 +467,7 @@ bool core_options::parse_ini_file(core_file &inifile, int priority, int ignore_p
void core_options::revert(int priority)
{
// iterate over options and revert to defaults if below the given priority
- for (entry *curentry = m_entrylist.first(); curentry != NULL; curentry = curentry->next())
+ for (entry *curentry = m_entrylist.first(); curentry != nullptr; curentry = curentry->next())
curentry->revert(priority);
}
@@ -484,10 +485,10 @@ const char *core_options::output_ini(std::string &buffer, const core_options *di
int num_valid_headers = 0;
int unadorned_index = 0;
- const char *last_header = NULL;
+ const char *last_header = nullptr;
// loop over all items
- for (entry *curentry = m_entrylist.first(); curentry != NULL; curentry = curentry->next())
+ for (entry *curentry = m_entrylist.first(); curentry != nullptr; curentry = curentry->next())
{
const char *name = curentry->name();
const char *value = curentry->value();
@@ -510,21 +511,21 @@ const char *core_options::output_ini(std::string &buffer, const core_options *di
if ( !curentry->is_internal() )
{
// look up counterpart in diff, if diff is specified
- if (diff == NULL || strcmp(value, diff->value(name)) != 0)
+ if (diff == nullptr || strcmp(value, diff->value(name)) != 0)
{
// output header, if we have one
- if (last_header != NULL)
+ if (last_header != nullptr)
{
if (num_valid_headers++)
strcatprintf(buffer,"\n");
strcatprintf(buffer, "#\n# %s\n#\n", last_header);
- last_header = NULL;
+ last_header = nullptr;
}
// and finally output the data, skip if unadorned
if (!is_unadorned)
{
- if (strchr(value, ' ') != NULL)
+ if (strchr(value, ' ') != nullptr)
strcatprintf(buffer,"%-25s \"%s\"\n", name, value);
else
strcatprintf(buffer,"%-25s %s\n", name, value);
@@ -547,14 +548,14 @@ const char *core_options::output_help(std::string &buffer)
buffer.clear();
// loop over all items
- for (entry *curentry = m_entrylist.first(); curentry != NULL; curentry = curentry->next())
+ for (entry *curentry = m_entrylist.first(); curentry != nullptr; curentry = curentry->next())
{
// header: just print
if (curentry->is_header())
strcatprintf(buffer,"\n#\n# %s\n#\n", curentry->description());
// otherwise, output entries for all non-deprecated items
- else if (curentry->description() != NULL)
+ else if (curentry->description() != nullptr)
strcatprintf(buffer,"-%-20s%s\n", curentry->name(), curentry->description());
}
return buffer.c_str();
@@ -567,8 +568,8 @@ const char *core_options::output_help(std::string &buffer)
const char *core_options::value(const char *name) const
{
- entry *curentry = m_entrymap.find(name);
- return (curentry != NULL) ? curentry->value() : "";
+ auto curentry = m_entrymap.find(name);
+ return (curentry != m_entrymap.end()) ? curentry->second->value() : "";
}
@@ -578,8 +579,8 @@ const char *core_options::value(const char *name) const
const char *core_options::description(const char *name) const
{
- entry *curentry = m_entrymap.find(name);
- return (curentry != NULL) ? curentry->description() : "";
+ auto curentry = m_entrymap.find(name);
+ return (curentry != m_entrymap.end()) ? curentry->second->description() : "";
}
@@ -589,8 +590,8 @@ const char *core_options::description(const char *name) const
int core_options::priority(const char *name) const
{
- entry *curentry = m_entrymap.find(name);
- return (curentry != NULL) ? curentry->priority() : 0;
+ auto curentry = m_entrymap.find(name);
+ return (curentry != m_entrymap.end()) ? curentry->second->priority() : 0;
}
@@ -600,8 +601,8 @@ int core_options::priority(const char *name) const
UINT32 core_options::seqid(const char *name) const
{
- entry *curentry = m_entrymap.find(name);
- return (curentry != NULL) ? curentry->seqid() : 0;
+ auto curentry = m_entrymap.find(name);
+ return (curentry != m_entrymap.end()) ? curentry->second->seqid() : 0;
}
//-------------------------------------------------
@@ -610,8 +611,7 @@ UINT32 core_options::seqid(const char *name) const
bool core_options::exists(const char *name) const
{
- entry *curentry = m_entrymap.find(name);
- return (curentry != NULL);
+ return (m_entrymap.find(name) != m_entrymap.end());
}
//-------------------------------------------------
@@ -621,15 +621,15 @@ bool core_options::exists(const char *name) const
bool core_options::set_value(const char *name, const char *value, int priority, std::string &error_string)
{
// find the entry first
- entry *curentry = m_entrymap.find(name);
- if (curentry == NULL)
+ auto curentry = m_entrymap.find(name);
+ if (curentry == m_entrymap.end())
{
strcatprintf(error_string, "Attempted to set unknown option %s\n", name);
return false;
}
// validate and set the item normally
- return validate_and_set_data(*curentry, value, priority, error_string);
+ return validate_and_set_data(*curentry->second, value, priority, error_string);
}
bool core_options::set_value(const char *name, int value, int priority, std::string &error_string)
@@ -650,12 +650,12 @@ bool core_options::set_value(const char *name, float value, int priority, std::s
void core_options::set_flag(const char *name, UINT32 mask, UINT32 flag)
{
// find the entry first
- entry *curentry = m_entrymap.find(name);
- if ( curentry == NULL )
+ auto curentry = m_entrymap.find(name);
+ if ( curentry == m_entrymap.end())
{
return;
}
- curentry->set_flag(mask, flag);
+ curentry->second->set_flag(mask, flag);
}
@@ -667,7 +667,7 @@ void core_options::set_flag(const char *name, UINT32 mask, UINT32 flag)
void core_options::reset()
{
m_entrylist.reset();
- m_entrymap.reset();
+ m_entrymap.clear();
}
@@ -682,13 +682,12 @@ void core_options::append_entry(core_options::entry &newentry)
// if we have names, add them to the map
for (int name = 0; name < ARRAY_LENGTH(newentry.m_name); name++)
- if (newentry.name(name) != NULL)
+ if (newentry.name(name) != nullptr)
{
- m_entrymap.add(newentry.name(name), &newentry);
-
+ m_entrymap.insert(std::make_pair(newentry.name(name), &newentry));
// for boolean options add a "no" variant as well
if (newentry.type() == OPTION_BOOLEAN)
- m_entrymap.add(std::string("no").append(newentry.name(name)).c_str(), &newentry);
+ m_entrymap.insert(std::make_pair(std::string("no").append(newentry.name(name)), &newentry));
}
}
@@ -703,7 +702,10 @@ void core_options::remove_entry(core_options::entry &delentry)
// remove all names from the map
for (int name = 0; name < ARRAY_LENGTH(delentry.m_name); name++)
if (!delentry.m_name[name].empty())
- m_entrymap.remove(delentry.m_name[name].c_str());
+ {
+ auto entry = m_entrymap.find(delentry.m_name[name]);
+ if (entry!= m_entrymap.end()) m_entrymap.erase(entry);
+ }
// remove the entry from the list
m_entrylist.remove(delentry);
@@ -725,7 +727,7 @@ void core_options::copyfrom(const core_options &src)
reset();
// iterate through the src options and make our own
- for (entry *curentry = src.m_entrylist.first(); curentry != NULL; curentry = curentry->next())
+ for (entry *curentry = src.m_entrylist.first(); curentry != nullptr; curentry = curentry->next())
append_entry(*global_alloc(entry(curentry->name(), curentry->description(), curentry->flags(), curentry->default_value())));
}
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index 1ef4636e1e6..f193d4a4976 100644
--- a/src/lib/util/options.h
+++ b/src/lib/util/options.h
@@ -12,7 +12,7 @@
#define __OPTIONS_H__
#include "corefile.h"
-#include "tagmap.h"
+#include <unordered_map>
@@ -70,12 +70,12 @@ public:
friend class simple_list<entry>;
// construction/destruction
- entry(const char *name, const char *description, UINT32 flags = 0, const char *defvalue = NULL);
+ entry(const char *name, const char *description, UINT32 flags = 0, const char *defvalue = nullptr);
public:
// getters
entry *next() const { return m_next; }
- const char *name(int index = 0) const { return (index < ARRAY_LENGTH(m_name) && !m_name[index].empty()) ? m_name[index].c_str() : NULL; }
+ const char *name(int index = 0) const { return (index < ARRAY_LENGTH(m_name) && !m_name[index].empty()) ? m_name[index].c_str() : nullptr; }
const char *description() const { return m_description; }
const char *value() const { return m_data.c_str(); }
const char *default_value() const { return m_defdata.c_str(); }
@@ -130,7 +130,7 @@ public:
const char *command() const { return m_command.c_str(); }
// configuration
- void add_entry(const char *name, const char *description, UINT32 flags = 0, const char *defvalue = NULL, bool override_existing = false);
+ void add_entry(const char *name, const char *description, UINT32 flags = 0, const char *defvalue = nullptr, bool override_existing = false);
void add_entry(const options_entry &data, bool override_existing = false) { add_entry(data.name, data.description, data.flags, data.defvalue, override_existing); }
void add_entries(const options_entry *entrylist, bool override_existing = false);
void set_default_value(const char *name, const char *defvalue);
@@ -145,7 +145,7 @@ public:
void revert(int priority = OPTION_PRIORITY_MAXIMUM);
// output
- const char *output_ini(std::string &buffer, const core_options *diff = NULL);
+ const char *output_ini(std::string &buffer, const core_options *diff = nullptr);
const char *output_help(std::string &buffer);
// reading
@@ -178,7 +178,7 @@ private:
// internal state
simple_list<entry> m_entrylist; // head of list of entries
- tagmap_t<entry *> m_entrymap; // map for fast lookup
+ std::unordered_map<std::string,entry *> m_entrymap; // map for fast lookup
std::string m_command; // command found
static const char *const s_option_unadorned[]; // array of unadorned option "names"
};
diff --git a/src/lib/util/palette.cpp b/src/lib/util/palette.cpp
index cafdce24ebd..bd3c2d45ede 100644
--- a/src/lib/util/palette.cpp
+++ b/src/lib/util/palette.cpp
@@ -66,7 +66,7 @@ const UINT32 *palette_client::dirty_state::dirty_list(UINT32 &mindirty, UINT32 &
maxdirty = m_maxdirty;
// if nothing to report, report nothing
- return (m_mindirty > m_maxdirty) ? NULL : &m_dirty[0];
+ return (m_mindirty > m_maxdirty) ? nullptr : &m_dirty[0];
}
@@ -128,7 +128,7 @@ void palette_client::dirty_state::reset()
palette_client::palette_client(palette_t &palette)
: m_palette(palette),
- m_next(NULL),
+ m_next(nullptr),
m_live(&m_dirty[0]),
m_previous(&m_dirty[1])
{
@@ -153,7 +153,7 @@ palette_client::palette_client(palette_t &palette)
palette_client::~palette_client()
{
// first locate and remove ourself from our palette's list
- for (palette_client **curptr = &m_palette.m_client_list; *curptr != NULL; curptr = &(*curptr)->m_next)
+ for (palette_client **curptr = &m_palette.m_client_list; *curptr != nullptr; curptr = &(*curptr)->m_next)
if (*curptr == this)
{
*curptr = m_next;
@@ -174,8 +174,8 @@ const UINT32 *palette_client::dirty_list(UINT32 &mindirty, UINT32 &maxdirty)
{
// if nothing to report, report nothing and don't swap
const UINT32 *result = m_live->dirty_list(mindirty, maxdirty);
- if (result == NULL)
- return NULL;
+ if (result == nullptr)
+ return nullptr;
// swap the live and previous lists
dirty_state *temp = m_live;
@@ -220,7 +220,7 @@ palette_t::palette_t(UINT32 numcolors, UINT32 numgroups)
m_adjusted_rgb15(numcolors * numgroups + 2),
m_group_bright(numgroups),
m_group_contrast(numgroups),
- m_client_list(NULL)
+ m_client_list(nullptr)
{
// initialize gamma map
for (UINT32 index = 0; index < 256; index++)
@@ -556,6 +556,6 @@ void palette_t::update_adjusted_color(UINT32 group, UINT32 index)
m_adjusted_rgb15[finalindex] = adjusted.as_rgb15();
// mark dirty in all clients
- for (palette_client *client = m_client_list; client != NULL; client = client->next())
+ for (palette_client *client = m_client_list; client != nullptr; client = client->next())
client->mark_dirty(finalindex);
}
diff --git a/src/lib/util/png.cpp b/src/lib/util/png.cpp
index 706dfb5e50f..a6b269593ef 100644
--- a/src/lib/util/png.cpp
+++ b/src/lib/util/png.cpp
@@ -53,51 +53,51 @@ static const int samples[] = { 1, 0, 3, 1, 2, 0, 4 };
INLINE FUNCTIONS
***************************************************************************/
-INLINE UINT8 fetch_8bit(UINT8 *v)
+static inline UINT8 fetch_8bit(UINT8 *v)
{
return *v;
}
#ifdef UNUSED_FUNCTION
-INLINE UINT16 fetch_16bit(UINT8 *v)
+static inline UINT16 fetch_16bit(UINT8 *v)
{
return BIG_ENDIANIZE_INT16(*(UINT16 *)v);
}
#endif
-INLINE UINT32 fetch_32bit(UINT8 *v)
+static inline UINT32 fetch_32bit(UINT8 *v)
{
return BIG_ENDIANIZE_INT32(*(UINT32 *)v);
}
-INLINE void put_8bit(UINT8 *v, UINT8 data)
+static inline void put_8bit(UINT8 *v, UINT8 data)
{
*v = data;
}
#ifdef UNUSED_FUNCTION
-INLINE void put_16bit(UINT8 *v, UINT16 data)
+static inline void put_16bit(UINT8 *v, UINT16 data)
{
*(UINT16 *)v = BIG_ENDIANIZE_INT16(data);
}
#endif
-INLINE void put_32bit(UINT8 *v, UINT32 data)
+static inline void put_32bit(UINT8 *v, UINT32 data)
{
*(UINT32 *)v = BIG_ENDIANIZE_INT32(data);
}
-INLINE int compute_bpp(const png_info *pnginfo)
+static inline int compute_bpp(const png_info *pnginfo)
{
return samples[pnginfo->color_type] * pnginfo->bit_depth / 8;
}
-INLINE int compute_rowbytes(const png_info *pnginfo)
+static inline int compute_rowbytes(const png_info *pnginfo)
{
return (pnginfo->width * samples[pnginfo->color_type] * pnginfo->bit_depth + 7) / 8;
}
@@ -115,26 +115,26 @@ INLINE int compute_rowbytes(const png_info *pnginfo)
void png_free(png_info *pnginfo)
{
- while (pnginfo->textlist != NULL)
+ while (pnginfo->textlist != nullptr)
{
png_text *temp = pnginfo->textlist;
pnginfo->textlist = temp->next;
- if (temp->keyword != NULL)
+ if (temp->keyword != nullptr)
free((void *)temp->keyword);
free(temp);
}
- if (pnginfo->palette != NULL)
+ if (pnginfo->palette != nullptr)
free(pnginfo->palette);
- pnginfo->palette = NULL;
+ pnginfo->palette = nullptr;
- if (pnginfo->trans != NULL)
+ if (pnginfo->trans != nullptr)
free(pnginfo->trans);
- pnginfo->trans = NULL;
+ pnginfo->trans = nullptr;
- if (pnginfo->image != NULL)
+ if (pnginfo->image != nullptr)
free(pnginfo->image);
- pnginfo->image = NULL;
+ pnginfo->image = nullptr;
}
@@ -191,19 +191,19 @@ static png_error read_chunk(core_file *fp, UINT8 **data, UINT32 *type, UINT32 *l
crc = crc32(0, tempbuff, 4);
/* read the chunk itself into an allocated memory buffer */
- *data = NULL;
+ *data = nullptr;
if (*length != 0)
{
/* allocate memory for this chunk */
*data = (UINT8 *)malloc(*length);
- if (*data == NULL)
+ if (*data == nullptr)
return PNGERR_OUT_OF_MEMORY;
/* read the data from the file */
if (core_fread(fp, *data, *length) != *length)
{
free(*data);
- *data = NULL;
+ *data = nullptr;
return PNGERR_FILE_TRUNCATED;
}
@@ -215,7 +215,7 @@ static png_error read_chunk(core_file *fp, UINT8 **data, UINT32 *type, UINT32 *l
if (core_fread(fp, tempbuff, 4) != 4)
{
free(*data);
- *data = NULL;
+ *data = nullptr;
return PNGERR_FILE_TRUNCATED;
}
chunk_crc = fetch_32bit(tempbuff);
@@ -224,7 +224,7 @@ static png_error read_chunk(core_file *fp, UINT8 **data, UINT32 *type, UINT32 *l
if (crc != chunk_crc)
{
free(*data);
- *data = NULL;
+ *data = nullptr;
return PNGERR_FILE_CORRUPT;
}
return PNGERR_NONE;
@@ -273,11 +273,11 @@ static png_error process_chunk(png_private *png, UINT8 *data, UINT32 type, UINT3
/* allocate a new image data descriptor */
*png->idata_next = (image_data_chunk *)malloc(sizeof(**png->idata_next));
- if (*png->idata_next == NULL)
+ if (*png->idata_next == nullptr)
return PNGERR_OUT_OF_MEMORY;
/* add it to the tail of the list */
- (*png->idata_next)->next = NULL;
+ (*png->idata_next)->next = nullptr;
(*png->idata_next)->length = length;
(*png->idata_next)->data = data;
png->idata_next = &(*png->idata_next)->next;
@@ -303,17 +303,17 @@ static png_error process_chunk(png_private *png, UINT8 *data, UINT32 type, UINT3
/* allocate a new text item */
text = (png_text *)malloc(sizeof(*text));
- if (text == NULL)
+ if (text == nullptr)
return PNGERR_OUT_OF_MEMORY;
/* set the elements */
text->keyword = (char *)data;
text->text = text->keyword + strlen(text->keyword) + 1;
- text->next = NULL;
+ text->next = nullptr;
/* add to the end of the list */
- for (pt = NULL, ct = png->pnginfo->textlist; ct != NULL; pt = ct, ct = ct->next) ;
- if (pt == NULL)
+ for (pt = nullptr, ct = png->pnginfo->textlist; ct != nullptr; pt = ct, ct = ct->next) ;
+ if (pt == nullptr)
png->pnginfo->textlist = text;
else
pt->next = text;
@@ -359,7 +359,7 @@ static png_error unfilter_row(int type, UINT8 *src, UINT8 *dst, UINT8 *dstprev,
/* UP = pixel above */
case PNG_PF_Up:
- if (dstprev == NULL)
+ if (dstprev == nullptr)
return unfilter_row(PNG_PF_None, src, dst, dstprev, bpp, rowbytes);
for (x = 0; x < rowbytes; x++, dst++)
*dst = *src++ + *dstprev++;
@@ -367,7 +367,7 @@ static png_error unfilter_row(int type, UINT8 *src, UINT8 *dst, UINT8 *dstprev,
/* AVERAGE = average of pixel above and previous pixel */
case PNG_PF_Average:
- if (dstprev == NULL)
+ if (dstprev == nullptr)
{
for (x = 0; x < bpp; x++)
*dst++ = *src++;
@@ -388,8 +388,8 @@ static png_error unfilter_row(int type, UINT8 *src, UINT8 *dst, UINT8 *dstprev,
for (x = 0; x < rowbytes; x++)
{
INT32 pa = (x < bpp) ? 0 : dst[-bpp];
- INT32 pc = (x < bpp || dstprev == NULL) ? 0 : dstprev[-bpp];
- INT32 pb = (dstprev == NULL) ? 0 : *dstprev++;
+ INT32 pc = (x < bpp || dstprev == nullptr) ? 0 : dstprev[-bpp];
+ INT32 pb = (dstprev == nullptr) ? 0 : *dstprev++;
INT32 prediction = pa + pb - pc;
INT32 da = abs(prediction - pa);
INT32 db = abs(prediction - pb);
@@ -432,7 +432,7 @@ static png_error process_image(png_private *png)
/* allocate memory for the filtered image */
png->pnginfo->image = (UINT8 *)malloc(imagesize);
- if (png->pnginfo->image == NULL)
+ if (png->pnginfo->image == nullptr)
return PNGERR_OUT_OF_MEMORY;
/* initialize the stream */
@@ -447,7 +447,7 @@ static png_error process_image(png_private *png)
}
/* loop over IDAT and decompress each as part of a larger stream */
- for (idat = png->idata; idat != NULL; idat = idat->next)
+ for (idat = png->idata; idat != nullptr; idat = idat->next)
{
/* decompress this chunk */
stream.next_in = idat->data;
@@ -482,7 +482,7 @@ static png_error process_image(png_private *png)
{
/* first byte of each row is the filter type */
int filter = *src++;
- error = unfilter_row(filter, src, dst, (y == 0) ? NULL : &dst[-rowbytes], bpp, rowbytes);
+ error = unfilter_row(filter, src, dst, (y == 0) ? nullptr : &dst[-rowbytes], bpp, rowbytes);
src += rowbytes;
dst += rowbytes;
}
@@ -492,7 +492,7 @@ handle_error:
if (error != PNGERR_NONE)
{
free(png->pnginfo->image);
- png->pnginfo->image = NULL;
+ png->pnginfo->image = nullptr;
}
return error;
}
@@ -504,7 +504,7 @@ handle_error:
png_error png_read_file(core_file *fp, png_info *pnginfo)
{
- UINT8 *chunk_data = NULL;
+ UINT8 *chunk_data = nullptr;
png_private png;
png_error error;
@@ -542,7 +542,7 @@ png_error png_read_file(core_file *fp, png_info *pnginfo)
/* free memory if we didn't want to keep it */
if (!keepmem)
free(chunk_data);
- chunk_data = NULL;
+ chunk_data = nullptr;
}
/* finish processing the image */
@@ -553,15 +553,15 @@ png_error png_read_file(core_file *fp, png_info *pnginfo)
handle_error:
/* free all intermediate data */
- while (png.idata != NULL)
+ while (png.idata != nullptr)
{
image_data_chunk *next = png.idata->next;
- if (png.idata->data != NULL)
+ if (png.idata->data != nullptr)
free(png.idata->data);
free(png.idata);
png.idata = next;
}
- if (chunk_data != NULL)
+ if (chunk_data != nullptr)
free(chunk_data);
/* if we have an error, free all the other data as well */
@@ -665,7 +665,7 @@ png_error png_expand_buffer_8bit(png_info *pnginfo)
/* allocate a new buffer at 8-bit */
outbuf = (UINT8 *)malloc(pnginfo->width * pnginfo->height);
- if (outbuf == NULL)
+ if (outbuf == nullptr)
return PNGERR_OUT_OF_MEMORY;
inp = pnginfo->image;
@@ -710,13 +710,13 @@ png_error png_add_text(png_info *pnginfo, const char *keyword, const char *text)
/* allocate a new text element */
newtext = (png_text *)malloc(sizeof(*newtext));
- if (newtext == NULL)
+ if (newtext == nullptr)
return PNGERR_OUT_OF_MEMORY;
/* allocate a string long enough to hold both */
keylen = (int)strlen(keyword);
textdata = (char *)malloc(keylen + 1 + strlen(text) + 1);
- if (textdata == NULL)
+ if (textdata == nullptr)
{
free(newtext);
return PNGERR_OUT_OF_MEMORY;
@@ -729,11 +729,11 @@ png_error png_add_text(png_info *pnginfo, const char *keyword, const char *text)
/* text follows a trailing NULL */
newtext->keyword = textdata;
newtext->text = textdata + keylen + 1;
- newtext->next = NULL;
+ newtext->next = nullptr;
/* add us to the end of the linked list */
- for (pt = NULL, ct = pnginfo->textlist; ct != NULL; pt = ct, ct = ct->next) ;
- if (pt == NULL)
+ for (pt = nullptr, ct = pnginfo->textlist; ct != nullptr; pt = ct, ct = ct->next) ;
+ if (pt == nullptr)
pnginfo->textlist = newtext;
else
pt->next = newtext;
@@ -884,7 +884,7 @@ static png_error convert_bitmap_to_image_palette(png_info *pnginfo, const bitmap
/* allocate memory for the palette */
pnginfo->palette = (UINT8 *)malloc(3 * 256);
- if (pnginfo->palette == NULL)
+ if (pnginfo->palette == nullptr)
return PNGERR_OUT_OF_MEMORY;
/* build the palette */
@@ -899,7 +899,7 @@ static png_error convert_bitmap_to_image_palette(png_info *pnginfo, const bitmap
/* allocate memory for the image */
pnginfo->image = (UINT8 *)malloc(pnginfo->height * (rowbytes + 1));
- if (pnginfo->image == NULL)
+ if (pnginfo->image == nullptr)
{
free(pnginfo->palette);
return PNGERR_OUT_OF_MEMORY;
@@ -941,7 +941,7 @@ static png_error convert_bitmap_to_image_rgb(png_info *pnginfo, const bitmap_t &
/* allocate memory for the image */
pnginfo->image = (UINT8 *)malloc(pnginfo->height * (rowbytes + 1));
- if (pnginfo->image == NULL)
+ if (pnginfo->image == nullptr)
return PNGERR_OUT_OF_MEMORY;
/* copy in the pixels, specifying a NULL filter */
@@ -1046,7 +1046,7 @@ static png_error write_png_stream(core_file *fp, png_info *pnginfo, const bitmap
goto handle_error;
/* write TEXT chunks */
- for (text = pnginfo->textlist; text != NULL; text = text->next)
+ for (text = pnginfo->textlist; text != nullptr; text = text->next)
{
error = write_chunk(fp, (UINT8 *)text->keyword, PNG_CN_tEXt, (UINT32)strlen(text->keyword) + 1 + (UINT32)strlen(text->text));
if (error != PNGERR_NONE)
@@ -1054,7 +1054,7 @@ static png_error write_png_stream(core_file *fp, png_info *pnginfo, const bitmap
}
/* write an IEND chunk */
- error = write_chunk(fp, NULL, PNG_CN_IEND, 0);
+ error = write_chunk(fp, nullptr, PNG_CN_IEND, 0);
handle_error:
return error;
@@ -1067,7 +1067,7 @@ png_error png_write_bitmap(core_file *fp, png_info *info, bitmap_t &bitmap, int
png_error error;
/* use a dummy pnginfo if none passed to us */
- if (info == NULL)
+ if (info == nullptr)
{
info = &pnginfo;
memset(&pnginfo, 0, sizeof(pnginfo));
@@ -1161,5 +1161,5 @@ png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t &bitmap, int
png_error mng_capture_stop(core_file *fp)
{
- return write_chunk(fp, NULL, MNG_CN_MEND, 0);
+ return write_chunk(fp, nullptr, MNG_CN_MEND, 0);
}
diff --git a/src/lib/util/pool.cpp b/src/lib/util/pool.cpp
index ab62f47c6aa..9712d8b6e00 100644
--- a/src/lib/util/pool.cpp
+++ b/src/lib/util/pool.cpp
@@ -100,7 +100,7 @@ static void report_failure(object_pool *pool, const char *format, ...) ATTR_PRIN
object
-------------------------------------------------*/
-INLINE int hash_object(void *object)
+static inline int hash_object(void *object)
{
return ((size_t)object >> 4) % POOL_HASH_SIZE;
}
@@ -111,15 +111,15 @@ INLINE int hash_object(void *object)
a given object type
-------------------------------------------------*/
-INLINE objtype_entry *get_object_type(object_pool *pool, object_type type)
+static inline objtype_entry *get_object_type(object_pool *pool, object_type type)
{
objtype_entry *entry;
- for (entry = pool->typelist; entry != NULL; entry = entry->next)
+ for (entry = pool->typelist; entry != nullptr; entry = entry->next)
if (entry->type == type)
return entry;
- return NULL;
+ return nullptr;
}
@@ -138,8 +138,8 @@ object_pool *pool_alloc_lib(void (*fail)(const char *message))
/* allocate memory for the pool itself */
pool = (object_pool *)malloc(sizeof(*pool));
- if (pool == NULL)
- return NULL;
+ if (pool == nullptr)
+ return nullptr;
memset(pool, 0, sizeof(*pool));
/* set the failure handler */
@@ -162,11 +162,11 @@ void pool_type_register(object_pool *pool, object_type type, const char *friendl
objtype_entry *newtype = get_object_type(pool, type);
/* if the type doesn't already exist... */
- if (newtype == NULL)
+ if (newtype == nullptr)
{
/* allocate a new entry */
newtype = (objtype_entry *)malloc(sizeof(*newtype));
- if (newtype == NULL)
+ if (newtype == nullptr)
{
report_failure(pool, "Error adding new type %s\n", friendly);
return;
@@ -195,7 +195,7 @@ void pool_clear(object_pool *pool)
object_entry *entry, *next;
/* iterate over all entries in the global list and free them */
- for (entry = pool->globallist; entry != NULL; entry = next)
+ for (entry = pool->globallist; entry != nullptr; entry = next)
{
/* remember the next entry */
next = entry->globalnext;
@@ -205,7 +205,7 @@ void pool_clear(object_pool *pool)
/* add ourself to the free list */
entry->next = pool->freelist;
- entry->globalnext = entry->globalprev = NULL;
+ entry->globalnext = entry->globalprev = nullptr;
pool->freelist = entry;
}
@@ -228,14 +228,14 @@ void pool_free_lib(object_pool *pool)
pool_clear(pool);
/* free all entry blocks */
- for (block = pool->blocklist; block != NULL; block = nextblock)
+ for (block = pool->blocklist; block != nullptr; block = nextblock)
{
nextblock = block->next;
free(block);
}
/* free all types */
- for (type = pool->typelist; type != NULL; type = nexttype)
+ for (type = pool->typelist; type != nullptr; type = nexttype)
{
nexttype = type->next;
free(type);
@@ -263,29 +263,29 @@ void *pool_object_add_file_line(object_pool *pool, object_type _type, void *obje
object_entry *entry;
/* if we have an invalid type, fail */
- if (type == NULL)
+ if (type == nullptr)
{
report_failure(pool, "pool_object_add (via %s:%d): Attempted to add object of unknown type with size %d", file, line, (int)size);
return object;
}
/* if we get a NULL object, fail */
- if (object == NULL)
+ if (object == nullptr)
{
report_failure(pool, "pool_object_add (via %s:%d): Attempted to add a NULL object of size %d", file, line, (int)size);
return object;
}
/* allocate a new entry */
- if (pool->freelist == NULL)
+ if (pool->freelist == nullptr)
{
object_entry_block *block;
int entrynum;
/* if we need a new block, allocate that now */
block = (object_entry_block *)malloc(sizeof(*block));
- if (block == NULL)
- return NULL;
+ if (block == nullptr)
+ return nullptr;
memset(block, 0, sizeof(*block));
/* hook us into the blocklist */
@@ -312,9 +312,9 @@ void *pool_object_add_file_line(object_pool *pool, object_type _type, void *obje
entry->line = line;
/* hook us into the global list */
- if (pool->globallist != NULL)
+ if (pool->globallist != nullptr)
pool->globallist->globalprev = entry;
- entry->globalprev = NULL;
+ entry->globalprev = nullptr;
entry->globalnext = pool->globallist;
pool->globallist = entry;
@@ -336,7 +336,7 @@ void *pool_object_remove(object_pool *pool, void *object, int destruct)
object_entry **entryptr;
/* find the object in question and remove it */
- for (entryptr = &pool->hashtable[hashnum]; *entryptr != NULL; entryptr = &(*entryptr)->next)
+ for (entryptr = &pool->hashtable[hashnum]; *entryptr != nullptr; entryptr = &(*entryptr)->next)
if ((*entryptr)->object == object)
{
object_entry *entry = *entryptr;
@@ -346,9 +346,9 @@ void *pool_object_remove(object_pool *pool, void *object, int destruct)
(*entry->type->destructor)(entry->object, entry->size);
/* remove us from the global list */
- if (entry->globalprev != NULL)
+ if (entry->globalprev != nullptr)
entry->globalprev->globalnext = entry->globalnext;
- if (entry->globalnext != NULL)
+ if (entry->globalnext != nullptr)
entry->globalnext->globalprev = entry->globalprev;
if (pool->globallist == entry)
pool->globallist = entry->globalnext;
@@ -362,7 +362,7 @@ void *pool_object_remove(object_pool *pool, void *object, int destruct)
break;
}
- return NULL;
+ return nullptr;
}
@@ -377,7 +377,7 @@ int pool_object_exists(object_pool *pool, object_type type, void *object)
object_entry *entry;
/* find the object in question */
- for (entry = pool->hashtable[hashnum]; entry != NULL; entry = entry->next)
+ for (entry = pool->hashtable[hashnum]; entry != nullptr; entry = entry->next)
if (entry->object == object && (type == OBJTYPE_WILDCARD || entry->type->type == type))
return TRUE;
@@ -401,14 +401,14 @@ object_pool_iterator *pool_iterate_begin(object_pool *pool, object_type type)
/* allocate the iterator */
iter = (object_pool_iterator *)malloc(sizeof(*iter));
- if (iter == NULL)
- return NULL;
+ if (iter == nullptr)
+ return nullptr;
memset(iter, 0, sizeof(*iter));
/* fill it in */
iter->pool = pool;
iter->type = type;
- iter->last = NULL;
+ iter->last = nullptr;
return iter;
}
@@ -421,19 +421,19 @@ object_pool_iterator *pool_iterate_begin(object_pool *pool, object_type type)
int pool_iterate_next(object_pool_iterator *iter, void **objectptr, size_t *sizeptr, object_type *typeptr)
{
/* if no previous entry, find the first */
- if (iter->last == NULL)
+ if (iter->last == nullptr)
iter->last = iter->pool->globallist;
else
iter->last = iter->last->globalnext;
/* stop when we get one */
- if (iter->last != NULL)
+ if (iter->last != nullptr)
{
- if (objectptr != NULL)
+ if (objectptr != nullptr)
*objectptr = iter->last;
- if (sizeptr != NULL)
+ if (sizeptr != nullptr)
*sizeptr = iter->last->size;
- if (typeptr != NULL)
+ if (typeptr != nullptr)
*typeptr = iter->last->type->type;
return TRUE;
}
@@ -478,7 +478,7 @@ void *pool_malloc_file_line(object_pool *pool, size_t size, const char *file, in
void *pool_realloc_file_line(object_pool *pool, void *ptr, size_t size, const char *file, int line)
{
- if (ptr != NULL)
+ if (ptr != nullptr)
pool_object_remove(pool, ptr, FALSE);
ptr = realloc(ptr, size);
if (size != 0)
@@ -495,7 +495,7 @@ void *pool_realloc_file_line(object_pool *pool, void *ptr, size_t size, const ch
char *pool_strdup_file_line(object_pool *pool, const char *str, const char *file, int line)
{
char *ptr = (char *)pool_malloc_file_line(pool, strlen(str) + 1, file, line);
- if (ptr != NULL)
+ if (ptr != nullptr)
strcpy(ptr, str);
return ptr;
}
@@ -530,7 +530,7 @@ static void memory_destruct(void *object, size_t size)
static void report_failure(object_pool *pool, const char *format, ...)
{
/* only do the work if we have a callback */
- if (pool->fail != NULL)
+ if (pool->fail != nullptr)
{
char message[1024];
va_list argptr;
diff --git a/src/lib/util/tagmap.cpp b/src/lib/util/tagmap.cpp
deleted file mode 100644
index 7995b578314..00000000000
--- a/src/lib/util/tagmap.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-/***************************************************************************
-
- tagmap.c
-
- tagmap counter
-
-***************************************************************************/
-
-#include <assert.h>
-
-#include "tagmap.h"
-
-#ifdef MAME_DEBUG
-/** @brief The tagmap finds. */
-INT32 g_tagmap_finds = 0;
-/** @brief true to enable, false to disable the tagmap counter. */
-bool g_tagmap_counter_enabled = false;
-#endif
diff --git a/src/lib/util/tagmap.h b/src/lib/util/tagmap.h
index 50550f3e6c3..4d15cbba193 100644
--- a/src/lib/util/tagmap.h
+++ b/src/lib/util/tagmap.h
@@ -16,11 +16,8 @@
#include "osdcore.h"
#include "coretmpl.h"
#include <string>
-#ifdef MAME_DEBUG
-#include "eminline.h"
-#endif
-
-
+#include <utility>
+#include <unordered_map>
//**************************************************************************
// CONSTANTS
@@ -32,178 +29,15 @@ enum tagmap_error
TMERR_DUPLICATE
};
-
-#ifdef MAME_DEBUG
-extern INT32 g_tagmap_finds;
-extern bool g_tagmap_counter_enabled;
-#endif
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-// generally used for small tables, though the hash size can be increased
-// as necessary; good primes are: 53, 97, 193, 389, 769, 1543, 3079, 6151, etc
-template<class _ElementType, int _HashSize = 53>
-class tagmap_t
-{
-private:
- // disable copying/assignment
- tagmap_t(const tagmap_t &);
- tagmap_t &operator=(const tagmap_t &);
-
-public:
- // an entry in the table
- class entry_t
- {
- friend class tagmap_t<_ElementType, _HashSize>;
-
- public:
- // construction/destruction
- entry_t(const char *tag, UINT32 fullhash, _ElementType object)
- : m_next(NULL),
- m_fullhash(fullhash),
- m_tag(tag),
- m_object(object) { }
-
- // accessors
- const std::string &tag() const { return m_tag; }
- _ElementType object() const { return m_object; }
-
- // setters
- void set_object(_ElementType object) { m_object = object; }
-
- private:
- // internal helpers
- entry_t *next() const { return m_next; }
- UINT32 fullhash() const { return m_fullhash; }
-
- // internal state
- entry_t * m_next;
- UINT32 m_fullhash;
- std::string m_tag;
- _ElementType m_object;
- };
-
- // construction/destruction
- tagmap_t() { memset(m_table, 0, sizeof(m_table)); }
- ~tagmap_t() { reset(); }
-
- // core hashing function
- UINT32 hash(const char *string) const
- {
- UINT32 result = *string++;
- for (UINT8 c = *string++; c != 0; c = *string++)
- result = (result*33) ^ c;
- return result;
- }
-
- // empty the list
- void reset()
- {
- for (UINT32 hashindex = 0; hashindex < ARRAY_LENGTH(m_table); hashindex++)
- while (m_table[hashindex] != NULL)
- remove_common(&m_table[hashindex]);
- }
-
- // add/remove
- tagmap_error add(const char *tag, _ElementType object, bool replace_if_duplicate = false) { return add_common(tag, object, replace_if_duplicate, false); }
- tagmap_error add_unique_hash(const char *tag, _ElementType object, bool replace_if_duplicate = false) { return add_common(tag, object, replace_if_duplicate, true); }
-
- // remove by tag
- void remove(const char *tag)
- {
- UINT32 fullhash = hash(tag);
- for (entry_t **entryptr = &m_table[fullhash % ARRAY_LENGTH(m_table)]; *entryptr != NULL; entryptr = &(*entryptr)->m_next)
- if ((*entryptr)->fullhash() == fullhash && (*entryptr)->tag() == tag)
- return remove_common(entryptr);
- }
-
- // remove by object
- void remove(_ElementType object)
- {
- for (UINT32 hashindex = 0; hashindex < ARRAY_LENGTH(m_table); hashindex++)
- for (entry_t **entryptr = &m_table[hashindex]; *entryptr != NULL; entryptr = &(*entryptr)->m_next)
- if ((*entryptr)->object() == object)
- return remove_common(entryptr);
- }
-
- // find by tag
- _ElementType find(const char *tag) const { return find(tag, hash(tag)); }
-
- // find by tag with precomputed hash
- _ElementType find(const char *tag, UINT32 fullhash) const
- {
-#ifdef MAME_DEBUG
- if (g_tagmap_counter_enabled)
- atomic_increment32(&g_tagmap_finds);
-#endif
- for (entry_t *entry = m_table[fullhash % ARRAY_LENGTH(m_table)]; entry != NULL; entry = entry->next())
- if (entry->fullhash() == fullhash && entry->tag() == tag)
- return entry->object();
- return _ElementType(NULL);
- }
-
- // find by tag without checking anything but the hash
- _ElementType find_hash_only(const char *tag) const
- {
-#ifdef MAME_DEBUG
- if (g_tagmap_counter_enabled)
- atomic_increment32(&g_tagmap_finds);
-#endif
- UINT32 fullhash = hash(tag);
- for (entry_t *entry = m_table[fullhash % ARRAY_LENGTH(m_table)]; entry != NULL; entry = entry->next())
- if (entry->fullhash() == fullhash)
- return entry->object();
- return NULL;
- }
-
- // return first object in the table
- entry_t *first() const { return next(NULL); }
-
- // return next object in the table
- entry_t *next(entry_t *after) const
- {
- // if there's another item in this hash bucket, just return it
- if (after != NULL && after->next() != NULL)
- return after->next();
-
- // otherwise scan forward for the next bucket with an entry
- UINT32 firstindex = (after != NULL) ? (after->fullhash() % ARRAY_LENGTH(m_table) + 1) : 0;
- for (UINT32 hashindex = firstindex; hashindex < ARRAY_LENGTH(m_table); hashindex++)
- if (m_table[hashindex] != NULL)
- return m_table[hashindex];
-
- // all out
- return NULL;
- }
-
-private:
- // internal helpers
- tagmap_error add_common(const char *tag, _ElementType object, bool replace_if_duplicate, bool unique_hash);
-
- // remove an entry given a pointer to its pointer
- void remove_common(entry_t **entryptr)
- {
- entry_t *entry = *entryptr;
- *entryptr = entry->next();
- global_free(entry);
- }
-
- // internal state
- entry_t * m_table[_HashSize];
-};
-
-
// ======================> tagged_list
class add_exception
{
public:
add_exception(const char *tag) : m_tag(tag) { }
- const char *tag() const { return m_tag; }
+ const char *tag() const { return m_tag.c_str(); }
private:
- const char *m_tag;
+ std::string m_tag;
};
// a tagged_list is a class that maintains a list of objects that can be quickly looked up by tag
@@ -224,12 +58,12 @@ public:
int count() const { return m_list.count(); }
// remove (free) all objects in the list, leaving an empty list
- void reset() { m_list.reset(); m_map.reset(); }
+ void reset() { m_list.reset(); m_map.clear(); }
// add the given object to the head of the list
_ElementType &prepend(const char *tag, _ElementType &object)
{
- if (m_map.add_unique_hash(tag, &object, false) != TMERR_NONE)
+ if (!m_map.insert(std::make_pair(tag, &object)).second)
throw add_exception(tag);
return m_list.prepend(object);
}
@@ -237,100 +71,20 @@ public:
// add the given object to the tail of the list
_ElementType &append(const char *tag, _ElementType &object)
{
- if (m_map.add_unique_hash(tag, &object, false) != TMERR_NONE)
+ if (!m_map.insert(std::make_pair(tag, &object)).second)
throw add_exception(tag);
return m_list.append(object);
}
- // insert the given object after a particular object (NULL means prepend)
- _ElementType &insert_after(const char *tag, _ElementType &object, _ElementType *insert_after)
- {
- if (m_map.add_unique_hash(tag, &object, false) != TMERR_NONE)
- throw add_exception(tag);
- return m_list.insert_after(object, insert_after);
- }
-
- // replace an item in the list at the same location, and remove it
- _ElementType &replace_and_remove(const char *tag, _ElementType &object, _ElementType &toreplace)
- {
- m_map.remove(&toreplace);
- m_list.replace_and_remove(object, toreplace);
- if (m_map.add_unique_hash(tag, &object, false) != TMERR_NONE)
- throw add_exception(tag);
- return object;
- }
-
- // detach the given item from the list, but don't free its memory
- _ElementType &detach(_ElementType &object)
- {
- m_map.remove(&object);
- return m_list.detach(object);
- }
-
- // remove the given object and free its memory
- void remove(_ElementType &object)
- {
- m_map.remove(&object);
- return m_list.remove(object);
- }
-
- // find an object by index in the list
- _ElementType *find(int index) const
- {
- return m_list.find(index);
- }
-
- // return the index of the given object in the list
- int indexof(const _ElementType &object) const
- {
- return m_list.indexof(object);
- }
-
// operations by tag
- _ElementType &replace_and_remove(const char *tag, _ElementType &object) { _ElementType *existing = find(tag); return (existing == NULL) ? append(tag, object) : replace_and_remove(tag, object, *existing); }
- void remove(const char *tag) { _ElementType *object = find(tag); if (object != NULL) remove(*object); }
- _ElementType *find(const char *tag) const { return m_map.find_hash_only(tag); }
- int indexof(const char *tag) const { _ElementType *object = find(tag); return (object != NULL) ? m_list.indexof(*object) : NULL; }
+ void remove(const char *tag) { auto search = m_map.find(tag); if (search != m_map.end()) m_list.remove(*search->second); }
+ _ElementType *find(const char *tag) const { auto search = m_map.find(tag); return (search == m_map.end()) ? nullptr : search->second; }
private:
// internal state
simple_list<_ElementType> m_list;
- tagmap_t<_ElementType *> m_map;
+ std::unordered_map<std::string,_ElementType *> m_map;
};
-
-//**************************************************************************
-// IMPLEMENTATION
-//**************************************************************************
-
-//-------------------------------------------------
-// add_common - core implementation of a tagmap
-// addition
-//-------------------------------------------------
-
-template<class _ElementType, int _HashSize>
-tagmap_error tagmap_t<_ElementType, _HashSize>::add_common(const char *tag, _ElementType object, bool replace_if_duplicate, bool unique_hash)
-{
- UINT32 fullhash = hash(tag);
- UINT32 hashindex = fullhash % ARRAY_LENGTH(m_table);
-
- // first make sure we don't have a duplicate
- for (entry_t *entry = m_table[hashindex]; entry != NULL; entry = entry->next())
- if (entry->fullhash() == fullhash)
- if (unique_hash || entry->tag() == tag)
- {
- if (replace_if_duplicate)
- entry->set_object(object);
- return TMERR_DUPLICATE;
- }
-
- // now allocate a new entry and add to the head of the list
- entry_t *entry = global_alloc(entry_t(tag, fullhash, object));
- entry->m_next = m_table[hashindex];
- m_table[hashindex] = entry;
- return TMERR_NONE;
-}
-
-
#endif /* __TAGMAP_H__ */
diff --git a/src/lib/util/un7z.cpp b/src/lib/util/un7z.cpp
index bbae440e0ff..b9cfa13eafe 100644
--- a/src/lib/util/un7z.cpp
+++ b/src/lib/util/un7z.cpp
@@ -24,7 +24,7 @@
void *SZipAlloc(void *p, size_t size)
{
if (size == 0)
- return 0;
+ return nullptr;
return malloc(size);
}
@@ -38,7 +38,7 @@ void SZipFree(void *p, void *address)
void File_Construct(CSzFile *p)
{
- p->_7z_osdfile = NULL;
+ p->_7z_osdfile = nullptr;
}
static WRes File_Open(CSzFile *p, const char *name, int writeMode)
@@ -186,7 +186,7 @@ static void free__7z_file(_7z_file *_7z);
int _7z_search_crc_match(_7z_file *new_7z, UINT32 search_crc, const char* search_filename, int search_filename_length, bool matchcrc, bool matchname)
{
- UInt16 *temp = NULL;
+ UInt16 *temp = nullptr;
size_t tempSize = 0;
for (int i = 0; i < new_7z->db.db.NumFiles; i++)
@@ -194,7 +194,7 @@ int _7z_search_crc_match(_7z_file *new_7z, UINT32 search_crc, const char* search
const CSzFileItem *f = new_7z->db.db.Files + i;
size_t len;
- len = SzArEx_GetFileNameUtf16(&new_7z->db, i, NULL);
+ len = SzArEx_GetFileNameUtf16(&new_7z->db, i, nullptr);
// if it's a directory entry we don't care about it..
if (f->IsDir)
@@ -202,10 +202,10 @@ int _7z_search_crc_match(_7z_file *new_7z, UINT32 search_crc, const char* search
if (len > tempSize)
{
- SZipFree(NULL, temp);
+ SZipFree(nullptr, temp);
tempSize = len;
- temp = (UInt16 *)SZipAlloc(NULL, tempSize * sizeof(temp[0]));
- if (temp == 0)
+ temp = (UInt16 *)SZipAlloc(nullptr, tempSize * sizeof(temp[0]));
+ if (temp == nullptr)
{
return -1; // memory error
}
@@ -265,12 +265,12 @@ int _7z_search_crc_match(_7z_file *new_7z, UINT32 search_crc, const char* search
new_7z->uncompressed_length = size;
new_7z->crc = crc;
- SZipFree(NULL, temp);
+ SZipFree(nullptr, temp);
return i;
}
}
- SZipFree(NULL, temp);
+ SZipFree(nullptr, temp);
return -1;
}
@@ -288,7 +288,7 @@ _7z_error _7z_file_open(const char *filename, _7z_file **_7z)
SRes res;
/* ensure we start with a NULL result */
- *_7z = NULL;
+ *_7z = nullptr;
/* see if we are in the cache, and reopen if so */
for (cachenum = 0; cachenum < ARRAY_LENGTH(_7z_cache); cachenum++)
@@ -296,17 +296,17 @@ _7z_error _7z_file_open(const char *filename, _7z_file **_7z)
_7z_file *cached = _7z_cache[cachenum];
/* if we have a valid entry and it matches our filename, use it and remove from the cache */
- if (cached != NULL && cached->filename != NULL && strcmp(filename, cached->filename) == 0)
+ if (cached != nullptr && cached->filename != nullptr && strcmp(filename, cached->filename) == 0)
{
*_7z = cached;
- _7z_cache[cachenum] = NULL;
+ _7z_cache[cachenum] = nullptr;
return _7ZERR_NONE;
}
}
/* allocate memory for the _7z_file structure */
new_7z = (_7z_file *)malloc(sizeof(*new_7z));
- if (new_7z == NULL)
+ if (new_7z == nullptr)
return _7ZERR_OUT_OF_MEMORY;
memset(new_7z, 0, sizeof(*new_7z));
@@ -350,12 +350,12 @@ _7z_error _7z_file_open(const char *filename, _7z_file **_7z)
}
new_7z->blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
- new_7z->outBuffer = 0; /* it must be 0 before first call for each new archive. */
+ new_7z->outBuffer = nullptr; /* it must be 0 before first call for each new archive. */
new_7z->outBufferSize = 0; /* it can have any value before first call (if outBuffer = 0) */
/* make a copy of the filename for caching purposes */
string = (char *)malloc(strlen(filename) + 1);
- if (string == NULL)
+ if (string == nullptr)
{
_7zerr = _7ZERR_OUT_OF_MEMORY;
goto error;
@@ -381,13 +381,13 @@ void _7z_file_close(_7z_file *_7z)
int cachenum;
/* close the open files */
- if (_7z->archiveStream.file._7z_osdfile != NULL)
+ if (_7z->archiveStream.file._7z_osdfile != nullptr)
osd_close(_7z->archiveStream.file._7z_osdfile);
- _7z->archiveStream.file._7z_osdfile = NULL;
+ _7z->archiveStream.file._7z_osdfile = nullptr;
/* find the first NULL entry in the cache */
for (cachenum = 0; cachenum < ARRAY_LENGTH(_7z_cache); cachenum++)
- if (_7z_cache[cachenum] == NULL)
+ if (_7z_cache[cachenum] == nullptr)
break;
/* if no room left in the cache, free the bottommost entry */
@@ -412,10 +412,10 @@ void _7z_file_cache_clear(void)
/* clear call cache entries */
for (cachenum = 0; cachenum < ARRAY_LENGTH(_7z_cache); cachenum++)
- if (_7z_cache[cachenum] != NULL)
+ if (_7z_cache[cachenum] != nullptr)
{
free__7z_file(_7z_cache[cachenum]);
- _7z_cache[cachenum] = NULL;
+ _7z_cache[cachenum] = nullptr;
}
}
@@ -432,7 +432,7 @@ _7z_error _7z_file_decompress(_7z_file *new_7z, void *buffer, UINT32 length)
int index = new_7z->curr_file_idx;
/* make sure the file is open.. */
- if (new_7z->archiveStream.file._7z_osdfile==NULL)
+ if (new_7z->archiveStream.file._7z_osdfile==nullptr)
{
new_7z->archiveStream.file._7z_currfpos = 0;
err = osd_open(new_7z->filename, OPEN_FLAG_READ, &new_7z->archiveStream.file._7z_osdfile, &new_7z->archiveStream.file._7z_length);
@@ -477,11 +477,11 @@ _7z_error _7z_file_decompress(_7z_file *new_7z, void *buffer, UINT32 length)
static void free__7z_file(_7z_file *_7z)
{
- if (_7z != NULL)
+ if (_7z != nullptr)
{
- if (_7z->archiveStream.file._7z_osdfile != NULL)
+ if (_7z->archiveStream.file._7z_osdfile != nullptr)
osd_close(_7z->archiveStream.file._7z_osdfile);
- if (_7z->filename != NULL)
+ if (_7z->filename != nullptr)
free((void *)_7z->filename);
diff --git a/src/lib/util/unicode.cpp b/src/lib/util/unicode.cpp
index 5f375337b34..e2c3956cedb 100644
--- a/src/lib/util/unicode.cpp
+++ b/src/lib/util/unicode.cpp
@@ -34,7 +34,7 @@ int uchar_from_utf8(unicode_char *uchar, const char *utf8char, size_t count)
char auxchar;
/* validate parameters */
- if (utf8char == NULL || count == 0)
+ if (utf8char == nullptr || count == 0)
return 0;
/* start with the first byte */
@@ -127,7 +127,7 @@ int uchar_from_utf16(unicode_char *uchar, const utf16_char *utf16char, size_t co
int rc = -1;
/* validate parameters */
- if (utf16char == NULL || count == 0)
+ if (utf16char == nullptr || count == 0)
return 0;
/* handle the two-byte case */
diff --git a/src/lib/util/unzip.cpp b/src/lib/util/unzip.cpp
index 21e137b9f24..876d8ae90c5 100644
--- a/src/lib/util/unzip.cpp
+++ b/src/lib/util/unzip.cpp
@@ -99,7 +99,7 @@
***************************************************************************/
/**
- * @fn INLINE UINT16 read_word(UINT8 *buf)
+ * @fn static inline UINT16 read_word(UINT8 *buf)
*
* @brief Reads a word.
*
@@ -108,13 +108,13 @@
* @return The word.
*/
-INLINE UINT16 read_word(UINT8 *buf)
+static inline UINT16 read_word(UINT8 *buf)
{
return (buf[1] << 8) | buf[0];
}
/**
- * @fn INLINE UINT32 read_dword(UINT8 *buf)
+ * @fn static inline UINT32 read_dword(UINT8 *buf)
*
* @brief Reads a double word.
*
@@ -123,7 +123,7 @@ INLINE UINT16 read_word(UINT8 *buf)
* @return The double word.
*/
-INLINE UINT32 read_dword(UINT8 *buf)
+static inline UINT32 read_dword(UINT8 *buf)
{
return (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
}
@@ -185,7 +185,7 @@ zip_error zip_file_open(const char *filename, zip_file **zip)
int cachenum;
/* ensure we start with a NULL result */
- *zip = NULL;
+ *zip = nullptr;
/* see if we are in the cache, and reopen if so */
for (cachenum = 0; cachenum < ARRAY_LENGTH(zip_cache); cachenum++)
@@ -193,17 +193,17 @@ zip_error zip_file_open(const char *filename, zip_file **zip)
zip_file *cached = zip_cache[cachenum];
/* if we have a valid entry and it matches our filename, use it and remove from the cache */
- if (cached != NULL && cached->filename != NULL && strcmp(filename, cached->filename) == 0)
+ if (cached != nullptr && cached->filename != nullptr && strcmp(filename, cached->filename) == 0)
{
*zip = cached;
- zip_cache[cachenum] = NULL;
+ zip_cache[cachenum] = nullptr;
return ZIPERR_NONE;
}
}
/* allocate memory for the zip_file structure */
newzip = (zip_file *)malloc(sizeof(*newzip));
- if (newzip == NULL)
+ if (newzip == nullptr)
return ZIPERR_OUT_OF_MEMORY;
memset(newzip, 0, sizeof(*newzip));
@@ -229,7 +229,7 @@ zip_error zip_file_open(const char *filename, zip_file **zip)
/* allocate memory for the central directory */
newzip->cd = (UINT8 *)malloc(newzip->ecd.cd_size + 1);
- if (newzip->cd == NULL)
+ if (newzip->cd == nullptr)
{
ziperr = ZIPERR_OUT_OF_MEMORY;
goto error;
@@ -245,7 +245,7 @@ zip_error zip_file_open(const char *filename, zip_file **zip)
/* make a copy of the filename for caching purposes */
string = (char *)malloc(strlen(filename) + 1);
- if (string == NULL)
+ if (string == nullptr)
{
ziperr = ZIPERR_OUT_OF_MEMORY;
goto error;
@@ -279,13 +279,13 @@ void zip_file_close(zip_file *zip)
int cachenum;
/* close the open files */
- if (zip->file != NULL)
+ if (zip->file != nullptr)
osd_close(zip->file);
- zip->file = NULL;
+ zip->file = nullptr;
/* find the first NULL entry in the cache */
for (cachenum = 0; cachenum < ARRAY_LENGTH(zip_cache); cachenum++)
- if (zip_cache[cachenum] == NULL)
+ if (zip_cache[cachenum] == nullptr)
break;
/* if no room left in the cache, free the bottommost entry */
@@ -316,10 +316,10 @@ void zip_file_cache_clear(void)
/* clear call cache entries */
for (cachenum = 0; cachenum < ARRAY_LENGTH(zip_cache); cachenum++)
- if (zip_cache[cachenum] != NULL)
+ if (zip_cache[cachenum] != nullptr)
{
free_zip_file(zip_cache[cachenum]);
- zip_cache[cachenum] = NULL;
+ zip_cache[cachenum] = nullptr;
}
}
@@ -370,15 +370,15 @@ const zip_file_header *zip_file_first_file(zip_file *zip)
const zip_file_header *zip_file_next_file(zip_file *zip)
{
/* fix up any modified data */
- if (zip->header.raw != NULL)
+ if (zip->header.raw != nullptr)
{
zip->header.raw[ZIPCFN + zip->header.filename_length] = zip->header.saved;
- zip->header.raw = NULL;
+ zip->header.raw = nullptr;
}
/* if we're at or past the end, we're done */
if (zip->cd_pos >= zip->ecd.cd_size)
- return NULL;
+ return nullptr;
/* extract file header info */
zip->header.raw = zip->cd + zip->cd_pos;
@@ -407,7 +407,7 @@ const zip_file_header *zip_file_next_file(zip_file *zip)
zip->header.rawlength += zip->header.extra_field_length;
zip->header.rawlength += zip->header.file_comment_length;
if (zip->cd_pos + zip->header.rawlength > zip->ecd.cd_size)
- return NULL;
+ return nullptr;
/* NULL terminate the filename */
zip->header.saved = zip->header.raw[ZIPCFN + zip->header.filename_length];
@@ -493,15 +493,15 @@ zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length)
static void free_zip_file(zip_file *zip)
{
- if (zip != NULL)
+ if (zip != nullptr)
{
- if (zip->file != NULL)
+ if (zip->file != nullptr)
osd_close(zip->file);
- if (zip->filename != NULL)
+ if (zip->filename != nullptr)
free((void *)zip->filename);
- if (zip->ecd.raw != NULL)
+ if (zip->ecd.raw != nullptr)
free(zip->ecd.raw);
- if (zip->cd != NULL)
+ if (zip->cd != nullptr)
free(zip->cd);
free(zip);
}
@@ -545,7 +545,7 @@ static zip_error read_ecd(zip_file *zip)
/* allocate buffer */
buffer = (UINT8 *)malloc(buflen + 1);
- if (buffer == NULL)
+ if (buffer == nullptr)
return ZIPERR_OUT_OF_MEMORY;
/* read in one buffers' worth of data */
@@ -618,7 +618,7 @@ static zip_error get_compressed_data_offset(zip_file *zip, UINT64 *offset)
UINT32 read_length;
/* make sure the file handle is open */
- if (zip->file == NULL)
+ if (zip->file == nullptr)
{
int filerr = osd_open(zip->filename, OPEN_FLAG_READ, &zip->file, &zip->length);
if (filerr != FILERR_NONE)
diff --git a/src/lib/util/vbiparse.cpp b/src/lib/util/vbiparse.cpp
index 9c6c39fc4ea..ff523ee4265 100644
--- a/src/lib/util/vbiparse.cpp
+++ b/src/lib/util/vbiparse.cpp
@@ -398,7 +398,7 @@ void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi)
void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source)
{
- if (framenum != NULL)
+ if (framenum != nullptr)
*framenum = (source[0] << 16) | (source[1] << 8) | source[2];
vbi->white = source[3];
vbi->line16 = (source[4] << 16) | (source[5] << 8) | source[6];
diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp
index cb674abfa2b..620f12a66b3 100644
--- a/src/lib/util/xmlfile.cpp
+++ b/src/lib/util/xmlfile.cpp
@@ -71,12 +71,12 @@ static const char *copystring(const char *input)
char *newstr;
/* NULL just passes through */
- if (input == NULL)
- return NULL;
+ if (input == nullptr)
+ return nullptr;
/* make a lower-case copy if the allocation worked */
newstr = (char *)malloc(strlen(input) + 1);
- if (newstr != NULL)
+ if (newstr != nullptr)
strcpy(newstr, input);
return newstr;
@@ -95,12 +95,12 @@ static const char *copystring_lower(const char *input)
int i;
/* NULL just passes through */
- if (input == NULL)
- return NULL;
+ if (input == nullptr)
+ return nullptr;
/* make a lower-case copy if the allocation worked */
newstr = (char *)malloc(strlen(input) + 1);
- if (newstr != NULL)
+ if (newstr != nullptr)
{
for (i = 0; input[i] != 0; i++)
newstr[i] = tolower((UINT8)input[i]);
@@ -127,8 +127,8 @@ xml_data_node *xml_file_create(void)
/* create a root node */
rootnode = (xml_data_node *)malloc(sizeof(*rootnode));
- if (rootnode == NULL)
- return NULL;
+ if (rootnode == nullptr)
+ return nullptr;
memset(rootnode, 0, sizeof(*rootnode));
return rootnode;
}
@@ -146,7 +146,7 @@ xml_data_node *xml_file_read(core_file *file, xml_parse_options *opts)
/* set up the parser */
if (!expat_setup_parser(&parse_info, opts))
- return NULL;
+ return nullptr;
/* loop through the file and parse it */
do
@@ -160,7 +160,7 @@ xml_data_node *xml_file_read(core_file *file, xml_parse_options *opts)
/* parse the data */
if (XML_Parse(parse_info.parser, tempbuf, bytes, done) == XML_STATUS_ERROR)
{
- if (opts != NULL && opts->error != NULL)
+ if (opts != nullptr && opts->error != nullptr)
{
opts->error->error_message = XML_ErrorString(XML_GetErrorCode(parse_info.parser));
opts->error->error_line = XML_GetCurrentLineNumber(parse_info.parser);
@@ -169,7 +169,7 @@ xml_data_node *xml_file_read(core_file *file, xml_parse_options *opts)
xml_file_free(parse_info.rootnode);
XML_ParserFree(parse_info.parser);
- return NULL;
+ return nullptr;
}
} while (!done);
@@ -194,12 +194,12 @@ xml_data_node *xml_string_read(const char *string, xml_parse_options *opts)
/* set up the parser */
if (!expat_setup_parser(&parse_info, opts))
- return NULL;
+ return nullptr;
/* parse the data */
if (XML_Parse(parse_info.parser, string, length, TRUE) == XML_STATUS_ERROR)
{
- if (opts != NULL && opts->error != NULL)
+ if (opts != nullptr && opts->error != nullptr)
{
opts->error->error_message = XML_ErrorString(XML_GetErrorCode(parse_info.parser));
opts->error->error_line = XML_GetCurrentLineNumber(parse_info.parser);
@@ -208,7 +208,7 @@ xml_data_node *xml_string_read(const char *string, xml_parse_options *opts)
xml_file_free(parse_info.rootnode);
XML_ParserFree(parse_info.parser);
- return NULL;
+ return nullptr;
}
/* free the parser */
@@ -226,7 +226,7 @@ xml_data_node *xml_string_read(const char *string, xml_parse_options *opts)
void xml_file_write(xml_data_node *node, core_file *file)
{
/* ensure this is a root node */
- if (node->name != NULL)
+ if (node->name != nullptr)
return;
/* output a simple header */
@@ -246,7 +246,7 @@ void xml_file_write(xml_data_node *node, core_file *file)
void xml_file_free(xml_data_node *node)
{
/* ensure this is a root node */
- if (node->name != NULL)
+ if (node->name != nullptr)
return;
free_node_recursive(node);
@@ -285,7 +285,7 @@ xml_data_node *xml_get_sibling(xml_data_node *node, const char *name)
for ( ; node; node = node->next)
if (strcmp(node->name, name) == 0)
return node;
- return NULL;
+ return nullptr;
}
@@ -301,15 +301,15 @@ xml_data_node *xml_find_matching_sibling(xml_data_node *node, const char *name,
for ( ; node; node = node->next)
{
/* can pass NULL as a wildcard for the node name */
- if (name == NULL || strcmp(name, node->name) == 0)
+ if (name == nullptr || strcmp(name, node->name) == 0)
{
/* find a matching attribute */
xml_attribute_node *attr = xml_get_attribute(node, attribute);
- if (attr != NULL && strcmp(attr->value, matchval) == 0)
+ if (attr != nullptr && strcmp(attr->value, matchval) == 0)
return node;
}
}
- return NULL;
+ return nullptr;
}
@@ -336,7 +336,7 @@ xml_data_node *xml_get_or_add_child(xml_data_node *node, const char *name, const
/* find the child first */
child = xml_get_sibling(node->child, name);
- if (child != NULL)
+ if (child != nullptr)
return child;
/* if not found, do a standard add child */
@@ -384,7 +384,7 @@ xml_attribute_node *xml_get_attribute(xml_data_node *node, const char *attribute
for (anode = node->attribute; anode; anode = anode->next)
if (strcmp(anode->name, attribute) == 0)
return anode;
- return NULL;
+ return nullptr;
}
@@ -409,11 +409,11 @@ const char *xml_get_attribute_string(xml_data_node *node, const char *attribute,
int xml_get_attribute_int(xml_data_node *node, const char *attribute, int defvalue)
{
- const char *string = xml_get_attribute_string(node, attribute, NULL);
+ const char *string = xml_get_attribute_string(node, attribute, nullptr);
int value;
unsigned int uvalue;
- if (string == NULL)
+ if (string == nullptr)
return defvalue;
if (string[0] == '$')
return (sscanf(&string[1], "%X", &uvalue) == 1) ? uvalue : defvalue;
@@ -432,9 +432,9 @@ int xml_get_attribute_int(xml_data_node *node, const char *attribute, int defval
int xml_get_attribute_int_format(xml_data_node *node, const char *attribute)
{
- const char *string = xml_get_attribute_string(node, attribute, NULL);
+ const char *string = xml_get_attribute_string(node, attribute, nullptr);
- if (string == NULL)
+ if (string == nullptr)
return XML_INT_FORMAT_DECIMAL;
if (string[0] == '$')
return XML_INT_FORMAT_HEX_DOLLAR;
@@ -466,10 +466,10 @@ int xml_get_attribute_int_format(xml_data_node *node, const char *attribute)
float xml_get_attribute_float(xml_data_node *node, const char *attribute, float defvalue)
{
- const char *string = xml_get_attribute_string(node, attribute, NULL);
+ const char *string = xml_get_attribute_string(node, attribute, nullptr);
float value;
- if (string == NULL || sscanf(string, "%f", &value) != 1)
+ if (string == nullptr || sscanf(string, "%f", &value) != 1)
return defvalue;
return value;
}
@@ -500,9 +500,9 @@ xml_attribute_node *xml_set_attribute(xml_data_node *node, const char *name, con
anode = xml_get_attribute(node, name);
/* if we found it, free the old value and replace it */
- if (anode != NULL)
+ if (anode != nullptr)
{
- if (anode->value != NULL)
+ if (anode->value != nullptr)
free((void *)anode->value);
anode->value = copystring(value);
}
@@ -590,7 +590,7 @@ const char *xml_normalize_string(const char *string)
static char buffer[1024];
char *d = &buffer[0];
- if (string != NULL)
+ if (string != nullptr)
{
while (*string)
{
@@ -650,7 +650,7 @@ static void *expat_malloc(size_t size)
static void expat_free(void *ptr)
{
- if (ptr != NULL)
+ if (ptr != nullptr)
free(&((UINT32 *)ptr)[-4]);
}
@@ -668,9 +668,9 @@ static void expat_free(void *ptr)
static void *expat_realloc(void *ptr, size_t size)
{
void *newptr = expat_malloc(size);
- if (newptr == NULL)
- return NULL;
- if (ptr != NULL)
+ if (newptr == nullptr)
+ return nullptr;
+ if (ptr != nullptr)
{
UINT32 oldsize = ((UINT32 *)ptr)[-4];
memcpy(newptr, ptr, oldsize);
@@ -701,12 +701,12 @@ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opt
/* setup parse_info structure */
memset(parse_info, 0, sizeof(*parse_info));
- if (opts != NULL)
+ if (opts != nullptr)
{
parse_info->flags = opts->flags;
- if (opts->error != NULL)
+ if (opts->error != nullptr)
{
- opts->error->error_message = NULL;
+ opts->error->error_message = nullptr;
opts->error->error_line = 0;
opts->error->error_column = 0;
}
@@ -714,7 +714,7 @@ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opt
/* create a root node */
parse_info->rootnode = xml_file_create();
- if (parse_info->rootnode == NULL)
+ if (parse_info->rootnode == nullptr)
return FALSE;
parse_info->curnode = parse_info->rootnode;
@@ -722,8 +722,8 @@ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opt
memcallbacks.malloc_fcn = expat_malloc;
memcallbacks.realloc_fcn = expat_realloc;
memcallbacks.free_fcn = expat_free;
- parse_info->parser = XML_ParserCreate_MM(NULL, &memcallbacks, NULL);
- if (parse_info->parser == NULL)
+ parse_info->parser = XML_ParserCreate_MM(nullptr, &memcallbacks, nullptr);
+ if (parse_info->parser == nullptr)
{
free(parse_info->rootnode);
return FALSE;
@@ -735,7 +735,7 @@ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opt
XML_SetUserData(parse_info->parser, parse_info);
/* optional parser initialization step */
- if (opts != NULL && opts->init_parser != NULL)
+ if (opts != nullptr && opts->init_parser != nullptr)
(*opts->init_parser)(parse_info->parser);
return TRUE;
}
@@ -764,8 +764,8 @@ static void expat_element_start(void *data, const XML_Char *name, const XML_Char
int attr;
/* add a new child node to the current node */
- newnode = add_child(*curnode, name, NULL);
- if (newnode == NULL)
+ newnode = add_child(*curnode, name, nullptr);
+ if (newnode == nullptr)
return;
/* remember the line number */
@@ -807,14 +807,14 @@ static void expat_data(void *data, const XML_Char *s, int len)
return;
/* determine how much data we currently have */
- if ((*curnode)->value != NULL)
+ if ((*curnode)->value != nullptr)
oldlen = (int)strlen((*curnode)->value);
/* realloc */
newdata = (char *)malloc(oldlen + len + 1);
- if (newdata == NULL)
+ if (newdata == nullptr)
return;
- if ((*curnode)->value != NULL)
+ if ((*curnode)->value != nullptr)
{
memcpy(newdata, (*curnode)->value, oldlen);
free((void *)(*curnode)->value);
@@ -850,7 +850,7 @@ static void expat_element_end(void *data, const XML_Char *name)
/* strip leading/trailing spaces from the value data */
orig = (char *)(*curnode)->value;
- if (orig != NULL && !(parse_info->flags & XML_PARSE_FLAG_WHITESPACE_SIGNIFICANT))
+ if (orig != nullptr && !(parse_info->flags & XML_PARSE_FLAG_WHITESPACE_SIGNIFICANT))
{
char *start = orig;
char *end = start + strlen(start);
@@ -867,7 +867,7 @@ static void expat_element_end(void *data, const XML_Char *name)
if (start == end)
{
free(orig);
- (*curnode)->value = NULL;
+ (*curnode)->value = nullptr;
}
/* otherwise, memmove the data */
@@ -911,27 +911,27 @@ static xml_data_node *add_child(xml_data_node *parent, const char *name, const c
/* new element: create a new node */
node = (xml_data_node *)malloc(sizeof(*node));
- if (node == NULL)
- return NULL;
+ if (node == nullptr)
+ return nullptr;
/* initialize the members */
- node->next = NULL;
+ node->next = nullptr;
node->parent = parent;
- node->child = NULL;
+ node->child = nullptr;
node->name = copystring_lower(name);
- if (node->name == NULL)
+ if (node->name == nullptr)
{
free(node);
- return NULL;
+ return nullptr;
}
node->value = copystring(value);
- if (node->value == NULL && value != NULL)
+ if (node->value == nullptr && value != nullptr)
{
free((void *)node->name);
free(node);
- return NULL;
+ return nullptr;
}
- node->attribute = NULL;
+ node->attribute = nullptr;
/* add us to the end of the list of siblings */
for (pnode = &parent->child; *pnode; pnode = &(*pnode)->next) ;
@@ -964,23 +964,23 @@ static xml_attribute_node *add_attribute(xml_data_node *node, const char *name,
/* allocate a new attribute node */
anode = (xml_attribute_node *)malloc(sizeof(*anode));
- if (anode == NULL)
- return NULL;
+ if (anode == nullptr)
+ return nullptr;
/* fill it in */
- anode->next = NULL;
+ anode->next = nullptr;
anode->name = copystring_lower(name);
- if (anode->name == NULL)
+ if (anode->name == nullptr)
{
free(anode);
- return NULL;
+ return nullptr;
}
anode->value = copystring(value);
- if (anode->value == NULL)
+ if (anode->value == nullptr)
{
free((void *)anode->name);
free(anode);
- return NULL;
+ return nullptr;
}
/* add us to the end of the list of attributes */
@@ -1024,7 +1024,7 @@ static void write_node_recursive(xml_data_node *node, int indent, core_file *fil
core_fprintf(file, " %s=\"%s\"", anode->name, anode->value);
/* if there are no children and no value, end the tag here */
- if (node->child == NULL && node->value == NULL)
+ if (node->child == nullptr && node->value == nullptr)
core_fprintf(file, " />\n");
/* otherwise, close this tag and output more stuff */
@@ -1033,11 +1033,11 @@ static void write_node_recursive(xml_data_node *node, int indent, core_file *fil
core_fprintf(file, ">\n");
/* if there is a value, output that here */
- if (node->value != NULL)
+ if (node->value != nullptr)
core_fprintf(file, "%*s%s\n", indent + 4, "", node->value);
/* loop over children and output them as well */
- if (node->child != NULL)
+ if (node->child != nullptr)
{
for (child = node->child; child; child = child->next)
write_node_recursive(child, indent + 4, file);
@@ -1068,18 +1068,18 @@ static void free_node_recursive(xml_data_node *node)
xml_data_node *child, *nchild;
/* free name/value */
- if (node->name != NULL)
+ if (node->name != nullptr)
free((void *)node->name);
- if (node->value != NULL)
+ if (node->value != nullptr)
free((void *)node->value);
/* free attributes */
for (anode = node->attribute; anode; anode = nanode)
{
/* free name/value */
- if (anode->name != NULL)
+ if (anode->name != nullptr)
free((void *)anode->name);
- if (anode->value != NULL)
+ if (anode->value != nullptr)
free((void *)anode->value);
/* note the next node and free this node */
diff --git a/src/lib/util/zippath.cpp b/src/lib/util/zippath.cpp
index 36c9470ed92..84674eb1fe2 100644
--- a/src/lib/util/zippath.cpp
+++ b/src/lib/util/zippath.cpp
@@ -47,10 +47,10 @@ class zippath_directory
public:
zippath_directory()
: returned_parent(false),
- directory(NULL),
+ directory(nullptr),
called_zip_first(false),
- zipfile(NULL),
- returned_dirlist(NULL) { }
+ zipfile(nullptr),
+ returned_dirlist(nullptr) { }
/* common */
/** @brief true to returned parent. */
@@ -130,7 +130,7 @@ static void parse_parent_path(const char *path, int *beginpos, int *endpos)
pos--;
/* return endpos */
- if (endpos != NULL)
+ if (endpos != nullptr)
*endpos = pos;
/* now skip until we find a path separator */
@@ -138,7 +138,7 @@ static void parse_parent_path(const char *path, int *beginpos, int *endpos)
pos--;
/* return beginpos */
- if (beginpos != NULL)
+ if (beginpos != nullptr)
*beginpos = pos;
}
@@ -162,7 +162,7 @@ static void parse_parent_path(const char *path, int *beginpos, int *endpos)
std::string &zippath_parent(std::string &dst, const char *path)
{
int pos;
- parse_parent_path(path, &pos, NULL);
+ parse_parent_path(path, &pos, nullptr);
/* return the result */
if (pos >= 0) {
@@ -316,7 +316,7 @@ static file_error create_core_file_from_zip(zip_file *zip, const zip_file_header
void *ptr;
ptr = malloc(header->uncompressed_length);
- if (ptr == NULL)
+ if (ptr == nullptr)
{
filerr = FILERR_OUT_OF_MEMORY;
goto done;
@@ -334,7 +334,7 @@ static file_error create_core_file_from_zip(zip_file *zip, const zip_file_header
goto done;
done:
- if (ptr != NULL)
+ if (ptr != nullptr)
free(ptr);
return filerr;
}
@@ -361,19 +361,19 @@ file_error zippath_fopen(const char *filename, UINT32 openflags, core_file *&fil
{
file_error filerr = FILERR_NOT_FOUND;
zip_error ziperr;
- zip_file *zip = NULL;
+ zip_file *zip = nullptr;
const zip_file_header *header;
osd_dir_entry_type entry_type;
- char *alloc_fullpath = NULL;
+ char *alloc_fullpath = nullptr;
int len;
/* first, set up the two types of paths */
std::string mainpath(filename);
std::string subpath;
- file = NULL;
+ file = nullptr;
/* loop through */
- while((file == NULL) && (mainpath.length() > 0)
+ while((file == nullptr) && (mainpath.length() > 0)
&& ((openflags == OPEN_FLAG_READ) || (subpath.length() == 0)))
{
/* is the mainpath a ZIP path? */
@@ -395,7 +395,7 @@ file_error zippath_fopen(const char *filename, UINT32 openflags, core_file *&fil
else
header = zip_file_first_file(zip);
- if (header == NULL)
+ if (header == nullptr)
{
filerr = FILERR_NOT_FOUND;
goto done;
@@ -470,9 +470,9 @@ done:
}
}
- if (zip != NULL)
+ if (zip != nullptr)
zip_file_close(zip);
- if (alloc_fullpath != NULL)
+ if (alloc_fullpath != nullptr)
osd_free(alloc_fullpath);
return filerr;
}
@@ -531,7 +531,7 @@ static int is_root(const char *path)
static int is_7z_file(const char *path)
{
const char *s = strrchr(path, '.');
- return (s != NULL) && !core_stricmp(s, ".7z");
+ return (s != nullptr) && !core_stricmp(s, ".7z");
}
@@ -553,7 +553,7 @@ static int is_7z_file(const char *path)
static int is_zip_file(const char *path)
{
const char *s = strrchr(path, '.');
- return (s != NULL) && !core_stricmp(s, ".zip");
+ return (s != nullptr) && !core_stricmp(s, ".zip");
}
@@ -678,12 +678,12 @@ static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const cha
char c1, c2, last_char;
const zip_file_header *header;
- for (header = zip_file_first_file(zipfile); header != NULL; header = zip_file_next_file(zipfile))
+ for (header = zip_file_first_file(zipfile); header != nullptr; header = zip_file_next_file(zipfile))
{
/* special case */
- if (subpath == NULL)
+ if (subpath == nullptr)
{
- if (type != NULL)
+ if (type != nullptr)
*type = ENTTYPE_FILE;
return header;
}
@@ -700,22 +700,22 @@ static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const cha
{
if (c1 == '\0')
{
- if (type != NULL)
+ if (type != nullptr)
*type = ENTTYPE_FILE;
return header;
}
else if ((last_char == '/') || (c1 == '/'))
{
- if (type != NULL)
+ if (type != nullptr)
*type = ENTTYPE_DIR;
return header;
}
}
}
- if (type != NULL)
+ if (type != nullptr)
*type = ENTTYPE_NONE;
- return NULL;
+ return nullptr;
}
@@ -741,7 +741,7 @@ static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const cha
static file_error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, zip_file *&zipfile, std::string &newpath)
{
file_error err;
- osd_directory_entry *current_entry = NULL;
+ osd_directory_entry *current_entry = nullptr;
osd_dir_entry_type current_entry_type;
int went_up = FALSE;
int i;
@@ -750,7 +750,7 @@ static file_error zippath_resolve(const char *path, osd_dir_entry_type &entry_ty
/* be conservative */
entry_type = ENTTYPE_NONE;
- zipfile = NULL;
+ zipfile = nullptr;
std::string apath(path);
std::string apath_trimmed;
@@ -767,12 +767,12 @@ static file_error zippath_resolve(const char *path, osd_dir_entry_type &entry_ty
current_entry = osd_stat(apath_trimmed.c_str());
/* did we find anything? */
- if (current_entry != NULL)
+ if (current_entry != nullptr)
{
/* get the entry type and free the stat entry */
current_entry_type = current_entry->type;
osd_free(current_entry);
- current_entry = NULL;
+ current_entry = nullptr;
}
else
{
@@ -849,7 +849,7 @@ file_error zippath_opendir(const char *path, zippath_directory **directory)
file_error err;
/* allocate a directory */
- zippath_directory *result = NULL;
+ zippath_directory *result = nullptr;
try
{
result = new zippath_directory;
@@ -873,11 +873,11 @@ file_error zippath_opendir(const char *path, zippath_directory **directory)
}
/* was the result a ZIP? */
- if (result->zipfile == NULL)
+ if (result->zipfile == nullptr)
{
/* a conventional directory */
result->directory = osd_opendir(path);
- if (result->directory == NULL)
+ if (result->directory == nullptr)
{
err = FILERR_FAILURE;
goto done;
@@ -889,12 +889,12 @@ file_error zippath_opendir(const char *path, zippath_directory **directory)
}
done:
- if ((directory == NULL || err != FILERR_NONE) && result != NULL)
+ if ((directory == nullptr || err != FILERR_NONE) && result != nullptr)
{
zippath_closedir(result);
- result = NULL;
+ result = nullptr;
}
- if (directory != NULL)
+ if (directory != nullptr)
*directory = result;
return err;
}
@@ -914,13 +914,13 @@ done:
void zippath_closedir(zippath_directory *directory)
{
- if (directory->directory != NULL)
+ if (directory->directory != nullptr)
osd_closedir(directory->directory);
- if (directory->zipfile != NULL)
+ if (directory->zipfile != nullptr)
zip_file_close(directory->zipfile);
- while (directory->returned_dirlist != NULL)
+ while (directory->returned_dirlist != nullptr)
{
zippath_returned_directory *dirlist = directory->returned_dirlist;
directory->returned_dirlist = directory->returned_dirlist->next;
@@ -950,7 +950,7 @@ void zippath_closedir(zippath_directory *directory)
static const char *get_relative_path(zippath_directory *directory, const zip_file_header *header)
{
- const char *result = NULL;
+ const char *result = nullptr;
int len = directory->zipprefix.length();
if ((len <= strlen(header->filename))
@@ -981,7 +981,7 @@ static const char *get_relative_path(zippath_directory *directory, const zip_fil
const osd_directory_entry *zippath_readdir(zippath_directory *directory)
{
- const osd_directory_entry *result = NULL;
+ const osd_directory_entry *result = nullptr;
const zip_file_header *header;
const char *relpath;
const char *separator;
@@ -997,17 +997,17 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
directory->returned_entry.type = ENTTYPE_DIR;
result = &directory->returned_entry;
}
- else if (directory->directory != NULL)
+ else if (directory->directory != nullptr)
{
/* a normal directory read */
do
{
result = osd_readdir(directory->directory);
}
- while((result != NULL) && (!strcmp(result->name, ".") || !strcmp(result->name, "..")));
+ while((result != nullptr) && (!strcmp(result->name, ".") || !strcmp(result->name, "..")));
/* special case - is this entry a ZIP file? if so we need to return it as a "directory" */
- if ((result != NULL) && is_zip_file(result->name))
+ if ((result != nullptr) && is_zip_file(result->name))
{
/* copy; but change the entry type */
directory->returned_entry = *result;
@@ -1015,7 +1015,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
result = &directory->returned_entry;
}
}
- else if (directory->zipfile != NULL)
+ else if (directory->zipfile != nullptr)
{
do
{
@@ -1027,27 +1027,27 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
else
header = zip_file_next_file(directory->zipfile);
directory->called_zip_first = true;
- relpath = NULL;
+ relpath = nullptr;
}
- while((header != NULL) && ((relpath = get_relative_path(directory, header)) == NULL));
+ while((header != nullptr) && ((relpath = get_relative_path(directory, header)) == nullptr));
- if (relpath != NULL)
+ if (relpath != nullptr)
{
/* we've found a ZIP entry; but this may be an entry deep within the target directory */
for (s = relpath; *s && !is_zip_file_separator(*s); s++)
;
- separator = *s ? s : NULL;
+ separator = *s ? s : nullptr;
- if (separator != NULL)
+ if (separator != nullptr)
{
/* a nested entry; loop through returned_dirlist to see if we've returned the parent directory */
- for (rdent = directory->returned_dirlist; rdent != NULL; rdent = rdent->next)
+ for (rdent = directory->returned_dirlist; rdent != nullptr; rdent = rdent->next)
{
if (!core_strnicmp(rdent->name.c_str(), relpath, separator - relpath))
break;
}
- if (rdent == NULL)
+ if (rdent == nullptr)
{
/* we've found a new directory; add this to returned_dirlist */
rdent = new zippath_returned_directory;
@@ -1073,7 +1073,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
}
}
}
- while((relpath != NULL) && (result == NULL));
+ while((relpath != nullptr) && (result == nullptr));
}
return result;
}
@@ -1097,5 +1097,5 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
int zippath_is_zip(zippath_directory *directory)
{
- return directory->zipfile != NULL;
+ return directory->zipfile != nullptr;
}