From 7f8df68ae0d574e8d25f5d8aef507daa9d82c079 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Thu, 19 Nov 2015 19:49:59 -0800 Subject: ap2_dsk.c: support 36-track Apple II NIB images [Peter Ferrie] --- src/lib/formats/ap2_dsk.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib/formats/ap2_dsk.cpp') diff --git a/src/lib/formats/ap2_dsk.cpp b/src/lib/formats/ap2_dsk.cpp index 885332882f9..05a1927015a 100644 --- a/src/lib/formats/ap2_dsk.cpp +++ b/src/lib/formats/ap2_dsk.cpp @@ -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; -- cgit v1.2.3-70-g09d2 From 5a2f80dcde2e76356bf568f1e2d71b054a7db45b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 4 Dec 2015 07:06:18 +0100 Subject: clang-modernize part 5 --- src/emu/devdelegate.h | 2 +- src/emu/devfind.h | 2 +- src/emu/save.h | 2 +- src/emu/screen.h | 2 +- src/emu/sound/filter.cpp | 4 +- src/emu/sprite.h | 2 +- src/lib/formats/a26_cas.cpp | 4 +- src/lib/formats/ace_tap.cpp | 4 +- src/lib/formats/adam_cas.cpp | 2 +- src/lib/formats/ap2_dsk.cpp | 14 +- src/lib/formats/ap_dsk35.cpp | 18 +- src/lib/formats/apf_apt.cpp | 8 +- src/lib/formats/atari_dsk.cpp | 4 +- src/lib/formats/atom_tap.cpp | 2 +- src/lib/formats/basicdsk.cpp | 6 +- src/lib/formats/camplynx_cas.cpp | 6 +- src/lib/formats/cassimg.cpp | 20 +-- src/lib/formats/cbm_tap.cpp | 10 +- src/lib/formats/ccvf_dsk.cpp | 2 +- src/lib/formats/cgen_cas.cpp | 4 +- src/lib/formats/coco_cas.cpp | 4 +- src/lib/formats/cqm_dsk.cpp | 2 +- src/lib/formats/csw_cas.cpp | 14 +- src/lib/formats/d88_dsk.cpp | 4 +- src/lib/formats/dsk_dsk.cpp | 6 +- src/lib/formats/fc100_cas.cpp | 4 +- src/lib/formats/flopimg.cpp | 36 ++-- src/lib/formats/fm7_cas.cpp | 4 +- src/lib/formats/fmsx_cas.cpp | 2 +- src/lib/formats/gtp_cas.cpp | 8 +- src/lib/formats/hect_dsk.cpp | 6 +- src/lib/formats/hect_tap.cpp | 8 +- src/lib/formats/imageutl.cpp | 2 +- src/lib/formats/imd_dsk.cpp | 10 +- src/lib/formats/ioprocs.cpp | 4 +- src/lib/formats/ipf_dsk.cpp | 6 +- src/lib/formats/kc_cas.cpp | 12 +- src/lib/formats/kim1_cas.cpp | 4 +- src/lib/formats/lviv_lvt.cpp | 2 +- src/lib/formats/mbee_cas.cpp | 4 +- src/lib/formats/mfi_dsk.cpp | 4 +- src/lib/formats/mz_cas.cpp | 4 +- src/lib/formats/nes_dsk.cpp | 4 +- src/lib/formats/orao_cas.cpp | 8 +- src/lib/formats/oric_tap.cpp | 2 +- src/lib/formats/p6001_cas.cpp | 4 +- src/lib/formats/pasti_dsk.cpp | 6 +- src/lib/formats/pc_dsk.cpp | 2 +- src/lib/formats/phc25_cas.cpp | 4 +- src/lib/formats/pmd_cas.cpp | 4 +- src/lib/formats/primoptp.cpp | 2 +- src/lib/formats/rk_cas.cpp | 18 +- src/lib/formats/sc3000_bit.cpp | 2 +- src/lib/formats/sol_cas.cpp | 4 +- src/lib/formats/sorc_cas.cpp | 4 +- src/lib/formats/sorc_dsk.cpp | 4 +- src/lib/formats/sord_cas.cpp | 2 +- src/lib/formats/spc1000_cas.cpp | 8 +- src/lib/formats/svi_cas.cpp | 2 +- src/lib/formats/td0_dsk.cpp | 10 +- src/lib/formats/thom_cas.cpp | 12 +- src/lib/formats/thom_dsk.cpp | 14 +- src/lib/formats/trs_cas.cpp | 4 +- src/lib/formats/tvc_cas.cpp | 2 +- src/lib/formats/tzx_cas.cpp | 14 +- src/lib/formats/uef_cas.cpp | 18 +- src/lib/formats/vg5k_cas.cpp | 4 +- src/lib/formats/vt_cas.cpp | 8 +- src/lib/formats/x07_cas.cpp | 4 +- src/lib/formats/x1_tap.cpp | 2 +- src/lib/formats/zx81_p.cpp | 4 +- src/lib/util/chd.cpp | 2 +- src/lib/util/options.cpp | 2 +- src/lib/util/tagmap.h | 2 +- src/osd/modules/debugger/debugint.cpp | 104 +++++------ src/osd/modules/debugger/none.cpp | 2 +- src/osd/modules/debugger/win/debugbaseinfo.cpp | 4 +- src/osd/modules/debugger/win/debugwininfo.h | 2 +- src/osd/modules/debugger/win/disasmbasewininfo.cpp | 16 +- src/osd/modules/debugger/win/logwininfo.cpp | 4 +- src/osd/modules/lib/osdlib_win32.cpp | 4 +- src/osd/modules/lib/osdobj_common.h | 2 +- src/osd/modules/midi/portmidi.cpp | 6 +- src/osd/modules/osdmodule.cpp | 22 +-- src/osd/modules/render/d3d/d3d9intf.cpp | 28 +-- src/osd/modules/sync/sync_mini.cpp | 4 +- src/osd/modules/sync/sync_windows.cpp | 24 +-- src/osd/modules/sync/work_mini.cpp | 6 +- src/osd/osdcore.cpp | 2 +- src/osd/osdmini/minidir.cpp | 4 +- src/osd/osdmini/minifile.cpp | 18 +- src/osd/osdmini/minimain.cpp | 2 +- src/osd/osdmini/minimisc.cpp | 4 +- src/osd/osdnet.cpp | 6 +- src/osd/sdl/watchdog.cpp | 2 +- src/osd/windows/ledutil.cpp | 50 +++--- src/osd/windows/output.cpp | 26 +-- src/osd/windows/winsocket.cpp | 14 +- src/tools/castool.cpp | 8 +- src/tools/chdman.cpp | 194 ++++++++++---------- src/tools/floptool.cpp | 4 +- src/tools/imgtool/charconv.cpp | 8 +- src/tools/imgtool/filtbas.cpp | 88 ++++----- src/tools/imgtool/filteoln.cpp | 10 +- src/tools/imgtool/filter.cpp | 10 +- src/tools/imgtool/iflopimg.cpp | 12 +- src/tools/imgtool/imghd.cpp | 6 +- src/tools/imgtool/imgtool.cpp | 190 ++++++++++---------- src/tools/imgtool/library.cpp | 12 +- src/tools/imgtool/library.h | 6 +- src/tools/imgtool/main.cpp | 98 +++++----- src/tools/imgtool/modules.cpp | 12 +- src/tools/imgtool/stream.cpp | 44 ++--- src/tools/jedutil.cpp | 198 ++++++++++----------- src/tools/ldresample.cpp | 10 +- src/tools/ldverify.cpp | 14 +- src/tools/pngcmp.cpp | 12 +- src/tools/regrep.cpp | 86 ++++----- src/tools/romcmp.cpp | 24 +-- src/tools/split.cpp | 38 ++-- src/tools/src2html.cpp | 46 ++--- src/tools/srcclean.cpp | 6 +- src/tools/unidasm.cpp | 6 +- 123 files changed, 974 insertions(+), 974 deletions(-) (limited to 'src/lib/formats/ap2_dsk.cpp') diff --git a/src/emu/devdelegate.h b/src/emu/devdelegate.h index ca4eae7b236..ee8a361ceb9 100644 --- a/src/emu/devdelegate.h +++ b/src/emu/devdelegate.h @@ -65,7 +65,7 @@ public: template device_delegate(typename basetype::template traits<_FunctionClass>::member_func_type funcptr, const char *name, const char *devname, _FunctionClass *object) : basetype(funcptr, name, (_FunctionClass *)nullptr), device_delegate_helper(devname) { } #ifdef USE_STATIC_DELEGATE template device_delegate(typename basetype::template traits<_FunctionClass>::static_func_type funcptr, const char *name, const char *devname, _FunctionClass *object) : basetype(funcptr, name, (_FunctionClass *)0), device_delegate_helper(devname) { } - template device_delegate(typename basetype::template traits<_FunctionClass>::static_ref_func_type funcptr, const char *name, const char *devname, _FunctionClass *object) : basetype(funcptr, name, (_FunctionClass *)0), device_delegate_helper(devname) { } + template device_delegate(typename basetype::template traits<_FunctionClass>::static_ref_func_type funcptr, const char *name, const char *devname, _FunctionClass *object) : basetype(funcptr, name, (_FunctionClass *)nullptr), device_delegate_helper(devname) { } device_delegate(typename basetype::template traits::static_func_type funcptr, const char *name) : basetype(funcptr, name, (device_t *)nullptr), device_delegate_helper(NULL) { } device_delegate(typename basetype::template traits::static_ref_func_type funcptr, const char *name) : basetype(funcptr, name, (device_t *)nullptr), device_delegate_helper(NULL) { } #endif diff --git a/src/emu/devfind.h b/src/emu/devfind.h index d16d7649e89..16dd1f34911 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -336,7 +336,7 @@ public: { if (isvalidation) return true; this->m_target = reinterpret_cast<_PointerType *>(this->find_memregion(sizeof(_PointerType), m_length, _Required)); - return this->report_missing(this->m_target != NULL, "memory region", _Required); + return this->report_missing(this->m_target != nullptr, "memory region", _Required); } protected: diff --git a/src/emu/save.h b/src/emu/save.h index b82b46ca32f..b4c2c3c2186 100644 --- a/src/emu/save.h +++ b/src/emu/save.h @@ -150,7 +150,7 @@ public: template void save_item(_ItemType &value, const char *valname, int index = 0) { save_item(nullptr, "global", nullptr, index, value, valname); } template - void save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { save_pointer(NULL, "global", NULL, index, value, valname, count); } + void save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { save_pointer(nullptr, "global", nullptr, index, value, valname, count); } // file processing static save_error check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)); diff --git a/src/emu/screen.h b/src/emu/screen.h index 45caece012e..31487c7d4ea 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -457,7 +457,7 @@ typedef device_type_iterator<&device_creator, screen_device> scre template inline screen_update_ind16_delegate screen_update_delegate_smart(UINT32 (_FunctionClass::*callback)(screen_device &, bitmap_ind16 &, const rectangle &), const char *name, const char *devname) { - return screen_update_ind16_delegate(callback, name, devname, (_FunctionClass *)0); + return screen_update_ind16_delegate(callback, name, devname, (_FunctionClass *)nullptr); } template diff --git a/src/emu/sound/filter.cpp b/src/emu/sound/filter.cpp index 452dd8b3f1b..9473a8b720d 100644 --- a/src/emu/sound/filter.cpp +++ b/src/emu/sound/filter.cpp @@ -4,7 +4,7 @@ #include "filter.h" static filter* filter_alloc(void) { - auto f = global_alloc(filter); + auto f = global_alloc(filter); return f; } @@ -22,7 +22,7 @@ void filter_state_reset(filter* f, filter_state* s) { filter_state* filter_state_alloc(void) { int i; - auto s = global_alloc(filter_state); + auto s = global_alloc(filter_state); s->prev_mac = 0; for(i=0;ixprev[i] = 0; diff --git a/src/emu/sprite.h b/src/emu/sprite.h index eb8aaec71db..f10537f9900 100644 --- a/src/emu/sprite.h +++ b/src/emu/sprite.h @@ -89,7 +89,7 @@ protected: : device_t(mconfig, type, name, tag, owner, 0, shortname, file), m_xorigin(0), m_yorigin(0), - m_spriteram(NULL), + m_spriteram(nullptr), m_spriteram_bytes(0), m_dirty(dirty_granularity) { 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/ace_tap.cpp b/src/lib/formats/ace_tap.cpp index 3479d6ba1f5..10265ad5460 100644 --- a/src/lib/formats/ace_tap.cpp +++ b/src/lib/formats/ace_tap.cpp @@ -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..0e38b97c1a0 100644 --- a/src/lib/formats/adam_cas.cpp +++ b/src/lib/formats/adam_cas.cpp @@ -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/ap2_dsk.cpp b/src/lib/formats/ap2_dsk.cpp index 05a1927015a..cfc9b5350ef 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); } @@ -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]) diff --git a/src/lib/formats/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp index 9efd835120d..385ff326047 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]) 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/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_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/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/cassimg.cpp b/src/lib/formats/cassimg.cpp index 3154def299a..aabc13ee393 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 */ @@ -374,7 +374,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 +385,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 +763,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..5c3033f9dad 100644 --- a/src/lib/formats/cbm_tap.cpp +++ b/src/lib/formats/cbm_tap.cpp @@ -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/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/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/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/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/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/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/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/flopimg.cpp b/src/lib/formats/flopimg.cpp index e66df68cdbc..fa10ab3e4a9 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, §or_length, NULL); + err = fmt->get_indexed_sector_info(floppy, head, track, sector, nullptr, nullptr, nullptr, §or_length, nullptr); else err = fmt->get_sector_length(floppy, head, track, sector, §or_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]; } @@ -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() @@ -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/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/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 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/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..ade50a8e2f9 100644 --- a/src/lib/formats/ipf_dsk.cpp +++ b/src/lib/formats/ipf_dsk.cpp @@ -88,7 +88,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 +118,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/kc_cas.cpp b/src/lib/formats/kc_cas.cpp index 32d7901cad5..40e261aed7f 100644 --- a/src/lib/formats/kc_cas.cpp +++ b/src/lib/formats/kc_cas.cpp @@ -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..db4c4a95a0b 100644 --- a/src/lib/formats/kim1_cas.cpp +++ b/src/lib/formats/kim1_cas.cpp @@ -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/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> 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_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..f6ed1556711 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; 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/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/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/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/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/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/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/td0_dsk.cpp b/src/lib/formats/td0_dsk.cpp index 185bb21cfed..600a6868a4e 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; @@ -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/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/trs_cas.cpp b/src/lib/formats/trs_cas.cpp index a4f748dea05..5e205348768 100644 --- a/src/lib/formats/trs_cas.cpp +++ b/src/lib/formats/trs_cas.cpp @@ -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/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp index e210afff8b7..498de384e53 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) @@ -219,7 +219,7 @@ INLINE int tcycles_to_samplecount( int tcycles ) static void tzx_output_wave( INT16 **buffer, int length ) { - if (buffer == NULL) + if (buffer == nullptr) { return; } @@ -805,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; @@ -843,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; } @@ -936,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 = @@ -944,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 = @@ -952,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/vg5k_cas.cpp b/src/lib/formats/vg5k_cas.cpp index ef648707fd8..6c10112ab30 100644 --- a/src/lib/formats/vg5k_cas.cpp +++ b/src/lib/formats/vg5k_cas.cpp @@ -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/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/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/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/util/chd.cpp b/src/lib/util/chd.cpp index 9f1b79081c5..38881cc8d81 100644 --- a/src/lib/util/chd.cpp +++ b/src/lib/util/chd.cpp @@ -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? - auto 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); diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp index c644fef9657..0a8ace7d9f3 100644 --- a/src/lib/util/options.cpp +++ b/src/lib/util/options.cpp @@ -255,7 +255,7 @@ 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 - auto newentry = global_alloc(entry(name, description, flags, defvalue)); + auto newentry = global_alloc(entry(name, description, flags, defvalue)); if (newentry->name() != nullptr) { // see if we match an existing entry diff --git a/src/lib/util/tagmap.h b/src/lib/util/tagmap.h index 600cc230985..75a67ac67ef 100644 --- a/src/lib/util/tagmap.h +++ b/src/lib/util/tagmap.h @@ -327,7 +327,7 @@ tagmap_error tagmap_t<_ElementType, _HashSize>::add_common(const char *tag, _Ele } // now allocate a new entry and add to the head of the list - auto entry = global_alloc(entry_t(tag, fullhash, object)); + auto entry = global_alloc(entry_t(tag, fullhash, object)); entry->m_next = m_table[hashindex]; m_table[hashindex] = entry; return TMERR_NONE; diff --git a/src/osd/modules/debugger/debugint.cpp b/src/osd/modules/debugger/debugint.cpp index 2598f481ca6..49ae108e881 100644 --- a/src/osd/modules/debugger/debugint.cpp +++ b/src/osd/modules/debugger/debugint.cpp @@ -28,7 +28,7 @@ class debug_internal : public osd_module, public debug_module public: debug_internal() : osd_module(OSD_DEBUG_PROVIDER, "internal"), debug_module(), - m_machine(NULL) + m_machine(nullptr) { } @@ -150,7 +150,7 @@ class DView_edit DISABLE_COPYING(DView_edit); public: - DView_edit(): active(0), container(NULL) { } + DView_edit(): active(0), container(nullptr) { } ~DView_edit() { } int active; render_container * container; @@ -170,7 +170,7 @@ class DView public: DView(render_target *target, running_machine &machine, debug_view_type type, int flags) - : next(NULL), + : next(nullptr), type(0), state(0), ofs_x(0), @@ -205,7 +205,7 @@ public: machine().debug_view().free_view(*this->view); } - running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + running_machine &machine() const { assert(m_machine != nullptr); return *m_machine; } DView * next; @@ -259,11 +259,11 @@ INLINE void dview_set_state(DView *dv, int state, int onoff) LOCAL VARIABLES ***************************************************************************/ -static render_font * debug_font = NULL; +static render_font * debug_font = nullptr; static int debug_font_width; static int debug_font_height; static float debug_font_aspect; -static DView * list = NULL; +static DView * list = nullptr; static DView * focus_view; static ui_menu * menu; @@ -271,10 +271,10 @@ static DView_edit * cur_editor; static void set_focus_view(DView *dv) { - if (focus_view != NULL) + if (focus_view != nullptr) dview_set_state(focus_view, VIEW_STATE_NEEDS_UPDATE, TRUE); - if (dv != NULL) + if (dv != nullptr) dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); if (focus_view != dv) @@ -863,16 +863,16 @@ static void dview_update(debug_view &dw, void *osdprivate) void debug_internal::exit() { - for (DView *ndv = list; ndv != NULL; ) + for (DView *ndv = list; ndv != nullptr; ) { DView *temp = ndv; ndv = ndv->next; dview_free(temp); } - if (debug_font != NULL) + if (debug_font != nullptr) { m_machine->render().font_free(debug_font); - debug_font = NULL; + debug_font = nullptr; } if (menu) global_free(menu); @@ -889,10 +889,10 @@ void debug_internal::init_debugger(running_machine &machine) debug_font_width = 0; debug_font_height = 15; - menu = NULL; - cur_editor = NULL; - list = NULL; - focus_view = NULL; + menu = nullptr; + cur_editor = nullptr; + list = nullptr; + focus_view = nullptr; debug_font_aspect = m_machine->render().ui_aspect(); @@ -980,7 +980,7 @@ static void on_disasm_cpu_activate(DView *dv, const ui_menu_event *event) if (event->iptkey == IPT_UI_RIGHT) { current = current->next(); - if (current == NULL) + if (current == nullptr) current = dv->view->first_source(); dv->view->set_source(*current); dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); @@ -1111,7 +1111,7 @@ static void render_editor(DView_edit *editor) editor->container->empty(); /* get the size of the text */ editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL); + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(width, 0.5f); @@ -1131,7 +1131,7 @@ static void render_editor(DView_edit *editor) /* draw the text within it */ editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } @@ -1176,8 +1176,8 @@ static void CreateMainMenu(running_machine &machine) break; } - menu->item_append(title.append(focus_view->title).c_str(), NULL, MENU_FLAG_DISABLE, NULL); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + menu->item_append(title.append(focus_view->title).c_str(), nullptr, MENU_FLAG_DISABLE, nullptr); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); switch (focus_view->type) { @@ -1191,37 +1191,37 @@ static void CreateMainMenu(running_machine &machine) case DASM_RIGHTCOL_COMMENTS: subtext = "Comments"; break; } menu->item_append("View", subtext, MENU_FLAG_RIGHT_ARROW, (void *)on_view_opcodes_activate); - menu->item_append("Run to cursor", NULL, 0, (void *)on_run_to_cursor_activate); + menu->item_append("Run to cursor", nullptr, 0, (void *)on_run_to_cursor_activate); if (!dview_is_state(focus_view, VIEW_STATE_FOLLOW_CPU)) { menu->item_append("CPU", focus_view->view->source()->name(), MENU_FLAG_RIGHT_ARROW, (void *)on_disasm_cpu_activate); } - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); break; } } /* add input menu items */ - menu->item_append("New Memory Window", NULL, 0, (void *)on_memory_window_activate); - menu->item_append("New Disassembly Window", NULL, 0, (void *)on_disassembly_window_activate); - menu->item_append("New Error Log Window", NULL, 0, (void *)on_log_window_activate); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - menu->item_append("Run", NULL, 0, (void *)on_run_activate); - menu->item_append("Run to Next CPU", NULL, 0, (void *)on_run_cpu_activate); - menu->item_append("Run until Next Interrupt on This CPU", NULL, 0, (void *)on_run_irq_activate); - menu->item_append("Run until Next VBLANK", NULL, 0, (void *)on_run_vbl_activate); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - menu->item_append("Step Into", NULL, 0, (void *)on_step_into_activate); - menu->item_append("Step Over", NULL, 0, (void *)on_step_over_activate); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - menu->item_append("Soft Reset", NULL, 0, (void *)on_soft_reset_activate); - menu->item_append("Hard Reset", NULL, 0, (void *)on_hard_reset_activate); - menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + menu->item_append("New Memory Window", nullptr, 0, (void *)on_memory_window_activate); + menu->item_append("New Disassembly Window", nullptr, 0, (void *)on_disassembly_window_activate); + menu->item_append("New Error Log Window", nullptr, 0, (void *)on_log_window_activate); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + menu->item_append("Run", nullptr, 0, (void *)on_run_activate); + menu->item_append("Run to Next CPU", nullptr, 0, (void *)on_run_cpu_activate); + menu->item_append("Run until Next Interrupt on This CPU", nullptr, 0, (void *)on_run_irq_activate); + menu->item_append("Run until Next VBLANK", nullptr, 0, (void *)on_run_vbl_activate); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + menu->item_append("Step Into", nullptr, 0, (void *)on_step_into_activate); + menu->item_append("Step Over", nullptr, 0, (void *)on_step_over_activate); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + menu->item_append("Soft Reset", nullptr, 0, (void *)on_soft_reset_activate); + menu->item_append("Hard Reset", nullptr, 0, (void *)on_hard_reset_activate); + menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); if (!dview_is_state(focus_view, VIEW_STATE_FOLLOW_CPU)) - menu->item_append("Close Window", NULL, 0, (void *)on_close_activate); - menu->item_append("Exit", NULL, 0, (void *)on_exit_activate); + menu->item_append("Close Window", nullptr, 0, (void *)on_close_activate); + menu->item_append("Exit", nullptr, 0, (void *)on_exit_activate); } static int map_point(DView *dv, INT32 target_x, INT32 target_y, INT32 *mapped_x, INT32 *mapped_y) @@ -1254,16 +1254,16 @@ static void handle_mouse(running_machine &machine) INT32 x,y; bool button; - if (menu != NULL) + if (menu != nullptr) return; mouse_target = ui_input_find_mouse(machine, &x, &y, &button); - if (mouse_target == NULL) + if (mouse_target == nullptr) return; //printf("mouse %d %d %d\n", x, y, button); - for (DView *dv = list; dv != NULL; dv = dv->next) + for (DView *dv = list; dv != nullptr; dv = dv->next) { if (mouse_target == dv->target) { @@ -1313,17 +1313,17 @@ static void handle_editor(running_machine &machine) break; } } - if (cur_editor != NULL) + if (cur_editor != nullptr) { render_editor(cur_editor); if (ui_input_pressed(machine, IPT_UI_SELECT)) { process_string(focus_view, focus_view->editor.str.c_str()); focus_view->editor.str = ""; - cur_editor = NULL; + cur_editor = nullptr; } if (ui_input_pressed(machine, IPT_UI_CANCEL)) - cur_editor = NULL; + cur_editor = nullptr; } } @@ -1340,11 +1340,11 @@ static void handle_menus(running_machine &machine) machine.render().ui_container().empty(); ui_input_frame_update(machine); - if (menu != NULL) + if (menu != nullptr) { /* process the menu */ event = menu->process(0); - if (event != NULL && (event->iptkey == IPT_UI_SELECT || (event->iptkey == IPT_UI_RIGHT))) + if (event != nullptr && (event->iptkey == IPT_UI_SELECT || (event->iptkey == IPT_UI_RIGHT))) { //global_free(menu); //menu = NULL; @@ -1355,7 +1355,7 @@ static void handle_menus(running_machine &machine) else if (ui_input_pressed(machine, IPT_UI_CONFIGURE)) { global_free(menu); - menu = NULL; + menu = nullptr; } } else @@ -1378,7 +1378,7 @@ static void followers_set_cpu(device_t *device) { std::string title; - for (DView *dv = list; dv != NULL; dv = dv->next) + for (DView *dv = list; dv != nullptr; dv = dv->next) { if (dview_is_state(dv, VIEW_STATE_FOLLOW_CPU)) { @@ -1420,7 +1420,7 @@ static void update_views(void) DView *dv, *prev; LIST_GET_LAST(list, dv); - while (dv != NULL) + while (dv != nullptr) { dview_update_view(dv); LIST_GET_PREVIOUS(list, dv, prev); @@ -1431,7 +1431,7 @@ static void update_views(void) void debug_internal::wait_for_debugger(device_t &device, bool firststop) { - if (firststop && list == NULL) + if (firststop && list == nullptr) { render_target *target = &device.machine().render().ui_target(); @@ -1463,7 +1463,7 @@ void debug_internal::wait_for_debugger(device_t &device, bool firststop) void debug_internal::debugger_update() { - if ((m_machine != NULL) && (!debug_cpu_is_stopped(*m_machine)) && (m_machine->phase() == MACHINE_PHASE_RUNNING)) + if ((m_machine != nullptr) && (!debug_cpu_is_stopped(*m_machine)) && (m_machine->phase() == MACHINE_PHASE_RUNNING)) { update_views(); } diff --git a/src/osd/modules/debugger/none.cpp b/src/osd/modules/debugger/none.cpp index 48085afd089..f6b22a1883a 100644 --- a/src/osd/modules/debugger/none.cpp +++ b/src/osd/modules/debugger/none.cpp @@ -16,7 +16,7 @@ class debug_none : public osd_module, public debug_module public: debug_none() : osd_module(OSD_DEBUG_PROVIDER, "none"), debug_module(), - m_machine(NULL) + m_machine(nullptr) { } diff --git a/src/osd/modules/debugger/win/debugbaseinfo.cpp b/src/osd/modules/debugger/win/debugbaseinfo.cpp index 66824b9f029..9f53899affd 100644 --- a/src/osd/modules/debugger/win/debugbaseinfo.cpp +++ b/src/osd/modules/debugger/win/debugbaseinfo.cpp @@ -25,7 +25,7 @@ void debugbase_info::smart_set_window_bounds(HWND wnd, HWND parent, RECT const & // first get the current bounds, relative to the parent GetWindowRect(wnd, &curbounds); - if (parent != NULL) + if (parent != nullptr) { RECT parentbounds; GetWindowRect(parent, &parentbounds); @@ -44,7 +44,7 @@ void debugbase_info::smart_set_window_bounds(HWND wnd, HWND parent, RECT const & // if we need to, reposition the window if (flags != (SWP_NOMOVE | SWP_NOSIZE)) - SetWindowPos(wnd, NULL, + SetWindowPos(wnd, nullptr, bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | flags); diff --git a/src/osd/modules/debugger/win/debugwininfo.h b/src/osd/modules/debugger/win/debugwininfo.h index 78c088a5eef..08e08d79de9 100644 --- a/src/osd/modules/debugger/win/debugwininfo.h +++ b/src/osd/modules/debugger/win/debugwininfo.h @@ -24,7 +24,7 @@ public: debugwin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler); virtual ~debugwin_info(); - bool is_valid() const { return m_wnd != NULL; } + bool is_valid() const { return m_wnd != nullptr; } debugwin_info *next() const { return m_next; } void set_ignore_char_lparam(LPARAM value) { m_ignore_char_lparam = value >> 16; } diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.cpp b/src/osd/modules/debugger/win/disasmbasewininfo.cpp index 783cc8d75fa..f7f516ca24c 100644 --- a/src/osd/modules/debugger/win/disasmbasewininfo.cpp +++ b/src/osd/modules/debugger/win/disasmbasewininfo.cpp @@ -25,7 +25,7 @@ disasmbasewin_info::disasmbasewin_info(debugger_windows_interface &debugger, boo return; m_views[0].reset(global_alloc(disasmview_info(debugger, *this, window()))); - if ((m_views[0] == NULL) || !m_views[0]->is_valid()) + if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); return; @@ -115,10 +115,10 @@ void disasmbasewin_info::update_menu() // first find an existing breakpoint at this address device_debug::breakpoint *bp = debug->breakpoint_first(); - while ((bp != NULL) && (bp->address() != address)) + while ((bp != nullptr) && (bp->address() != address)) bp = bp->next(); - if (bp == NULL) + if (bp == nullptr) { ModifyMenu(menu, ID_TOGGLE_BREAKPOINT, MF_BYCOMMAND, ID_TOGGLE_BREAKPOINT, TEXT("Set breakpoint at cursor\tF9")); ModifyMenu(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND, ID_DISABLE_BREAKPOINT, TEXT("Disable breakpoint at cursor\tShift+F9")); @@ -131,7 +131,7 @@ void disasmbasewin_info::update_menu() else ModifyMenu(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND, ID_DISABLE_BREAKPOINT, TEXT("Enable breakpoint at cursor\tShift+F9")); } - bool const available = (bp != NULL) && (!is_main_console() || dasmview->source_is_visible_cpu()); + bool const available = (bp != nullptr) && (!is_main_console() || dasmview->source_is_visible_cpu()); EnableMenuItem(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND | (available ? MF_ENABLED : MF_GRAYED)); } else @@ -168,7 +168,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) INT32 bpindex = -1; // first find an existing breakpoint at this address - for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != NULL; bp = bp->next()) + for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != nullptr; bp = bp->next()) { if (address == bp->address()) { @@ -182,7 +182,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) { if (bpindex == -1) { - bpindex = debug->breakpoint_set(address, NULL, NULL); + bpindex = debug->breakpoint_set(address, nullptr, nullptr); debug_console_printf(machine(), "Breakpoint %X set\n", bpindex); } else @@ -213,11 +213,11 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) // first find an existing breakpoint at this address device_debug::breakpoint *bp = debug->breakpoint_first(); - while ((bp != NULL) && (bp->address() != address)) + while ((bp != nullptr) && (bp->address() != address)) bp = bp->next(); // if it doesn't exist, add a new one - if (bp != NULL) + if (bp != nullptr) { if (!is_main_console()) { diff --git a/src/osd/modules/debugger/win/logwininfo.cpp b/src/osd/modules/debugger/win/logwininfo.cpp index 6610e8a296f..2f631e199d3 100644 --- a/src/osd/modules/debugger/win/logwininfo.cpp +++ b/src/osd/modules/debugger/win/logwininfo.cpp @@ -12,13 +12,13 @@ logwin_info::logwin_info(debugger_windows_interface &debugger) : - debugwin_info(debugger, false, std::string("Errorlog: ").append(debugger.machine().system().description).append(" [").append(debugger.machine().system().name).append("]").c_str(), NULL) + debugwin_info(debugger, false, std::string("Errorlog: ").append(debugger.machine().system().description).append(" [").append(debugger.machine().system().name).append("]").c_str(), nullptr) { if (!window()) return; m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_LOG))); - if ((m_views[0] == NULL) || !m_views[0]->is_valid()) + if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); return; diff --git a/src/osd/modules/lib/osdlib_win32.cpp b/src/osd/modules/lib/osdlib_win32.cpp index 85334fd8ddc..75218574aff 100644 --- a/src/osd/modules/lib/osdlib_win32.cpp +++ b/src/osd/modules/lib/osdlib_win32.cpp @@ -77,7 +77,7 @@ int osd_setenv(const char *name, const char *value, int overwrite) if (!overwrite) { - if (osd_getenv(name) != NULL) + if (osd_getenv(name) != nullptr) return 0; } buf = (char *) osd_malloc_array(strlen(name)+strlen(value)+2); @@ -217,7 +217,7 @@ void osd_free(void *ptr) void *osd_alloc_executable(size_t size) { - return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); + return VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); } diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index ddbc8c974d4..c3501ec84b6 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -200,7 +200,7 @@ public: // this INTERFACE but part of the osd IMPLEMENTATION // getters - running_machine &machine() { assert(m_machine != NULL); return *m_machine; } + running_machine &machine() { assert(m_machine != nullptr); return *m_machine; } virtual void debugger_update(); diff --git a/src/osd/modules/midi/portmidi.cpp b/src/osd/modules/midi/portmidi.cpp index dd75d58ff17..9aa02c63c5b 100644 --- a/src/osd/modules/midi/portmidi.cpp +++ b/src/osd/modules/midi/portmidi.cpp @@ -46,7 +46,7 @@ static const int RX_EVENT_BUF_SIZE = 512; class osd_midi_device_pm : public osd_midi_device { public: - osd_midi_device_pm(): pmStream(NULL), xmit_cnt(0), last_status(0), rx_sysex(false) { } + osd_midi_device_pm(): pmStream(nullptr), xmit_cnt(0), last_status(0), rx_sysex(false) { } virtual ~osd_midi_device_pm() { } virtual bool open_input(const char *devname); virtual bool open_output(const char *devname); @@ -147,7 +147,7 @@ bool osd_midi_device_pm::open_input(const char *devname) if (found_dev >= 0) { - if (Pm_OpenInput(&stm, found_dev, NULL, RX_EVENT_BUF_SIZE, NULL, NULL) == pmNoError) + if (Pm_OpenInput(&stm, found_dev, nullptr, RX_EVENT_BUF_SIZE, nullptr, nullptr) == pmNoError) { pmStream = stm; return true; @@ -194,7 +194,7 @@ bool osd_midi_device_pm::open_output(const char *devname) if (found_dev >= 0) { - if (Pm_OpenOutput(&stm, found_dev, NULL, 100, NULL, NULL, 0) == pmNoError) + if (Pm_OpenOutput(&stm, found_dev, nullptr, 100, nullptr, nullptr, 0) == pmNoError) { pmStream = stm; return true; diff --git a/src/osd/modules/osdmodule.cpp b/src/osd/modules/osdmodule.cpp index e0d7781ace0..1c745effc6c 100644 --- a/src/osd/modules/osdmodule.cpp +++ b/src/osd/modules/osdmodule.cpp @@ -11,13 +11,13 @@ osd_module_manager::osd_module_manager() { for (int i=0; i~osd_module(); osd_free(m_modules[i]); @@ -32,7 +32,7 @@ void osd_module_manager::register_module(const module_type &mod_type) osd_printf_verbose("===> registered module %s %s\n", module->name(), module->type()); int i; - for (i = 0; m_modules[i] != NULL; i++) + for (i = 0; m_modules[i] != nullptr; i++) ; m_modules[i] = module; } @@ -55,7 +55,7 @@ osd_module *osd_module_manager::get_module_generic(const char *type, const char if (i>=0) return m_modules[i]; else - return NULL; + return nullptr; } osd_module *osd_module_manager::select_module(const char *type, const char *name) @@ -64,7 +64,7 @@ osd_module *osd_module_manager::select_module(const char *type, const char *name // FIXME: check if already exists! int i; - for (i = 0; m_selected[i] != NULL; i++) + for (i = 0; m_selected[i] != nullptr; i++) ; m_selected[i] = m; return m; @@ -72,7 +72,7 @@ osd_module *osd_module_manager::select_module(const char *type, const char *name void osd_module_manager::init(const osd_options &options) { - for (int i = 0; m_selected[i] != NULL; i++) + for (int i = 0; m_selected[i] != nullptr; i++) { m_selected[i]->init(options); } @@ -82,18 +82,18 @@ void osd_module_manager::exit() { // Find count int cnt; - for (cnt = 0; m_selected[cnt] != NULL; cnt++) + for (cnt = 0; m_selected[cnt] != nullptr; cnt++) ; for (int i = cnt - 1; i >= 0; i--) { m_selected[i]->exit(); - m_selected[i] = NULL; + m_selected[i] = nullptr; } } int osd_module_manager::get_module_index(const char *type, const char *name) { - for (int i = 0; m_modules[i] != NULL; i++) + for (int i = 0; m_modules[i] != nullptr; i++) { if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0))) return i; @@ -104,7 +104,7 @@ int osd_module_manager::get_module_index(const char *type, const char *name) void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[]) { *num = 0; - for (int i = 0; m_modules[i] != NULL; i++) + for (int i = 0; m_modules[i] != nullptr; i++) { if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max)) { diff --git a/src/osd/modules/render/d3d/d3d9intf.cpp b/src/osd/modules/render/d3d/d3d9intf.cpp index d6751b6ca21..cb8eb741f65 100644 --- a/src/osd/modules/render/d3d/d3d9intf.cpp +++ b/src/osd/modules/render/d3d/d3d9intf.cpp @@ -70,32 +70,32 @@ base *drawd3d9_init(void) // dynamically grab the create function from d3d9.dll HINSTANCE dllhandle = LoadLibrary(TEXT("d3d9.dll")); - if (dllhandle == NULL) + if (dllhandle == nullptr) { osd_printf_verbose("Direct3D: Unable to access d3d9.dll\n"); - return NULL; + return nullptr; } // import the create function direct3dcreate9_ptr direct3dcreate9 = (direct3dcreate9_ptr)GetProcAddress(dllhandle, "Direct3DCreate9"); - if (direct3dcreate9 == NULL) + if (direct3dcreate9 == nullptr) { osd_printf_verbose("Direct3D: Unable to find Direct3DCreate9\n"); FreeLibrary(dllhandle); - return NULL; + return nullptr; } // create our core direct 3d object IDirect3D9 *d3d9 = (*direct3dcreate9)(D3D_SDK_VERSION); - if (d3d9 == NULL) + if (d3d9 == nullptr) { osd_printf_verbose("Direct3D: Error attempting to initialize Direct3D9\n"); FreeLibrary(dllhandle); - return NULL; + return nullptr; } // dynamically grab the shader load function from d3dx9.dll - HINSTANCE fxhandle = NULL; + HINSTANCE fxhandle = nullptr; for (int idx = 99; idx >= 0; idx--) // a shameful moogle { #ifdef UNICODE @@ -107,19 +107,19 @@ base *drawd3d9_init(void) sprintf(dllbuf, "d3dx9_%d.dll", idx); fxhandle = LoadLibraryA(dllbuf); #endif - if (fxhandle != NULL) + if (fxhandle != nullptr) { break; } } - if (fxhandle == NULL) + if (fxhandle == nullptr) { osd_printf_verbose("Direct3D: Warning - Unable find any D3D9 DLLs; disabling post-effect rendering\n"); post_available = false; } // allocate an object to hold our data - base *d3dptr = global_alloc(base); + auto d3dptr = global_alloc(base); d3dptr->version = 9; d3dptr->d3dobj = d3d9; d3dptr->dllhandle = dllhandle; @@ -284,20 +284,20 @@ static HRESULT device_clear(device *dev, DWORD count, const D3DRECT *rects, DWOR static HRESULT device_create_offscreen_plain_surface(device *dev, UINT width, UINT height, D3DFORMAT format, D3DPOOL pool, surface **surface) { IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev; - return IDirect3DDevice9_CreateOffscreenPlainSurface(device, width, height, format, pool, (IDirect3DSurface9 **)surface, NULL); + return IDirect3DDevice9_CreateOffscreenPlainSurface(device, width, height, format, pool, (IDirect3DSurface9 **)surface, nullptr); } static HRESULT device_create_texture(device *dev, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, texture **texture) { IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev; - return IDirect3DDevice9_CreateTexture(device, width, height, levels, usage, format, pool, (IDirect3DTexture9 **)texture, NULL); + return IDirect3DDevice9_CreateTexture(device, width, height, levels, usage, format, pool, (IDirect3DTexture9 **)texture, nullptr); } static HRESULT device_create_vertex_buffer(device *dev, UINT length, DWORD usage, DWORD fvf, D3DPOOL pool, vertex_buffer **buf) { IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev; - return IDirect3DDevice9_CreateVertexBuffer(device, length, usage, fvf, pool, (IDirect3DVertexBuffer9 **)buf, NULL); + return IDirect3DDevice9_CreateVertexBuffer(device, length, usage, fvf, pool, (IDirect3DVertexBuffer9 **)buf, nullptr); } @@ -395,7 +395,7 @@ static HRESULT device_set_render_target(device *dev, DWORD index, surface *surf) static HRESULT device_create_render_target(device *dev, UINT width, UINT height, D3DFORMAT format, surface **surface) { IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev; - return IDirect3DDevice9_CreateRenderTarget(device, width, height, format, D3DMULTISAMPLE_NONE, 0, false, (IDirect3DSurface9 **)surface, NULL); + return IDirect3DDevice9_CreateRenderTarget(device, width, height, format, D3DMULTISAMPLE_NONE, 0, false, (IDirect3DSurface9 **)surface, nullptr); } diff --git a/src/osd/modules/sync/sync_mini.cpp b/src/osd/modules/sync/sync_mini.cpp index a09303aed80..f5e6accb0c7 100644 --- a/src/osd/modules/sync/sync_mini.cpp +++ b/src/osd/modules/sync/sync_mini.cpp @@ -82,7 +82,7 @@ void osd_lock_free(osd_lock *lock) osd_event *osd_event_alloc(int manualreset, int initialstate) { - return NULL; + return nullptr; } @@ -129,7 +129,7 @@ int osd_event_wait(osd_event *event, osd_ticks_t timeout) osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam) { - return NULL; + return nullptr; } diff --git a/src/osd/modules/sync/sync_windows.cpp b/src/osd/modules/sync/sync_windows.cpp index c3d93c75fc9..9439d68b72c 100644 --- a/src/osd/modules/sync/sync_windows.cpp +++ b/src/osd/modules/sync/sync_windows.cpp @@ -68,7 +68,7 @@ struct osd_scalable_lock // GLOBAL VARIABLES //============================================================ -static try_enter_critical_section_ptr try_enter_critical_section = NULL; +static try_enter_critical_section_ptr try_enter_critical_section = nullptr; static int checked_for_try_enter = FALSE; @@ -80,8 +80,8 @@ static int checked_for_try_enter = FALSE; osd_lock *osd_lock_alloc(void) { osd_lock *lock = (osd_lock *)malloc(sizeof(*lock)); - if (lock == NULL) - return NULL; + if (lock == nullptr) + return nullptr; InitializeCriticalSection(&lock->critsect); return lock; } @@ -121,13 +121,13 @@ int osd_lock_try(osd_lock *lock) { // see if we can use TryEnterCriticalSection HMODULE library = LoadLibrary(TEXT("kernel32.dll")); - if (library != NULL) + if (library != nullptr) try_enter_critical_section = (try_enter_critical_section_ptr)GetProcAddress(library, "TryEnterCriticalSection"); checked_for_try_enter = TRUE; } // if we have it, use it, otherwise just block - if (try_enter_critical_section != NULL) + if (try_enter_critical_section != nullptr) result = (*try_enter_critical_section)(&lock->critsect); else EnterCriticalSection(&lock->critsect); @@ -203,7 +203,7 @@ INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta) osd_event *osd_event_alloc(int manualreset, int initialstate) { - return (osd_event *) CreateEvent(NULL, manualreset, initialstate, NULL); + return (osd_event *) CreateEvent(nullptr, manualreset, initialstate, nullptr); } //============================================================ @@ -271,15 +271,15 @@ osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam) uintptr_t handle; thread = (osd_thread *)calloc(1, sizeof(osd_thread)); - if (thread == NULL) - return NULL; + if (thread == nullptr) + return nullptr; thread->callback = callback; thread->param = cbparam; - handle = _beginthreadex(NULL, 0, worker_thread_entry, thread, 0, NULL); + handle = _beginthreadex(nullptr, 0, worker_thread_entry, thread, 0, nullptr); if (handle == 0) { free(thread); - return NULL; + return nullptr; } thread->handle = (HANDLE) handle; return thread; @@ -327,8 +327,8 @@ osd_scalable_lock *osd_scalable_lock_alloc(void) osd_scalable_lock *lock; lock = (osd_scalable_lock *)calloc(1, sizeof(*lock)); - if (lock == NULL) - return NULL; + if (lock == nullptr) + return nullptr; memset(lock, 0, sizeof(*lock)); #if USE_SCALABLE_LOCKS diff --git a/src/osd/modules/sync/work_mini.cpp b/src/osd/modules/sync/work_mini.cpp index fd359c6ee40..3d4b10fc539 100644 --- a/src/osd/modules/sync/work_mini.cpp +++ b/src/osd/modules/sync/work_mini.cpp @@ -80,8 +80,8 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call // allocate memory to hold the result item = (osd_work_item *)malloc(sizeof(*item)); - if (item == NULL) - return NULL; + if (item == nullptr) + return nullptr; // loop over all requested items for (itemnum = 0; itemnum < numitems; itemnum++) @@ -97,7 +97,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call if (flags & WORK_ITEM_FLAG_AUTO_RELEASE) { free(item); - item = NULL; + item = nullptr; } return item; } diff --git a/src/osd/osdcore.cpp b/src/osd/osdcore.cpp index 82bbf1ee63b..91ba3fc4266 100644 --- a/src/osd/osdcore.cpp +++ b/src/osd/osdcore.cpp @@ -17,7 +17,7 @@ void osd_output::push(osd_output *delegate) { if (m_ptr < MAXSTACK) { - delegate->m_chain = (m_ptr >= 0 ? m_stack[m_ptr] : NULL); + delegate->m_chain = (m_ptr >= 0 ? m_stack[m_ptr] : nullptr); m_ptr++; m_stack[m_ptr] = delegate; } diff --git a/src/osd/osdmini/minidir.cpp b/src/osd/osdmini/minidir.cpp index 66b815daabb..e061b644cdf 100644 --- a/src/osd/osdmini/minidir.cpp +++ b/src/osd/osdmini/minidir.cpp @@ -17,7 +17,7 @@ osd_directory *osd_opendir(const char *dirname) { // since there are no standard C library routines for walking directories, // we always return an error here - return NULL; + return nullptr; } @@ -29,7 +29,7 @@ const osd_directory_entry *osd_readdir(osd_directory *dir) { // since there are no standard C library routines for walking directories, // we always return an error here - return NULL; + return nullptr; } diff --git a/src/osd/osdmini/minifile.cpp b/src/osd/osdmini/minifile.cpp index b55a3ad77e9..b30b566585c 100644 --- a/src/osd/osdmini/minifile.cpp +++ b/src/osd/osdmini/minifile.cpp @@ -35,7 +35,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64 // open the file fileptr = fopen(path, mode); - if (fileptr == NULL) + if (fileptr == nullptr) return FILERR_NOT_FOUND; // store the file pointer directly as an osd_file @@ -75,7 +75,7 @@ file_error osd_read(osd_file *file, void *buffer, UINT64 offset, UINT32 length, // perform the read count = fread(buffer, 1, length, (FILE *)file); - if (actual != NULL) + if (actual != nullptr) *actual = count; return FILERR_NONE; @@ -95,7 +95,7 @@ file_error osd_write(osd_file *file, const void *buffer, UINT64 offset, UINT32 l // perform the write count = fwrite(buffer, 1, length, (FILE *)file); - if (actual != NULL) + if (actual != nullptr) *actual = count; return FILERR_NONE; @@ -169,7 +169,7 @@ int osd_uchar_from_osdchar(UINT32 /* unicode_char */ *uchar, const char *osdchar osd_directory_entry *osd_stat(const char *path) { - osd_directory_entry *result = NULL; + osd_directory_entry *result = nullptr; // create an osd_directory_entry; be sure to make sure that the caller can // free all resources by just freeing the resulting osd_directory_entry @@ -180,7 +180,7 @@ osd_directory_entry *osd_stat(const char *path) result->size = 0; FILE *f = fopen(path, "rb"); - if (f != NULL) + if (f != nullptr) { fseek(f, 0, SEEK_END); result->type = ENTTYPE_FILE; @@ -199,11 +199,11 @@ file_error osd_get_full_path(char **dst, const char *path) { // derive the full path of the file in an allocated string // for now just fake it since we don't presume any underlying file system - *dst = NULL; - if (path != NULL) + *dst = nullptr; + if (path != nullptr) { *dst = (char *)osd_malloc_array(strlen(path) + 1); - if (*dst != NULL) + if (*dst != nullptr) strcpy(*dst, path); } @@ -218,5 +218,5 @@ file_error osd_get_full_path(char **dst, const char *path) const char *osd_get_volume_name(int idx) { // we don't expose volumes - return NULL; + return nullptr; } diff --git a/src/osd/osdmini/minimain.cpp b/src/osd/osdmini/minimain.cpp index c0598e65dfd..18fbba1bc37 100644 --- a/src/osd/osdmini/minimain.cpp +++ b/src/osd/osdmini/minimain.cpp @@ -117,7 +117,7 @@ void mini_osd_interface::init(running_machine &machine) // initialize the input system by adding devices // let's pretend like we have a keyboard device keyboard_device = machine.input().device_class(DEVICE_CLASS_KEYBOARD).add_device("Keyboard"); - if (keyboard_device == NULL) + if (keyboard_device == nullptr) fatalerror("Error creating keyboard device\n"); // our faux keyboard only has a couple of keys (corresponding to the diff --git a/src/osd/osdmini/minimisc.cpp b/src/osd/osdmini/minimisc.cpp index 21d658ace5b..c6bb413b292 100644 --- a/src/osd/osdmini/minimisc.cpp +++ b/src/osd/osdmini/minimisc.cpp @@ -79,7 +79,7 @@ void osd_break_into_debugger(const char *message) char *osd_get_clipboard_text(void) { // can't support clipboards generically - return NULL; + return nullptr; } //============================================================ @@ -88,7 +88,7 @@ char *osd_get_clipboard_text(void) const char *osd_getenv(const char *name) { - return NULL; + return nullptr; } //============================================================ diff --git a/src/osd/osdnet.cpp b/src/osd/osdnet.cpp index 4c167251cea..057a562ee76 100644 --- a/src/osd/osdnet.cpp +++ b/src/osd/osdnet.cpp @@ -7,11 +7,11 @@ static class simple_list netdev_list; void add_netdev(const char *name, const char *description, create_netdev func) { - osd_netdev::entry_t *entry = global_alloc_clear(osd_netdev::entry_t); + auto entry = global_alloc_clear(osd_netdev::entry_t); entry->id = netdev_list.count(); strncpy(entry->name, name, 255); entry->name[255] = '\0'; - strncpy(entry->description, (description != NULL) ? description : "(no name)", 255); + strncpy(entry->description, (description != nullptr) ? description : "(no name)", 255); entry->description[255] = '\0'; entry->func = func; netdev_list.append(*entry); @@ -35,7 +35,7 @@ class osd_netdev *open_netdev(int id, class device_network_interface *ifdev, int entry = entry->m_next; } - return NULL; + return nullptr; } osd_netdev::osd_netdev(class device_network_interface *ifdev, int rate) diff --git a/src/osd/sdl/watchdog.cpp b/src/osd/sdl/watchdog.cpp index c3fef7a7709..01d98f460dc 100644 --- a/src/osd/sdl/watchdog.cpp +++ b/src/osd/sdl/watchdog.cpp @@ -38,7 +38,7 @@ static void *watchdog_thread(void *param) osd_process_kill(); } } - return NULL; + return nullptr; } watchdog::watchdog(void) diff --git a/src/osd/windows/ledutil.cpp b/src/osd/windows/ledutil.cpp index 6788fdaf53e..6106005145e 100644 --- a/src/osd/windows/ledutil.cpp +++ b/src/osd/windows/ledutil.cpp @@ -180,13 +180,13 @@ int main(int argc, char *argv[]) // if the argument is "-kill", post a close message if (strcmp(arg, "-kill") == 0) { - if (otherwnd != NULL) + if (otherwnd != nullptr) PostMessage(otherwnd, WM_QUIT, 0, 0); - return (otherwnd != NULL) ? 1 : 0; + return (otherwnd != nullptr) ? 1 : 0; } // if we had another instance, defer to it - if (otherwnd != NULL) + if (otherwnd != nullptr) return 0; // call the startup code @@ -205,11 +205,11 @@ int main(int argc, char *argv[]) WINDOW_STYLE, 0, 0, 1, 1, - NULL, - NULL, - GetModuleHandle(NULL), - NULL); - if (listener_hwnd == NULL) + nullptr, + nullptr, + GetModuleHandle(nullptr), + nullptr); + if (listener_hwnd == nullptr) goto error; // allocate message ids @@ -235,18 +235,18 @@ int main(int argc, char *argv[]) // see if MAME is already running otherwnd = FindWindow(OUTPUT_WINDOW_CLASS, OUTPUT_WINDOW_NAME); - if (otherwnd != NULL) + if (otherwnd != nullptr) handle_mame_start((WPARAM)otherwnd, 0); // process messages - while (GetMessage(&message, NULL, 0, 0)) + while (GetMessage(&message, nullptr, 0, 0)) { TranslateMessage(&message); DispatchMessage(&message); } // reset on the way out if still live - if (mame_target != NULL) + if (mame_target != nullptr) handle_mame_stop((WPARAM)mame_target, 0); exitcode = 0; @@ -273,7 +273,7 @@ static int create_window_class(void) // initialize the description of the window class wc.lpszClassName = WINDOW_CLASS; - wc.hInstance = GetModuleHandle(NULL); + wc.hInstance = GetModuleHandle(nullptr); wc.lpfnWndProc = listener_window_proc; // register the class; fail if we can't @@ -351,7 +351,7 @@ static LRESULT handle_mame_stop(WPARAM wparam, LPARAM lparam) return 1; // clear our target out - mame_target = NULL; + mame_target = nullptr; reset_id_to_outname_cache(); // reset the LED states @@ -379,11 +379,11 @@ static LRESULT handle_copydata(WPARAM wparam, LPARAM lparam) // allocate memory entry = (id_map_entry *)malloc(sizeof(*entry)); - if (entry == NULL) + if (entry == nullptr) return 0; string = (char *)malloc(strlen(data->string) + 1); - if (string == NULL) + if (string == nullptr) { free(entry); return 0; @@ -411,7 +411,7 @@ static LRESULT handle_copydata(WPARAM wparam, LPARAM lparam) static void reset_id_to_outname_cache(void) { // free our ID list - while (idmaplist != NULL) + while (idmaplist != nullptr) { id_map_entry *temp = idmaplist; idmaplist = temp->next; @@ -430,7 +430,7 @@ static const char *map_id_to_outname(WPARAM id) id_map_entry *entry; // see if we have an entry in our map - for (entry = idmaplist; entry != NULL; entry = entry->next) + for (entry = idmaplist; entry != nullptr; entry = entry->next) if (entry->id == id) return entry->name; @@ -438,7 +438,7 @@ static const char *map_id_to_outname(WPARAM id) SendMessage(mame_target, om_mame_get_id_string, (WPARAM)listener_hwnd, id); // now see if we have the entry in our map - for (entry = idmaplist; entry != NULL; entry = entry->next) + for (entry = idmaplist; entry != nullptr; entry = entry->next) if (entry->id == id) return entry->name; @@ -476,7 +476,7 @@ static void output_startup(const char *commandline) { // default to PS/2, override if USB is specified as a parameter ledmethod = LED_METHOD_PS2; - if (commandline != NULL && strcmp(commandline, "-usb") == 0) + if (commandline != nullptr && strcmp(commandline, "-usb") == 0) ledmethod = LED_METHOD_USB; // output the method @@ -522,7 +522,7 @@ static void output_mame_start(void) return; } - hKbdDev = CreateFile(TEXT("\\\\.\\Kbd"), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + hKbdDev = CreateFile(TEXT("\\\\.\\Kbd"), GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr); if (hKbdDev == INVALID_HANDLE_VALUE) { error_number = GetLastError(); @@ -551,7 +551,7 @@ static void output_mame_stop(void) switch (ledmethod) { case LED_METHOD_PS2: - if (!DefineDosDevice(DDD_REMOVE_DEFINITION, TEXT("Kbd"), NULL)) + if (!DefineDosDevice(DDD_REMOVE_DEFINITION, TEXT("Kbd"), nullptr)) { error_number = GetLastError(); fprintf(stderr, "Unable to close the keyboard device. (error %d)\n", error_number); @@ -632,9 +632,9 @@ static int led_get_state(void) OutputBuffer.UnitId = 0; DeviceIoControl(hKbdDev, IOCTL_KEYBOARD_QUERY_INDICATORS, - NULL, 0, + nullptr, 0, &OutputBuffer, DataLength, - &ReturnedLength, NULL); + &ReturnedLength, nullptr); // Demangle lights to match 95/98 if (OutputBuffer.LedFlags & KEYBOARD_NUM_LOCK_ON) result |= 0x1; @@ -702,8 +702,8 @@ static void led_set_state(int state) InputBuffer.LedFlags = LedFlags; DeviceIoControl(hKbdDev, IOCTL_KEYBOARD_SET_INDICATORS, &InputBuffer, DataLength, - NULL, 0, - &ReturnedLength, NULL); + nullptr, 0, + &ReturnedLength, nullptr); break; } } diff --git a/src/osd/windows/output.cpp b/src/osd/windows/output.cpp index 41f2fd26201..0419d9bc2a7 100644 --- a/src/osd/windows/output.cpp +++ b/src/osd/windows/output.cpp @@ -85,7 +85,7 @@ bool windows_osd_interface::output_init() int result; // reset globals - clientlist = NULL; + clientlist = nullptr; // create our window class result = create_window_class(); @@ -100,11 +100,11 @@ bool windows_osd_interface::output_init() WINDOW_STYLE, 0, 0, 1, 1, - NULL, - NULL, + nullptr, + nullptr, GetModuleHandleUni(), - NULL); - assert(output_hwnd != NULL); + nullptr); + assert(output_hwnd != nullptr); // set a pointer to the running machine SetWindowLongPtr(output_hwnd, GWLP_USERDATA, (LONG_PTR)&machine()); @@ -128,7 +128,7 @@ bool windows_osd_interface::output_init() PostMessage(HWND_BROADCAST, om_mame_start, (WPARAM)output_hwnd, 0); // register a notifier for output changes - output_set_notifier(NULL, notifier_callback, NULL); + output_set_notifier(nullptr, notifier_callback, nullptr); return true; } @@ -141,7 +141,7 @@ bool windows_osd_interface::output_init() void windows_osd_interface::output_exit() { // free all the clients - while (clientlist != NULL) + while (clientlist != nullptr) { registered_client *temp = clientlist; clientlist = temp->next; @@ -219,7 +219,7 @@ static LRESULT register_client(HWND hwnd, LPARAM id) // find the end of the list; if we find ourself already registered, // return 1 - for (client = &clientlist; *client != NULL; client = &(*client)->next) + for (client = &clientlist; *client != nullptr; client = &(*client)->next) if ((*client)->id == id) { (*client)->hwnd = hwnd; @@ -229,7 +229,7 @@ static LRESULT register_client(HWND hwnd, LPARAM id) // add us to the end *client = global_alloc(registered_client); - (*client)->next = NULL; + (*client)->next = nullptr; (*client)->id = id; (*client)->hwnd = hwnd; @@ -249,7 +249,7 @@ static LRESULT unregister_client(HWND hwnd, LPARAM id) int found = FALSE; // find any matching IDs in the list and remove them - for (client = &clientlist; *client != NULL; client = &(*client)->next) + for (client = &clientlist; *client != nullptr; client = &(*client)->next) if ((*client)->id == id) { registered_client *temp = *client; @@ -281,7 +281,7 @@ static LRESULT send_id_string(running_machine &machine, HWND hwnd, LPARAM id) name = output_id_to_name(id); // a NULL name is an empty string - if (name == NULL) + if (name == nullptr) name = ""; // allocate memory for the message @@ -310,7 +310,7 @@ static void notifier_callback(const char *outname, INT32 value, void *param) registered_client *client; // loop over clients and notify them - for (client = clientlist; client != NULL; client = client->next) - if (param == NULL || param == client) + for (client = clientlist; client != nullptr; client = client->next) + if (param == nullptr || param == client) PostMessage(client->hwnd, om_mame_update_state, output_name_to_id(outname), value); } diff --git a/src/osd/windows/winsocket.cpp b/src/osd/windows/winsocket.cpp index 78c3a6161d4..cfa22dbbcb1 100644 --- a/src/osd/windows/winsocket.cpp +++ b/src/osd/windows/winsocket.cpp @@ -59,7 +59,7 @@ bool win_check_socket_path(const char *path) { if (strlen(winfile_socket_identifier) > 0 && strncmp(path, winfile_socket_identifier, strlen(winfile_socket_identifier)) == 0 && - strchr(path, ':') != NULL) return true; + strchr(path, ':') != nullptr) return true; return false; } @@ -105,7 +105,7 @@ file_error win_open_socket(const char *path, UINT32 openflags, osd_file **file, } // mark socket as "listening" - (*file)->handle = 0; + (*file)->handle = nullptr; *filesize = 0; return FILERR_NONE; } @@ -131,7 +131,7 @@ file_error win_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 c FD_SET(file->socket, &readfds); timeout.tv_sec = timeout.tv_usec = 0; - if (select(file->socket + 1, &readfds, NULL, NULL, &timeout) < 0) + if (select(file->socket + 1, &readfds, nullptr, nullptr, &timeout) < 0) { sprintf(line, "win_read_socket : %s : %d ", __FILE__, __LINE__); perror(line); @@ -148,7 +148,7 @@ file_error win_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 c { // listening socket SOCKET AcceptSocket; - AcceptSocket = accept(file->socket, NULL, NULL); + AcceptSocket = accept(file->socket, nullptr, nullptr); if (AcceptSocket == INVALID_SOCKET) { return FILERR_FAILURE; @@ -156,7 +156,7 @@ file_error win_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 c closesocket(file->socket); file->socket = AcceptSocket; file->handle = INVALID_HANDLE_VALUE; - if (actual != NULL ) + if (actual != nullptr ) { *actual = 0; } @@ -174,7 +174,7 @@ file_error win_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 c return win_error_to_mame_file_error(GetLastError()); } - if (actual != NULL ) + if (actual != nullptr ) { *actual = result; } @@ -190,7 +190,7 @@ file_error win_write_socket(osd_file *file, const void *buffer, UINT64 offset, U return win_error_to_mame_file_error(GetLastError()); } - if (actual != NULL ) + if (actual != nullptr ) { *actual = result; } diff --git a/src/tools/castool.cpp b/src/tools/castool.cpp index 22564dcdf78..a6b5c190b72 100644 --- a/src/tools/castool.cpp +++ b/src/tools/castool.cpp @@ -121,7 +121,7 @@ const struct SupportedCassetteFormats formats[] = { - {NULL,NULL,NULL} + {nullptr,nullptr,nullptr} }; @@ -129,9 +129,9 @@ static const char *get_extension(const char *name) { const char *s; s = name; - if (s != NULL) + if (s != nullptr) s = strrchr(s, '.'); - return s ? s+1 : NULL; + return s ? s+1 : nullptr; } static void display_usage(void) @@ -156,7 +156,7 @@ int CLIB_DECL main(int argc, char *argv[]) { int i; int found =0; - const struct CassetteFormat * const *selected_formats = NULL; + const struct CassetteFormat * const *selected_formats = nullptr; cassette_image *cassette; FILE *f; diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index 3ea0a31f752..691fc71b47b 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -189,7 +189,7 @@ public: chd_rawfile_compressor(core_file *file, UINT64 offset = 0, UINT64 maxoffset = ~0) : m_file(file), m_offset(offset), - m_maxoffset(MIN(maxoffset, (file != NULL) ? core_fsize(file) : 0)) { } + m_maxoffset(MIN(maxoffset, (file != nullptr) ? core_fsize(file) : 0)) { } // read interface virtual UINT32 read_data(void *dest, UINT64 offset, UINT32 length) @@ -218,7 +218,7 @@ class chd_chdfile_compressor : public chd_file_compressor public: // construction/destruction chd_chdfile_compressor(chd_file &file, UINT64 offset = 0, UINT64 maxoffset = ~0) - : m_toc(NULL), + : m_toc(nullptr), m_file(file), m_offset(offset), m_maxoffset(MIN(maxoffset, file.logical_bytes())) { } @@ -289,13 +289,13 @@ class chd_cd_compressor : public chd_file_compressor public: // construction/destruction chd_cd_compressor(cdrom_toc &toc, chdcd_track_input_info &info) - : m_file(NULL), + : m_file(nullptr), m_toc(toc), m_info(info) { } ~chd_cd_compressor() { - if (m_file != NULL) + if (m_file != nullptr) core_fclose(m_file); } @@ -320,9 +320,9 @@ public: if (offset >= startoffs && offset < endoffs) { // if we don't already have this file open, open it now - if (m_file == NULL || m_lastfile.compare(m_info.track[tracknum].fname)!=0) + if (m_file == nullptr || m_lastfile.compare(m_info.track[tracknum].fname)!=0) { - if (m_file != NULL) + if (m_file != nullptr) core_fclose(m_file); m_lastfile = m_info.track[tracknum].fname; file_error filerr = core_fopen(m_lastfile.c_str(), OPEN_FLAG_READ, &m_file); @@ -764,10 +764,10 @@ static void ATTR_PRINTF(2,3) progress(bool forceit, const char *format, ...) // print_help - print help for all the commands //------------------------------------------------- -static int print_help(const char *argv0, const char *error = NULL) +static int print_help(const char *argv0, const char *error = nullptr) { // print the error message first - if (error != NULL) + if (error != nullptr) fprintf(stderr, "Error: %s\n\n", error); // print a summary of each command @@ -788,10 +788,10 @@ static int print_help(const char *argv0, const char *error = NULL) // command //------------------------------------------------- -static int print_help(const char *argv0, const command_description &desc, const char *error = NULL) +static int print_help(const char *argv0, const command_description &desc, const char *error = nullptr) { // print the error message first - if (error != NULL) + if (error != nullptr) fprintf(stderr, "Error: %s\n\n", error); // print usage for this command @@ -801,7 +801,7 @@ static int print_help(const char *argv0, const command_description &desc, const { // determine whether we are required const char *option = desc.valid_options[valid]; - if (option == NULL) + if (option == nullptr) break; bool required = (option[0] == REQUIRED[0]); if (required) @@ -813,7 +813,7 @@ static int print_help(const char *argv0, const command_description &desc, const { const option_description &odesc = s_options[optnum]; printf(" --%s", odesc.name); - if (odesc.shortname != NULL) + if (odesc.shortname != nullptr) printf(", -%s", odesc.shortname); printf("%s%s\n", odesc.description, required ? " (required)" : ""); } @@ -904,7 +904,7 @@ UINT64 parse_number(const char *string) static void guess_chs(std::string *filename, UINT64 filesize, int sectorsize, UINT32 &cylinders, UINT32 &heads, UINT32 §ors, UINT32 &bps) { // if this is a direct physical drive read, handle it specially - if (filename != NULL && osd_get_physical_drive_geometry(filename->c_str(), &cylinders, &heads, §ors, &bps)) + if (filename != nullptr && osd_get_physical_drive_geometry(filename->c_str(), &cylinders, &heads, §ors, &bps)) return; // if we have no length to work with, we can't guess @@ -941,7 +941,7 @@ static void parse_input_chd_parameters(const parameters_t ¶ms, chd_file &inp { // process input parent file std::string *input_chd_parent_str = params.find(OPTION_INPUT_PARENT); - if (input_chd_parent_str != NULL) + if (input_chd_parent_str != nullptr) { chd_error err = input_parent_chd.open(input_chd_parent_str->c_str()); if (err != CHDERR_NONE) @@ -950,9 +950,9 @@ static void parse_input_chd_parameters(const parameters_t ¶ms, chd_file &inp // process input file std::string *input_chd_str = params.find(OPTION_INPUT); - if (input_chd_str != NULL) + if (input_chd_str != nullptr) { - chd_error err = input_chd.open(input_chd_str->c_str(), writeable, input_parent_chd.opened() ? &input_parent_chd : NULL); + chd_error err = input_chd.open(input_chd_str->c_str(), writeable, input_parent_chd.opened() ? &input_parent_chd : nullptr); if (err != CHDERR_NONE) report_error(1, "Error opening CHD file (%s): %s", input_chd_str->c_str(), chd_file::error_string(err)); } @@ -974,11 +974,11 @@ static void parse_input_start_end(const parameters_t ¶ms, UINT64 logical_siz std::string *input_start_byte_str = params.find(OPTION_INPUT_START_BYTE); std::string *input_start_hunk_str = params.find(OPTION_INPUT_START_HUNK); std::string *input_start_frame_str = params.find(OPTION_INPUT_START_FRAME); - if (input_start_byte_str != NULL) + if (input_start_byte_str != nullptr) input_start = parse_number(input_start_byte_str->c_str()); - if (input_start_hunk_str != NULL) + if (input_start_hunk_str != nullptr) input_start = parse_number(input_start_hunk_str->c_str()) * hunkbytes; - if (input_start_frame_str != NULL) + if (input_start_frame_str != nullptr) input_start = parse_number(input_start_frame_str->c_str()) * framebytes; if (input_start >= input_end) report_error(1, "Input start offset greater than input file size"); @@ -988,11 +988,11 @@ static void parse_input_start_end(const parameters_t ¶ms, UINT64 logical_siz std::string *input_length_hunks_str = params.find(OPTION_INPUT_LENGTH_HUNKS); std::string *input_length_frames_str = params.find(OPTION_INPUT_LENGTH_FRAMES); UINT64 input_length = input_end; - if (input_length_bytes_str != NULL) + if (input_length_bytes_str != nullptr) input_length = parse_number(input_length_bytes_str->c_str()); - if (input_length_hunks_str != NULL) + if (input_length_hunks_str != nullptr) input_length = parse_number(input_length_hunks_str->c_str()) * hunkbytes; - if (input_length_frames_str != NULL) + if (input_length_frames_str != nullptr) input_length = parse_number(input_length_frames_str->c_str()) * framebytes; if (input_start + input_length < input_end) input_end = input_start + input_length; @@ -1007,7 +1007,7 @@ static void parse_input_start_end(const parameters_t ¶ms, UINT64 logical_siz static void check_existing_output_file(const parameters_t ¶ms, const char *filename) { - if (params.find(OPTION_OUTPUT_FORCE) == NULL) + if (params.find(OPTION_OUTPUT_FORCE) == nullptr) { core_file *file; file_error filerr = core_fopen(filename, OPEN_FLAG_READ, &file); @@ -1029,7 +1029,7 @@ static std::string *parse_output_chd_parameters(const parameters_t ¶ms, chd_ { // process output parent file std::string *output_chd_parent_str = params.find(OPTION_OUTPUT_PARENT); - if (output_chd_parent_str != NULL) + if (output_chd_parent_str != nullptr) { chd_error err = output_parent_chd.open(output_chd_parent_str->c_str()); if (err != CHDERR_NONE) @@ -1038,7 +1038,7 @@ static std::string *parse_output_chd_parameters(const parameters_t ¶ms, chd_ // process output file std::string *output_chd_str = params.find(OPTION_OUTPUT); - if (output_chd_str != NULL) + if (output_chd_str != nullptr) check_existing_output_file(params, output_chd_str->c_str()); return output_chd_str; } @@ -1052,7 +1052,7 @@ static std::string *parse_output_chd_parameters(const parameters_t ¶ms, chd_ static void parse_hunk_size(const parameters_t ¶ms, UINT32 required_granularity, UINT32 &hunk_size) { std::string *hunk_size_str = params.find(OPTION_HUNK_SIZE); - if (hunk_size_str != NULL) + if (hunk_size_str != nullptr) { hunk_size = parse_number(hunk_size_str->c_str()); if (hunk_size < 16 || hunk_size > 1024 * 1024) @@ -1072,7 +1072,7 @@ static void parse_compression(const parameters_t ¶ms, chd_codec_type compres { // see if anything was specified std::string *compression_str = params.find(OPTION_COMPRESSION); - if (compression_str == NULL) + if (compression_str == nullptr) return; // special case: 'none' @@ -1112,7 +1112,7 @@ static void parse_compression(const parameters_t ¶ms, chd_codec_type compres static void parse_numprocessors(const parameters_t ¶ms) { std::string *numprocessors_str = params.find(OPTION_NUMPROCESSORS); - if (numprocessors_str == NULL) + if (numprocessors_str == nullptr) return; int count = atoi(numprocessors_str->c_str()); @@ -1234,7 +1234,7 @@ void output_track_metadata(int mode, core_file *file, int tracknum, const cdrom_ size = 2352; break; } - bool needquote = strchr(filename, ' ') != NULL; + bool needquote = strchr(filename, ' ') != nullptr; core_fprintf(file, "%d %d %d %d %s%s%s %" I64FMT "d\n", tracknum+1, frameoffs, mode, size, needquote?"\"":"", filename, needquote?"\"":"", discoffs); } else if (mode == MODE_CUEBIN) @@ -1421,7 +1421,7 @@ static void do_info(parameters_t ¶ms) } // print compression stats if verbose - if (params.find(OPTION_VERBOSE) != NULL) + if (params.find(OPTION_VERBOSE) != nullptr) { UINT32 compression_types[10] = { 0 }; for (UINT32 hunknum = 0; hunknum < input_chd.hunk_count(); hunknum++) @@ -1528,7 +1528,7 @@ static void do_verify(parameters_t ¶ms) fprintf(stderr, " actual SHA1 = %s\n", computed_sha1.as_string(tempstr)); // fix it if requested; this also fixes the overall one so we don't need to do any more - if (params.find(OPTION_FIX) != NULL) + if (params.find(OPTION_FIX) != nullptr) { input_chd.set_raw_sha1(computed_sha1); printf("SHA-1 updated to correct value in input CHD\n"); @@ -1551,7 +1551,7 @@ static void do_verify(parameters_t ¶ms) fprintf(stderr, " actual SHA1 = %s\n", computed_overall_sha1.as_string(tempstr)); // fix it if requested - if (params.find(OPTION_FIX) != NULL) + if (params.find(OPTION_FIX) != nullptr) { input_chd.set_raw_sha1(computed_sha1); printf("SHA-1 updated to correct value in input CHD\n"); @@ -1570,9 +1570,9 @@ static void do_verify(parameters_t ¶ms) static void do_create_raw(parameters_t ¶ms) { // process input file - core_file *input_file = NULL; + core_file *input_file = nullptr; std::string *input_file_str = params.find(OPTION_INPUT); - if (input_file_str != NULL) + if (input_file_str != nullptr) { file_error filerr = core_fopen(input_file_str->c_str(), OPEN_FLAG_READ, &input_file); if (filerr != FILERR_NONE) @@ -1590,7 +1590,7 @@ static void do_create_raw(parameters_t ¶ms) // process unit size UINT32 unit_size = output_parent.opened() ? output_parent.unit_bytes() : 0; std::string *unit_size_str = params.find(OPTION_UNIT_SIZE); - if (unit_size_str != NULL) + if (unit_size_str != nullptr) { unit_size = parse_number(unit_size_str->c_str()); if (hunk_size % unit_size != 0) @@ -1626,7 +1626,7 @@ static void do_create_raw(parameters_t ¶ms) printf("Logical size: %s\n", big_int_string(tempstr, input_end - input_start)); // catch errors so we can close & delete the output file - chd_rawfile_compressor *chd = NULL; + chd_rawfile_compressor *chd = nullptr; try { // create the new CHD @@ -1652,7 +1652,7 @@ static void do_create_raw(parameters_t ¶ms) delete chd; // delete the output file std::string *output_chd_str = params.find(OPTION_OUTPUT); - if (output_chd_str != NULL) + if (output_chd_str != nullptr) osd_rmfile(output_chd_str->c_str()); throw; } @@ -1667,9 +1667,9 @@ static void do_create_raw(parameters_t ¶ms) static void do_create_hd(parameters_t ¶ms) { // process input file - core_file *input_file = NULL; + core_file *input_file = nullptr; std::string *input_file_str = params.find(OPTION_INPUT); - if (input_file_str != NULL) + if (input_file_str != nullptr) { file_error filerr = core_fopen(input_file_str->c_str(), OPEN_FLAG_READ, &input_file); if (filerr != FILERR_NONE) @@ -1683,7 +1683,7 @@ static void do_create_hd(parameters_t ¶ms) // process sectorsize UINT32 sector_size = output_parent.opened() ? output_parent.unit_bytes() : IDE_SECTOR_SIZE; std::string *sectorsize_str = params.find(OPTION_SECTOR_SIZE); - if (sectorsize_str != NULL) + if (sectorsize_str != nullptr) { if (output_parent.opened()) report_error(1, "Sector size does not apply when creating a diff from the parent"); @@ -1698,7 +1698,7 @@ static void do_create_hd(parameters_t ¶ms) UINT64 filesize = 0; UINT64 input_start = 0; UINT64 input_end = 0; - if (input_file != NULL) + if (input_file != nullptr) { parse_input_start_end(params, core_fsize(input_file), hunk_size, hunk_size, input_start, input_end); filesize = input_end - input_start; @@ -1706,7 +1706,7 @@ static void do_create_hd(parameters_t ¶ms) else { std::string *size_str = params.find(OPTION_SIZE); - if (size_str != NULL) + if (size_str != nullptr) { if (sscanf(size_str->c_str(), "%" I64FMT"d", &filesize) != 1) report_error(1, "Invalid size string"); @@ -1716,10 +1716,10 @@ static void do_create_hd(parameters_t ¶ms) // process compression chd_codec_type compression[4]; memcpy(compression, s_default_hd_compression, sizeof(compression)); - if (input_file == NULL) + if (input_file == nullptr) compression[0] = compression[1] = compression[2] = compression[3] = CHD_CODEC_NONE; parse_compression(params, compression); - if (input_file == NULL && compression[0] != CHD_CODEC_NONE) + if (input_file == nullptr && compression[0] != CHD_CODEC_NONE) report_error(1, "Blank hard disks must be uncompressed"); // process numprocessors @@ -1730,7 +1730,7 @@ static void do_create_hd(parameters_t ¶ms) UINT32 heads = 0; UINT32 sectors = 0; std::string *chs_str = params.find(OPTION_CHS); - if (chs_str != NULL) + if (chs_str != nullptr) { if (output_parent.opened()) report_error(1, "CHS does not apply when creating a diff from the parent"); @@ -1743,7 +1743,7 @@ static void do_create_hd(parameters_t ¶ms) if (output_parent.opened()) output_parent.read_metadata(HARD_DISK_IDENT_METADATA_TAG, 0, identdata); std::string *ident_str = params.find(OPTION_IDENT); - if (ident_str != NULL) + if (ident_str != nullptr) { // load the file file_error filerr = core_fload(ident_str->c_str(), identdata); @@ -1775,7 +1775,7 @@ static void do_create_hd(parameters_t ¶ms) // if no CHS values, try to guess them if (cylinders == 0) { - if (input_file == NULL && filesize == 0) + if (input_file == nullptr && filesize == 0) report_error(1, "Blank hard drives must specify either a length or a set of CHS values"); guess_chs(input_file_str, filesize, sector_size, cylinders, heads, sectors, sector_size); } @@ -1786,7 +1786,7 @@ static void do_create_hd(parameters_t ¶ms) printf("Output CHD: %s\n", output_chd_str->c_str()); if (output_parent.opened()) printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); - if (input_file != NULL) + if (input_file != nullptr) { printf("Input file: %s\n", input_file_str->c_str()); if (input_start != 0 || input_end != core_fsize(input_file)) @@ -1804,7 +1804,7 @@ static void do_create_hd(parameters_t ¶ms) printf("Logical size: %s\n", big_int_string(tempstr, UINT64(totalsectors) * UINT64(sector_size))); // catch errors so we can close & delete the output file - chd_rawfile_compressor *chd = NULL; + chd_rawfile_compressor *chd = nullptr; try { // create the new hard drive @@ -1833,7 +1833,7 @@ static void do_create_hd(parameters_t ¶ms) } // compress it generically - if (input_file != NULL) + if (input_file != nullptr) compress_common(*chd); delete chd; } @@ -1842,7 +1842,7 @@ static void do_create_hd(parameters_t ¶ms) delete chd; // delete the output file std::string *output_chd_str = params.find(OPTION_OUTPUT); - if (output_chd_str != NULL) + if (output_chd_str != nullptr) osd_rmfile(output_chd_str->c_str()); throw; } @@ -1860,7 +1860,7 @@ static void do_create_cd(parameters_t ¶ms) chdcd_track_input_info track_info; cdrom_toc toc = { 0 }; std::string *input_file_str = params.find(OPTION_INPUT); - if (input_file_str != NULL) + if (input_file_str != nullptr) { chd_error err = chdcd_parse_toc(input_file_str->c_str(), toc, track_info); if (err != CHDERR_NONE) @@ -1907,7 +1907,7 @@ static void do_create_cd(parameters_t ¶ms) printf("Logical size: %s\n", big_int_string(tempstr, UINT64(totalsectors) * CD_FRAME_SIZE)); // catch errors so we can close & delete the output file - chd_cd_compressor *chd = NULL; + chd_cd_compressor *chd = nullptr; try { // create the new CD @@ -1934,7 +1934,7 @@ static void do_create_cd(parameters_t ¶ms) delete chd; // delete the output file std::string *output_chd_str = params.find(OPTION_OUTPUT); - if (output_chd_str != NULL) + if (output_chd_str != nullptr) osd_rmfile(output_chd_str->c_str()); throw; } @@ -1949,9 +1949,9 @@ static void do_create_cd(parameters_t ¶ms) static void do_create_ld(parameters_t ¶ms) { // process input file - avi_file *input_file = NULL; + avi_file *input_file = nullptr; std::string *input_file_str = params.find(OPTION_INPUT); - if (input_file_str != NULL) + if (input_file_str != nullptr) { avi_error avierr = avi_open(input_file_str->c_str(), &input_file); if (avierr != AVIERR_NONE) @@ -2025,7 +2025,7 @@ static void do_create_ld(parameters_t ¶ms) printf("Logical size: %s\n", big_int_string(tempstr, UINT64(input_end - input_start) * hunk_size)); // catch errors so we can close & delete the output file - chd_avi_compressor *chd = NULL; + chd_avi_compressor *chd = nullptr; try { // create the new CHD @@ -2062,7 +2062,7 @@ static void do_create_ld(parameters_t ¶ms) delete chd; // delete the output file std::string *output_chd_str = params.find(OPTION_OUTPUT); - if (output_chd_str != NULL) + if (output_chd_str != nullptr) osd_rmfile(output_chd_str->c_str()); throw; } @@ -2134,7 +2134,7 @@ static void do_copy(parameters_t ¶ms) printf("Logical size: %s\n", big_int_string(tempstr, input_end - input_start)); // catch errors so we can close & delete the output file - chd_chdfile_compressor *chd = NULL; + chd_chdfile_compressor *chd = nullptr; try { // create the new CHD @@ -2179,7 +2179,7 @@ static void do_copy(parameters_t ¶ms) if (redo_cd) { cdrom_file *cdrom = cdrom_open(&input_chd); - if (cdrom == NULL) + if (cdrom == nullptr) report_error(1, "Error upgrading CD metadata"); const cdrom_toc *toc = cdrom_get_toc(cdrom); err = cdrom_write_metadata(chd, toc); @@ -2198,7 +2198,7 @@ static void do_copy(parameters_t ¶ms) delete chd; // delete the output file std::string *output_chd_str = params.find(OPTION_OUTPUT); - if (output_chd_str != NULL) + if (output_chd_str != nullptr) osd_rmfile(output_chd_str->c_str()); throw; } @@ -2224,7 +2224,7 @@ static void do_extract_raw(parameters_t ¶ms) // verify output file doesn't exist std::string *output_file_str = params.find(OPTION_OUTPUT); - if (output_file_str != NULL) + if (output_file_str != nullptr) check_existing_output_file(params, output_file_str->c_str()); // print some info @@ -2238,7 +2238,7 @@ static void do_extract_raw(parameters_t ¶ms) } // catch errors so we can close & delete the output file - core_file *output_file = NULL; + core_file *output_file = nullptr; try { // process output file @@ -2274,7 +2274,7 @@ static void do_extract_raw(parameters_t ¶ms) catch (...) { // delete the output file - if (output_file != NULL) + if (output_file != nullptr) { core_fclose(output_file); osd_rmfile(output_file_str->c_str()); @@ -2298,13 +2298,13 @@ static void do_extract_cd(parameters_t ¶ms) // further process input file cdrom_file *cdrom = cdrom_open(&input_chd); - if (cdrom == NULL) + if (cdrom == nullptr) report_error(1, "Unable to recognize CHD file as a CD"); const cdrom_toc *toc = cdrom_get_toc(cdrom); // verify output file doesn't exist std::string *output_file_str = params.find(OPTION_OUTPUT); - if (output_file_str != NULL) + if (output_file_str != nullptr) check_existing_output_file(params, output_file_str->c_str()); // verify output BIN file doesn't exist @@ -2316,7 +2316,7 @@ static void do_extract_cd(parameters_t ¶ms) char basename[128]; strncpy(basename, default_name.c_str(), 127); default_name.append(".bin"); - if (output_bin_file_str == NULL) + if (output_bin_file_str == nullptr) output_bin_file_str = &default_name; check_existing_output_file(params, output_bin_file_str->c_str()); @@ -2327,8 +2327,8 @@ static void do_extract_cd(parameters_t ¶ms) printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str()); // catch errors so we can close & delete the output file - core_file *output_bin_file = NULL; - core_file *output_toc_file = NULL; + core_file *output_bin_file = nullptr; + core_file *output_toc_file = nullptr; try { int mode = MODE_NORMAL; @@ -2387,7 +2387,7 @@ static void do_extract_cd(parameters_t ¶ms) if (output_bin_file) { core_fclose(output_bin_file); - output_bin_file = NULL; + output_bin_file = nullptr; } filerr = core_fopen(trackbin_name.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_bin_file); @@ -2474,9 +2474,9 @@ static void do_extract_cd(parameters_t ¶ms) catch (...) { // delete the output files - if (output_bin_file != NULL) + if (output_bin_file != nullptr) core_fclose(output_bin_file); - if (output_toc_file != NULL) + if (output_toc_file != nullptr) core_fclose(output_toc_file); osd_rmfile(output_bin_file_str->c_str()); osd_rmfile(output_file_str->c_str()); @@ -2551,7 +2551,7 @@ static void do_extract_ld(parameters_t ¶ms) // verify output file doesn't exist std::string *output_file_str = params.find(OPTION_OUTPUT); - if (output_file_str != NULL) + if (output_file_str != nullptr) check_existing_output_file(params, output_file_str->c_str()); // print some info @@ -2565,7 +2565,7 @@ static void do_extract_ld(parameters_t ¶ms) } // catch errors so we can close & delete the output file - avi_file *output_file = NULL; + avi_file *output_file = nullptr; try { // process output file @@ -2596,7 +2596,7 @@ static void do_extract_ld(parameters_t ¶ms) input_chd.codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig); // read the hunk into the buffers - chd_error err = input_chd.read_hunk(framenum, NULL); + chd_error err = input_chd.read_hunk(framenum, nullptr); if (err != CHDERR_NONE) { UINT64 filepos = core_ftell(input_chd); @@ -2627,7 +2627,7 @@ static void do_extract_ld(parameters_t ¶ms) catch (...) { // delete the output file - if (output_file != NULL) + if (output_file != nullptr) avi_close(output_file); osd_rmfile(output_file_str->c_str()); throw; @@ -2650,7 +2650,7 @@ static void do_add_metadata(parameters_t ¶ms) // process tag chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?'); std::string *tag_str = params.find(OPTION_TAG); - if (tag_str != NULL) + if (tag_str != nullptr) { tag_str->append(" "); tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]); @@ -2659,13 +2659,13 @@ static void do_add_metadata(parameters_t ¶ms) // process index UINT32 index = 0; std::string *index_str = params.find(OPTION_INDEX); - if (index_str != NULL) + if (index_str != nullptr) index = atoi(index_str->c_str()); // process text input std::string *text_str = params.find(OPTION_VALUE_TEXT); std::string text; - if (text_str != NULL) + if (text_str != nullptr) { text = *text_str; if (text[0] == '"' && text[text.length() - 1] == '"') @@ -2675,7 +2675,7 @@ static void do_add_metadata(parameters_t ¶ms) // process file input std::string *file_str = params.find(OPTION_VALUE_FILE); dynamic_buffer file; - if (file_str != NULL) + if (file_str != nullptr) { file_error filerr = core_fload(file_str->c_str(), file); if (filerr != FILERR_NONE) @@ -2683,14 +2683,14 @@ static void do_add_metadata(parameters_t ¶ms) } // make sure we have one or the other - if (text_str == NULL && file_str == NULL) + if (text_str == nullptr && file_str == nullptr) report_error(1, "Error: missing either --valuetext/-vt or --valuefile/-vf parameters"); - if (text_str != NULL && file_str != NULL) + if (text_str != nullptr && file_str != nullptr) report_error(1, "Error: both --valuetext/-vt or --valuefile/-vf parameters specified; only one permitted"); // process no checksum UINT8 flags = CHD_MDFLAGS_CHECKSUM; - if (params.find(OPTION_NO_CHECKSUM) != NULL) + if (params.find(OPTION_NO_CHECKSUM) != nullptr) flags &= ~CHD_MDFLAGS_CHECKSUM; // print some info @@ -2698,14 +2698,14 @@ static void do_add_metadata(parameters_t ¶ms) printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str()); printf("Tag: %c%c%c%c\n", (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff); printf("Index: %d\n", index); - if (text_str != NULL) + if (text_str != nullptr) printf("Text: %s\n", text.c_str()); else printf("Data: %s (%d bytes)\n", file_str->c_str(), int(file.size())); // write the metadata chd_error err; - if (text_str != NULL) + if (text_str != nullptr) err = input_chd.write_metadata(tag, index, text, flags); else err = input_chd.write_metadata(tag, index, &file[0], flags); @@ -2730,7 +2730,7 @@ static void do_del_metadata(parameters_t ¶ms) // process tag chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?'); std::string *tag_str = params.find(OPTION_TAG); - if (tag_str != NULL) + if (tag_str != nullptr) { tag_str->append(" "); tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]); @@ -2739,7 +2739,7 @@ static void do_del_metadata(parameters_t ¶ms) // process index UINT32 index = 0; std::string *index_str = params.find(OPTION_INDEX); - if (index_str != NULL) + if (index_str != nullptr) index = atoi(index_str->c_str()); // print some info @@ -2770,13 +2770,13 @@ static void do_dump_metadata(parameters_t ¶ms) // verify output file doesn't exist std::string *output_file_str = params.find(OPTION_OUTPUT); - if (output_file_str != NULL) + if (output_file_str != nullptr) check_existing_output_file(params, output_file_str->c_str()); // process tag chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?'); std::string *tag_str = params.find(OPTION_TAG); - if (tag_str != NULL) + if (tag_str != nullptr) { tag_str->append(" "); tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]); @@ -2785,7 +2785,7 @@ static void do_dump_metadata(parameters_t ¶ms) // process index UINT32 index = 0; std::string *index_str = params.find(OPTION_INDEX); - if (index_str != NULL) + if (index_str != nullptr) index = atoi(index_str->c_str()); // write the metadata @@ -2795,11 +2795,11 @@ static void do_dump_metadata(parameters_t ¶ms) report_error(1, "Error reading metadata: %s", chd_file::error_string(err)); // catch errors so we can close & delete the output file - core_file *output_file = NULL; + core_file *output_file = nullptr; try { // create the file - if (output_file_str != NULL) + if (output_file_str != nullptr) { file_error filerr = core_fopen(output_file_str->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_file); if (filerr != FILERR_NONE) @@ -2826,7 +2826,7 @@ static void do_dump_metadata(parameters_t ¶ms) catch (...) { // delete the output file - if (output_file != NULL) + if (output_file != nullptr) core_fclose(output_file); osd_rmfile(output_file_str->c_str()); throw; @@ -2882,7 +2882,7 @@ int CLIB_DECL main(int argc, char *argv[]) { // reduce to the option name const char *validname = desc.valid_options[valid]; - if (validname == NULL) + if (validname == nullptr) break; if (*validname == REQUIRED[0]) validname++; @@ -2897,7 +2897,7 @@ int CLIB_DECL main(int argc, char *argv[]) // do we match? const option_description &odesc = s_options[optnum]; if ((arg[1] == '-' && strcmp(odesc.name, &arg[2]) == 0) || - (arg[1] != '-' && odesc.shortname != NULL && strcmp(odesc.shortname, &arg[1]) == 0)) + (arg[1] != '-' && odesc.shortname != nullptr && strcmp(odesc.shortname, &arg[1]) == 0)) { // if we need a parameter, consume it const char *param = ""; @@ -2924,9 +2924,9 @@ int CLIB_DECL main(int argc, char *argv[]) for (int valid = 0; valid < ARRAY_LENGTH(desc.valid_options); valid++) { const char *validname = desc.valid_options[valid]; - if (validname == NULL) + if (validname == nullptr) break; - if (*validname == REQUIRED[0] && parameters.find(++validname) == NULL) + if (*validname == REQUIRED[0] && parameters.find(++validname) == nullptr) return print_help(argv[0], desc, "Required parameters missing"); } diff --git a/src/tools/floptool.cpp b/src/tools/floptool.cpp index 2cb36f3a873..190e2004ea6 100644 --- a/src/tools/floptool.cpp +++ b/src/tools/floptool.cpp @@ -100,13 +100,13 @@ static floppy_image_format_t *find_format_by_name(const char *name) for(int i=0; i != FORMAT_COUNT; i++) if(!core_stricmp(name, formats[i]->name())) return formats[i]; - return 0; + return nullptr; } static floppy_image_format_t *find_format_by_identify(io_generic *image) { int best = 0; - floppy_image_format_t *best_fif = 0; + floppy_image_format_t *best_fif = nullptr; for(int i = 0; i != FORMAT_COUNT; i++) { floppy_image_format_t *fif = formats[i]; diff --git a/src/tools/imgtool/charconv.cpp b/src/tools/imgtool/charconv.cpp index 39b5953d799..34a912dcb89 100644 --- a/src/tools/imgtool/charconv.cpp +++ b/src/tools/imgtool/charconv.cpp @@ -24,7 +24,7 @@ static char *utf8_from_latin1(const char *src) /* validate input */ if (!src) { - return NULL; + return nullptr; } /* allocate space for result, twice the source len to be safe */ @@ -69,7 +69,7 @@ static char *latin1_from_utf8(const char *src) /* validate input */ if (!src) { - return NULL; + return nullptr; } /* allocate space for result */ @@ -128,7 +128,7 @@ char *utf8_from_native(imgtool_charset charset, const char *src) break; default: - result = NULL; + result = nullptr; break; } return result; @@ -155,7 +155,7 @@ char *native_from_utf8(imgtool_charset charset, const char *src) break; default: - result = NULL; + result = nullptr; break; } return result; diff --git a/src/tools/imgtool/filtbas.cpp b/src/tools/imgtool/filtbas.cpp index bff1bda121e..a83d7a80108 100644 --- a/src/tools/imgtool/filtbas.cpp +++ b/src/tools/imgtool/filtbas.cpp @@ -83,15 +83,15 @@ static imgtoolerr_t basic_readfile(const basictokens *tokens, const char *token; /* open a memory stream */ - mem_stream = stream_open_mem(NULL, 0); - if (mem_stream == NULL) + mem_stream = stream_open_mem(nullptr, 0); + if (mem_stream == nullptr) { err = IMGTOOLERR_OUTOFMEMORY; goto done; } /* read actual file */ - err = imgtool_partition_read_file(partition, filename, fork, mem_stream, NULL); + err = imgtool_partition_read_file(partition, filename, fork, mem_stream, nullptr); if (err) goto done; @@ -126,7 +126,7 @@ static imgtoolerr_t basic_readfile(const basictokens *tokens, if ((b & 0x80) && (!in_string)) { - token = NULL; + token = nullptr; for (i = 0; i < tokens->num_entries; i++) { @@ -161,7 +161,7 @@ static imgtoolerr_t basic_readfile(const basictokens *tokens, } done: - if (mem_stream != NULL) + if (mem_stream != nullptr) stream_close(mem_stream); return err; } @@ -193,8 +193,8 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens, UINT16 address; /* open a memory stream */ - mem_stream = stream_open_mem(NULL, 0); - if (mem_stream == NULL) + mem_stream = stream_open_mem(nullptr, 0); + if (mem_stream == nullptr) { err = IMGTOOLERR_OUTOFMEMORY; goto done; @@ -272,7 +272,7 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens, /* read until end of line */ while(buf[pos] != '\0') { - token = NULL; + token = nullptr; token_shift = 0; token_value = 0; @@ -283,10 +283,10 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens, } else if (!in_quotes) { - for (i = 0; (token == NULL) && (i < tokens->num_entries); i++) + for (i = 0; (token == nullptr) && (i < tokens->num_entries); i++) { token_table = &tokens->entries[i]; - for (j = 0; (token == NULL) && (j < token_table->num_tokens); j++) + for (j = 0; (token == nullptr) && (j < token_table->num_tokens); j++) { if (!strncmp(&buf[pos], token_table->tokens[j], strlen(token_table->tokens[j]))) { @@ -300,7 +300,7 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens, } /* did we find a token? */ - if (token != NULL) + if (token != nullptr) { /* emit the token */ if (token_shift != 0) @@ -343,12 +343,12 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens, } /* write actual file */ - err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, NULL); + err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, nullptr); if (err) goto done; done: - if (mem_stream != NULL) + if (mem_stream != nullptr) stream_close(mem_stream); return err; } @@ -684,7 +684,7 @@ static const char *const vzbas[] = "RESET", /* 0x82 */ "SET", /* 0x83 */ "CLS", /* 0x84 */ - NULL, /* 0x85 */ + nullptr, /* 0x85 */ "RANDOM", /* 0x86 */ "NEXT", /* 0x87 */ "DATA", /* 0x88 */ @@ -713,21 +713,21 @@ static const char *const vzbas[] = "RESUME", /* 0x9f */ "OUT", /* 0xa0 */ "IN", /* 0xa1 */ - NULL, /* 0xa2 */ - NULL, /* 0xa3 */ - NULL, /* 0xa4 */ - NULL, /* 0xa5 */ - NULL, /* 0xa6 */ - NULL, /* 0xa7 */ - NULL, /* 0xa8 */ - NULL, /* 0xa9 */ - NULL, /* 0xaa */ - NULL, /* 0xab */ - NULL, /* 0xac */ - NULL, /* 0xad */ + nullptr, /* 0xa2 */ + nullptr, /* 0xa3 */ + nullptr, /* 0xa4 */ + nullptr, /* 0xa5 */ + nullptr, /* 0xa6 */ + nullptr, /* 0xa7 */ + nullptr, /* 0xa8 */ + nullptr, /* 0xa9 */ + nullptr, /* 0xaa */ + nullptr, /* 0xab */ + nullptr, /* 0xac */ + nullptr, /* 0xad */ "(RESET)", /* 0xae */ "LPRINT", /* 0xaf */ - NULL, /* 0xb0 */ + nullptr, /* 0xb0 */ "POKE", /* 0xb1 */ "PRINT", /* 0xb2 */ "CONT", /* 0xb3 */ @@ -741,16 +741,16 @@ static const char *const vzbas[] = "NEW", /* 0xbb */ "TAB(", /* 0xbc */ "TO", /* 0xbd */ - NULL, /* 0xbe */ + nullptr, /* 0xbe */ "USING", /* 0xbf */ "VARPTR", /* 0xc0 */ "USR", /* 0xc1 */ "ERL", /* 0xc2 */ "ERR", /* 0xc3 */ "STRING$", /* 0xc4 */ - NULL, /* 0xc5 */ + nullptr, /* 0xc5 */ "POINT", /* 0xc6 */ - NULL, /* 0xc7 */ + nullptr, /* 0xc7 */ "MEM", /* 0xc8 */ "INKEY$", /* 0xc9 */ "THEN", /* 0xca */ @@ -781,15 +781,15 @@ static const char *const vzbas[] = "TAN", /* 0xe3 */ "ATN", /* 0xe4 */ "PEEK", /* 0xe5 */ - NULL, /* 0xe6 */ - NULL, /* 0xe7 */ - NULL, /* 0xe8 */ - NULL, /* 0xe9 */ - NULL, /* 0xea */ - NULL, /* 0xeb */ - NULL, /* 0xec */ - NULL, /* 0xed */ - NULL, /* 0xee */ + nullptr, /* 0xe6 */ + nullptr, /* 0xe7 */ + nullptr, /* 0xe8 */ + nullptr, /* 0xe9 */ + nullptr, /* 0xea */ + nullptr, /* 0xeb */ + nullptr, /* 0xec */ + nullptr, /* 0xed */ + nullptr, /* 0xee */ "CINT", /* 0xef */ "CSNG", /* 0xf0 */ "CDBL", /* 0xf1 */ @@ -802,11 +802,11 @@ static const char *const vzbas[] = "LEFT$", /* 0xf8 */ "RIGHT$", /* 0xf9 */ "MID$", /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - NULL /* 0xff */ + nullptr, /* 0xfb */ + nullptr, /* 0xfc */ + nullptr, /* 0xfd */ + nullptr, /* 0xfe */ + nullptr /* 0xff */ }; static const char *const bml3bas_statements[] = diff --git a/src/tools/imgtool/filteoln.cpp b/src/tools/imgtool/filteoln.cpp index 30fb52ed429..457ac89aee6 100644 --- a/src/tools/imgtool/filteoln.cpp +++ b/src/tools/imgtool/filteoln.cpp @@ -58,14 +58,14 @@ static imgtoolerr_t ascii_readfile(imgtool_partition *partition, const char *fil imgtoolerr_t err; imgtool_stream *mem_stream; - mem_stream = stream_open_mem(NULL, 0); + mem_stream = stream_open_mem(nullptr, 0); if (!mem_stream) { err = IMGTOOLERR_OUTOFMEMORY; goto done; } - err = imgtool_partition_read_file(partition, filename, fork, mem_stream, NULL); + err = imgtool_partition_read_file(partition, filename, fork, mem_stream, nullptr); if (err) goto done; @@ -85,11 +85,11 @@ done: static imgtoolerr_t ascii_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) { imgtoolerr_t err; - imgtool_stream *mem_stream = NULL; + imgtool_stream *mem_stream = nullptr; const char *eoln; /* create a stream */ - mem_stream = stream_open_mem(NULL, 0); + mem_stream = stream_open_mem(nullptr, 0); if (!mem_stream) { err = IMGTOOLERR_OUTOFMEMORY; @@ -103,7 +103,7 @@ static imgtoolerr_t ascii_writefile(imgtool_partition *partition, const char *fi goto done; stream_seek(mem_stream, SEEK_SET, 0); - err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, NULL); + err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, nullptr); if (err) goto done; diff --git a/src/tools/imgtool/filter.cpp b/src/tools/imgtool/filter.cpp index 5887d6b501d..cd90026b6f7 100644 --- a/src/tools/imgtool/filter.cpp +++ b/src/tools/imgtool/filter.cpp @@ -25,7 +25,7 @@ INT64 filter_get_info_int(filter_getinfoproc get_info, UINT32 state) void *filter_get_info_ptr(filter_getinfoproc get_info, UINT32 state) { union filterinfo info; - info.p = NULL; + info.p = nullptr; get_info(state, &info); return info.p; } @@ -33,7 +33,7 @@ void *filter_get_info_ptr(filter_getinfoproc get_info, UINT32 state) void *filter_get_info_fct(filter_getinfoproc get_info, UINT32 state) { union filterinfo info; - info.f = NULL; + info.f = nullptr; get_info(state, &info); return info.f; } @@ -41,7 +41,7 @@ void *filter_get_info_fct(filter_getinfoproc get_info, UINT32 state) const char *filter_get_info_string(filter_getinfoproc get_info, UINT32 state) { union filterinfo info; - info.s = NULL; + info.s = nullptr; get_info(state, &info); return info.s; } @@ -61,7 +61,7 @@ const filter_getinfoproc filters[] = filter_thombas128_getinfo, filter_thomcrypt_getinfo, filter_bml3bas_getinfo, - NULL + nullptr }; @@ -78,5 +78,5 @@ filter_getinfoproc filter_lookup(const char *name) return filters[i]; } - return NULL; + return nullptr; } diff --git a/src/tools/imgtool/iflopimg.cpp b/src/tools/imgtool/iflopimg.cpp index 9e8493f9477..3bf05aacd35 100644 --- a/src/tools/imgtool/iflopimg.cpp +++ b/src/tools/imgtool/iflopimg.cpp @@ -81,7 +81,7 @@ static const struct io_procs imgtool_ioprocs = static const struct io_procs imgtool_noclose_ioprocs = { - NULL, + nullptr, imgtool_floppy_seekproc, imgtool_floppy_readproc, imgtool_floppy_writeproc, @@ -118,7 +118,7 @@ static imgtoolerr_t imgtool_floppy_open_internal(imgtool_image *image, imgtool_s /* open up the floppy */ ferr = floppy_open(f, noclose ? &imgtool_noclose_ioprocs : &imgtool_ioprocs, - NULL, format, FLOPPY_FLAGS_READWRITE, &fimg->floppy); + nullptr, format, FLOPPY_FLAGS_READWRITE, &fimg->floppy); if (ferr) { err = imgtool_floppy_error(ferr); @@ -127,7 +127,7 @@ static imgtoolerr_t imgtool_floppy_open_internal(imgtool_image *image, imgtool_s if (open) { - err = open(image, NULL); + err = open(image, nullptr); if (err) return err; } @@ -171,7 +171,7 @@ static imgtoolerr_t imgtool_floppy_create(imgtool_image *image, imgtool_stream * /* do we have to do extra stuff when creating the image? */ if (create) { - err = create(image, NULL, opts); + err = create(image, nullptr, opts); if (err) goto done; } @@ -179,7 +179,7 @@ static imgtoolerr_t imgtool_floppy_create(imgtool_image *image, imgtool_stream * /* do we have to do extra stuff when opening the image? */ if (open) { - err = open(image, NULL); + err = open(image, nullptr); if (err) goto done; } @@ -269,7 +269,7 @@ static void imgtool_floppy_get_info(const imgtool_class *imgclass, UINT32 state, case IMGTOOLINFO_PTR_OPEN: info->open = imgtool_floppy_open; break; case IMGTOOLINFO_PTR_CREATE: info->create = imgtool_floppy_create; break; case IMGTOOLINFO_PTR_CLOSE: info->close = imgtool_floppy_close; break; - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = format->param_guidelines ? floppy_option_guide : NULL; break; + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = format->param_guidelines ? floppy_option_guide : nullptr; break; case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = imgtool_floppy_get_sector_size; break; case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = imgtool_floppy_read_sector; break; case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = imgtool_floppy_write_sector; break; diff --git a/src/tools/imgtool/imghd.cpp b/src/tools/imgtool/imghd.cpp index 8ac129751f9..b3161ae2caf 100644 --- a/src/tools/imgtool/imghd.cpp +++ b/src/tools/imgtool/imghd.cpp @@ -134,8 +134,8 @@ imgtoolerr_t imghd_open(imgtool_stream *stream, struct mess_hard_disk_file *hard chd_error chderr; imgtoolerr_t err = IMGTOOLERR_SUCCESS; - hard_disk->hard_disk = NULL; - hard_disk->chd = NULL; + hard_disk->hard_disk = nullptr; + hard_disk->chd = nullptr; chderr = hard_disk->chd->open(*stream_core_file(stream), stream_isreadonly(stream)); if (chderr) @@ -170,7 +170,7 @@ void imghd_close(struct mess_hard_disk_file *disk) if (disk->hard_disk) { hard_disk_close(disk->hard_disk); - disk->hard_disk = NULL; + disk->hard_disk = nullptr; } if (disk->stream) stream_close(disk->stream); diff --git a/src/tools/imgtool/imgtool.cpp b/src/tools/imgtool/imgtool.cpp index df44a9bbff2..c2c07e4ee23 100644 --- a/src/tools/imgtool/imgtool.cpp +++ b/src/tools/imgtool/imgtool.cpp @@ -170,7 +170,7 @@ char *imgtool_basename(char *filename) // NULL begets NULL if (!filename) - return NULL; + return nullptr; // start at the end and return when we hit a slash or colon for (c = filename + strlen(filename) - 1; c >= filename; c--) @@ -240,9 +240,9 @@ void imgtool_exit(void) if (global_imgtool_library) { imgtool_library_close(global_imgtool_library); - global_imgtool_library = NULL; + global_imgtool_library = nullptr; } - global_warn = NULL; + global_warn = nullptr; } @@ -311,9 +311,9 @@ static imgtoolerr_t evaluate_module(const char *fname, const imgtool_module *module, float *result) { imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - imgtool_directory *imageenum = NULL; + imgtool_image *image = nullptr; + imgtool_partition *partition = nullptr; + imgtool_directory *imageenum = nullptr; imgtool_dirent ent; float current_result; @@ -331,7 +331,7 @@ static imgtoolerr_t evaluate_module(const char *fname, if (err) goto done; - err = imgtool_directory_open(partition, NULL, &imageenum); + err = imgtool_directory_open(partition, nullptr, &imageenum); if (err) goto done; @@ -387,12 +387,12 @@ imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules, { imgtoolerr_t err = IMGTOOLERR_SUCCESS; imgtool_library *library = global_imgtool_library; - imgtool_module *module = NULL; + imgtool_module *module = nullptr; imgtool_module *insert_module; imgtool_module *temp_module; size_t i = 0; const char *extension; - float val, temp_val, *values = NULL; + float val, temp_val, *values = nullptr; if (count <= 0) { @@ -401,7 +401,7 @@ imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules, } for (i = 0; i < count; i++) - modules[i] = NULL; + modules[i] = nullptr; if (count > 1) count--; /* null terminate */ @@ -420,7 +420,7 @@ imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules, extension++; /* iterate through all modules */ - while((module = imgtool_library_iterate(library, module)) != NULL) + while((module = imgtool_library_iterate(library, module)) != nullptr) { if (!extension || image_find_extension(module->extensions, extension)) { @@ -592,7 +592,7 @@ imgtoolerr_t imgtool_image_write_block(imgtool_image *image, UINT64 block, const imgtoolerr_t imgtool_image_clear_block(imgtool_image *image, UINT64 block, UINT8 data) { imgtoolerr_t err; - UINT8 *block_data = NULL; + UINT8 *block_data = nullptr; UINT32 length; err = imgtool_image_get_block_size(image, &length); @@ -666,7 +666,7 @@ const imgtool_module *imgtool_image_module(imgtool_image *img) void *imgtool_image_extra_bytes(imgtool_image *image) { - void *ptr = NULL; + void *ptr = nullptr; if (image->module->image_extra_bytes > 0) ptr = ((UINT8 *) image) + sizeof(*image); assert(ptr); @@ -699,7 +699,7 @@ UINT64 imgtool_image_rand(imgtool_image *image) static char *pool_strdup_allow_null(object_pool *pool, char *s) { - return s ? pool_strdup_lib(pool, s) : NULL; + return s ? pool_strdup_lib(pool, s) : nullptr; } @@ -707,7 +707,7 @@ static char *pool_strdup_allow_null(object_pool *pool, char *s) imgtoolerr_t imgtool_partition_open(imgtool_image *image, int partition_index, imgtool_partition **partition) { imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; - imgtool_partition *p = NULL; + imgtool_partition *p = nullptr; imgtool_class imgclass; imgtool_partition_info partition_info[32]; UINT64 base_block, block_count; @@ -753,7 +753,7 @@ imgtoolerr_t imgtool_partition_open(imgtool_image *image, int partition_index, i partition_extra_bytes = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES); /* allocate the new memory pool */ - pool = pool_alloc_lib(NULL); + pool = pool_alloc_lib(nullptr); if (!pool) { err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; @@ -806,12 +806,12 @@ imgtoolerr_t imgtool_partition_open(imgtool_image *image, int partition_index, i /* mask out if writing is untested */ if (global_omit_untested && imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_WRITING_UNTESTED)) { - p->write_file = NULL; - p->delete_file = NULL; - p->create_dir = NULL; - p->delete_dir = NULL; - p->writefile_optguide = NULL; - p->writefile_optspec = NULL; + p->write_file = nullptr; + p->delete_file = nullptr; + p->create_dir = nullptr; + p->delete_dir = nullptr; + p->writefile_optguide = nullptr; + p->writefile_optspec = nullptr; } /* call the partition open function, if present */ @@ -825,7 +825,7 @@ imgtoolerr_t imgtool_partition_open(imgtool_image *image, int partition_index, i } done: - *partition = err ? NULL : p; + *partition = err ? nullptr : p; return err; } @@ -930,18 +930,18 @@ int imgtool_validitychecks(void) int error = 0; int val; imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; - const imgtool_module *module = NULL; + const imgtool_module *module = nullptr; const option_guide *guide_entry; imgtool_module_features features; int created_library = FALSE; if (!global_imgtool_library) { - imgtool_init(FALSE, NULL); + imgtool_init(FALSE, nullptr); created_library = TRUE; } - while((module = imgtool_library_iterate(global_imgtool_library, module)) != NULL) + while((module = imgtool_library_iterate(global_imgtool_library, module)) != nullptr) { features = imgtool_get_module_features(module); @@ -1091,13 +1091,13 @@ static imgtoolerr_t internal_open(const imgtool_module *module, const char *fnam int read_or_write, option_resolution *createopts, imgtool_image **outimg) { imgtoolerr_t err; - imgtool_stream *f = NULL; - imgtool_image *image = NULL; - object_pool *pool = NULL; + imgtool_stream *f = nullptr; + imgtool_image *image = nullptr; + object_pool *pool = nullptr; size_t size; if (outimg) - *outimg = NULL; + *outimg = nullptr; /* is the requested functionality implemented? */ if ((read_or_write == OSD_FOPEN_RW_CREATE) ? !module->create : !module->open) @@ -1107,7 +1107,7 @@ static imgtoolerr_t internal_open(const imgtool_module *module, const char *fnam } /* create a memory pool */ - pool = pool_alloc_lib(NULL); + pool = pool_alloc_lib(nullptr); if (!pool) { err = (imgtoolerr_t)(IMGTOOLERR_OUTOFMEMORY); @@ -1152,7 +1152,7 @@ done: stream_close(f); if (pool) pool_free_lib(pool); - image = NULL; + image = nullptr; } if (outimg) @@ -1171,7 +1171,7 @@ done: imgtoolerr_t imgtool_image_open(const imgtool_module *module, const char *fname, int read_or_write, imgtool_image **outimg) { read_or_write = read_or_write ? OSD_FOPEN_RW : OSD_FOPEN_READ; - return internal_open(module, fname, read_or_write, NULL, outimg); + return internal_open(module, fname, read_or_write, nullptr, outimg); } @@ -1214,7 +1214,7 @@ imgtoolerr_t imgtool_image_create(const imgtool_module *module, const char *fnam option_resolution *opts, imgtool_image **image) { imgtoolerr_t err; - option_resolution *alloc_resolution = NULL; + option_resolution *alloc_resolution = nullptr; /* allocate dummy options if necessary */ if (!opts && module->createimage_optguide) @@ -1291,7 +1291,7 @@ static imgtoolerr_t cannonicalize_path(imgtool_partition *partition, UINT32 flag const char **path, char **alloc_path) { imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; - char *new_path = NULL; + char *new_path = nullptr; char path_separator, alt_path_separator; const char *s; int in_path_separator, i, j; @@ -1323,7 +1323,7 @@ static imgtoolerr_t cannonicalize_path(imgtool_partition *partition, UINT32 flag err = (imgtoolerr_t)(IMGTOOLERR_CANNOTUSEPATH | IMGTOOLERR_SRC_FUNCTIONALITY); goto done; } - *path = NULL; /* normalize empty path */ + *path = nullptr; /* normalize empty path */ } } else @@ -1395,7 +1395,7 @@ static imgtoolerr_t cannonicalize_fork(imgtool_partition *partition, const char imgtoolerr_t imgtool_partition_get_directory_entry(imgtool_partition *partition, const char *path, int index, imgtool_dirent *ent) { imgtoolerr_t err; - imgtool_directory *imgenum = NULL; + imgtool_directory *imgenum = nullptr; if (index < 0) { @@ -1443,7 +1443,7 @@ imgtoolerr_t imgtool_partition_get_file_size(imgtool_partition *partition, const imgtool_dirent ent; const char *path; - path = NULL; /* TODO: Need to parse off the path */ + path = nullptr; /* TODO: Need to parse off the path */ *filesize = -1; memset(&ent, 0, sizeof(ent)); @@ -1484,8 +1484,8 @@ done: imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len) { imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; + char *alloc_path = nullptr; + char *new_fname = nullptr; memset(attrs, 0, sizeof(*attrs) * len); @@ -1496,7 +1496,7 @@ imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition } new_fname = normalize_filename(partition, path); - if (new_fname == NULL) + if (new_fname == nullptr) { err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); goto done; @@ -1514,9 +1514,9 @@ imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition goto done; done: - if (alloc_path != NULL) + if (alloc_path != nullptr) free(alloc_path); - if (new_fname != NULL) + if (new_fname != nullptr) osd_free(new_fname); return err; } @@ -1531,8 +1531,8 @@ done: imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) { imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; + char *alloc_path = nullptr; + char *new_fname = nullptr; if (!partition->get_attrs) { @@ -1541,7 +1541,7 @@ imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, } new_fname = normalize_filename(partition, path); - if (new_fname == NULL) + if (new_fname == nullptr) { err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); goto done; @@ -1559,9 +1559,9 @@ imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, goto done; done: - if (alloc_path != NULL) + if (alloc_path != nullptr) free(alloc_path); - if (new_fname != NULL) + if (new_fname != nullptr) osd_free(new_fname); return err; } @@ -1576,7 +1576,7 @@ done: imgtoolerr_t imgtool_partition_put_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) { imgtoolerr_t err; - char *alloc_path = NULL; + char *alloc_path = nullptr; if (!partition->set_attrs) { @@ -1639,8 +1639,8 @@ imgtoolerr_t imgtool_partition_put_file_attribute(imgtool_partition *partition, imgtoolerr_t imgtool_partition_get_icon_info(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo) { imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; + char *alloc_path = nullptr; + char *new_fname = nullptr; if (!partition->get_iconinfo) { @@ -1649,7 +1649,7 @@ imgtoolerr_t imgtool_partition_get_icon_info(imgtool_partition *partition, const } new_fname = normalize_filename(partition, path); - if (new_fname == NULL) + if (new_fname == nullptr) { err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); goto done; @@ -1688,7 +1688,7 @@ imgtoolerr_t imgtool_partition_suggest_file_filters(imgtool_partition *partition { imgtoolerr_t err; int i, j; - char *alloc_path = NULL; + char *alloc_path = nullptr; imgtoolerr_t (*check_stream)(imgtool_stream *stream, imgtool_suggestion_viability_t *viability); size_t position; @@ -1890,7 +1890,7 @@ imgtoolerr_t imgtool_partition_get_free_space(imgtool_partition *partition, UINT imgtoolerr_t imgtool_partition_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter) { imgtoolerr_t err; - char *alloc_path = NULL; + char *alloc_path = nullptr; union filterinfo u; if (!partition->read_file) @@ -1952,10 +1952,10 @@ done: imgtoolerr_t imgtool_partition_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts, filter_getinfoproc filter) { imgtoolerr_t err; - char *buf = NULL; + char *buf = nullptr; char *s; - option_resolution *alloc_resolution = NULL; - char *alloc_path = NULL; + option_resolution *alloc_resolution = nullptr; + char *alloc_path = nullptr; UINT64 free_space; UINT64 file_size; union filterinfo u; @@ -2073,17 +2073,17 @@ imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char { imgtoolerr_t err; imgtool_stream *f; - char *new_fname = NULL; - char *alloc_dest = NULL; - const char *filter_extension = NULL; + char *new_fname = nullptr; + char *alloc_dest = nullptr; + const char *filter_extension = nullptr; if (!dest) { /* determine the filter extension, if appropriate */ - if (filter != NULL) + if (filter != nullptr) filter_extension = filter_get_info_string(filter, FILTINFO_STR_EXTENSION); - if (filter_extension != NULL) + if (filter_extension != nullptr) { alloc_dest = (char*)malloc(strlen(filename) + 1 + strlen(filter_extension) + 1); if (!alloc_dest) @@ -2109,7 +2109,7 @@ imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char } new_fname = normalize_filename(partition, filename); - if (new_fname == NULL) + if (new_fname == nullptr) { err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); goto done; @@ -2120,11 +2120,11 @@ imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char goto done; done: - if (f != NULL) + if (f != nullptr) stream_close(f); - if (alloc_dest != NULL) + if (alloc_dest != nullptr) free(alloc_dest); - if (new_fname != NULL) + if (new_fname != nullptr) osd_free(new_fname); return err; } @@ -2140,9 +2140,9 @@ imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char const char *source, option_resolution *opts, filter_getinfoproc filter) { imgtoolerr_t err; - imgtool_stream *f = NULL; + imgtool_stream *f = nullptr; imgtool_charset charset; - char *alloc_newfname = NULL; + char *alloc_newfname = nullptr; if (!newfname) newfname = (const char *) imgtool_basename((char *) source); @@ -2152,7 +2152,7 @@ imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char { /* convert to native format */ alloc_newfname = native_from_utf8(charset, newfname); - if (alloc_newfname == NULL) + if (alloc_newfname == nullptr) { err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_NATIVEFILE); goto done; @@ -2169,9 +2169,9 @@ imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char done: /* clean up */ - if (f != NULL) + if (f != nullptr) stream_close(f); - if (alloc_newfname != NULL) + if (alloc_newfname != nullptr) osd_free(alloc_newfname); return err; } @@ -2186,8 +2186,8 @@ done: imgtoolerr_t imgtool_partition_delete_file(imgtool_partition *partition, const char *fname) { imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; + char *alloc_path = nullptr; + char *new_fname = nullptr; if (!partition->delete_file) { @@ -2196,7 +2196,7 @@ imgtoolerr_t imgtool_partition_delete_file(imgtool_partition *partition, const c } new_fname = normalize_filename(partition, fname); - if (new_fname == NULL) + if (new_fname == nullptr) { err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); goto done; @@ -2234,8 +2234,8 @@ done: imgtoolerr_t imgtool_partition_list_file_forks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len) { imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; + char *alloc_path = nullptr; + char *new_fname = nullptr; if (!partition->list_forks) { @@ -2244,7 +2244,7 @@ imgtoolerr_t imgtool_partition_list_file_forks(imgtool_partition *partition, con } new_fname = normalize_filename(partition, path); - if (new_fname == NULL) + if (new_fname == nullptr) { err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); goto done; @@ -2279,8 +2279,8 @@ done: imgtoolerr_t imgtool_partition_create_directory(imgtool_partition *partition, const char *path) { imgtoolerr_t err; - char *alloc_path = NULL; - char *new_path = NULL; + char *alloc_path = nullptr; + char *new_path = nullptr; /* implemented? */ if (!partition->create_dir) @@ -2290,7 +2290,7 @@ imgtoolerr_t imgtool_partition_create_directory(imgtool_partition *partition, co } new_path = normalize_filename(partition, path); - if (new_path == NULL) + if (new_path == nullptr) { err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); goto done; @@ -2325,8 +2325,8 @@ done: imgtoolerr_t imgtool_partition_delete_directory(imgtool_partition *partition, const char *path) { imgtoolerr_t err; - char *alloc_path = NULL; - char *new_path = NULL; + char *alloc_path = nullptr; + char *new_path = nullptr; /* implemented? */ if (!partition->delete_dir) @@ -2336,7 +2336,7 @@ imgtoolerr_t imgtool_partition_delete_directory(imgtool_partition *partition, co } new_path = normalize_filename(partition, path); - if (new_path == NULL) + if (new_path == nullptr) { err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); goto done; @@ -2482,7 +2482,7 @@ UINT64 imgtool_partition_get_info_int(imgtool_partition *partition, UINT32 state void *imgtool_partition_extra_bytes(imgtool_partition *partition) { - void *ptr = NULL; + void *ptr = nullptr; if (partition->partition_extra_bytes > 0) ptr = ((UINT8 *) partition) + sizeof(*partition); assert(ptr); @@ -2618,16 +2618,16 @@ const char *imgtool_partition_get_base_name(imgtool_partition *partition, const imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *path, imgtool_directory **outenum) { imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; - imgtool_directory *enumeration = NULL; - char *alloc_path = NULL; - char *new_path = NULL; + imgtool_directory *enumeration = nullptr; + char *alloc_path = nullptr; + char *new_path = nullptr; size_t size; /* sanity checks */ assert(partition); assert(outenum); - *outenum = NULL; + *outenum = nullptr; if (!partition->next_enum) { @@ -2663,14 +2663,14 @@ imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *pa } done: - if (alloc_path != NULL) + if (alloc_path != nullptr) free(alloc_path); - if (new_path != NULL) + if (new_path != nullptr) osd_free(new_path); - if (err && (enumeration != NULL)) + if (err && (enumeration != nullptr)) { free(enumeration); - enumeration = NULL; + enumeration = nullptr; } *outenum = enumeration; return err; @@ -2731,17 +2731,17 @@ imgtoolerr_t imgtool_directory_get_next(imgtool_directory *directory, imgtool_di /* don't trust the module! */ if (!partition->supports_creation_time && (ent->creation_time != 0)) { - internal_error(NULL, "next_enum() specified creation_time, which is marked as unsupported by this module"); + internal_error(nullptr, "next_enum() specified creation_time, which is marked as unsupported by this module"); return IMGTOOLERR_UNEXPECTED; } if (!partition->supports_lastmodified_time && (ent->lastmodified_time != 0)) { - internal_error(NULL, "next_enum() specified lastmodified_time, which is marked as unsupported by this module"); + internal_error(nullptr, "next_enum() specified lastmodified_time, which is marked as unsupported by this module"); return IMGTOOLERR_UNEXPECTED; } if (!partition->path_separator && ent->directory) { - internal_error(NULL, "next_enum() returned a directory, which is marked as unsupported by this module"); + internal_error(nullptr, "next_enum() returned a directory, which is marked as unsupported by this module"); return IMGTOOLERR_UNEXPECTED; } return IMGTOOLERR_SUCCESS; diff --git a/src/tools/imgtool/library.cpp b/src/tools/imgtool/library.cpp index e2ce14d4461..88c1119a85a 100644 --- a/src/tools/imgtool/library.cpp +++ b/src/tools/imgtool/library.cpp @@ -30,7 +30,7 @@ imgtool_library *imgtool_library_create(void) object_pool *pool; /* create a memory pool */ - pool = pool_alloc_lib(NULL); + pool = pool_alloc_lib(nullptr); if (!pool) goto error; @@ -48,7 +48,7 @@ imgtool_library *imgtool_library_create(void) error: if (pool) pool_free_lib(pool); - return NULL; + return nullptr; } @@ -162,12 +162,12 @@ const imgtool_module *imgtool_library_unlink(imgtool_library *library, next = m->next ? &m->next->previous : &library->last; *previous = m->next; *next = m->previous; - m->previous = NULL; - m->next = NULL; + m->previous = nullptr; + m->next = nullptr; return m; } } - return NULL; + return nullptr; } @@ -278,5 +278,5 @@ char *imgtool_library_strdup(imgtool_library *library, const char *s) char *imgtool_library_strdup_allow_null(imgtool_library *library, const char *s) { - return s ? imgtool_library_strdup(library, s) : NULL; + return s ? imgtool_library_strdup(library, s) : nullptr; } diff --git a/src/tools/imgtool/library.h b/src/tools/imgtool/library.h index 25c923c1f4d..0ea52a68e44 100644 --- a/src/tools/imgtool/library.h +++ b/src/tools/imgtool/library.h @@ -308,7 +308,7 @@ INLINE INT64 imgtool_get_info_int(const imgtool_class *imgclass, UINT32 state) INLINE void *imgtool_get_info_ptr(const imgtool_class *imgclass, UINT32 state) { union imgtoolinfo info; - info.p = NULL; + info.p = nullptr; imgclass->get_info(imgclass, state, &info); return info.p; } @@ -316,7 +316,7 @@ INLINE void *imgtool_get_info_ptr(const imgtool_class *imgclass, UINT32 state) INLINE void *imgtool_get_info_fct(const imgtool_class *imgclass, UINT32 state) { union imgtoolinfo info; - info.f = NULL; + info.f = nullptr; imgclass->get_info(imgclass, state, &info); return info.f; } @@ -324,7 +324,7 @@ INLINE void *imgtool_get_info_fct(const imgtool_class *imgclass, UINT32 state) INLINE char *imgtool_get_info_string(const imgtool_class *imgclass, UINT32 state) { union imgtoolinfo info; - info.s = NULL; + info.s = nullptr; imgclass->get_info(imgclass, state, &info); return info.s; } diff --git a/src/tools/imgtool/main.cpp b/src/tools/imgtool/main.cpp index 6825b71fa81..fb34403f51a 100644 --- a/src/tools/imgtool/main.cpp +++ b/src/tools/imgtool/main.cpp @@ -38,15 +38,15 @@ static int parse_options(int argc, char *argv[], int minunnamed, int maxunnamed, int i; int lastunnamed = 0; char *s; - char *name = NULL; - char *value = NULL; + char *name = nullptr; + char *value = nullptr; optreserr_t oerr; static char buf[256]; if (filter) - *filter = NULL; + *filter = nullptr; if (fork) - *fork = NULL; + *fork = nullptr; for (i = 0; i < argc; i++) { @@ -177,9 +177,9 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) imgtoolerr_t err; int total_count, total_size, freespace_err; UINT64 freespace; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - imgtool_directory *imgenum = NULL; + imgtool_image *image = nullptr; + imgtool_partition *partition = nullptr; + imgtool_directory *imgenum = nullptr; imgtool_dirent ent; char buf[512]; char last_modified[19]; @@ -196,7 +196,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) if (err) goto done; - path = argc > 2 ? argv[2] : NULL; + path = argc > 2 ? argv[2] : nullptr; err = imgtool_directory_open(partition, path, &imgenum); if (err) @@ -260,7 +260,7 @@ done: if (image) imgtool_image_close(image); if (err) - reporterror(err, c, argv[0], argv[1], NULL, NULL, NULL); + reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr); return err ? -1 : 0; } @@ -269,8 +269,8 @@ done: static int cmd_get(const struct command *c, int argc, char *argv[]) { imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; + imgtool_image *image = nullptr; + imgtool_partition *partition = nullptr; const char *filename; char *new_filename; int unnamedargs = 0; @@ -288,11 +288,11 @@ static int cmd_get(const struct command *c, int argc, char *argv[]) filename = interpret_filename(argv[2]); - unnamedargs = parse_options(argc, argv, 3, 4, NULL, &filter, &fork); + unnamedargs = parse_options(argc, argv, 3, 4, nullptr, &filter, &fork); if (unnamedargs < 0) goto done; - new_filename = (unnamedargs == 4) ? argv[3] : NULL; + new_filename = (unnamedargs == 4) ? argv[3] : nullptr; err = imgtool_partition_get_file(partition, filename, fork, new_filename, filter); if (err) @@ -302,7 +302,7 @@ static int cmd_get(const struct command *c, int argc, char *argv[]) done: if (err) - reporterror(err, c, argv[0], argv[1], argv[2], argv[3], NULL); + reporterror(err, c, argv[0], argv[1], argv[2], argv[3], nullptr); if (partition) imgtool_partition_close(partition); if (image) @@ -316,13 +316,13 @@ static int cmd_put(const struct command *c, int argc, char *argv[]) { imgtoolerr_t err = IMGTOOLERR_SUCCESS; int i; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - const char *filename = NULL; + imgtool_image *image = nullptr; + imgtool_partition *partition = nullptr; + const char *filename = nullptr; int unnamedargs; filter_getinfoproc filter; const imgtool_module *module; - option_resolution *resolution = NULL; + option_resolution *resolution = nullptr; const char *fork; const char *new_filename; char **filename_list; @@ -394,7 +394,7 @@ done: if (resolution) option_resolution_close(resolution); if (err) - reporterror(err, c, argv[0], argv[1], filename, NULL, resolution); + reporterror(err, c, argv[0], argv[1], filename, nullptr, resolution); return err ? -1 : 0; } @@ -403,13 +403,13 @@ done: static int cmd_getall(const struct command *c, int argc, char *argv[]) { imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - imgtool_directory *imgenum = NULL; + imgtool_image *image = nullptr; + imgtool_partition *partition = nullptr; + imgtool_directory *imgenum = nullptr; imgtool_dirent ent; filter_getinfoproc filter; int unnamedargs; - const char *path = NULL; + const char *path = nullptr; int arg; int partition_index = 0; @@ -427,7 +427,7 @@ static int cmd_getall(const struct command *c, int argc, char *argv[]) path = argv[arg++]; } - unnamedargs = parse_options(argc, argv, arg, arg, NULL, &filter, NULL); + unnamedargs = parse_options(argc, argv, arg, arg, nullptr, &filter, nullptr); if (unnamedargs < 0) goto done; @@ -441,7 +441,7 @@ static int cmd_getall(const struct command *c, int argc, char *argv[]) { fprintf(stdout, "Retrieving %s (%u bytes)\n", ent.filename, (unsigned int) ent.filesize); - err = imgtool_partition_get_file(partition, ent.filename, NULL, NULL, filter); + err = imgtool_partition_get_file(partition, ent.filename, nullptr, nullptr, filter); if (err) goto done; } @@ -454,7 +454,7 @@ done: if (image) imgtool_image_close(image); if (err) - reporterror(err, c, argv[0], argv[1], NULL, NULL, NULL); + reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr); return err ? -1 : 0; } @@ -463,8 +463,8 @@ done: static int cmd_del(const struct command *c, int argc, char *argv[]) { imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; + imgtool_image *image = nullptr; + imgtool_partition *partition = nullptr; int partition_index = 0; err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &image); @@ -485,7 +485,7 @@ done: if (image) imgtool_image_close(image); if (err) - reporterror(err, c, argv[0], argv[1], argv[2], NULL, NULL); + reporterror(err, c, argv[0], argv[1], argv[2], nullptr, nullptr); return err ? -1 : 0; } @@ -494,8 +494,8 @@ done: static int cmd_mkdir(const struct command *c, int argc, char *argv[]) { imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; + imgtool_image *image = nullptr; + imgtool_partition *partition = nullptr; int partition_index = 0; err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &image); @@ -516,7 +516,7 @@ done: if (image) imgtool_image_close(image); if (err) - reporterror(err, c, argv[0], argv[1], argv[2], NULL, NULL); + reporterror(err, c, argv[0], argv[1], argv[2], nullptr, nullptr); return err ? -1 : 0; } @@ -525,8 +525,8 @@ done: static int cmd_rmdir(const struct command *c, int argc, char *argv[]) { imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; + imgtool_image *image = nullptr; + imgtool_partition *partition = nullptr; int partition_index = 0; err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &image); @@ -547,7 +547,7 @@ done: if (image) imgtool_image_close(image); if (err) - reporterror(err, c, argv[0], argv[1], argv[2], NULL, NULL); + reporterror(err, c, argv[0], argv[1], argv[2], nullptr, nullptr); return err ? -1 : 0; } @@ -571,7 +571,7 @@ static int cmd_identify(const struct command *c, int argc, char *argv[]) return 0; error: - reporterror(err, c, NULL, argv[0], NULL, NULL, 0); + reporterror(err, c, nullptr, argv[0], nullptr, nullptr, nullptr); return -1; } @@ -582,7 +582,7 @@ static int cmd_create(const struct command *c, int argc, char *argv[]) imgtoolerr_t err; int unnamedargs; const imgtool_module *module; - option_resolution *resolution = NULL; + option_resolution *resolution = nullptr; module = imgtool_find_module(argv[0]); if (!module) @@ -601,11 +601,11 @@ static int cmd_create(const struct command *c, int argc, char *argv[]) } } - unnamedargs = parse_options(argc, argv, 2, 3, resolution, NULL, NULL); + unnamedargs = parse_options(argc, argv, 2, 3, resolution, nullptr, nullptr); if (unnamedargs < 0) return -1; - err = imgtool_image_create(module, argv[1], resolution, NULL); + err = imgtool_image_create(module, argv[1], resolution, nullptr); if (err) goto error; @@ -616,7 +616,7 @@ static int cmd_create(const struct command *c, int argc, char *argv[]) error: if (resolution) option_resolution_close(resolution); - reporterror(err, c, argv[0], argv[1], NULL, NULL, 0); + reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr); return -1; } @@ -626,7 +626,7 @@ static int cmd_readsector(const struct command *c, int argc, char *argv[]) { imgtoolerr_t err; imgtool_image *img; - imgtool_stream *stream = NULL; + imgtool_stream *stream = nullptr; dynamic_buffer buffer; UINT32 size, track, head, sector; @@ -663,7 +663,7 @@ done: if (stream) stream_close(stream); if (err) - reporterror(err, c, argv[0], argv[1], NULL, NULL, 0); + reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr); return err ? -1 : 0; } @@ -673,7 +673,7 @@ static int cmd_writesector(const struct command *c, int argc, char *argv[]) { imgtoolerr_t err; imgtool_image *img; - imgtool_stream *stream = NULL; + imgtool_stream *stream = nullptr; dynamic_buffer buffer; UINT32 size, track, head, sector; @@ -707,7 +707,7 @@ done: if (stream) stream_close(stream); if (err) - reporterror(err, c, argv[0], argv[1], NULL, NULL, 0); + reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr); return err ? -1 : 0; } @@ -719,7 +719,7 @@ static int cmd_listformats(const struct command *c, int argc, char *argv[]) fprintf(stdout, "Image formats supported by imgtool:\n\n"); - mod = imgtool_find_module(NULL); + mod = imgtool_find_module(nullptr); while(mod) { fprintf(stdout, " %-25s%s\n", mod->name, mod->description); @@ -865,7 +865,7 @@ static int cmd_listdriveroptions(const struct command *c, int argc, char *argv[] return 0; error: - reporterror((imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND|IMGTOOLERR_SRC_MODULE), c, argv[0], NULL, NULL, NULL, NULL); + reporterror((imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND|IMGTOOLERR_SRC_MODULE), c, argv[0], nullptr, nullptr, nullptr, nullptr); return -1; } @@ -886,8 +886,8 @@ static const struct command cmds[] = { "readsector", cmd_readsector, " ", 6, 6, 0 }, { "writesector", cmd_writesector, " ", 6, 6, 0 }, { "identify", cmd_identify, "", 1, 1 }, - { "listformats", cmd_listformats, NULL, 0, 0, 0 }, - { "listfilters", cmd_listfilters, NULL, 0, 0, 0 }, + { "listformats", cmd_listformats, nullptr, 0, 0, 0 }, + { "listfilters", cmd_listfilters, nullptr, 0, 0, 0 }, { "listdriveroptions", cmd_listdriveroptions, "", 1, 1, 0 } }; @@ -918,7 +918,7 @@ int CLIB_DECL main(int argc, char *argv[]) goto cmderror; /* initialize the imgtool core */ - imgtool_init(TRUE, NULL); + imgtool_init(TRUE, nullptr); if (c->lastargrepeats && (argc > c->maxargs)) { diff --git a/src/tools/imgtool/modules.cpp b/src/tools/imgtool/modules.cpp index 982fec1972c..72f81b862b9 100644 --- a/src/tools/imgtool/modules.cpp +++ b/src/tools/imgtool/modules.cpp @@ -60,18 +60,18 @@ imgtoolerr_t imgtool_create_cannonical_library(int omit_untested, imgtool_librar /* if we are omitting untested, go through and block out the functionality in question */ if (omit_untested) { - module = NULL; - while((module = imgtool_library_iterate(lib, module)) != NULL) + module = nullptr; + while((module = imgtool_library_iterate(lib, module)) != nullptr) { if (module->writing_untested) { - module->write_sector = NULL; + module->write_sector = nullptr; } if (module->creation_untested) { - module->create = NULL; - module->createimage_optguide = NULL; - module->createimage_optspec = NULL; + module->create = nullptr; + module->createimage_optguide = nullptr; + module->createimage_optspec = nullptr; } } } diff --git a/src/tools/imgtool/stream.cpp b/src/tools/imgtool/stream.cpp index 5c9cf4050c6..461d2fd99bd 100644 --- a/src/tools/imgtool/stream.cpp +++ b/src/tools/imgtool/stream.cpp @@ -41,9 +41,9 @@ struct imgtool_stream static imgtool_stream *stream_open_zip(const char *zipname, const char *subname, int read_or_write) { - imgtool_stream *imgfile = NULL; + imgtool_stream *imgfile = nullptr; // zip_error ziperr; - zip_file *z = NULL; + zip_file *z = nullptr; const zip_file_header *zipent; FILE *f; @@ -96,7 +96,7 @@ error: free(imgfile->u.buffer); free(imgfile); } - return NULL; + return nullptr; } @@ -105,7 +105,7 @@ imgtool_stream *stream_open(const char *fname, int read_or_write) { file_error filerr; const char *ext; - imgtool_stream *imgfile = NULL; + imgtool_stream *imgfile = nullptr; static const UINT32 write_modes[] = { OPEN_FLAG_READ, @@ -113,16 +113,16 @@ imgtool_stream *stream_open(const char *fname, int read_or_write) OPEN_FLAG_READ | OPEN_FLAG_WRITE, OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE }; - core_file *f = NULL; - char *buf = NULL; + core_file *f = nullptr; + char *buf = nullptr; int len, i; - imgtool_stream *s = NULL; + imgtool_stream *s = nullptr; char c; /* maybe we are just a ZIP? */ ext = strrchr(fname, '.'); if (ext && !core_stricmp(ext, ".zip")) - return stream_open_zip(fname, NULL, read_or_write); + return stream_open_zip(fname, nullptr, read_or_write); filerr = core_fopen(fname, write_modes[read_or_write], &f); if (filerr != FILERR_NONE) @@ -148,7 +148,7 @@ imgtool_stream *stream_open(const char *fname, int read_or_write) } } free(buf); - buf = NULL; + buf = nullptr; if (s) return s; @@ -173,13 +173,13 @@ imgtool_stream *stream_open(const char *fname, int read_or_write) return imgfile; error: - if (imgfile != NULL) + if (imgfile != nullptr) free((void *) imgfile); - if (f != NULL) + if (f != nullptr) core_fclose(f); if (buf) free(buf); - return (imgtool_stream *) NULL; + return (imgtool_stream *) nullptr; } @@ -190,7 +190,7 @@ imgtool_stream *stream_open_write_stream(int size) imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); if (!imgfile) - return NULL; + return nullptr; imgfile->imgtype = IMG_MEM; imgfile->write_protect = 0; @@ -201,7 +201,7 @@ imgtool_stream *stream_open_write_stream(int size) if (!imgfile->u.buffer) { free(imgfile); - return NULL; + return nullptr; } return imgfile; @@ -215,7 +215,7 @@ imgtool_stream *stream_open_mem(void *buf, size_t sz) imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); if (!imgfile) - return NULL; + return nullptr; memset(imgfile, 0, sizeof(*imgfile)); imgfile->imgtype = IMG_MEM; @@ -231,23 +231,23 @@ imgtool_stream *stream_open_mem(void *buf, size_t sz) void stream_close(imgtool_stream *s) { - assert(s != NULL); + assert(s != nullptr); switch(s->imgtype) { case IMG_FILE: - if (s->u.file != NULL) + if (s->u.file != nullptr) { core_fclose(s->u.file); - s->u.file = NULL; + s->u.file = nullptr; } break; case IMG_MEM: - if (s->u.buffer != NULL) + if (s->u.buffer != nullptr) { free(s->u.buffer); - s->u.buffer = NULL; + s->u.buffer = nullptr; } break; @@ -262,7 +262,7 @@ void stream_close(imgtool_stream *s) core_file *stream_core_file(imgtool_stream *stream) { - return (stream->imgtype == IMG_FILE) ? stream->u.file : NULL; + return (stream->imgtype == IMG_FILE) ? stream->u.file : nullptr; } @@ -369,7 +369,7 @@ void *stream_getptr(imgtool_stream *f) break; default: - ptr = NULL; + ptr = nullptr; break; } return ptr; diff --git a/src/tools/jedutil.cpp b/src/tools/jedutil.cpp index 7e4fe826c8a..284b77ae217 100644 --- a/src/tools/jedutil.cpp +++ b/src/tools/jedutil.cpp @@ -1875,93 +1875,93 @@ static pal_data paldata[] = { pal10l8pinfusecolumns, ARRAY_LENGTH(pal10l8pinfusecolumns), print_pal10l8_product_terms, config_pal10l8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL10H8", 320, pal10h8pinfuserows, ARRAY_LENGTH(pal10h8pinfuserows), pal10h8pinfusecolumns, ARRAY_LENGTH(pal10h8pinfusecolumns), print_pal10h8_product_terms, config_pal10h8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL12H6", 384, pal12h6pinfuserows, ARRAY_LENGTH(pal12h6pinfuserows), pal12h6pinfusecolumns, ARRAY_LENGTH(pal12h6pinfusecolumns), print_pal12h6_product_terms, config_pal12h6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL14H4", 448, pal14h4pinfuserows, ARRAY_LENGTH(pal14h4pinfuserows), pal14h4pinfusecolumns, ARRAY_LENGTH(pal14h4pinfusecolumns), print_pal14h4_product_terms, config_pal14h4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16H2", 512, pal16h2pinfuserows, ARRAY_LENGTH(pal16h2pinfuserows), pal16h2pinfusecolumns, ARRAY_LENGTH(pal16h2pinfusecolumns), print_pal16h2_product_terms, config_pal16h2_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16C1", 512, pal16c1pinfuserows, ARRAY_LENGTH(pal16c1pinfuserows), pal16c1pinfusecolumns, ARRAY_LENGTH(pal16c1pinfusecolumns), print_pal16c1_product_terms, config_pal16c1_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL12L6", 384, pal12l6pinfuserows, ARRAY_LENGTH(pal12l6pinfuserows), pal12l6pinfusecolumns, ARRAY_LENGTH(pal12l6pinfusecolumns), print_pal12l6_product_terms, config_pal12l6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL14L4", 448, pal14l4pinfuserows, ARRAY_LENGTH(pal14l4pinfuserows), pal14l4pinfusecolumns, ARRAY_LENGTH(pal14l4pinfusecolumns), print_pal14l4_product_terms, config_pal14l4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16L2", 512, pal16l2pinfuserows, ARRAY_LENGTH(pal16l2pinfuserows), pal16l2pinfusecolumns, ARRAY_LENGTH(pal16l2pinfusecolumns), print_pal16l2_product_terms, config_pal16l2_pins, - NULL, - NULL}, + nullptr, + nullptr}, /*{"15S8", 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},*/ {"PAL16L8", 2048, pal16l8pinfuserows, ARRAY_LENGTH(pal16l8pinfuserows), pal16l8pinfusecolumns, ARRAY_LENGTH(pal16l8pinfusecolumns), print_pal16l8_product_terms, config_pal16l8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16R4", 2048, pal16r4pinfuserows, ARRAY_LENGTH(pal16r4pinfuserows), pal16r4pinfusecolumns, ARRAY_LENGTH(pal16r4pinfusecolumns), print_pal16r4_product_terms, config_pal16r4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16R6", 2048, pal16r6pinfuserows, ARRAY_LENGTH(pal16r6pinfuserows), pal16r6pinfusecolumns, ARRAY_LENGTH(pal16r6pinfusecolumns), print_pal16r6_product_terms, config_pal16r6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16R8", 2048, pal16r8pinfuserows, ARRAY_LENGTH(pal16r8pinfuserows), pal16r8pinfusecolumns, ARRAY_LENGTH(pal16r8pinfusecolumns), print_pal16r8_product_terms, config_pal16r8_pins, - NULL, - NULL}, + nullptr, + nullptr}, /*{"PAL16RA8", 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL}, {"PAL16V8R", 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL},*/ {"PALCE16V8", 2194, @@ -1969,85 +1969,85 @@ static pal_data paldata[] = { palce16v8pinfusecolumns, ARRAY_LENGTH(palce16v8pinfusecolumns), print_palce16v8_product_terms, config_palce16v8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"GAL16V8", 2194, gal16v8pinfuserows, ARRAY_LENGTH(gal16v8pinfuserows), gal16v8pinfusecolumns, ARRAY_LENGTH(gal16v8pinfusecolumns), print_gal16v8_product_terms, config_gal16v8_pins, is_gal16v8_product_term_enabled, - NULL}, + nullptr}, {"18CV8", 2696, peel18cv8pinfuserows, ARRAY_LENGTH(peel18cv8pinfuserows), peel18cv8pinfusecolumns, ARRAY_LENGTH(peel18cv8pinfusecolumns), print_peel18cv8_product_terms, config_peel18cv8_pins, - NULL, + nullptr, get_peel18cv8_pin_fuse_state}, {"GAL18V10", 3540, gal18v10pinfuserows, ARRAY_LENGTH(gal18v10pinfuserows), gal18v10pinfusecolumns, ARRAY_LENGTH(gal18v10pinfusecolumns), print_gal18v10_product_terms, config_gal18v10_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20L8", 2560, pal20l8pinfuserows, ARRAY_LENGTH(pal20l8pinfuserows), pal20l8pinfusecolumns, ARRAY_LENGTH(pal20l8pinfusecolumns), print_pal20l8_product_terms, config_pal20l8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20L10", 1600, pal20l10pinfuserows, ARRAY_LENGTH(pal20l10pinfuserows), pal20l10pinfusecolumns, ARRAY_LENGTH(pal20l10pinfusecolumns), print_pal20l10_product_terms, config_pal20l10_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20R4", 2560, pal20r4pinfuserows, ARRAY_LENGTH(pal20r4pinfuserows), pal20r4pinfusecolumns, ARRAY_LENGTH(pal20r4pinfusecolumns), print_pal20r4_product_terms, config_pal20r4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20R6", 2560, pal20r6pinfuserows, ARRAY_LENGTH(pal20r6pinfuserows), pal20r6pinfusecolumns, ARRAY_LENGTH(pal20r6pinfusecolumns), print_pal20r6_product_terms, config_pal20r6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20R8", 2560, pal20r8pinfuserows, ARRAY_LENGTH(pal20r8pinfuserows), pal20r8pinfusecolumns, ARRAY_LENGTH(pal20r8pinfusecolumns), print_pal20r8_product_terms, config_pal20r8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20X4", 1600, pal20x4pinfuserows, ARRAY_LENGTH(pal20x4pinfuserows), pal20x4pinfusecolumns, ARRAY_LENGTH(pal20x4pinfusecolumns), print_pal20x4_product_terms, config_pal20x4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20X8", 1600, pal20x8pinfuserows, ARRAY_LENGTH(pal20x8pinfuserows), pal20x8pinfusecolumns, ARRAY_LENGTH(pal20x8pinfusecolumns), print_pal20x8_product_terms, config_pal20x8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20X10", 1600, pal20x10pinfuserows, ARRAY_LENGTH(pal20x10pinfuserows), pal20x10pinfusecolumns, ARRAY_LENGTH(pal20x10pinfusecolumns), print_pal20x10_product_terms, config_pal20x10_pins, - NULL, - NULL}, + nullptr, + nullptr}, /*{"PAL22V10", 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL}, {"GAL20V8A", 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL}, {"GAL22V10", 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL}, @@ -2057,22 +2057,22 @@ static pal_data paldata[] = { _82s153_pls153pinfusecolumns, ARRAY_LENGTH(_82s153_pls153pinfusecolumns), print_82s153_pls153_product_terms, config_82s153_pls153_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PLS153", 1842, _82s153_pls153pinfuserows, ARRAY_LENGTH(_82s153_pls153pinfuserows), _82s153_pls153pinfusecolumns, ARRAY_LENGTH(_82s153_pls153pinfusecolumns), print_82s153_pls153_product_terms, config_82s153_pls153_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"CK2605", 1106, ck2605pinfuserows, ARRAY_LENGTH(ck2605pinfuserows), ck2605pinfusecolumns, ARRAY_LENGTH(ck2605pinfusecolumns), print_ck2605_product_terms, config_ck2605_pins, - NULL, - NULL}, + nullptr, + nullptr}, #if defined(ricoh_pals) {"EPL10P8", 664, epl10p8pinfuserows, ARRAY_LENGTH(epl10p8pinfuserows), @@ -2136,141 +2136,141 @@ static pal_data paldata[] = { pal10p8pinfusecolumns, ARRAY_LENGTH(pal10p8pinfusecolumns), print_pal10p8_product_terms, config_pal10p8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL12P6", 390, pal12p6pinfuserows, ARRAY_LENGTH(pal12p6pinfuserows), pal12p6pinfusecolumns, ARRAY_LENGTH(pal12p6pinfusecolumns), print_pal12p6_product_terms, config_pal12p6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL14P4", 452, pal14p4pinfuserows, ARRAY_LENGTH(pal14p4pinfuserows), pal14p4pinfusecolumns, ARRAY_LENGTH(pal14p4pinfusecolumns), print_pal14p4_product_terms, config_pal14p4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16P2", 514, pal16p2pinfuserows, ARRAY_LENGTH(pal16p2pinfuserows), pal16p2pinfusecolumns, ARRAY_LENGTH(pal16p2pinfusecolumns), print_pal16p2_product_terms, config_pal16p2_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16P8", 2056, pal16p8pinfuserows, ARRAY_LENGTH(pal16p8pinfuserows), pal16p8pinfusecolumns, ARRAY_LENGTH(pal16p8pinfusecolumns), print_pal16p8_product_terms, config_pal16p8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16RP4", 2056, pal16rp4pinfuserows, ARRAY_LENGTH(pal16rp4pinfuserows), pal16rp4pinfusecolumns, ARRAY_LENGTH(pal16rp4pinfusecolumns), print_pal16rp4_product_terms, config_pal16rp4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16RP6", 2056, pal16rp6pinfuserows, ARRAY_LENGTH(pal16rp6pinfuserows), pal16rp6pinfusecolumns, ARRAY_LENGTH(pal16rp6pinfusecolumns), print_pal16rp6_product_terms, config_pal16rp6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16RP8", 2056, pal16rp8pinfuserows, ARRAY_LENGTH(pal16rp8pinfuserows), pal16rp8pinfusecolumns, ARRAY_LENGTH(pal16rp8pinfusecolumns), print_pal16rp8_product_terms, config_pal16rp8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL6L16", 192, pal6l16pinfuserows, ARRAY_LENGTH(pal6l16pinfuserows), pal6l16pinfusecolumns, ARRAY_LENGTH(pal6l16pinfusecolumns), print_pal6l16_product_terms, config_pal6l16_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL8L14", 224, pal8l14pinfuserows, ARRAY_LENGTH(pal8l14pinfuserows), pal8l14pinfusecolumns, ARRAY_LENGTH(pal8l14pinfusecolumns), print_pal8l14_product_terms, config_pal8l14_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL12H10", 480, pal12h10pinfuserows, ARRAY_LENGTH(pal12h10pinfuserows), pal12h10pinfusecolumns, ARRAY_LENGTH(pal12h10pinfusecolumns), print_pal12h10_product_terms, config_pal12h10_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL12L10", 480, pal12l10pinfuserows, ARRAY_LENGTH(pal12l10pinfuserows), pal12l10pinfusecolumns, ARRAY_LENGTH(pal12l10pinfusecolumns), print_pal12l10_product_terms, config_pal12l10_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL14H8", 560, pal14h8pinfuserows, ARRAY_LENGTH(pal14h8pinfuserows), pal14h8pinfusecolumns, ARRAY_LENGTH(pal14h8pinfusecolumns), print_pal14h8_product_terms, config_pal14h8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL14L8", 560, pal14l8pinfuserows, ARRAY_LENGTH(pal14l8pinfuserows), pal14l8pinfusecolumns, ARRAY_LENGTH(pal14l8pinfusecolumns), print_pal14l8_product_terms, config_pal14l8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16H6", 640, pal16h6pinfuserows, ARRAY_LENGTH(pal16h6pinfuserows), pal16h6pinfusecolumns, ARRAY_LENGTH(pal16h6pinfusecolumns), print_pal16h6_product_terms, config_pal16h6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL16L6", 640, pal16l6pinfuserows, ARRAY_LENGTH(pal16l6pinfuserows), pal16l6pinfusecolumns, ARRAY_LENGTH(pal16l6pinfusecolumns), print_pal16l6_product_terms, config_pal16l6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL18H4", 720, pal18h4pinfuserows, ARRAY_LENGTH(pal18h4pinfuserows), pal18h4pinfusecolumns, ARRAY_LENGTH(pal18h4pinfusecolumns), print_pal18h4_product_terms, config_pal18h4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL18L4", 720, pal18l4pinfuserows, ARRAY_LENGTH(pal18l4pinfuserows), pal18l4pinfusecolumns, ARRAY_LENGTH(pal18l4pinfusecolumns), print_pal18l4_product_terms, config_pal18l4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20C1", 640, pal20c1pinfuserows, ARRAY_LENGTH(pal20c1pinfuserows), pal20c1pinfusecolumns, ARRAY_LENGTH(pal20c1pinfusecolumns), print_pal20c1_product_terms, config_pal20c1_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"PAL20L2", 640, pal20l2pinfuserows, ARRAY_LENGTH(pal20l2pinfuserows), pal20l2pinfusecolumns, ARRAY_LENGTH(pal20l2pinfusecolumns), print_pal20l2_product_terms, config_pal20l2_pins, - NULL, - NULL}}; + nullptr, + nullptr}}; /*************************************************************************** CORE IMPLEMENTATION @@ -2333,7 +2333,7 @@ static const pal_data* find_pal_data(const char *name) } } - return NULL; + return nullptr; } @@ -2355,7 +2355,7 @@ static const pin_fuse_rows* find_fuse_rows(const pal_data* pal, UINT16 pin) } } - return NULL; + return nullptr; } @@ -2377,7 +2377,7 @@ static const pin_fuse_columns* find_fuse_columns(const pal_data* pal, UINT16 pin } } - return NULL; + return nullptr; } @@ -7054,7 +7054,7 @@ static int command_convert(int argc, char *argv[]) printf(" Total fuses = %d\n", jed.numfuses); /* generate the output */ - dstbuflen = jedbin_output(&jed, NULL, 0); + dstbuflen = jedbin_output(&jed, nullptr, 0); dstbuf = (UINT8 *)malloc(dstbuflen); if (!dstbuf) { @@ -7082,7 +7082,7 @@ static int command_convert(int argc, char *argv[]) printf(" Total fuses = %d\n", jed.numfuses); /* generate the output */ - dstbuflen = jed_output(&jed, NULL, 0); + dstbuflen = jed_output(&jed, nullptr, 0); dstbuf = (UINT8 *)malloc(dstbuflen); if (!dstbuf) { diff --git a/src/tools/ldresample.cpp b/src/tools/ldresample.cpp index d22fcd7a4a9..771c4e94676 100644 --- a/src/tools/ldresample.cpp +++ b/src/tools/ldresample.cpp @@ -248,7 +248,7 @@ static bool read_chd(chd_file &file, UINT32 field, movie_info &info, UINT32 soun file.codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig); // read the field - chd_error chderr = file.read_hunk(field, NULL); + chd_error chderr = file.read_hunk(field, nullptr); return (chderr == CHDERR_NONE); } @@ -508,13 +508,13 @@ int main(int argc, char *argv[]) if (argc < 2) return usage(); const char *srcfilename = argv[1]; - const char *dstfilename = (argc < 3) ? NULL : argv[2]; + const char *dstfilename = (argc < 3) ? nullptr : argv[2]; double offset = (argc < 4) ? 0.0 : atof(argv[3]); double slope = (argc < 5) ? 1.0 : atof(argv[4]); // print basic information printf("Input file: %s\n", srcfilename); - if (dstfilename != NULL) + if (dstfilename != nullptr) { printf("Output file: %s\n", dstfilename); printf("Offset: %f\n", offset); @@ -538,7 +538,7 @@ int main(int argc, char *argv[]) printf("Total fields: %d\n", info.numfields); // if we don't have a destination file, scan for edges - if (dstfilename == NULL) + if (dstfilename == nullptr) { for (UINT32 fieldnum = 60; fieldnum < info.numfields - 60; fieldnum += 30) { @@ -554,7 +554,7 @@ int main(int argc, char *argv[]) // open the destination file chd_resample_compressor dstfile(srcfile, info, INT64(offset * 65536.0 * 256.0), INT64(slope * 65536.0 * 256.0)); err = create_chd(dstfile, dstfilename, srcfile, info); - if (dstfile == NULL) + if (dstfile == nullptr) { fprintf(stderr, "Unable to create file '%s'\n", dstfilename); return 1; diff --git a/src/tools/ldverify.cpp b/src/tools/ldverify.cpp index 020e611181c..ab3947dfaea 100644 --- a/src/tools/ldverify.cpp +++ b/src/tools/ldverify.cpp @@ -107,7 +107,7 @@ static void *open_avi(const char *filename, movie_info &info) if (avierr != AVIERR_NONE) { fprintf(stderr, "Error opening AVI file: %s\n", avi_error_string(avierr)); - return NULL; + return nullptr; } // extract movie info @@ -171,7 +171,7 @@ static void close_avi(void *file) static void *open_chd(const char *filename, movie_info &info) { - chd_file *chd = new chd_file; + auto chd = new chd_file; // open the file chd_error chderr = chd->open(filename); @@ -179,7 +179,7 @@ static void *open_chd(const char *filename, movie_info &info) { fprintf(stderr, "Error opening CHD file: %s\n", chd_file::error_string(chderr)); delete chd; - return NULL; + return nullptr; } // get the metadata @@ -189,7 +189,7 @@ static void *open_chd(const char *filename, movie_info &info) { fprintf(stderr, "Error getting A/V metadata: %s\n", chd_file::error_string(chderr)); delete chd; - return NULL; + return nullptr; } // extract the info @@ -198,7 +198,7 @@ static void *open_chd(const char *filename, movie_info &info) { fprintf(stderr, "Improperly formatted metadata\n"); delete chd; - return NULL; + return nullptr; } // extract movie info @@ -249,7 +249,7 @@ static int read_chd(void *file, int frame, bitmap_yuy16 &bitmap, INT16 *lsound, chdfile->codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig); // read the frame - chd_error chderr = chdfile->read_hunk(frame * interlace_factor + fieldnum, NULL); + chd_error chderr = chdfile->read_hunk(frame * interlace_factor + fieldnum, nullptr); if (chderr != CHDERR_NONE) return false; @@ -735,7 +735,7 @@ int main(int argc, char *argv[]) printf("Processing file: %s\n", srcfile); movie_info info = { 0 }; void *file = isavi ? open_avi(srcfile, info) : open_chd(srcfile, info); - if (file == NULL) + if (file == nullptr) { fprintf(stderr, "Unable to open file '%s'\n", srcfile); return 1; diff --git a/src/tools/pngcmp.cpp b/src/tools/pngcmp.cpp index 4b0974d824f..dda54ed7730 100644 --- a/src/tools/pngcmp.cpp +++ b/src/tools/pngcmp.cpp @@ -72,7 +72,7 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img bitmap_argb32 bitmap2; bitmap_argb32 finalbitmap; int width, height, maxwidth; - core_file *file = NULL; + core_file *file = nullptr; file_error filerr; png_error pngerr; int error = 100; @@ -150,8 +150,8 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img /* iterate over rows in these bitmaps */ for (y = 0; y < curheight; y++) { - UINT32 *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : NULL; - UINT32 *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : NULL; + UINT32 *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; + UINT32 *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; UINT32 *dst1 = &finalbitmap.pix32(y); UINT32 *dst2 = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE); UINT32 *dstdiff = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); @@ -161,9 +161,9 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img { int pix1 = -1, pix2 = -2; - if (src1 != NULL && x < bitmap1.width()) + if (src1 != nullptr && x < bitmap1.width()) pix1 = dst1[x] = src1[x]; - if (src2 != NULL && x < bitmap2.width()) + if (src2 != nullptr && x < bitmap2.width()) pix2 = dst2[x] = src2[x]; dstdiff[x] = (pix1 != pix2) ? 0xffffffff : 0xff000000; } @@ -176,7 +176,7 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img printf("Could not open %s (%d)\n", outfilename.c_str(), filerr); goto error; } - pngerr = png_write_bitmap(file, NULL, finalbitmap, 0, NULL); + pngerr = png_write_bitmap(file, nullptr, finalbitmap, 0, nullptr); core_fclose(file); if (pngerr != PNGERR_NONE) { diff --git a/src/tools/regrep.cpp b/src/tools/regrep.cpp index 8c2beddf0ed..6f5adbf8f22 100644 --- a/src/tools/regrep.cpp +++ b/src/tools/regrep.cpp @@ -287,14 +287,14 @@ static summary_file *get_file(const char *filename) summary_file *file; /* use the first two characters as a lookup */ - for (file = filehash[filename[0] & 0x7f][filename[1] & 0x7f]; file != NULL; file = file->next) + for (file = filehash[filename[0] & 0x7f][filename[1] & 0x7f]; file != nullptr; file = file->next) if (strcmp(filename, file->name) == 0) return file; /* didn't find one -- allocate */ file = (summary_file *)malloc(sizeof(*file)); - if (file == NULL) - return NULL; + if (file == nullptr) + return nullptr; memset(file, 0, sizeof(*file)); /* set the name so we find it in the future */ @@ -314,7 +314,7 @@ static summary_file *get_file(const char *filename) static int read_summary_log(const char *filename, int index) { - summary_file *curfile = NULL; + summary_file *curfile = nullptr; char linebuffer[1024]; char *linestart; int drivers = 0; @@ -322,14 +322,14 @@ static int read_summary_log(const char *filename, int index) /* open the logfile */ file = fopen(filename, "r"); - if (file == NULL) + if (file == nullptr) { fprintf(stderr, "Error: file '%s' not found\n", filename); return 1; } /* parse it */ - while (fgets(linebuffer, sizeof(linebuffer), file) != NULL) + while (fgets(linebuffer, sizeof(linebuffer), file) != nullptr) { /* trim the leading/trailing spaces */ linestart = trim_string(linebuffer); @@ -344,7 +344,7 @@ static int read_summary_log(const char *filename, int index) if (strncmp(linestart, "driver=", 7) == 0) { curfile = parse_driver_tag(linestart + 7, index); - if (curfile == NULL) + if (curfile == nullptr) goto error; drivers++; } @@ -353,7 +353,7 @@ static int read_summary_log(const char *filename, int index) else if (strncmp(linestart, "source=", 7) == 0) { /* error if no driver yet */ - if (curfile == NULL) + if (curfile == nullptr) { fprintf(stderr, "Unexpected @@@@@source= tag\n"); goto error; @@ -370,7 +370,7 @@ static int read_summary_log(const char *filename, int index) /* allocate a copy of the string */ lists[index].dir = (char *)malloc(strlen(dirname) + 1); - if (lists[index].dir == NULL) + if (lists[index].dir == nullptr) goto error; strcpy(lists[index].dir, dirname); fprintf(stderr, "Directory %s\n", lists[index].dir); @@ -378,7 +378,7 @@ static int read_summary_log(const char *filename, int index) } /* if not, consider other options */ - else if (curfile != NULL) + else if (curfile != nullptr) { int foundchars = 0; char *curptr; @@ -443,19 +443,19 @@ static summary_file *parse_driver_tag(char *linestart, int index) /* find the colon separating name from status */ colon = strchr(linestart, ':'); - if (colon == NULL) + if (colon == nullptr) { fprintf(stderr, "Unexpected text after @@@@@driver=\n"); - return NULL; + return nullptr; } /* NULL terminate at the colon and look up the file */ *colon = 0; curfile = get_file(trim_string(linestart)); - if (curfile == NULL) + if (curfile == nullptr) { fprintf(stderr, "Unable to allocate memory for driver\n"); - return NULL; + return nullptr; } /* clear out any old status for this file */ @@ -514,36 +514,36 @@ static summary_file *sort_file_list(void) numfiles = 0; for (c0 = 0; c0 < 128; c0++) for (c1 = 0; c1 < 128; c1++) - for (curfile = filehash[c0][c1]; curfile != NULL; curfile = curfile->next) + for (curfile = filehash[c0][c1]; curfile != nullptr; curfile = curfile->next) numfiles++; /* allocate an array of files */ filearray = (summary_file **)malloc(numfiles * sizeof(*filearray)); - if (filearray == NULL) + if (filearray == nullptr) { fprintf(stderr, "Out of memory!\n"); - return NULL; + return nullptr; } /* populate the array */ numfiles = 0; for (c0 = 0; c0 < 128; c0++) for (c1 = 0; c1 < 128; c1++) - for (curfile = filehash[c0][c1]; curfile != NULL; curfile = curfile->next) + for (curfile = filehash[c0][c1]; curfile != nullptr; curfile = curfile->next) filearray[numfiles++] = curfile; /* sort the array */ qsort(filearray, numfiles, sizeof(filearray[0]), compare_file); /* now regenerate a single list */ - listhead = NULL; + listhead = nullptr; tailptr = &listhead; for (filenum = 0; filenum < numfiles; filenum++) { *tailptr = filearray[filenum]; tailptr = &(*tailptr)->next; } - *tailptr = NULL; + *tailptr = nullptr; free(filearray); return listhead; @@ -566,7 +566,7 @@ static core_file *create_file_and_output_header(std::string &filename, std::stri /* create the indexfile */ if (core_fopen(filename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE) - return NULL; + return nullptr; /* print a header */ std::string modified(templatefile); @@ -615,17 +615,17 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st /* initialize the lists */ for (bucknum = 0; bucknum < BUCKET_COUNT; bucknum++) { - buckethead[bucknum] = NULL; + buckethead[bucknum] = nullptr; buckettailptr[bucknum] = &buckethead[bucknum]; } /* compute the total number of files */ total = 0; - for (curfile = filelist; curfile != NULL; curfile = curfile->next) + for (curfile = filelist; curfile != nullptr; curfile = curfile->next) total++; /* first bucketize the games */ - for (curfile = filelist; curfile != NULL; curfile = curfile->next) + for (curfile = filelist; curfile != nullptr; curfile = curfile->next) { int statcount[STATUS_COUNT] = { 0 }; int bucket = BUCKET_UNKNOWN; @@ -683,12 +683,12 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st /* terminate all the lists */ for (bucknum = 0; bucknum < BUCKET_COUNT; bucknum++) - *buckettailptr[bucknum] = NULL; + *buckettailptr[bucknum] = nullptr; /* output header */ strprintf(tempname,"%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); indexfile = create_file_and_output_header(tempname, tempheader, title); - if (indexfile == NULL) + if (indexfile == nullptr) { fprintf(stderr, "Error creating file '%s'\n", tempname.c_str()); return; @@ -699,7 +699,7 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st { int curbucket = bucket_output_order[bucknum]; - if (buckethead[curbucket] != NULL) + if (buckethead[curbucket] != nullptr) { fprintf(stderr, "Outputting bucket: %s\n", bucket_name[curbucket]); append_driver_list_table(bucket_name[curbucket], dirname, indexfile, buckethead[curbucket], tempheader, tempfooter); @@ -836,7 +836,7 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, int width, height, maxwidth; int bitmapcount = 0; int listnum, bmnum; - core_file *file = NULL; + core_file *file = nullptr; file_error filerr; png_error pngerr; int error = -1; @@ -901,8 +901,8 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, /* iterate over rows in these bitmaps */ for (y = 0; y < curheight; y++) { - UINT32 *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : NULL; - UINT32 *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : NULL; + UINT32 *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; + UINT32 *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; UINT32 *dst1 = &finalbitmap.pix32(starty + y, 0); UINT32 *dst2 = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE); UINT32 *dstdiff = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); @@ -912,9 +912,9 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, { int pix1 = -1, pix2 = -2; - if (src1 != NULL && x < bitmap1.width()) + if (src1 != nullptr && x < bitmap1.width()) pix1 = dst1[x] = src1[x]; - if (src2 != NULL && x < bitmap2.width()) + if (src2 != nullptr && x < bitmap2.width()) pix2 = dst2[x] = src2[x]; dstdiff[x] = (pix1 != pix2) ? 0xffffffff : 0xff000000; } @@ -928,7 +928,7 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, filerr = core_fopen(dstfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file); if (filerr != FILERR_NONE) goto error; - pngerr = png_write_bitmap(file, NULL, finalbitmap, 0, NULL); + pngerr = png_write_bitmap(file, nullptr, finalbitmap, 0, nullptr); core_fclose(file); if (pngerr != PNGERR_NONE) goto error; @@ -963,7 +963,7 @@ static void create_linked_file(std::string &dirname, const summary_file *curfile strprintf(title, "%s Regressions (%s)", curfile->name, curfile->source); strprintf(linkname,"%s" PATH_SEPARATOR "%s", dirname.c_str(), filename.c_str()); linkfile = create_file_and_output_header(linkname, tempheader, title); - if (linkfile == NULL) + if (linkfile == nullptr) { fprintf(stderr, "Error creating file '%s'\n", filename.c_str()); return; @@ -973,12 +973,12 @@ static void create_linked_file(std::string &dirname, const summary_file *curfile core_fprintf(linkfile, "\t

\n"); core_fprintf(linkfile, "\t\n"); core_fprintf(linkfile, "\t\t\n"); core_fprintf(linkfile, "\t\t\n"); core_fprintf(linkfile, "\t\t\n"); core_fprintf(linkfile, "\t
"); - if (prevfile != NULL) + if (prevfile != nullptr) core_fprintf(linkfile, "<< %s (%s)", prevfile->name, prevfile->name, prevfile->source); core_fprintf(linkfile, "Home"); - if (nextfile != NULL) + if (nextfile != nullptr) core_fprintf(linkfile, "%s (%s) >>", nextfile->name, nextfile->name, nextfile->source); core_fprintf(linkfile, "
\n"); @@ -993,7 +993,7 @@ static void create_linked_file(std::string &dirname, const summary_file *curfile core_fprintf(linkfile, "\n\t

%s

\n", lists[listnum].version); core_fprintf(linkfile, "\t

\n"); core_fprintf(linkfile, "\tStatus: %s\n", status_text[curfile->status[listnum]]); - if (pngfile != NULL) + if (pngfile != nullptr) imageindex = get_unique_index(curfile, listnum); if (imageindex != -1) core_fprintf(linkfile, " [%d]", imageindex); @@ -1008,7 +1008,7 @@ static void create_linked_file(std::string &dirname, const summary_file *curfile } /* output link to the image */ - if (pngfile != NULL) + if (pngfile != nullptr) { core_fprintf(linkfile, "\n\t

Screenshot Comparisons

\n"); core_fprintf(linkfile, "\t

\n"); @@ -1043,7 +1043,7 @@ static void append_driver_list_table(const char *header, std::string &dirname, c core_fprintf(indexfile, "\n\t\t\n"); /* if nothing, print a default message */ - if (listhead == NULL) + if (listhead == nullptr) { core_fprintf(indexfile, "\t\t\n\t\t\t"); core_fprintf(indexfile, "(No regressions detected)", list_count + 2); @@ -1051,16 +1051,16 @@ static void append_driver_list_table(const char *header, std::string &dirname, c } /* iterate over files */ - for (prevfile = NULL, curfile = listhead; curfile != NULL; prevfile = curfile, curfile = curfile->next) + for (prevfile = nullptr, curfile = listhead; curfile != nullptr; prevfile = curfile, curfile = curfile->next) { int rowspan = 0, uniqueshots = 0; char pngdiffname[40]; /* if this is the first entry in this source file, count how many rows we need to span */ - if (prevfile == NULL || strcmp(prevfile->source, curfile->source) != 0) + if (prevfile == nullptr || strcmp(prevfile->source, curfile->source) != 0) { const summary_file *cur; - for (cur = curfile; cur != NULL; cur = cur->next) + for (cur = curfile; cur != nullptr; cur = cur->next) if (strcmp(cur->source, curfile->source) == 0) rowspan++; else @@ -1080,7 +1080,7 @@ static void append_driver_list_table(const char *header, std::string &dirname, c } /* create a linked file */ - create_linked_file(dirname, curfile, prevfile, curfile->next, (pngdiffname[0] == 0) ? NULL : pngdiffname, tempheader, tempfooter); + create_linked_file(dirname, curfile, prevfile, curfile->next, (pngdiffname[0] == 0) ? nullptr : pngdiffname, tempheader, tempfooter); /* create a row */ core_fprintf(indexfile, "\t\t\n\t\t\t"); diff --git a/src/tools/romcmp.cpp b/src/tools/romcmp.cpp index 97cdfa47ab3..4d89718abe9 100644 --- a/src/tools/romcmp.cpp +++ b/src/tools/romcmp.cpp @@ -120,7 +120,7 @@ static void checkintegrity(const fileinfo *file,int side) int mask0,mask1; int addrbit; - if (file->buf == 0) return; + if (file->buf == nullptr) return; /* check for bad data lines */ mask0 = 0x0000; @@ -351,7 +351,7 @@ static float filecompare(const fileinfo *file1,const fileinfo *file2,int mode1,i int base1=0,base2=0,mult1=0,mult2=0,mask1=0,mask2=0; - if (file1->buf == 0 || file2->buf == 0) return 0.0; + if (file1->buf == nullptr || file2->buf == nullptr) return 0.0; size1 = usedbytes(file1,mode1); size2 = usedbytes(file2,mode2); @@ -397,7 +397,7 @@ static void readfile(const char *path,fileinfo *file) UINT64 filesize; UINT32 actual; char fullname[256]; - osd_file *f = 0; + osd_file *f = nullptr; if (path) { @@ -408,7 +408,7 @@ static void readfile(const char *path,fileinfo *file) else fullname[0] = 0; strcat(fullname,file->name); - if ((file->buf = (unsigned char *)malloc(file->size)) == 0) + if ((file->buf = (unsigned char *)malloc(file->size)) == nullptr) { printf("%s: out of memory!\n",file->name); return; @@ -436,7 +436,7 @@ static void readfile(const char *path,fileinfo *file) static void freefile(fileinfo *file) { free(file->buf); - file->buf = 0; + file->buf = nullptr; } @@ -455,12 +455,12 @@ static int load_files(int i, int *found, const char *path) /* attempt to open as a directory first */ dir = osd_opendir(path); - if (dir != NULL) + if (dir != nullptr) { const osd_directory_entry *d; /* load all files in directory */ - while ((d = osd_readdir(dir)) != NULL) + while ((d = osd_readdir(dir)) != nullptr) { const char *d_name = d->name; char buf[255+1]; @@ -506,7 +506,7 @@ static int load_files(int i, int *found, const char *path) } /* load all files in zip file */ - for (zipent = zip_file_first_file(zip); zipent != NULL; zipent = zip_file_next_file(zip)) + for (zipent = zip_file_first_file(zip); zipent != nullptr; zipent = zip_file_next_file(zip)) { int size; @@ -525,14 +525,14 @@ static int load_files(int i, int *found, const char *path) else strcpy(file->name,zipent->filename); file->size = zipent->uncompressed_length; - if ((file->buf = (unsigned char *)malloc(file->size)) == 0) + if ((file->buf = (unsigned char *)malloc(file->size)) == nullptr) printf("%s: out of memory!\n",file->name); else { if (zip_file_decompress(zip, (char *)file->buf, file->size) != ZIPERR_NONE) { free(file->buf); - file->buf = 0; + file->buf = nullptr; } } @@ -728,11 +728,11 @@ int CLIB_DECL main(int argc,char *argv[]) for (i = 0;i < found[0];i++) { - if (files[0][i].listed == 0) printname(&files[0][i],0,0.0,0,0); + if (files[0][i].listed == 0) printname(&files[0][i],nullptr,0.0,0,0); } for (i = 0;i < found[1];i++) { - if (files[1][i].listed == 0) printname(0,&files[1][i],0.0,0,0); + if (files[1][i].listed == 0) printname(nullptr,&files[1][i],0.0,0,0); } } diff --git a/src/tools/split.cpp b/src/tools/split.cpp index 302bc6d8d7f..043d93b3a78 100644 --- a/src/tools/split.cpp +++ b/src/tools/split.cpp @@ -64,9 +64,9 @@ static void compute_hash_as_string(std::string &buffer, void *data, UINT32 lengt static int split_file(const char *filename, const char *basename, UINT32 splitsize) { std::string outfilename, basefilename, splitfilename; - core_file *outfile = NULL, *infile = NULL, *splitfile = NULL; + core_file *outfile = nullptr, *infile = nullptr, *splitfile = nullptr; std::string computedhash; - void *splitbuffer = NULL; + void *splitbuffer = nullptr; int index, partnum; UINT64 totallength; file_error filerr; @@ -103,7 +103,7 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi // allocate a buffer for reading splitbuffer = malloc(splitsize); - if (splitbuffer == NULL) + if (splitbuffer == nullptr) { fprintf(stderr, "Fatal error: unable to allocate memory for the split\n"); goto cleanup; @@ -174,7 +174,7 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi goto cleanup; } core_fclose(outfile); - outfile = NULL; + outfile = nullptr; printf(" done\n"); @@ -188,21 +188,21 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi error = 0; cleanup: - if (splitfile != NULL) + if (splitfile != nullptr) { core_fclose(splitfile); if (error != 0) remove(splitfilename.c_str()); } - if (infile != NULL) + if (infile != nullptr) core_fclose(infile); - if (outfile != NULL) + if (outfile != nullptr) { core_fclose(outfile); if (error != 0) remove(outfilename.c_str()); } - if (splitbuffer != NULL) + if (splitbuffer != nullptr) free(splitbuffer); return error; } @@ -218,8 +218,8 @@ static int join_file(const char *filename, const char *outname, int write_output std::string expectedhash, computedhash; std::string outfilename, infilename; std::string basepath; - core_file *outfile = NULL, *infile = NULL, *splitfile = NULL; - void *splitbuffer = NULL; + core_file *outfile = nullptr, *infile = nullptr, *splitfile = nullptr; + void *splitbuffer = nullptr; file_error filerr; UINT32 splitsize; char buffer[256]; @@ -252,7 +252,7 @@ static int join_file(const char *filename, const char *outname, int write_output basepath.clear(); // override the output filename if specified, otherwise prepend the path - if (outname != NULL) + if (outname != nullptr) outfilename.assign(outname); else outfilename.insert(0, basepath); @@ -272,7 +272,7 @@ static int join_file(const char *filename, const char *outname, int write_output if (filerr == FILERR_NONE) { core_fclose(outfile); - outfile = NULL; + outfile = nullptr; fprintf(stderr, "Fatal error: output file '%s' already exists\n", outfilename.c_str()); goto cleanup; } @@ -346,7 +346,7 @@ static int join_file(const char *filename, const char *outname, int write_output // release allocated memory osd_free(splitbuffer); - splitbuffer = NULL; + splitbuffer = nullptr; } if (write_output) printf("File re-created successfully\n"); @@ -357,17 +357,17 @@ static int join_file(const char *filename, const char *outname, int write_output error = 0; cleanup: - if (splitfile != NULL) + if (splitfile != nullptr) core_fclose(splitfile); - if (infile != NULL) + if (infile != nullptr) core_fclose(infile); - if (outfile != NULL) + if (outfile != nullptr) { core_fclose(outfile); if (error != 0) remove(outfilename.c_str()); } - if (splitbuffer != NULL) + if (splitbuffer != nullptr) osd_free(splitbuffer); return error; } @@ -398,7 +398,7 @@ int main(int argc, char *argv[]) { if (argc != 3 && argc != 4) goto usage; - result = join_file(argv[2], (argc >= 4) ? argv[3] : NULL, TRUE); + result = join_file(argv[2], (argc >= 4) ? argv[3] : nullptr, TRUE); } /* verify command */ @@ -406,7 +406,7 @@ int main(int argc, char *argv[]) { if (argc != 3) goto usage; - result = join_file(argv[2], NULL, FALSE); + result = join_file(argv[2], nullptr, FALSE); } else goto usage; diff --git a/src/tools/src2html.cpp b/src/tools/src2html.cpp index 91780cd2fc6..62eefb4da56 100644 --- a/src/tools/src2html.cpp +++ b/src/tools/src2html.cpp @@ -99,7 +99,7 @@ static const ext_to_type extension_lookup[] = static const token_entry dummy_token_table[] = { - { NULL, KEYWORD_CLASS } + { nullptr, KEYWORD_CLASS } }; @@ -192,7 +192,7 @@ static const token_entry c_token_table[] = { "UINT64", CUSTOM_CLASS }, { "ARRAY_LENGTH", CUSTOM_CLASS }, */ - { NULL, KEYWORD_CLASS } + { nullptr, KEYWORD_CLASS } }; @@ -244,9 +244,9 @@ int main(int argc, char *argv[]) if (arg[0] == '-' && arg[1] == 'I') { *incpathhead = new include_path; - if (*incpathhead != NULL) + if (*incpathhead != nullptr) { - (*incpathhead)->next = NULL; + (*incpathhead)->next = nullptr; strreplacechr((*incpathhead)->path.assign(&arg[2]), '/', PATH_SEPARATOR[0]); incpathhead = &(*incpathhead)->next; } @@ -348,7 +348,7 @@ static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std: // open the directory and iterate through it osd_directory *dir = osd_opendir(srcdir.c_str()); - if (dir == NULL) + if (dir == nullptr) { result = 1; break; @@ -357,11 +357,11 @@ static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std: // build up the list of files const osd_directory_entry *entry; int found = 0; - list_entry *list = NULL; - while ((entry = osd_readdir(dir)) != NULL) + list_entry *list = nullptr; + while ((entry = osd_readdir(dir)) != nullptr) if (entry->type == entry_type && entry->name[0] != '.') { - list_entry *lentry = new list_entry; + auto lentry = new list_entry; lentry->name.assign(entry->name); lentry->next = list; list = lentry; @@ -376,16 +376,16 @@ static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std: continue; // allocate memory for sorting - list_entry **listarray = new list_entry *[found]; + auto listarray = new list_entry *[found]; found = 0; - for (list_entry *curlist = list; curlist != NULL; curlist = curlist->next) + for (list_entry *curlist = list; curlist != nullptr; curlist = curlist->next) listarray[found++] = curlist; // sort the list qsort(listarray, found, sizeof(listarray[0]), compare_list_entries); // rebuild the list - list = NULL; + list = nullptr; while (--found >= 0) { listarray[found]->next = list; @@ -394,7 +394,7 @@ static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std: delete[] listarray; // iterate through each file - for (list_entry *curlist = list; curlist != NULL && result == 0; curlist = curlist->next) + for (list_entry *curlist = list; curlist != nullptr && result == 0; curlist = curlist->next) { // add a header if (curlist == list) @@ -421,7 +421,7 @@ static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std: if (type != FILE_TYPE_INVALID) { strprintf(dstfile, "%s%c%s.html", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); - if (indexfile != NULL) + if (indexfile != nullptr) core_fprintf(indexfile, "\t

  • %s
  • \n", curlist->name.c_str(), curlist->name.c_str()); result = output_file(type, srcrootlen, dstrootlen, srcfile, dstfile, srcdir.compare(dstdir) == 0, tempheader, tempfooter); } @@ -431,18 +431,18 @@ static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std: else { strprintf(dstfile, "%s%c%s", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); - if (indexfile != NULL) + if (indexfile != nullptr) core_fprintf(indexfile, "\t
  • %s/
  • \n", curlist->name.c_str(), curlist->name.c_str()); result = recurse_dir(srcrootlen, dstrootlen, srcfile, dstfile, tempheader, tempfooter); } } // close the list if we found some stuff - if (list != NULL) + if (list != nullptr) core_fprintf(indexfile, "\t\n"); // free all the allocated entries - while (list != NULL) + while (list != nullptr) { list_entry *next = list->next; delete list; @@ -450,7 +450,7 @@ static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std: } } - if (indexfile != NULL) + if (indexfile != nullptr) output_footer_and_close_file(indexfile, tempfooter, srcdir_subpath); return result; } @@ -525,7 +525,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, std::stri // open the output file core_file *dst = create_file_and_output_header(dstfile, tempheader, srcfile_subpath); - if (dst == NULL) + if (dst == nullptr) { fprintf(stderr, "Unable to write file '%s'\n", dstfile.c_str()); core_fclose(src); @@ -544,7 +544,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, std::stri int linenum = 1; bool in_comment = false; char srcline[4096]; - while (core_fgets(srcline, ARRAY_LENGTH(srcline), src) != NULL) + while (core_fgets(srcline, ARRAY_LENGTH(srcline), src) != nullptr) { // start with the line number std::string dstline; @@ -608,7 +608,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, std::stri // scan the token table last_token_was_include = false; - for (curtoken = token_table; curtoken->token != NULL; curtoken++) + for (curtoken = token_table; curtoken->token != nullptr; curtoken++) if (strncmp(srcptr - 1, curtoken->token, toklength) == 0 && strlen(curtoken->token) == toklength) { strcatprintf(dstline, "%s", curtoken->color, curtoken->token); @@ -653,7 +653,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, std::stri if (last_token_was_include) { char *endquote = strchr(srcptr, ch); - if (endquote != NULL) + if (endquote != nullptr) { std::string filename(srcptr, endquote - srcptr); std::string target; @@ -734,7 +734,7 @@ static core_file *create_file_and_output_header(std::string &filename, std::stri // create the indexfile core_file *file; if (core_fopen(filename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE) - return NULL; + return nullptr; // print a header std::string modified(templatefile); @@ -831,7 +831,7 @@ static void output_path_as_links(core_file *file, std::string &path, bool end_is static bool find_include_file(std::string &srcincpath, int srcrootlen, int dstrootlen, std::string &srcfile, std::string &dstfile, std::string &filename) { // iterate over include paths and find the file - for (include_path *curpath = incpaths; curpath != NULL; curpath = curpath->next) + for (include_path *curpath = incpaths; curpath != nullptr; curpath = curpath->next) { // a '.' include path is specially treated if (curpath->path.compare(".") == 0) diff --git a/src/tools/srcclean.cpp b/src/tools/srcclean.cpp index 24db9bca880..0af298a4441 100644 --- a/src/tools/srcclean.cpp +++ b/src/tools/srcclean.cpp @@ -39,7 +39,7 @@ static int le_convert(char *buffer, int size) /* brute force */ *end = 0; pos = strchr(buffer, 0x0d); - while (pos != NULL) + while (pos != nullptr) { memmove(pos, pos+1,end - pos + 1); size--; @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) /* read the file */ file = fopen(argv[1], "rb"); - if (file == NULL) + if (file == nullptr) { fprintf(stderr, "Can't open %s\n", argv[1]); return 1; @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) fclose(file); /* check whether we have dos line endings and are in unix mode */ - if (unix_le && (strchr((char *) original, 0x0d) != NULL)) + if (unix_le && (strchr((char *) original, 0x0d) != nullptr)) fixed_dos_style = 1; /* determine if we are a C file */ diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp index 7a245886d6a..13eabe31c59 100644 --- a/src/tools/unidasm.cpp +++ b/src/tools/unidasm.cpp @@ -454,7 +454,7 @@ static int parse_options(int argc, char *argv[], options *opts) } // filename - else if (opts->filename == NULL) + else if (opts->filename == nullptr) opts->filename = curarg; // fail @@ -467,7 +467,7 @@ static int parse_options(int argc, char *argv[], options *opts) goto usage; // if no file or no architecture, fail - if (opts->filename == NULL || opts->dasm == NULL) + if (opts->filename == nullptr || opts->dasm == nullptr) goto usage; return 0; @@ -545,7 +545,7 @@ int main(int argc, char *argv[]) int numchunks; // disassemble - pcdelta = (*opts.dasm->func)(NULL, buffer, curpc, oprom, oprom, opts.mode) & DASMFLAG_LENGTHMASK; + pcdelta = (*opts.dasm->func)(nullptr, buffer, curpc, oprom, oprom, opts.mode) & DASMFLAG_LENGTHMASK; if (opts.dasm->pcshift < 0) numbytes = pcdelta << -opts.dasm->pcshift; -- cgit v1.2.3-70-g09d2 From 1b0ec08af5cd3b3268b5889ba4e30409431434e2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 4 Dec 2015 10:29:21 +0100 Subject: clang-modernize part 6 --- src/devices/bus/a2bus/a2bus.cpp | 4 +- src/devices/bus/a2bus/a2mcms.cpp | 4 +- src/devices/bus/a7800/a78_slot.cpp | 12 ++-- src/devices/bus/a800/a800_slot.cpp | 12 ++-- src/devices/bus/amiga/zorro/a2232.cpp | 4 +- src/devices/bus/apf/slot.cpp | 12 ++-- src/devices/bus/arcadia/slot.cpp | 6 +- src/devices/bus/astrocde/slot.cpp | 12 ++-- src/devices/bus/bml3/bml3bus.cpp | 4 +- src/devices/bus/cbmiec/cbmiec.cpp | 8 +-- src/devices/bus/chanf/slot.cpp | 12 ++-- src/devices/bus/comx35/expbox.cpp | 24 +++---- src/devices/bus/crvision/slot.cpp | 12 ++-- src/devices/bus/ecbbus/ecbbus.cpp | 28 ++++---- src/devices/bus/econet/econet.cpp | 8 +-- src/devices/bus/gameboy/gb_slot.cpp | 12 ++-- src/devices/bus/gba/gba_slot.cpp | 20 +++--- src/devices/bus/ieee488/ieee488.cpp | 8 +-- src/devices/bus/intv/slot.cpp | 12 ++-- src/devices/bus/isa/cga.cpp | 4 +- src/devices/bus/kc/d002.cpp | 16 ++--- src/devices/bus/lpci/pci.cpp | 4 +- src/devices/bus/megadrive/md_slot.cpp | 12 ++-- src/devices/bus/msx_cart/ascii.cpp | 20 +++--- src/devices/bus/msx_cart/crossblaim.cpp | 4 +- src/devices/bus/msx_cart/halnote.cpp | 4 +- src/devices/bus/msx_cart/holy_quran.cpp | 4 +- src/devices/bus/msx_cart/konami.cpp | 32 ++++----- src/devices/bus/msx_cart/korean.cpp | 4 +- src/devices/bus/msx_cart/majutsushi.cpp | 8 +-- src/devices/bus/msx_cart/rtype.cpp | 4 +- src/devices/bus/msx_slot/cartridge.cpp | 12 ++-- src/devices/bus/nes/mmc5.cpp | 4 +- src/devices/bus/nes/nes_pcb.inc | 12 ++-- src/devices/bus/odyssey2/slot.cpp | 12 ++-- src/devices/bus/pce/pce_slot.cpp | 12 ++-- src/devices/bus/scv/slot.cpp | 12 ++-- src/devices/bus/sega8/sega8_slot.cpp | 12 ++-- src/devices/bus/snes/sdd1.cpp | 12 ++-- src/devices/bus/snes/snes_slot.cpp | 12 ++-- src/devices/bus/snes/spc7110.cpp | 10 +-- src/devices/bus/ti99_peb/bwg.cpp | 8 +-- src/devices/bus/ti99_peb/hfdc.cpp | 4 +- src/devices/bus/ti99_peb/memex.cpp | 4 +- src/devices/bus/ti99_peb/pcode.cpp | 4 +- src/devices/bus/ti99_peb/samsmem.cpp | 2 +- src/devices/bus/ti99_peb/ti_fdc.cpp | 4 +- src/devices/bus/ti99x/990_dk.cpp | 8 +-- src/devices/bus/ti99x/998board.cpp | 4 +- src/devices/bus/ti99x/genboard.cpp | 2 +- src/devices/bus/ti99x/gromport.cpp | 22 +++--- src/devices/bus/vboy/slot.cpp | 6 +- src/devices/bus/vc4000/slot.cpp | 12 ++-- src/devices/bus/vcs/dpc.cpp | 8 +-- src/devices/bus/vcs/vcs_slot.cpp | 16 ++--- src/devices/bus/vectrex/slot.cpp | 6 +- src/devices/bus/vic20/vic1010.cpp | 12 ++-- src/devices/bus/vip/vp575.cpp | 52 +++++++------- src/devices/bus/wswan/slot.cpp | 12 ++-- src/devices/cpu/arcompact/arcompact.cpp | 4 +- src/devices/cpu/arm/arm.cpp | 8 +-- src/devices/cpu/avr8/avr8.cpp | 4 +- src/devices/cpu/cosmac/cosmac.cpp | 4 +- src/devices/cpu/drcbex64.cpp | 4 +- src/devices/cpu/drcbex86.cpp | 4 +- src/devices/cpu/h6280/h6280.cpp | 4 +- src/devices/cpu/h8/h8_timer8.cpp | 14 ++-- src/devices/cpu/hcd62121/hcd62121.cpp | 4 +- src/devices/cpu/hd61700/hd61700.cpp | 4 +- src/devices/cpu/i8089/i8089_channel.cpp | 6 +- src/devices/cpu/i86/i186.cpp | 18 ++--- src/devices/cpu/m6502/m3745x.cpp | 4 +- src/devices/cpu/m68000/m68kcpu.cpp | 8 +-- src/devices/cpu/mcs51/mcs51.cpp | 4 +- src/devices/cpu/pdp1/pdp1.cpp | 4 +- src/devices/cpu/pdp1/tx0.cpp | 4 +- src/devices/cpu/rsp/rspcp2.cpp | 10 +-- src/devices/cpu/se3208/se3208.cpp | 4 +- src/devices/cpu/sh2/sh2drc.cpp | 14 ++-- src/devices/cpu/sharc/sharc.cpp | 54 +++++++-------- src/devices/cpu/sm8500/sm8500.cpp | 4 +- src/devices/cpu/ssp1601/ssp1601.cpp | 4 +- src/devices/cpu/superfx/superfx.cpp | 4 +- src/devices/cpu/upd7725/upd7725.cpp | 4 +- src/devices/cpu/z8/z8.cpp | 12 ++-- src/devices/imagedev/floppy.cpp | 2 +- src/devices/machine/53c810.cpp | 4 +- src/devices/machine/6525tpi.cpp | 4 +- src/devices/machine/68307tmu.cpp | 4 +- src/devices/machine/6840ptm.cpp | 10 +-- src/devices/machine/74148.cpp | 4 +- src/devices/machine/74153.cpp | 12 ++-- src/devices/machine/am9517a.cpp | 12 ++-- src/devices/machine/ataintf.cpp | 42 ++++++------ src/devices/machine/ay31015.cpp | 8 +-- src/devices/machine/ds1302.cpp | 4 +- src/devices/machine/ds2404.cpp | 10 +-- src/devices/machine/hdc92x4.cpp | 8 +-- src/devices/machine/i8257.cpp | 14 ++-- src/devices/machine/i8271.cpp | 12 ++-- src/devices/machine/kb3600.cpp | 4 +- src/devices/machine/laserdsc.cpp | 12 ++-- src/devices/machine/m6m80011ap.cpp | 4 +- src/devices/machine/mc6843.cpp | 4 +- src/devices/machine/mc6854.cpp | 4 +- src/devices/machine/mos8722.cpp | 4 +- src/devices/machine/msm5832.cpp | 4 +- src/devices/machine/msm58321.cpp | 4 +- src/devices/machine/netlist.h | 4 +- src/devices/machine/pci.cpp | 4 +- src/devices/machine/pla.cpp | 8 +-- src/devices/machine/rtc9701.cpp | 4 +- src/devices/machine/s2636.cpp | 4 +- src/devices/machine/s3c24xx.inc | 16 ++--- src/devices/machine/s3c44b0.cpp | 24 +++---- src/devices/machine/upd1990a.cpp | 4 +- src/devices/machine/upd71071.cpp | 4 +- src/devices/machine/upd765.cpp | 12 ++-- src/devices/machine/wd7600.cpp | 4 +- src/devices/machine/z80ctc.cpp | 4 +- src/devices/machine/z80dart.cpp | 20 +++--- src/devices/machine/z80scc.cpp | 12 ++-- src/devices/machine/z80sio.cpp | 12 ++-- src/devices/machine/z80sti.cpp | 4 +- src/devices/machine/z8536.cpp | 4 +- src/devices/sound/es5503.cpp | 22 +++--- src/devices/sound/es5506.cpp | 4 +- src/devices/sound/i5000.cpp | 4 +- src/devices/sound/ics2115.cpp | 42 ++++++------ src/devices/sound/k007232.cpp | 4 +- src/devices/sound/k053260.cpp | 12 ++-- src/devices/sound/k054539.cpp | 4 +- src/devices/sound/nes_apu.cpp | 16 ++--- src/devices/sound/nes_defs.h | 16 ++--- src/devices/sound/okim6295.cpp | 8 +-- src/devices/sound/okim9810.cpp | 8 +-- src/devices/sound/qs1000.cpp | 8 +-- src/devices/sound/qsound.cpp | 30 ++++---- src/devices/sound/sp0250.cpp | 14 ++-- src/devices/sound/spu.cpp | 8 +-- src/devices/sound/ymf271.cpp | 6 +- src/devices/sound/ymz280b.cpp | 8 +-- src/devices/sound/ymz770.cpp | 102 ++++++++++++++-------------- src/devices/sound/zsg2.cpp | 26 +++---- src/devices/video/crt9007.cpp | 4 +- src/devices/video/hd66421.cpp | 4 +- src/devices/video/mos6566.cpp | 4 +- src/devices/video/snes_ppu.cpp | 48 ++++++------- src/devices/video/tms9928a.cpp | 4 +- src/devices/video/upd7220.cpp | 4 +- src/emu/dispatch.h | 4 +- src/emu/input.cpp | 4 +- src/lib/formats/ap2_dsk.cpp | 20 +++--- src/lib/formats/ap_dsk35.cpp | 4 +- src/lib/formats/cassimg.cpp | 4 +- src/lib/formats/flopimg.cpp | 12 ++-- src/mame/audio/dave.cpp | 32 ++++----- src/mame/audio/exidy440.cpp | 8 +-- src/mame/audio/flower.cpp | 4 +- src/mame/audio/lynx.cpp | 4 +- src/mame/audio/mea8000.cpp | 16 ++--- src/mame/audio/turrett.cpp | 4 +- src/mame/drivers/atarist.cpp | 4 +- src/mame/drivers/bfm_sc45_helper.cpp | 60 ++++++++-------- src/mame/drivers/esq1.cpp | 4 +- src/mame/drivers/famibox.cpp | 12 ++-- src/mame/drivers/hyperscan.cpp | 16 ++--- src/mame/drivers/iq151.cpp | 20 +++--- src/mame/drivers/jack.cpp | 4 +- src/mame/drivers/joystand.cpp | 6 +- src/mame/drivers/lethal.cpp | 4 +- src/mame/drivers/microvsn.cpp | 18 ++--- src/mame/drivers/monty.cpp | 4 +- src/mame/drivers/mz3500.cpp | 6 +- src/mame/drivers/nakajies.cpp | 4 +- src/mame/drivers/namcoic.cpp | 8 +-- src/mame/drivers/namcos22.cpp | 4 +- src/mame/drivers/pcfx.cpp | 6 +- src/mame/drivers/psikyo4.cpp | 4 +- src/mame/drivers/raiden2.cpp | 4 +- src/mame/drivers/segaxbd.cpp | 4 +- src/mame/drivers/stratos.cpp | 4 +- src/mame/drivers/subsino2.cpp | 4 +- src/mame/drivers/x07.cpp | 8 +-- src/mame/includes/msx.h | 4 +- src/mame/includes/tandy2k.h | 4 +- src/mame/machine/315-5838_317-0229_comp.cpp | 20 +++--- src/mame/machine/315_5296.cpp | 4 +- src/mame/machine/asic65.cpp | 4 +- src/mame/machine/balsente.cpp | 4 +- src/mame/machine/cdi070.cpp | 4 +- src/mame/machine/cdislave.cpp | 16 ++--- src/mame/machine/decocass_tape.cpp | 4 +- src/mame/machine/fd1094.cpp | 8 +-- src/mame/machine/gb.cpp | 4 +- src/mame/machine/kc.cpp | 16 ++--- src/mame/machine/megacdcd.cpp | 8 +-- src/mame/machine/micropolis.cpp | 14 ++-- src/mame/machine/model3.cpp | 8 +-- src/mame/machine/msx.cpp | 18 ++--- src/mame/machine/namcoio.cpp | 4 +- src/mame/machine/naomim1.cpp | 4 +- src/mame/machine/pce.cpp | 4 +- src/mame/machine/pgmprot_igs027a_type1.cpp | 4 +- src/mame/machine/pgmprot_igs027a_type3.cpp | 4 +- src/mame/machine/rx01.cpp | 8 +-- src/mame/machine/segaic16.cpp | 12 ++-- src/mame/machine/snes.cpp | 20 +++--- src/mame/machine/st0016.cpp | 4 +- src/mame/machine/tait8741.cpp | 14 ++-- src/mame/machine/taitoio.cpp | 12 ++-- src/mame/machine/vectrex.cpp | 4 +- src/mame/video/abc806.cpp | 4 +- src/mame/video/antic.cpp | 4 +- src/mame/video/bfm_dm01.cpp | 8 +-- src/mame/video/chihiro.cpp | 12 ++-- src/mame/video/gauntlet.cpp | 4 +- src/mame/video/hng64.cpp | 8 +-- src/mame/video/k053244_k053245.cpp | 4 +- src/mame/video/k053246_k053247_k055673.cpp | 8 +-- src/mame/video/k057714.cpp | 8 +-- src/mame/video/kaneko16.cpp | 4 +- src/mame/video/maria.cpp | 8 +-- src/mame/video/mcd212.cpp | 60 ++++++++-------- src/mame/video/nemesis.cpp | 4 +- src/mame/video/pc080sn.cpp | 4 +- src/mame/video/powervr2.cpp | 6 +- src/mame/video/ppu2c0x.cpp | 4 +- src/mame/video/psikyosh.cpp | 2 +- src/mame/video/rdptpipe.h | 4 +- src/mame/video/stic.cpp | 4 +- src/mame/video/tc0100scn.cpp | 4 +- src/mame/video/tc0360pri.cpp | 4 +- src/mame/video/tc0480scp.cpp | 4 +- src/tools/chdman.cpp | 24 +++---- src/tools/src2html.cpp | 6 +- 236 files changed, 1171 insertions(+), 1171 deletions(-) (limited to 'src/lib/formats/ap2_dsk.cpp') diff --git a/src/devices/bus/a2bus/a2bus.cpp b/src/devices/bus/a2bus/a2bus.cpp index eec06d8bdb8..5fd03495c87 100644 --- a/src/devices/bus/a2bus/a2bus.cpp +++ b/src/devices/bus/a2bus/a2bus.cpp @@ -168,9 +168,9 @@ void a2bus_device::device_start() m_out_inh_cb.resolve_safe(); // clear slots - for (int i = 0; i < 8; i++) + for (auto & elem : m_device_list) { - m_device_list[i] = nullptr; + elem = nullptr; } m_slot_irq_mask = m_slot_nmi_mask = 0; diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp index 93a62a6d03d..ad7f621d6c8 100644 --- a/src/devices/bus/a2bus/a2mcms.cpp +++ b/src/devices/bus/a2bus/a2mcms.cpp @@ -232,9 +232,9 @@ void mcms_device::device_start() memset(m_acc, 0, sizeof(m_acc)); // the card detect programs volumes and wavetable page but not freq and expects the accumulator to increment - for (int i = 0; i < 16; i++) + for (auto & elem : m_freq) { - m_freq[i] = 0x0040; + elem = 0x0040; } save_item(NAME(m_enabled)); diff --git a/src/devices/bus/a7800/a78_slot.cpp b/src/devices/bus/a7800/a78_slot.cpp index 78c4cece478..7fda107b70c 100644 --- a/src/devices/bus/a7800/a78_slot.cpp +++ b/src/devices/bus/a7800/a78_slot.cpp @@ -322,10 +322,10 @@ static const a78_slot slot_list[] = static int a78_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -333,10 +333,10 @@ static int a78_get_pcb_id(const char *slot) static const char *a78_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "a78_rom"; diff --git a/src/devices/bus/a800/a800_slot.cpp b/src/devices/bus/a800/a800_slot.cpp index 973be0eb899..148ab38ed03 100644 --- a/src/devices/bus/a800/a800_slot.cpp +++ b/src/devices/bus/a800/a800_slot.cpp @@ -216,10 +216,10 @@ static const a800_slot slot_list[] = static int a800_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -227,10 +227,10 @@ static int a800_get_pcb_id(const char *slot) static const char *a800_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "a800_8k"; diff --git a/src/devices/bus/amiga/zorro/a2232.cpp b/src/devices/bus/amiga/zorro/a2232.cpp index 60f5b96ac53..4cf44853c46 100644 --- a/src/devices/bus/amiga/zorro/a2232.cpp +++ b/src/devices/bus/amiga/zorro/a2232.cpp @@ -206,9 +206,9 @@ void a2232_device::device_reset_after_children() void a2232_device::update_irqs() { // look for any active irq - for (int i = 0; i < IRQ_SOURCE_COUNT; i++) + for (auto & elem : m_irqs) { - if (m_irqs[i]) + if (elem) { m_iocpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); return; diff --git a/src/devices/bus/apf/slot.cpp b/src/devices/bus/apf/slot.cpp index 4a89673a9d0..b94f286798c 100644 --- a/src/devices/bus/apf/slot.cpp +++ b/src/devices/bus/apf/slot.cpp @@ -131,10 +131,10 @@ static const apf_slot slot_list[] = static int apf_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -142,10 +142,10 @@ static int apf_get_pcb_id(const char *slot) static const char *apf_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "std"; diff --git a/src/devices/bus/arcadia/slot.cpp b/src/devices/bus/arcadia/slot.cpp index c2cddcc8488..eec8c412775 100644 --- a/src/devices/bus/arcadia/slot.cpp +++ b/src/devices/bus/arcadia/slot.cpp @@ -120,10 +120,10 @@ static const arcadia_slot slot_list[] = static int arcadia_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; diff --git a/src/devices/bus/astrocde/slot.cpp b/src/devices/bus/astrocde/slot.cpp index 74071506c90..877df4773a0 100644 --- a/src/devices/bus/astrocde/slot.cpp +++ b/src/devices/bus/astrocde/slot.cpp @@ -121,10 +121,10 @@ static const astrocade_slot slot_list[] = static int astrocade_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -132,10 +132,10 @@ static int astrocade_get_pcb_id(const char *slot) static const char *astrocade_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "std"; diff --git a/src/devices/bus/bml3/bml3bus.cpp b/src/devices/bus/bml3/bml3bus.cpp index b06ac50e5d2..0438cc58997 100644 --- a/src/devices/bus/bml3/bml3bus.cpp +++ b/src/devices/bus/bml3/bml3bus.cpp @@ -139,9 +139,9 @@ void bml3bus_device::device_start() m_out_firq_cb.resolve_safe(); // clear slots - for (int i = 0; i < BML3BUS_MAX_SLOTS; i++) + for (auto & elem : m_device_list) { - m_device_list[i] = nullptr; + elem = nullptr; } } diff --git a/src/devices/bus/cbmiec/cbmiec.cpp b/src/devices/bus/cbmiec/cbmiec.cpp index bcfc9318860..7e893614f3f 100644 --- a/src/devices/bus/cbmiec/cbmiec.cpp +++ b/src/devices/bus/cbmiec/cbmiec.cpp @@ -290,9 +290,9 @@ cbm_iec_device::cbm_iec_device(const machine_config &mconfig, const char *tag, d m_write_data(*this), m_write_reset(*this) { - for (int i = 0; i < SIGNAL_COUNT; i++) + for (auto & elem : m_line) { - m_line[i] = 1; + elem = 1; } } @@ -357,9 +357,9 @@ cbm_iec_device::daisy_entry::daisy_entry(device_t *device) m_device(device), m_interface(nullptr) { - for (int i = 0; i < SIGNAL_COUNT; i++) + for (auto & elem : m_line) { - m_line[i] = 1; + elem = 1; } device->interface(m_interface); diff --git a/src/devices/bus/chanf/slot.cpp b/src/devices/bus/chanf/slot.cpp index ad6eae7bde8..f46abf3b7c3 100644 --- a/src/devices/bus/chanf/slot.cpp +++ b/src/devices/bus/chanf/slot.cpp @@ -134,10 +134,10 @@ static const chanf_slot slot_list[] = static int chanf_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -145,10 +145,10 @@ static int chanf_get_pcb_id(const char *slot) static const char *chanf_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "chess"; diff --git a/src/devices/bus/comx35/expbox.cpp b/src/devices/bus/comx35/expbox.cpp index be5bc3bee73..ce0dec61006 100644 --- a/src/devices/bus/comx35/expbox.cpp +++ b/src/devices/bus/comx35/expbox.cpp @@ -149,9 +149,9 @@ void comx_eb_device::device_start() m_expansion_slot[2] = dynamic_cast(subdevice(SLOT3_TAG)); m_expansion_slot[3] = dynamic_cast(subdevice(SLOT4_TAG)); - for (int slot = 0; slot < MAX_EB_SLOTS; slot++) + for (auto & elem : m_irq) { - m_irq[slot] = CLEAR_LINE; + elem = CLEAR_LINE; } } @@ -162,12 +162,12 @@ void comx_eb_device::device_start() void comx_eb_device::device_reset() { - for (int slot = 0; slot < MAX_EB_SLOTS; slot++) + for (auto & elem : m_expansion_slot) { - if (m_expansion_slot[slot] != nullptr) + if (elem != nullptr) { - m_expansion_slot[slot]->device().reset(); - m_expansion_slot[slot]->ds_w(0); + elem->device().reset(); + elem->ds_w(0); } } } @@ -181,11 +181,11 @@ int comx_eb_device::comx_ef4_r() { int state = CLEAR_LINE; - for (int slot = 0; slot < MAX_EB_SLOTS; slot++) + for (auto & elem : m_expansion_slot) { - if (m_expansion_slot[slot] != nullptr) + if (elem != nullptr) { - state |= m_expansion_slot[slot]->ef4_r(); + state |= elem->ef4_r(); } } @@ -199,11 +199,11 @@ int comx_eb_device::comx_ef4_r() void comx_eb_device::comx_q_w(int state) { - for (int slot = 0; slot < MAX_EB_SLOTS; slot++) + for (auto & elem : m_expansion_slot) { - if (m_expansion_slot[slot] != nullptr) + if (elem != nullptr) { - m_expansion_slot[slot]->q_w(state); + elem->q_w(state); } } } diff --git a/src/devices/bus/crvision/slot.cpp b/src/devices/bus/crvision/slot.cpp index df7caa51f95..207105ea1d6 100644 --- a/src/devices/bus/crvision/slot.cpp +++ b/src/devices/bus/crvision/slot.cpp @@ -125,10 +125,10 @@ static const crvision_slot slot_list[] = static int crvision_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -136,10 +136,10 @@ static int crvision_get_pcb_id(const char *slot) static const char *crvision_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "crv_rom4k"; diff --git a/src/devices/bus/ecbbus/ecbbus.cpp b/src/devices/bus/ecbbus/ecbbus.cpp index 100af329b10..c96d49da103 100644 --- a/src/devices/bus/ecbbus/ecbbus.cpp +++ b/src/devices/bus/ecbbus/ecbbus.cpp @@ -95,8 +95,8 @@ ecbbus_device::ecbbus_device(const machine_config &mconfig, const char *tag, dev m_write_irq(*this), m_write_nmi(*this) { - for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) - m_ecbbus_device[i] = nullptr; + for (auto & elem : m_ecbbus_device) + elem = nullptr; } @@ -130,11 +130,11 @@ READ8_MEMBER( ecbbus_device::mem_r ) { UINT8 data = 0; - for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) + for (auto & elem : m_ecbbus_device) { - if (m_ecbbus_device[i] != nullptr) + if (elem != nullptr) { - data |= m_ecbbus_device[i]->ecbbus_mem_r(offset); + data |= elem->ecbbus_mem_r(offset); } } @@ -148,11 +148,11 @@ READ8_MEMBER( ecbbus_device::mem_r ) WRITE8_MEMBER( ecbbus_device::mem_w ) { - for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) + for (auto & elem : m_ecbbus_device) { - if (m_ecbbus_device[i] != nullptr) + if (elem != nullptr) { - m_ecbbus_device[i]->ecbbus_mem_w(offset, data); + elem->ecbbus_mem_w(offset, data); } } } @@ -166,11 +166,11 @@ READ8_MEMBER( ecbbus_device::io_r ) { UINT8 data = 0; - for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) + for (auto & elem : m_ecbbus_device) { - if (m_ecbbus_device[i] != nullptr) + if (elem != nullptr) { - data |= m_ecbbus_device[i]->ecbbus_io_r(offset); + data |= elem->ecbbus_io_r(offset); } } @@ -184,11 +184,11 @@ READ8_MEMBER( ecbbus_device::io_r ) WRITE8_MEMBER( ecbbus_device::io_w ) { - for (int i = 0; i < MAX_ECBBUS_SLOTS; i++) + for (auto & elem : m_ecbbus_device) { - if (m_ecbbus_device[i] != nullptr) + if (elem != nullptr) { - m_ecbbus_device[i]->ecbbus_io_w(offset, data); + elem->ecbbus_io_w(offset, data); } } } diff --git a/src/devices/bus/econet/econet.cpp b/src/devices/bus/econet/econet.cpp index f1a2ff110e0..e56d843db32 100644 --- a/src/devices/bus/econet/econet.cpp +++ b/src/devices/bus/econet/econet.cpp @@ -198,9 +198,9 @@ econet_device::econet_device(const machine_config &mconfig, const char *tag, dev m_write_clk(*this), m_write_data(*this) { - for (int i = 0; i < SIGNAL_COUNT; i++) + for (auto & elem : m_line) { - m_line[i] = 1; + elem = 1; } } @@ -251,9 +251,9 @@ econet_device::daisy_entry::daisy_entry(device_t *device) : m_device(device), m_interface(nullptr) { - for (int i = 0; i < SIGNAL_COUNT; i++) + for (auto & elem : m_line) { - m_line[i] = 1; + elem = 1; } device->interface(m_interface); diff --git a/src/devices/bus/gameboy/gb_slot.cpp b/src/devices/bus/gameboy/gb_slot.cpp index 19ddda4601b..e70eb07c6d2 100644 --- a/src/devices/bus/gameboy/gb_slot.cpp +++ b/src/devices/bus/gameboy/gb_slot.cpp @@ -232,10 +232,10 @@ static const gb_slot slot_list[] = static int gb_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -243,10 +243,10 @@ static int gb_get_pcb_id(const char *slot) static const char *gb_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "rom"; diff --git a/src/devices/bus/gba/gba_slot.cpp b/src/devices/bus/gba/gba_slot.cpp index 2618b7ad09f..fc8f09f30a0 100644 --- a/src/devices/bus/gba/gba_slot.cpp +++ b/src/devices/bus/gba/gba_slot.cpp @@ -138,10 +138,10 @@ static const gba_slot slot_list[] = static int gba_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -149,10 +149,10 @@ static int gba_get_pcb_id(const char *slot) static const char *gba_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "gba_rom"; @@ -324,9 +324,9 @@ int gba_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) chip &= ~(GBA_CHIP_EEPROM | GBA_CHIP_EEPROM_4K | GBA_CHIP_EEPROM_64K | GBA_CHIP_FLASH | GBA_CHIP_FLASH_1M | GBA_CHIP_FLASH_512 | GBA_CHIP_SRAM); // search if it is one of the known titles with NVRAM conflicts - for (int i = 0; i < sizeof(gba_chip_fix_conflict_list) / sizeof(gba_chip_fix_conflict_item); i++) + for (auto & elem : gba_chip_fix_conflict_list) { - const gba_chip_fix_conflict_item *item = &gba_chip_fix_conflict_list[i]; + const gba_chip_fix_conflict_item *item = &elem; if (!strcmp(game_code, item->game_code)) { chip |= item->chip; @@ -348,9 +348,9 @@ int gba_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) osd_printf_info("GBA: Game Code \"%s\"\n", game_code); - for (int i = 0; i < sizeof(gba_chip_fix_eeprom_list) / sizeof(gba_chip_fix_eeprom_item); i++) + for (auto & elem : gba_chip_fix_eeprom_list) { - const gba_chip_fix_eeprom_item *item = &gba_chip_fix_eeprom_list[i]; + const gba_chip_fix_eeprom_item *item = &elem; if (!strcmp(game_code, item->game_code)) { chip = (chip & ~GBA_CHIP_EEPROM) | GBA_CHIP_EEPROM_64K; diff --git a/src/devices/bus/ieee488/ieee488.cpp b/src/devices/bus/ieee488/ieee488.cpp index c217407d49e..38a1f538404 100644 --- a/src/devices/bus/ieee488/ieee488.cpp +++ b/src/devices/bus/ieee488/ieee488.cpp @@ -112,9 +112,9 @@ ieee488_device::ieee488_device(const machine_config &mconfig, const char *tag, d m_write_ren(*this), m_dio(0xff) { - for (int i = 0; i < SIGNAL_COUNT; i++) + for (auto & elem : m_line) { - m_line[i] = 1; + elem = 1; } } @@ -172,9 +172,9 @@ ieee488_device::daisy_entry::daisy_entry(device_t *device) m_interface(nullptr), m_dio(0xff) { - for (int i = 0; i < SIGNAL_COUNT; i++) + for (auto & elem : m_line) { - m_line[i] = 1; + elem = 1; } device->interface(m_interface); diff --git a/src/devices/bus/intv/slot.cpp b/src/devices/bus/intv/slot.cpp index 342a40964f4..05e55e49318 100644 --- a/src/devices/bus/intv/slot.cpp +++ b/src/devices/bus/intv/slot.cpp @@ -207,10 +207,10 @@ static const intv_slot slot_list[] = static int intv_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -219,10 +219,10 @@ static int intv_get_pcb_id(const char *slot) #if 1 static const char *intv_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "intv_rom"; diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index 3c1cd22cab7..8f99ddc0792 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -1593,9 +1593,9 @@ void isa8_cga_pc1512_device::device_reset() m_write = 0x0f; m_read = 0; m_mc6845_address = 0; - for ( int i = 0; i < 31; i++ ) + for (auto & elem : m_mc6845_locked_register) { - m_mc6845_locked_register[i] = 0; + elem = 0; } membank("bank1")->set_base(&m_vram[isa8_cga_pc1512_device::vram_offset[0]]); diff --git a/src/devices/bus/kc/d002.cpp b/src/devices/bus/kc/d002.cpp index 7abf3aa6b47..fdb36a8c34d 100644 --- a/src/devices/bus/kc/d002.cpp +++ b/src/devices/bus/kc/d002.cpp @@ -161,8 +161,8 @@ ioport_constructor kc_d002_device::device_input_ports() const void kc_d002_device::read(offs_t offset, UINT8 &data) { - for (int i=0; i<5; i++) - m_expansions[i]->read(offset, data); + for (auto & elem : m_expansions) + elem->read(offset, data); } //------------------------------------------------- @@ -171,8 +171,8 @@ void kc_d002_device::read(offs_t offset, UINT8 &data) void kc_d002_device::write(offs_t offset, UINT8 data) { - for (int i=0; i<5; i++) - m_expansions[i]->write(offset, data); + for (auto & elem : m_expansions) + elem->write(offset, data); } //------------------------------------------------- @@ -192,8 +192,8 @@ void kc_d002_device::io_read(offs_t offset, UINT8 &data) } else { - for (int i=0; i<5; i++) - m_expansions[i]->io_read(offset, data); + for (auto & elem : m_expansions) + elem->io_read(offset, data); } } @@ -214,8 +214,8 @@ void kc_d002_device::io_write(offs_t offset, UINT8 data) } else { - for (int i=0; i<5; i++) - m_expansions[i]->io_write(offset, data); + for (auto & elem : m_expansions) + elem->io_write(offset, data); } } diff --git a/src/devices/bus/lpci/pci.cpp b/src/devices/bus/lpci/pci.cpp index 90e13e9eb22..aa095a8cd4e 100644 --- a/src/devices/bus/lpci/pci.cpp +++ b/src/devices/bus/lpci/pci.cpp @@ -93,8 +93,8 @@ pci_bus_device::pci_bus_device(const machine_config &mconfig, const char *tag, d device_t(mconfig, PCI_BUS, "PCI Bus", tag, owner, clock, "pci_bus", __FILE__), m_busnum(0), m_father(nullptr), m_address(0), m_devicenum(0), m_busnumber(0), m_busnumaddr(nullptr) { - for (int i = 0; i < ARRAY_LENGTH(m_devtag); i++) { - m_devtag[i]= nullptr; + for (auto & elem : m_devtag) { + elem= nullptr; } m_siblings_count = 0; } diff --git a/src/devices/bus/megadrive/md_slot.cpp b/src/devices/bus/megadrive/md_slot.cpp index 45fc6b75030..2d0ff90acb6 100644 --- a/src/devices/bus/megadrive/md_slot.cpp +++ b/src/devices/bus/megadrive/md_slot.cpp @@ -289,10 +289,10 @@ static const md_slot slot_list[] = static int md_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return SEGA_STD; @@ -300,10 +300,10 @@ static int md_get_pcb_id(const char *slot) static const char *md_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "rom"; diff --git a/src/devices/bus/msx_cart/ascii.cpp b/src/devices/bus/msx_cart/ascii.cpp index 07da54de8b7..04ef820e7d9 100644 --- a/src/devices/bus/msx_cart/ascii.cpp +++ b/src/devices/bus/msx_cart/ascii.cpp @@ -43,9 +43,9 @@ void msx_cart_ascii8::restore_banks() void msx_cart_ascii8::device_reset() { - for (int i = 0; i < 4; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } } @@ -127,9 +127,9 @@ void msx_cart_ascii16::restore_banks() void msx_cart_ascii16::device_reset() { - for (int i = 0; i < 2; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } } @@ -237,9 +237,9 @@ void msx_cart_ascii8_sram::restore_banks() void msx_cart_ascii8_sram::device_reset() { - for (int i = 0; i < 4; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } } @@ -362,9 +362,9 @@ void msx_cart_ascii16_sram::restore_banks() void msx_cart_ascii16_sram::device_reset() { - for (int i = 0; i < 2; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } } @@ -477,9 +477,9 @@ void msx_cart_msxwrite::restore_banks() void msx_cart_msxwrite::device_reset() { - for (int i = 0; i < 2; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } } diff --git a/src/devices/bus/msx_cart/crossblaim.cpp b/src/devices/bus/msx_cart/crossblaim.cpp index 24116832469..f36f7b4b8cc 100644 --- a/src/devices/bus/msx_cart/crossblaim.cpp +++ b/src/devices/bus/msx_cart/crossblaim.cpp @@ -11,9 +11,9 @@ msx_cart_crossblaim::msx_cart_crossblaim(const machine_config &mconfig, const ch , msx_cart_interface(mconfig, *this) , m_selected_bank(1) { - for (int i = 0; i < 4; i++) + for (auto & elem : m_bank_base) { - m_bank_base[i] = nullptr; + elem = nullptr; } } diff --git a/src/devices/bus/msx_cart/halnote.cpp b/src/devices/bus/msx_cart/halnote.cpp index 63b298e67b0..d37354dd0a5 100644 --- a/src/devices/bus/msx_cart/halnote.cpp +++ b/src/devices/bus/msx_cart/halnote.cpp @@ -69,9 +69,9 @@ void msx_cart_halnote::restore_banks() void msx_cart_halnote::device_reset() { - for (int i = 0; i < 8; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } } diff --git a/src/devices/bus/msx_cart/holy_quran.cpp b/src/devices/bus/msx_cart/holy_quran.cpp index fbb7068da02..7671e8624de 100644 --- a/src/devices/bus/msx_cart/holy_quran.cpp +++ b/src/devices/bus/msx_cart/holy_quran.cpp @@ -50,9 +50,9 @@ void msx_cart_holy_quran::restore_banks() void msx_cart_holy_quran::device_reset() { - for (int i = 0; i < 4; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } } diff --git a/src/devices/bus/msx_cart/konami.cpp b/src/devices/bus/msx_cart/konami.cpp index ee0abcda095..d9d129888fd 100644 --- a/src/devices/bus/msx_cart/konami.cpp +++ b/src/devices/bus/msx_cart/konami.cpp @@ -21,9 +21,9 @@ msx_cart_konami::msx_cart_konami(const machine_config &mconfig, const char *tag, { m_selected_bank[i] = i; } - for (int i = 0; i < 8; i++) + for (auto & elem : m_bank_base) { - m_bank_base[i] = nullptr; + elem = nullptr; } } @@ -130,9 +130,9 @@ msx_cart_konami_scc::msx_cart_konami_scc(const machine_config &mconfig, const ch { m_selected_bank[i] = i; } - for (int i = 0; i < 8; i++) + for (auto & elem : m_bank_base) { - m_bank_base[i] = nullptr; + elem = nullptr; } } @@ -299,13 +299,13 @@ msx_cart_gamemaster2::msx_cart_gamemaster2(const machine_config &mconfig, const : device_t(mconfig, MSX_CART_GAMEMASTER2, "MSX Cartridge - GAMEMASTER2", tag, owner, clock, "msx_cart_gamemaster2", __FILE__) , msx_cart_interface(mconfig, *this) { - for (int i = 0; i < 3; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } - for (int i = 0; i < 8; i++) + for (auto & elem : m_bank_base) { - m_bank_base[i] = nullptr; + elem = nullptr; } } @@ -533,21 +533,21 @@ msx_cart_konami_sound::msx_cart_konami_sound(const machine_config &mconfig, devi , m_sccplus_active(false) , m_scc_mode(0) { - for (int i = 0; i < 4; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } - for (int i = 0; i < 8; i++) + for (auto & elem : m_bank_base) { - m_bank_base[i] = nullptr; + elem = nullptr; } - for (int i = 0; i < 16; i++) + for (auto & elem : m_ram_bank) { - m_ram_bank[i] = nullptr; + elem = nullptr; } - for (int i = 0; i < 4; i++) + for (auto & elem : m_ram_enabled) { - m_ram_enabled[i] = false; + elem = false; } } diff --git a/src/devices/bus/msx_cart/korean.cpp b/src/devices/bus/msx_cart/korean.cpp index 0fb2e1bb6b4..f1dedeb9874 100644 --- a/src/devices/bus/msx_cart/korean.cpp +++ b/src/devices/bus/msx_cart/korean.cpp @@ -107,9 +107,9 @@ msx_cart_korean_90in1::msx_cart_korean_90in1(const machine_config &mconfig, cons , m_bank_mask(0) , m_selected_bank(0) { - for (int i = 0; i < 4; i++) + for (auto & elem : m_bank_base) { - m_bank_base[i] = nullptr; + elem = nullptr; } } diff --git a/src/devices/bus/msx_cart/majutsushi.cpp b/src/devices/bus/msx_cart/majutsushi.cpp index eca7aa44f6c..23091c1fb4b 100644 --- a/src/devices/bus/msx_cart/majutsushi.cpp +++ b/src/devices/bus/msx_cart/majutsushi.cpp @@ -11,13 +11,13 @@ msx_cart_majutsushi::msx_cart_majutsushi(const machine_config &mconfig, const ch , msx_cart_interface(mconfig, *this) , m_dac(*this, "dac") { - for (int i = 0; i < 4; i++) + for (auto & elem : m_selected_bank) { - m_selected_bank[i] = 0; + elem = 0; } - for (int i = 0; i < 8; i++) + for (auto & elem : m_bank_base) { - m_bank_base[i] = nullptr; + elem = nullptr; } } diff --git a/src/devices/bus/msx_cart/rtype.cpp b/src/devices/bus/msx_cart/rtype.cpp index ec430b6e2fb..ffe7d56cfba 100644 --- a/src/devices/bus/msx_cart/rtype.cpp +++ b/src/devices/bus/msx_cart/rtype.cpp @@ -11,9 +11,9 @@ msx_cart_rtype::msx_cart_rtype(const machine_config &mconfig, const char *tag, d , msx_cart_interface(mconfig, *this) , m_selected_bank(0) { - for (int i = 0; i < 2; i++) + for (auto & elem : m_bank_base) { - m_bank_base[i] = nullptr; + elem = nullptr; } } diff --git a/src/devices/bus/msx_slot/cartridge.cpp b/src/devices/bus/msx_slot/cartridge.cpp index 22e4e6c11ec..43a92a94906 100644 --- a/src/devices/bus/msx_slot/cartridge.cpp +++ b/src/devices/bus/msx_slot/cartridge.cpp @@ -85,10 +85,10 @@ static const struct static const char *msx_cart_get_slot_option(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return slot_list[0].slot_option; @@ -315,11 +315,11 @@ void msx_slot_cartridge_device::get_default_card_software(std::string &result) { 17, KOREAN_126IN1 } }; - for (int i = 0; i < ARRAY_LENGTH(extrainfo_map); i++) + for (auto & elem : extrainfo_map) { - if (extrainfo_map[i].extrainfo == extrainfo_type) + if (elem.extrainfo == extrainfo_type) { - type = extrainfo_map[i].mapper; + type = elem.mapper; } } } diff --git a/src/devices/bus/nes/mmc5.cpp b/src/devices/bus/nes/mmc5.cpp index c3a82e02c8e..4fcc50282d3 100644 --- a/src/devices/bus/nes/mmc5.cpp +++ b/src/devices/bus/nes/mmc5.cpp @@ -122,8 +122,8 @@ void nes_exrom_device::pcb_reset() m_ex1_bank = 0; m_vcount = 0; - for (int i = 0; i < 12; i++) - m_vrom_bank[i] = 0x3ff; + for (auto & elem : m_vrom_bank) + elem = 0x3ff; m_prg_regs[0] = 0xfc; m_prg_regs[1] = 0xfd; diff --git a/src/devices/bus/nes/nes_pcb.inc b/src/devices/bus/nes/nes_pcb.inc index fdaceb3c1ba..b7af5aeefd4 100644 --- a/src/devices/bus/nes/nes_pcb.inc +++ b/src/devices/bus/nes/nes_pcb.inc @@ -325,20 +325,20 @@ static const nes_pcb pcb_list[] = static const nes_pcb *nes_pcb_lookup( const char *slot ) { - for (int i = 0; i < ARRAY_LENGTH(pcb_list); i++) + for (auto & elem : pcb_list) { - if (!core_stricmp(pcb_list[i].slot_opt, slot)) - return &pcb_list[i]; + if (!core_stricmp(elem.slot_opt, slot)) + return &elem; } return nullptr; } static const nes_pcb *nes_id_lookup( int id ) { - for (int i = 0; i < ARRAY_LENGTH(pcb_list); i++) + for (auto & elem : pcb_list) { - if (pcb_list[i].pcb_id == id) - return &pcb_list[i]; + if (elem.pcb_id == id) + return &elem; } return nullptr; } diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp index 69473618b04..e4d3f4c8d3c 100644 --- a/src/devices/bus/odyssey2/slot.cpp +++ b/src/devices/bus/odyssey2/slot.cpp @@ -133,10 +133,10 @@ static const o2_slot slot_list[] = static int o2_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -144,10 +144,10 @@ static int o2_get_pcb_id(const char *slot) static const char *o2_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "o2_rom"; diff --git a/src/devices/bus/pce/pce_slot.cpp b/src/devices/bus/pce/pce_slot.cpp index fb145d1a6a6..254993a4714 100644 --- a/src/devices/bus/pce/pce_slot.cpp +++ b/src/devices/bus/pce/pce_slot.cpp @@ -197,10 +197,10 @@ static const pce_slot slot_list[] = static int pce_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -208,10 +208,10 @@ static int pce_get_pcb_id(const char *slot) static const char *pce_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "rom"; diff --git a/src/devices/bus/scv/slot.cpp b/src/devices/bus/scv/slot.cpp index 733c8258ea0..e29221b411a 100644 --- a/src/devices/bus/scv/slot.cpp +++ b/src/devices/bus/scv/slot.cpp @@ -135,10 +135,10 @@ static const scv_slot slot_list[] = static int scv_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -146,10 +146,10 @@ static int scv_get_pcb_id(const char *slot) static const char *scv_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "rom8k"; diff --git a/src/devices/bus/sega8/sega8_slot.cpp b/src/devices/bus/sega8/sega8_slot.cpp index a1be24b7f2e..c88be013d3f 100644 --- a/src/devices/bus/sega8/sega8_slot.cpp +++ b/src/devices/bus/sega8/sega8_slot.cpp @@ -188,10 +188,10 @@ static const sega8_slot slot_list[] = static int sega8_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -199,10 +199,10 @@ static int sega8_get_pcb_id(const char *slot) static const char *sega8_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "rom"; diff --git a/src/devices/bus/snes/sdd1.cpp b/src/devices/bus/snes/sdd1.cpp index ccfed10ebe1..56376641705 100644 --- a/src/devices/bus/snes/sdd1.cpp +++ b/src/devices/bus/snes/sdd1.cpp @@ -188,10 +188,10 @@ static const SDD1_PEM_state PEM_evolution_table[33] = void SDD1_PEM::PEM_prepareDecomp() { - for (int i = 0; i < 32; i++) + for (auto & elem : m_contextInfo) { - m_contextInfo[i].status = 0; - m_contextInfo[i].MPS = 0; + elem.status = 0; + elem.MPS = 0; } } @@ -459,10 +459,10 @@ void sns_rom_sdd1_device::device_reset() m_mmc[2] = 2 << 20; m_mmc[3] = 3 << 20; - for(int i = 0; i < 8; i++) + for(auto & elem : m_dma) { - m_dma[i].addr = 0; - m_dma[i].size = 0; + elem.addr = 0; + elem.size = 0; } } diff --git a/src/devices/bus/snes/snes_slot.cpp b/src/devices/bus/snes/snes_slot.cpp index 5f439459bfc..10add2da1cc 100644 --- a/src/devices/bus/snes/snes_slot.cpp +++ b/src/devices/bus/snes/snes_slot.cpp @@ -289,10 +289,10 @@ static const sns_slot slot_list[] = static int sns_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -300,10 +300,10 @@ static int sns_get_pcb_id(const char *slot) static const char *sns_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "lorom"; diff --git a/src/devices/bus/snes/spc7110.cpp b/src/devices/bus/snes/spc7110.cpp index 156b26c0df4..a6ebbdab2df 100644 --- a/src/devices/bus/snes/spc7110.cpp +++ b/src/devices/bus/snes/spc7110.cpp @@ -389,10 +389,10 @@ void SPC7110_Decomp::init(running_machine &machine, UINT8 *ROM, UINT32 len, UINT m_decomp_buffer_length = 0; //reset context states - for (int i = 0; i < 32; i++) + for (auto & elem : m_context) { - m_context[i].index = 0; - m_context[i].invert = 0; + elem.index = 0; + elem.invert = 0; } switch (m_decomp_mode) @@ -873,9 +873,9 @@ void SPC7110_Decomp::mode2(UINT8 init, UINT8 *ROM, UINT32 len) if (m_m2_buffer_index == 16) { - for (int i = 0; i < 16; i++) + for (auto & elem : m_m2_bitplanebuffer) { - write(m_m2_bitplanebuffer[i]); + write(elem); } m_m2_buffer_index = 0; } diff --git a/src/devices/bus/ti99_peb/bwg.cpp b/src/devices/bus/ti99_peb/bwg.cpp index 0f5f338bda0..cc1cedaf45b 100644 --- a/src/devices/bus/ti99_peb/bwg.cpp +++ b/src/devices/bus/ti99_peb/bwg.cpp @@ -547,8 +547,8 @@ void snug_bwg_device::set_floppy_motors_running(bool run) m_wd1773->set_force_ready(run); // Set all motors - for (int i=0; i < 4; i++) - if (m_floppy[i] != nullptr) m_floppy[i]->mon_w((run)? 0 : 1); + for (auto & elem : m_floppy) + if (elem != nullptr) elem->mon_w((run)? 0 : 1); // The motor-on line also connects to the wait state logic operate_ready_line(); @@ -621,8 +621,8 @@ void snug_bwg_device::device_reset() void snug_bwg_device::device_config_complete() { - for (int i=0; i < 4; i++) - m_floppy[i] = nullptr; + for (auto & elem : m_floppy) + elem = nullptr; // Seems to be null when doing a "-listslots" if (subdevice("0")!=nullptr) m_floppy[0] = static_cast(subdevice("0")->first_subdevice()); diff --git a/src/devices/bus/ti99_peb/hfdc.cpp b/src/devices/bus/ti99_peb/hfdc.cpp index e1def78eedb..dddc49a4aeb 100644 --- a/src/devices/bus/ti99_peb/hfdc.cpp +++ b/src/devices/bus/ti99_peb/hfdc.cpp @@ -802,8 +802,8 @@ void myarc_hfdc_device::set_floppy_motors_running(bool run) } // Set all motors - for (int i=0; i < 4; i++) - if (m_floppy_unit[i] != nullptr) m_floppy_unit[i]->mon_w((run)? 0 : 1); + for (auto & elem : m_floppy_unit) + if (elem != nullptr) elem->mon_w((run)? 0 : 1); } /* diff --git a/src/devices/bus/ti99_peb/memex.cpp b/src/devices/bus/ti99_peb/memex.cpp index 21ddf1a860a..4f1bbd56a0f 100644 --- a/src/devices/bus/ti99_peb/memex.cpp +++ b/src/devices/bus/ti99_peb/memex.cpp @@ -125,9 +125,9 @@ void geneve_memex_device::device_reset() { UINT8 dips = ioport("MEMEXDIPS")->read(); if (VERBOSE>5) LOG("geneve: memex dips = %02x\n", dips); - for (int i=0; i < 8; i++) + for (auto & elem : m_dip_switch) { - m_dip_switch[i] = ((dips & 0x01)!=0x00); + elem = ((dips & 0x01)!=0x00); dips = dips >> 1; } } diff --git a/src/devices/bus/ti99_peb/pcode.cpp b/src/devices/bus/ti99_peb/pcode.cpp index 9baff162ac7..e16baa7145c 100644 --- a/src/devices/bus/ti99_peb/pcode.cpp +++ b/src/devices/bus/ti99_peb/pcode.cpp @@ -107,7 +107,7 @@ READ8Z_MEMBER( ti_pcode_card_device::readz ) // GROM access if ((offset & GROMMASK)==GROMREAD) { - for (int i=0; i < 8; i++) m_grom[i]->readz(space, offset, value, mem_mask); + for (auto & elem : m_grom) elem->readz(space, offset, value, mem_mask); if (VERBOSE>5) LOG("ti99_pcode: read from grom %04x: %02x\n", offset&0xffff, *value); } else @@ -148,7 +148,7 @@ WRITE8_MEMBER( ti_pcode_card_device::write ) // 0101 1111 1111 11x0 if ((offset & GROMMASK) == GROMWRITE) { - for (int i=0; i < 8; i++) m_grom[i]->write(space, offset, data, mem_mask); + for (auto & elem : m_grom) elem->write(space, offset, data, mem_mask); } } } diff --git a/src/devices/bus/ti99_peb/samsmem.cpp b/src/devices/bus/ti99_peb/samsmem.cpp index aeb39aa92af..4f8cd48189c 100644 --- a/src/devices/bus/ti99_peb/samsmem.cpp +++ b/src/devices/bus/ti99_peb/samsmem.cpp @@ -122,7 +122,7 @@ void sams_memory_expansion_device::device_reset() // Resetting values m_map_mode = false; m_access_mapper = false; - for (int i=0; i < 16; i++) m_mapper[i] = 0; + for (auto & elem : m_mapper) elem = 0; } const rom_entry *sams_memory_expansion_device::device_rom_region() const diff --git a/src/devices/bus/ti99_peb/ti_fdc.cpp b/src/devices/bus/ti99_peb/ti_fdc.cpp index c595bcea1e8..82585c424ce 100644 --- a/src/devices/bus/ti99_peb/ti_fdc.cpp +++ b/src/devices/bus/ti99_peb/ti_fdc.cpp @@ -333,8 +333,8 @@ void ti_fdc_device::set_floppy_motors_running(bool run) m_fd1771->set_force_ready(run); // Set all motors - for (int i=0; i < 3; i++) - if (m_floppy[i] != nullptr) m_floppy[i]->mon_w((run)? 0 : 1); + for (auto & elem : m_floppy) + if (elem != nullptr) elem->mon_w((run)? 0 : 1); // The motor-on line also connects to the wait state logic operate_ready_line(); diff --git a/src/devices/bus/ti99x/990_dk.cpp b/src/devices/bus/ti99x/990_dk.cpp index 058d3f7665f..16fd5920d7c 100644 --- a/src/devices/bus/ti99x/990_dk.cpp +++ b/src/devices/bus/ti99x/990_dk.cpp @@ -874,12 +874,12 @@ void fd800_legacy_device::device_start(void) logerror("fd800: start\n"); m_int_line.resolve(); - for (int i=0; iwrite(space, offset, data, mem_mask); + elem->write(space, offset, data, mem_mask); } } } @@ -539,9 +539,9 @@ void multi_conn_device::device_start() { m_next_free_slot = 0; m_active_slot = 0; - for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++) + for (auto & elem : m_cartridge) { - m_cartridge[i] = nullptr; + elem = nullptr; } } @@ -1474,22 +1474,22 @@ void ti99_cartridge_pcb::set_cartridge(ti99_cartridge_device *cart) READ8Z_MEMBER(ti99_cartridge_pcb::gromreadz) { - for (int i=0; i < 5; i++) + for (auto & elem : m_grom) { - if (m_grom[i] != nullptr) + if (elem != nullptr) { - m_grom[i]->readz(space, offset, value, mem_mask); + elem->readz(space, offset, value, mem_mask); } } } WRITE8_MEMBER(ti99_cartridge_pcb::gromwrite) { - for (int i=0; i < 5; i++) + for (auto & elem : m_grom) { - if (m_grom[i] != nullptr) + if (elem != nullptr) { - m_grom[i]->write(space, offset, data, mem_mask); + elem->write(space, offset, data, mem_mask); } } } diff --git a/src/devices/bus/vboy/slot.cpp b/src/devices/bus/vboy/slot.cpp index 863a0ff9ad0..88ef2ce7a2f 100644 --- a/src/devices/bus/vboy/slot.cpp +++ b/src/devices/bus/vboy/slot.cpp @@ -132,10 +132,10 @@ static const vboy_slot slot_list[] = static int vboy_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; diff --git a/src/devices/bus/vc4000/slot.cpp b/src/devices/bus/vc4000/slot.cpp index a7c8fc23ec4..ecfc63b42dd 100644 --- a/src/devices/bus/vc4000/slot.cpp +++ b/src/devices/bus/vc4000/slot.cpp @@ -145,10 +145,10 @@ static const vc4000_slot slot_list[] = static int vc4000_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -156,10 +156,10 @@ static int vc4000_get_pcb_id(const char *slot) static const char *vc4000_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "std"; diff --git a/src/devices/bus/vcs/dpc.cpp b/src/devices/bus/vcs/dpc.cpp index 87a2ee34424..fac776fabb1 100644 --- a/src/devices/bus/vcs/dpc.cpp +++ b/src/devices/bus/vcs/dpc.cpp @@ -55,11 +55,11 @@ void dpc_device::device_start() void dpc_device::device_reset() { - for (int data_fetcher = 0; data_fetcher < 8; data_fetcher++) + for (auto & elem : m_df) { - m_df[data_fetcher].osc_clk = 0; - m_df[data_fetcher].flag = 0; - m_df[data_fetcher].music_mode = 0; + elem.osc_clk = 0; + elem.flag = 0; + elem.music_mode = 0; } m_oscillator->adjust(attotime::from_hz(18400), 0, attotime::from_hz(18400)); diff --git a/src/devices/bus/vcs/vcs_slot.cpp b/src/devices/bus/vcs/vcs_slot.cpp index 1b12824f6ab..caa46ef358b 100755 --- a/src/devices/bus/vcs/vcs_slot.cpp +++ b/src/devices/bus/vcs/vcs_slot.cpp @@ -162,10 +162,10 @@ static const vcs_slot slot_list[] = static int vcs_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -173,10 +173,10 @@ static int vcs_get_pcb_id(const char *slot) static const char *vcs_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "a26_4k"; @@ -671,9 +671,9 @@ int vcs_cart_slot_device::detect_super_chip(UINT8 *cart, UINT32 len) { for (int i = 0; i < len - sizeof signatures[0]; i++) { - for (int j = 0; j < (sizeof signatures/sizeof signatures[0]); j++) + for (auto & signature : signatures) { - if (!memcmp(&cart[i], &signatures[j], sizeof signatures[0])) + if (!memcmp(&cart[i], &signature, sizeof signatures[0])) { return 1; } diff --git a/src/devices/bus/vectrex/slot.cpp b/src/devices/bus/vectrex/slot.cpp index fb9e9577ddd..a7322b0b994 100644 --- a/src/devices/bus/vectrex/slot.cpp +++ b/src/devices/bus/vectrex/slot.cpp @@ -135,10 +135,10 @@ static int vectrex_get_pcb_id(const char *slot) static const char *vectrex_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "vec_rom"; diff --git a/src/devices/bus/vic20/vic1010.cpp b/src/devices/bus/vic20/vic1010.cpp index 98fd3552afa..5aa981edb5a 100644 --- a/src/devices/bus/vic20/vic1010.cpp +++ b/src/devices/bus/vic20/vic1010.cpp @@ -86,9 +86,9 @@ void vic1010_device::device_start() void vic1010_device::device_reset() { - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - m_expansion_slot[i]->reset(); + elem->reset(); } } @@ -99,9 +99,9 @@ void vic1010_device::device_reset() UINT8 vic1010_device::vic20_cd_r(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { - for (int i = 0; i < MAX_SLOTS; i++) + for (auto elem : m_expansion_slot) { - UINT8 slot_data = m_expansion_slot[i]->cd_r(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); + UINT8 slot_data = elem->cd_r(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); if (data != slot_data) { @@ -119,8 +119,8 @@ UINT8 vic1010_device::vic20_cd_r(address_space &space, offs_t offset, UINT8 data void vic1010_device::vic20_cd_w(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - m_expansion_slot[i]->cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); + elem->cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); } } diff --git a/src/devices/bus/vip/vp575.cpp b/src/devices/bus/vip/vp575.cpp index 9037498a664..680a2a14369 100644 --- a/src/devices/bus/vip/vp575.cpp +++ b/src/devices/bus/vip/vp575.cpp @@ -128,9 +128,9 @@ UINT8 vp575_device::vip_program_r(address_space &space, offs_t offset, int cs, i { UINT8 data = 0xff; - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - data &= m_expansion_slot[i]->program_r(space, offset, cs, cdef, minh); + data &= elem->program_r(space, offset, cs, cdef, minh); } return data; @@ -143,9 +143,9 @@ UINT8 vp575_device::vip_program_r(address_space &space, offs_t offset, int cs, i void vp575_device::vip_program_w(address_space &space, offs_t offset, UINT8 data, int cdef, int *minh) { - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - m_expansion_slot[i]->program_w(space, offset, data, cdef, minh); + elem->program_w(space, offset, data, cdef, minh); } } @@ -158,9 +158,9 @@ UINT8 vp575_device::vip_io_r(address_space &space, offs_t offset) { UINT8 data = 0xff; - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - data &= m_expansion_slot[i]->io_r(space, offset); + data &= elem->io_r(space, offset); } return data; @@ -173,9 +173,9 @@ UINT8 vp575_device::vip_io_r(address_space &space, offs_t offset) void vp575_device::vip_io_w(address_space &space, offs_t offset, UINT8 data) { - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - m_expansion_slot[i]->io_w(space, offset, data); + elem->io_w(space, offset, data); } } @@ -188,9 +188,9 @@ UINT8 vp575_device::vip_dma_r(address_space &space, offs_t offset) { UINT8 data = 0xff; - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - data &= m_expansion_slot[i]->dma_r(space, offset); + data &= elem->dma_r(space, offset); } return data; @@ -203,9 +203,9 @@ UINT8 vp575_device::vip_dma_r(address_space &space, offs_t offset) void vp575_device::vip_dma_w(address_space &space, offs_t offset, UINT8 data) { - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - m_expansion_slot[i]->dma_w(space, offset, data); + elem->dma_w(space, offset, data); } } @@ -218,9 +218,9 @@ UINT32 vp575_device::vip_screen_update(screen_device &screen, bitmap_rgb32 &bitm { UINT32 data = 0; - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - data |= m_expansion_slot[i]->screen_update(screen, bitmap, cliprect); + data |= elem->screen_update(screen, bitmap, cliprect); } return data; @@ -235,9 +235,9 @@ int vp575_device::vip_ef1_r() { int state = CLEAR_LINE; - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - state |= m_expansion_slot[i]->ef1_r(); + state |= elem->ef1_r(); } return state; @@ -252,9 +252,9 @@ int vp575_device::vip_ef3_r() { int state = CLEAR_LINE; - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - state |= m_expansion_slot[i]->ef3_r(); + state |= elem->ef3_r(); } return state; @@ -269,9 +269,9 @@ int vp575_device::vip_ef4_r() { int state = CLEAR_LINE; - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - state |= m_expansion_slot[i]->ef4_r(); + state |= elem->ef4_r(); } return state; @@ -284,9 +284,9 @@ int vp575_device::vip_ef4_r() void vp575_device::vip_sc_w(int data) { - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - m_expansion_slot[i]->sc_w(data); + elem->sc_w(data); } } @@ -297,9 +297,9 @@ void vp575_device::vip_sc_w(int data) void vp575_device::vip_q_w(int state) { - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - m_expansion_slot[i]->q_w(state); + elem->q_w(state); } } @@ -310,8 +310,8 @@ void vp575_device::vip_q_w(int state) void vp575_device::vip_run_w(int state) { - for (int i = 0; i < MAX_SLOTS; i++) + for (auto & elem : m_expansion_slot) { - m_expansion_slot[i]->run_w(state); + elem->run_w(state); } } diff --git a/src/devices/bus/wswan/slot.cpp b/src/devices/bus/wswan/slot.cpp index 7547be9357d..749f82596e1 100644 --- a/src/devices/bus/wswan/slot.cpp +++ b/src/devices/bus/wswan/slot.cpp @@ -135,10 +135,10 @@ static const ws_slot slot_list[] = static int ws_get_pcb_id(const char *slot) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (!core_stricmp(slot_list[i].slot_option, slot)) - return slot_list[i].pcb_id; + if (!core_stricmp(elem.slot_option, slot)) + return elem.pcb_id; } return 0; @@ -146,10 +146,10 @@ static int ws_get_pcb_id(const char *slot) static const char *ws_get_slot(int type) { - for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + for (auto & elem : slot_list) { - if (slot_list[i].pcb_id == type) - return slot_list[i].slot_option; + if (elem.pcb_id == type) + return elem.slot_option; } return "std"; diff --git a/src/devices/cpu/arcompact/arcompact.cpp b/src/devices/cpu/arcompact/arcompact.cpp index dca1bf9fd91..7c56a774601 100644 --- a/src/devices/cpu/arcompact/arcompact.cpp +++ b/src/devices/cpu/arcompact/arcompact.cpp @@ -175,8 +175,8 @@ void arcompact_device::device_reset() m_delayactive = 0; m_delayjump = 0x00000000; - for (int i = 0; i < 0x40; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; m_status32 = 0; m_LP_START = 0; diff --git a/src/devices/cpu/arm/arm.cpp b/src/devices/cpu/arm/arm.cpp index b8025a438b9..aa07ddcfecb 100644 --- a/src/devices/cpu/arm/arm.cpp +++ b/src/devices/cpu/arm/arm.cpp @@ -318,13 +318,13 @@ void arm_cpu_device::SetModeRegister( int mode, int rIndex, UINT32 value ) void arm_cpu_device::device_reset() { - for ( int i = 0; i < 27; i++ ) + for (auto & elem : m_sArmRegister) { - m_sArmRegister[i] = 0; + elem = 0; } - for ( int i = 0; i < 16; i++ ) + for (auto & elem : m_coproRegister) { - m_coproRegister[i] = 0; + elem = 0; } m_pendingIrq = 0; m_pendingFiq = 0; diff --git a/src/devices/cpu/avr8/avr8.cpp b/src/devices/cpu/avr8/avr8.cpp index ebc61fec9ae..7ebafca65a1 100644 --- a/src/devices/cpu/avr8/avr8.cpp +++ b/src/devices/cpu/avr8/avr8.cpp @@ -855,9 +855,9 @@ void avr8_device::device_reset() logerror("AVR Boot loader section size: %d words\n", m_boot_size); } - for (int i = 0; i < 0x200; i++) + for (auto & elem : m_r) { - m_r[i] = 0; + elem = 0; } m_spi_active = false; diff --git a/src/devices/cpu/cosmac/cosmac.cpp b/src/devices/cpu/cosmac/cosmac.cpp index a868e604e9f..73170762cbf 100644 --- a/src/devices/cpu/cosmac/cosmac.cpp +++ b/src/devices/cpu/cosmac/cosmac.cpp @@ -292,8 +292,8 @@ cosmac_device::cosmac_device(const machine_config &mconfig, device_type type, co m_io(nullptr), m_direct(nullptr) { - for (int i = 0; i < 4; i++) - m_ef[i] = CLEAR_LINE; + for (auto & elem : m_ef) + elem = CLEAR_LINE; } diff --git a/src/devices/cpu/drcbex64.cpp b/src/devices/cpu/drcbex64.cpp index 38cb9fbcc25..b14e4cd189d 100644 --- a/src/devices/cpu/drcbex64.cpp +++ b/src/devices/cpu/drcbex64.cpp @@ -648,8 +648,8 @@ drcbe_x64::drcbe_x64(drcuml_state &drcuml, device_t &device, drc_cache &cache, U } // build the opcode table (static but it doesn't hurt to regenerate it) - for (int opnum = 0; opnum < ARRAY_LENGTH(s_opcode_table_source); opnum++) - s_opcode_table[s_opcode_table_source[opnum].opcode] = s_opcode_table_source[opnum].func; + for (auto & elem : s_opcode_table_source) + s_opcode_table[elem.opcode] = elem.func; // create the log if (device.machine().options().drc_log_native()) diff --git a/src/devices/cpu/drcbex86.cpp b/src/devices/cpu/drcbex86.cpp index e1f2b1830cb..846d054bf14 100644 --- a/src/devices/cpu/drcbex86.cpp +++ b/src/devices/cpu/drcbex86.cpp @@ -562,8 +562,8 @@ drcbe_x86::drcbe_x86(drcuml_state &drcuml, device_t &device, drc_cache &cache, U } // build the opcode table (static but it doesn't hurt to regenerate it) - for (int opnum = 0; opnum < ARRAY_LENGTH(s_opcode_table_source); opnum++) - s_opcode_table[s_opcode_table_source[opnum].opcode] = s_opcode_table_source[opnum].func; + for (auto & elem : s_opcode_table_source) + s_opcode_table[elem.opcode] = elem.func; // create the log if (device.machine().options().drc_log_native()) diff --git a/src/devices/cpu/h6280/h6280.cpp b/src/devices/cpu/h6280/h6280.cpp index f92e0520a12..d1be228e732 100644 --- a/src/devices/cpu/h6280/h6280.cpp +++ b/src/devices/cpu/h6280/h6280.cpp @@ -263,9 +263,9 @@ void h6280_device::device_start() m_icount = 0; /* clear pending interrupts */ - for (int i = 0; i < 3; i++) + for (auto & elem : m_irq_state) { - m_irq_state[i] = CLEAR_LINE; + elem = CLEAR_LINE; } m_nmi_state = CLEAR_LINE; } diff --git a/src/devices/cpu/h8/h8_timer8.cpp b/src/devices/cpu/h8/h8_timer8.cpp index dcb21adeb31..29e156edfee 100644 --- a/src/devices/cpu/h8/h8_timer8.cpp +++ b/src/devices/cpu/h8/h8_timer8.cpp @@ -278,16 +278,16 @@ void h8_timer8_channel_device::recalc_event(UINT64 cur_time) event_delay = counter_cycle; } - for(int i=0; i<2; i++) { + for(auto & elem : tcor) { UINT32 new_delay = 0xffffffff; - if(tcor[i] > tcnt) { - if(tcnt >= counter_cycle || tcor[i] <= counter_cycle) - new_delay = tcor[i] - tcnt; - } else if(tcor[i] <= counter_cycle) { + if(elem > tcnt) { + if(tcnt >= counter_cycle || elem <= counter_cycle) + new_delay = elem - tcnt; + } else if(elem <= counter_cycle) { if(tcnt < counter_cycle) - new_delay = (counter_cycle - tcnt) + tcor[i]; + new_delay = (counter_cycle - tcnt) + elem; else - new_delay = (0x100 - tcnt) + tcor[i]; + new_delay = (0x100 - tcnt) + elem; } if(event_delay > new_delay) event_delay = new_delay; diff --git a/src/devices/cpu/hcd62121/hcd62121.cpp b/src/devices/cpu/hcd62121/hcd62121.cpp index 4371edc8407..692297048c0 100644 --- a/src/devices/cpu/hcd62121/hcd62121.cpp +++ b/src/devices/cpu/hcd62121/hcd62121.cpp @@ -493,9 +493,9 @@ void hcd62121_cpu_device::device_reset() m_f = 0; m_dsize = 0; - for( int i = 0; i < 0x80; i++ ) + for(auto & elem : m_reg) { - m_reg[i] = 0; + elem = 0; } } diff --git a/src/devices/cpu/hd61700/hd61700.cpp b/src/devices/cpu/hd61700/hd61700.cpp index 30cf3f6a425..777a23de894 100644 --- a/src/devices/cpu/hd61700/hd61700.cpp +++ b/src/devices/cpu/hd61700/hd61700.cpp @@ -215,8 +215,8 @@ void hd61700_cpu_device::device_reset() memset(m_reg16bit, 0, sizeof(m_reg16bit)); memset(m_regmain, 0, sizeof(m_regmain)); - for (int i=0;i<6; i++) - m_lines_status[i] = CLEAR_LINE; + for (auto & elem : m_lines_status) + elem = CLEAR_LINE; } diff --git a/src/devices/cpu/i8089/i8089_channel.cpp b/src/devices/cpu/i8089/i8089_channel.cpp index 63e4262abf2..932d59ff229 100644 --- a/src/devices/cpu/i8089/i8089_channel.cpp +++ b/src/devices/cpu/i8089/i8089_channel.cpp @@ -96,10 +96,10 @@ void i8089_channel::device_reset() m_xfer_pending = false; // initialize registers - for (int i = 0; i < ARRAY_LENGTH(m_r); i++) + for (auto & elem : m_r) { - m_r[i].w = 0; - m_r[i].t = 0; + elem.w = 0; + elem.t = 0; } m_prio = PRIO_IDLE; } diff --git a/src/devices/cpu/i86/i186.cpp b/src/devices/cpu/i86/i186.cpp index 1cb501cbaaf..7d30f5b9771 100644 --- a/src/devices/cpu/i86/i186.cpp +++ b/src/devices/cpu/i86/i186.cpp @@ -636,19 +636,19 @@ void i80186_cpu_device::device_reset() m_intr.ext_state = 0x00; m_reloc = 0x20ff; - for (int i = 0; i < ARRAY_LENGTH(m_dma); i++) + for (auto & elem : m_dma) { - m_dma[i].drq_state = false; - m_dma[i].control = 0; + elem.drq_state = false; + elem.control = 0; } - for (int i = 0; i < ARRAY_LENGTH(m_timer); i++) + for (auto & elem : m_timer) { - m_timer[i].control = 0; - m_timer[i].maxA = 0; - m_timer[i].maxB = 0; - m_timer[i].active_count = false; - m_timer[i].count = 0; + elem.control = 0; + elem.maxA = 0; + elem.maxB = 0; + elem.active_count = false; + elem.count = 0; } } diff --git a/src/devices/cpu/m6502/m3745x.cpp b/src/devices/cpu/m6502/m3745x.cpp index 46cfdf37fba..a7f40fa7ada 100644 --- a/src/devices/cpu/m6502/m3745x.cpp +++ b/src/devices/cpu/m6502/m3745x.cpp @@ -123,9 +123,9 @@ void m3745x_device::device_reset() SP = 0x01ff; // we have the "traditional" stack in page 1, not 0 like some M740 derivatives - for (int i = 0; i < NUM_TIMERS; i++) + for (auto & elem : m_timers) { - m_timers[i]->adjust(attotime::never); + elem->adjust(attotime::never); } // all ports reset to input on startup diff --git a/src/devices/cpu/m68000/m68kcpu.cpp b/src/devices/cpu/m68000/m68kcpu.cpp index 42b59863abb..a8f52a6cdcd 100644 --- a/src/devices/cpu/m68000/m68kcpu.cpp +++ b/src/devices/cpu/m68000/m68kcpu.cpp @@ -2335,12 +2335,12 @@ void m68000_base_device::clear_all() { cpu_type= 0; // dasm_type= 0; - for (int i=0;i<16;i++) - dar[i]= 0; + for (auto & elem : dar) + elem= 0; ppc= 0; pc= 0; - for (int i=0;i<7;i++) - sp[i]= 0; + for (auto & elem : sp) + elem= 0; vbr= 0; sfc= 0; dfc= 0; diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp index cfd4c334d00..0fc5d9449be 100644 --- a/src/devices/cpu/mcs51/mcs51.cpp +++ b/src/devices/cpu/mcs51/mcs51.cpp @@ -279,8 +279,8 @@ mcs51_cpu_device::mcs51_cpu_device(const machine_config &mconfig, device_type ty /* default to standard cmos interfacing */ - for (int i=0; i < ARRAY_LENGTH(m_forced_inputs); i++) - m_forced_inputs[i] = 0; + for (auto & elem : m_forced_inputs) + elem = 0; } diff --git a/src/devices/cpu/pdp1/pdp1.cpp b/src/devices/cpu/pdp1/pdp1.cpp index 97ac5e703f5..b36e7242967 100644 --- a/src/devices/cpu/pdp1/pdp1.cpp +++ b/src/devices/cpu/pdp1/pdp1.cpp @@ -404,9 +404,9 @@ void pdp1_device::device_config_complete() hw_mul_div = 0; type_20_sbs = 0; - for (int i = 0; i < 64; i++) + for (auto & elem : extern_iot) { - memset(&extern_iot[i], 0, sizeof(extern_iot[i])); + memset(&elem, 0, sizeof(elem)); } } } diff --git a/src/devices/cpu/pdp1/tx0.cpp b/src/devices/cpu/pdp1/tx0.cpp index c0ad2e9de3c..3a4fd7f1fb1 100644 --- a/src/devices/cpu/pdp1/tx0.cpp +++ b/src/devices/cpu/pdp1/tx0.cpp @@ -116,9 +116,9 @@ void tx0_device::device_start() m_pf = 0; m_tbr = 0; m_tac = 0; - for ( int i = 0; i < 16; i++ ) + for (auto & elem : m_tss) { - m_tss[i] = 0; + elem = 0; } m_cm_sel = 0; m_lr_sel = 0; diff --git a/src/devices/cpu/rsp/rspcp2.cpp b/src/devices/cpu/rsp/rspcp2.cpp index ab6afed4cbc..fe6d3b243e8 100644 --- a/src/devices/cpu/rsp/rspcp2.cpp +++ b/src/devices/cpu/rsp/rspcp2.cpp @@ -725,10 +725,10 @@ void rsp_cop2::init() void rsp_cop2::start() { - for(int regIdx = 0; regIdx < 32; regIdx++ ) + for(auto & elem : m_v) { - m_v[regIdx].d[0] = 0; - m_v[regIdx].d[1] = 0; + elem.d[0] = 0; + elem.d[1] = 0; } CLEAR_CARRY_FLAGS(); @@ -740,9 +740,9 @@ void rsp_cop2::start() m_reciprocal_high = 0; // Accumulators do not power on to a random state - for(int accumIdx = 0; accumIdx < 8; accumIdx++ ) + for(auto & elem : m_accum) { - m_accum[accumIdx].q = 0; + elem.q = 0; } } diff --git a/src/devices/cpu/se3208/se3208.cpp b/src/devices/cpu/se3208/se3208.cpp index 36a26cd603b..b37a8e09f5f 100644 --- a/src/devices/cpu/se3208/se3208.cpp +++ b/src/devices/cpu/se3208/se3208.cpp @@ -1715,9 +1715,9 @@ void se3208_device::BuildTable(void) void se3208_device::device_reset() { - for ( int i = 0; i < 8; i++ ) + for (auto & elem : m_R) { - m_R[i] = 0; + elem = 0; } m_SP = 0; m_ER = 0; diff --git a/src/devices/cpu/sh2/sh2drc.cpp b/src/devices/cpu/sh2/sh2drc.cpp index edf02fe421d..6f112eb0db5 100644 --- a/src/devices/cpu/sh2/sh2drc.cpp +++ b/src/devices/cpu/sh2/sh2drc.cpp @@ -935,20 +935,20 @@ void sh2_device::static_generate_memory_accessor(int size, int iswrite, const ch UML_LABEL(block, label++); // label: - for (int ramnum = 0; ramnum < SH2_MAX_FASTRAM; ramnum++) + for (auto & elem : m_fastram) { - if (m_fastram[ramnum].base != nullptr && (!iswrite || !m_fastram[ramnum].readonly)) + if (elem.base != nullptr && (!iswrite || !elem.readonly)) { - void *fastbase = (UINT8 *)m_fastram[ramnum].base - m_fastram[ramnum].start; + void *fastbase = (UINT8 *)elem.base - elem.start; UINT32 skip = label++; - if (m_fastram[ramnum].end != 0xffffffff) + if (elem.end != 0xffffffff) { - UML_CMP(block, I0, m_fastram[ramnum].end); // cmp i0,end + UML_CMP(block, I0, elem.end); // cmp i0,end UML_JMPc(block, COND_A, skip); // ja skip } - if (m_fastram[ramnum].start != 0x00000000) + if (elem.start != 0x00000000) { - UML_CMP(block, I0, m_fastram[ramnum].start);// cmp i0,fastram_start + UML_CMP(block, I0, elem.start);// cmp i0,fastram_start UML_JMPc(block, COND_B, skip); // jb skip } diff --git a/src/devices/cpu/sharc/sharc.cpp b/src/devices/cpu/sharc/sharc.cpp index 702f36ebe4c..bee241441ca 100644 --- a/src/devices/cpu/sharc/sharc.cpp +++ b/src/devices/cpu/sharc/sharc.cpp @@ -326,19 +326,19 @@ void adsp21062_device::device_start() m_delayed_iop_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(adsp21062_device::sharc_iop_delayed_write_callback), this)); - for (int i=0; i < 12; i++) + for (auto & elem : m_dma_op) { - m_dma_op[i].src = 0; - m_dma_op[i].dst = 0; - m_dma_op[i].chain_ptr = 0; - m_dma_op[i].src_modifier = 0; - m_dma_op[i].dst_modifier = 0; - m_dma_op[i].src_count = 0; - m_dma_op[i].dst_count = 0; - m_dma_op[i].pmode = 0; - m_dma_op[i].chained_direction = 0; - m_dma_op[i].active = false; - m_dma_op[i].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(adsp21062_device::sharc_dma_callback), this)); + elem.src = 0; + elem.dst = 0; + elem.chain_ptr = 0; + elem.src_modifier = 0; + elem.dst_modifier = 0; + elem.src_count = 0; + elem.dst_count = 0; + elem.pmode = 0; + elem.chained_direction = 0; + elem.active = false; + elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(adsp21062_device::sharc_dma_callback), this)); } for (int i=0; i < 16; i++) @@ -348,9 +348,9 @@ void adsp21062_device::device_start() } m_mrf = 0; m_mrb = 0; - for (int i=0; i < 32; i++) + for (auto & elem : m_pcstack) { - m_pcstack[i] = 0; + elem = 0; } for (int i=0; i < 6; i++) { @@ -368,17 +368,17 @@ void adsp21062_device::device_start() m_dag1_alt.i[i] = m_dag1_alt.m[i] = m_dag1_alt.b[i] = m_dag1_alt.l[i] = 0; m_dag2_alt.i[i] = m_dag2_alt.m[i] = m_dag2_alt.b[i] = m_dag2_alt.l[i] = 0; } - for (int i=0; i < 12; i++) + for (auto & elem : m_dma) { - m_dma[i].control = 0; - m_dma[i].int_index = 0; - m_dma[i].int_modifier = 0; - m_dma[i].int_count = 0; - m_dma[i].chain_ptr = 0; - m_dma[i].gen_purpose = 0; - m_dma[i].ext_index = 0; - m_dma[i].ext_modifier = 0; - m_dma[i].ext_count = 0; + elem.control = 0; + elem.int_index = 0; + elem.int_modifier = 0; + elem.int_count = 0; + elem.chain_ptr = 0; + elem.gen_purpose = 0; + elem.ext_index = 0; + elem.ext_modifier = 0; + elem.ext_count = 0; } m_mode1 = 0; m_mode2 = 0; @@ -391,10 +391,10 @@ void adsp21062_device::device_start() m_flag[0] = m_flag[1] = m_flag[2] = m_flag[3] = 0; m_syscon = 0; m_sysstat = 0; - for (int i=0; i < 5; i++) + for (auto & elem : m_status_stack) { - m_status_stack[i].mode1 = 0; - m_status_stack[i].astat = 0; + elem.mode1 = 0; + elem.astat = 0; } m_status_stkp = 0; m_px = 0; diff --git a/src/devices/cpu/sm8500/sm8500.cpp b/src/devices/cpu/sm8500/sm8500.cpp index 13b32447714..11fc61132fc 100644 --- a/src/devices/cpu/sm8500/sm8500.cpp +++ b/src/devices/cpu/sm8500/sm8500.cpp @@ -198,9 +198,9 @@ void sm8500_cpu_device::state_string_export(const device_state_entry &entry, std void sm8500_cpu_device::device_reset() { - for ( int i = 0; i < 0x108; i++ ) + for (auto & elem : m_register_ram) { - m_register_ram[i] = 0; + elem = 0; } m_PC = 0x1020; diff --git a/src/devices/cpu/ssp1601/ssp1601.cpp b/src/devices/cpu/ssp1601/ssp1601.cpp index 0f44256945e..945eb7d4499 100644 --- a/src/devices/cpu/ssp1601/ssp1601.cpp +++ b/src/devices/cpu/ssp1601/ssp1601.cpp @@ -504,9 +504,9 @@ void ssp1601_device::device_start() m_r[i] = 0; } memset( m_RAM, 0, sizeof(m_RAM)); - for ( int i = 0; i < 6; i++ ) + for (auto & elem : m_stack) { - m_stack[i] = 0; + elem = 0; } m_ppc.d = 0; m_g_cycles = 0; diff --git a/src/devices/cpu/superfx/superfx.cpp b/src/devices/cpu/superfx/superfx.cpp index ecdae33a1b0..eb5f04278d3 100644 --- a/src/devices/cpu/superfx/superfx.cpp +++ b/src/devices/cpu/superfx/superfx.cpp @@ -573,9 +573,9 @@ void superfx_device::add_clocks(INT32 clocks) void superfx_device::device_start() { - for(int i = 0; i < 16; i++) + for(auto & elem : m_r) { - m_r[i] = 0; + elem = 0; } m_sfr = 0; diff --git a/src/devices/cpu/upd7725/upd7725.cpp b/src/devices/cpu/upd7725/upd7725.cpp index 3d26780ae2e..5820d6fe4e0 100644 --- a/src/devices/cpu/upd7725/upd7725.cpp +++ b/src/devices/cpu/upd7725/upd7725.cpp @@ -139,9 +139,9 @@ void necdsp_device::device_start() void necdsp_device::device_reset() { - for (unsigned i = 0; i < 2048; i++) + for (auto & elem : dataRAM) { - dataRAM[i] = 0x0000; + elem = 0x0000; } regs.pc = 0x0000; diff --git a/src/devices/cpu/z8/z8.cpp b/src/devices/cpu/z8/z8.cpp index 7db38eaf500..3d8c6746c5b 100644 --- a/src/devices/cpu/z8/z8.cpp +++ b/src/devices/cpu/z8/z8.cpp @@ -693,17 +693,17 @@ void z8_device::device_start() m_t1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z8_device::t1_tick), this)); /* Clear state */ - for ( int i = 0; i < 6; i++ ) - m_irq[i] = 0; - for ( int i = 0; i < 256; i++ ) - m_r[i] = 0; + for (auto & elem : m_irq) + elem = 0; + for (auto & elem : m_r) + elem = 0; for ( int i = 0; i < 4; i++ ) { m_input[i] = 0; m_output[i] = 0; } - for ( int i = 0; i < 16; i++ ) - m_fake_r[i] = 0; + for (auto & elem : m_fake_r) + elem = 0; m_fake_sp = 0; m_t0 = 0; m_t1 = 0; diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index 319e000e626..786a44e2916 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -1171,7 +1171,7 @@ void floppy_sound_device::device_start() m_samplesize_motor_start = 0; m_samplesize_motor_loop = 0; m_samplesize_motor_end = 0; - for (int i = 0; i < MAX_STEP_SAMPLES; ++i) m_samplesize_step[i] = 0; + for (auto & elem : m_samplesize_step) elem = 0; // Read audio samples. The samples are stored in the list m_samples. m_loaded = load_samples(); diff --git a/src/devices/machine/53c810.cpp b/src/devices/machine/53c810.cpp index e11dbae70a3..1323e822d69 100644 --- a/src/devices/machine/53c810.cpp +++ b/src/devices/machine/53c810.cpp @@ -634,9 +634,9 @@ void lsi53c810_device::device_start() m_dma_cb.bind_relative_to(*owner()); m_fetch_cb.bind_relative_to(*owner()); - for (int i = 0; i < 256; i++) + for (auto & elem : dma_opcode) { - dma_opcode[i] = opcode_handler_delegate(FUNC(lsi53c810_device::dmaop_invalid), this); + elem = opcode_handler_delegate(FUNC(lsi53c810_device::dmaop_invalid), this); } add_opcode(0x00, 0xc0, opcode_handler_delegate(FUNC( lsi53c810_device::dmaop_block_move ), this)); diff --git a/src/devices/machine/6525tpi.cpp b/src/devices/machine/6525tpi.cpp index 038440e29d3..8d5a43a2b35 100644 --- a/src/devices/machine/6525tpi.cpp +++ b/src/devices/machine/6525tpi.cpp @@ -132,9 +132,9 @@ tpi6525_device::tpi6525_device(const machine_config &mconfig, const char *tag, d m_cr(0), m_air(0) { - for (int i = 0; i < 5; i++) + for (auto & elem : m_irq_level) { - m_irq_level[i] = 0; + elem = 0; } } diff --git a/src/devices/machine/68307tmu.cpp b/src/devices/machine/68307tmu.cpp index 21f709c3b00..6f5c33687cd 100644 --- a/src/devices/machine/68307tmu.cpp +++ b/src/devices/machine/68307tmu.cpp @@ -223,9 +223,9 @@ void m68307_timer::write_trr(UINT16 data, UINT16 mem_mask, int which) void m68307_timer::reset(void) { - for (int i=0;i<2;i++) + for (auto & elem : singletimer) { - m68307_single_timer* tptr = &singletimer[i]; + m68307_single_timer* tptr = &elem; tptr->regs[m68307TIMER_TMR] = 0x0000; tptr->regs[m68307TIMER_TRR] = 0xffff; diff --git a/src/devices/machine/6840ptm.cpp b/src/devices/machine/6840ptm.cpp index 239498f681c..bbf9a57ce18 100644 --- a/src/devices/machine/6840ptm.cpp +++ b/src/devices/machine/6840ptm.cpp @@ -92,19 +92,19 @@ void ptm6840_device::device_start() m_out2_cb.resolve_safe(); m_irq_cb.resolve_safe(); - for (int i = 0; i < 3; i++) + for (auto & elem : m_external_clock) { - if ( m_external_clock[i] == 0 ) - m_external_clock[i] = 1; + if ( elem == 0 ) + elem = 1; } m_timer[0] = timer_alloc(0); m_timer[1] = timer_alloc(1); m_timer[2] = timer_alloc(2); - for (int i = 0; i < 3; i++) + for (auto & elem : m_timer) { - m_timer[i]->enable(false); + elem->enable(false); } // register for state saving diff --git a/src/devices/machine/74148.cpp b/src/devices/machine/74148.cpp index 02d1be3927a..71520535f63 100644 --- a/src/devices/machine/74148.cpp +++ b/src/devices/machine/74148.cpp @@ -56,8 +56,8 @@ ttl74148_device::ttl74148_device(const machine_config &mconfig, const char *tag, m_last_output_valid(0), m_last_enable_output(0) { - for (int i = 0; i < 8; i++) - m_input_lines[i] = 0; + for (auto & elem : m_input_lines) + elem = 0; } //------------------------------------------------- diff --git a/src/devices/machine/74153.cpp b/src/devices/machine/74153.cpp index e38194f5d6e..d5b8ad37634 100644 --- a/src/devices/machine/74153.cpp +++ b/src/devices/machine/74153.cpp @@ -55,14 +55,14 @@ ttl74153_device::ttl74153_device(const machine_config &mconfig, const char *tag, m_input_lines[1][2] = 0; m_input_lines[1][3] = 0; - for (int i = 0; i < 2; i++) - m_enable[i] = 0; + for (auto & elem : m_enable) + elem = 0; - for (int i = 0; i < 2; i++) - m_output[i] = 0; + for (auto & elem : m_output) + elem = 0; - for (int i = 0; i < 2; i++) - m_last_output[i] = 0; + for (auto & elem : m_last_output) + elem = 0; } //------------------------------------------------- diff --git a/src/devices/machine/am9517a.cpp b/src/devices/machine/am9517a.cpp index 734d542e37d..7f2ecb7e37f 100644 --- a/src/devices/machine/am9517a.cpp +++ b/src/devices/machine/am9517a.cpp @@ -557,13 +557,13 @@ void am9517a_device::device_start() m_out_dack_2_cb.resolve_safe(); m_out_dack_3_cb.resolve_safe(); - for (int i = 0; i < 4; i++) + for (auto & elem : m_channel) { - m_channel[i].m_address = 0; - m_channel[i].m_count = 0; - m_channel[i].m_base_address = 0; - m_channel[i].m_base_count = 0; - m_channel[i].m_mode = 0; + elem.m_address = 0; + elem.m_count = 0; + elem.m_base_address = 0; + elem.m_base_count = 0; + elem.m_mode = 0; } // state saving diff --git a/src/devices/machine/ataintf.cpp b/src/devices/machine/ataintf.cpp index 59b1d6ddebf..b9c51351e71 100644 --- a/src/devices/machine/ataintf.cpp +++ b/src/devices/machine/ataintf.cpp @@ -125,9 +125,9 @@ WRITE_LINE_MEMBER( ata_interface_device::pdiag1_write_line ) UINT16 ata_interface_device::read_dma() { UINT16 result = 0xffff; - for (int i = 0; i < 2; i++) - if (m_slot[i]->dev() != nullptr) - result &= m_slot[i]->dev()->read_dma(); + for (auto & elem : m_slot) + if (elem->dev() != nullptr) + result &= elem->dev()->read_dma(); // printf( "%s: read_dma %04x\n", machine().describe_context(), result ); return result; @@ -136,9 +136,9 @@ UINT16 ata_interface_device::read_dma() READ16_MEMBER( ata_interface_device::read_cs0 ) { UINT16 result = mem_mask; - for (int i = 0; i < 2; i++) - if (m_slot[i]->dev() != nullptr) - result &= m_slot[i]->dev()->read_cs0(space, offset, mem_mask); + for (auto & elem : m_slot) + if (elem->dev() != nullptr) + result &= elem->dev()->read_cs0(space, offset, mem_mask); // { static int last_status = -1; if (offset == 7 ) { if( result == last_status ) return last_status; last_status = result; } else last_status = -1; } @@ -150,9 +150,9 @@ READ16_MEMBER( ata_interface_device::read_cs0 ) READ16_MEMBER( ata_interface_device::read_cs1 ) { UINT16 result = mem_mask; - for (int i = 0; i < 2; i++) - if (m_slot[i]->dev() != nullptr) - result &= m_slot[i]->dev()->read_cs1(space, offset, mem_mask); + for (auto & elem : m_slot) + if (elem->dev() != nullptr) + result &= elem->dev()->read_cs1(space, offset, mem_mask); // printf( "%s: read cs1 %04x %04x %04x\n", machine().describe_context(), offset, result, mem_mask ); @@ -170,36 +170,36 @@ void ata_interface_device::write_dma( UINT16 data ) { // printf( "%s: write_dma %04x\n", machine().describe_context(), data ); - for (int i = 0; i < 2; i++) - if (m_slot[i]->dev() != nullptr) - m_slot[i]->dev()->write_dma(data); + for (auto & elem : m_slot) + if (elem->dev() != nullptr) + elem->dev()->write_dma(data); } WRITE16_MEMBER( ata_interface_device::write_cs0 ) { // printf( "%s: write cs0 %04x %04x %04x\n", machine().describe_context(), offset, data, mem_mask ); - for (int i = 0; i < 2; i++) - if (m_slot[i]->dev() != nullptr) - m_slot[i]->dev()->write_cs0(space, offset, data, mem_mask); + for (auto & elem : m_slot) + if (elem->dev() != nullptr) + elem->dev()->write_cs0(space, offset, data, mem_mask); } WRITE16_MEMBER( ata_interface_device::write_cs1 ) { // printf( "%s: write cs1 %04x %04x %04x\n", machine().describe_context(), offset, data, mem_mask ); - for (int i = 0; i < 2; i++) - if (m_slot[i]->dev() != nullptr) - m_slot[i]->dev()->write_cs1(space, offset, data, mem_mask); + for (auto & elem : m_slot) + if (elem->dev() != nullptr) + elem->dev()->write_cs1(space, offset, data, mem_mask); } WRITE_LINE_MEMBER( ata_interface_device::write_dmack ) { // printf( "%s: write_dmack %04x\n", machine().describe_context(), state ); - for (int i = 0; i < 2; i++) - if (m_slot[i]->dev() != nullptr) - m_slot[i]->dev()->write_dmack(state); + for (auto & elem : m_slot) + if (elem->dev() != nullptr) + elem->dev()->write_dmack(state); } SLOT_INTERFACE_START(ata_devices) diff --git a/src/devices/machine/ay31015.cpp b/src/devices/machine/ay31015.cpp index 08b136043ad..f1db92a19d8 100644 --- a/src/devices/machine/ay31015.cpp +++ b/src/devices/machine/ay31015.cpp @@ -121,8 +121,8 @@ ay31015_device::ay31015_device(const machine_config &mconfig, device_type type, m_write_so_cb(*this), m_status_changed_cb(*this) { - for (int i = 0; i < 41; i++) - m_pins[i] = 0; + for (auto & elem : m_pins) + elem = 0; } ay31015_device::ay31015_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -149,8 +149,8 @@ ay31015_device::ay31015_device(const machine_config &mconfig, const char *tag, d m_write_so_cb(*this), m_status_changed_cb(*this) { - for (int i = 0; i < 41; i++) - m_pins[i] = 0; + for (auto & elem : m_pins) + elem = 0; } ay51013_device::ay51013_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) diff --git a/src/devices/machine/ds1302.cpp b/src/devices/machine/ds1302.cpp index c254690cae0..c2cd23b560f 100644 --- a/src/devices/machine/ds1302.cpp +++ b/src/devices/machine/ds1302.cpp @@ -90,8 +90,8 @@ void ds1302_device::device_start() m_clock_timer = timer_alloc(); m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); - for (int i = 0; i < 9; i++) - m_reg[i] = 0; + for (auto & elem : m_reg) + elem = 0; // state saving save_item(NAME(m_ce)); diff --git a/src/devices/machine/ds2404.cpp b/src/devices/machine/ds2404.cpp index 9ba913c7250..68082389cee 100644 --- a/src/devices/machine/ds2404.cpp +++ b/src/devices/machine/ds2404.cpp @@ -99,8 +99,8 @@ void ds2404_device::device_start() m_rtc[3] = (current_time >> 16) & 0xff; m_rtc[4] = (current_time >> 24) & 0xff; - for (int i = 0; i < 8; i++) - m_state[i] = DS2404_STATE_IDLE; + for (auto & elem : m_state) + elem = DS2404_STATE_IDLE; m_tick_timer = timer_alloc(0); m_tick_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); @@ -353,10 +353,10 @@ void ds2404_device::device_timer(emu_timer &timer, device_timer_id id, int param case 0: { // tick - for(int i = 0; i < 5; i++) + for(auto & elem : m_rtc) { - m_rtc[ i ]++; - if(m_rtc[ i ] != 0) + elem++; + if(elem != 0) { break; } diff --git a/src/devices/machine/hdc92x4.cpp b/src/devices/machine/hdc92x4.cpp index 685ee90015f..f433a7a2edd 100644 --- a/src/devices/machine/hdc92x4.cpp +++ b/src/devices/machine/hdc92x4.cpp @@ -2721,8 +2721,8 @@ void hdc92x4_device::live_run_until(attotime limit) m_out_dip(ASSERT_LINE); // Write the header via DMA - for (int slot = 0; slot < 6; slot++) - m_out_dma(0, m_register_r[id_field[slot]], 0xff); + for (auto & elem : id_field) + m_out_dma(0, m_register_r[elem], 0xff); m_out_dip(CLEAR_LINE); m_out_dmarq(CLEAR_LINE); @@ -3296,8 +3296,8 @@ void hdc92x4_device::live_run_hd_until(attotime limit) m_out_dip(ASSERT_LINE); // Write the header via DMA - for (int slot = 0; slot < 6; slot++) - m_out_dma(0, m_register_r[id_field[slot]], 0xff); + for (auto & elem : id_field) + m_out_dma(0, m_register_r[elem], 0xff); // Continue with reading the sector data m_live_state.state = SEARCH_DAM; diff --git a/src/devices/machine/i8257.cpp b/src/devices/machine/i8257.cpp index 23abcc3915c..a54d21697cc 100644 --- a/src/devices/machine/i8257.cpp +++ b/src/devices/machine/i8257.cpp @@ -364,11 +364,11 @@ void i8257_device::device_reset() m_hreq = -1; m_tc = 0; - for (int i = 0; i < 4; i++) + for (auto & elem : m_channel) { - m_channel[i].m_address = 0; - m_channel[i].m_count = 0; - m_channel[i].m_mode = 0; + elem.m_address = 0; + elem.m_count = 0; + elem.m_mode = 0; } set_hreq(0); set_dack(); @@ -390,11 +390,11 @@ bool i8257_device::next_channel() } } - for (int channel = 0; channel < 4; channel++) + for (auto & elem : priority) { - if (is_request_active(priority[channel])) + if (is_request_active(elem)) { - m_current_channel = m_last_channel = priority[channel]; + m_current_channel = m_last_channel = elem; return true; } } diff --git a/src/devices/machine/i8271.cpp b/src/devices/machine/i8271.cpp index a0bcfd01ff9..3d1d602dd74 100644 --- a/src/devices/machine/i8271.cpp +++ b/src/devices/machine/i8271.cpp @@ -119,10 +119,10 @@ bool i8271_device::get_ready(int fid) void i8271_device::set_floppy(floppy_image_device *flop) { - for(int fid=0; fid<2; fid++) { - if(flopi[fid].dev) - flopi[fid].dev->setup_index_pulse_cb(floppy_image_device::index_pulse_cb()); - flopi[fid].dev = flop; + for(auto & elem : flopi) { + if(elem.dev) + elem.dev->setup_index_pulse_cb(floppy_image_device::index_pulse_cb()); + elem.dev = flop; } if(flop) flop->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(FUNC(i8271_device::index_callback), this)); @@ -1540,8 +1540,8 @@ void i8271_device::device_timer(emu_timer &timer, device_timer_id id, int param, void i8271_device::index_callback(floppy_image_device *floppy, int state) { - for(int fid=0; fid<2; fid++) { - floppy_info &fi = flopi[fid]; + for(auto & fi : flopi) { + if(fi.dev != floppy) continue; diff --git a/src/devices/machine/kb3600.cpp b/src/devices/machine/kb3600.cpp index f83ba9c46d8..ca5fb5e7e76 100644 --- a/src/devices/machine/kb3600.cpp +++ b/src/devices/machine/kb3600.cpp @@ -58,9 +58,9 @@ ay3600_device::ay3600_device(const machine_config &mconfig, const char *tag, dev m_write_data_ready(*this), m_write_ako(*this) { - for (int i = 0; i < 9; i++) + for (auto & elem : m_x_mask) { - m_x_mask[i] = 0; + elem = 0; } } diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp index 44d5e72c99d..b8ecf53611c 100644 --- a/src/devices/machine/laserdsc.cpp +++ b/src/devices/machine/laserdsc.cpp @@ -802,10 +802,10 @@ void laserdisc_device::init_video() m_videopalette->entry_set_color(index, rgb_t(index, index, index)); // allocate video frames - for (int index = 0; index < ARRAY_LENGTH(m_frame); index++) + for (auto & frame : m_frame) { // first allocate a YUY16 bitmap at 2x the height - frame_data &frame = m_frame[index]; + frame.m_bitmap.allocate(m_width, m_height * 2); frame.m_bitmap.set_palette(m_videopalette); fillbitmap_yuy16(frame.m_bitmap, 40, 109, 240); @@ -842,12 +842,12 @@ void laserdisc_device::init_video() texture_format texformat = !m_overupdate_ind16.isnull() ? TEXFORMAT_PALETTEA16 : TEXFORMAT_ARGB32; // allocate overlay bitmaps - for (int index = 0; index < ARRAY_LENGTH(m_overbitmap); index++) + for (auto & elem : m_overbitmap) { - m_overbitmap[index].set_format(format, texformat); + elem.set_format(format, texformat); if (format==BITMAP_FORMAT_IND16) - m_overbitmap[index].set_palette(m_overlay_palette->palette()); - m_overbitmap[index].resize(m_overwidth, m_overheight); + elem.set_palette(m_overlay_palette->palette()); + elem.resize(m_overwidth, m_overheight); } // allocate overlay texture diff --git a/src/devices/machine/m6m80011ap.cpp b/src/devices/machine/m6m80011ap.cpp index 39fbd526235..a8dea68d6ef 100644 --- a/src/devices/machine/m6m80011ap.cpp +++ b/src/devices/machine/m6m80011ap.cpp @@ -68,8 +68,8 @@ void m6m80011ap_device::device_reset() void m6m80011ap_device::nvram_default() { - for (offs_t offs = 0; offs < 0x80; offs++) - m_eeprom_data[offs] = 0xffff; + for (auto & elem : m_eeprom_data) + elem = 0xffff; } diff --git a/src/devices/machine/mc6843.cpp b/src/devices/machine/mc6843.cpp index bec088ff829..04a7b6a0906 100644 --- a/src/devices/machine/mc6843.cpp +++ b/src/devices/machine/mc6843.cpp @@ -95,9 +95,9 @@ mc6843_device::mc6843_device(const machine_config &mconfig, const char *tag, dev m_index_pulse(0), m_timer_cont(nullptr) { - for (int i = 0; i < 128; i++) + for (auto & elem : m_data) { - m_data[i] = 0; + elem = 0; } } diff --git a/src/devices/machine/mc6854.cpp b/src/devices/machine/mc6854.cpp index 9da624c850e..3461d58dde5 100644 --- a/src/devices/machine/mc6854.cpp +++ b/src/devices/machine/mc6854.cpp @@ -197,9 +197,9 @@ mc6854_device::mc6854_device(const machine_config &mconfig, const char *tag, dev m_rfifo[i] = 0; } - for (int i = 0; i < MAX_FRAME_LENGTH; i++) + for (auto & elem : m_frame) { - m_frame[i] = 0; + elem = 0; } } diff --git a/src/devices/machine/mos8722.cpp b/src/devices/machine/mos8722.cpp index 31b2beb1f27..214a52faa21 100644 --- a/src/devices/machine/mos8722.cpp +++ b/src/devices/machine/mos8722.cpp @@ -100,9 +100,9 @@ void mos8722_device::device_start() void mos8722_device::device_reset() { - for (int i = 0; i < 16; i++) + for (auto & elem : m_reg) { - m_reg[i] = 0; + elem = 0; } m_reg[P1L] = 0x01; diff --git a/src/devices/machine/msm5832.cpp b/src/devices/machine/msm5832.cpp index 7bc6fa70bfa..21fdeb3ba63 100644 --- a/src/devices/machine/msm5832.cpp +++ b/src/devices/machine/msm5832.cpp @@ -96,8 +96,8 @@ msm5832_device::msm5832_device(const machine_config &mconfig, const char *tag, d m_write(0), m_cs(0) { - for (int i = 0; i < 13; i++) - m_reg[i] = 0; + for (auto & elem : m_reg) + elem = 0; } diff --git a/src/devices/machine/msm58321.cpp b/src/devices/machine/msm58321.cpp index 679b85584ff..7bdd77713ea 100644 --- a/src/devices/machine/msm58321.cpp +++ b/src/devices/machine/msm58321.cpp @@ -298,8 +298,8 @@ void msm58321_device::rtc_clock_updated(int year, int month, int day, int day_of void msm58321_device::nvram_default() { - for (int i = 0; i < 13; i++) - m_reg[i] = 0; + for (auto & elem : m_reg) + elem = 0; if (m_default_24h) m_reg[REGISTER_H10] = H10_24; diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h index 583a9d5fd26..94c9c29e36e 100644 --- a/src/devices/machine/netlist.h +++ b/src/devices/machine/netlist.h @@ -658,8 +658,8 @@ public: ATTR_COLD void reset() { m_pos = 0; - for (int i = 0; i < MAX_INPUT_CHANNELS; i++) - m_buffer[i] = nullptr; + for (auto & elem : m_buffer) + elem = nullptr; } ATTR_COLD int resolve() diff --git a/src/devices/machine/pci.cpp b/src/devices/machine/pci.cpp index c5191e984f6..f41eaea2e20 100644 --- a/src/devices/machine/pci.cpp +++ b/src/devices/machine/pci.cpp @@ -431,8 +431,8 @@ void pci_bridge_device::device_start() { pci_device::device_start(); - for(int i=0; i<32*8; i++) - sub_devices[i] = nullptr; + for(auto & elem : sub_devices) + elem = nullptr; for(device_t *d = bus_root()->first_subdevice(); d != nullptr; d = d->next()) { const char *t = d->tag(); diff --git a/src/devices/machine/pla.cpp b/src/devices/machine/pla.cpp index 286b7805e81..417fb4e6c3f 100644 --- a/src/devices/machine/pla.cpp +++ b/src/devices/machine/pla.cpp @@ -48,8 +48,8 @@ void pla_device::device_start() // initialize cache m_cache2_ptr = 0; - for (int i = 0; i < CACHE2_SIZE; i++) - m_cache2[i] = 0x80000000; + for (auto & elem : m_cache2) + elem = 0x80000000; m_cache_size = 0; int csize = 1 << ((m_inputs > MAX_CACHE_BITS) ? MAX_CACHE_BITS : m_inputs); @@ -146,9 +146,9 @@ UINT32 pla_device::read(UINT32 input) if (input < m_cache_size) return m_cache[input]; - for (int i = 0; i < CACHE2_SIZE; ++i) + for (auto cache2_entry : m_cache2) { - UINT64 cache2_entry = m_cache2[i]; + if ((UINT32)cache2_entry == input) { diff --git a/src/devices/machine/rtc9701.cpp b/src/devices/machine/rtc9701.cpp index ee7cff625c7..7c92ddc53e7 100644 --- a/src/devices/machine/rtc9701.cpp +++ b/src/devices/machine/rtc9701.cpp @@ -129,8 +129,8 @@ void rtc9701_device::device_reset() void rtc9701_device::nvram_default() { - for (offs_t offs = 0; offs < 0x100; offs++) - rtc9701_data[offs] = 0xffff; + for (auto & elem : rtc9701_data) + elem = 0xffff; } diff --git a/src/devices/machine/s2636.cpp b/src/devices/machine/s2636.cpp index e6c440fcddc..142514d8a19 100644 --- a/src/devices/machine/s2636.cpp +++ b/src/devices/machine/s2636.cpp @@ -97,8 +97,8 @@ s2636_device::s2636_device(const machine_config &mconfig, const char *tag, devic m_y_offset(0), m_x_offset(0) { - for (int i = 0; i < 1; i++) - m_reg[i] = 0; + for (auto & elem : m_reg) + elem = 0; } //------------------------------------------------- diff --git a/src/devices/machine/s3c24xx.inc b/src/devices/machine/s3c24xx.inc index 6bf7a49f71c..07193f890a4 100644 --- a/src/devices/machine/s3c24xx.inc +++ b/src/devices/machine/s3c24xx.inc @@ -1481,9 +1481,9 @@ TIMER_CALLBACK_MEMBER( S3C24_CLASS_NAME::s3c24xx_pwm_timer_exp ) void S3C24_CLASS_NAME::s3c24xx_dma_reset() { - for (int i = 0; i < S3C24XX_DMA_COUNT; i++) + for (auto & elem : m_dma) { - s3c24xx_dma_t *dma = &m_dma[i]; + s3c24xx_dma_t *dma = &elem; memset( &dma->regs, 0, sizeof( dma->regs)); dma->timer->adjust( attotime::never); } @@ -2012,9 +2012,9 @@ WRITE32_MEMBER( S3C24_CLASS_NAME::s3c24xx_usb_host_w ) void S3C24_CLASS_NAME::s3c24xx_uart_reset() { - for (int i = 0; i < S3C24XX_UART_COUNT; i++) + for (auto & elem : m_uart) { - s3c24xx_uart_t *uart = &m_uart[i]; + s3c24xx_uart_t *uart = &elem; memset( &uart->regs, 0, sizeof( uart->regs)); uart->regs.utrstat = 6; } @@ -2860,9 +2860,9 @@ void S3C24_CLASS_NAME::s3c24xx_touch_screen(int state) void S3C24_CLASS_NAME::s3c24xx_spi_reset() { - for (int i = 0; i < S3C24XX_SPI_COUNT; i++) + for (auto & elem : m_spi) { - s3c24xx_spi_t *spi = &m_spi[i]; + s3c24xx_spi_t *spi = &elem; memset( &spi->regs, 0, sizeof( spi->regs)); spi->regs.spsta = 1; #if defined(DEVICE_S3C2400) || defined(DEVICE_S3C2410) @@ -3496,9 +3496,9 @@ void S3C24_CLASS_NAME::s3c24xx_device_start() { m_pwm.timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate( FUNC(S3C24_CLASS_NAME::s3c24xx_pwm_timer_exp), this)); } - for (int i = 0; i < S3C24XX_DMA_COUNT; i++) + for (auto & elem : m_dma) { - m_dma[i].timer = machine().scheduler().timer_alloc(timer_expired_delegate( FUNC(S3C24_CLASS_NAME::s3c24xx_dma_timer_exp), this)); + elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate( FUNC(S3C24_CLASS_NAME::s3c24xx_dma_timer_exp), this)); } m_iic.timer = machine().scheduler().timer_alloc(timer_expired_delegate( FUNC(S3C24_CLASS_NAME::s3c24xx_iic_timer_exp), this)); m_iis.timer = machine().scheduler().timer_alloc(timer_expired_delegate( FUNC(S3C24_CLASS_NAME::s3c24xx_iis_timer_exp), this)); diff --git a/src/devices/machine/s3c44b0.cpp b/src/devices/machine/s3c44b0.cpp index 22d895fb5d9..56e9ee32e3b 100644 --- a/src/devices/machine/s3c44b0.cpp +++ b/src/devices/machine/s3c44b0.cpp @@ -76,9 +76,9 @@ void s3c44b0_device::device_start() for (int i = 0; i < 6; i++) m_pwm.timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::pwm_timer_exp),this)); - for (int i = 0; i < 2; i++) m_uart[i].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::uart_timer_exp),this)); - for (int i = 0; i < 2; i++) m_zdma[i].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::zdma_timer_exp),this)); - for (int i = 0; i < 2; i++) m_bdma[i].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::bdma_timer_exp),this)); + for (auto & elem : m_uart) elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::uart_timer_exp),this)); + for (auto & elem : m_zdma) elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::zdma_timer_exp),this)); + for (auto & elem : m_bdma) elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::bdma_timer_exp),this)); m_lcd.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::lcd_timer_exp),this)); m_wdt.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::wdt_timer_exp),this)); @@ -390,12 +390,12 @@ void s3c44b0_device::lcd_render_stn_04() UINT8 *bitmap = m_lcd.bitmap + ((m_lcd.vpos - m_lcd.vpos_min) * (m_lcd.hpos_max - m_lcd.hpos_min + 1)) + (m_lcd.hpos - m_lcd.hpos_min); UINT8 data[16]; lcd_dma_read(16, data); - for (int i = 0; i < 16; i++) + for (auto & elem : data) { for (int j = 0; j < 2; j++) { - *bitmap++ = lcd_get_color_stn_04((data[i] >> 4) & 0x0F); - data[i] = data[i] << 4; + *bitmap++ = lcd_get_color_stn_04((elem >> 4) & 0x0F); + elem = elem << 4; m_lcd.hpos++; if (m_lcd.hpos >= m_lcd.hpos_min + (m_lcd.pagewidth_max << 2)) { @@ -416,15 +416,15 @@ void s3c44b0_device::lcd_render_stn_08() UINT8 *bitmap = m_lcd.bitmap + ((m_lcd.vpos - m_lcd.vpos_min) * (m_lcd.hpos_max - m_lcd.hpos_min + 1)) + (m_lcd.hpos - m_lcd.hpos_min); UINT8 data[16]; lcd_dma_read(16, data); - for (int i = 0; i < 16; i++) + for (auto & elem : data) { UINT8 xxx[3]; - xxx[0] = lcd_get_color_stn_08_r(data[i]); - xxx[1] = lcd_get_color_stn_08_g(data[i]); - xxx[2] = lcd_get_color_stn_08_b(data[i]); - for (int j = 0; j < 3; j++) + xxx[0] = lcd_get_color_stn_08_r(elem); + xxx[1] = lcd_get_color_stn_08_g(elem); + xxx[2] = lcd_get_color_stn_08_b(elem); + for (auto & xxx_j : xxx) { - *bitmap++ = xxx[j]; + *bitmap++ = xxx_j; m_lcd.hpos++; if (m_lcd.hpos >= m_lcd.hpos_min + (m_lcd.pagewidth_max * 6)) { diff --git a/src/devices/machine/upd1990a.cpp b/src/devices/machine/upd1990a.cpp index f40bb30af48..59f85d9c4ca 100644 --- a/src/devices/machine/upd1990a.cpp +++ b/src/devices/machine/upd1990a.cpp @@ -86,8 +86,8 @@ void upd1990a_device::device_start() // initialize set_current_time(machine()); - for (int i = 0; i < 7; i++) - m_shift_reg[i] = 0; + for (auto & elem : m_shift_reg) + elem = 0; m_oe = 0; m_cs = 0; diff --git a/src/devices/machine/upd71071.cpp b/src/devices/machine/upd71071.cpp index 59965256bc5..921c0bcc7a4 100644 --- a/src/devices/machine/upd71071.cpp +++ b/src/devices/machine/upd71071.cpp @@ -133,9 +133,9 @@ void upd71071_device::device_start() m_out_dack_1_cb.resolve_safe(); m_out_dack_2_cb.resolve_safe(); m_out_dack_3_cb.resolve_safe(); - for (int x = 0; x < 4; x++) + for (auto & elem : m_timer) { - m_timer[x] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd71071_device::dma_transfer_timer),this)); + elem = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd71071_device::dma_transfer_timer),this)); } m_selected_channel = 0; diff --git a/src/devices/machine/upd765.cpp b/src/devices/machine/upd765.cpp index 34a01b21ac7..54c1119d4e7 100644 --- a/src/devices/machine/upd765.cpp +++ b/src/devices/machine/upd765.cpp @@ -260,10 +260,10 @@ bool upd765_family_device::get_ready(int fid) void upd765_family_device::set_floppy(floppy_image_device *flop) { - for(int fid=0; fid<4; fid++) { - if(flopi[fid].dev) - flopi[fid].dev->setup_index_pulse_cb(floppy_image_device::index_pulse_cb()); - flopi[fid].dev = flop; + for(auto & elem : flopi) { + if(elem.dev) + elem.dev->setup_index_pulse_cb(floppy_image_device::index_pulse_cb()); + elem.dev = flop; } if(flop) flop->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(FUNC(upd765_family_device::index_callback), this)); @@ -2246,8 +2246,8 @@ void upd765_family_device::run_drive_ready_polling() void upd765_family_device::index_callback(floppy_image_device *floppy, int state) { - for(int fid=0; fid<4; fid++) { - floppy_info &fi = flopi[fid]; + for(auto & fi : flopi) { + if(fi.dev != floppy) continue; diff --git a/src/devices/machine/wd7600.cpp b/src/devices/machine/wd7600.cpp index 26873553e14..63586c3d858 100644 --- a/src/devices/machine/wd7600.cpp +++ b/src/devices/machine/wd7600.cpp @@ -201,8 +201,8 @@ void wd7600_device::device_reset() m_memory_ctrl = 0; m_diagnostic = 0xe080; - for(int x=0;x<4;x++) - m_bank_start[x] = 0; + for(auto & elem : m_bank_start) + elem = 0; // initialize dma controller clocks m_dma1->set_unscaled_clock(clock()); diff --git a/src/devices/machine/z80ctc.cpp b/src/devices/machine/z80ctc.cpp index 23487d5120c..13c4844c9e3 100644 --- a/src/devices/machine/z80ctc.cpp +++ b/src/devices/machine/z80ctc.cpp @@ -183,9 +183,9 @@ int z80ctc_device::z80daisy_irq_state() // loop over all channels int state = 0; - for (int ch = 0; ch < 4; ch++) + for (auto & channel : m_channel) { - ctc_channel &channel = m_channel[ch]; + // if we're servicing a request, don't indicate more interrupts if (channel.m_int_state & Z80_DAISY_IEO) diff --git a/src/devices/machine/z80dart.cpp b/src/devices/machine/z80dart.cpp index 6254d1d81f1..e976080881f 100644 --- a/src/devices/machine/z80dart.cpp +++ b/src/devices/machine/z80dart.cpp @@ -112,8 +112,8 @@ z80dart_device::z80dart_device(const machine_config &mconfig, device_type type, m_out_txdrqb_cb(*this), m_variant(variant) { - for (int i = 0; i < 8; i++) - m_int_state[i] = 0; + for (auto & elem : m_int_state) + elem = 0; } z80dart_device::z80dart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -142,8 +142,8 @@ z80dart_device::z80dart_device(const machine_config &mconfig, const char *tag, d m_out_txdrqb_cb(*this), m_variant(TYPE_DART) { - for (int i = 0; i < 8; i++) - m_int_state[i] = 0; + for (auto & elem : m_int_state) + elem = 0; } z80sio0_device::z80sio0_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -338,9 +338,9 @@ void z80dart_device::check_interrupts() void z80dart_device::reset_interrupts() { - for (int i = 0; i < 8; i++) + for (auto & elem : m_int_state) { - m_int_state[i] = 0; + elem = 0; } check_interrupts(); @@ -518,11 +518,11 @@ z80dart_channel::z80dart_channel(const machine_config &mconfig, const char *tag, m_rts(0), m_sync(0) { - for (int i = 0; i < 3; i++) - m_rr[i] = 0; + for (auto & elem : m_rr) + elem = 0; - for (int i = 0; i < 6; i++) - m_wr[i] = 0; + for (auto & elem : m_wr) + elem = 0; for (int i = 0; i < 3; i++) { diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp index 1abc94fec86..3c6a17f6fbb 100644 --- a/src/devices/machine/z80scc.cpp +++ b/src/devices/machine/z80scc.cpp @@ -154,8 +154,8 @@ z80scc_device::z80scc_device(const machine_config &mconfig, device_type type, co m_out_txdrqb_cb(*this), m_variant(variant), m_wr0_ptrbits(0){ - for (int i = 0; i < 6; i++) - m_int_state[i] = 0; + for (auto & elem : m_int_state) + elem = 0; } z80scc_device::z80scc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -184,8 +184,8 @@ z80scc_device::z80scc_device(const machine_config &mconfig, const char *tag, dev m_out_txdrqb_cb(*this), m_variant(TYPE_Z80SCC) { - for (int i = 0; i < 6; i++) - m_int_state[i] = 0; + for (auto & elem : m_int_state) + elem = 0; } scc8030_device::scc8030_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -379,9 +379,9 @@ void z80scc_device::reset_interrupts() { LOG(("%s %s \n",FUNCNAME, tag())); // reset internal interrupt sources - for (int i = 0; i < 6; i++) + for (auto & elem : m_int_state) { - m_int_state[i] = 0; + elem = 0; } // check external interrupt sources diff --git a/src/devices/machine/z80sio.cpp b/src/devices/machine/z80sio.cpp index 00f65a8e6b4..64d9480dfbf 100644 --- a/src/devices/machine/z80sio.cpp +++ b/src/devices/machine/z80sio.cpp @@ -129,8 +129,8 @@ z80sio_device::z80sio_device(const machine_config &mconfig, device_type type, co m_out_txdrqb_cb(*this), m_variant(variant) { - for (int i = 0; i < 8; i++) - m_int_state[i] = 0; + for (auto & elem : m_int_state) + elem = 0; } z80sio_device::z80sio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -159,8 +159,8 @@ z80sio_device::z80sio_device(const machine_config &mconfig, const char *tag, dev m_out_txdrqb_cb(*this), m_variant(TYPE_Z80SIO) { - for (int i = 0; i < 8; i++) - m_int_state[i] = 0; + for (auto & elem : m_int_state) + elem = 0; } //------------------------------------------------- @@ -317,9 +317,9 @@ void z80sio_device::reset_interrupts() { LOG(("%s %s \n",FUNCNAME, tag())); // reset internal interrupt sources - for (int i = 0; i < 8; i++) + for (auto & elem : m_int_state) { - m_int_state[i] = 0; + elem = 0; } check_interrupts(); diff --git a/src/devices/machine/z80sti.cpp b/src/devices/machine/z80sti.cpp index a27295f6ff1..e8900abd021 100644 --- a/src/devices/machine/z80sti.cpp +++ b/src/devices/machine/z80sti.cpp @@ -103,9 +103,9 @@ z80sti_device::z80sti_device(const machine_config &mconfig, const char *tag, dev m_isr(0), m_imr(0) { - for (int i = 0; i < 16; i++) + for (auto & elem : m_int_state) { - m_int_state[i] = 0; + elem = 0; } } diff --git a/src/devices/machine/z8536.cpp b/src/devices/machine/z8536.cpp index fc5e770b15a..60d5e46f05f 100644 --- a/src/devices/machine/z8536.cpp +++ b/src/devices/machine/z8536.cpp @@ -905,9 +905,9 @@ void z8536_device::device_reset() { m_state = STATE_RESET; - for (int i = 0; i < 48; i++) + for (auto & elem : m_register) { - m_register[i] = 0; + elem = 0; } m_register[MASTER_INTERRUPT_CONTROL] = MICR_RESET; diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp index cd69d5deee6..8103ffbc456 100644 --- a/src/devices/sound/es5503.cpp +++ b/src/devices/sound/es5503.cpp @@ -260,18 +260,18 @@ void es5503_device::device_reset() { rege0 = 0xff; - for (int osc = 0; osc < 32; osc++) + for (auto & elem : oscillators) { - oscillators[osc].freq = 0; - oscillators[osc].wtsize = 0; - oscillators[osc].control = 0; - oscillators[osc].vol = 0; - oscillators[osc].data = 0x80; - oscillators[osc].wavetblpointer = 0; - oscillators[osc].wavetblsize = 0; - oscillators[osc].resolution = 0; - oscillators[osc].accumulator = 0; - oscillators[osc].irqpend = 0; + elem.freq = 0; + elem.wtsize = 0; + elem.control = 0; + elem.vol = 0; + elem.data = 0x80; + elem.wavetblpointer = 0; + elem.wavetblsize = 0; + elem.resolution = 0; + elem.accumulator = 0; + elem.irqpend = 0; } oscsenabled = 1; diff --git a/src/devices/sound/es5506.cpp b/src/devices/sound/es5506.cpp index e29edc5f0ce..6e47ed7977d 100644 --- a/src/devices/sound/es5506.cpp +++ b/src/devices/sound/es5506.cpp @@ -157,9 +157,9 @@ es550x_device::es550x_device(const machine_config &mconfig, device_type type, co m_irq_cb(*this), m_read_port_cb(*this) { - for (int i = 0; i < 4; i++) + for (auto & elem : m_region_base) { - m_region_base[i] = nullptr; + elem = nullptr; } } diff --git a/src/devices/sound/i5000.cpp b/src/devices/sound/i5000.cpp index 22d390cc89c..11dc147f0b0 100644 --- a/src/devices/sound/i5000.cpp +++ b/src/devices/sound/i5000.cpp @@ -35,9 +35,9 @@ void i5000snd_device::device_start() // fill volume table double div = 1.032; double vol = 2047.0; - for (int i = 0; i < 0x100; i++) + for (auto & elem : m_lut_volume) { - m_lut_volume[i] = vol + 0.5; + elem = vol + 0.5; vol /= div; } m_lut_volume[0xff] = 0; diff --git a/src/devices/sound/ics2115.cpp b/src/devices/sound/ics2115.cpp index c76e043f8ac..9dabc41d334 100644 --- a/src/devices/sound/ics2115.cpp +++ b/src/devices/sound/ics2115.cpp @@ -108,29 +108,29 @@ void ics2115_device::device_reset() m_vmode = 0; m_irq_on = false; memset(m_voice, 0, sizeof(m_voice)); - for(int i = 0; i < 2; ++i) + for(auto & elem : m_timer) { - m_timer[i].timer->adjust(attotime::never); - m_timer[i].period = 0; - m_timer[i].scale = 0; - m_timer[i].preset = 0; + elem.timer->adjust(attotime::never); + elem.period = 0; + elem.scale = 0; + elem.preset = 0; } - for(int i = 0; i < 32; i++) { - m_voice[i].osc_conf.value = 2; - m_voice[i].osc.fc = 0; - m_voice[i].osc.acc = 0; - m_voice[i].osc.start = 0; - m_voice[i].osc.end = 0; - m_voice[i].osc.ctl = 0; - m_voice[i].osc.saddr = 0; - m_voice[i].vol.acc = 0; - m_voice[i].vol.incr = 0; - m_voice[i].vol.start = 0; - m_voice[i].vol.end = 0; - m_voice[i].vol.pan = 0x7F; - m_voice[i].vol_ctrl.value = 1; - m_voice[i].vol.mode = 0; - m_voice[i].state.value = 0; + for(auto & elem : m_voice) { + elem.osc_conf.value = 2; + elem.osc.fc = 0; + elem.osc.acc = 0; + elem.osc.start = 0; + elem.osc.end = 0; + elem.osc.ctl = 0; + elem.osc.saddr = 0; + elem.vol.acc = 0; + elem.vol.incr = 0; + elem.vol.start = 0; + elem.vol.end = 0; + elem.vol.pan = 0x7F; + elem.vol_ctrl.value = 1; + elem.vol.mode = 0; + elem.state.value = 0; } } diff --git a/src/devices/sound/k007232.cpp b/src/devices/sound/k007232.cpp index 6f5286b951f..767cd904357 100644 --- a/src/devices/sound/k007232.cpp +++ b/src/devices/sound/k007232.cpp @@ -179,8 +179,8 @@ void k007232_device::device_start() m_vol[1][0] = 0; m_vol[1][1] = 255; /* channel B output to output B */ - for (int i = 0; i < 0x10; i++) - m_wreg[i] = 0; + for (auto & elem : m_wreg) + elem = 0; m_stream = machine().sound().stream_alloc(*this, 0 , 2, clock()/128); diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp index fcf35089747..434d352635c 100644 --- a/src/devices/sound/k053260.cpp +++ b/src/devices/sound/k053260.cpp @@ -115,8 +115,8 @@ void k053260_device::device_start() void k053260_device::device_reset() { - for (int i = 0; i < 4; i++) - m_voice[i].voice_reset(); + for (auto & elem : m_voice) + elem.voice_reset(); } @@ -208,9 +208,9 @@ WRITE8_MEMBER( k053260_device::write ) // 0x29 is a read register case 0x2a: // loop and pcm/adpcm select - for (int i = 0; i < 4; i++) + for (auto & elem : m_voice) { - m_voice[i].set_loop_kadpcm(data); + elem.set_loop_kadpcm(data); data >>= 1; } break; @@ -272,9 +272,9 @@ void k053260_device::sound_stream_update(sound_stream &stream, stream_sample_t * { stream_sample_t buffer[2] = {0, 0}; - for (int i = 0; i < 4; i++) + for (auto & voice : m_voice) { - KDSC_Voice &voice = m_voice[i]; + if (voice.playing()) voice.play(buffer); } diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp index ed1699e6fd1..ba38b750b08 100644 --- a/src/devices/sound/k054539.cpp +++ b/src/devices/sound/k054539.cpp @@ -499,8 +499,8 @@ void k054539_device::device_start() m_timer_handler.resolve_safe(); m_apan_cb.bind_relative_to(*owner()); - for (int i = 0; i < 8; i++) - gain[i] = 1.0; + for (auto & elem : gain) + elem = 1.0; flags = RESET_FLAGS; diff --git a/src/devices/sound/nes_apu.cpp b/src/devices/sound/nes_apu.cpp index 5a5ee87fa26..0c42deb0fca 100644 --- a/src/devices/sound/nes_apu.cpp +++ b/src/devices/sound/nes_apu.cpp @@ -113,24 +113,24 @@ nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, dev m_stream(nullptr), m_cpu_tag("") { - for (int i = 0; i < NOISE_LONG; i++) + for (auto & elem : m_noise_lut) { - m_noise_lut[i] = 0; + elem = 0; } - for (int i = 0; i < 0X20; i++) + for (auto & elem : m_vbl_times) { - m_vbl_times[i] = 0; + elem = 0; } - for (int i = 0; i < SYNCS_MAX1; i++) + for (auto & elem : m_sync_times1) { - m_sync_times1[i] = 0; + elem = 0; } - for (int i = 0; i < SYNCS_MAX2; i++) + for (auto & elem : m_sync_times2) { - m_sync_times2[i] = 0; + elem = 0; } } diff --git a/src/devices/sound/nes_defs.h b/src/devices/sound/nes_defs.h index a3ed9203500..b225b1e60a6 100644 --- a/src/devices/sound/nes_defs.h +++ b/src/devices/sound/nes_defs.h @@ -96,9 +96,9 @@ struct square_t { square_t() { - for (int i = 0; i < 4; i++) + for (auto & elem : regs) { - regs[i] = 0; + elem = 0; } vbl_length =0; freq = 0; @@ -128,9 +128,9 @@ struct triangle_t { triangle_t() { - for (int i = 0; i < 4; i++) + for (auto & elem : regs) { - regs[i] = 0; + elem = 0; } linear_length =0; vbl_length =0; @@ -158,9 +158,9 @@ struct noise_t { noise_t() { - for (int i = 0; i < 4; i++) + for (auto & elem : regs) { - regs[i] = 0; + elem = 0; } cur_pos =0; vbl_length =0; @@ -186,9 +186,9 @@ struct dpcm_t { dpcm_t() { - for (int i = 0; i < 4; i++) + for (auto & elem : regs) { - regs[i] = 0; + elem = 0; } address = 0; length = 0; diff --git a/src/devices/sound/okim6295.cpp b/src/devices/sound/okim6295.cpp index 27ff90adb2b..7e97d04e916 100644 --- a/src/devices/sound/okim6295.cpp +++ b/src/devices/sound/okim6295.cpp @@ -150,8 +150,8 @@ void okim6295_device::device_start() void okim6295_device::device_reset() { m_stream->update(); - for (int voicenum = 0; voicenum < OKIM6295_VOICES; voicenum++) - m_voice[voicenum].m_playing = false; + for (auto & elem : m_voice) + elem.m_playing = false; } @@ -200,8 +200,8 @@ void okim6295_device::sound_stream_update(sound_stream &stream, stream_sample_t memset(outputs[0], 0, samples * sizeof(*outputs[0])); // iterate over voices and accumulate sample data - for (int voicenum = 0; voicenum < OKIM6295_VOICES; voicenum++) - m_voice[voicenum].generate_adpcm(*m_direct, outputs[0], samples); + for (auto & elem : m_voice) + elem.generate_adpcm(*m_direct, outputs[0], samples); } diff --git a/src/devices/sound/okim9810.cpp b/src/devices/sound/okim9810.cpp index d59ae3d82fa..cd89d77a3e0 100644 --- a/src/devices/sound/okim9810.cpp +++ b/src/devices/sound/okim9810.cpp @@ -144,8 +144,8 @@ void okim9810_device::device_start() void okim9810_device::device_reset() { m_stream->update(); - for (int voicenum = 0; voicenum < OKIM9810_VOICES; voicenum++) - m_voice[voicenum].m_playing = false; + for (auto & elem : m_voice) + elem.m_playing = false; } @@ -191,8 +191,8 @@ void okim9810_device::sound_stream_update(sound_stream &stream, stream_sample_t memset(outputs[1], 0, samples * sizeof(*outputs[1])); // iterate over voices and accumulate sample data - for (int voicenum = 0; voicenum < OKIM9810_VOICES; voicenum++) - m_voice[voicenum].generate_audio(*m_direct, outputs, samples, m_global_volume, clock(), m_filter_type); + for (auto & elem : m_voice) + elem.generate_audio(*m_direct, outputs, samples, m_global_volume, clock(), m_filter_type); } diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp index 866b48ec615..44ff9017ea4 100644 --- a/src/devices/sound/qs1000.cpp +++ b/src/devices/sound/qs1000.cpp @@ -305,9 +305,9 @@ READ8_MEMBER(qs1000_device::data_to_i8052) //------------------------------------------------- void qs1000_device::device_reset() { - for (int ch = 0; ch < QS1000_CHANNELS; ++ch) + for (auto & elem : m_channels) { - m_channels[ch].m_flags = 0; + elem.m_flags = 0; } } @@ -486,9 +486,9 @@ void qs1000_device::sound_stream_update(sound_stream &stream, stream_sample_t ** memset(outputs[1], 0x0, samples * sizeof(*outputs[1])); // Iterate over voices and accumulate sample data - for (int ch = 0; ch < QS1000_CHANNELS; ch++) + for (auto & chan : m_channels) { - qs1000_channel &chan = m_channels[ch]; + UINT8 lvol = chan.m_regs[6]; UINT8 rvol = chan.m_regs[7]; diff --git a/src/devices/sound/qsound.cpp b/src/devices/sound/qsound.cpp index 977a459e1dd..c9bd30d3e74 100644 --- a/src/devices/sound/qsound.cpp +++ b/src/devices/sound/qsound.cpp @@ -147,9 +147,9 @@ void qsound_device::sound_stream_update(sound_stream &stream, stream_sample_t ** memset(outputs[0], 0, samples * sizeof(*outputs[0])); memset(outputs[1], 0, samples * sizeof(*outputs[1])); - for (int ch = 0; ch < 16; ch++) + for (auto & elem : m_channel) { - if (m_channel[ch].enabled) + if (elem.enabled) { stream_sample_t *lmix=outputs[0]; stream_sample_t *rmix=outputs[1]; @@ -157,34 +157,34 @@ void qsound_device::sound_stream_update(sound_stream &stream, stream_sample_t ** // Go through the buffer and add voice contributions for (int i = 0; i < samples; i++) { - m_channel[ch].address += (m_channel[ch].step_ptr >> 12); - m_channel[ch].step_ptr &= 0xfff; - m_channel[ch].step_ptr += m_channel[ch].freq; + elem.address += (elem.step_ptr >> 12); + elem.step_ptr &= 0xfff; + elem.step_ptr += elem.freq; - if (m_channel[ch].address >= m_channel[ch].end) + if (elem.address >= elem.end) { - if (m_channel[ch].loop) + if (elem.loop) { // Reached the end, restart the loop - m_channel[ch].address -= m_channel[ch].loop; + elem.address -= elem.loop; // Make sure we don't overflow (what does the real chip do in this case?) - if (m_channel[ch].address >= m_channel[ch].end) - m_channel[ch].address = m_channel[ch].end - m_channel[ch].loop; + if (elem.address >= elem.end) + elem.address = elem.end - elem.loop; - m_channel[ch].address &= 0xffff; + elem.address &= 0xffff; } else { // Reached the end of a non-looped sample - m_channel[ch].enabled = false; + elem.enabled = false; break; } } - INT8 sample = read_sample(m_channel[ch].bank | m_channel[ch].address); - *lmix++ += ((sample * m_channel[ch].lvol * m_channel[ch].vol) >> 14); - *rmix++ += ((sample * m_channel[ch].rvol * m_channel[ch].vol) >> 14); + INT8 sample = read_sample(elem.bank | elem.address); + *lmix++ += ((sample * elem.lvol * elem.vol) >> 14); + *rmix++ += ((sample * elem.rvol * elem.vol) >> 14); } } } diff --git a/src/devices/sound/sp0250.cpp b/src/devices/sound/sp0250.cpp index 0ff76fb13c1..004cd6d6921 100644 --- a/src/devices/sound/sp0250.cpp +++ b/src/devices/sound/sp0250.cpp @@ -51,17 +51,17 @@ sp0250_device::sp0250_device(const machine_config &mconfig, const char *tag, dev m_fifo_pos(0), m_drq(*this) { - for (int i = 0; i < 15; i++) + for (auto & elem : m_fifo) { - m_fifo[i] = 0; + elem = 0; } - for (int i = 0; i < 6; i++) + for (auto & elem : m_filter) { - m_filter[i].F = 0; - m_filter[i].B = 0; - m_filter[i].z1 = 0; - m_filter[i].z2 = 0; + elem.F = 0; + elem.B = 0; + elem.z1 = 0; + elem.z2 = 0; } } diff --git a/src/devices/sound/spu.cpp b/src/devices/sound/spu.cpp index 714d6750e28..31d04be95d6 100644 --- a/src/devices/sound/spu.cpp +++ b/src/devices/sound/spu.cpp @@ -1048,8 +1048,8 @@ void spu_device::device_reset() memset(cache,0,(spu_ram_size>>4)*sizeof(sample_cache *)); - for (unsigned int i=0; i<4; i++) - output_buf[i]=new unsigned char [output_buffer_size]; + for (auto & elem : output_buf) + elem=new unsigned char [output_buffer_size]; output_head=output_tail=output_size=0; noise_t=0; @@ -1082,8 +1082,8 @@ void spu_device::device_post_load() // void spu_device::device_stop() { - for (unsigned int i=0; i<4; i++) - global_free_array(output_buf[i]); + for (auto & elem : output_buf) + global_free_array(elem); kill_stream(); diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp index c10420af8a4..1d0eec4fa5d 100644 --- a/src/devices/sound/ymf271.cpp +++ b/src/devices/sound/ymf271.cpp @@ -1726,10 +1726,10 @@ void ymf271_device::device_start() void ymf271_device::device_reset() { - for (int i = 0; i < 48; i++) + for (auto & elem : m_slots) { - m_slots[i].active = 0; - m_slots[i].volume = 0; + elem.active = 0; + elem.volume = 0; } // reset timers and IRQ diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp index 9d07f057739..c9c19277780 100644 --- a/src/devices/sound/ymz280b.cpp +++ b/src/devices/sound/ymz280b.cpp @@ -138,9 +138,9 @@ void ymz280b_device::update_volumes(struct YMZ280BVoice *voice) void ymz280b_device::device_post_load() { - for (int j = 0; j < 8; j++) + for (auto & elem : m_voice) { - struct YMZ280BVoice *voice = &m_voice[j]; + struct YMZ280BVoice *voice = &elem; update_step(voice); if(voice->irq_schedule) voice->timer->adjust(attotime::zero); @@ -660,9 +660,9 @@ void ymz280b_device::device_reset() m_ext_mem_address = 0; /* clear other voice parameters */ - for (int i = 0; i < 8; i++) + for (auto & elem : m_voice) { - struct YMZ280BVoice *voice = &m_voice[i]; + struct YMZ280BVoice *voice = &elem; voice->curr_sample = 0; voice->last_sample = 0; diff --git a/src/devices/sound/ymz770.cpp b/src/devices/sound/ymz770.cpp index f5ca4eab23f..6456c346ffd 100644 --- a/src/devices/sound/ymz770.cpp +++ b/src/devices/sound/ymz770.cpp @@ -54,11 +54,11 @@ void ymz770_device::device_start() m_rom_base = region()->base(); m_rom_limit = region()->bytes() * 8; - for (int i = 0; i < 8; i++) + for (auto & elem : m_channels) { - m_channels[i].is_playing = false; - m_channels[i].is_seq_playing = false; - m_channels[i].decoder = new mpeg_audio(m_rom_base, mpeg_audio::AMM, false, 0); + elem.is_playing = false; + elem.is_seq_playing = false; + elem.decoder = new mpeg_audio(m_rom_base, mpeg_audio::AMM, false, 0); } // register for save states @@ -96,19 +96,19 @@ void ymz770_device::device_start() void ymz770_device::device_reset() { - for (int ch = 0; ch < 8; ch++) + for (auto & elem : m_channels) { - m_channels[ch].phrase = 0; - m_channels[ch].pan = 8; - m_channels[ch].volume = 0; - m_channels[ch].control = 0; - m_channels[ch].sequence = 0; - m_channels[ch].seqcontrol = 0; - m_channels[ch].seqdelay = 0; - m_channels[ch].is_playing = false; - m_channels[ch].is_seq_playing = false; - m_channels[ch].output_remaining = 0; - m_channels[ch].decoder->clear(); + elem.phrase = 0; + elem.pan = 8; + elem.volume = 0; + elem.control = 0; + elem.sequence = 0; + elem.seqcontrol = 0; + elem.seqdelay = 0; + elem.is_playing = false; + elem.is_seq_playing = false; + elem.output_remaining = 0; + elem.decoder->clear(); } } @@ -128,35 +128,35 @@ void ymz770_device::sound_stream_update(sound_stream &stream, stream_sample_t ** for (int i = 0; i < samples; i++) { // run sequencers (should probably be in separate timer callbacks) - for (int ch = 0; ch < 8; ch++) + for (auto & elem : m_channels) { - if (m_channels[ch].is_seq_playing) + if (elem.is_seq_playing) { - if (m_channels[ch].seqdelay > 0) + if (elem.seqdelay > 0) { - m_channels[ch].seqdelay--; + elem.seqdelay--; } else { - int reg = *m_channels[ch].seqdata++; - UINT8 data = *m_channels[ch].seqdata++; + int reg = *elem.seqdata++; + UINT8 data = *elem.seqdata++; switch (reg) { case 0x0f: - if (m_channels[ch].seqcontrol & 1) + if (elem.seqcontrol & 1) { // loop sequence - UINT8 sqn = m_channels[ch].sequence; + UINT8 sqn = elem.sequence; UINT32 pptr = m_rom_base[(4*sqn)+1+0x400]<<16 | m_rom_base[(4*sqn)+2+0x400]<<8 | m_rom_base[(4*sqn)+3+0x400]; - m_channels[ch].seqdata = &m_rom_base[pptr]; + elem.seqdata = &m_rom_base[pptr]; } else { - m_channels[ch].is_seq_playing = false; + elem.is_seq_playing = false; } break; case 0x0e: - m_channels[ch].seqdelay = 32 - 1; + elem.seqdelay = 32 - 1; break; default: internal_reg_write(reg, data); @@ -169,55 +169,55 @@ void ymz770_device::sound_stream_update(sound_stream &stream, stream_sample_t ** // process channels INT32 mix = 0; - for (int ch = 0; ch < 8; ch++) + for (auto & elem : m_channels) { - if (m_channels[ch].output_remaining > 0) + if (elem.output_remaining > 0) { // force finish current block - mix += (m_channels[ch].output_data[m_channels[ch].output_ptr++]*m_channels[ch].volume); - m_channels[ch].output_remaining--; + mix += (elem.output_data[elem.output_ptr++]*elem.volume); + elem.output_remaining--; - if (m_channels[ch].output_remaining == 0 && !m_channels[ch].is_playing) - m_channels[ch].decoder->clear(); + if (elem.output_remaining == 0 && !elem.is_playing) + elem.decoder->clear(); } - else if (m_channels[ch].is_playing) + else if (elem.is_playing) { retry: - if (m_channels[ch].last_block) + if (elem.last_block) { - if (m_channels[ch].control & 1) + if (elem.control & 1) { // loop sample - UINT8 phrase = m_channels[ch].phrase; - m_channels[ch].atbl = m_rom_base[(4*phrase)+0] >> 4 & 7; - m_channels[ch].pptr = 8*(m_rom_base[(4*phrase)+1]<<16 | m_rom_base[(4*phrase)+2]<<8 | m_rom_base[(4*phrase)+3]); + UINT8 phrase = elem.phrase; + elem.atbl = m_rom_base[(4*phrase)+0] >> 4 & 7; + elem.pptr = 8*(m_rom_base[(4*phrase)+1]<<16 | m_rom_base[(4*phrase)+2]<<8 | m_rom_base[(4*phrase)+3]); } else { - m_channels[ch].is_playing = false; - m_channels[ch].output_remaining = 0; - m_channels[ch].decoder->clear(); + elem.is_playing = false; + elem.output_remaining = 0; + elem.decoder->clear(); } } - if (m_channels[ch].is_playing) + if (elem.is_playing) { // next block int sample_rate, channel_count; - if (!m_channels[ch].decoder->decode_buffer(m_channels[ch].pptr, m_rom_limit, m_channels[ch].output_data, m_channels[ch].output_remaining, sample_rate, channel_count) || m_channels[ch].output_remaining == 0) + if (!elem.decoder->decode_buffer(elem.pptr, m_rom_limit, elem.output_data, elem.output_remaining, sample_rate, channel_count) || elem.output_remaining == 0) { - m_channels[ch].is_playing = !m_channels[ch].last_block; // detect infinite retry loop - m_channels[ch].last_block = true; - m_channels[ch].output_remaining = 0; + elem.is_playing = !elem.last_block; // detect infinite retry loop + elem.last_block = true; + elem.output_remaining = 0; goto retry; } - m_channels[ch].last_block = m_channels[ch].output_remaining < 1152; - m_channels[ch].output_remaining--; - m_channels[ch].output_ptr = 1; + elem.last_block = elem.output_remaining < 1152; + elem.output_remaining--; + elem.output_ptr = 1; - mix += (m_channels[ch].output_data[0]*m_channels[ch].volume); + mix += (elem.output_data[0]*elem.volume); } } } diff --git a/src/devices/sound/zsg2.cpp b/src/devices/sound/zsg2.cpp index 4f3f1a42ca9..f7f7f53ae16 100644 --- a/src/devices/sound/zsg2.cpp +++ b/src/devices/sound/zsg2.cpp @@ -206,33 +206,33 @@ void zsg2_device::sound_stream_update(sound_stream &stream, stream_sample_t **in INT32 mix_r = 0; // loop over all channels - for (int ch = 0; ch < 48; ch++) + for (auto & elem : m_chan) { - if (!m_chan[ch].is_playing) + if (!elem.is_playing) continue; - m_chan[ch].step_ptr += m_chan[ch].step; - if (m_chan[ch].step_ptr & 0x10000) + elem.step_ptr += elem.step; + if (elem.step_ptr & 0x10000) { - m_chan[ch].step_ptr &= 0xffff; - if (++m_chan[ch].cur_pos >= m_chan[ch].end_pos) + elem.step_ptr &= 0xffff; + if (++elem.cur_pos >= elem.end_pos) { // loop sample - m_chan[ch].cur_pos = m_chan[ch].loop_pos; - if ((m_chan[ch].cur_pos + 1) >= m_chan[ch].end_pos) + elem.cur_pos = elem.loop_pos; + if ((elem.cur_pos + 1) >= elem.end_pos) { // end of sample - m_chan[ch].is_playing = false; + elem.is_playing = false; continue; } } - m_chan[ch].samples = prepare_samples(m_chan[ch].page | m_chan[ch].cur_pos); + elem.samples = prepare_samples(elem.page | elem.cur_pos); } - INT32 sample = (m_chan[ch].samples[m_chan[ch].step_ptr >> 14 & 3] * m_chan[ch].vol) >> 16; + INT32 sample = (elem.samples[elem.step_ptr >> 14 & 3] * elem.vol) >> 16; - mix_l += (sample * m_chan[ch].panl + sample * (0x1f - m_chan[ch].panr)) >> 5; - mix_r += (sample * m_chan[ch].panr + sample * (0x1f - m_chan[ch].panl)) >> 5; + mix_l += (sample * elem.panl + sample * (0x1f - elem.panr)) >> 5; + mix_r += (sample * elem.panr + sample * (0x1f - elem.panl)) >> 5; } outputs[0][i] = mix_l; diff --git a/src/devices/video/crt9007.cpp b/src/devices/video/crt9007.cpp index 0b2a30894c3..84ec673ec8b 100644 --- a/src/devices/video/crt9007.cpp +++ b/src/devices/video/crt9007.cpp @@ -466,8 +466,8 @@ crt9007_t::crt9007_t(const machine_config &mconfig, const char *tag, device_t *o m_write_slg(*this), m_write_sld(*this) { - for (int i = 0; i < 0x3d; i++) - m_reg[i] = 0; + for (auto & elem : m_reg) + elem = 0; } diff --git a/src/devices/video/hd66421.cpp b/src/devices/video/hd66421.cpp index 1eda616225c..513b028336f 100644 --- a/src/devices/video/hd66421.cpp +++ b/src/devices/video/hd66421.cpp @@ -125,9 +125,9 @@ hd66421_device::hd66421_device(const machine_config &mconfig, const char *tag, d m_y(0), m_palette(*this, "palette") { - for (int i = 0; i < 32; i++) + for (auto & elem : m_reg) { - m_reg[i] = 0; + elem = 0; } } diff --git a/src/devices/video/mos6566.cpp b/src/devices/video/mos6566.cpp index 77196b0d85e..d39e8cb041a 100644 --- a/src/devices/video/mos6566.cpp +++ b/src/devices/video/mos6566.cpp @@ -773,8 +773,8 @@ void mos6566_device::device_reset() { memset(m_reg, 0, sizeof(m_reg)); - for (int i = 0; i < ARRAY_LENGTH(m_mc); i++) - m_mc[i] = 63; + for (auto & elem : m_mc) + elem = 63; // from 0 to 311 (0 first, PAL) or from 0 to 261 (? first, NTSC 6567R56A) or from 0 to 262 (? first, NTSC 6567R8) m_rasterline = 0; // VIC2_LINES - 1; diff --git a/src/devices/video/snes_ppu.cpp b/src/devices/video/snes_ppu.cpp index ce33d0a7dae..134f3e84a97 100644 --- a/src/devices/video/snes_ppu.cpp +++ b/src/devices/video/snes_ppu.cpp @@ -409,14 +409,14 @@ void snes_ppu_device::device_reset() memset(&m_oam, 0, sizeof(m_oam)); memset(&m_mode7, 0, sizeof(m_mode7)); - for (int i = 0; i < 2; i++) + for (auto & elem : m_scanlines) { - m_scanlines[i].enable = 0; - m_scanlines[i].clip = 0; - memset(m_scanlines[i].buffer, 0, SNES_SCR_WIDTH); - memset(m_scanlines[i].priority, 0, SNES_SCR_WIDTH); - memset(m_scanlines[i].layer, 0, SNES_SCR_WIDTH); - memset(m_scanlines[i].blend_exception, 0, SNES_SCR_WIDTH); + elem.enable = 0; + elem.clip = 0; + memset(elem.buffer, 0, SNES_SCR_WIDTH); + memset(elem.priority, 0, SNES_SCR_WIDTH); + memset(elem.layer, 0, SNES_SCR_WIDTH); + memset(elem.blend_exception, 0, SNES_SCR_WIDTH); } for (int i = 0; i < 6; i++) @@ -442,27 +442,27 @@ void snes_ppu_device::device_reset() memset(m_clipmasks[i], 0, SNES_SCR_WIDTH); } - for (int i = 0; i < ARRAY_LENGTH(m_oam_spritelist); i++) + for (auto & elem : m_oam_spritelist) { - m_oam_spritelist[i].tile = 0; - m_oam_spritelist[i].x = 0; - m_oam_spritelist[i].y = 0; - m_oam_spritelist[i].size = 0; - m_oam_spritelist[i].vflip = 0; - m_oam_spritelist[i].hflip = 0; - m_oam_spritelist[i].priority_bits = 0; - m_oam_spritelist[i].pal = 0; - m_oam_spritelist[i].height = 0; - m_oam_spritelist[i].width = 0; + elem.tile = 0; + elem.x = 0; + elem.y = 0; + elem.size = 0; + elem.vflip = 0; + elem.hflip = 0; + elem.priority_bits = 0; + elem.pal = 0; + elem.height = 0; + elem.width = 0; } - for (int i = 0; i < ARRAY_LENGTH(m_oam_tilelist); i++) + for (auto & elem : m_oam_tilelist) { - m_oam_tilelist[i].x = 0; - m_oam_tilelist[i].priority = 0; - m_oam_tilelist[i].pal = 0; - m_oam_tilelist[i].tileaddr = 0; - m_oam_tilelist[i].hflip = 0; + elem.x = 0; + elem.priority = 0; + elem.pal = 0; + elem.tileaddr = 0; + elem.hflip = 0; } } diff --git a/src/devices/video/tms9928a.cpp b/src/devices/video/tms9928a.cpp index 7fd22263776..ba7a40a4b6e 100644 --- a/src/devices/video/tms9928a.cpp +++ b/src/devices/video/tms9928a.cpp @@ -709,8 +709,8 @@ void tms9928a_device::device_start() void tms9928a_device::device_reset() { - for ( int i = 0; i < 8; i++ ) - m_Regs[i] = 0; + for (auto & elem : m_Regs) + elem = 0; m_StatusReg = 0; m_FifthSprite = 31; diff --git a/src/devices/video/upd7220.cpp b/src/devices/video/upd7220.cpp index e80cef73745..cc892d66b33 100644 --- a/src/devices/video/upd7220.cpp +++ b/src/devices/video/upd7220.cpp @@ -653,9 +653,9 @@ upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, d m_ra[i] = 0; } - for (int i = 0; i < 17; i++) + for (auto & elem : m_pr) { - m_pr[i] = 0; + elem = 0; } memset(&m_figs, 0x00, sizeof(m_figs)); diff --git a/src/emu/dispatch.h b/src/emu/dispatch.h index 47e742c86b3..f9442a658da 100644 --- a/src/emu/dispatch.h +++ b/src/emu/dispatch.h @@ -40,8 +40,8 @@ public: template static devcb_base &set_fwd_cb(device_t &device, int entry, _Object object) { return downcast &>(device).fwd_cb[entry]->set_callback(object); } WRITE_LINE_MEMBER( in_w ) { - for(int i=0; iget_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/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp index 385ff326047..ff8cef2e08a 100644 --- a/src/lib/formats/ap_dsk35.cpp +++ b/src/lib/formats/ap_dsk35.cpp @@ -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/cassimg.cpp b/src/lib/formats/cassimg.cpp index aabc13ee393..7fe1bcec81b 100644 --- a/src/lib/formats/cassimg.cpp +++ b/src/lib/formats/cassimg.cpp @@ -278,8 +278,8 @@ 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); } } diff --git a/src/lib/formats/flopimg.cpp b/src/lib/formats/flopimg.cpp index fa10ab3e4a9..57281fcda0e 100644 --- a/src/lib/formats/flopimg.cpp +++ b/src/lib/formats/flopimg.cpp @@ -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; iadjust(period, 0, period); /* reset all the voices */ - for (int i = 0; i < 8; i++) + for (auto & elem : m_channel_list) { - voice = &m_channel_list[i]; + voice = &elem; voice->freq = 0; voice->pos = 0; diff --git a/src/mame/audio/lynx.cpp b/src/mame/audio/lynx.cpp index 2e17abde91f..ba31b88ba06 100644 --- a/src/mame/audio/lynx.cpp +++ b/src/mame/audio/lynx.cpp @@ -212,9 +212,9 @@ void lynx2_sound_device::device_start() void lynx_sound_device::device_reset() { - for (int i = 0; i < LYNX_AUDIO_CHANNELS; i++) + for (auto & elem : m_audio) { - reset_channel(&m_audio[i]); + reset_channel(&elem); } } diff --git a/src/mame/audio/mea8000.cpp b/src/mame/audio/mea8000.cpp index 6936205b79f..306fec1ac3e 100644 --- a/src/mame/audio/mea8000.cpp +++ b/src/mame/audio/mea8000.cpp @@ -174,10 +174,10 @@ void mea8000_device::device_reset() m_roe = 0; m_state = MEA8000_STOPPED; update_req(); - for (int i = 0; i < 4; i++) + for (auto & elem : m_f) { - m_f[i].last_output = 0; - m_f[i].output = 0; + elem.last_output = 0; + elem.output = 0; } } @@ -215,8 +215,8 @@ void mea8000_device::init_tables() m_exp_table[i] = exp(-M_PI * f) * QUANT; m_exp2_table[i] = exp(-2 * M_PI * f) * QUANT; } - for (int i = 0; i < NOISE_LEN; i++) - m_noise_table[i] = (machine().rand() % (2 * QUANT)) - QUANT; + for (auto & elem : m_noise_table) + elem = (machine().rand() % (2 * QUANT)) - QUANT; } @@ -371,10 +371,10 @@ int mea8000_device::compute_sample() void mea8000_device::shift_frame() { m_last_pitch = m_pitch; - for (int i = 0; i < 4; i++) + for (auto & elem : m_f) { - m_f[i].last_bw = m_f[i].bw; - m_f[i].last_fm = m_f[i].fm; + elem.last_bw = elem.bw; + elem.last_fm = elem.fm; } m_last_ampl = m_ampl; } diff --git a/src/mame/audio/turrett.cpp b/src/mame/audio/turrett.cpp index 69c8b784c3f..bb1fee907b4 100644 --- a/src/mame/audio/turrett.cpp +++ b/src/mame/audio/turrett.cpp @@ -69,8 +69,8 @@ void turrett_device::device_start() void turrett_device::device_reset() { - for (int ch = 0; ch < SOUND_CHANNELS; ++ch) - m_channels[ch].m_playing = false; + for (auto & elem : m_channels) + elem.m_playing = false; } diff --git a/src/mame/drivers/atarist.cpp b/src/mame/drivers/atarist.cpp index 46dcf99df03..053d68c4b61 100644 --- a/src/mame/drivers/atarist.cpp +++ b/src/mame/drivers/atarist.cpp @@ -760,9 +760,9 @@ void ste_state::dmasound_tick() { UINT8 *RAM = m_ram->pointer(); - for (int i = 0; i < 8; i++) + for (auto & elem : m_dmasnd_fifo) { - m_dmasnd_fifo[i] = RAM[m_dmasnd_cntr]; + elem = RAM[m_dmasnd_cntr]; m_dmasnd_cntr++; m_dmasnd_samples++; diff --git a/src/mame/drivers/bfm_sc45_helper.cpp b/src/mame/drivers/bfm_sc45_helper.cpp index 991f3894e59..264f9dbe71f 100644 --- a/src/mame/drivers/bfm_sc45_helper.cpp +++ b/src/mame/drivers/bfm_sc45_helper.cpp @@ -388,16 +388,16 @@ lampinfo lamps[16][16]; void set_clickable_temp(running_machine &machine, const std::string &teststring, int clickport, int clickmask) { - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { for (int x = 0; x < 16; x++) { - if (!strcmp(teststring.c_str(), lamps[y][x].lampname_alt.c_str())) + if (!strcmp(teststring.c_str(), lamp[x].lampname_alt.c_str())) { - lamps[y][x].clickport = clickport; - lamps[y][x].clickmask = clickmask; + lamp[x].clickport = clickport; + lamp[x].clickmask = clickmask; - lamps[y][x].lamptypename = "buttonlamp"; + lamp[x].lamptypename = "buttonlamp"; } } @@ -518,12 +518,12 @@ int find_lamp_strings(running_machine &machine) // layout elements for each of the text labels int d = 0; - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { //sc45helperlog("---ROW %02d---\n", y); for (int x = 0; x < 16; x++) { - sc45helperlog("\n", d, lamps[y][x].lampname.c_str()); + sc45helperlog("\n", d, lamp[x].lampname.c_str()); d++; } } @@ -589,17 +589,17 @@ int find_lamp_strings(running_machine &machine) // copy the button strings so we can modify some for easier comparisons d = 0; - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { for (int x = 0; x < 16; x++) { - lamps[y][x].lampname_alt = lamps[y][x].lampname; + lamp[x].lampname_alt = lamp[x].lampname; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "hold2/hi")) lamps[y][x].lampname_alt = "hold2"; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "hold3/lo")) lamps[y][x].lampname_alt = "hold3"; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "chg stake")) lamps[y][x].lampname_alt = "chnge stk"; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "canc/coll")) lamps[y][x].lampname_alt = "cancel"; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "start")) lamps[y][x].lampname_alt = "strt exch"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "hold2/hi")) lamp[x].lampname_alt = "hold2"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "hold3/lo")) lamp[x].lampname_alt = "hold3"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "chg stake")) lamp[x].lampname_alt = "chnge stk"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "canc/coll")) lamp[x].lampname_alt = "cancel"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "start")) lamp[x].lampname_alt = "strt exch"; } } @@ -623,20 +623,20 @@ int find_lamp_strings(running_machine &machine) if (pos == 2) sprintf(tempname2, "%sbot", tempname); - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { for (int x = 0; x < 16; x++) { - if (!strcmp(tempname2, lamps[y][x].lampname_alt.c_str())) + if (!strcmp(tempname2, lamp[x].lampname_alt.c_str())) { //sc45helperlog("%s found\n", tempname2); - lamps[y][x].draw_label = false; + lamp[x].draw_label = false; - lamps[y][x].x = 0 + (50 * reel); - lamps[y][x].y = 300 + (17 * pos); - lamps[y][x].width = 50; - lamps[y][x].height = 17; - lamps[y][x].lamptypename = "reellamp"; + lamp[x].x = 0 + (50 * reel); + lamp[x].y = 300 + (17 * pos); + lamp[x].width = 50; + lamp[x].height = 17; + lamp[x].lamptypename = "reellamp"; } @@ -676,17 +676,17 @@ int find_lamp_strings(running_machine &machine) // dump out basic matrix stuff in layout format d = 0; - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { //sc45helperlog("---ROW %02d---\n", y); for (int x = 0; x < 16; x++) { - if (lamps[y][x].clickport== -1) sc45helperlog("\n", d, lamps[y][x].lamptypename.c_str(), lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); - else sc45helperlog("\n", d, lamps[y][x].lamptypename.c_str(), lamps[y][x].clickport, lamps[y][x].clickmask, lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); + if (lamp[x].clickport== -1) sc45helperlog("\n", d, lamp[x].lamptypename.c_str(), lamp[x].x, lamp[x].y, lamp[x].width, lamp[x].height); + else sc45helperlog("\n", d, lamp[x].lamptypename.c_str(), lamp[x].clickport, lamp[x].clickmask, lamp[x].x, lamp[x].y, lamp[x].width, lamp[x].height); - if (lamps[y][x].draw_label == false) sc45helperlog("\n"); + if (lamp[x].draw_label == false) sc45helperlog("\n"); d++; } @@ -830,9 +830,9 @@ int find_reel_strings(running_machine &machine) int total_reel_symbols = 0; - for (unsigned int i = 0; i < reelsizes.size(); i++) + for (auto & reelsize : reelsizes) { - total_reel_symbols += reelsizes[i]; + total_reel_symbols += reelsize; } endblock = startblock + 4 * (total_reel_symbols); diff --git a/src/mame/drivers/esq1.cpp b/src/mame/drivers/esq1.cpp index b37f26185aa..4edb38303cf 100644 --- a/src/mame/drivers/esq1.cpp +++ b/src/mame/drivers/esq1.cpp @@ -332,8 +332,8 @@ void esq1_filters::device_start() { stream = stream_alloc(8, 2, 44100); memset(filters, 0, sizeof(filters)); - for(int i=0; i<8; i++) - recalc_filter(filters[i]); + for(auto & elem : filters) + recalc_filter(elem); } void esq1_filters::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) diff --git a/src/mame/drivers/famibox.cpp b/src/mame/drivers/famibox.cpp index 023cd64486b..6f93c9bb930 100644 --- a/src/mame/drivers/famibox.cpp +++ b/src/mame/drivers/famibox.cpp @@ -254,14 +254,14 @@ void famibox_state::famicombox_bankswitch(UINT8 bank) }; - for (int i = 0; i < ARRAY_LENGTH(famicombox_banks); i++ ) + for (auto & famicombox_bank : famicombox_banks) { - if ( bank == famicombox_banks[i].bank || - famicombox_banks[i].bank == 0 ) + if ( bank == famicombox_bank.bank || + famicombox_bank.bank == 0 ) { - membank("cpubank1")->set_base(memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank1_offset); - membank("cpubank2")->set_base(memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank2_offset); - membank("ppubank1")->set_base(memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].ppubank_offset); + membank("cpubank1")->set_base(memregion(famicombox_bank.memory_region)->base() + famicombox_bank.bank1_offset); + membank("cpubank2")->set_base(memregion(famicombox_bank.memory_region)->base() + famicombox_bank.bank2_offset); + membank("ppubank1")->set_base(memregion(famicombox_bank.memory_region)->base() + famicombox_bank.ppubank_offset); break; } } diff --git a/src/mame/drivers/hyperscan.cpp b/src/mame/drivers/hyperscan.cpp index baa1c767773..d5cc9d804e5 100644 --- a/src/mame/drivers/hyperscan.cpp +++ b/src/mame/drivers/hyperscan.cpp @@ -523,22 +523,22 @@ UINT32 hyperscan_state::spg290_screen_update(screen_device &screen, bitmap_rgb32 void hyperscan_state::spg290_timers_update() { - for(int i=0; i<6; i++) - if (m_timers[i].control & 0x80000000) + for(auto & elem : m_timers) + if (elem.control & 0x80000000) { - if (((m_timers[i].control2 >> 30) & 0x03) == 0x00) + if (((elem.control2 >> 30) & 0x03) == 0x00) { - if (m_timers[i].counter == 0xffff) + if (elem.counter == 0xffff) { - m_timers[i].counter = m_timers[i].preload; - if (m_timers[i].control & 0x08000000) + elem.counter = elem.preload; + if (elem.control & 0x08000000) { - m_timers[i].control |= 0x04000000; + elem.control |= 0x04000000; m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 56); } } else - m_timers[i].counter++; + elem.counter++; } else { diff --git a/src/mame/drivers/iq151.cpp b/src/mame/drivers/iq151.cpp index afee4573fcd..e4cbe4a504c 100644 --- a/src/mame/drivers/iq151.cpp +++ b/src/mame/drivers/iq151.cpp @@ -170,32 +170,32 @@ READ8_MEMBER(iq151_state::cartslot_r) { UINT8 data = 0xff; - for (int i=0; i<5; i++) - m_carts[i]->read(offset, data); + for (auto & elem : m_carts) + elem->read(offset, data); return data; } WRITE8_MEMBER(iq151_state::cartslot_w) { - for (int i=0; i<5; i++) - m_carts[i]->write(offset, data); + for (auto & elem : m_carts) + elem->write(offset, data); } READ8_MEMBER(iq151_state::cartslot_io_r) { UINT8 data = 0xff; - for (int i=0; i<5; i++) - m_carts[i]->io_read(offset, data); + for (auto & elem : m_carts) + elem->io_read(offset, data); return data; } WRITE8_MEMBER(iq151_state::cartslot_io_w) { - for (int i=0; i<5; i++) - m_carts[i]->io_write(offset, data); + for (auto & elem : m_carts) + elem->io_write(offset, data); } static ADDRESS_MAP_START(iq151_mem, AS_PROGRAM, 8, iq151_state) @@ -355,8 +355,8 @@ UINT32 iq151_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { bitmap.fill(0, cliprect); - for (int i=0; i<5; i++) - m_carts[i]->video_update(bitmap, cliprect); + for (auto & elem : m_carts) + elem->video_update(bitmap, cliprect); return 0; } diff --git a/src/mame/drivers/jack.cpp b/src/mame/drivers/jack.cpp index 01f1c88a2a7..952915820c1 100644 --- a/src/mame/drivers/jack.cpp +++ b/src/mame/drivers/jack.cpp @@ -878,8 +878,8 @@ MACHINE_RESET_MEMBER(jack_state,striv) m_question_address = 0; m_question_rom = 0; - for (int i = 0; i < 16; i++) - m_remap_address[i] = 0; + for (auto & elem : m_remap_address) + elem = 0; } diff --git a/src/mame/drivers/joystand.cpp b/src/mame/drivers/joystand.cpp index a9e4a9e097c..4a17628eae4 100644 --- a/src/mame/drivers/joystand.cpp +++ b/src/mame/drivers/joystand.cpp @@ -306,10 +306,10 @@ void joystand_state::video_start() m_bg1_tmap->set_transparent_pen(0xf); m_bg2_tmap->set_transparent_pen(0xf); - for (int i = 0; i < 2; ++i) + for (auto & elem : m_bg15_bitmap) { - m_bg15_bitmap[i].allocate(0x200, 0x200); - m_bg15_bitmap[i].fill(BG15_TRANSPARENT); + elem.allocate(0x200, 0x200); + elem.fill(BG15_TRANSPARENT); } bg15_tiles_dirty = true; diff --git a/src/mame/drivers/lethal.cpp b/src/mame/drivers/lethal.cpp index 59015da3704..30f82d8195c 100644 --- a/src/mame/drivers/lethal.cpp +++ b/src/mame/drivers/lethal.cpp @@ -481,8 +481,8 @@ void lethal_state::machine_start() void lethal_state::machine_reset() { - for (int i = 0; i < 4; i++) - m_layer_colorbase[i] = 0; + for (auto & elem : m_layer_colorbase) + elem = 0; m_sprite_colorbase = 0; m_back_colorbase = 0; diff --git a/src/mame/drivers/microvsn.cpp b/src/mame/drivers/microvsn.cpp index f82725bc43e..f15bfd8c0a6 100644 --- a/src/mame/drivers/microvsn.cpp +++ b/src/mame/drivers/microvsn.cpp @@ -163,16 +163,16 @@ MACHINE_START_MEMBER(microvision_state, microvision) MACHINE_RESET_MEMBER(microvision_state, microvision) { - for( int i = 0; i < 8; i++ ) + for(auto & elem : m_lcd_latch) { - m_lcd_latch[i] = 0; + elem = 0; } - for( int i = 0; i < 16; i++ ) + for(auto & elem : m_lcd) { for ( int j = 0; j < 16; j++ ) { - m_lcd[i][j] = 0; + elem[j] = 0; } } @@ -225,11 +225,11 @@ void microvision_state::update_lcd() { UINT16 temp = row; - for ( int j = 0; j < 16; j++ ) + for (auto & elem : m_lcd) { if ( ( temp & col ) & 0x8000 ) { - m_lcd[j][i] = 15; + elem[i] = 15; } temp <<= 1; } @@ -256,13 +256,13 @@ void microvision_state::screen_vblank(screen_device &screen, bool state) { if ( state ) { - for ( int i = 0; i < 16; i++ ) + for (auto & elem : m_lcd) { for ( int j= 0; j < 16; j++ ) { - if ( m_lcd[i][j] ) + if ( elem[j] ) { - m_lcd[i][j]--; + elem[j]--; } } } diff --git a/src/mame/drivers/monty.cpp b/src/mame/drivers/monty.cpp index 3ec54712777..0167938503b 100644 --- a/src/mame/drivers/monty.cpp +++ b/src/mame/drivers/monty.cpp @@ -44,8 +44,8 @@ public: , m_sed0(*this, "sed1520_0") , m_writeUpper(false) { - for (int i = 0; i < 42*32; i++) - m_pixels[i] = 0xff000000; + for (auto & elem : m_pixels) + elem = 0xff000000; } DECLARE_WRITE8_MEMBER(sound_w); diff --git a/src/mame/drivers/mz3500.cpp b/src/mame/drivers/mz3500.cpp index 8a5828e0401..9f480c08563 100644 --- a/src/mame/drivers/mz3500.cpp +++ b/src/mame/drivers/mz3500.cpp @@ -770,10 +770,10 @@ void mz3500_state::machine_reset() { m_fdd_sel = 0; { - for(int i=0;i<4;i++) + for(auto & elem : m_floppy_connector) { - m_floppy_connector[i]->get_device()->mon_w(ASSERT_LINE); - m_floppy_connector[i]->get_device()->set_rpm(300); + elem->get_device()->mon_w(ASSERT_LINE); + elem->get_device()->set_rpm(300); } machine().device("upd765a")->set_rate(250000); diff --git a/src/mame/drivers/nakajies.cpp b/src/mame/drivers/nakajies.cpp index 29b2ba35af8..bcf43ef4071 100644 --- a/src/mame/drivers/nakajies.cpp +++ b/src/mame/drivers/nakajies.cpp @@ -649,9 +649,9 @@ void nakajies_state::machine_reset() m_matrix = 0; /* Initialize banks */ - for ( int i = 0; i < 8; i++ ) + for (auto & elem : m_bank) { - m_bank[i] = 0; + elem = 0; } memset(m_ram_base, 0, m_ram_size); update_banks(); diff --git a/src/mame/drivers/namcoic.cpp b/src/mame/drivers/namcoic.cpp index 422756fb48f..1cc553b93eb 100644 --- a/src/mame/drivers/namcoic.cpp +++ b/src/mame/drivers/namcoic.cpp @@ -1165,8 +1165,8 @@ WRITE16_MEMBER( namcos2_shared_state::c169_roz_bank_w ) UINT16 old_data = m_c169_roz_bank[offset]; COMBINE_DATA(&m_c169_roz_bank[offset]); if (m_c169_roz_bank[offset] != old_data) - for (int i = 0; i < ROZ_TILEMAP_COUNT; i++) - m_c169_roz_tilemap[i]->mark_all_dirty(); + for (auto & elem : m_c169_roz_tilemap) + elem->mark_all_dirty(); } READ16_MEMBER( namcos2_shared_state::c169_roz_videoram_r ) @@ -1177,6 +1177,6 @@ READ16_MEMBER( namcos2_shared_state::c169_roz_videoram_r ) WRITE16_MEMBER( namcos2_shared_state::c169_roz_videoram_w ) { COMBINE_DATA(&m_c169_roz_videoram[offset]); - for (int i = 0; i < ROZ_TILEMAP_COUNT; i++) - m_c169_roz_tilemap[i]->mark_tile_dirty(offset); + for (auto & elem : m_c169_roz_tilemap) + elem->mark_tile_dirty(offset); } diff --git a/src/mame/drivers/namcos22.cpp b/src/mame/drivers/namcos22.cpp index cbc60e9fca9..64000211811 100644 --- a/src/mame/drivers/namcos22.cpp +++ b/src/mame/drivers/namcos22.cpp @@ -3874,8 +3874,8 @@ MACHINE_START_MEMBER(namcos22_state,adillor) { machine_start(); - for (int axis = 0; axis < 2; axis++) - m_ar_tb_interrupt[axis] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos22_state::adillor_trackball_interrupt),this)); + for (auto & elem : m_ar_tb_interrupt) + elem = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos22_state::adillor_trackball_interrupt),this)); } static MACHINE_CONFIG_DERIVED( adillor, namcos22s ) diff --git a/src/mame/drivers/pcfx.cpp b/src/mame/drivers/pcfx.cpp index d2faa292087..f80150959e6 100644 --- a/src/mame/drivers/pcfx.cpp +++ b/src/mame/drivers/pcfx.cpp @@ -380,13 +380,13 @@ inline void pcfx_state::check_irqs() UINT16 active_irqs = m_irq_pending & ~m_irq_mask; int highest_prio = -1; - for ( int i = 0; i < 8; i++ ) + for (auto & elem : m_irq_priority) { if ( active_irqs & 0x80 ) { - if ( m_irq_priority[i] >= highest_prio ) + if ( elem >= highest_prio ) { - highest_prio = m_irq_priority[i]; + highest_prio = elem; } } active_irqs <<= 1; diff --git a/src/mame/drivers/psikyo4.cpp b/src/mame/drivers/psikyo4.cpp index de33dbeb935..b1c04ab7ae8 100644 --- a/src/mame/drivers/psikyo4.cpp +++ b/src/mame/drivers/psikyo4.cpp @@ -296,13 +296,13 @@ WRITE32_MEMBER(psikyo4_state::io_select_w) { UINT32 bankdata = data >> 16; UINT32 bankmask = mem_mask >> 16; - for (int i = 0; i < 4; i++) + for (auto & elem : m_ymf_bank) { if (bankmask & 0x0f) { int banknum = bankdata & 0x0f; if (banknum < m_ymf_max_bank) - m_ymf_bank[i]->set_entry(banknum); + elem->set_entry(banknum); } bankdata >>= 4; bankmask >>= 4; diff --git a/src/mame/drivers/raiden2.cpp b/src/mame/drivers/raiden2.cpp index dce9db01f60..661f7fd9e27 100644 --- a/src/mame/drivers/raiden2.cpp +++ b/src/mame/drivers/raiden2.cpp @@ -2988,8 +2988,8 @@ const UINT16 raiden2_state::raiden_blended_colors[] = { void raiden2_state::init_blending(const UINT16 *table) { - for(int i=0; i<0x800; i++) - blend_active[i] = false; + for(auto & elem : blend_active) + elem = false; while(*table != 0xffff) blend_active[*table++] = true; } diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp index 8b26b9149b5..5758c0957c2 100644 --- a/src/mame/drivers/segaxbd.cpp +++ b/src/mame/drivers/segaxbd.cpp @@ -369,9 +369,9 @@ public: : segaxbd_new_state(mconfig, type, tag), m_subpcb(*this, "subpcb") { - for (int i = 0; i < 0x800; i++) + for (auto & elem : shareram) { - shareram[i] = 0x0000; + elem = 0x0000; } rampage1 = 0x0000; rampage2 = 0x0000; diff --git a/src/mame/drivers/stratos.cpp b/src/mame/drivers/stratos.cpp index 3af3d8ed6b8..733f62b979f 100644 --- a/src/mame/drivers/stratos.cpp +++ b/src/mame/drivers/stratos.cpp @@ -320,8 +320,8 @@ WRITE8_MEMBER(stratos_state::lcd_w) idx++; if(idx == 18*2) { logerror("lcd"); - for(int i=0; i<18; i++) - logerror(" %02x", vals[i]); + for(auto & val : vals) + logerror(" %02x", val); logerror("\n"); } } diff --git a/src/mame/drivers/subsino2.cpp b/src/mame/drivers/subsino2.cpp index a521bc00b92..fda484cd19e 100644 --- a/src/mame/drivers/subsino2.cpp +++ b/src/mame/drivers/subsino2.cpp @@ -712,9 +712,9 @@ UINT32 subsino2_state::screen_update_subsino2(screen_device &screen, bitmap_ind1 l->tmap->set_scroll_rows(1); l->tmap->set_scroll_cols(1); - for (int r = 0; r < 3; r++) + for (auto visible : m_ss9601_reelrects) { - rectangle visible = m_ss9601_reelrects[r]; + for (int x = 0; x < 0x40; x++) { diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp index 08daaa4d696..4cb0db32f25 100644 --- a/src/mame/drivers/x07.cpp +++ b/src/mame/drivers/x07.cpp @@ -156,8 +156,8 @@ void x07_state::t6834_cmd (UINT8 cmd) case 0x0c: //ALM$ write { - for(int i = 0; i < 8; i++) - m_alarm[i] = m_in.data[m_in.read++]; + for(auto & elem : m_alarm) + elem = m_in.data[m_in.read++]; } break; @@ -500,8 +500,8 @@ void x07_state::t6834_cmd (UINT8 cmd) case 0x36: //alarm read { - for(int i = 0; i < 8; i++) - m_out.data[m_out.write++] = m_alarm[i]; + for(auto & elem : m_alarm) + m_out.data[m_out.write++] = elem; } break; diff --git a/src/mame/includes/msx.h b/src/mame/includes/msx.h index c52d8d7bef7..ba8e3e6064f 100644 --- a/src/mame/includes/msx.h +++ b/src/mame/includes/msx.h @@ -159,9 +159,9 @@ public: } m_mouse[0] = m_mouse[1] = 0; m_mouse_stat[0] = m_mouse_stat[1] = 0; - for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) + for (auto & elem : m_irq_state) { - m_irq_state[i] = CLEAR_LINE; + elem = CLEAR_LINE; } } diff --git a/src/mame/includes/tandy2k.h b/src/mame/includes/tandy2k.h index 761d2f0cb37..e9949ad3443 100644 --- a/src/mame/includes/tandy2k.h +++ b/src/mame/includes/tandy2k.h @@ -96,9 +96,9 @@ public: m_centronics_perror(0), m_centronics_busy(0) { - for (int i = 0; i < 4; i++) + for (auto & elem : m_busdmarq) { - m_busdmarq[i] = CLEAR_LINE; + elem = CLEAR_LINE; } } diff --git a/src/mame/machine/315-5838_317-0229_comp.cpp b/src/mame/machine/315-5838_317-0229_comp.cpp index d7c33c5afad..cfd38aa7c88 100644 --- a/src/mame/machine/315-5838_317-0229_comp.cpp +++ b/src/mame/machine/315-5838_317-0229_comp.cpp @@ -49,24 +49,24 @@ sega_315_5838_comp_device::sega_315_5838_comp_device(const machine_config &mconf void sega_315_5838_comp_device::device_start() { - for (int i = 0; i < 2; i++) + for (auto & elem : m_channel) { - m_channel[i].m_decathlt_lastcount = 0; - m_channel[i].m_decathlt_prot_uploadmode = 0; - m_channel[i].m_decathlt_prot_uploadoffset = 0; - m_channel[i].m_read_ch.bind_relative_to(*owner()); + elem.m_decathlt_lastcount = 0; + elem.m_decathlt_prot_uploadmode = 0; + elem.m_decathlt_prot_uploadoffset = 0; + elem.m_read_ch.bind_relative_to(*owner()); } } void sega_315_5838_comp_device::device_reset() { - for (int i = 0; i < 2; i++) + for (auto & elem : m_channel) { - m_channel[i].m_srcoffset = 0; - m_channel[i].m_decathlt_lastcount = 0; - m_channel[i].m_decathlt_prot_uploadmode = 0; - m_channel[i].m_decathlt_prot_uploadoffset = 0; + elem.m_srcoffset = 0; + elem.m_decathlt_lastcount = 0; + elem.m_decathlt_prot_uploadmode = 0; + elem.m_decathlt_prot_uploadoffset = 0; } m_protstate = 0; diff --git a/src/mame/machine/315_5296.cpp b/src/mame/machine/315_5296.cpp index 18551b95f23..34aa0da1d22 100644 --- a/src/mame/machine/315_5296.cpp +++ b/src/mame/machine/315_5296.cpp @@ -105,8 +105,8 @@ void sega_315_5296_device::device_reset() for (int i = 0; i < 8; i++) (*m_out_port_cb[i])((offs_t)i, 0); - for (int i = 0; i < 3; i++) - (*m_out_cnt_cb[i])(0); + for (auto & elem : m_out_cnt_cb) + (*elem)(0); } diff --git a/src/mame/machine/asic65.cpp b/src/mame/machine/asic65.cpp index 5674adfd49e..3ad34f5e32a 100644 --- a/src/mame/machine/asic65.cpp +++ b/src/mame/machine/asic65.cpp @@ -102,9 +102,9 @@ asic65_device::asic65_device(const machine_config &mconfig, const char *tag, dev m_tdata(0), m_log(nullptr) { - for (int i = 0; i < 32; i++) + for (auto & elem : m_param) { - m_param[i] = 0; + elem = 0; } } diff --git a/src/mame/machine/balsente.cpp b/src/mame/machine/balsente.cpp index d9bde8cb7ae..8eceeffa417 100644 --- a/src/mame/machine/balsente.cpp +++ b/src/mame/machine/balsente.cpp @@ -925,8 +925,8 @@ WRITE8_MEMBER(balsente_state::balsente_counter_control_w) /* bit D0 enables/disables audio */ if (diff_counter_control & 0x01) { - for (int ch = 0; ch < 6; ch++) - m_cem_device[ch]->set_output_gain(0, (data & 0x01) ? 1.0 : 0); + for (auto & elem : m_cem_device) + elem->set_output_gain(0, (data & 0x01) ? 1.0 : 0); } /* bit D1 is hooked to counter 0's gate */ diff --git a/src/mame/machine/cdi070.cpp b/src/mame/machine/cdi070.cpp index 36b41333b7d..cc8f377d76a 100644 --- a/src/mame/machine/cdi070.cpp +++ b/src/mame/machine/cdi070.cpp @@ -426,9 +426,9 @@ void cdi68070_device::mcu_frame() { quizard_calculate_state(); uart_rx(0x5a); - for(int index = 0; index < 8; index++) + for(auto & elem : m_state) { - uart_rx(m_state[index]); + uart_rx(elem); } } } diff --git a/src/mame/machine/cdislave.cpp b/src/mame/machine/cdislave.cpp index fea5c7ef2ac..ac9d4fe706f 100644 --- a/src/mame/machine/cdislave.cpp +++ b/src/mame/machine/cdislave.cpp @@ -484,15 +484,15 @@ void cdislave_device::device_start() void cdislave_device::device_reset() { - for(INT32 index = 0; index < 4; index++) + for(auto & elem : m_channel) { - m_channel[index].m_out_buf[0] = 0; - m_channel[index].m_out_buf[1] = 0; - m_channel[index].m_out_buf[2] = 0; - m_channel[index].m_out_buf[3] = 0; - m_channel[index].m_out_index = 0; - m_channel[index].m_out_count = 0; - m_channel[index].m_out_cmd = 0; + elem.m_out_buf[0] = 0; + elem.m_out_buf[1] = 0; + elem.m_out_buf[2] = 0; + elem.m_out_buf[3] = 0; + elem.m_out_index = 0; + elem.m_out_count = 0; + elem.m_out_cmd = 0; } memset(m_in_buf, 0, 17); diff --git a/src/mame/machine/decocass_tape.cpp b/src/mame/machine/decocass_tape.cpp index 48c9fd310ee..8b3f2785032 100644 --- a/src/mame/machine/decocass_tape.cpp +++ b/src/mame/machine/decocass_tape.cpp @@ -67,8 +67,8 @@ decocass_tape_device::decocass_tape_device(const machine_config &mconfig, const m_clockpos(0), m_numclocks(0) { - for (int i = 0; i < 256; i++) - m_crc16[i] = 0; + for (auto & elem : m_crc16) + elem = 0; } //------------------------------------------------- diff --git a/src/mame/machine/fd1094.cpp b/src/mame/machine/fd1094.cpp index 4d0992ef30e..6fb0f8b866e 100644 --- a/src/mame/machine/fd1094.cpp +++ b/src/mame/machine/fd1094.cpp @@ -500,8 +500,8 @@ fd1094_decryption_cache::fd1094_decryption_cache(fd1094_device &fd1094) void fd1094_decryption_cache::reset() { // reset all allocated cache buffers - for (int cache = 0; cache < 256; cache++) - m_decrypted_opcodes[cache].clear(); + for (auto & elem : m_decrypted_opcodes) + elem.clear(); } @@ -570,9 +570,9 @@ fd1094_device::fd1094_device(const machine_config &mconfig, const char *tag, dev // create the initial masked opcode table memset(m_masked_opcodes_lookup, 0, sizeof(m_masked_opcodes_lookup)); - for (int index = 0; index < ARRAY_LENGTH(s_masked_opcodes); index++) + for (auto opcode : s_masked_opcodes) { - UINT16 opcode = s_masked_opcodes[index]; + m_masked_opcodes_lookup[0][opcode >> 4] |= 1 << ((opcode >> 1) & 7); m_masked_opcodes_lookup[1][opcode >> 4] |= 1 << ((opcode >> 1) & 7); } diff --git a/src/mame/machine/gb.cpp b/src/mame/machine/gb.cpp index 187cea04d72..3b77d56b403 100644 --- a/src/mame/machine/gb.cpp +++ b/src/mame/machine/gb.cpp @@ -226,8 +226,8 @@ MACHINE_RESET_MEMBER(gb_state,gbc) /* Enable BIOS rom */ m_bios_disable = 0; - for (int i = 0; i < 8; i++) - memset(m_gbc_rammap[i], 0, 0x1000); + for (auto & elem : m_gbc_rammap) + memset(elem, 0, 0x1000); } MACHINE_RESET_MEMBER(gb_state,sgb) diff --git a/src/mame/machine/kc.cpp b/src/mame/machine/kc.cpp index 1f8c0d95ed2..d4374e31c45 100644 --- a/src/mame/machine/kc.cpp +++ b/src/mame/machine/kc.cpp @@ -84,8 +84,8 @@ READ8_MEMBER( kc_state::expansion_read ) // assert MEI line of first slot m_expansions[0]->mei_w(ASSERT_LINE); - for (int i=0; i<3; i++) - m_expansions[i]->read(offset, result); + for (auto & elem : m_expansions) + elem->read(offset, result); return result; } @@ -95,8 +95,8 @@ WRITE8_MEMBER( kc_state::expansion_write ) // assert MEI line of first slot m_expansions[0]->mei_w(ASSERT_LINE); - for (int i=0; i<3; i++) - m_expansions[i]->write(offset, data); + for (auto & elem : m_expansions) + elem->write(offset, data); } /* @@ -129,8 +129,8 @@ READ8_MEMBER( kc_state::expansion_io_read ) } else { - for (int i=0; i<3; i++) - m_expansions[i]->io_read(offset, result); + for (auto & elem : m_expansions) + elem->io_read(offset, result); } return result; @@ -152,8 +152,8 @@ WRITE8_MEMBER( kc_state::expansion_io_write ) } else { - for (int i=0; i<3; i++) - m_expansions[i]->io_write(offset, data); + for (auto & elem : m_expansions) + elem->io_write(offset, data); } } diff --git a/src/mame/machine/megacdcd.cpp b/src/mame/machine/megacdcd.cpp index 54c7d3c81a2..0fd65a3d2c0 100644 --- a/src/mame/machine/megacdcd.cpp +++ b/src/mame/machine/megacdcd.cpp @@ -23,10 +23,10 @@ lc89510_temp_device::lc89510_temp_device(const machine_config &mconfig, const ch is_neoCD = false; nff0002 = 0; - for (int i=0;i<10;i++) - CDD_TX[i] = 0; - for (int i=0;i<10;i++) - CDD_RX[i] = 0; + for (auto & elem : CDD_TX) + elem = 0; + for (auto & elem : CDD_RX) + elem = 0; NeoCDCommsWordCount = 0; NeoCD_StatusHack = 0; SCD_CURLBA = 0; diff --git a/src/mame/machine/micropolis.cpp b/src/mame/machine/micropolis.cpp index 9cf03159e18..a42c692718c 100644 --- a/src/mame/machine/micropolis.cpp +++ b/src/mame/machine/micropolis.cpp @@ -82,11 +82,11 @@ micropolis_device::micropolis_device(const machine_config &mconfig, const char * m_sector_length(0), m_drive(nullptr) { - for (int i = 0; i < 6144; i++) - m_buffer[i] = 0; + for (auto & elem : m_buffer) + elem = 0; - for (int i = 0; i < 4; i++) - m_floppy_drive_tags[i] = nullptr; + for (auto & elem : m_floppy_drive_tags) + elem = nullptr; } //------------------------------------------------- @@ -118,11 +118,11 @@ void micropolis_device::device_start() void micropolis_device::device_reset() { - for (int i = 0; i < 4; i++) + for (auto & elem : m_floppy_drive_tags) { - if (m_floppy_drive_tags[i]) + if (elem) { - legacy_floppy_image_device *img = siblingdevice(m_floppy_drive_tags[i]); + legacy_floppy_image_device *img = siblingdevice(elem); if (img) { diff --git a/src/mame/machine/model3.cpp b/src/mame/machine/model3.cpp index 12826528efe..1cfb25e48f8 100644 --- a/src/mame/machine/model3.cpp +++ b/src/mame/machine/model3.cpp @@ -154,9 +154,9 @@ void model3_state::tap_write(int tck, int tms, int tdi, int trst) if (m_ir == U64(0x000023fffffffffe)) { - for (int i=0; i < 32; i++) + for (auto & elem : m_id_data) { - m_id_data[i] = 0; + elem = 0; } m_id_size = 41; @@ -237,9 +237,9 @@ void model3_state::tap_set_asic_ids() * data on TAP reset and when the instruction is issued. */ - for (int i=0; i < 32; i++) + for (auto & elem : m_id_data) { - m_id_data[i] = 0; + elem = 0; } if (m_m3_step == 0x10) diff --git a/src/mame/machine/msx.cpp b/src/mame/machine/msx.cpp index 11402a50c40..b881ad38d4d 100644 --- a/src/mame/machine/msx.cpp +++ b/src/mame/machine/msx.cpp @@ -31,9 +31,9 @@ void msx_state::check_irq() { int state = CLEAR_LINE; - for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) + for (auto & elem : m_irq_state) { - if (m_irq_state[i] != CLEAR_LINE) + if (elem != CLEAR_LINE) { state = ASSERT_LINE; } @@ -47,9 +47,9 @@ void msx_state::machine_reset() { msx_memory_reset (); msx_memory_map_all (); - for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) + for (auto & elem : m_irq_state) { - m_irq_state[i] = CLEAR_LINE; + elem = CLEAR_LINE; } check_irq(); } @@ -401,15 +401,15 @@ void msx_state::msx_memory_init() int count_populated_pages = 0; // Populate all unpopulated slots with the dummy interface - for ( int prim = 0; prim < 4; prim++ ) + for (auto & elem : m_all_slots) { for ( int sec = 0; sec < 4; sec++ ) { for ( int page = 0; page < 4; page++ ) { - if ( m_all_slots[prim][sec][page] == nullptr ) + if ( elem[sec][page] == nullptr ) { - m_all_slots[prim][sec][page] = &m_empty_slot; + elem[sec][page] = &m_empty_slot; } else { @@ -428,9 +428,9 @@ void msx_state::msx_memory_reset () { m_primary_slot = 0; - for (int prim=0; prim<4; prim++) + for (auto & elem : m_secondary_slot) { - m_secondary_slot[prim] = 0; + elem = 0; } } diff --git a/src/mame/machine/namcoio.cpp b/src/mame/machine/namcoio.cpp index b8fb22fef40..4ac534279ce 100644 --- a/src/mame/machine/namcoio.cpp +++ b/src/mame/machine/namcoio.cpp @@ -181,8 +181,8 @@ void namcoio_device::device_start() void namcoio_device::device_reset() { - for (int i = 0; i < 16; i++) - m_ram[i] = 0; + for (auto & elem : m_ram) + elem = 0; set_reset_line(PULSE_LINE); } diff --git a/src/mame/machine/naomim1.cpp b/src/mame/machine/naomim1.cpp index 5b16f278fb7..c9e5bc1c359 100644 --- a/src/mame/machine/naomim1.cpp +++ b/src/mame/machine/naomim1.cpp @@ -159,8 +159,8 @@ void naomi_m1_board::enc_reset() has_history = false; buffer_actual_size = 0; - for(int i=0; i<111; i++) - dict[i] = getb(8); + for(auto & elem : dict) + elem = getb(8); } void naomi_m1_board::wb(UINT8 byte) diff --git a/src/mame/machine/pce.cpp b/src/mame/machine/pce.cpp index 6aeba853933..ad5d712367c 100644 --- a/src/mame/machine/pce.cpp +++ b/src/mame/machine/pce.cpp @@ -110,8 +110,8 @@ MACHINE_START_MEMBER(pce_state,pce) MACHINE_RESET_MEMBER(pce_state,mess_pce) { - for (int joy_i = 0; joy_i < 5; joy_i++) - m_joy_6b_packet[joy_i] = 0; + for (auto & elem : m_joy_6b_packet) + elem = 0; /* Note: Arcade Card BIOS contents are the same as System 3, only internal HW differs. We use a category to select between modes (some games can be run in either S-CD or A-CD modes) */ diff --git a/src/mame/machine/pgmprot_igs027a_type1.cpp b/src/mame/machine/pgmprot_igs027a_type1.cpp index 096d1135c2b..84b7bfc5de6 100644 --- a/src/mame/machine/pgmprot_igs027a_type1.cpp +++ b/src/mame/machine/pgmprot_igs027a_type1.cpp @@ -881,9 +881,9 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc) m_valueresponse = 0x36<<16; // clear the return structure - for (int columns=0;columns<8;columns++) + for (auto & elem : level_structure) for (int rows=0;rows<10;rows++) - level_structure[columns][rows] = 0x0000; + elem[rows] = 0x0000; break; diff --git a/src/mame/machine/pgmprot_igs027a_type3.cpp b/src/mame/machine/pgmprot_igs027a_type3.cpp index 8faa5fc4432..24fc0c19ccd 100644 --- a/src/mame/machine/pgmprot_igs027a_type3.cpp +++ b/src/mame/machine/pgmprot_igs027a_type3.cpp @@ -566,10 +566,10 @@ void pgm_arm_type3_state::pgm_patch_external_arm_rom_jumptable_theglada(int base */ - for (int i = 0; i < 131; i++) + for (auto & subroutine_addresse : subroutine_addresses) { // UINT32 addr = extprot[(base/2)] | (extprot[(base/2) + 1] << 16); - extprot[(base / 2)] = subroutine_addresses[i]; + extprot[(base / 2)] = subroutine_addresse; base += 4; // printf("%04x (%08x)\n", subroutine_addresses[i], addr ); diff --git a/src/mame/machine/rx01.cpp b/src/mame/machine/rx01.cpp index c1889eb6a8b..b4cb85869ea 100644 --- a/src/mame/machine/rx01.cpp +++ b/src/mame/machine/rx01.cpp @@ -80,11 +80,11 @@ void rx01_device::device_start() void rx01_device::device_reset() { - for(int i=0;i<2;i++) + for(auto & elem : m_image) { - m_image[i]->floppy_mon_w(0); // turn it on - m_image[i]->floppy_drive_set_controller(this); - m_image[i]->floppy_drive_set_rpm(360.); + elem->floppy_mon_w(0); // turn it on + elem->floppy_drive_set_controller(this); + elem->floppy_drive_set_rpm(360.); } m_rxes = 0; m_rxcs = 0; diff --git a/src/mame/machine/segaic16.cpp b/src/mame/machine/segaic16.cpp index ee171e9af70..3d807412a56 100644 --- a/src/mame/machine/segaic16.cpp +++ b/src/mame/machine/segaic16.cpp @@ -487,8 +487,8 @@ void sega_315_5195_mapper_device::configure_explicit(const UINT8 *map_data) void sega_315_5195_mapper_device::fd1094_state_change(UINT8 state) { // iterate over regions and set the decrypted address of any ROM banks - for (int index = 0; index < ARRAY_LENGTH(m_banks); index++) - m_banks[index].update(); + for (auto & elem : m_banks) + elem.update(); } @@ -511,16 +511,16 @@ void sega_315_5195_mapper_device::device_start() // if we are mapping an FD1089, tell all the banks fd1089_base_device *fd1089 = dynamic_cast(m_cpu); if (fd1089 != nullptr) - for (int banknum = 0; banknum < ARRAY_LENGTH(m_banks); banknum++) - m_banks[banknum].set_decrypt(fd1089); + for (auto & elem : m_banks) + elem.set_decrypt(fd1089); // if we are mapping an FD1094, register for state change notifications and tell all the banks fd1094_device *fd1094 = dynamic_cast(m_cpu); if (fd1094 != nullptr) { fd1094->notify_state_change(fd1094_device::state_change_delegate(FUNC(sega_315_5195_mapper_device::fd1094_state_change), this)); - for (int banknum = 0; banknum < ARRAY_LENGTH(m_banks); banknum++) - m_banks[banknum].set_decrypt(fd1094); + for (auto & elem : m_banks) + elem.set_decrypt(fd1094); } // find the address space that is to be mapped diff --git a/src/mame/machine/snes.cpp b/src/mame/machine/snes.cpp index 30b125f94fa..9c4253906e2 100644 --- a/src/mame/machine/snes.cpp +++ b/src/mame/machine/snes.cpp @@ -1123,17 +1123,17 @@ void snes_state::machine_reset() snes_init_ram(); /* init DMA regs to be 0xff */ - for (int i = 0; i < 8; i++) + for (auto & elem : m_dma_channel) { - m_dma_channel[i].dmap = 0xff; - m_dma_channel[i].dest_addr = 0xff; - m_dma_channel[i].src_addr = 0xffff; - m_dma_channel[i].bank = 0xff; - m_dma_channel[i].trans_size = 0xffff; - m_dma_channel[i].ibank = 0xff; - m_dma_channel[i].hdma_addr = 0xffff; - m_dma_channel[i].hdma_line_counter = 0xff; - m_dma_channel[i].unk = 0xff; + elem.dmap = 0xff; + elem.dest_addr = 0xff; + elem.src_addr = 0xffff; + elem.bank = 0xff; + elem.trans_size = 0xffff; + elem.ibank = 0xff; + elem.hdma_addr = 0xffff; + elem.hdma_line_counter = 0xff; + elem.unk = 0xff; } /* Set STAT78 to NTSC or PAL */ diff --git a/src/mame/machine/st0016.cpp b/src/mame/machine/st0016.cpp index 3abdc4eafaf..08959876e99 100644 --- a/src/mame/machine/st0016.cpp +++ b/src/mame/machine/st0016.cpp @@ -49,8 +49,8 @@ st0016_cpu_device::st0016_cpu_device(const machine_config &mconfig, const char * m_palette(*this, "palette") { - for (int i = 0; i < 0xc0; i++) - st0016_vregs[i] = 0; + for (auto & elem : st0016_vregs) + elem = 0; } diff --git a/src/mame/machine/tait8741.cpp b/src/mame/machine/tait8741.cpp index 58df20ca4ed..5e568fbd6f1 100644 --- a/src/mame/machine/tait8741.cpp +++ b/src/mame/machine/tait8741.cpp @@ -381,15 +381,15 @@ void josvolly8741_4pack_device::device_reset() { m_nmi_enable = 0; - for(int i=0;i<4;i++) + for(auto & elem : m_i8741) { - m_i8741[i].cmd = 0; - m_i8741[i].sts = 0; // 0xf0; /* init flag */ - m_i8741[i].txd = 0; - m_i8741[i].outport = 0xff; - m_i8741[i].rxd = 0; + elem.cmd = 0; + elem.sts = 0; // 0xf0; /* init flag */ + elem.txd = 0; + elem.outport = 0xff; + elem.rxd = 0; - m_i8741[i].rst = 1; + elem.rst = 1; } } diff --git a/src/mame/machine/taitoio.cpp b/src/mame/machine/taitoio.cpp index 4b15fa06932..6d2bcadd9b0 100644 --- a/src/mame/machine/taitoio.cpp +++ b/src/mame/machine/taitoio.cpp @@ -90,8 +90,8 @@ void tc0220ioc_device::device_reset() { m_port = 0; - for (int i = 0; i < 8; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } /***************************************************************************** @@ -213,8 +213,8 @@ void tc0510nio_device::device_start() void tc0510nio_device::device_reset() { - for (int i = 0; i < 8; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } /***************************************************************************** @@ -340,8 +340,8 @@ void tc0640fio_device::device_start() void tc0640fio_device::device_reset() { - for (int i = 0; i < 8; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } diff --git a/src/mame/machine/vectrex.cpp b/src/mame/machine/vectrex.cpp index ca64a1cd23c..4959c3de5f1 100644 --- a/src/mame/machine/vectrex.cpp +++ b/src/mame/machine/vectrex.cpp @@ -306,8 +306,8 @@ DRIVER_INIT_MEMBER(vectrex_state,vectrex) { m_imager_angles = unknown_game_angles; m_beam_color = rgb_t::white; - for (int i = 0; i < ARRAY_LENGTH(m_imager_colors); i++) - m_imager_colors[i] = rgb_t::white; + for (auto & elem : m_imager_colors) + elem = rgb_t::white; /* * Minestorm's PRNG doesn't work with a 0 seed (mines in the first diff --git a/src/mame/video/abc806.cpp b/src/mame/video/abc806.cpp index f958b025b1c..4e8ff8ba854 100644 --- a/src/mame/video/abc806.cpp +++ b/src/mame/video/abc806.cpp @@ -413,9 +413,9 @@ void abc806_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) void abc806_state::video_start() { // initialize variables - for (int i = 0; i < 16; i++) + for (auto & elem : m_hrc) { - m_hrc[i] = 0; + elem = 0; } m_sync = 10; diff --git a/src/mame/video/antic.cpp b/src/mame/video/antic.cpp index 1a8979abf6a..b01b7ba259e 100644 --- a/src/mame/video/antic.cpp +++ b/src/mame/video/antic.cpp @@ -96,8 +96,8 @@ void antic_device::device_start() LOG(("atari cclk_init\n")); cclk_init(); - for (int i = 0; i < 64; i++) - m_prio_table[i] = auto_alloc_array_clear(machine(), UINT8, 8*256); + for (auto & elem : m_prio_table) + elem = auto_alloc_array_clear(machine(), UINT8, 8*256); LOG(("atari prio_init\n")); prio_init(); diff --git a/src/mame/video/bfm_dm01.cpp b/src/mame/video/bfm_dm01.cpp index 4c9f8e31825..19911ee5654 100644 --- a/src/mame/video/bfm_dm01.cpp +++ b/src/mame/video/bfm_dm01.cpp @@ -62,11 +62,11 @@ bfmdm01_device::bfmdm01_device(const machine_config &mconfig, const char *tag, d m_comdata(0), m_busy_cb(*this) { - for (int i = 0; i < 65; i++) - m_segbuffer[i] = 0; + for (auto & elem : m_segbuffer) + elem = 0; - for (int i = 0; i < DM_BYTESPERROW; i++) - m_scanline[i] = 0; + for (auto & elem : m_scanline) + elem = 0; } //------------------------------------------------- diff --git a/src/mame/video/chihiro.cpp b/src/mame/video/chihiro.cpp index 5aa59cf0493..8e59ed253a9 100644 --- a/src/mame/video/chihiro.cpp +++ b/src/mame/video/chihiro.cpp @@ -433,8 +433,8 @@ int vertex_program_disassembler::disassemble(unsigned int *instruction, char *li vertex_program_simulator::vertex_program_simulator() { - for (int i = 0; i < 256; i++) - op[i].modified = 0; + for (auto & elem : op) + elem.modified = 0; initialize_constants(); } @@ -674,17 +674,17 @@ void vertex_program_simulator::initialize_outputs() void vertex_program_simulator::initialize_temps() { - for (int n = 0; n < 32; n++) { + for (auto & elem : r_temp) { for (int m = 0; m < 4; m++) - r_temp[n].fv[m] = 0; + elem.fv[m] = 0; } } void vertex_program_simulator::initialize_constants() { - for (int n = 0; n < 192; n++) { + for (auto & elem : c_constant) { for (int m = 0; m < 4;m++) - c_constant[n].fv[m] = 0; + elem.fv[m] = 0; } } diff --git a/src/mame/video/gauntlet.cpp b/src/mame/video/gauntlet.cpp index 0d7120a627b..c9430f4f0ef 100644 --- a/src/mame/video/gauntlet.cpp +++ b/src/mame/video/gauntlet.cpp @@ -83,8 +83,8 @@ VIDEO_START_MEMBER(gauntlet_state,gauntlet) { /* modify the motion object code lookup table to account for the code XOR */ std::vector &codelookup = m_mob->code_lookup(); - for (unsigned int i = 0; i < codelookup.size(); i++) - codelookup[i] ^= 0x800; + for (auto & elem : codelookup) + elem ^= 0x800; /* set up the base color for the playfield */ m_playfield_color_bank = m_vindctr2_screen_refresh ? 0 : 1; diff --git a/src/mame/video/hng64.cpp b/src/mame/video/hng64.cpp index 01a5709085c..ac7084687b6 100644 --- a/src/mame/video/hng64.cpp +++ b/src/mame/video/hng64.cpp @@ -1274,11 +1274,11 @@ void hng64_state::video_start() m_tilemap[3].m_tilemap_16x16 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(hng64_state::get_hng64_tile3_16x16_info),this), TILEMAP_SCAN_ROWS, 16, 16, 128, 128); /* 128x128x4 = 0x10000 */ m_tilemap[3].m_tilemap_16x16_alt = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(hng64_state::get_hng64_tile3_16x16_info),this), TILEMAP_SCAN_ROWS, 16, 16, 256, 64); /* 128x128x4 = 0x10000 */ - for (int i = 0; i < 4; i++) + for (auto & elem : m_tilemap) { - m_tilemap[i].m_tilemap_8x8->set_transparent_pen(0); - m_tilemap[i].m_tilemap_16x16->set_transparent_pen(0); - m_tilemap[i].m_tilemap_16x16_alt->set_transparent_pen(0); + elem.m_tilemap_8x8->set_transparent_pen(0); + elem.m_tilemap_16x16->set_transparent_pen(0); + elem.m_tilemap_16x16_alt->set_transparent_pen(0); } // Debug switch, turn on / off additive blending on a per-tilemap basis diff --git a/src/mame/video/k053244_k053245.cpp b/src/mame/video/k053244_k053245.cpp index 23227fede07..8596af1ce54 100644 --- a/src/mame/video/k053244_k053245.cpp +++ b/src/mame/video/k053244_k053245.cpp @@ -152,8 +152,8 @@ void k05324x_device::device_reset() { m_rombank = 0; - for (int i = 0; i < 0x10; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } /***************************************************************************** diff --git a/src/mame/video/k053246_k053247_k055673.cpp b/src/mame/video/k053246_k053247_k055673.cpp index 27636d19001..b97fc461e63 100644 --- a/src/mame/video/k053246_k053247_k055673.cpp +++ b/src/mame/video/k053246_k053247_k055673.cpp @@ -52,11 +52,11 @@ void k053247_device::clear_all() m_ram = nullptr; m_gfx = nullptr; - for (int i=0;i<8;i++) - m_kx46_regs[i] = 0; + for (auto & elem : m_kx46_regs) + elem = 0; - for (int i=0;i<16;i++) - m_kx47_regs[i] = 0; + for (auto & elem : m_kx47_regs) + elem = 0; m_objcha_line = 0; m_z_rejection = 0; diff --git a/src/mame/video/k057714.cpp b/src/mame/video/k057714.cpp index 2ab8685cf56..405f0e722c2 100644 --- a/src/mame/video/k057714.cpp +++ b/src/mame/video/k057714.cpp @@ -35,11 +35,11 @@ void k057714_device::device_reset() m_vram_fifo0_addr = 0; m_vram_fifo1_addr = 0; - for (int i=0; i < 4; i++) + for (auto & elem : m_frame) { - m_frame[i].base = 0; - m_frame[i].width = 0; - m_frame[i].height = 0; + elem.base = 0; + elem.width = 0; + elem.height = 0; } } diff --git a/src/mame/video/kaneko16.cpp b/src/mame/video/kaneko16.cpp index 18d1e602511..47dc6e209d9 100644 --- a/src/mame/video/kaneko16.cpp +++ b/src/mame/video/kaneko16.cpp @@ -116,8 +116,8 @@ VIDEO_START_MEMBER(kaneko16_berlwall_state,berlwall) /* Render the hi-color static backgrounds held in the ROMs */ - for (int screen = 0; screen < 32; screen++) - m_bg15_bitmap[screen].allocate(256, 256); + for (auto & elem : m_bg15_bitmap) + elem.allocate(256, 256); /* 8aba is used as background color diff --git a/src/mame/video/maria.cpp b/src/mame/video/maria.cpp index b2514770e82..a5501989e4b 100644 --- a/src/mame/video/maria.cpp +++ b/src/mame/video/maria.cpp @@ -93,12 +93,12 @@ void atari_maria_device::device_start() void atari_maria_device::device_reset() { - for (int i = 0; i < 32; i++) - m_maria_palette[i] = 0; + for (auto & elem : m_maria_palette) + elem = 0; - for (int i = 0; i < 2; i++) + for (auto & elem : m_line_ram) for (int j = 0; j < 160; j++) - m_line_ram[i][j] = 0; + elem[j] = 0; m_active_buffer = 0; diff --git a/src/mame/video/mcd212.cpp b/src/mame/video/mcd212.cpp index 5476e0a5030..aec55056c8f 100644 --- a/src/mame/video/mcd212.cpp +++ b/src/mame/video/mcd212.cpp @@ -1470,37 +1470,37 @@ TIMER_CALLBACK_MEMBER( mcd212_device::perform_scan ) void mcd212_device::device_reset() { - for(int index = 0; index < 2; index++) + for(auto & elem : m_channel) { - m_channel[index].csrr = 0; - m_channel[index].csrw = 0; - m_channel[index].dcr = 0; - m_channel[index].vsr = 0; - m_channel[index].ddr = 0; - m_channel[index].dcp = 0; - m_channel[index].dca = 0; - memset(m_channel[index].clut_r, 0, 256); - memset(m_channel[index].clut_g, 0, 256); - memset(m_channel[index].clut_b, 0, 256); - m_channel[index].image_coding_method = 0; - m_channel[index].transparency_control = 0; - m_channel[index].plane_order = 0; - m_channel[index].clut_bank = 0; - m_channel[index].transparent_color_a = 0; - m_channel[index].transparent_color_b = 0; - m_channel[index].mask_color_a = 0; - m_channel[index].mask_color_b = 0; - m_channel[index].dyuv_abs_start_a = 0; - m_channel[index].dyuv_abs_start_b = 0; - m_channel[index].cursor_position = 0; - m_channel[index].cursor_control = 0; - memset((UINT8*)&m_channel[index].cursor_pattern, 0, 16 * sizeof(UINT32)); - memset((UINT8*)&m_channel[index].region_control, 0, 8 * sizeof(UINT32)); - m_channel[index].backdrop_color = 0; - m_channel[index].mosaic_hold_a = 0; - m_channel[index].mosaic_hold_b = 0; - memset(m_channel[index].weight_factor_a, 0, 768); - memset(m_channel[index].weight_factor_b, 0, 768); + elem.csrr = 0; + elem.csrw = 0; + elem.dcr = 0; + elem.vsr = 0; + elem.ddr = 0; + elem.dcp = 0; + elem.dca = 0; + memset(elem.clut_r, 0, 256); + memset(elem.clut_g, 0, 256); + memset(elem.clut_b, 0, 256); + elem.image_coding_method = 0; + elem.transparency_control = 0; + elem.plane_order = 0; + elem.clut_bank = 0; + elem.transparent_color_a = 0; + elem.transparent_color_b = 0; + elem.mask_color_a = 0; + elem.mask_color_b = 0; + elem.dyuv_abs_start_a = 0; + elem.dyuv_abs_start_b = 0; + elem.cursor_position = 0; + elem.cursor_control = 0; + memset((UINT8*)&elem.cursor_pattern, 0, 16 * sizeof(UINT32)); + memset((UINT8*)&elem.region_control, 0, 8 * sizeof(UINT32)); + elem.backdrop_color = 0; + elem.mosaic_hold_a = 0; + elem.mosaic_hold_b = 0; + memset(elem.weight_factor_a, 0, 768); + memset(elem.weight_factor_b, 0, 768); } memset(m_region_flag_0, 0, 768); memset(m_region_flag_1, 0, 768); diff --git a/src/mame/video/nemesis.cpp b/src/mame/video/nemesis.cpp index f5b15c30794..191f5e20d59 100644 --- a/src/mame/video/nemesis.cpp +++ b/src/mame/video/nemesis.cpp @@ -188,8 +188,8 @@ void nemesis_state::create_palette_lookups() // normalize black/white levels double black = m_palette_lookup[0]; double white = 255.0 / (m_palette_lookup[31] - black); - for (int i = 0; i < 32; i++) - m_palette_lookup[i] = (m_palette_lookup[i] - black) * white + 0.5; + for (auto & elem : m_palette_lookup) + elem = (elem - black) * white + 0.5; } diff --git a/src/mame/video/pc080sn.cpp b/src/mame/video/pc080sn.cpp index 449cd97351a..55c67ed2bfa 100644 --- a/src/mame/video/pc080sn.cpp +++ b/src/mame/video/pc080sn.cpp @@ -61,8 +61,8 @@ pc080sn_device::pc080sn_device(const machine_config &mconfig, const char *tag, d m_gfxdecode(*this), m_palette(*this) { - for (int i = 0; i < 8; i++) - m_ctrl[i] = 0; + for (auto & elem : m_ctrl) + elem = 0; for (int i = 0; i < 2; i++) { diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp index bea1e3fca36..a0db91d6b62 100644 --- a/src/mame/video/powervr2.cpp +++ b/src/mame/video/powervr2.cpp @@ -921,9 +921,9 @@ WRITE32_MEMBER( powervr2_device::softreset_w ) logerror("%s: Core Pipeline soft reset\n", tag()); #endif if (start_render_received == 1) { - for (int a=0;a < NUM_BUFFERS;a++) - if (grab[a].busy == 1) - grab[a].busy = 0; + for (auto & elem : grab) + if (elem.busy == 1) + elem.busy = 0; start_render_received = 0; } } diff --git a/src/mame/video/ppu2c0x.cpp b/src/mame/video/ppu2c0x.cpp index 17f17178d75..d6511dbb245 100644 --- a/src/mame/video/ppu2c0x.cpp +++ b/src/mame/video/ppu2c0x.cpp @@ -144,8 +144,8 @@ ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type, m_draw_phase(0), m_use_sprite_write_limitation(true) { - for (int i = 0; i < PPU_MAX_REG; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; memset(m_palette_ram, 0, ARRAY_LENGTH(m_palette_ram)); diff --git a/src/mame/video/psikyosh.cpp b/src/mame/video/psikyosh.cpp index 0eb703853cd..24b51d9e375 100644 --- a/src/mame/video/psikyosh.cpp +++ b/src/mame/video/psikyosh.cpp @@ -260,7 +260,7 @@ void psikyosh_state::draw_bglayerscroll( int layer, bitmap_rgb32 &bitmap, const /* cache rendered bitmap */ int last_bank[32]; // corresponds to bank of bitmap in m_bg_bitmap. bg_bitmap is split into 16/32-rows of one-tile high each - for(int ii = 0; ii < 32; ii++) last_bank[ii] = -1; + for(auto & elem : last_bank) elem = -1; int scr_width = cliprect.width(); int scr_height = cliprect.height(); diff --git a/src/mame/video/rdptpipe.h b/src/mame/video/rdptpipe.h index e47f6f17130..201b15d63c1 100644 --- a/src/mame/video/rdptpipe.h +++ b/src/mame/video/rdptpipe.h @@ -34,9 +34,9 @@ class n64_texture_pipe_t } m_start_span = false; - for (int idx = 0; idx < 80; idx++) + for (auto & elem : m_texel_fetch) { - m_texel_fetch[idx] = &n64_texture_pipe_t::fetch_nop; + elem = &n64_texture_pipe_t::fetch_nop; } m_texel_fetch[ 8] = &n64_texture_pipe_t::fetch_rgba16_raw; diff --git a/src/mame/video/stic.cpp b/src/mame/video/stic.cpp index b5b8dbfb6a4..350544e8f90 100644 --- a/src/mame/video/stic.cpp +++ b/src/mame/video/stic.cpp @@ -760,8 +760,8 @@ void stic_device::screenrefresh() render_background(m_bitmap); // Render the sprites into their buffers render_sprites(); - for (int i = 0; i < STIC_MOBS; i++) - m_sprite[i].collision = 0; + for (auto & elem : m_sprite) + elem.collision = 0; // Copy the sprites to the background copy_sprites_to_background(m_bitmap); determine_sprite_collisions(); diff --git a/src/mame/video/tc0100scn.cpp b/src/mame/video/tc0100scn.cpp index 3ecbc3623d8..e63bd9b0c25 100644 --- a/src/mame/video/tc0100scn.cpp +++ b/src/mame/video/tc0100scn.cpp @@ -318,8 +318,8 @@ void tc0100scn_device::device_reset() m_dblwidth = 0; m_gfxbank = 0; /* Mjnquest uniquely banks tiles */ - for (int i = 0; i < 8; i++) - m_ctrl[i] = 0; + for (auto & elem : m_ctrl) + elem = 0; } diff --git a/src/mame/video/tc0360pri.cpp b/src/mame/video/tc0360pri.cpp index 43bf42ee1ef..e3620cb74ac 100644 --- a/src/mame/video/tc0360pri.cpp +++ b/src/mame/video/tc0360pri.cpp @@ -65,8 +65,8 @@ void tc0360pri_device::device_start() void tc0360pri_device::device_reset() { - for (int i = 0; i < 16; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } diff --git a/src/mame/video/tc0480scp.cpp b/src/mame/video/tc0480scp.cpp index d50a77c6ace..df66f8afb3b 100644 --- a/src/mame/video/tc0480scp.cpp +++ b/src/mame/video/tc0480scp.cpp @@ -317,8 +317,8 @@ void tc0480scp_device::device_reset() { m_dblwidth = 0; - for (int i = 0; i < 0x18; i++) - m_ctrl[i] = 0; + for (auto & elem : m_ctrl) + elem = 0; } diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index 691fc71b47b..91e40c51b5b 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -772,9 +772,9 @@ static int print_help(const char *argv0, const char *error = nullptr) // print a summary of each command printf("Usage:\n"); - for (int cmdnum = 0; cmdnum < ARRAY_LENGTH(s_commands); cmdnum++) + for (auto & desc : s_commands) { - const command_description &desc = s_commands[cmdnum]; + printf(" %s %s%s\n", argv0, desc.name, desc.description); } printf("\nFor help with any command, run:\n"); @@ -808,10 +808,10 @@ static int print_help(const char *argv0, const command_description &desc, const option++; // find the option - for (int optnum = 0; optnum < ARRAY_LENGTH(s_options); optnum++) - if (strcmp(option, s_options[optnum].name) == 0) + for (auto & s_option : s_options) + if (strcmp(option, s_option.name) == 0) { - const option_description &odesc = s_options[optnum]; + const option_description &odesc = s_option; printf(" --%s", odesc.name); if (odesc.shortname != nullptr) printf(", -%s", odesc.shortname); @@ -1391,10 +1391,10 @@ static void do_info(parameters_t ¶ms) // determine our index UINT32 metaindex = ~0; - for (unsigned int cur = 0; cur < info.size(); cur++) - if (info[cur].tag == metatag) + for (auto & elem : info) + if (elem.tag == metatag) { - metaindex = ++info[cur].index; + metaindex = ++elem.index; break; } @@ -2858,10 +2858,10 @@ int CLIB_DECL main(int argc, char *argv[]) } // iterate over commands to find our match - for (int cmdnum = 0; cmdnum < ARRAY_LENGTH(s_commands); cmdnum++) - if (strcmp(command, s_commands[cmdnum].name) == 0) + for (auto & s_command : s_commands) + if (strcmp(command, s_command.name) == 0) { - const command_description &desc = s_commands[cmdnum]; + const command_description &desc = s_command; // print help if that was requested if (help) @@ -2933,7 +2933,7 @@ int CLIB_DECL main(int argc, char *argv[]) // all clear, run the command try { - (*s_commands[cmdnum].handler)(parameters); + (*s_command.handler)(parameters); return 0; } catch (chd_error &err) diff --git a/src/tools/src2html.cpp b/src/tools/src2html.cpp index 62eefb4da56..e5d2f8f496c 100644 --- a/src/tools/src2html.cpp +++ b/src/tools/src2html.cpp @@ -410,10 +410,10 @@ static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std: { // make sure we care, first file_type type = FILE_TYPE_INVALID; - for (int extnum = 0; extnum < ARRAY_LENGTH(extension_lookup); extnum++) - if (core_filename_ends_with(curlist->name.c_str(), extension_lookup[extnum].extension)) + for (auto & elem : extension_lookup) + if (core_filename_ends_with(curlist->name.c_str(), elem.extension)) { - type = extension_lookup[extnum].type; + type = elem.type; break; } -- cgit v1.2.3-70-g09d2 From 3ee9b6cee4c0757a999f63b70a190ac6020984b2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 6 Dec 2015 09:23:23 +0100 Subject: fixing some more override (nw) --- src/emu/devfind.h | 4 +-- src/lib/formats/2d_dsk.h | 6 ++-- src/lib/formats/a5105_dsk.h | 6 ++-- src/lib/formats/ap2_dsk.cpp | 2 +- src/lib/formats/ap_dsk35.h | 16 ++++----- src/lib/formats/applix_dsk.h | 6 ++-- src/lib/formats/apridisk.h | 16 ++++----- src/lib/formats/asst128_dsk.h | 6 ++-- src/lib/formats/atom_dsk.h | 6 ++-- src/lib/formats/bbc_dsk.h | 46 ++++++++++++------------ src/lib/formats/bw12_dsk.h | 6 ++-- src/lib/formats/bw2_dsk.h | 6 ++-- src/lib/formats/camplynx_dsk.h | 6 ++-- src/lib/formats/cd90_640_dsk.h | 6 ++-- src/lib/formats/coupedsk.h | 16 ++++----- src/lib/formats/d64_dsk.cpp | 2 +- src/lib/formats/d64_dsk.h | 2 +- src/lib/formats/d80_dsk.cpp | 4 +-- src/lib/formats/dcp_dsk.cpp | 2 +- src/lib/formats/dcp_dsk.h | 12 +++---- src/lib/formats/dim_dsk.h | 16 ++++----- src/lib/formats/dip_dsk.cpp | 2 +- src/lib/formats/dip_dsk.h | 12 +++---- src/lib/formats/dmv_dsk.h | 6 ++-- src/lib/formats/esq16_dsk.h | 16 ++++----- src/lib/formats/esq8_dsk.h | 16 ++++----- src/lib/formats/excali64_dsk.h | 6 ++-- src/lib/formats/fdd_dsk.h | 12 +++---- src/lib/formats/flex_dsk.h | 12 +++---- src/lib/formats/flopimg.cpp | 10 +++--- src/lib/formats/flopimg.h | 8 ++--- src/lib/formats/fmtowns_dsk.h | 6 ++-- src/lib/formats/fsd_dsk.h | 12 +++---- src/lib/formats/guab_dsk.h | 6 ++-- src/lib/formats/hector_minidisc.h | 6 ++-- src/lib/formats/imd_dsk.cpp | 2 +- src/lib/formats/ipf_dsk.cpp | 3 +- src/lib/formats/itt3030_dsk.h | 6 ++-- src/lib/formats/kaypro_dsk.h | 12 +++---- src/lib/formats/m20_dsk.h | 16 ++++----- src/lib/formats/m5_dsk.h | 6 ++-- src/lib/formats/mfm_hd.h | 11 +++--- src/lib/formats/mm_dsk.h | 12 +++---- src/lib/formats/nanos_dsk.h | 6 ++-- src/lib/formats/nfd_dsk.h | 12 +++---- src/lib/formats/pasti_dsk.cpp | 2 +- src/lib/formats/pasti_dsk.h | 12 +++---- src/lib/formats/pc98_dsk.h | 6 ++-- src/lib/formats/pc98fdi_dsk.cpp | 2 +- src/lib/formats/pc98fdi_dsk.h | 12 +++---- src/lib/formats/pk8020_dsk.h | 6 ++-- src/lib/formats/pyldin_dsk.h | 6 ++-- src/lib/formats/rx50_dsk.h | 16 ++++----- src/lib/formats/sf7000_dsk.h | 6 ++-- src/lib/formats/smx_dsk.h | 6 ++-- src/lib/formats/st_dsk.h | 28 +++++++-------- src/lib/formats/svi_dsk.h | 16 ++++----- src/lib/formats/tandy2k_dsk.h | 6 ++-- src/lib/formats/td0_dsk.cpp | 4 +-- src/lib/formats/ti99_dsk.h | 1 - src/lib/formats/tiki100_dsk.h | 6 ++-- src/lib/formats/trd_dsk.h | 6 ++-- src/lib/formats/trs80_dsk.h | 8 ++--- src/lib/formats/upd765_dsk.cpp | 4 +-- src/lib/formats/upd765_dsk.h | 2 +- src/lib/formats/vector06_dsk.h | 6 ++-- src/lib/formats/victor9k_dsk.h | 16 ++++----- src/lib/formats/wd177x_dsk.cpp | 2 +- src/lib/formats/xdf_dsk.h | 6 ++-- src/osd/modules/debugger/debugint.cpp | 14 ++++---- src/osd/modules/debugger/debugwin.cpp | 32 ++++++++--------- src/osd/modules/debugger/none.cpp | 10 +++--- src/osd/modules/debugger/win/consolewininfo.h | 8 ++--- src/osd/modules/debugger/win/disasmbasewininfo.h | 6 ++-- src/osd/modules/debugger/win/disasmwininfo.h | 8 ++--- src/osd/modules/debugger/win/editwininfo.h | 6 ++-- src/osd/modules/debugger/win/memorywininfo.h | 12 +++---- src/osd/modules/debugger/win/pointswininfo.h | 6 ++-- src/osd/modules/debugger/win/uimetrics.cpp | 2 +- src/osd/modules/font/font_none.cpp | 10 +++--- src/osd/modules/font/font_windows.cpp | 10 +++--- src/osd/modules/lib/osdobj_common.h | 26 +++++++------- src/osd/modules/midi/none.cpp | 20 +++++------ src/osd/modules/midi/portmidi.cpp | 20 +++++------ src/osd/modules/netdev/none.cpp | 3 +- src/osd/modules/netdev/pcap.cpp | 12 +++---- src/osd/modules/osdmodule.h | 4 +-- src/osd/modules/render/drawbgfx.cpp | 16 ++++----- src/osd/modules/render/drawd3d.h | 14 ++++---- src/osd/modules/render/drawdd.cpp | 14 ++++---- src/osd/modules/render/drawgdi.cpp | 14 ++++---- src/osd/modules/render/drawnone.cpp | 14 ++++---- src/osd/modules/render/drawogl.cpp | 26 +++++++------- src/osd/modules/sound/direct_sound.cpp | 8 ++--- src/osd/modules/sound/none.cpp | 8 ++--- src/osd/windows/video.h | 2 +- src/osd/windows/window.h | 14 ++++---- src/osd/windows/winmain.cpp | 2 +- src/osd/windows/winmain.h | 32 ++++++++--------- 99 files changed, 484 insertions(+), 482 deletions(-) (limited to 'src/lib/formats/ap2_dsk.cpp') diff --git a/src/emu/devfind.h b/src/emu/devfind.h index 16dd1f34911..3d0fc80f9de 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -110,7 +110,7 @@ public: operator _DeviceClass &() { assert(object_finder_base<_DeviceClass>::m_target != nullptr); return *object_finder_base<_DeviceClass>::m_target; } // finder - virtual bool findit(bool isvalidation = false) + virtual bool findit(bool isvalidation = false) override { device_t *device = this->m_base.subdevice(this->m_tag); this->m_target = dynamic_cast<_DeviceClass *>(device); @@ -396,7 +396,7 @@ public: } // finder - virtual bool findit(bool isvalidation = false) + virtual bool findit(bool isvalidation = false) override { if (isvalidation) return true; this->m_target = reinterpret_cast<_PointerType *>(this->find_memshare(m_width, m_bytes, _Required)); 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/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/ap2_dsk.cpp b/src/lib/formats/ap2_dsk.cpp index 49010ff62e1..774d4785735 100644 --- a/src/lib/formats/ap2_dsk.cpp +++ b/src/lib/formats/ap2_dsk.cpp @@ -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) { } 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/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/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/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/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/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/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/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 5eaecc3b042..c5bef4b3313 100644 --- a/src/lib/formats/d64_dsk.h +++ b/src/lib/formats/d64_dsk.h @@ -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/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/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/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/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/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/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/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 57281fcda0e..f8cf7c83780 100644 --- a/src/lib/formats/flopimg.cpp +++ b/src/lib/formats/flopimg.cpp @@ -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; @@ -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; } 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 &buffer, const gen_crc_info *crc); void fixup_crc_victor_data(std::vector &buffer, const gen_crc_info *crc); void fixup_crcs(std::vector &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/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.h b/src/lib/formats/fsd_dsk.h index 8d7a9302926..fdfb6fb3d27 100644 --- a/src/lib/formats/fsd_dsk.h +++ b/src/lib/formats/fsd_dsk.h @@ -29,13 +29,13 @@ class fsd_format : public floppy_image_format_t public: fsd_format(); - 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; - 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; }; extern const floppy_format_type FLOPPY_FSD_FORMAT; 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/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/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp index 05320686e40..8f660b91535 100644 --- a/src/lib/formats/imd_dsk.cpp +++ b/src/lib/formats/imd_dsk.cpp @@ -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) diff --git a/src/lib/formats/ipf_dsk.cpp b/src/lib/formats/ipf_dsk.cpp index ade50a8e2f9..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(): 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) { } 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/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/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/mfm_hd.h b/src/lib/formats/mfm_hd.h index 45963e2c3d5..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. 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/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/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/pasti_dsk.cpp b/src/lib/formats/pasti_dsk.cpp index f6ed1556711..78e016991d9 100644 --- a/src/lib/formats/pasti_dsk.cpp +++ b/src/lib/formats/pasti_dsk.cpp @@ -175,7 +175,7 @@ void pasti_format::wd_generate_unsynced_gap(std::vector &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/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/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/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/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/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 §or_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_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 600a6868a4e..69b3e5bfc14 100644 --- a/src/lib/formats/td0_dsk.cpp +++ b/src/lib/formats/td0_dsk.cpp @@ -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; diff --git a/src/lib/formats/ti99_dsk.h b/src/lib/formats/ti99_dsk.h index 94ae7cf1f36..64285c1dcce 100644 --- a/src/lib/formats/ti99_dsk.h +++ b/src/lib/formats/ti99_dsk.h @@ -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); 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/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 12bda75d51b..a108931d89b 100644 --- a/src/lib/formats/upd765_dsk.h +++ b/src/lib/formats/upd765_dsk.h @@ -46,7 +46,7 @@ public: protected: floppy_image_format_t::desc_e* get_desc_fm(const format &f, int ¤t_size, int &end_gap_index); floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int ¤t_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 &candidates); 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/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/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/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/osd/modules/debugger/debugint.cpp b/src/osd/modules/debugger/debugint.cpp index 49ae108e881..02e3ae93689 100644 --- a/src/osd/modules/debugger/debugint.cpp +++ b/src/osd/modules/debugger/debugint.cpp @@ -34,12 +34,12 @@ public: virtual ~debug_internal() { } - virtual int init(const osd_options &options) { return 0; } - virtual void exit(); + virtual int init(const osd_options &options) override { return 0; } + virtual void exit() override; - virtual void init_debugger(running_machine &machine); - virtual void wait_for_debugger(device_t &device, bool firststop); - virtual void debugger_update(); + virtual void init_debugger(running_machine &machine) override; + virtual void wait_for_debugger(device_t &device, bool firststop) override; + virtual void debugger_update() override; private: running_machine *m_machine; @@ -1143,8 +1143,8 @@ class ui_menu_debug : public ui_menu { public: ui_menu_debug(running_machine &machine, render_container *container) : ui_menu(machine, container) {} virtual ~ui_menu_debug() {} - virtual void populate() {} - virtual void handle() {} + virtual void populate() override {} + virtual void handle() override {} }; static void CreateMainMenu(running_machine &machine) diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp index da32b678b67..b31d12ea67a 100644 --- a/src/osd/modules/debugger/debugwin.cpp +++ b/src/osd/modules/debugger/debugwin.cpp @@ -44,29 +44,29 @@ public: virtual ~debugger_windows() { } - virtual int init(const osd_options &options) { return 0; } - virtual void exit(); + virtual int init(const osd_options &options) override { return 0; } + virtual void exit() override; - virtual void init_debugger(running_machine &machine); - virtual void wait_for_debugger(device_t &device, bool firststop); - virtual void debugger_update(); + virtual void init_debugger(running_machine &machine) override; + virtual void wait_for_debugger(device_t &device, bool firststop) override; + virtual void debugger_update() override; protected: - virtual running_machine &machine() const { return *m_machine; } + virtual running_machine &machine() const override { return *m_machine; } - virtual ui_metrics &metrics() const { return *m_metrics; } + virtual ui_metrics &metrics() const override { return *m_metrics; } - virtual bool const &waiting_for_debugger() const { return m_waiting_for_debugger; } - virtual bool seq_pressed() const; + virtual bool const &waiting_for_debugger() const override { return m_waiting_for_debugger; } + virtual bool seq_pressed() const override; - virtual void create_memory_window() { create_window(); } - virtual void create_disasm_window() { create_window(); } - virtual void create_log_window() { create_window(); } - virtual void create_points_window() { create_window(); } - virtual void remove_window(debugwin_info &info); + virtual void create_memory_window() override { create_window(); } + virtual void create_disasm_window() override { create_window(); } + virtual void create_log_window() override { create_window(); } + virtual void create_points_window() override { create_window(); } + virtual void remove_window(debugwin_info &info) override; - virtual void show_all(); - virtual void hide_all(); + virtual void show_all() override; + virtual void hide_all() override; private: template T *create_window(); diff --git a/src/osd/modules/debugger/none.cpp b/src/osd/modules/debugger/none.cpp index f6b22a1883a..27157bbee1b 100644 --- a/src/osd/modules/debugger/none.cpp +++ b/src/osd/modules/debugger/none.cpp @@ -22,12 +22,12 @@ public: virtual ~debug_none() { } - virtual int init(const osd_options &options) { return 0; } - virtual void exit() { } + virtual int init(const osd_options &options) override { return 0; } + virtual void exit() override { } - virtual void init_debugger(running_machine &machine); - virtual void wait_for_debugger(device_t &device, bool firststop); - virtual void debugger_update(); + virtual void init_debugger(running_machine &machine) override; + virtual void wait_for_debugger(device_t &device, bool firststop) override; + virtual void debugger_update() override; private: running_machine *m_machine; diff --git a/src/osd/modules/debugger/win/consolewininfo.h b/src/osd/modules/debugger/win/consolewininfo.h index f788b044873..8281dda4e97 100644 --- a/src/osd/modules/debugger/win/consolewininfo.h +++ b/src/osd/modules/debugger/win/consolewininfo.h @@ -23,9 +23,9 @@ public: void set_cpu(device_t &device); protected: - virtual void recompute_children(); - virtual void update_menu(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); + virtual void recompute_children() override; + virtual void update_menu() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; private: enum @@ -41,7 +41,7 @@ private: DEVOPTION_MAX }; - virtual void process_string(char const *string); + virtual void process_string(char const *string) override; static void build_generic_filter(device_image_interface *img, bool is_save, std::string &filter); static void add_filter_entry(std::string &dest, char const *description, char const *extensions); diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.h b/src/osd/modules/debugger/win/disasmbasewininfo.h index 085ec351c98..26cd481b7f6 100644 --- a/src/osd/modules/debugger/win/disasmbasewininfo.h +++ b/src/osd/modules/debugger/win/disasmbasewininfo.h @@ -20,11 +20,11 @@ public: disasmbasewin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler); virtual ~disasmbasewin_info(); - virtual bool handle_key(WPARAM wparam, LPARAM lparam); + virtual bool handle_key(WPARAM wparam, LPARAM lparam) override; protected: - virtual void update_menu(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); + virtual void update_menu() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; }; #endif diff --git a/src/osd/modules/debugger/win/disasmwininfo.h b/src/osd/modules/debugger/win/disasmwininfo.h index e55b74ba3c1..6297b628168 100644 --- a/src/osd/modules/debugger/win/disasmwininfo.h +++ b/src/osd/modules/debugger/win/disasmwininfo.h @@ -21,12 +21,12 @@ public: virtual ~disasmwin_info(); protected: - virtual void recompute_children(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); - virtual void draw_contents(HDC dc); + virtual void recompute_children() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; + virtual void draw_contents(HDC dc) override; private: - virtual void process_string(char const *string); + virtual void process_string(char const *string) override; void update_caption(); diff --git a/src/osd/modules/debugger/win/editwininfo.h b/src/osd/modules/debugger/win/editwininfo.h index f1b729a1f59..5da80597272 100644 --- a/src/osd/modules/debugger/win/editwininfo.h +++ b/src/osd/modules/debugger/win/editwininfo.h @@ -20,9 +20,9 @@ public: editwin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler); virtual ~editwin_info(); - virtual bool restore_field(HWND wnd); + virtual bool restore_field(HWND wnd) override; - virtual bool set_default_focus(); + virtual bool set_default_focus() override; protected: static DWORD const COMBO_BOX_STYLE = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL; @@ -33,7 +33,7 @@ protected: void editwnd_select_all(); void set_edit_defstr(char const *string) { m_edit_defstr = string; } - virtual void draw_contents(HDC dc); + virtual void draw_contents(HDC dc) override; private: virtual void process_string(char const *string) = 0; diff --git a/src/osd/modules/debugger/win/memorywininfo.h b/src/osd/modules/debugger/win/memorywininfo.h index a52315829b8..f0fe535cf16 100644 --- a/src/osd/modules/debugger/win/memorywininfo.h +++ b/src/osd/modules/debugger/win/memorywininfo.h @@ -20,16 +20,16 @@ public: memorywin_info(debugger_windows_interface &debugger); virtual ~memorywin_info(); - virtual bool handle_key(WPARAM wparam, LPARAM lparam); + virtual bool handle_key(WPARAM wparam, LPARAM lparam) override; protected: - virtual void recompute_children(); - virtual void update_menu(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); - virtual void draw_contents(HDC dc); + virtual void recompute_children() override; + virtual void update_menu() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; + virtual void draw_contents(HDC dc) override; private: - virtual void process_string(char const *string); + virtual void process_string(char const *string) override; void update_caption(); diff --git a/src/osd/modules/debugger/win/pointswininfo.h b/src/osd/modules/debugger/win/pointswininfo.h index a6c944bc160..8ba1b31fc00 100644 --- a/src/osd/modules/debugger/win/pointswininfo.h +++ b/src/osd/modules/debugger/win/pointswininfo.h @@ -20,11 +20,11 @@ public: pointswin_info(debugger_windows_interface &debugger); virtual ~pointswin_info(); - virtual bool handle_key(WPARAM wparam, LPARAM lparam); + virtual bool handle_key(WPARAM wparam, LPARAM lparam) override; protected: - virtual void update_menu(); - virtual bool handle_command(WPARAM wparam, LPARAM lparam); + virtual void update_menu() override; + virtual bool handle_command(WPARAM wparam, LPARAM lparam) override; }; #endif diff --git a/src/osd/modules/debugger/win/uimetrics.cpp b/src/osd/modules/debugger/win/uimetrics.cpp index aebbf1cfe06..7da41d6f79f 100644 --- a/src/osd/modules/debugger/win/uimetrics.cpp +++ b/src/osd/modules/debugger/win/uimetrics.cpp @@ -12,7 +12,7 @@ ui_metrics::ui_metrics(osd_options const &options) : - m_debug_font(NULL), + m_debug_font(nullptr), m_debug_font_height(0), m_debug_font_width(0), m_debug_font_ascent(0), diff --git a/src/osd/modules/font/font_none.cpp b/src/osd/modules/font/font_none.cpp index 7ea689c8f35..de9d01bb103 100644 --- a/src/osd/modules/font/font_none.cpp +++ b/src/osd/modules/font/font_none.cpp @@ -18,9 +18,9 @@ class osd_font_none : public osd_font public: virtual ~osd_font_none() { } - virtual bool open(const char *font_path, const char *name, int &height); - virtual void close(); - virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); + virtual bool open(const char *font_path, const char *name, int &height) override; + virtual void close() override; + virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) override; }; bool osd_font_none::open(const char *font_path, const char *_name, int &height) @@ -57,9 +57,9 @@ public: { } - virtual int init(const osd_options &options) { return 0; } + virtual int init(const osd_options &options) override { return 0; } - osd_font *font_alloc() + virtual osd_font *font_alloc() override { return global_alloc(osd_font_none); } diff --git a/src/osd/modules/font/font_windows.cpp b/src/osd/modules/font/font_windows.cpp index 6192c965564..6d561e5cddd 100644 --- a/src/osd/modules/font/font_windows.cpp +++ b/src/osd/modules/font/font_windows.cpp @@ -39,9 +39,9 @@ public: osd_font_windows(): m_font(NULL) { } virtual ~osd_font_windows() { } - virtual bool open(const char *font_path, const char *name, int &height); - virtual void close(); - virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); + virtual bool open(const char *font_path, const char *name, int &height) override; + virtual void close() override; + virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) override; private: HGDIOBJ m_font; }; @@ -273,9 +273,9 @@ public: { } - virtual int init(const osd_options &options) { return 0; } + virtual int init(const osd_options &options) override { return 0; } - osd_font *font_alloc() + virtual osd_font *font_alloc() override { return global_alloc(osd_font_windows); } diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index c3501ec84b6..3e56996f9ec 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -166,20 +166,20 @@ public: virtual void register_options(); // general overridables - virtual void init(running_machine &machine); - virtual void update(bool skip_redraw); + virtual void init(running_machine &machine) override; + virtual void update(bool skip_redraw) override; // debugger overridables - virtual void init_debugger(); - virtual void wait_for_debugger(device_t &device, bool firststop); + virtual void init_debugger() override; + virtual void wait_for_debugger(device_t &device, bool firststop) override; // audio overridables - virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame); - virtual void set_mastervolume(int attenuation); - virtual bool no_sound(); + virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) override; + virtual void set_mastervolume(int attenuation) override; + virtual bool no_sound() override; // input overridables - virtual void customize_input_type_list(simple_list &typelist); + virtual void customize_input_type_list(simple_list &typelist) override; // font overridables virtual osd_font *font_open(const char *name, int &height); @@ -187,14 +187,14 @@ public: virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); // video overridables - virtual void *get_slider_list(); + virtual void *get_slider_list() override; // command option overrides - virtual bool execute_command(const char *command); + virtual bool execute_command(const char *command) override; - osd_font *font_alloc() { return m_font_module->font_alloc(); } + virtual osd_font *font_alloc() override { return m_font_module->font_alloc(); } - osd_midi_device *create_midi_device() { return m_midi->create_midi_device(); } + virtual osd_midi_device *create_midi_device() override { return m_midi->create_midi_device(); } // FIXME: everything below seems to be osd specific and not part of // this INTERFACE but part of the osd IMPLEMENTATION @@ -227,7 +227,7 @@ public: osd_options &options() { return m_options; } // osd_output interface ... - virtual void output_callback(osd_output_channel channel, const char *msg, va_list args); + virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override; protected: virtual bool input_init(); diff --git a/src/osd/modules/midi/none.cpp b/src/osd/modules/midi/none.cpp index 12e15558a4d..1c16c5e04b2 100644 --- a/src/osd/modules/midi/none.cpp +++ b/src/osd/modules/midi/none.cpp @@ -23,11 +23,11 @@ public: } virtual ~none_module() { } - virtual int init(const osd_options &options); - virtual void exit(); + virtual int init(const osd_options &options) override; + virtual void exit() override; - osd_midi_device *create_midi_device(); - void list_midi_devices(void); + virtual osd_midi_device *create_midi_device() override; + virtual void list_midi_devices(void) override; }; @@ -35,12 +35,12 @@ class osd_midi_device_none : public osd_midi_device { public: virtual ~osd_midi_device_none() { } - virtual bool open_input(const char *devname); - virtual bool open_output(const char *devname); - virtual void close(); - virtual bool poll(); - virtual int read(UINT8 *pOut); - virtual void write(UINT8 data); + virtual bool open_input(const char *devname) override; + virtual bool open_output(const char *devname) override; + virtual void close() override; + virtual bool poll() override; + virtual int read(UINT8 *pOut) override; + virtual void write(UINT8 data) override; }; osd_midi_device *none_module::create_midi_device() diff --git a/src/osd/modules/midi/portmidi.cpp b/src/osd/modules/midi/portmidi.cpp index 9aa02c63c5b..a158b9033cd 100644 --- a/src/osd/modules/midi/portmidi.cpp +++ b/src/osd/modules/midi/portmidi.cpp @@ -30,11 +30,11 @@ public: } virtual ~pm_module() { } - virtual int init(const osd_options &options); - virtual void exit(); + virtual int init(const osd_options &options)override; + virtual void exit()override; - osd_midi_device *create_midi_device(); - void list_midi_devices(void); + virtual osd_midi_device *create_midi_device() override; + virtual void list_midi_devices(void) override; }; @@ -48,12 +48,12 @@ class osd_midi_device_pm : public osd_midi_device public: osd_midi_device_pm(): pmStream(nullptr), xmit_cnt(0), last_status(0), rx_sysex(false) { } virtual ~osd_midi_device_pm() { } - virtual bool open_input(const char *devname); - virtual bool open_output(const char *devname); - virtual void close(); - virtual bool poll(); - virtual int read(UINT8 *pOut); - virtual void write(UINT8 data); + virtual bool open_input(const char *devname) override; + virtual bool open_output(const char *devname) override; + virtual void close() override; + virtual bool poll() override; + virtual int read(UINT8 *pOut) override; + virtual void write(UINT8 data) override; private: PortMidiStream *pmStream; diff --git a/src/osd/modules/netdev/none.cpp b/src/osd/modules/netdev/none.cpp index d5b11392309..5a9be50a36c 100644 --- a/src/osd/modules/netdev/none.cpp +++ b/src/osd/modules/netdev/none.cpp @@ -15,7 +15,8 @@ public: : osd_module(OSD_NETDEV_PROVIDER, "none"), netdev_module() { } - int init(const osd_options &options) { return 0; } + + virtual int init(const osd_options &options) override { return 0; } }; MODULE_DEFINITION(NETDEV_NONE, netdev_none) diff --git a/src/osd/modules/netdev/pcap.cpp b/src/osd/modules/netdev/pcap.cpp index 833548cfabb..1e4f7dbea5e 100644 --- a/src/osd/modules/netdev/pcap.cpp +++ b/src/osd/modules/netdev/pcap.cpp @@ -60,10 +60,10 @@ public: } virtual ~pcap_module() { } - virtual int init(const osd_options &options); - virtual void exit(); + virtual int init(const osd_options &options) override; + virtual void exit() override; - virtual bool probe(); + virtual bool probe() override; HMODULE handle; }; @@ -109,10 +109,10 @@ public: netdev_pcap(const char *name, class device_network_interface *ifdev, int rate); ~netdev_pcap(); - int send(UINT8 *buf, int len); - void set_mac(const char *mac); + virtual int send(UINT8 *buf, int len) override; + virtual void set_mac(const char *mac) override; protected: - int recv_dev(UINT8 **buf); + virtual int recv_dev(UINT8 **buf) override; private: pcap_t *m_p; #ifdef SDLMAME_MACOSX diff --git a/src/osd/modules/osdmodule.h b/src/osd/modules/osdmodule.h index 1a49b5ff4f9..1e545aa299b 100644 --- a/src/osd/modules/osdmodule.h +++ b/src/osd/modules/osdmodule.h @@ -102,8 +102,8 @@ private: class _mod : public osd_module { \ public: \ _mod () : osd_module(_type, _name) { } \ - int init(const osd_options &options) { return -1; } \ - bool probe() { return false; } \ + virtual int init(const osd_options &options) override { return -1; } \ + virtual bool probe() override { return false; } \ }; #endif /* __OSDMODULE_H__ */ diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 1920aa94684..ee808bfc197 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -64,17 +64,17 @@ public: m_last_blit_time(0), m_last_blit_pixels(0) {} - /* virtual */ int create(); - /* virtual */ int draw(const int update); + virtual int create() override; + virtual int draw(const int update) override; #ifdef OSD_SDL - /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt); + virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; #else - /* virtual */ void save() { } - /* virtual */ void record() { } - /* virtual */ void toggle_fsfx() { } + virtual void save() override { } + virtual void record() override { } + virtual void toggle_fsfx() override { } #endif - /* virtual */ void destroy(); - /* virtual */ render_primitive_list *get_primitives() + virtual void destroy() override; + virtual render_primitive_list *get_primitives() override { #ifdef OSD_WINDOWS RECT client; diff --git a/src/osd/modules/render/drawd3d.h b/src/osd/modules/render/drawd3d.h index daedf235bd3..ab5385914b5 100644 --- a/src/osd/modules/render/drawd3d.h +++ b/src/osd/modules/render/drawd3d.h @@ -101,13 +101,13 @@ public: renderer(osd_window *window); virtual ~renderer(); - virtual int create(); - virtual render_primitive_list *get_primitives(); - virtual int draw(const int update); - virtual void save(); - virtual void record(); - virtual void toggle_fsfx(); - virtual void destroy(); + virtual int create() override; + virtual render_primitive_list *get_primitives() override; + virtual int draw(const int update) override; + virtual void save() override; + virtual void record() override; + virtual void toggle_fsfx() override; + virtual void destroy() override; int initialize(); diff --git a/src/osd/modules/render/drawdd.cpp b/src/osd/modules/render/drawdd.cpp index a4dfc58777b..8ba2df0df91 100644 --- a/src/osd/modules/render/drawdd.cpp +++ b/src/osd/modules/render/drawdd.cpp @@ -64,13 +64,13 @@ public: virtual ~renderer_dd() { } - virtual int create(); - virtual render_primitive_list *get_primitives(); - virtual int draw(const int update); - virtual void save() {}; - virtual void record() {}; - virtual void toggle_fsfx() {}; - virtual void destroy(); + virtual int create() override; + virtual render_primitive_list *get_primitives() override; + virtual int draw(const int update) override; + virtual void save() override {}; + virtual void record() override {}; + virtual void toggle_fsfx() override {}; + virtual void destroy() override; int width, height; // current width, height int refresh; // current refresh rate diff --git a/src/osd/modules/render/drawgdi.cpp b/src/osd/modules/render/drawgdi.cpp index ccbbc6c03eb..11e61a28407 100644 --- a/src/osd/modules/render/drawgdi.cpp +++ b/src/osd/modules/render/drawgdi.cpp @@ -30,13 +30,13 @@ public: virtual ~renderer_gdi() { } - virtual int create(); - virtual render_primitive_list *get_primitives(); - virtual int draw(const int update); - virtual void save() {}; - virtual void record() {}; - virtual void toggle_fsfx() {}; - virtual void destroy(); + virtual int create() override; + virtual render_primitive_list *get_primitives() override; + virtual int draw(const int update) override; + virtual void save() override {}; + virtual void record() override {}; + virtual void toggle_fsfx() override {}; + virtual void destroy() override; private: /* gdi_info is the information for the current screen */ diff --git a/src/osd/modules/render/drawnone.cpp b/src/osd/modules/render/drawnone.cpp index 08bd81666ca..9f45683e6da 100644 --- a/src/osd/modules/render/drawnone.cpp +++ b/src/osd/modules/render/drawnone.cpp @@ -25,13 +25,13 @@ public: virtual ~renderer_none() { } - virtual int create(); - virtual render_primitive_list *get_primitives(); - virtual int draw(const int update); - virtual void save() { }; - virtual void record() { }; - virtual void toggle_fsfx() { }; - virtual void destroy(); + virtual int create() override; + virtual render_primitive_list *get_primitives() override; + virtual int draw(const int update) override; + virtual void save() override { }; + virtual void record() override { }; + virtual void toggle_fsfx() override { }; + virtual void destroy() override; }; //============================================================ diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index de04e04a580..750eb5ae2d6 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -233,12 +233,12 @@ public: ReleaseDC(m_window, m_hdc); } - virtual void MakeCurrent() + virtual void MakeCurrent() override { this->pfn_wglMakeCurrent(m_hdc, m_context); } - virtual const char *LastErrorMsg() + virtual const char *LastErrorMsg() override { if (m_error[0] == 0) return NULL; @@ -246,7 +246,7 @@ public: return m_error; } - virtual void *getProcAddress(const char *proc) + virtual void *getProcAddress(const char *proc) override { void *ret = (void *) GetProcAddress(m_module, proc); if (ret == NULL) @@ -254,7 +254,7 @@ public: return ret; } - virtual int SetSwapInterval(const int swap) + virtual int SetSwapInterval(const int swap) override { if (this->pfn_wglSwapIntervalEXT != NULL) { @@ -263,7 +263,7 @@ public: return 0; } - virtual void SwapBuffer() + virtual void SwapBuffer() override { SwapBuffers(m_hdc); //wglSwapLayerBuffers(GetDC(window().m_hwnd), WGL_SWAP_MAIN_PLANE); @@ -535,12 +535,12 @@ public: m_texVerticex[i] = 0.0f; } - /* virtual */ int create(); - /* virtual */ int draw(const int update); + virtual int create() override; + virtual int draw(const int update) override; - /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt); - /* virtual */ void destroy(); - /* virtual */ render_primitive_list *get_primitives() + int xy_to_render_target(const int x, const int y, int *xt, int *yt); + virtual void destroy() override; + virtual render_primitive_list *get_primitives() override { #ifdef OSD_WINDOWS osd_dim nd = window().get_size(); @@ -556,9 +556,9 @@ public: return &window().target()->get_primitives(); } - /* virtual */ void save() { } - /* virtual */ void record() { } - /* virtual */ void toggle_fsfx() { } + virtual void save() override { } + virtual void record() override { } + virtual void toggle_fsfx() override { } private: void destroy_all_textures(); diff --git a/src/osd/modules/sound/direct_sound.cpp b/src/osd/modules/sound/direct_sound.cpp index 01610e2a9d3..78996093e77 100644 --- a/src/osd/modules/sound/direct_sound.cpp +++ b/src/osd/modules/sound/direct_sound.cpp @@ -66,12 +66,12 @@ public: } virtual ~sound_direct_sound() { } - virtual int init(osd_options const &options); - virtual void exit(); + virtual int init(osd_options const &options) override; + virtual void exit() override; // sound_module - virtual void update_audio_stream(bool is_throttled, INT16 const *buffer, int samples_this_frame); - virtual void set_mastervolume(int attenuation); + virtual void update_audio_stream(bool is_throttled, INT16 const *buffer, int samples_this_frame) override; + virtual void set_mastervolume(int attenuation) override; private: class buffer diff --git a/src/osd/modules/sound/none.cpp b/src/osd/modules/sound/none.cpp index 2c2e07b8198..651f74021bf 100644 --- a/src/osd/modules/sound/none.cpp +++ b/src/osd/modules/sound/none.cpp @@ -20,13 +20,13 @@ public: } virtual ~sound_none() { } - virtual int init(const osd_options &options) { return 0; } - virtual void exit() { } + virtual int init(const osd_options &options) override { return 0; } + virtual void exit() override { } // sound_module - virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) { } - virtual void set_mastervolume(int attenuation) { } + virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) override { } + virtual void set_mastervolume(int attenuation) override { } }; diff --git a/src/osd/windows/video.h b/src/osd/windows/video.h index 875aebe81b5..9215dc189bf 100644 --- a/src/osd/windows/video.h +++ b/src/osd/windows/video.h @@ -150,7 +150,7 @@ public: win_monitor_info(const HMONITOR handle, const char *monitor_device, float aspect); virtual ~win_monitor_info(); - virtual void refresh(); + virtual void refresh() override; // static diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index 10a871d2f5f..0010d2bbd28 100644 --- a/src/osd/windows/window.h +++ b/src/osd/windows/window.h @@ -39,28 +39,28 @@ public: win_window_info(running_machine &machine); virtual ~win_window_info(); - running_machine &machine() const { return m_machine; } + running_machine &machine() const override { return m_machine; } - render_target *target() { return m_target; } - int fullscreen() const { return m_fullscreen; } + virtual render_target *target() override { return m_target; } + int fullscreen() const override { return m_fullscreen; } void update(); - osd_monitor_info *winwindow_video_window_monitor(const osd_rect *proposed); + virtual osd_monitor_info *winwindow_video_window_monitor(const osd_rect *proposed) override; - bool win_has_menu() + virtual bool win_has_menu() override { return GetMenu(m_hwnd) ? true : false; } - /* virtual */ osd_dim get_size() + virtual osd_dim get_size() override { RECT client; GetClientRect(m_hwnd, &client); return osd_dim(client.right - client.left, client.bottom - client.top); } - osd_monitor_info *monitor() const { return m_monitor; } + virtual osd_monitor_info *monitor() const override { return m_monitor; } void destroy(); diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index a7b946332c7..e3d8d9cccc6 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -199,7 +199,7 @@ private: class winui_output_error : public osd_output { public: - virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) + virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override { if (channel == OSD_OUTPUT_CHANNEL_ERROR) { diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index 27b503fa99c..4c15cd1cbf6 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -240,35 +240,35 @@ public: virtual ~windows_osd_interface(); // general overridables - virtual void init(running_machine &machine); - virtual void update(bool skip_redraw); + virtual void init(running_machine &machine) override; + virtual void update(bool skip_redraw) override; // video overridables - virtual void *get_slider_list(); + virtual void *get_slider_list() override; // input overridables - virtual void customize_input_type_list(simple_list &typelist); + virtual void customize_input_type_list(simple_list &typelist) override; - virtual void video_register(); + virtual void video_register() override; - virtual bool video_init(); - virtual bool window_init(); - virtual bool input_init(); - virtual void input_pause(); - virtual void input_resume(); - virtual bool output_init(); + virtual bool video_init() override; + virtual bool window_init() override; + virtual bool input_init() override; + virtual void input_pause() override; + virtual void input_resume() override; + virtual bool output_init() override; - virtual void video_exit(); - virtual void window_exit(); - virtual void input_exit(); - virtual void output_exit(); + virtual void video_exit() override; + virtual void window_exit() override; + virtual void input_exit() override; + virtual void output_exit() override; void extract_video_config(); windows_options &options() { return m_options; } private: - void osd_exit(); + virtual void osd_exit() override; windows_options &m_options; static const int DEFAULT_FONT_HEIGHT = 200; -- cgit v1.2.3-70-g09d2