diff options
231 files changed, 1222 insertions, 1228 deletions
diff --git a/src/emu/addrmap.cpp b/src/emu/addrmap.cpp index dedf97c780c..a7a510b56f7 100644 --- a/src/emu/addrmap.cpp +++ b/src/emu/addrmap.cpp @@ -445,7 +445,7 @@ void address_map::configure(address_spacenum spacenum, UINT8 databits) void address_map::set_global_mask(offs_t mask) { -// if (m_entrylist != NULL) +// if (m_entrylist != nullptr) // throw emu_fatalerror("AM_GLOBALMASK must be specified before any entries"); m_globalmask = mask; } @@ -755,8 +755,8 @@ void address_map::map_validity_check(validity_checker &valid, const device_t &de } // make sure ports exist -// if ((entry.m_read.m_type == AMH_PORT && entry.m_read.m_tag != NULL && portlist.find(entry.m_read.m_tag) == NULL) || -// (entry.m_write.m_type == AMH_PORT && entry.m_write.m_tag != NULL && portlist.find(entry.m_write.m_tag) == NULL)) +// if ((entry.m_read.m_type == AMH_PORT && entry.m_read.m_tag != nullptr && portlist.find(entry.m_read.m_tag) == nullptr) || +// (entry.m_write.m_type == AMH_PORT && entry.m_write.m_tag != nullptr && portlist.find(entry.m_write.m_tag) == nullptr)) // osd_printf_error("%s space memory map entry references nonexistent port tag '%s'\n", spaceconfig.m_name, entry.m_read.m_tag); // validate bank and share tags diff --git a/src/emu/addrmap.h b/src/emu/addrmap.h index 56e9fde3e8f..ee49ee7030e 100644 --- a/src/emu/addrmap.h +++ b/src/emu/addrmap.h @@ -302,7 +302,7 @@ public: //************************************************************************** // so that "0" can be used for unneeded address maps -#define construct_address_map_0 NULL +#define construct_address_map_0 nullptr // start/end tags for the address map #define ADDRESS_MAP_NAME(_name) construct_address_map_##_name @@ -312,7 +312,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, device_t &device) \ { \ typedef read##_bits##_delegate read_delegate ATTR_UNUSED; \ typedef write##_bits##_delegate write_delegate ATTR_UNUSED; \ - address_map_entry##_bits *curentry = NULL; \ + address_map_entry##_bits *curentry = nullptr; \ (void)curentry; \ assert(&device != nullptr); \ map.configure(_space, _bits); \ @@ -322,7 +322,7 @@ void _class :: _name(::address_map &map, device_t &device) \ { \ typedef read##_bits##_delegate read_delegate ATTR_UNUSED; \ typedef write##_bits##_delegate write_delegate ATTR_UNUSED; \ - address_map_entry##_bits *curentry = NULL; \ + address_map_entry##_bits *curentry = nullptr; \ (void)curentry; \ assert(&device != nullptr); \ map.configure(AS_PROGRAM, _bits); \ diff --git a/src/emu/crsshair.h b/src/emu/crsshair.h index 91becc37f58..0faf47f508e 100644 --- a/src/emu/crsshair.h +++ b/src/emu/crsshair.h @@ -65,7 +65,7 @@ public: void set_screen(int player, screen_device *screen) { m_screen[player] = screen; } /* return TRUE if any crosshairs are used */ - int get_usage() { return m_usage; } + int get_usage() const { return m_usage; } /* return the current crosshair settings for the given player */ void get_user_settings(UINT8 player, crosshair_user_settings *settings); diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 084eacfc66f..004ec75a8d1 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -510,7 +510,7 @@ static void global_set(symbol_table &table, void *ref, UINT64 value) int debug_command_parameter_number(running_machine &machine, const char *param, UINT64 *result) { - /* NULL parameter does nothing and returns no error */ + /* nullptr parameter does nothing and returns no error */ if (param == nullptr) return TRUE; @@ -614,7 +614,7 @@ int debug_command_parameter_cpu_space(running_machine &machine, const char *para static int debug_command_parameter_expression(running_machine &machine, const char *param, parsed_expression &result) { - /* NULL parameter does nothing and returns no error */ + /* nullptr parameter does nothing and returns no error */ if (param == nullptr) return TRUE; @@ -644,7 +644,7 @@ static int debug_command_parameter_command(running_machine &machine, const char { CMDERR err; - /* NULL parameter does nothing and returns no error */ + /* nullptr parameter does nothing and returns no error */ if (param == nullptr) return TRUE; diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp index ffe188b722d..c0ed17bdde0 100644 --- a/src/emu/debug/dvdisasm.cpp +++ b/src/emu/debug/dvdisasm.cpp @@ -25,7 +25,6 @@ debug_view_disasm_source::debug_view_disasm_source(const char *name, device_t &device) : debug_view_source(name, &device), - m_device(device), m_disasmintf(dynamic_cast<device_disasm_interface *>(&device)), m_space(device.memory().space(AS_PROGRAM)), m_decrypted_space(device.memory().has_space(AS_DECRYPTED_OPCODES) ? device.memory().space(AS_DECRYPTED_OPCODES) : device.memory().space(AS_PROGRAM)) @@ -69,7 +68,7 @@ debug_view_disasm::debug_view_disasm(running_machine &machine, debug_view_osd_up for (const debug_view_source &source : m_source_list) { const debug_view_disasm_source &dasmsource = downcast<const debug_view_disasm_source &>(source); - total_comments += dasmsource.m_device.debug()->comment_count(); + total_comments += dasmsource.device()->debug()->comment_count(); } // configure the view @@ -122,7 +121,7 @@ void debug_view_disasm::view_notify(debug_view_notification type) adjust_visible_y_for_cursor(); else if (type == VIEW_NOTIFY_SOURCE_CHANGED) - m_expression.set_context(&downcast<const debug_view_disasm_source *>(m_source)->device().debug()->symtable()); + m_expression.set_context(&downcast<const debug_view_disasm_source *>(m_source)->device()->debug()->symtable()); } @@ -168,7 +167,7 @@ void debug_view_disasm::view_char(int chval) case DCH_HOME: // set the active column to the PC { const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); - offs_t pc = source.m_space.address_to_byte(source.m_device.safe_pc()) & source.m_space.logbytemask(); + offs_t pc = source.m_space.address_to_byte(source.device()->safe_pc()) & source.m_space.logbytemask(); // figure out which row the pc is on for (unsigned int curline = 0; curline < m_byteaddress.size(); curline++) @@ -273,7 +272,7 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) if (debug_cpu_translate(source.m_space, TRANSLATE_FETCH, &physpcbyte)) { char dasmbuffer[100]; - instlen = source.m_device.debug()->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK; + instlen = source.device()->debug()->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK; } // count this one @@ -408,7 +407,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) } // disassemble the result - pc += numbytes = source.m_device.debug()->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK; + pc += numbytes = source.device()->debug()->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK; } else strcpy(buffer, "<unmapped>"); @@ -428,7 +427,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) { // get and add the comment, if present const offs_t comment_address = source.m_space.byte_to_address(m_byteaddress[instr]); - const char *const text = source.m_device.debug()->comment_text(comment_address); + const char *const text = source.device()->debug()->comment_text(comment_address); if (text != nullptr) util::stream_format(m_dasm.seekp(base + m_divider2), "// %.*s", m_total.x - m_divider2 - 4, text); } @@ -442,7 +441,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) // update opcode base information m_last_direct_decrypted = source.m_decrypted_space.direct().ptr(); m_last_direct_raw = source.m_space.direct().ptr(); - m_last_change_count = source.m_device.debug()->comment_change_count(); + m_last_change_count = source.device()->debug()->comment_change_count(); // no longer need to recompute m_recompute = false; @@ -459,7 +458,7 @@ void debug_view_disasm::view_update() { const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); - offs_t pc = source.m_device.safe_pc(); + offs_t pc = source.device()->safe_pc(); offs_t pcbyte = source.m_space.address_to_byte(pc) & source.m_space.logbytemask(); // update our context; if the expression is dirty, recompute @@ -493,7 +492,7 @@ void debug_view_disasm::view_update() m_recompute = true; // if the comments have changed, redo it - if (m_last_change_count != source.m_device.debug()->comment_change_count()) + if (m_last_change_count != source.device()->debug()->comment_change_count()) m_recompute = true; // if we need to recompute, do it @@ -502,7 +501,7 @@ recompute: if (m_recompute) { // recompute the view - if (!m_byteaddress.empty() && m_last_change_count != source.m_device.debug()->comment_change_count()) + if (!m_byteaddress.empty() && m_last_change_count != source.device()->debug()->comment_change_count()) { // smoosh us against the left column, but not the top row m_topleft.x = 0; @@ -569,7 +568,7 @@ recompute: // if we're on a line with a breakpoint, tag it changed else { - for (device_debug::breakpoint *bp = source.m_device.debug()->breakpoint_first(); bp != nullptr; bp = bp->next()) + for (device_debug::breakpoint *bp = source.device()->debug()->breakpoint_first(); bp != nullptr; bp = bp->next()) if (m_byteaddress[effrow] == (source.m_space.address_to_byte(bp->address()) & source.m_space.logbytemask())) attrib = DCA_CHANGED; } @@ -579,7 +578,7 @@ recompute: attrib |= DCA_SELECTED; // if we've visited this pc, mark it as such - if (source.m_device.debug()->track_pc_visited(m_byteaddress[effrow])) + if (source.device()->debug()->track_pc_visited(m_byteaddress[effrow])) attrib |= DCA_VISITED; // get the effective string diff --git a/src/emu/debug/dvdisasm.h b/src/emu/debug/dvdisasm.h index c474f5021a6..662d5102425 100644 --- a/src/emu/debug/dvdisasm.h +++ b/src/emu/debug/dvdisasm.h @@ -45,12 +45,10 @@ class debug_view_disasm_source : public debug_view_source public: // getters - device_t &device() const { return m_device; } address_space &space() const { return m_space; } private: // internal state - device_t & m_device; // underlying device device_disasm_interface *m_disasmintf; // disassembly interface address_space & m_space; // address space to display address_space & m_decrypted_space; // address space to display for decrypted opcodes diff --git a/src/emu/debug/dvmemory.h b/src/emu/debug/dvmemory.h index 234bd0ed19b..3b15748ed2e 100644 --- a/src/emu/debug/dvmemory.h +++ b/src/emu/debug/dvmemory.h @@ -52,7 +52,7 @@ class debug_view_memory : public debug_view public: // getters - const char *expression() { return m_expression.string(); } + const char *expression() const { return m_expression.string(); } int get_data_format() { flush_updates(); return m_data_format; } UINT32 chunks_per_row() { flush_updates(); return m_chunks_per_row; } bool reverse() const { return m_reverse_view; } diff --git a/src/emu/debug/dvstate.cpp b/src/emu/debug/dvstate.cpp index 0c1924d90fa..ca216c12f78 100644 --- a/src/emu/debug/dvstate.cpp +++ b/src/emu/debug/dvstate.cpp @@ -24,7 +24,6 @@ debug_view_state_source::debug_view_state_source(const char *name, device_t &device) : debug_view_source(name, &device), - m_device(device), m_stateintf(dynamic_cast<device_state_interface *>(&device)), m_execintf(dynamic_cast<device_execute_interface *>(&device)) { diff --git a/src/emu/debug/dvstate.h b/src/emu/debug/dvstate.h index 909526ee5f6..ad51ff69b3b 100644 --- a/src/emu/debug/dvstate.h +++ b/src/emu/debug/dvstate.h @@ -25,14 +25,8 @@ class debug_view_state_source : public debug_view_source // construction/destruction debug_view_state_source(const char *name, device_t &device); - -public: - // getters - device_t &device() const { return m_device; } - private: // internal state - device_t & m_device; // underlying device device_state_interface *m_stateintf; // state interface device_execute_interface *m_execintf; // execution interface }; diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp index 7a9ed4697ae..eb2477a1374 100644 --- a/src/emu/debug/express.cpp +++ b/src/emu/debug/express.cpp @@ -613,7 +613,7 @@ void parsed_expression::print_tokens(FILE *out) { #if DEBUG_TOKENS osd_printf_debug("----\n"); - for (parse_token *token = m_tokens.first(); token != NULL; token = token->next()) + for (parse_token *token = m_tokens.first(); token != nullptr; token = token->next()) { switch (token->type) { diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h index bbbac044691..5eb961606e4 100644 --- a/src/emu/debug/express.h +++ b/src/emu/debug/express.h @@ -181,7 +181,7 @@ public: void add(const char *name, UINT64 constvalue); void add(const char *name, void *ref, getter_func getter, setter_func setter = nullptr); void add(const char *name, void *ref, int minparams, int maxparams, execute_func execute); - symbol_entry *find(const char *name) { return m_symlist.find(name); } + symbol_entry *find(const char *name) const { return m_symlist.find(name); } symbol_entry *find_deep(const char *name); // value getter/setter diff --git a/src/emu/debug/textbuf.cpp b/src/emu/debug/textbuf.cpp index 476fe6e1efc..5f2fbf8280b 100644 --- a/src/emu/debug/textbuf.cpp +++ b/src/emu/debug/textbuf.cpp @@ -261,7 +261,7 @@ void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) } } - /* NULL terminate what we have on this line */ + /* nullptr terminate what we have on this line */ text->buffer[text->bufend] = 0; } diff --git a/src/emu/devfind.cpp b/src/emu/devfind.cpp index 820a4e110c6..803bd0a15e5 100644 --- a/src/emu/devfind.cpp +++ b/src/emu/devfind.cpp @@ -42,7 +42,7 @@ finder_base::~finder_base() void *finder_base::find_memregion(UINT8 width, size_t &length, bool required) const { - // look up the region and return NULL if not found + // look up the region and return nullptr if not found memory_region *region = m_base.memregion(m_tag); if (region == nullptr) { @@ -119,7 +119,7 @@ bool finder_base::validate_memregion(size_t bytes, bool required) const void *finder_base::find_memshare(UINT8 width, size_t &bytes, bool required) const { - // look up the share and return NULL if not found + // look up the share and return nullptr if not found memory_share *share = m_base.memshare(m_tag); if (share == nullptr) return nullptr; diff --git a/src/emu/devfind.h b/src/emu/devfind.h index 98599e4a6e9..8ea8e59908c 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -154,7 +154,7 @@ public: : object_finder_base<memory_region>(base, tag) { } // make reference use transparent as well - operator memory_region &() { assert(object_finder_base<memory_region>::m_target != NULL); return *object_finder_base<memory_region>::m_target; } + operator memory_region &() const { assert(object_finder_base<memory_region>::m_target != nullptr); return *object_finder_base<memory_region>::m_target; } // finder virtual bool findit(bool isvalidation = false) override @@ -192,7 +192,7 @@ public: : object_finder_base<memory_bank>(base, tag) { } // make reference use transparent as well - operator memory_bank &() { assert(object_finder_base<memory_bank>::m_target != NULL); return *object_finder_base<memory_bank>::m_target; } + operator memory_bank &() const { assert(object_finder_base<memory_bank>::m_target != nullptr); return *object_finder_base<memory_bank>::m_target; } // finder virtual bool findit(bool isvalidation = false) override @@ -230,9 +230,9 @@ public: : object_finder_base<ioport_port>(base, tag) { } // make reference use transparent as well - operator ioport_port &() { assert(object_finder_base<ioport_port>::m_target != NULL); return *object_finder_base<ioport_port>::m_target; } + operator ioport_port &() const { assert(object_finder_base<ioport_port>::m_target != nullptr); return *object_finder_base<ioport_port>::m_target; } - // allow dereference even when target is NULL so read_safe() can be used + // allow dereference even when target is nullptr so read_safe() can be used ioport_port *operator->() const override { return object_finder_base<ioport_port>::m_target; } // finder diff --git a/src/emu/device.h b/src/emu/device.h index c33939dc210..114e8e28b16 100644 --- a/src/emu/device.h +++ b/src/emu/device.h @@ -190,7 +190,7 @@ public: virtual ~device_t(); // getters - running_machine &machine() const { /*assert(m_machine != NULL);*/ return *m_machine; } + running_machine &machine() const { /*assert(m_machine != nullptr);*/ return *m_machine; } const char *tag() const { return m_tag.c_str(); } const char *basetag() const { return m_basetag.c_str(); } device_type type() const { return m_type; } @@ -442,7 +442,7 @@ protected: // search depth-first for the next device void advance() { - // remember our starting position, and end immediately if we're NULL + // remember our starting position, and end immediately if we're nullptr device_t *start = m_curdevice; if (start == nullptr) return; @@ -730,7 +730,7 @@ private: inline device_t *device_t::subdevice(const char *tag) const { - // empty string or NULL means this device + // empty string or nullptr means this device if (tag == nullptr || *tag == 0) return const_cast<device_t *>(this); @@ -747,7 +747,7 @@ inline device_t *device_t::subdevice(const char *tag) const inline device_t *device_t::siblingdevice(const char *tag) const { - // empty string or NULL means this device + // empty string or nullptr means this device if (tag == nullptr || *tag == 0) return const_cast<device_t *>(this); @@ -758,7 +758,7 @@ inline device_t *device_t::siblingdevice(const char *tag) const if (m_owner != nullptr) return m_owner->subdevice(tag); - // otherwise, it's NULL unless the tag is absolute + // otherwise, it's nullptr unless the tag is absolute return (tag[0] == ':') ? subdevice(tag) : nullptr; } diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 4fd379b5dae..9397c363947 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -93,7 +93,7 @@ enum #define MCFG_DEVICE_VBLANK_INT_DEVICE(_tag, _devtag, _class, _func) \ device_execute_interface::static_set_vblank_int(*device, device_interrupt_delegate(&_class::_func, #_class "::" #_func, _devtag, (_class *)0), _tag); #define MCFG_DEVICE_VBLANK_INT_REMOVE() \ - device_execute_interface::static_set_vblank_int(*device, device_interrupt_delegate(), NULL); + device_execute_interface::static_set_vblank_int(*device, device_interrupt_delegate(), nullptr); #define MCFG_DEVICE_PERIODIC_INT_DRIVER(_class, _func, _rate) \ device_execute_interface::static_set_periodic_int(*device, device_interrupt_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)0), attotime::from_hz(_rate)); #define MCFG_DEVICE_PERIODIC_INT_DEVICE(_devtag, _class, _func, _rate) \ diff --git a/src/emu/digfx.h b/src/emu/digfx.h index ec13147e966..510656dc253 100644 --- a/src/emu/digfx.h +++ b/src/emu/digfx.h @@ -178,7 +178,7 @@ struct gfx_decode_entry { const char * memory_region; // memory region where the data resides UINT32 start; // offset of beginning of data to decode - const gfx_layout *gfxlayout; // pointer to gfx_layout describing the layout; NULL marks the end of the array + const gfx_layout *gfxlayout; // pointer to gfx_layout describing the layout; nullptr marks the end of the array UINT16 color_codes_start; // offset in the color lookup table where color codes start UINT16 total_color_codes; // total number of color codes UINT32 flags; // flags and optional scaling factors diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index 67d7bbf06f5..c1e1e6de409 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -372,7 +372,7 @@ UINT8 *device_image_interface::get_software_region(const char *tag) sprintf( full_tag, "%s:%s", device().tag(), tag ); memory_region *region = device().machine().root_device().memregion(full_tag); - return region != NULL ? region->base() : NULL; + return region != nullptr ? region->base() : nullptr; } @@ -387,7 +387,7 @@ UINT32 device_image_interface::get_software_region_length(const char *tag) sprintf( full_tag, "%s:%s", device().tag(), tag ); memory_region *region = device().machine().root_device().memregion(full_tag); - return region != NULL ? region->bytes() : 0; + return region != nullptr ? region->bytes() : 0; } @@ -1178,8 +1178,8 @@ void device_image_interface::update_names(const device_type device_type, const c // strings. // // str1:str2:str3 => swlist_name - str1, swname - str2, swpart - str3 -// str1:str2 => swlist_name - NULL, swname - str1, swpart - str2 -// str1 => swlist_name - NULL, swname - str1, swpart - NULL +// str1:str2 => swlist_name - nullptr, swname - str1, swpart - str2 +// str1 => swlist_name - nullptr, swname - str1, swpart - nullptr // // Notice however that we could also have been // passed a string swlist_name:swname, and thus diff --git a/src/emu/diimage.h b/src/emu/diimage.h index 08001c8da89..10b4144e27f 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -165,24 +165,24 @@ public: virtual const char *file_extensions() const = 0; virtual const option_guide *create_option_guide() const = 0; - const image_device_format *device_get_indexed_creatable_format(int index) { return m_formatlist.find(index); } + const image_device_format *device_get_indexed_creatable_format(int index) const { return m_formatlist.find(index); } const image_device_format *device_get_named_creatable_format(const char *format_name); - const option_guide *device_get_creation_option_guide() { return create_option_guide(); } + const option_guide *device_get_creation_option_guide() const { return create_option_guide(); } const char *error(); void seterror(image_error_t err, const char *message); void message(const char *format, ...) ATTR_PRINTF(2,3); bool exists() { return !m_image_name.empty(); } - const char *filename() { if (m_image_name.empty()) return nullptr; else return m_image_name.c_str(); } - const char *basename() { if (m_basename.empty()) return nullptr; else return m_basename.c_str(); } - const char *basename_noext() { if (m_basename_noext.empty()) return nullptr; else return m_basename_noext.c_str(); } - const char *filetype() { if (m_filetype.empty()) return nullptr; else return m_filetype.c_str(); } + const char *filename() const { if (m_image_name.empty()) return nullptr; else return m_image_name.c_str(); } + const char *basename() const { if (m_basename.empty()) return nullptr; else return m_basename.c_str(); } + const char *basename_noext() const { if (m_basename_noext.empty()) return nullptr; else return m_basename_noext.c_str(); } + const char *filetype() const { if (m_filetype.empty()) return nullptr; else return m_filetype.c_str(); } bool is_open() const { return bool(m_file); } - util::core_file &image_core_file() { return *m_file; } + util::core_file &image_core_file() const { return *m_file; } UINT64 length() { check_for_file(); return m_file->size(); } - bool is_readonly() { return m_readonly; } - bool has_been_created() { return m_created; } + bool is_readonly() const { return m_readonly; } + bool has_been_created() const { return m_created; } void make_readonly() { m_readonly = true; } UINT32 fread(void *buffer, UINT32 length) { check_for_file(); return m_file->read(buffer, length); } UINT32 fread(optional_shared_ptr<UINT8> &ptr, UINT32 length) { ptr.allocate(length); return fread(ptr.target(), length); } @@ -197,14 +197,14 @@ public: // configuration access void set_init_phase() { m_init_phase = TRUE; } - const char* longname() { return m_longname.c_str(); } - const char* manufacturer() { return m_manufacturer.c_str(); } - const char* year() { return m_year.c_str(); } - UINT32 supported() { return m_supported; } + const char* longname() const { return m_longname.c_str(); } + const char* manufacturer() const { return m_manufacturer.c_str(); } + const char* year() const { return m_year.c_str(); } + UINT32 supported() const { return m_supported; } - const software_info *software_entry() { return m_software_info_ptr; } - const software_part *part_entry() { return m_software_part_ptr; } - const char *software_list_name() { return m_software_list_name.c_str(); } + const software_info *software_entry() const { return m_software_info_ptr; } + const software_part *part_entry() const { return m_software_part_ptr; } + const char *software_list_name() const { return m_software_list_name.c_str(); } void set_working_directory(const char *working_directory) { m_working_directory = working_directory; } const char * working_directory(); @@ -258,7 +258,7 @@ protected: void clear_error(); - void check_for_file() { assert_always(m_file, "Illegal operation on unmounted image"); } + void check_for_file() const { assert_always(m_file, "Illegal operation on unmounted image"); } void setup_working_directory(); bool try_change_working_directory(const char *subdir); diff --git a/src/emu/dimemory.h b/src/emu/dimemory.h index 941a8c87729..6bd85ff5e5e 100644 --- a/src/emu/dimemory.h +++ b/src/emu/dimemory.h @@ -47,7 +47,7 @@ const int TRANSLATE_FETCH_DEBUG = (TRANSLATE_FETCH | TRANSLATE_DEBUG_MASK); device_memory_interface::static_set_addrmap(*device, _space, ADDRESS_MAP_NAME(_map)); #define MCFG_DEVICE_REMOVE_ADDRESS_MAP(_space) \ - device_memory_interface::static_set_addrmap(*device, _space, NULL); + device_memory_interface::static_set_addrmap(*device, _space, nullptr); #define MCFG_DEVICE_PROGRAM_MAP(_map) \ MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _map) diff --git a/src/emu/dinetwork.h b/src/emu/dinetwork.h index f4383f67834..dd78dbcea15 100644 --- a/src/emu/dinetwork.h +++ b/src/emu/dinetwork.h @@ -15,9 +15,9 @@ public: void set_promisc(bool promisc); void set_mac(const char *mac); - const char *get_mac() { return m_mac; } - bool get_promisc() { return m_promisc; } - int get_interface() { return m_intf; } + const char *get_mac() const { return m_mac; } + bool get_promisc() const { return m_promisc; } + int get_interface() const { return m_intf; } int send(UINT8 *buf, int len) const; virtual void recv_cb(UINT8 *buf, int len); diff --git a/src/emu/diserial.h b/src/emu/diserial.h index 185c6849a4d..dbb9c3b8c55 100644 --- a/src/emu/diserial.h +++ b/src/emu/diserial.h @@ -109,12 +109,12 @@ protected: bool is_receive_register_full(); bool is_transmit_register_empty(); - bool is_receive_register_synchronized() { return m_rcv_flags & RECEIVE_REGISTER_SYNCHRONISED; } - bool is_receive_register_shifting() { return m_rcv_bit_count_received > 0; } - bool is_receive_framing_error() { return m_rcv_framing_error; } - bool is_receive_parity_error() { return m_rcv_parity_error; } + bool is_receive_register_synchronized() const { return m_rcv_flags & RECEIVE_REGISTER_SYNCHRONISED; } + bool is_receive_register_shifting() const { return m_rcv_bit_count_received > 0; } + bool is_receive_framing_error() const { return m_rcv_framing_error; } + bool is_receive_parity_error() const { return m_rcv_parity_error; } - UINT8 get_received_char() { return m_rcv_byte_received; } + UINT8 get_received_char() const { return m_rcv_byte_received; } virtual void tra_callback() { } virtual void rcv_callback() { receive_register_update_bit(m_rcv_line); } diff --git a/src/emu/dispatch.h b/src/emu/dispatch.h index f9442a658da..e1d2c510822 100644 --- a/src/emu/dispatch.h +++ b/src/emu/dispatch.h @@ -25,7 +25,8 @@ template<int N> class devcb_line_dispatch_device : public device_t { public: - devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, tag, owner, clock) { } void init_fwd() { for(auto & elem : fwd_cb) diff --git a/src/emu/distate.cpp b/src/emu/distate.cpp index 3fa2fd8e03b..daa8942e3ee 100644 --- a/src/emu/distate.cpp +++ b/src/emu/distate.cpp @@ -111,7 +111,7 @@ device_state_entry &device_state_entry::formatstr(const char *_format) m_format.assign(_format); m_default_format = false; - // set the DSF_CUSTOM_STRING flag by formatting with a NULL string + // set the DSF_CUSTOM_STRING flag by formatting with a nullptr string m_flags &= ~DSF_CUSTOM_STRING; format(nullptr); @@ -417,7 +417,7 @@ device_state_interface::~device_state_interface() UINT64 device_state_interface::state_int(int index) { - // NULL or out-of-range entry returns 0 + // nullptr or out-of-range entry returns 0 const device_state_entry *entry = state_find_entry(index); if (entry == nullptr) return 0; @@ -438,7 +438,7 @@ UINT64 device_state_interface::state_int(int index) std::string device_state_interface::state_string(int index) const { - // NULL or out-of-range entry returns bogus string + // nullptr or out-of-range entry returns bogus string const device_state_entry *entry = state_find_entry(index); if (entry == nullptr) return std::string("???"); @@ -460,7 +460,7 @@ std::string device_state_interface::state_string(int index) const int device_state_interface::state_string_max_length(int index) { - // NULL or out-of-range entry returns bogus string + // nullptr or out-of-range entry returns bogus string const device_state_entry *entry = state_find_entry(index); if (entry == nullptr) return 3; @@ -477,7 +477,7 @@ int device_state_interface::state_string_max_length(int index) void device_state_interface::set_state_int(int index, UINT64 value) { - // NULL or out-of-range entry is a no-op + // nullptr or out-of-range entry is a no-op const device_state_entry *entry = state_find_entry(index); if (entry == nullptr) return; @@ -498,7 +498,7 @@ void device_state_interface::set_state_int(int index, UINT64 value) void device_state_interface::set_state_string(int index, const char *string) { - // NULL or out-of-range entry is a no-op + // nullptr or out-of-range entry is a no-op const device_state_entry *entry = state_find_entry(index); if (entry == nullptr) return; @@ -625,6 +625,6 @@ const device_state_entry *device_state_interface::state_find_entry(int index) co if (entry->m_index == index) return entry; - // handle failure by returning NULL + // handle failure by returning nullptr return nullptr; } diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h index 4a310ca4839..7e4e803c6c9 100644 --- a/src/emu/drawgfxm.h +++ b/src/emu/drawgfxm.h @@ -59,7 +59,7 @@ extern bitmap_ind8 drawgfx_dummy_priority_bitmap; /* macros for using the optional priority */ #define PRIORITY_VALID(x) (sizeof(x) != sizeof(NO_PRIORITY)) -#define PRIORITY_ADDR(p,t,y,x) (PRIORITY_VALID(t) ? (&(p).pixt<t>(y, x)) : NULL) +#define PRIORITY_ADDR(p,t,y,x) (PRIORITY_VALID(t) ? (&(p).pixt<t>(y, x)) : nullptr) #define PRIORITY_ADVANCE(t,p,i) do { if (PRIORITY_VALID(t)) (p) += (i); } while (0) @@ -1173,7 +1173,7 @@ do { assert(destx + length <= bitmap.width()); \ assert(desty >= 0); \ assert(desty < bitmap.height()); \ - assert(srcptr != NULL); \ + assert(srcptr != nullptr); \ assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ \ { \ @@ -1228,7 +1228,7 @@ do { assert(srcx + length <= bitmap.width()); \ assert(srcy >= 0); \ assert(srcy < bitmap.height()); \ - assert(destptr != NULL); \ + assert(destptr != nullptr); \ \ { \ const PIXEL_TYPE *srcptr = &bitmap.pixt<PIXEL_TYPE>(srcy, srcx); \ diff --git a/src/emu/drivenum.h b/src/emu/drivenum.h index faaf685304a..5c7fba7b1b5 100644 --- a/src/emu/drivenum.h +++ b/src/emu/drivenum.h @@ -84,9 +84,9 @@ public: // current item const game_driver &driver() const { return driver_list::driver(m_current); } machine_config &config() const { return config(m_current, m_options); } - int clone() { return driver_list::clone(m_current); } - int non_bios_clone() { return driver_list::non_bios_clone(m_current); } - int compatible_with() { return driver_list::compatible_with(m_current); } + int clone() const { return driver_list::clone(m_current); } + int non_bios_clone() const { return driver_list::non_bios_clone(m_current); } + int compatible_with() const { return driver_list::compatible_with(m_current); } void include() { include(m_current); } void exclude() { exclude(m_current); } diff --git a/src/emu/emucore.h b/src/emu/emucore.h index ae631cecd79..c8c95c1af48 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -209,7 +209,7 @@ inline void operator--(_Type &value, int) { value = (_Type)((int)value - 1); } // this macro wraps a function 'x' and can be used to pass a function followed by its name #define FUNC(x) &x, #x -#define FUNC_NULL NULL, "(null)" +#define FUNC_NULL nullptr, "(null)" // standard assertion macros diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp index fb406709669..649be6d8138 100644 --- a/src/emu/emumem.cpp +++ b/src/emu/emumem.cpp @@ -1050,7 +1050,7 @@ public: accessors.write_qword_masked = reinterpret_cast<void (*)(address_space &, offs_t, UINT64, UINT64)>(&write_qword_masked_static); } - // return a pointer to the read bank, or NULL if none + // return a pointer to the read bank, or nullptr if none virtual void *get_read_ptr(offs_t byteaddress) override { // perform the lookup @@ -1064,7 +1064,7 @@ public: return handler.ramptr(handler.byteoffset(byteaddress)); } - // return a pointer to the write bank, or NULL if none + // return a pointer to the write bank, or nullptr if none virtual void *get_write_ptr(offs_t byteaddress) override { // perform the lookup @@ -4005,9 +4005,9 @@ void memory_bank::invalidate_references() void memory_bank::set_base(void *base) { - // NULL is not an option + // nullptr is not an option if (base == nullptr) - throw emu_fatalerror("memory_bank::set_base called NULL base"); + throw emu_fatalerror("memory_bank::set_base called nullptr base"); // set the base and invalidate any referencing spaces *m_baseptr = reinterpret_cast<UINT8 *>(base); diff --git a/src/emu/emumem.h b/src/emu/emumem.h index 9348058f650..ac17925370d 100644 --- a/src/emu/emumem.h +++ b/src/emu/emumem.h @@ -878,7 +878,7 @@ private: //------------------------------------------------- // read_ptr - return a pointer to valid RAM -// referenced by the address, or NULL if no RAM +// referenced by the address, or nullptr if no RAM // backing that address //------------------------------------------------- diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 9cf84a3a6eb..e7a7d74db2b 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -228,7 +228,7 @@ emu_options::emu_options() //------------------------------------------------- // system - return a pointer to the specified -// system driver, or NULL if no match +// system driver, or nullptr if no match //------------------------------------------------- const game_driver *emu_options::system() const diff --git a/src/emu/fileio.h b/src/emu/fileio.h index e71934ea22a..5e765f660d8 100644 --- a/src/emu/fileio.h +++ b/src/emu/fileio.h @@ -92,7 +92,7 @@ public: const char *fullpath() const { return m_fullpath.c_str(); } UINT32 openflags() const { return m_openflags; } hash_collection &hashes(const char *types); - bool restrict_to_mediapath() { return m_restrict_to_mediapath; } + bool restrict_to_mediapath() const { return m_restrict_to_mediapath; } bool part_of_mediapath(std::string path); // setters diff --git a/src/emu/inpttype.h b/src/emu/inpttype.h index 08415d9e58c..605abe0b024 100644 --- a/src/emu/inpttype.h +++ b/src/emu/inpttype.h @@ -31,7 +31,7 @@ /* split up into small functions to be nicer on optimizers */ -void construct_core_types_P1(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P1(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_UP, "P1 Up", input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) ) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_DOWN, "P1 Down", input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) ) @@ -65,7 +65,7 @@ void construct_core_types_P1(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, SELECT, "P1 Select", input_seq(KEYCODE_5, input_seq::or_code, JOYCODE_SELECT_INDEXED(0)) ) } -void construct_core_types_P1_mahjong(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P1_mahjong(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_A, "P1 Mahjong A", input_seq(KEYCODE_A) ) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_B, "P1 Mahjong B", input_seq(KEYCODE_B) ) @@ -98,7 +98,7 @@ void construct_core_types_P1_mahjong(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_SMALL, "P1 Mahjong Small", input_seq(KEYCODE_BACKSPACE) ) } -void construct_core_types_P1_hanafuda(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P1_hanafuda(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_A, "P1 Hanafuda A/1", input_seq(KEYCODE_A) ) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_B, "P1 Hanafuda B/2", input_seq(KEYCODE_B) ) @@ -112,7 +112,7 @@ void construct_core_types_P1_hanafuda(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_NO, "P1 Hanafuda No", input_seq(KEYCODE_N) ) } -void construct_core_types_gamble(simple_list<input_type_entry> &typelist) +inline void construct_core_types_gamble(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_HIGH, "High", input_seq(KEYCODE_A) ) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_LOW, "Low", input_seq(KEYCODE_S) ) @@ -130,7 +130,7 @@ void construct_core_types_gamble(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, GAMBLE_BOOK, "Book-Keeping", input_seq(KEYCODE_0) ) } -void construct_core_types_poker(simple_list<input_type_entry> &typelist) +inline void construct_core_types_poker(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, POKER_HOLD1, "Hold 1", input_seq(KEYCODE_Z) ) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, POKER_HOLD2, "Hold 2", input_seq(KEYCODE_X) ) @@ -141,7 +141,7 @@ void construct_core_types_poker(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, POKER_BET, "Bet", input_seq(KEYCODE_1) ) } -void construct_core_types_slot(simple_list<input_type_entry> &typelist) +inline void construct_core_types_slot(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, SLOT_STOP1, "Stop Reel 1", input_seq(KEYCODE_X) ) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, SLOT_STOP2, "Stop Reel 2", input_seq(KEYCODE_C) ) @@ -150,7 +150,7 @@ void construct_core_types_slot(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, SLOT_STOP_ALL, "Stop All Reels", input_seq(KEYCODE_Z) ) } -void construct_core_types_P2(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P2(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_UP, "P2 Up", input_seq(KEYCODE_R, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(1)) ) INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_DOWN, "P2 Down", input_seq(KEYCODE_F, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(1)) ) @@ -184,7 +184,7 @@ void construct_core_types_P2(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, SELECT, "P2 Select", input_seq(KEYCODE_6, input_seq::or_code, JOYCODE_SELECT_INDEXED(1)) ) } -void construct_core_types_P2_mahjong(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P2_mahjong(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_A, "P2 Mahjong A", input_seq() ) INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_B, "P2 Mahjong B", input_seq() ) @@ -217,7 +217,7 @@ void construct_core_types_P2_mahjong(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_SMALL, "P2 Mahjong Small", input_seq() ) } -void construct_core_types_P2_hanafuda(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P2_hanafuda(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_A, "P2 Hanafuda A/1", input_seq() ) INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_B, "P2 Hanafuda B/2", input_seq() ) @@ -231,7 +231,7 @@ void construct_core_types_P2_hanafuda(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_NO, "P2 Hanafuda No", input_seq() ) } -void construct_core_types_P3(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P3(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_UP, "P3 Up", input_seq(KEYCODE_I, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(2)) ) INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_DOWN, "P3 Down", input_seq(KEYCODE_K, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(2)) ) @@ -265,7 +265,7 @@ void construct_core_types_P3(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, SELECT, "P3 Select", input_seq(KEYCODE_7, input_seq::or_code, JOYCODE_SELECT_INDEXED(2)) ) } -void construct_core_types_P4(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P4(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_UP, "P4 Up", input_seq(KEYCODE_8_PAD, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(3)) ) INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_DOWN, "P4 Down", input_seq(KEYCODE_2_PAD, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(3)) ) @@ -299,7 +299,7 @@ void construct_core_types_P4(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, SELECT, "P4 Select", input_seq(KEYCODE_8, input_seq::or_code, JOYCODE_SELECT_INDEXED(3)) ) } -void construct_core_types_P5(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P5(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_UP, "P5 Up", input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(4)) ) INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_DOWN, "P5 Down", input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(4)) ) @@ -333,7 +333,7 @@ void construct_core_types_P5(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, SELECT, "P5 Select", input_seq() ) } -void construct_core_types_P6(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P6(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_UP, "P6 Up", input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(5)) ) INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_DOWN, "P6 Down", input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(5)) ) @@ -367,7 +367,7 @@ void construct_core_types_P6(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, SELECT, "P6 Select", input_seq() ) } -void construct_core_types_P7(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P7(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_UP, "P7 Up", input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(6)) ) INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_DOWN, "P7 Down", input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(6)) ) @@ -401,7 +401,7 @@ void construct_core_types_P7(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, SELECT, "P7 Select", input_seq() ) } -void construct_core_types_P8(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P8(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_UP, "P8 Up", input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(7)) ) INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_DOWN, "P8 Down", input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(7)) ) @@ -435,7 +435,7 @@ void construct_core_types_P8(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, SELECT, "P8 Select", input_seq() ) } -void construct_core_types_P9(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P9(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_UP, "P9 Up", input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(8)) ) INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_DOWN, "P9 Down", input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(8)) ) @@ -469,7 +469,7 @@ void construct_core_types_P9(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, SELECT, "P9 Select", input_seq() ) } -void construct_core_types_P10(simple_list<input_type_entry> &typelist) +inline void construct_core_types_P10(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_UP, "P10 Up", input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(9)) ) INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_DOWN, "P10 Down", input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(9)) ) @@ -503,7 +503,7 @@ void construct_core_types_P10(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, SELECT, "P10 Select", input_seq() ) } -void construct_core_types_start(simple_list<input_type_entry> &typelist) +inline void construct_core_types_start(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START1, "1 Player Start", input_seq(KEYCODE_1, input_seq::or_code, JOYCODE_START_INDEXED(0)) ) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START2, "2 Players Start", input_seq(KEYCODE_2, input_seq::or_code, JOYCODE_START_INDEXED(1)) ) @@ -515,7 +515,7 @@ void construct_core_types_start(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, START8, "8 Players Start", input_seq() ) } -void construct_core_types_coin(simple_list<input_type_entry> &typelist) +inline void construct_core_types_coin(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN1, "Coin 1", input_seq(KEYCODE_5, input_seq::or_code, JOYCODE_SELECT_INDEXED(0)) ) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, COIN2, "Coin 2", input_seq(KEYCODE_6, input_seq::or_code, JOYCODE_SELECT_INDEXED(1)) ) @@ -532,7 +532,7 @@ void construct_core_types_coin(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, BILL1, "Bill 1", input_seq(KEYCODE_BACKSPACE) ) } -void construct_core_types_service(simple_list<input_type_entry> &typelist) +inline void construct_core_types_service(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 0, OTHER, SERVICE1, "Service 1", input_seq(KEYCODE_9) ) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, SERVICE2, "Service 2", input_seq(KEYCODE_0) ) @@ -540,7 +540,7 @@ void construct_core_types_service(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, SERVICE4, "Service 4", input_seq(KEYCODE_EQUALS) ) } -void construct_core_types_tilt(simple_list<input_type_entry> &typelist) +inline void construct_core_types_tilt(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 0, OTHER, TILT1, "Tilt 1", input_seq(KEYCODE_T) ) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, TILT2, "Tilt 2", input_seq() ) @@ -548,7 +548,7 @@ void construct_core_types_tilt(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, TILT4, "Tilt 4", input_seq() ) } -void construct_core_types_other(simple_list<input_type_entry> &typelist) +inline void construct_core_types_other(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 0, OTHER, POWER_ON, "Power On", input_seq(KEYCODE_F1) ) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, POWER_OFF, "Power Off", input_seq(KEYCODE_F2) ) @@ -559,7 +559,7 @@ void construct_core_types_other(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, VOLUME_UP, "Volume Up", input_seq(KEYCODE_EQUALS) ) } -void construct_core_types_pedal(simple_list<input_type_entry> &typelist) +inline void construct_core_types_pedal(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PEDAL, "P1 Pedal 1", input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(0)), input_seq(), input_seq(KEYCODE_LCONTROL, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0)) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PEDAL, "P2 Pedal 1", input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(1)), input_seq(), input_seq(KEYCODE_A, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(1)) ) @@ -573,7 +573,7 @@ void construct_core_types_pedal(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PEDAL, "P10 Pedal 1", input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(9)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(9)) ) } -void construct_core_types_pedal2(simple_list<input_type_entry> &typelist) +inline void construct_core_types_pedal2(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PEDAL2, "P1 Pedal 2", input_seq(JOYCODE_Z_POS_ABSOLUTE_INDEXED(0)), input_seq(), input_seq(KEYCODE_LALT, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(0)) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PEDAL2, "P2 Pedal 2", input_seq(JOYCODE_Z_POS_ABSOLUTE_INDEXED(1)), input_seq(), input_seq(KEYCODE_S, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(1)) ) @@ -587,7 +587,7 @@ void construct_core_types_pedal2(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PEDAL2, "P10 Pedal 2", input_seq(JOYCODE_Z_POS_ABSOLUTE_INDEXED(9)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(9)) ) } -void construct_core_types_pedal3(simple_list<input_type_entry> &typelist) +inline void construct_core_types_pedal3(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PEDAL3, "P1 Pedal 3", input_seq(), input_seq(), input_seq(KEYCODE_SPACE, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(0)) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PEDAL3, "P2 Pedal 3", input_seq(), input_seq(), input_seq(KEYCODE_Q, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(1)) ) @@ -601,7 +601,7 @@ void construct_core_types_pedal3(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PEDAL3, "P10 Pedal 3", input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(9)) ) } -void construct_core_types_paddle(simple_list<input_type_entry> &typelist) +inline void construct_core_types_paddle(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PADDLE, "Paddle", input_seq(JOYCODE_X_INDEXED(0), input_seq::or_code, MOUSECODE_X_INDEXED(0)), input_seq(KEYCODE_LEFT), input_seq(KEYCODE_RIGHT) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PADDLE, "Paddle 2", input_seq(JOYCODE_X_INDEXED(1), input_seq::or_code, MOUSECODE_X_INDEXED(1)), input_seq(KEYCODE_D), input_seq(KEYCODE_G) ) @@ -615,7 +615,7 @@ void construct_core_types_paddle(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PADDLE, "Paddle 10", input_seq(JOYCODE_X_INDEXED(9), input_seq::or_code, MOUSECODE_X_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_paddle_v(simple_list<input_type_entry> &typelist) +inline void construct_core_types_paddle_v(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PADDLE_V, "Paddle V", input_seq(JOYCODE_Y_INDEXED(0), input_seq::or_code, MOUSECODE_Y_INDEXED(0)), input_seq(KEYCODE_UP), input_seq(KEYCODE_DOWN) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PADDLE_V, "Paddle V 2", input_seq(JOYCODE_Y_INDEXED(1), input_seq::or_code, MOUSECODE_Y_INDEXED(1)), input_seq(KEYCODE_R), input_seq(KEYCODE_F) ) @@ -629,7 +629,7 @@ void construct_core_types_paddle_v(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PADDLE_V, "Paddle V 10", input_seq(JOYCODE_Y_INDEXED(9), input_seq::or_code, MOUSECODE_Y_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_positional(simple_list<input_type_entry> &typelist) +inline void construct_core_types_positional(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, POSITIONAL, "Positional", input_seq(MOUSECODE_X_INDEXED(0), input_seq::or_code, JOYCODE_X_INDEXED(0)), input_seq(KEYCODE_LEFT), input_seq(KEYCODE_RIGHT) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, POSITIONAL, "Positional 2", input_seq(MOUSECODE_X_INDEXED(1), input_seq::or_code, JOYCODE_X_INDEXED(1)), input_seq(KEYCODE_D), input_seq(KEYCODE_G) ) @@ -643,7 +643,7 @@ void construct_core_types_positional(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, POSITIONAL, "Positional 10", input_seq(MOUSECODE_X_INDEXED(9), input_seq::or_code, JOYCODE_X_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_positional_v(simple_list<input_type_entry> &typelist) +inline void construct_core_types_positional_v(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, POSITIONAL_V, "Positional V", input_seq(MOUSECODE_Y_INDEXED(0), input_seq::or_code, JOYCODE_Y_INDEXED(0)), input_seq(KEYCODE_UP), input_seq(KEYCODE_DOWN) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, POSITIONAL_V, "Positional V 2", input_seq(MOUSECODE_Y_INDEXED(1), input_seq::or_code, JOYCODE_Y_INDEXED(1)), input_seq(KEYCODE_R), input_seq(KEYCODE_F) ) @@ -657,7 +657,7 @@ void construct_core_types_positional_v(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, POSITIONAL_V, "Positional V 10", input_seq(MOUSECODE_Y_INDEXED(9), input_seq::or_code, JOYCODE_Y_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_dial(simple_list<input_type_entry> &typelist) +inline void construct_core_types_dial(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, DIAL, "Dial", input_seq(MOUSECODE_X_INDEXED(0), input_seq::or_code, JOYCODE_X_INDEXED(0)), input_seq(KEYCODE_LEFT), input_seq(KEYCODE_RIGHT) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, DIAL, "Dial 2", input_seq(MOUSECODE_X_INDEXED(1), input_seq::or_code, JOYCODE_X_INDEXED(1)), input_seq(KEYCODE_D), input_seq(KEYCODE_G) ) @@ -671,7 +671,7 @@ void construct_core_types_dial(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, DIAL, "Dial 10", input_seq(MOUSECODE_X_INDEXED(9), input_seq::or_code, JOYCODE_X_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_dial_v(simple_list<input_type_entry> &typelist) +inline void construct_core_types_dial_v(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, DIAL_V, "Dial V", input_seq(MOUSECODE_Y_INDEXED(0), input_seq::or_code, JOYCODE_Y_INDEXED(0)), input_seq(KEYCODE_UP), input_seq(KEYCODE_DOWN) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, DIAL_V, "Dial V 2", input_seq(MOUSECODE_Y_INDEXED(1), input_seq::or_code, JOYCODE_Y_INDEXED(1)), input_seq(KEYCODE_R), input_seq(KEYCODE_F) ) @@ -685,7 +685,7 @@ void construct_core_types_dial_v(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, DIAL_V, "Dial V 10", input_seq(MOUSECODE_Y_INDEXED(9), input_seq::or_code, JOYCODE_Y_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_trackball_X(simple_list<input_type_entry> &typelist) +inline void construct_core_types_trackball_X(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, TRACKBALL_X, "Track X", input_seq(MOUSECODE_X_INDEXED(0), input_seq::or_code, JOYCODE_X_INDEXED(0)), input_seq(KEYCODE_LEFT), input_seq(KEYCODE_RIGHT) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, TRACKBALL_X, "Track X 2", input_seq(MOUSECODE_X_INDEXED(1), input_seq::or_code, JOYCODE_X_INDEXED(1)), input_seq(KEYCODE_D), input_seq(KEYCODE_G) ) @@ -699,7 +699,7 @@ void construct_core_types_trackball_X(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, TRACKBALL_X, "Track X 10", input_seq(MOUSECODE_X_INDEXED(9), input_seq::or_code, JOYCODE_X_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_trackball_Y(simple_list<input_type_entry> &typelist) +inline void construct_core_types_trackball_Y(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, TRACKBALL_Y, "Track Y", input_seq(MOUSECODE_Y_INDEXED(0), input_seq::or_code, JOYCODE_Y_INDEXED(0)), input_seq(KEYCODE_UP), input_seq(KEYCODE_DOWN) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, TRACKBALL_Y, "Track Y 2", input_seq(MOUSECODE_Y_INDEXED(1), input_seq::or_code, JOYCODE_Y_INDEXED(1)), input_seq(KEYCODE_R), input_seq(KEYCODE_F) ) @@ -713,7 +713,7 @@ void construct_core_types_trackball_Y(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, TRACKBALL_Y, "Track Y 10", input_seq(MOUSECODE_Y_INDEXED(9), input_seq::or_code, JOYCODE_Y_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_AD_stick_X(simple_list<input_type_entry> &typelist) +inline void construct_core_types_AD_stick_X(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, AD_STICK_X, "AD Stick X", input_seq(JOYCODE_X_INDEXED(0), input_seq::or_code, MOUSECODE_X_INDEXED(0)), input_seq(KEYCODE_LEFT), input_seq(KEYCODE_RIGHT) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, AD_STICK_X, "AD Stick X 2", input_seq(JOYCODE_X_INDEXED(1), input_seq::or_code, MOUSECODE_X_INDEXED(1)), input_seq(KEYCODE_D), input_seq(KEYCODE_G) ) @@ -727,7 +727,7 @@ void construct_core_types_AD_stick_X(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, AD_STICK_X, "AD Stick X 10", input_seq(JOYCODE_X_INDEXED(9), input_seq::or_code, MOUSECODE_X_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_AD_stick_Y(simple_list<input_type_entry> &typelist) +inline void construct_core_types_AD_stick_Y(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, AD_STICK_Y, "AD Stick Y", input_seq(JOYCODE_Y_INDEXED(0), input_seq::or_code, MOUSECODE_Y_INDEXED(0)), input_seq(KEYCODE_UP), input_seq(KEYCODE_DOWN) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, AD_STICK_Y, "AD Stick Y 2", input_seq(JOYCODE_Y_INDEXED(1), input_seq::or_code, MOUSECODE_Y_INDEXED(1)), input_seq(KEYCODE_R), input_seq(KEYCODE_F) ) @@ -741,7 +741,7 @@ void construct_core_types_AD_stick_Y(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, AD_STICK_Y, "AD Stick Y 10", input_seq(JOYCODE_Y_INDEXED(9), input_seq::or_code, MOUSECODE_Y_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_AD_stick_Z(simple_list<input_type_entry> &typelist) +inline void construct_core_types_AD_stick_Z(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, AD_STICK_Z, "AD Stick Z", input_seq(JOYCODE_Z_INDEXED(0)), input_seq(KEYCODE_A), input_seq(KEYCODE_Z) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, AD_STICK_Z, "AD Stick Z 2", input_seq(JOYCODE_Z_INDEXED(1)), input_seq(), input_seq() ) @@ -755,7 +755,7 @@ void construct_core_types_AD_stick_Z(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, AD_STICK_Z, "AD Stick Z 10", input_seq(JOYCODE_Z_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_lightgun_X(simple_list<input_type_entry> &typelist) +inline void construct_core_types_lightgun_X(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, LIGHTGUN_X, "Lightgun X", input_seq(GUNCODE_X_INDEXED(0), input_seq::or_code, MOUSECODE_X_INDEXED(0), input_seq::or_code, JOYCODE_X_INDEXED(0)), input_seq(KEYCODE_LEFT), input_seq(KEYCODE_RIGHT) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, LIGHTGUN_X, "Lightgun X 2", input_seq(GUNCODE_X_INDEXED(1), input_seq::or_code, MOUSECODE_X_INDEXED(1), input_seq::or_code, JOYCODE_X_INDEXED(1)), input_seq(KEYCODE_D), input_seq(KEYCODE_G) ) @@ -769,7 +769,7 @@ void construct_core_types_lightgun_X(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, LIGHTGUN_X, "Lightgun X 10", input_seq(GUNCODE_X_INDEXED(9), input_seq::or_code, MOUSECODE_X_INDEXED(9), input_seq::or_code, JOYCODE_X_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_lightgun_Y(simple_list<input_type_entry> &typelist) +inline void construct_core_types_lightgun_Y(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, LIGHTGUN_Y, "Lightgun Y", input_seq(GUNCODE_Y_INDEXED(0), input_seq::or_code, MOUSECODE_Y_INDEXED(0), input_seq::or_code, JOYCODE_Y_INDEXED(0)), input_seq(KEYCODE_UP), input_seq(KEYCODE_DOWN) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, LIGHTGUN_Y, "Lightgun Y 2", input_seq(GUNCODE_Y_INDEXED(1), input_seq::or_code, MOUSECODE_Y_INDEXED(1), input_seq::or_code, JOYCODE_Y_INDEXED(1)), input_seq(KEYCODE_R), input_seq(KEYCODE_F) ) @@ -783,7 +783,7 @@ void construct_core_types_lightgun_Y(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, LIGHTGUN_Y, "Lightgun Y 10", input_seq(GUNCODE_Y_INDEXED(9), input_seq::or_code, MOUSECODE_Y_INDEXED(9), input_seq::or_code, JOYCODE_Y_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_mouse_X(simple_list<input_type_entry> &typelist) +inline void construct_core_types_mouse_X(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, MOUSE_X, "Mouse X", input_seq(MOUSECODE_X_INDEXED(0)), input_seq(KEYCODE_LEFT), input_seq(KEYCODE_RIGHT) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, MOUSE_X, "Mouse X 2", input_seq(MOUSECODE_X_INDEXED(1)), input_seq(KEYCODE_D), input_seq(KEYCODE_G) ) @@ -797,7 +797,7 @@ void construct_core_types_mouse_X(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, MOUSE_X, "Mouse X 10", input_seq(MOUSECODE_X_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_mouse_Y(simple_list<input_type_entry> &typelist) +inline void construct_core_types_mouse_Y(simple_list<input_type_entry> &typelist) { INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, MOUSE_Y, "Mouse Y", input_seq(MOUSECODE_Y_INDEXED(0)), input_seq(KEYCODE_UP), input_seq(KEYCODE_DOWN) ) INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, MOUSE_Y, "Mouse Y 2", input_seq(MOUSECODE_Y_INDEXED(1)), input_seq(KEYCODE_R), input_seq(KEYCODE_F) ) @@ -811,13 +811,13 @@ void construct_core_types_mouse_Y(simple_list<input_type_entry> &typelist) INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, MOUSE_Y, "Mouse Y 10", input_seq(MOUSECODE_Y_INDEXED(9)), input_seq(), input_seq() ) } -void construct_core_types_keypad(simple_list<input_type_entry> &typelist) +inline void construct_core_types_keypad(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 0, OTHER, KEYPAD, "Keypad", input_seq() ) INPUT_PORT_DIGITAL_TYPE( 0, OTHER, KEYBOARD, "Keyboard", input_seq() ) } -void construct_core_types_UI(simple_list<input_type_entry> &typelist) +inline void construct_core_types_UI(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_ON_SCREEN_DISPLAY,"On Screen Display", input_seq(KEYCODE_TILDE) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DEBUG_BREAK, "Break in Debugger", input_seq(KEYCODE_TILDE) ) @@ -875,7 +875,7 @@ void construct_core_types_UI(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_AUDIT_ALL, "UI Audit All", input_seq(KEYCODE_F1, KEYCODE_LSHIFT) ) } -void construct_core_types_OSD(simple_list<input_type_entry> &typelist) +inline void construct_core_types_OSD(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_1, nullptr, input_seq() ) INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_2, nullptr, input_seq() ) @@ -895,7 +895,7 @@ void construct_core_types_OSD(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_16, nullptr, input_seq() ) } -void construct_core_types_invalid(simple_list<input_type_entry> &typelist) +inline void construct_core_types_invalid(simple_list<input_type_entry> &typelist) { INPUT_PORT_DIGITAL_TYPE( 0, INVALID, UNKNOWN, nullptr, input_seq() ) INPUT_PORT_DIGITAL_TYPE( 0, INVALID, UNUSED, nullptr, input_seq() ) @@ -906,7 +906,7 @@ void construct_core_types_invalid(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 0, INVALID, CONFIG, nullptr, input_seq() ) } -void construct_core_types(simple_list<input_type_entry> &typelist) +inline void construct_core_types(simple_list<input_type_entry> &typelist) { construct_core_types_P1(typelist); construct_core_types_P1_mahjong(typelist); diff --git a/src/emu/input.cpp b/src/emu/input.cpp index 68e825402b4..360810a3b6c 100644 --- a/src/emu/input.cpp +++ b/src/emu/input.cpp @@ -1184,7 +1184,7 @@ void input_manager::reset_polling() for (input_device_class devclass = DEVICE_CLASS_FIRST_VALID; devclass <= DEVICE_CLASS_LAST_VALID; ++devclass) for (int devnum = 0; devnum <= m_class[devclass]->maxindex(); devnum++) { - // fetch the device; ignore if NULL + // fetch the device; ignore if nullptr input_device *device = m_class[devclass]->device(devnum); if (device == nullptr) continue; @@ -1211,7 +1211,7 @@ input_code input_manager::poll_switches() for (input_device_class devclass = DEVICE_CLASS_FIRST_VALID; devclass <= DEVICE_CLASS_LAST_VALID; ++devclass) for (int devnum = 0; devnum <= m_class[devclass]->maxindex(); devnum++) { - // fetch the device; ignore if NULL + // fetch the device; ignore if nullptr input_device *device = m_class[devclass]->device(devnum); if (device == nullptr) continue; @@ -1291,7 +1291,7 @@ input_code input_manager::poll_keyboard_switches() // iterate over devices within each class for (int devnum = 0; devnum < m_keyboard_class.maxindex(); devnum++) { - // fetch the device; ignore if NULL + // fetch the device; ignore if nullptr input_device *device = m_keyboard_class.device(devnum); if (device == nullptr) continue; @@ -1365,7 +1365,7 @@ input_code input_manager::poll_axes() for (input_device_class devclass = DEVICE_CLASS_FIRST_VALID; devclass <= DEVICE_CLASS_LAST_VALID; ++devclass) for (int devnum = 0; devnum <= m_class[devclass]->maxindex(); devnum++) { - // fetch the device; ignore if NULL + // fetch the device; ignore if nullptr input_device *device = m_class[devclass]->device(devnum); if (device == nullptr) continue; @@ -1400,7 +1400,7 @@ input_device *input_manager::device_from_code(input_code code) const if (devclass >= DEVICE_CLASS_FIRST_VALID && devclass <= DEVICE_CLASS_LAST_VALID) return m_class[devclass]->device(code.device_index()); - // otherwise, return NULL + // otherwise, return nullptr return nullptr; } diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index c7c40b139f2..5a68a76a0ae 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -3315,7 +3315,7 @@ void ioport_manager::save_game_inputs(xml_data_node *parentnode) template<typename _Type> _Type ioport_manager::playback_read(_Type &result) { - // protect against NULL handles if previous reads fail + // protect against nullptr handles if previous reads fail if (!m_playback_file.is_open()) result = 0; @@ -3480,7 +3480,7 @@ void ioport_manager::playback_port(ioport_port &port) template<typename _Type> void ioport_manager::record_write(_Type value) { - // protect against NULL handles if previous reads fail + // protect against nullptr handles if previous reads fail if (!m_record_file.is_open()) return; @@ -3499,7 +3499,7 @@ void ioport_manager::record_write<bool>(bool value) template<typename _Type> void ioport_manager::timecode_write(_Type value) { - // protect against NULL handles if previous reads fail + // protect against nullptr handles if previous reads fail if (!m_timecode_file.is_open()) return; diff --git a/src/emu/ioport.h b/src/emu/ioport.h index f3bbb0ab272..fb02918be1f 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -1195,7 +1195,7 @@ private: // internal state ioport_field * m_next; // pointer to next field in sequence ioport_port & m_port; // reference to the port that owns us - std::unique_ptr<ioport_field_live> m_live; // live state of field (NULL if not live) + std::unique_ptr<ioport_field_live> m_live; // live state of field (nullptr if not live) int m_modcount; // modification count simple_list<ioport_setting> m_settinglist; // list of input_setting_configs simple_list<ioport_diplocation> m_diploclist; // list of locations for various bits @@ -1321,7 +1321,7 @@ private: std::string m_tag; // copy of this port's tag int m_modcount; // modification count ioport_value m_active; // mask of active bits in the port - std::unique_ptr<ioport_port_live> m_live; // live state of port (NULL if not live) + std::unique_ptr<ioport_port_live> m_live; // live state of port (nullptr if not live) }; inline ioport_value read_safe(ioport_port *port, ioport_value defval) { return (port == nullptr) ? defval : port->read(); } @@ -1543,7 +1543,7 @@ private: template<typename _Type> void timecode_write(_Type value); void timecode_init(); - void timecode_end(const char *message = NULL); + void timecode_end(const char *message = nullptr); // internal state running_machine & m_machine; // reference to owning machine @@ -1563,11 +1563,11 @@ private: attoseconds_t m_last_delta_nsec; // nanoseconds that passed since the previous callback // playback/record information - emu_file m_record_file; // recording file (NULL if not recording) - emu_file m_playback_file; // playback file (NULL if not recording) + emu_file m_record_file; // recording file (nullptr if not recording) + emu_file m_playback_file; // playback file (nullptr if not recording) UINT64 m_playback_accumulated_speed; // accumulated speed during playback UINT32 m_playback_accumulated_frames; // accumulated frames during playback - emu_file m_timecode_file; // timecode/frames playback file (NULL if not recording) + emu_file m_timecode_file; // timecode/frames playback file (nullptr if not recording) int m_timecode_count; attotime m_timecode_last_time; @@ -1675,7 +1675,7 @@ private: //************************************************************************** // so that "0" can be used for unneeded input ports -#define construct_ioport_0 NULL +#define construct_ioport_0 nullptr // name of table #define INPUT_PORTS_NAME(_name) construct_ioport_##_name @@ -1706,7 +1706,7 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s #define PORT_BIT(_mask, _default, _type) \ configurer.field_alloc((_type), (_default), (_mask)); #define PORT_SPECIAL_ONOFF(_mask, _default, _strindex) \ - PORT_SPECIAL_ONOFF_DIPLOC(_mask, _default, _strindex, NULL) + PORT_SPECIAL_ONOFF_DIPLOC(_mask, _default, _strindex, nullptr) #define PORT_SPECIAL_ONOFF_DIPLOC(_mask, _default, _strindex, _diploc) \ configurer.onoff_alloc(DEF_STR(_strindex), _default, _mask, _diploc); @@ -1779,10 +1779,10 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s configurer.field_set_crosshair(CROSSHAIR_AXIS_##axis, altaxis, scale, offset); #define PORT_CROSSHAIR_MAPPER(_callback) \ - configurer.field_set_crossmapper(ioport_field_crossmap_delegate(_callback, #_callback, DEVICE_SELF, (device_t *)NULL)); + configurer.field_set_crossmapper(ioport_field_crossmap_delegate(_callback, #_callback, DEVICE_SELF, (device_t *)nullptr)); #define PORT_CROSSHAIR_MAPPER_MEMBER(_device, _class, _member) \ - configurer.field_set_crossmapper(ioport_field_crossmap_delegate(&_class::_member, #_class "::" #_member, _device, (_class *)NULL)); + configurer.field_set_crossmapper(ioport_field_crossmap_delegate(&_class::_member, #_class "::" #_member, _device, (_class *)nullptr)); // how many optical counts for 1 full turn of the control #define PORT_FULL_TURN_COUNT(_count) \ @@ -1809,19 +1809,19 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s // read callbacks #define PORT_CUSTOM_MEMBER(_device, _class, _member, _param) \ - configurer.field_set_dynamic_read(ioport_field_read_delegate(&_class::_member, #_class "::" #_member, _device, (_class *)NULL), (void *)(_param)); + configurer.field_set_dynamic_read(ioport_field_read_delegate(&_class::_member, #_class "::" #_member, _device, (_class *)nullptr), (void *)(_param)); // write callbacks #define PORT_CHANGED_MEMBER(_device, _class, _member, _param) \ - configurer.field_set_dynamic_write(ioport_field_write_delegate(&_class::_member, #_class "::" #_member, _device, (_class *)NULL), (void *)(_param)); + configurer.field_set_dynamic_write(ioport_field_write_delegate(&_class::_member, #_class "::" #_member, _device, (_class *)nullptr), (void *)(_param)); // input device handler #define PORT_READ_LINE_DEVICE_MEMBER(_device, _class, _member) \ - configurer.field_set_dynamic_read(ioport_field_read_delegate([](_class &device, ioport_field &field, void *param)->ioport_value { return (device._member() & 1) ? ~ioport_value(0) : 0; } , #_class "::" #_member, _device, (_class *)NULL)); + configurer.field_set_dynamic_read(ioport_field_read_delegate([](_class &device, ioport_field &field, void *param)->ioport_value { return (device._member() & 1) ? ~ioport_value(0) : 0; } , #_class "::" #_member, _device, (_class *)nullptr)); // output device handler #define PORT_WRITE_LINE_DEVICE_MEMBER(_device, _class, _member) \ - configurer.field_set_dynamic_write(ioport_field_write_delegate([](_class &device, ioport_field &field, void *param, ioport_value oldval, ioport_value newval) { device._member(newval); }, #_class "::" #_member, _device, (_class *)NULL)); + configurer.field_set_dynamic_write(ioport_field_write_delegate([](_class &device, ioport_field &field, void *param, ioport_value oldval, ioport_value newval) { device._member(newval); }, #_class "::" #_member, _device, (_class *)nullptr)); // dip switch definition #define PORT_DIPNAME(_mask, _default, _name) \ @@ -1853,10 +1853,10 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s // name of table #define DEVICE_INPUT_DEFAULTS_NAME(_name) device_iptdef_##_name -#define device_iptdef_0 NULL -#define device_iptdef_0L NULL -#define device_iptdef_0LL NULL -#define device_iptdef___null NULL +#define device_iptdef_0 nullptr +#define device_iptdef_0L nullptr +#define device_iptdef_0LL nullptr +#define device_iptdef___null nullptr // start of table #define DEVICE_INPUT_DEFAULTS_START(_name) \ @@ -1866,7 +1866,7 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s { _tag ,_mask, _defval }, // end of table #define DEVICE_INPUT_DEFAULTS_END \ - {NULL,0,0} }; + {nullptr,0,0} }; diff --git a/src/emu/machine.h b/src/emu/machine.h index 45001f406bb..573825c389c 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -244,7 +244,7 @@ public: private: // video-related information - screen_device * primary_screen; // the primary screen device, or NULL if screenless + screen_device * primary_screen; // the primary screen device, or nullptr if screenless public: // debugger-related information @@ -382,7 +382,7 @@ private: template <typename Format, typename... Params> inline void running_machine::popmessage(Format &&fmt, Params &&... args) const { - // if the format is NULL, it is a signal to clear the popmessage + // if the format is nullptr, it is a signal to clear the popmessage // otherwise, generate the buffer and call the UI to display the message if (is_null<Format>::value(fmt)) popup_clear(); diff --git a/src/emu/main.h b/src/emu/main.h index 5b4d0124fa4..13eacfb3c49 100644 --- a/src/emu/main.h +++ b/src/emu/main.h @@ -76,7 +76,7 @@ public: osd_interface &osd() const { return m_osd; } emu_options &options() const { return m_options; } - running_machine *machine() { return m_machine; } + running_machine *machine() const { return m_machine; } void set_machine(running_machine *machine) { m_machine = machine; } diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index 582ea14d035..a2ae9638527 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -114,9 +114,9 @@ private: #define MACHINE_CONFIG_START(_name, _class) \ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t *owner, device_t *device) \ { \ - devcb_base *devcb = NULL; \ + devcb_base *devcb = nullptr; \ (void)devcb; \ - if (owner == NULL) owner = config.device_add(NULL, "root", &driver_device_creator<_class>, 0); + if (owner == nullptr) owner = config.device_add(nullptr, "root", &driver_device_creator<_class>, 0); /** @def MACHINE_CONFIG_FRAGMENT(_name) @@ -127,9 +127,9 @@ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t #define MACHINE_CONFIG_FRAGMENT(_name) \ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t *owner, device_t *device) \ { \ - devcb_base *devcb = NULL; \ + devcb_base *devcb = nullptr; \ (void)devcb; \ - assert(owner != NULL); + assert(owner != nullptr); /** @def MACHINE_CONFIG_DERIVED(_name, _base) @@ -141,10 +141,10 @@ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t #define MACHINE_CONFIG_DERIVED(_name, _base) \ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t *owner, device_t *device) \ { \ - devcb_base *devcb = NULL; \ + devcb_base *devcb = nullptr; \ (void)devcb; \ owner = MACHINE_CONFIG_NAME(_base)(config, owner, device); \ - assert(owner != NULL); + assert(owner != nullptr); /** @def MACHINE_CONFIG_DERIVED_CLASS(_name, _base, _class) @@ -157,9 +157,9 @@ Begins a machine_config that is derived from another machine_config that can spe #define MACHINE_CONFIG_DERIVED_CLASS(_name, _base, _class) \ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t *owner, device_t *device) \ { \ - devcb_base *devcb = NULL; \ + devcb_base *devcb = nullptr; \ (void)devcb; \ - if (owner == NULL) owner = config.device_add(NULL, "root", &driver_device_creator<_class>, 0); \ + if (owner == nullptr) owner = config.device_add(nullptr, "root", &driver_device_creator<_class>, 0); \ owner = MACHINE_CONFIG_NAME(_base)(config, owner, device); /** diff --git a/src/emu/output.cpp b/src/emu/output.cpp index 25d37dd4c43..b905c45d70b 100644 --- a/src/emu/output.cpp +++ b/src/emu/output.cpp @@ -183,7 +183,7 @@ INT32 output_manager::get_indexed_value(const char *basename, int index) /*------------------------------------------------- output_set_notifier - sets a notifier callback for a particular output, or for all outputs - if NULL is specified + if nullptr is specified -------------------------------------------------*/ void output_manager::set_notifier(const char *outname, output_notifier_func callback, void *param) diff --git a/src/emu/output.h b/src/emu/output.h index 77798c1eaf1..e83399aa4b1 100644 --- a/src/emu/output.h +++ b/src/emu/output.h @@ -68,10 +68,10 @@ public: // return the current value for a given indexed output INT32 get_indexed_value(const char *outname, int index); - // set a notifier on a particular output, or globally if NULL + // set a notifier on a particular output, or globally if nullptr void set_notifier(const char *outname, output_notifier_func callback, void *param); - // set a notifier on a particular output, or globally if NULL + // set a notifier on a particular output, or globally if nullptr void notify_all(output_notifier_func callback, void *param); // map a name to a unique ID diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 304e667b82f..22f23d3d263 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -546,7 +546,7 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container) case TEXFORMAT_ARGB32: case TEXFORMAT_YUY16: - // if no adjustment necessary, return NULL + // if no adjustment necessary, return nullptr if (!container.has_brightness_contrast_gamma_changes()) return nullptr; return container.bcg_lookup_table(m_format); @@ -2123,7 +2123,7 @@ bool render_target::map_point_internal(INT32 target_x, INT32 target_y, render_co //------------------------------------------------- // view_name - return the name of the indexed -// view, or NULL if it doesn't exist +// view, or nullptr if it doesn't exist //------------------------------------------------- layout_view *render_target::view_by_index(int index) const @@ -2770,7 +2770,7 @@ void render_manager::font_free(render_font *font) void render_manager::invalidate_all(void *refptr) { - // permit NULL + // permit nullptr if (refptr == nullptr) return; diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp index e99bcc12088..70d87856378 100644 --- a/src/emu/rendfont.cpp +++ b/src/emu/rendfont.cpp @@ -32,7 +32,7 @@ inline const char *next_line(const char *ptr) // scan forward until we hit the end or a carriage return while (*ptr != 13 && *ptr != 10 && *ptr != 0) ptr++; - // if we hit the end, return NULL + // if we hit the end, return nullptr if (*ptr == 0) return nullptr; diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index ea2fc8b4bd5..5b945b09d04 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -647,7 +647,7 @@ layout_element::component::component(running_machine &machine, xml_data_node &co } m_stopnames[m_numstops++] = symbollist; - // careful, dirname is NULL if we're coming from internal layout, and our string assignment doesn't like that + // careful, dirname is nullptr if we're coming from internal layout, and our string assignment doesn't like that if (dirname != nullptr) m_dirname = dirname; diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index a7f0d74d826..a03e25e91ed 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -661,7 +661,7 @@ int rom_load_manager::open_rom_file(const char *regiontag, const rom_entry *romp /*------------------------------------------------- rom_fread - cheesy fread that fills with - random data for a NULL file + random data for a nullptr file -------------------------------------------------*/ int rom_load_manager::rom_fread(UINT8 *buffer, int length, const rom_entry *parent_region) diff --git a/src/emu/romload.h b/src/emu/romload.h index 48190330409..f0553949d96 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -194,11 +194,11 @@ struct rom_entry /* ----- start/stop macros ----- */ #define ROM_NAME(name) rom_##name #define ROM_START(name) static const rom_entry ROM_NAME(name)[] = { -#define ROM_END { NULL, NULL, 0, 0, ROMENTRYTYPE_END } }; +#define ROM_END { nullptr, nullptr, 0, 0, ROMENTRYTYPE_END } }; /* ----- ROM region macros ----- */ -#define ROM_REGION(length,tag,flags) { tag, NULL, 0, length, ROMENTRYTYPE_REGION | (flags) }, +#define ROM_REGION(length,tag,flags) { tag, nullptr, 0, length, ROMENTRYTYPE_REGION | (flags) }, #define ROM_REGION16_LE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_16BIT | ROMREGION_LE) #define ROM_REGION16_BE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_16BIT | ROMREGION_BE) #define ROM_REGION32_LE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_32BIT | ROMREGION_LE) @@ -229,19 +229,19 @@ struct rom_entry /* ----- ROM_RELOAD related macros ----- */ -#define ROM_RELOAD(offset,length) { NULL, NULL, offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS }, -#define ROM_RELOAD_PLAIN(offset,length) { NULL, NULL, offset, length, ROMENTRYTYPE_RELOAD }, +#define ROM_RELOAD(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS }, +#define ROM_RELOAD_PLAIN(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD }, /* ----- additional ROM-related macros ----- */ -#define ROM_CONTINUE(offset,length) { NULL, NULL, offset, length, ROMENTRYTYPE_CONTINUE | ROM_INHERITFLAGS }, -#define ROM_IGNORE(length) { NULL, NULL, 0, length, ROMENTRYTYPE_IGNORE | ROM_INHERITFLAGS }, -#define ROM_FILL(offset,length,value) { NULL, (const char *)value, offset, length, ROMENTRYTYPE_FILL }, +#define ROM_CONTINUE(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_CONTINUE | ROM_INHERITFLAGS }, +#define ROM_IGNORE(length) { nullptr, nullptr, 0, length, ROMENTRYTYPE_IGNORE | ROM_INHERITFLAGS }, +#define ROM_FILL(offset,length,value) { nullptr, (const char *)value, offset, length, ROMENTRYTYPE_FILL }, #define ROM_COPY(srctag,srcoffs,offset,length) { srctag, (const char *)srcoffs, offset, length, ROMENTRYTYPE_COPY }, /* ----- system BIOS macros ----- */ #define ROM_SYSTEM_BIOS(value,name,description) { name, description, 0, 0, ROMENTRYTYPE_SYSTEM_BIOS | ROM_BIOS(value+1) }, -#define ROM_DEFAULT_BIOS(name) { name, NULL, 0, 0, ROMENTRYTYPE_DEFAULT_BIOS }, +#define ROM_DEFAULT_BIOS(name) { name, nullptr, 0, 0, ROMENTRYTYPE_DEFAULT_BIOS }, /* ----- game parameter macro ----- */ diff --git a/src/emu/save.h b/src/emu/save.h index b4c2c3c2186..fabbcba9071 100644 --- a/src/emu/save.h +++ b/src/emu/save.h @@ -74,7 +74,7 @@ public: state_entry * m_next; // pointer to next entry void * m_data; // pointer to the memory to save/restore std::string m_name; // full name - device_t * m_device; // associated device, NULL if none + device_t * m_device; // associated device, nullptr if none std::string m_module; // module name std::string m_tag; // tag name int m_index; // index diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index fa53767854d..8566e85f2b1 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -67,7 +67,7 @@ screen_device_svg_renderer::screen_device_svg_renderer(memory_region *region) delete[] s; m_rasterizer = nsvgCreateRasterizer(); - for (NSVGshape *shape = m_image->shapes; shape != NULL; shape = shape->next) + for (NSVGshape *shape = m_image->shapes; shape != nullptr; shape = shape->next) if(shape->title[0]) { shape->flags &= ~NSVG_FLAGS_VISIBLE; m_keyed_shapes[shape->title].push_back(shape); diff --git a/src/emu/screen.h b/src/emu/screen.h index cf55fcb0ec8..5f5b3f06030 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -445,13 +445,13 @@ typedef device_type_iterator<&device_creator<screen_device>, screen_device> scre #define MCFG_SCREEN_DEFAULT_POSITION(_xscale, _xoffs, _yscale, _yoffs) \ screen_device::static_set_default_position(*device, _xscale, _xoffs, _yscale, _yoffs); #define MCFG_SCREEN_UPDATE_DRIVER(_class, _method) \ - screen_device::static_set_screen_update(*device, screen_update_delegate_smart(&_class::_method, #_class "::" #_method, NULL)); + screen_device::static_set_screen_update(*device, screen_update_delegate_smart(&_class::_method, #_class "::" #_method, nullptr)); #define MCFG_SCREEN_UPDATE_DEVICE(_device, _class, _method) \ screen_device::static_set_screen_update(*device, screen_update_delegate_smart(&_class::_method, #_class "::" #_method, _device)); #define MCFG_SCREEN_VBLANK_NONE() \ screen_device::static_set_screen_vblank(*device, screen_vblank_delegate()); #define MCFG_SCREEN_VBLANK_DRIVER(_class, _method) \ - screen_device::static_set_screen_vblank(*device, screen_vblank_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); + screen_device::static_set_screen_vblank(*device, screen_vblank_delegate(&_class::_method, #_class "::" #_method, nullptr, (_class *)0)); #define MCFG_SCREEN_VBLANK_DEVICE(_device, _class, _method) \ screen_device::static_set_screen_vblank(*device, screen_vblank_delegate(&_class::_method, #_class "::" #_method, _device, (_class *)0)); #define MCFG_SCREEN_PALETTE(_palette_tag) \ diff --git a/src/emu/softlist.cpp b/src/emu/softlist.cpp index 3d65dca7598..383e4931878 100644 --- a/src/emu/softlist.cpp +++ b/src/emu/softlist.cpp @@ -142,7 +142,7 @@ const char *software_part::feature(const char *feature_name) const bool software_part::is_compatible(const software_list_device &swlistdev) const { - // get the compatibility feature and the softlist filter; if either is NULL, assume compatible + // get the compatibility feature and the softlist filter; if either is nullptr, assume compatible const char *compatibility = feature("compatibility"); const char *filter = swlistdev.filter(); if (compatibility == nullptr || filter == nullptr) @@ -447,7 +447,7 @@ void software_list_device::display_matches(const machine_config &config, const c software_info *software_list_device::find(const char *look_for, software_info *prev) { - // NULL search returns nothing + // nullptr search returns nothing if (look_for == nullptr) return nullptr; diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index 69bde8821c0..48e288fa0c0 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -100,7 +100,7 @@ inline bool tilemap_t::gfx_elements_changed() //************************************************************************** //------------------------------------------------- -// scanline_draw_opaque_null - draw to a NULL +// scanline_draw_opaque_null - draw to a nullptr // bitmap, setting priority only //------------------------------------------------- @@ -117,7 +117,7 @@ inline void tilemap_t::scanline_draw_opaque_null(int count, UINT8 *pri, UINT32 p //------------------------------------------------- -// scanline_draw_masked_null - draw to a NULL +// scanline_draw_masked_null - draw to a nullptr // bitmap using a mask, setting priority only //------------------------------------------------- diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h index 6e4308d6052..610f51b6215 100644 --- a/src/emu/tilemap.h +++ b/src/emu/tilemap.h @@ -370,13 +370,13 @@ enum tilemap_standard_mapper #define MCFG_TILEMAP_BYTES_PER_ENTRY(_bpe) \ tilemap_device::static_set_bytes_per_entry(*device, _bpe); #define MCFG_TILEMAP_INFO_CB_DRIVER(_class, _method) \ - tilemap_device::static_set_info_callback(*device, tilemap_get_info_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); + tilemap_device::static_set_info_callback(*device, tilemap_get_info_delegate(&_class::_method, #_class "::" #_method, nullptr, (_class *)0)); #define MCFG_TILEMAP_INFO_CB_DEVICE(_device, _class, _method) \ tilemap_device::static_set_info_callback(*device, tilemap_get_info_delegate(&_class::_method, #_class "::" #_method, _device, (_class *)0)); #define MCFG_TILEMAP_LAYOUT_STANDARD(_standard, _columns, _rows) \ tilemap_device::static_set_layout(*device, TILEMAP_##_standard, _columns, _rows); #define MCFG_TILEMAP_LAYOUT_CB_DRIVER(_class, _method, _columns, _rows) \ - tilemap_device::static_set_layout(*device, tilemap_mapper_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0), _columns, _rows); + tilemap_device::static_set_layout(*device, tilemap_mapper_delegate(&_class::_method, #_class "::" #_method, nullptr, (_class *)0), _columns, _rows); #define MCFG_TILEMAP_LAYOUT_CB_DEVICE(_device, _class, _method, _columns, _rows) \ tilemap_device::static_set_layout(*device, tilemap_mapper_delegate(&_class::_method, #_class "::" #_method, _device, (_class *)0), _columns, _rows); #define MCFG_TILEMAP_TILE_SIZE(_width, _height) \ diff --git a/src/emu/timer.h b/src/emu/timer.h index 55db37c267b..ecd98b9970f 100644 --- a/src/emu/timer.h +++ b/src/emu/timer.h @@ -35,19 +35,19 @@ timer_device::static_configure_generic(*device, timer_device_expired_delegate()); #define MCFG_TIMER_DRIVER_ADD(_tag, _class, _callback) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \ - timer_device::static_configure_generic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0)); + timer_device::static_configure_generic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, nullptr, (_class *)0)); #define MCFG_TIMER_DEVICE_ADD(_tag, _devtag, _class, _callback) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \ timer_device::static_configure_generic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, _devtag, (_class *)0)); #define MCFG_TIMER_DRIVER_ADD_PERIODIC(_tag, _class, _callback, _period) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \ - timer_device::static_configure_periodic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0), _period); + timer_device::static_configure_periodic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, nullptr, (_class *)0), _period); #define MCFG_TIMER_DEVICE_ADD_PERIODIC(_tag, _devtag, _class, _callback, _period) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \ timer_device::static_configure_periodic(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, _devtag, (_class *)0), _period); #define MCFG_TIMER_DRIVER_ADD_SCANLINE(_tag, _class, _callback, _screen, _first_vpos, _increment) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \ - timer_device::static_configure_scanline(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0), _screen, _first_vpos, _increment); + timer_device::static_configure_scanline(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, nullptr, (_class *)0), _screen, _first_vpos, _increment); #define MCFG_TIMER_DEVICE_ADD_SCANLINE(_tag, _devtag, _class, _callback, _screen, _first_vpos, _increment) \ MCFG_DEVICE_ADD(_tag, TIMER, 0) \ timer_device::static_configure_scanline(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, _devtag, (_class *)0), _screen, _first_vpos, _increment); @@ -55,7 +55,7 @@ MCFG_DEVICE_MODIFY(_tag) #define MCFG_TIMER_DRIVER_CALLBACK(_class, _callback) \ - timer_device::static_set_callback(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, NULL, (_class *)0)); + timer_device::static_set_callback(*device, timer_device_expired_delegate(&_class::_callback, #_class "::" #_callback, nullptr, (_class *)0)); #define MCFG_TIMER_START_DELAY(_start_delay) \ timer_device::static_set_start_delay(*device, _start_delay); #define MCFG_TIMER_PARAM(_param) \ @@ -98,13 +98,13 @@ public: bool enabled() const { return m_timer->enabled(); } // property setters - void set_param(int param) { assert(m_type == TIMER_TYPE_GENERIC); m_timer->set_param(param); } + void set_param(int param) const { assert(m_type == TIMER_TYPE_GENERIC); m_timer->set_param(param); } void set_ptr(void *ptr) { m_ptr = ptr; } - void enable(bool enable = true) { m_timer->enable(enable); } + void enable(bool enable = true) const { m_timer->enable(enable); } // adjustments void reset() { adjust(attotime::never, 0, attotime::never); } - void adjust(const attotime &duration, INT32 param = 0, const attotime &period = attotime::never) { assert(m_type == TIMER_TYPE_GENERIC); m_timer->adjust(duration, param, period); } + void adjust(const attotime &duration, INT32 param = 0, const attotime &period = attotime::never) const { assert(m_type == TIMER_TYPE_GENERIC); m_timer->adjust(duration, param, period); } // timing information attotime time_elapsed() const { return m_timer->elapsed(); } diff --git a/src/emu/ui/cmddata.h b/src/emu/ui/cmddata.h index 31dd8c5ebd8..14c09c73883 100644 --- a/src/emu/ui/cmddata.h +++ b/src/emu/ui/cmddata.h @@ -396,7 +396,7 @@ static fix_strings_t convert_text[] = { "charge", 131 }, // Charge { "tap", 132 }, // Serious Tap { "button", 133 }, // Any Button - { 0, 0 } // end of array + { nullptr, 0 } // end of array }; #endif /* __UI_CMDDATA_H__ */ diff --git a/src/emu/ui/uimain.h b/src/emu/ui/uimain.h index c12107a6cc8..9230892adca 100644 --- a/src/emu/ui/uimain.h +++ b/src/emu/ui/uimain.h @@ -71,6 +71,8 @@ class ui_manager public: // construction/destruction ui_manager(running_machine &machine) : m_machine(machine),m_use_natural_keyboard(false),m_show_timecode_counter(false),m_show_timecode_total(false) { } + + virtual ~ui_manager() { } virtual void set_startup_text(const char *text, bool force) { } @@ -80,8 +82,8 @@ public: void set_show_timecode_counter(bool value) { m_show_timecode_counter = value; m_show_timecode_total = true; } - bool show_timecode_counter() { return m_show_timecode_counter; } - bool show_timecode_total() { return m_show_timecode_total; } + bool show_timecode_counter() const { return m_show_timecode_counter; } + bool show_timecode_total() const { return m_show_timecode_total; } virtual void popup_time_string(int seconds, std::string message) { } diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index 70070623e46..91f218b9470 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -599,7 +599,7 @@ void validity_checker::validate_roms() // check for a valid tag if (basetag == nullptr) { - osd_printf_error("ROM_REGION tag with NULL name\n"); + osd_printf_error("ROM_REGION tag with nullptr name\n"); continue; } @@ -874,7 +874,7 @@ void validity_checker::validate_inputs() { // dip switch fields must have a name if (field.name() == nullptr) - osd_printf_error("DIP switch has a NULL name\n"); + osd_printf_error("DIP switch has a nullptr name\n"); // verify the settings list validate_dip_settings(field); diff --git a/src/emu/video/rgbgen.h b/src/emu/video/rgbgen.h index 4ade036637a..12ec8f3d765 100644 --- a/src/emu/video/rgbgen.h +++ b/src/emu/video/rgbgen.h @@ -35,12 +35,12 @@ public: } inline void set(rgb_t& rgba) { set(rgba.a(), rgba.r(), rgba.g(), rgba.b()); } - inline rgb_t to_rgba() + inline rgb_t to_rgba() const { return rgb_t(m_a, m_r, m_g, m_b); } - inline rgb_t to_rgba_clamp() + inline rgb_t to_rgba_clamp() const { UINT8 a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a; UINT8 r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r; diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp index 099e6344d59..2c48e8c6375 100644 --- a/src/frontend/mame/cheat.cpp +++ b/src/frontend/mame/cheat.cpp @@ -142,7 +142,7 @@ cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, // iterate over items for (xml_data_node *itemnode = xml_get_sibling(paramnode.child, "item"); itemnode != nullptr; itemnode = xml_get_sibling(itemnode->next, "item")) { - // check for NULL text + // check for nullptr text if (itemnode->value == nullptr || itemnode->value[0] == 0) throw emu_fatalerror("%s.xml(%d): item is missing text\n", filename, itemnode->line); @@ -705,7 +705,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons xml_data_node *commentnode = xml_get_sibling(cheatnode.child, "comment"); if (commentnode != nullptr) { - // set the value if not NULL + // set the value if not nullptr if (commentnode->value != nullptr && commentnode->value[0] != 0) m_comment.assign(commentnode->value); diff --git a/src/frontend/mame/info.cpp b/src/frontend/mame/info.cpp index b314770123d..893a25964e3 100644 --- a/src/frontend/mame/info.cpp +++ b/src/frontend/mame/info.cpp @@ -10,7 +10,6 @@ #include "emu.h" #include "mame.h" -#include "emuopts.h" #include "mameopts.h" #include "machine/ram.h" #include "sound/samples.h" diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 1e4f58ef08f..72c36e3bd47 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -40,7 +40,7 @@ #define lua_readline(b,p) \ (fputs(p, stdout), fflush(stdout), /* show prompt */ \ - fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ + fgets(b, LUA_MAXINPUT, stdin) != nullptr) /* get line */ static lua_State *globalL = nullptr; @@ -1669,7 +1669,7 @@ static void *serve_lua(void *param) { lua_engine *engine = (lua_engine *)param; engine->serve_lua(); - return NULL; + return nullptr; } //------------------------------------------------- diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp index 2be1ea0f615..5a528ab51b3 100644 --- a/src/frontend/mame/mame.cpp +++ b/src/frontend/mame/mame.cpp @@ -113,8 +113,9 @@ mame_machine_manager::mame_machine_manager(emu_options &options,osd_interface &o : machine_manager(options, osd), m_plugins(std::make_unique<plugin_options>()), m_lua(global_alloc(lua_engine)), - m_new_driver_pending(nullptr) -{ + m_new_driver_pending(nullptr), + m_autoboot_timer(nullptr) + { } diff --git a/src/frontend/mame/pluginopts.cpp b/src/frontend/mame/pluginopts.cpp index 90b4b138cab..e56a72dfced 100644 --- a/src/frontend/mame/pluginopts.cpp +++ b/src/frontend/mame/pluginopts.cpp @@ -14,7 +14,6 @@ #include <rapidjson/document.h> #include <rapidjson/error/en.h> #include <rapidjson/istreamwrapper.h> -#include <fstream> //************************************************************************** // PLUGIN OPTIONS @@ -66,7 +65,7 @@ void plugin_options::parse_json(std::string path) if (document["plugin"].IsObject()) { - std::string name = document["plugin"]["name"].GetString(); + std::string plugin_name = document["plugin"]["name"].GetString(); std::string description = document["plugin"]["description"].GetString(); std::string type = document["plugin"]["type"].GetString(); bool start = false; @@ -75,7 +74,7 @@ void plugin_options::parse_json(std::string path) if (type=="plugin") { - add_entry(core_strdup(name.c_str()),core_strdup(description.c_str()), OPTION_BOOLEAN, start ? "1" : "0"); + add_entry(core_strdup(plugin_name.c_str()),core_strdup(description.c_str()), OPTION_BOOLEAN, start ? "1" : "0"); } } diff --git a/src/frontend/mame/ui/cheatopt.cpp b/src/frontend/mame/ui/cheatopt.cpp index 8d84c06d759..18fe17f93e4 100644 --- a/src/frontend/mame/ui/cheatopt.cpp +++ b/src/frontend/mame/ui/cheatopt.cpp @@ -156,7 +156,7 @@ ui_menu_cheat::~ui_menu_cheat() menu -------------------------------------------------*/ -ui_menu_autofire::ui_menu_autofire(running_machine &machine, render_container *container) : ui_menu(machine, container) +ui_menu_autofire::ui_menu_autofire(running_machine &machine, render_container *container) : ui_menu(machine, container), last_toggle(false) { const screen_device *screen = machine.first_screen(); diff --git a/src/frontend/mame/ui/custmenu.cpp b/src/frontend/mame/ui/custmenu.cpp index e1d6ed470ca..618b16285cd 100644 --- a/src/frontend/mame/ui/custmenu.cpp +++ b/src/frontend/mame/ui/custmenu.cpp @@ -84,14 +84,14 @@ void ui_menu_custom_filter::handle() { custfltr::other[pos]--; for ( ; custfltr::other[pos] > FILTER_UNAVAILABLE && (custfltr::other[pos] == FILTER_CATEGORY - || custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]--) ; + || custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]--) { }; changed = true; } else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::other[pos] < FILTER_LAST - 1) { custfltr::other[pos]++; for ( ; custfltr::other[pos] < FILTER_LAST && (custfltr::other[pos] == FILTER_CATEGORY - || custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]++) ; + || custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]++) { }; changed = true; } else if (m_event->iptkey == IPT_UI_SELECT) diff --git a/src/frontend/mame/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp index eb0e755d240..78818f33cf8 100644 --- a/src/frontend/mame/ui/custui.cpp +++ b/src/frontend/mame/ui/custui.cpp @@ -216,13 +216,13 @@ ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *con for (ui_options::entry &f_entry : moptions) { - const char *name = f_entry.name(); - if (name && strlen(name) && !strcmp(OPTION_INFOS_SIZE, f_entry.name())) + const char *entry_name = f_entry.name(); + if (entry_name && strlen(entry_name) && !strcmp(OPTION_INFOS_SIZE, f_entry.name())) { m_info_max = atof(f_entry.maximum()); m_info_min = atof(f_entry.minimum()); } - else if (name && strlen(name) && !strcmp(OPTION_FONT_ROWS, f_entry.name())) + else if (entry_name && strlen(entry_name) && !strcmp(OPTION_FONT_ROWS, f_entry.name())) { m_font_max = atof(f_entry.maximum()); m_font_min = atof(f_entry.minimum()); diff --git a/src/frontend/mame/ui/datfile.cpp b/src/frontend/mame/ui/datfile.cpp index 1e2ca1d6938..2264a421b9e 100644 --- a/src/frontend/mame/ui/datfile.cpp +++ b/src/frontend/mame/ui/datfile.cpp @@ -530,19 +530,19 @@ int datfile_manager::index_datafile(dataindex &index, int &swcount) while (cpoint < cends) { // search for comma - size_t found = s_roms.find(",", cpoint); + size_t comma_found = s_roms.find(",", cpoint); // found it - if (found != std::string::npos) + if (comma_found != std::string::npos) { // copy data - name = s_roms.substr(cpoint, found - cpoint); + name = s_roms.substr(cpoint, comma_found - cpoint); // add a SoftwareItem m_swindex[lname].emplace(name, ftell(fp)); // update current point - cpoint = ++found; + cpoint = ++comma_found; swcount++; } else diff --git a/src/frontend/mame/ui/datmenu.cpp b/src/frontend/mame/ui/datmenu.cpp index 7e90e11178d..188e938acff 100644 --- a/src/frontend/mame/ui/datmenu.cpp +++ b/src/frontend/mame/ui/datmenu.cpp @@ -11,7 +11,6 @@ #include "emu.h" #include "ui/ui.h" #include "ui/menu.h" -#include "drivenum.h" #include "rendfont.h" #include "ui/datfile.h" #include "ui/datmenu.h" diff --git a/src/frontend/mame/ui/icorender.h b/src/frontend/mame/ui/icorender.h index ac942ac922e..677ebf001c7 100644 --- a/src/frontend/mame/ui/icorender.h +++ b/src/frontend/mame/ui/icorender.h @@ -64,7 +64,7 @@ typedef struct{ // load an ICO file into a bitmap //------------------------------------------------- -void render_load_ico(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename) +inline void render_load_ico(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename) { INT32 width = 0; INT32 height = 0; diff --git a/src/frontend/mame/ui/imgcntrl.cpp b/src/frontend/mame/ui/imgcntrl.cpp index 78bbf1825a2..07a027e6975 100644 --- a/src/frontend/mame/ui/imgcntrl.cpp +++ b/src/frontend/mame/ui/imgcntrl.cpp @@ -115,10 +115,9 @@ void ui_menu_control_device_image::test_create(bool &can_create, bool &need_conf break; default: - fatalerror("Unexpected\n"); can_create = false; need_confirm = false; - break; + fatalerror("Unexpected\n"); } if (entry != nullptr) diff --git a/src/frontend/mame/ui/mainmenu.cpp b/src/frontend/mame/ui/mainmenu.cpp index 1202bd136f2..acb318b3b41 100644 --- a/src/frontend/mame/ui/mainmenu.cpp +++ b/src/frontend/mame/ui/mainmenu.cpp @@ -11,8 +11,6 @@ #include "emu.h" #include "crsshair.h" #include "emuopts.h" -#include "rendutil.h" -#include "cheat.h" #include "ui/menu.h" #include "ui/filemngr.h" #include "ui/barcode.h" diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index 3c144228d7a..4be8b689a27 100644 --- a/src/frontend/mame/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -18,10 +18,6 @@ #include "ui/utils.h" #include "ui/defimg.h" #include "ui/starimg.h" -#include "ui/optsmenu.h" -#include "ui/datfile.h" -#include "rendfont.h" -#include "ui/custmenu.h" #include "ui/icorender.h" #include "ui/toolbar.h" #include "ui/miscmenu.h" @@ -1435,8 +1431,8 @@ void ui_menu::init_ui(running_machine &machine) sw_toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); toolbar_texture[x] = mrender.texture_alloc(); sw_toolbar_texture[x] = mrender.texture_alloc(); - UINT32 *dst = &toolbar_bitmap[x]->pix32(0); - memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); + UINT32 *texture_dst = &toolbar_bitmap[x]->pix32(0); + memcpy(texture_dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); if (toolbar_bitmap[x]->valid()) toolbar_texture[x]->set_bitmap(*toolbar_bitmap[x], toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); else @@ -1444,8 +1440,8 @@ void ui_menu::init_ui(running_machine &machine) if (x == 0 || x == 2) { - dst = &sw_toolbar_bitmap[x]->pix32(0); - memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); + texture_dst = &sw_toolbar_bitmap[x]->pix32(0); + memcpy(texture_dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); if (sw_toolbar_bitmap[x]->valid()) sw_toolbar_texture[x]->set_bitmap(*sw_toolbar_bitmap[x], sw_toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); else diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp index 8ec09c4dc17..30ba479ada4 100644 --- a/src/frontend/mame/ui/miscmenu.cpp +++ b/src/frontend/mame/ui/miscmenu.cpp @@ -17,7 +17,6 @@ #include "ui/ui.h" #include "ui/menu.h" #include "ui/miscmenu.h" -#include "ui/utils.h" #include "../info.h" #include "ui/inifile.h" #include "ui/submenu.h" @@ -522,7 +521,7 @@ void ui_menu_crosshair::populate() } // else // /* leave a blank filler line when not in auto time so size does not rescale */ -// item_append("", "", NULL, NULL); +// item_append("", "", nullptr, nullptr); } ui_menu_crosshair::~ui_menu_crosshair() diff --git a/src/frontend/mame/ui/optsmenu.cpp b/src/frontend/mame/ui/optsmenu.cpp index d4d3696a27a..3dbebd3a896 100644 --- a/src/frontend/mame/ui/optsmenu.cpp +++ b/src/frontend/mame/ui/optsmenu.cpp @@ -13,12 +13,10 @@ #include "ui/ui.h" #include "ui/menu.h" #include "ui/submenu.h" -#include "ui/datfile.h" #include "ui/inifile.h" #include "ui/selector.h" #include "ui/custui.h" #include "ui/sndmenu.h" -#include "ui/miscmenu.h" #include "ui/optsmenu.h" #include "ui/custmenu.h" #include "ui/inputmap.h" diff --git a/src/frontend/mame/ui/pluginopt.cpp b/src/frontend/mame/ui/pluginopt.cpp index 6d026c8fabe..ec6d0a4f25d 100644 --- a/src/frontend/mame/ui/pluginopt.cpp +++ b/src/frontend/mame/ui/pluginopt.cpp @@ -34,7 +34,7 @@ ui_menu_plugin::ui_menu_plugin(running_machine &machine, render_container *conta void ui_menu_plugin::populate() { for (auto &curplugin : m_plugins) - item_append(curplugin.c_str(), 0, 0, (void *)curplugin.c_str()); + item_append(curplugin.c_str(), nullptr, 0, (void *)curplugin.c_str()); item_append(ui_menu_item_type::SEPARATOR); } diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp index 00fbd75108e..8fccd5bda65 100644 --- a/src/frontend/mame/ui/selgame.cpp +++ b/src/frontend/mame/ui/selgame.cpp @@ -23,7 +23,6 @@ #include "ui/optsmenu.h" #include "ui/selector.h" #include "ui/selsoft.h" -#include "sound/samples.h" #include "ui/custmenu.h" #include "../info.h" #include "ui/auditmenu.h" @@ -2084,13 +2083,13 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or { // check size float textlen = mui.get_string_width(tempbuf.c_str(), text_size); - float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size; + float tmp_size2 = (textlen > sc) ? text_size * (sc / textlen) : text_size; size_t last_underscore = tempbuf.find_last_of("_"); if (last_underscore == std::string::npos) { mui.draw_text_full(container, tempbuf.c_str(), origx1, oy1, origx2 - origx1, JUSTIFY_CENTER, - WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2); } else { @@ -2101,11 +2100,11 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or float item_width; mui.draw_text_full(container, first_part.c_str(), effective_left, oy1, effective_width, - JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &item_width, nullptr, tmp_size); + JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &item_width, nullptr, tmp_size2); mui.draw_text_full(container, last_part.c_str(), effective_left + item_width, oy1, origx2 - origx1 - 2.0f * gutter_width - item_width, JUSTIFY_RIGHT, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2); } } @@ -2114,7 +2113,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or { // check size float textlen = mui.get_string_width(tempbuf.c_str(), text_size); - float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size; + float tmp_size3 = (textlen > sc) ? text_size * (sc / textlen) : text_size; int first_dspace = (ui_globals::curdats_view == UI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":"); if (first_dspace > 0) @@ -2125,14 +2124,14 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or std::string last_part(tempbuf.substr(first_dspace + 1)); strtrimspace(last_part); mui.draw_text_full(container, first_part.c_str(), effective_left, oy1, effective_width, JUSTIFY_LEFT, - WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3); mui.draw_text_full(container, last_part.c_str(), effective_left, oy1, origx2 - origx1 - 2.0f * gutter_width, - JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3); } else mui.draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, JUSTIFY_LEFT, - WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3); } else mui.draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, JUSTIFY_LEFT, diff --git a/src/frontend/mame/ui/simpleselgame.cpp b/src/frontend/mame/ui/simpleselgame.cpp index 16818ea2c8c..b564ae868d7 100644 --- a/src/frontend/mame/ui/simpleselgame.cpp +++ b/src/frontend/mame/ui/simpleselgame.cpp @@ -15,7 +15,6 @@ #include "ui/menu.h" #include "uiinput.h" #include "ui/simpleselgame.h" -#include "ui/inputmap.h" #include "ui/miscmenu.h" #include "ui/optsmenu.h" #include "audit.h" diff --git a/src/frontend/mame/ui/sliders.cpp b/src/frontend/mame/ui/sliders.cpp index 8ec21b8894c..75d40c2ace3 100644 --- a/src/frontend/mame/ui/sliders.cpp +++ b/src/frontend/mame/ui/sliders.cpp @@ -11,7 +11,6 @@ #include "emu.h" #include "osdepend.h" -#include "uiinput.h" #include "ui/ui.h" #include "ui/menu.h" #include "ui/sliders.h" diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp index 68b8d85d36a..2d5984606eb 100644 --- a/src/frontend/mame/ui/submenu.cpp +++ b/src/frontend/mame/ui/submenu.cpp @@ -13,7 +13,6 @@ #include "ui/submenu.h" #include "ui/utils.h" #include <limits> -#include <iterator> //------------------------------------------------- // ctor / dtor @@ -89,7 +88,6 @@ ui_submenu::ui_submenu(running_machine &machine, render_container *container, st sm_option.options = dynamic_cast<core_options*>(&mame_machine_manager::instance()->ui().options()); break; default: - continue; break; } } @@ -204,7 +202,7 @@ void ui_submenu::populate() UINT32 arrow_flags; // add options - for (auto sm_option = m_options.begin(); sm_option < m_options.end(); sm_option++) + for (auto sm_option = m_options.begin(); sm_option < m_options.end(); ++sm_option) { // skip first heading (is menu title) if (sm_option == m_options.begin() && sm_option->type == ui_submenu::HEAD) continue; diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index 173eff6ad9c..c2ca24db80c 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -266,7 +266,18 @@ static const UINT32 mouse_bitmap[32*32] = //------------------------------------------------- mame_ui_manager::mame_ui_manager(running_machine &machine) - : ui_manager(machine) + : ui_manager(machine), + m_font(nullptr), + m_handler_callback(nullptr), + m_handler_param(0), + m_single_step(false), + m_showfps(false), + m_showfps_end(0), + m_show_profiler(false), + m_popup_text_end(0), + m_mouse_arrow_texture(nullptr), + m_mouse_show(false), + m_load_save_hold(false) { } @@ -277,18 +288,6 @@ void mame_ui_manager::init() ui_menu::init(machine()); ui_gfx_init(machine()); - // reset instance variables - m_font = nullptr; - m_handler_callback = nullptr; - m_handler_param = 0; - m_single_step = false; - m_showfps = false; - m_showfps_end = 0; - m_show_profiler = false; - m_popup_text_end = 0; - m_mouse_arrow_texture = nullptr; - m_load_save_hold = false; - get_font_rows(&machine()); decode_ui_color(0, &machine()); @@ -1527,13 +1526,13 @@ UINT32 mame_ui_manager::handler_ingame(running_machine &machine, render_containe if (mame_machine_manager::instance()->ui().show_timecode_counter()) { std::string tempstring; mame_machine_manager::instance()->ui().draw_text_full(container, machine.video().timecode_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, - JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0xf0,0x10,0x10), ARGB_BLACK, NULL, NULL); + JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0xf0,0x10,0x10), ARGB_BLACK, nullptr, nullptr); } // Show the total time elapsed for the video preview (all parts intro, gameplay, extras) if (mame_machine_manager::instance()->ui().show_timecode_total()) { std::string tempstring; mame_machine_manager::instance()->ui().draw_text_full(container, machine.video().timecode_total_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, - JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0x10,0xf0,0x10), ARGB_BLACK, NULL, NULL); + JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0x10,0xf0,0x10), ARGB_BLACK, nullptr, nullptr); } diff --git a/src/frontend/mame/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp index 2a49b00983d..94949210dfc 100644 --- a/src/frontend/mame/ui/viewgfx.cpp +++ b/src/frontend/mame/ui/viewgfx.cpp @@ -184,7 +184,7 @@ static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state) while (count < MAX_GFX_ELEMENTS && interface.gfx(count) != nullptr) count++; - // count = index of first NULL + // count = index of first nullptr if (count > 0) { state.gfxdev[state.gfxset.devcount].interface = &interface; diff --git a/src/lib/formats/cassimg.h b/src/lib/formats/cassimg.h index 4bfbea512e6..50542aacc73 100644 --- a/src/lib/formats/cassimg.h +++ b/src/lib/formats/cassimg.h @@ -147,7 +147,7 @@ extern const struct CassetteFormat wavfile_format; #define CASSETTE_FORMAT(name) \ &(name), #define CASSETTE_FORMATLIST_END \ - NULL \ + nullptr \ }; CASSETTE_FORMATLIST_EXTERN(cassette_default_formats); diff --git a/src/lib/formats/flopimg.h b/src/lib/formats/flopimg.h index 258bc0d3db0..986cc110a9c 100644 --- a/src/lib/formats/flopimg.h +++ b/src/lib/formats/flopimg.h @@ -121,7 +121,7 @@ FLOPPY_CONSTRUCT(fdi_dsk_construct); const struct FloppyFormat floppyoptions_##name[] = \ { #define LEGACY_FLOPPY_OPTIONS_END0 \ - { NULL } \ + { nullptr } \ }; #define LEGACY_FLOPPY_OPTIONS_EXTERN(name) \ @@ -129,12 +129,12 @@ FLOPPY_CONSTRUCT(fdi_dsk_construct); #define LEGACY_FLOPPY_OPTION(name, extensions_, description_, identify_, construct_, destruct_, ranges_)\ { #name, extensions_, description_, identify_, construct_, destruct_, ranges_ }, #define LEGACY_FLOPPY_OPTIONS_END \ - LEGACY_FLOPPY_OPTION( fdi, "fdi", "Formatted Disk Image", fdi_dsk_identify, fdi_dsk_construct, NULL, NULL) \ - LEGACY_FLOPPY_OPTION( td0, "td0", "Teledisk floppy disk image", td0_dsk_identify, td0_dsk_construct, td0_dsk_destruct, NULL) \ - LEGACY_FLOPPY_OPTION( imd, "imd", "IMD floppy disk image", imd_dsk_identify, imd_dsk_construct, NULL, NULL) \ - LEGACY_FLOPPY_OPTION( cqm, "cqm,dsk", "CopyQM floppy disk image", cqm_dsk_identify, cqm_dsk_construct, NULL, NULL) \ - LEGACY_FLOPPY_OPTION( dsk, "dsk", "DSK floppy disk image", dsk_dsk_identify, dsk_dsk_construct, NULL, NULL) \ - LEGACY_FLOPPY_OPTION( d88, "d77,d88,1dd", "D88 Floppy Disk image", d88_dsk_identify, d88_dsk_construct, NULL, NULL) \ + LEGACY_FLOPPY_OPTION( fdi, "fdi", "Formatted Disk Image", fdi_dsk_identify, fdi_dsk_construct, nullptr, nullptr) \ + LEGACY_FLOPPY_OPTION( td0, "td0", "Teledisk floppy disk image", td0_dsk_identify, td0_dsk_construct, td0_dsk_destruct, nullptr) \ + LEGACY_FLOPPY_OPTION( imd, "imd", "IMD floppy disk image", imd_dsk_identify, imd_dsk_construct, nullptr, nullptr) \ + LEGACY_FLOPPY_OPTION( cqm, "cqm,dsk", "CopyQM floppy disk image", cqm_dsk_identify, cqm_dsk_construct, nullptr, nullptr) \ + LEGACY_FLOPPY_OPTION( dsk, "dsk", "DSK floppy disk image", dsk_dsk_identify, dsk_dsk_construct, nullptr, nullptr) \ + LEGACY_FLOPPY_OPTION( d88, "d77,d88,1dd", "D88 Floppy Disk image", d88_dsk_identify, d88_dsk_construct, nullptr, nullptr) \ LEGACY_FLOPPY_OPTIONS_END0 LEGACY_FLOPPY_OPTIONS_EXTERN(default); diff --git a/src/lib/formats/fsd_dsk.cpp b/src/lib/formats/fsd_dsk.cpp index bed5a780275..6fec1c9754e 100644 --- a/src/lib/formats/fsd_dsk.cpp +++ b/src/lib/formats/fsd_dsk.cpp @@ -159,7 +159,7 @@ bool fsd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) //sects[i].actual_size = 0; //sects[i].deleted = false; //sects[i].bad_crc = false; - //sects[i].data = NULL; + //sects[i].data = nullptr; //osd_printf_verbose("Unread %x %x %x %x %x %x %x\n", i, sects[i].track, sects[i].head, sects[i].sector, sects[i].size, sects[i].actual_size, 0); } } diff --git a/src/lib/formats/imageutl.cpp b/src/lib/formats/imageutl.cpp index 2bf17be849c..ecb322aac57 100644 --- a/src/lib/formats/imageutl.cpp +++ b/src/lib/formats/imageutl.cpp @@ -167,7 +167,7 @@ void image_specify_extension(char *buffer, size_t buffer_len, const char *extens /* determine the length of the buffer */ len = strlen(buffer); - /* be aware that extension can be NULL */ + /* be aware that extension can be nullptr */ if (extension != nullptr) { while(extension[extension_pos] != '\0') diff --git a/src/lib/formats/rx50_dsk.cpp b/src/lib/formats/rx50_dsk.cpp index b612db5b4a7..dd92318450b 100644 --- a/src/lib/formats/rx50_dsk.cpp +++ b/src/lib/formats/rx50_dsk.cpp @@ -216,8 +216,8 @@ const floppy_format_type FLOPPY_RX50IMG_FORMAT = &floppy_image_format_creator<rx // The BIOS can also * read * VT-180 disks and access MS-DOS 160 k disks (R + W) // ( 40 tracks; single sided with 9 or 8 sectors per track ) static LEGACY_FLOPPY_OPTIONS_START( dec100_floppy ) - LEGACY_FLOPPY_OPTION( dec100_floppy, "td0", "Teledisk floppy disk image", td0_dsk_identify, td0_dsk_construct, td0_dsk_destruct, NULL ) - LEGACY_FLOPPY_OPTION( dec100_floppy, "img", "DEC Rainbow 100", basicdsk_identify_default, basicdsk_construct_default, NULL, + LEGACY_FLOPPY_OPTION( dec100_floppy, "td0", "Teledisk floppy disk image", td0_dsk_identify, td0_dsk_construct, td0_dsk_destruct, nullptr ) + LEGACY_FLOPPY_OPTION( dec100_floppy, "img", "DEC Rainbow 100", basicdsk_identify_default, basicdsk_construct_default, nullptr, HEADS([1]) TRACKS(40/[80]) SECTORS(8/9/[10]) diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp index d78fee1595f..fa157b282f9 100644 --- a/src/lib/formats/tzx_cas.cpp +++ b/src/lib/formats/tzx_cas.cpp @@ -532,7 +532,7 @@ static const char *const hw_info[] = }; /* Will go through blocks and calculate number of samples needed. -If buffer is not NULL the sample data will also be written. */ +If buffer is not nullptr the sample data will also be written. */ static int tzx_cas_do_work( INT16 **buffer ) { int current_block = 0; diff --git a/src/lib/formats/x07_cas.cpp b/src/lib/formats/x07_cas.cpp index 0c36ad7c3e8..b55ed79913a 100644 --- a/src/lib/formats/x07_cas.cpp +++ b/src/lib/formats/x07_cas.cpp @@ -91,7 +91,7 @@ static int x07_handle_cassette(INT16 *buffer, const UINT8 *bytes) } else { - // remove the NULL chars at start + // remove the nullptr chars at start while (!bytes[img_start]) img_start++; diff --git a/src/lib/netlist/analog/nld_fourterm.cpp b/src/lib/netlist/analog/nld_fourterm.cpp index 7cba4b15588..51502319f83 100644 --- a/src/lib/netlist/analog/nld_fourterm.cpp +++ b/src/lib/netlist/analog/nld_fourterm.cpp @@ -34,8 +34,8 @@ void NETLIB_NAME(VCCS)::start_internal(const nl_double def_RI) register_terminal("_OP1", m_OP1); register_terminal("_ON1", m_ON1); - m_IP.m_otherterm = &m_IN; // <= this should be NULL and terminal be filtered out prior to solving... - m_IN.m_otherterm = &m_IP; // <= this should be NULL and terminal be filtered out prior to solving... + m_IP.m_otherterm = &m_IN; // <= this should be nullptr and terminal be filtered out prior to solving... + m_IN.m_otherterm = &m_IP; // <= this should be nullptr and terminal be filtered out prior to solving... m_OP.m_otherterm = &m_IP; m_OP1.m_otherterm = &m_IN; diff --git a/src/lib/netlist/devices/nld_system.cpp b/src/lib/netlist/devices/nld_system.cpp index e861bf05171..3e4565d09d2 100644 --- a/src/lib/netlist/devices/nld_system.cpp +++ b/src/lib/netlist/devices/nld_system.cpp @@ -148,7 +148,7 @@ NETLIB_RESET(logic_input) NETLIB_STOP(logic_input) { - if (m_logic_family != NULL) + if (m_logic_family != nullptr) if (!m_logic_family->m_is_static) pfree(m_logic_family); } diff --git a/src/lib/netlist/devices/nld_truthtable.cpp b/src/lib/netlist/devices/nld_truthtable.cpp index 9cd2d206664..c56666209cb 100644 --- a/src/lib/netlist/devices/nld_truthtable.cpp +++ b/src/lib/netlist/devices/nld_truthtable.cpp @@ -270,7 +270,7 @@ netlist_base_factory_truthtable_t *nl_tt_factory_create(const unsigned ni, const pstring msg = pfmt("unable to create truthtable<{1},{2},{3}>")(ni)(no)(has_state); nl_assert_always(false, msg); } - return NULL; + return nullptr; } NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/lib/netlist/devices/nld_truthtable.h b/src/lib/netlist/devices/nld_truthtable.h index 4c53260fdc3..d84e3b56a13 100644 --- a/src/lib/netlist/devices/nld_truthtable.h +++ b/src/lib/netlist/devices/nld_truthtable.h @@ -112,7 +112,7 @@ public: nld_truthtable_t(truthtable_t *ttbl, const char *desc[]) : device_t(), m_last_state(0), m_ign(0), m_active(1), m_ttp(ttbl) { - while (*desc != NULL && **desc != 0 ) + while (*desc != nullptr && **desc != 0 ) { m_desc.push_back(*desc); desc++; diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index c37217c6bbb..3cd6f6ba645 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -175,7 +175,7 @@ ATTR_COLD const pstring &object_t::name() const ATTR_COLD device_object_t::device_object_t(const type_t atype, const family_t afamily) : object_t(atype, afamily) -, m_device(NULL) +, m_device(nullptr) { } @@ -196,12 +196,12 @@ netlist_t::netlist_t(const pstring &aname) m_time(netlist_time::zero), m_use_deactivate(0), m_queue(*this), - m_mainclock(NULL), - m_solver(NULL), - m_gnd(NULL), - m_params(NULL), + m_mainclock(nullptr), + m_solver(nullptr), + m_gnd(nullptr), + m_params(nullptr), m_name(aname), - m_setup(NULL), + m_setup(nullptr), m_log(this), m_lib(nullptr) { @@ -250,10 +250,10 @@ ATTR_COLD void netlist_t::start() /* make sure the solver and parameters are started first! */ - if (m_solver != NULL) + if (m_solver != nullptr) m_solver->start_dev(); - if (m_params != NULL) + if (m_params != nullptr) { m_params->start_dev(); } @@ -282,7 +282,7 @@ ATTR_COLD net_t *netlist_t::find_net(const pstring &name) if (net->name() == name) return net; - return NULL; + return nullptr; } ATTR_COLD void netlist_t::rebuild_lists() @@ -296,9 +296,9 @@ ATTR_COLD void netlist_t::reset() { m_time = netlist_time::zero; m_queue.clear(); - if (m_mainclock != NULL) + if (m_mainclock != nullptr) m_mainclock->m_Q.net().set_time(netlist_time::zero); - if (m_solver != NULL) + if (m_solver != nullptr) m_solver->do_reset(); // Reset all nets once ! @@ -330,7 +330,7 @@ ATTR_HOT void netlist_t::process_queue(const netlist_time &delta) { m_stop = m_time + delta; - if (m_mainclock == NULL) + if (m_mainclock == nullptr) { while ( (m_time < m_stop) && (m_queue.is_not_empty())) { @@ -401,7 +401,7 @@ ATTR_COLD core_device_t::core_device_t(const family_t afamily) ATTR_COLD void core_device_t::init(netlist_t &anetlist, const pstring &name) { - if (logic_family() == NULL) + if (logic_family() == nullptr) set_logic_family(this->default_logic_family()); init_object(anetlist, name); @@ -587,7 +587,7 @@ ATTR_COLD net_t::net_t(const family_t afamily) : object_t(NET, afamily) , m_new_Q(0) , m_cur_Q (0) - , m_railterminal(NULL) + , m_railterminal(nullptr) , m_time(netlist_time::zero) , m_active(0) , m_in_queue(2) @@ -648,7 +648,7 @@ ATTR_HOT void net_t::dec_active(core_terminal_t &term) ATTR_COLD void net_t::register_railterminal(core_terminal_t &mr) { - nl_assert(m_railterminal == NULL); + nl_assert(m_railterminal == nullptr); m_railterminal = &mr; } @@ -689,7 +689,7 @@ ATTR_HOT /* inline */ void net_t::update_devs() m_in_queue = 2; /* mark as taken ... */ m_cur_Q = m_new_Q; - for (core_terminal_t *p = m_list_active.first(); p != NULL; p = p->next()) + for (core_terminal_t *p = m_list_active.first(); p != nullptr; p = p->next()) { inc_stat(p->netdev().stat_call_count); if ((p->state() & mask) != 0) @@ -742,7 +742,7 @@ ATTR_COLD void net_t::move_connections(net_t *dest_net) ATTR_COLD void net_t::merge_net(net_t *othernet) { netlist().log().debug("merging nets ...\n"); - if (othernet == NULL) + if (othernet == nullptr) return; // Nothing to do if (othernet == this) @@ -792,7 +792,7 @@ ATTR_COLD void logic_net_t::save_register() ATTR_COLD analog_net_t::analog_net_t() : net_t(ANALOG) - , m_solver(NULL) + , m_solver(nullptr) { } @@ -844,7 +844,7 @@ ATTR_COLD void analog_net_t::process_net(pvector_t<list_t> &groups) ATTR_COLD core_terminal_t::core_terminal_t(const type_t atype, const family_t afamily) : device_object_t(atype, afamily) , plinkedlist_element_t() -, m_net(NULL) +, m_net(nullptr) , m_state(STATE_NONEX) { } @@ -860,10 +860,10 @@ ATTR_COLD void core_terminal_t::set_net(net_t &anet) ATTR_COLD terminal_t::terminal_t() : analog_t(TERMINAL) -, m_otherterm(NULL) -, m_Idr1(NULL) -, m_go1(NULL) -, m_gt1(NULL) +, m_otherterm(nullptr) +, m_Idr1(nullptr) +, m_go1(nullptr) +, m_gt1(nullptr) { } @@ -871,14 +871,14 @@ ATTR_COLD terminal_t::terminal_t() ATTR_HOT void terminal_t::schedule_solve() { // FIXME: Remove this after we found a way to remove *ALL* twoterms connected to railnets only. - if (net().solver() != NULL) + if (net().solver() != nullptr) net().solver()->update_forced(); } ATTR_HOT void terminal_t::schedule_after(const netlist_time &after) { // FIXME: Remove this after we found a way to remove *ALL* twoterms connected to railnets only. - if (net().solver() != NULL) + if (net().solver() != nullptr) net().solver()->update_after(after); } @@ -936,7 +936,7 @@ ATTR_COLD void logic_output_t::initial(const netlist_sig_t val) // ---------------------------------------------------------------------------------------- ATTR_COLD analog_output_t::analog_output_t() - : analog_t(OUTPUT), m_proxied_net(NULL) + : analog_t(OUTPUT), m_proxied_net(nullptr) { this->set_net(m_my_net); set_state(STATE_OUT); @@ -945,7 +945,7 @@ ATTR_COLD analog_output_t::analog_output_t() } ATTR_COLD analog_output_t::analog_output_t(core_device_t &dev, const pstring &aname) - : analog_t(OUTPUT), m_proxied_net(NULL) + : analog_t(OUTPUT), m_proxied_net(nullptr) { this->set_net(m_my_net); set_state(STATE_OUT); diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index 55be15527de..b5c26a2262c 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -342,7 +342,7 @@ namespace netlist { public: - logic_family_t() : m_logic_family(NULL) {} + logic_family_t() : m_logic_family(nullptr) {} ~logic_family_t() { } ATTR_HOT logic_family_desc_t *logic_family() const { return m_logic_family; } @@ -412,7 +412,7 @@ namespace netlist ATTR_COLD void init_object(const pstring &aname); ATTR_COLD void init_object(netlist_t &nl, const pstring &aname); - ATTR_COLD bool isInitialized() { return (m_netlist != NULL); } + ATTR_COLD bool isInitialized() { return (m_netlist != nullptr); } ATTR_COLD const pstring &name() const; @@ -489,8 +489,8 @@ namespace netlist ATTR_COLD core_terminal_t(const type_t atype, const family_t afamily); ATTR_COLD void set_net(net_t &anet); - ATTR_COLD void clear_net() { m_net = NULL; } - ATTR_HOT bool has_net() const { return (m_net != NULL); } + ATTR_COLD void clear_net() { m_net = nullptr; } + ATTR_HOT bool has_net() const { return (m_net != nullptr); } ATTR_HOT const net_t & net() const { return *m_net;} ATTR_HOT net_t & net() { return *m_net;} @@ -594,7 +594,7 @@ namespace netlist private: ATTR_HOT void set_ptr(nl_double *ptr, const nl_double val) { - if (ptr != NULL && *ptr != val) + if (ptr != nullptr && *ptr != val) { *ptr = val; } @@ -618,7 +618,7 @@ namespace netlist ATTR_COLD logic_t(const type_t atype) : core_terminal_t(atype, LOGIC), logic_family_t(), - m_proxy(NULL) + m_proxy(nullptr) { } @@ -626,7 +626,7 @@ namespace netlist { } - ATTR_COLD bool has_proxy() const { return (m_proxy != NULL); } + ATTR_COLD bool has_proxy() const { return (m_proxy != nullptr); } ATTR_COLD devices::nld_base_proxy *get_proxy() const { return m_proxy; } ATTR_COLD void set_proxy(devices::nld_base_proxy *proxy) { m_proxy = proxy; } @@ -720,7 +720,7 @@ namespace netlist ATTR_HOT const netlist_time &time() const { return m_time; } ATTR_HOT void set_time(const netlist_time &ntime) { m_time = ntime; } - ATTR_HOT bool isRailNet() const { return !(m_railterminal == NULL); } + ATTR_HOT bool isRailNet() const { return !(m_railterminal == nullptr); } ATTR_HOT core_terminal_t & railterminal() const { return *m_railterminal; } ATTR_HOT void push_to_queue(const netlist_time &delay); @@ -1227,7 +1227,7 @@ namespace netlist for (std::size_t i = 0; i < m_devices.size(); i++) { _device_class *dev = dynamic_cast<_device_class *>(m_devices[i]); - if (dev != NULL) + if (dev != nullptr) tmp.push_back(dev); } return tmp; @@ -1239,22 +1239,22 @@ namespace netlist for (std::size_t i = 0; i < m_devices.size(); i++) { _device_class *dev = dynamic_cast<_device_class *>(m_devices[i]); - if (dev != NULL) + if (dev != nullptr) return dev; } - return NULL; + return nullptr; } template<class _device_class> ATTR_COLD _device_class *get_single_device(const char *classname) { - _device_class *ret = NULL; + _device_class *ret = nullptr; for (std::size_t i = 0; i < m_devices.size(); i++) { _device_class *dev = dynamic_cast<_device_class *>(m_devices[i]); - if (dev != NULL) + if (dev != nullptr) { - if (ret != NULL) + if (ret != nullptr) this->log().fatal("more than one {1} device found", classname); else ret = dev; diff --git a/src/lib/netlist/nl_factory.cpp b/src/lib/netlist/nl_factory.cpp index 45765cb8e30..397aa756ea3 100644 --- a/src/lib/netlist/nl_factory.cpp +++ b/src/lib/netlist/nl_factory.cpp @@ -62,7 +62,7 @@ device_t *factory_list_t::new_device_by_classname(const pstring &classname) cons } p++; } - return NULL; // appease code analysis + return nullptr; // appease code analysis } #endif @@ -84,7 +84,7 @@ base_factory_t * factory_list_t::factory_by_name(const pstring &name) else { m_setup.log().fatal("Class {1} not found!\n", name); - return NULL; // appease code analysis + return nullptr; // appease code analysis } } diff --git a/src/lib/netlist/nl_parser.h b/src/lib/netlist/nl_parser.h index b11d89f5ff1..2a6cc79ad2b 100644 --- a/src/lib/netlist/nl_parser.h +++ b/src/lib/netlist/nl_parser.h @@ -19,7 +19,7 @@ namespace netlist P_PREVENT_COPYING(parser_t) public: parser_t(pistream &strm, setup_t &setup) - : ptokenizer(strm), m_setup(setup), m_buf(NULL) {} + : ptokenizer(strm), m_setup(setup), m_buf(nullptr) {} bool parse(const pstring nlname = ""); diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index dad17991b87..3e347356b5a 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -74,7 +74,7 @@ setup_t::~setup_t() m_terminals.clear(); m_params_temp.clear(); - netlist().set_setup(NULL); + netlist().set_setup(nullptr); pfree(m_factory); m_sources.clear_and_free(); @@ -132,13 +132,13 @@ device_t *setup_t::register_dev(const pstring &classname, const pstring &name) namespace_push(name); include(classname); namespace_pop(); - return NULL; + return nullptr; } else { device_t *dev = factory().new_device_by_name(classname); //device_t *dev = factory().new_device_by_classname(classname); - if (dev == NULL) + if (dev == nullptr) log().fatal("Class {1} not found!\n", classname); return register_dev(dev, name); } @@ -412,11 +412,11 @@ core_terminal_t *setup_t::find_terminal(const pstring &terminal_in, bool require ret = m_terminals.index_of(tname + ".Q"); } - core_terminal_t *term = (ret < 0 ? NULL : m_terminals.value_at(ret)); + core_terminal_t *term = (ret < 0 ? nullptr : m_terminals.value_at(ret)); - if (term == NULL && required) + if (term == nullptr && required) log().fatal("terminal {1}({2}) not found!\n", terminal_in, tname); - if (term != NULL) + if (term != nullptr) log().debug("Found input {1}\n", tname); return term; } @@ -436,16 +436,16 @@ core_terminal_t *setup_t::find_terminal(const pstring &terminal_in, object_t::ty if (ret < 0 && required) log().fatal("terminal {1}({2}) not found!\n", terminal_in, tname); - core_terminal_t *term = (ret < 0 ? NULL : m_terminals.value_at(ret)); + core_terminal_t *term = (ret < 0 ? nullptr : m_terminals.value_at(ret)); - if (term != NULL && term->type() != atype) + if (term != nullptr && term->type() != atype) { if (required) log().fatal("object {1}({2}) found but wrong type\n", terminal_in, tname); else - term = NULL; + term = nullptr; } - if (term != NULL) + if (term != nullptr) log().debug("Found input {1}\n", tname); return term; @@ -463,7 +463,7 @@ param_t *setup_t::find_param(const pstring ¶m_in, bool required) log().fatal("parameter {1}({2}) not found!\n", param_in_fqn, outname); if (ret != -1) log().debug("Found parameter {1}\n", outname); - return (ret == -1 ? NULL : m_params.value_at(ret)); + return (ret == -1 ? nullptr : m_params.value_at(ret)); } // FIXME avoid dynamic cast here @@ -474,7 +474,7 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(core_terminal_t &out) logic_output_t &out_cast = dynamic_cast<logic_output_t &>(out); devices::nld_base_proxy *proxy = out_cast.get_proxy(); - if (proxy == NULL) + if (proxy == nullptr) { // create a new one ... devices::nld_base_d_to_a_proxy *new_proxy = out_cast.logic_family()->create_d_a_proxy(&out_cast); @@ -782,7 +782,7 @@ void setup_t::resolve_inputs() for (std::size_t i = 0; i < m_terminals.size(); i++) { core_terminal_t *term = m_terminals.value_at(i); - if (!term->has_net() && dynamic_cast< devices::NETLIB_NAME(dummy_input) *>(&term->device()) != NULL) + if (!term->has_net() && dynamic_cast< devices::NETLIB_NAME(dummy_input) *>(&term->device()) != nullptr) log().warning("Found dummy terminal {1} without connections", term->name()); else if (!term->has_net()) errstr += pfmt("Found terminal {1} without a net\n")(term->name()); @@ -798,7 +798,7 @@ void setup_t::resolve_inputs() for (std::size_t i=0; i < netlist().m_devices.size(); i++) { devices::NETLIB_NAME(twoterm) *t = dynamic_cast<devices::NETLIB_NAME(twoterm) *>(netlist().m_devices[i]); - if (t != NULL) + if (t != nullptr) { has_twoterms = true; if (t->m_N.net().isRailNet() && t->m_P.net().isRailNet()) @@ -809,7 +809,7 @@ void setup_t::resolve_inputs() log().verbose("initialize solver ...\n"); - if (netlist().solver() == NULL) + if (netlist().solver() == nullptr) { if (has_twoterms) log().fatal("No solver found for this net although analog elements are present\n"); diff --git a/src/lib/netlist/nl_util.h b/src/lib/netlist/nl_util.h index 76f49918c18..352b20d0003 100644 --- a/src/lib/netlist/nl_util.h +++ b/src/lib/netlist/nl_util.h @@ -44,7 +44,7 @@ public: static const pstring environment(const pstring &var, const pstring &default_val = "") { - if (getenv(var.cstr()) == NULL) + if (getenv(var.cstr()) == nullptr) return default_val; else return pstring(getenv(var.cstr())); diff --git a/src/lib/netlist/plib/palloc.cpp b/src/lib/netlist/plib/palloc.cpp index 22dbc1d4e93..b6d188d159e 100644 --- a/src/lib/netlist/plib/palloc.cpp +++ b/src/lib/netlist/plib/palloc.cpp @@ -40,7 +40,7 @@ void* operator new(std::size_t size, pmemory_pool *pool) throw (std::bad_alloc) void operator delete(void *ptr, pmemory_pool *pool) { - if (ptr != NULL) + if (ptr != nullptr) pfree_raw(ptr); } diff --git a/src/lib/netlist/plib/pfmtlog.cpp b/src/lib/netlist/plib/pfmtlog.cpp index d66b8f62520..25ed4c4d391 100644 --- a/src/lib/netlist/plib/pfmtlog.cpp +++ b/src/lib/netlist/plib/pfmtlog.cpp @@ -61,7 +61,7 @@ void pformat::format_element(const char *f, const char *l, const char *fmt_spec, m_arg++; int sl = sprintf(search, "%%%d", m_arg); char *p = strstr(m_str, search); - if (p != NULL) + if (p != nullptr) { // Make room memmove(p+nl, p+sl, strlen(p) + 1 - sl); @@ -80,23 +80,23 @@ void pfmt::format_element(const char *f, const char *l, const char *fmt_spec, . m_arg++; int sl = sprintf(search, "{%d:", m_arg); char *p = strstr(m_str, search); - if (p == NULL) + if (p == nullptr) { sl = sprintf(search, "{%d}", m_arg); p = strstr(m_str, search); - if (p == NULL) + if (p == nullptr) { sl = 2; p = strstr(m_str, "{}"); } - if (p==NULL) + if (p==nullptr) { sl=1; p = strstr(m_str, "{"); - if (p != NULL) + if (p != nullptr) { char *p1 = strstr(p, "}"); - if (p1 != NULL) + if (p1 != nullptr) { sl = p1 - p + 1; strncat(fmt, p+1, p1 - p - 2); @@ -111,7 +111,7 @@ void pfmt::format_element(const char *f, const char *l, const char *fmt_spec, . else { char *p1 = strstr(p, "}"); - if (p1 != NULL) + if (p1 != nullptr) { sl = p1 - p + 1; if (m_arg>=10) @@ -124,20 +124,20 @@ void pfmt::format_element(const char *f, const char *l, const char *fmt_spec, . } strcat(fmt, l); char *pend = fmt + strlen(fmt) - 1; - if (strchr("fge", *fmt_spec) != NULL) + if (strchr("fge", *fmt_spec) != nullptr) { - if (strchr("fge", *pend) == NULL) + if (strchr("fge", *pend) == nullptr) strcat(fmt, fmt_spec); } - else if (strchr("duxo", *fmt_spec) != NULL) + else if (strchr("duxo", *fmt_spec) != nullptr) { - if (strchr("duxo", *pend) == NULL) + if (strchr("duxo", *pend) == nullptr) strcat(fmt, fmt_spec); } else strcat(fmt, fmt_spec); int nl = vsprintf(buf, fmt, ap); - if (p != NULL) + if (p != nullptr) { // check room unsigned new_size = (p - m_str) + nl + strlen(p) + 1 - sl; diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h index b9a9a70e195..495aeb5ed38 100644 --- a/src/lib/netlist/plib/plists.h +++ b/src/lib/netlist/plib/plists.h @@ -52,9 +52,9 @@ public: ~parray_t() { - if (m_list != NULL) + if (m_list != nullptr) pfree_array(m_list); - m_list = NULL; + m_list = nullptr; } ATTR_HOT _ListClass& operator[](const std::size_t index) { return m_list[index]; } @@ -70,12 +70,12 @@ public: protected: ATTR_COLD void set_capacity(const std::size_t new_capacity) { - if (m_list != NULL) + if (m_list != nullptr) pfree_array(m_list); if (new_capacity > 0) m_list = palloc_array(_ListClass, new_capacity); else - m_list = NULL; + m_list = nullptr; m_capacity = new_capacity; } @@ -153,7 +153,7 @@ public: friend class plinkedlist_t<_ListClass>; - plinkedlist_element_t() : m_next(NULL) {} + plinkedlist_element_t() : m_next(nullptr) {} _ListClass *next() const { return m_next; } private: @@ -165,7 +165,7 @@ class plinkedlist_t { public: - plinkedlist_t() : m_head(NULL) {} + plinkedlist_t() : m_head(nullptr) {} ATTR_HOT void insert(const _ListClass &before, _ListClass &elem) { @@ -177,7 +177,7 @@ public: else { _ListClass *p = m_head; - while (p != NULL) + while (p != nullptr) { if (p->m_next == &before) { @@ -200,12 +200,12 @@ public: ATTR_HOT void add(_ListClass &elem) { _ListClass **p = &m_head; - while (*p != NULL) + while (*p != nullptr) { p = &((*p)->m_next); } *p = &elem; - elem.m_next = NULL; + elem.m_next = nullptr; } ATTR_HOT void remove(const _ListClass &elem) @@ -213,14 +213,14 @@ public: _ListClass **p; for (p = &m_head; *p != &elem; p = &((*p)->m_next)) { - //nl_assert(*p != NULL); + //nl_assert(*p != nullptr); } (*p) = elem.m_next; } ATTR_HOT _ListClass *first() const { return m_head; } - ATTR_HOT void clear() { m_head = NULL; } - ATTR_HOT bool is_empty() const { return (m_head == NULL); } + ATTR_HOT void clear() { m_head = nullptr; } + ATTR_HOT bool is_empty() const { return (m_head == nullptr); } private: _ListClass *m_head; @@ -234,7 +234,7 @@ public: friend class plinkedlist_t<_ListClass>; - plinkedlist_element_t() : m_next(NULL), m_prev(NULL) {} + plinkedlist_element_t() : m_next(nullptr), m_prev(nullptr) {} _ListClass *next() const { return m_next; } private: @@ -247,46 +247,46 @@ class plinkedlist_t { public: - plinkedlist_t() : m_head(NULL), m_tail(NULL) {} + plinkedlist_t() : m_head(nullptr), m_tail(nullptr) {} ATTR_HOT void insert(_ListClass &elem) { - if (m_head != NULL) + if (m_head != nullptr) m_head->m_prev = &elem; elem.m_next = m_head; - elem.m_prev = NULL; + elem.m_prev = nullptr; m_head = &elem; - if (m_tail == NULL) + if (m_tail == nullptr) m_tail = &elem; } ATTR_HOT void add(_ListClass &elem) { - if (m_tail != NULL) + if (m_tail != nullptr) m_tail->m_next = &elem; elem.m_prev = m_tail; m_tail = &elem; - elem.m_next = NULL; - if (m_head == NULL) + elem.m_next = nullptr; + if (m_head == nullptr) m_head = &elem; } ATTR_HOT void remove(const _ListClass &elem) { - if (prev(elem) == NULL) + if (prev(elem) == nullptr) { m_head = next(elem); if (m_tail == &elem) - m_tail = NULL; + m_tail = nullptr; } else prev(elem)->m_next = next(elem); - if (next(elem) == NULL) + if (next(elem) == nullptr) { m_tail = prev(elem); if (m_head == &elem) - m_head = NULL; + m_head = nullptr; } else next(elem)->m_prev = prev(elem); @@ -298,8 +298,8 @@ public: ATTR_HOT static _ListClass *prev(const _ListClass &elem) { return static_cast<_ListClass *>(elem.m_prev); } ATTR_HOT static _ListClass *prev(const _ListClass *elem) { return static_cast<_ListClass *>(elem->m_prev); } ATTR_HOT _ListClass *first() const { return m_head; } - ATTR_HOT void clear() { m_head = m_tail = NULL; } - ATTR_HOT bool is_empty() const { return (m_head == NULL); } + ATTR_HOT void clear() { m_head = m_tail = nullptr; } + ATTR_HOT bool is_empty() const { return (m_head == nullptr); } private: _ListClass *m_head; diff --git a/src/lib/netlist/plib/poptions.h b/src/lib/netlist/plib/poptions.h index fe46a25f7a9..984db395e2f 100644 --- a/src/lib/netlist/plib/poptions.h +++ b/src/lib/netlist/plib/poptions.h @@ -28,7 +28,7 @@ public: : m_short(""), m_long(""), m_help(""), m_has_argument(false) {} - poption(pstring ashort, pstring along, pstring help, bool has_argument, poptions *parent = NULL); + poption(pstring ashort, pstring along, pstring help, bool has_argument, poptions *parent = nullptr); virtual ~poption() { @@ -48,7 +48,7 @@ private: class poption_str : public poption { public: - poption_str(pstring ashort, pstring along, pstring defval, pstring help, poptions *parent = NULL) + poption_str(pstring ashort, pstring along, pstring defval, pstring help, poptions *parent = nullptr) : poption(ashort, along, help, true, parent), m_val(defval) {} @@ -62,7 +62,7 @@ private: class poption_str_limit : public poption { public: - poption_str_limit(pstring ashort, pstring along, pstring defval, pstring limit, pstring help, poptions *parent = NULL) + poption_str_limit(pstring ashort, pstring along, pstring defval, pstring limit, pstring help, poptions *parent = nullptr) : poption(ashort, along, help, true, parent), m_val(defval), m_limit(limit, ":") {} @@ -86,7 +86,7 @@ private: class poption_bool : public poption { public: - poption_bool(pstring ashort, pstring along, pstring help, poptions *parent = NULL) + poption_bool(pstring ashort, pstring along, pstring help, poptions *parent = nullptr) : poption(ashort, along, help, false, parent), m_val(false) {} @@ -100,7 +100,7 @@ private: class poption_double : public poption { public: - poption_double(pstring ashort, pstring along, double defval, pstring help, poptions *parent = NULL) + poption_double(pstring ashort, pstring along, double defval, pstring help, poptions *parent = nullptr) : poption(ashort, along, help, true, parent), m_val(defval) {} @@ -125,7 +125,7 @@ public: poptions(poption *o[]) { int i=0; - while (o[i] != NULL) + while (o[i] != nullptr) { m_opts.push_back(o[i]); i++; @@ -149,7 +149,7 @@ public: for (int i=1; i<argc; ) { pstring arg(argv[i]); - poption *opt = NULL; + poption *opt = nullptr; if (arg.startsWith("--")) { @@ -161,7 +161,7 @@ public: } else return i; - if (opt == NULL) + if (opt == nullptr) return i; if (opt->m_has_argument) { @@ -210,7 +210,7 @@ private: if (m_opts[i]->m_short == arg) return m_opts[i]; } - return NULL; + return nullptr; } poption *getopt_long(pstring arg) { @@ -219,7 +219,7 @@ private: if (m_opts[i]->m_long == arg) return m_opts[i]; } - return NULL; + return nullptr; } pvector_t<poption *> m_opts; @@ -229,7 +229,7 @@ private: poption::poption(pstring ashort, pstring along, pstring help, bool has_argument, poptions *parent) : m_short(ashort), m_long(along), m_help(help), m_has_argument(has_argument) { - if (parent != NULL) + if (parent != nullptr) parent->register_option(this); } diff --git a/src/lib/netlist/plib/pparser.cpp b/src/lib/netlist/plib/pparser.cpp index 9362ba7de0d..70e48ba5c23 100644 --- a/src/lib/netlist/plib/pparser.cpp +++ b/src/lib/netlist/plib/pparser.cpp @@ -352,7 +352,7 @@ ppreprocessor::define_t *ppreprocessor::get_define(const pstring &name) if (idx >= 0) return &m_defines.value_at(idx); else - return NULL; + return nullptr; } pstring ppreprocessor::replace_macros(const pstring &line) @@ -362,7 +362,7 @@ pstring ppreprocessor::replace_macros(const pstring &line) for (std::size_t i=0; i<elems.size(); i++) { define_t *def = get_define(elems[i]); - if (def != NULL) + if (def != nullptr) ret.cat(def->m_replace); else ret.cat(elems[i]); @@ -403,13 +403,13 @@ pstring ppreprocessor::process_line(const pstring &line) else if (lti[0].equals("#ifdef")) { m_level++; - if (get_define(lti[1]) == NULL) + if (get_define(lti[1]) == nullptr) m_ifflag |= (1 << m_level); } else if (lti[0].equals("#ifndef")) { m_level++; - if (get_define(lti[1]) != NULL) + if (get_define(lti[1]) != nullptr) m_ifflag |= (1 << m_level); } else if (lti[0].equals("#else")) diff --git a/src/lib/netlist/plib/pstate.h b/src/lib/netlist/plib/pstate.h index 88c0c005927..4c9f34208d1 100644 --- a/src/lib/netlist/plib/pstate.h +++ b/src/lib/netlist/plib/pstate.h @@ -87,10 +87,10 @@ struct pstate_entry_t pstate_entry_t(const pstring &stname, const pstate_data_type_e dt, const void *owner, const int size, const int count, void *ptr, bool is_ptr) - : m_name(stname), m_dt(dt), m_owner(owner), m_callback(NULL), m_size(size), m_count(count), m_ptr(ptr), m_is_ptr(is_ptr) { } + : m_name(stname), m_dt(dt), m_owner(owner), m_callback(nullptr), m_size(size), m_count(count), m_ptr(ptr), m_is_ptr(is_ptr) { } pstate_entry_t(const pstring &stname, const void *owner, pstate_callback_t *callback) - : m_name(stname), m_dt(DT_CUSTOM), m_owner(owner), m_callback(callback), m_size(0), m_count(0), m_ptr(NULL), m_is_ptr(false) { } + : m_name(stname), m_dt(DT_CUSTOM), m_owner(owner), m_callback(callback), m_size(0), m_count(0), m_ptr(nullptr), m_is_ptr(false) { } ~pstate_entry_t() { } diff --git a/src/lib/netlist/plib/pstream.cpp b/src/lib/netlist/plib/pstream.cpp index 9702ab5dab5..988a403236d 100644 --- a/src/lib/netlist/plib/pstream.cpp +++ b/src/lib/netlist/plib/pstream.cpp @@ -70,7 +70,7 @@ pifilestream::pifilestream(void *file, const bool do_close) void pifilestream::init(void *file) { m_file = file; - if (m_file == NULL) + if (m_file == nullptr) { set_flag(FLAG_ERROR); set_flag(FLAG_EOF); @@ -170,7 +170,7 @@ pofilestream::pofilestream(void *file, const bool do_close) void pofilestream::init(void *file) { m_file = file; - if (m_file == NULL) + if (m_file == nullptr) { set_flag(FLAG_ERROR); set_flag(FLAG_CLOSED); @@ -322,7 +322,7 @@ void pomemstream::vwrite(const void *buf, const unsigned n) m_capacity *= 2; char *o = m_mem; m_mem = palloc_array(char, m_capacity); - if (m_mem == NULL) + if (m_mem == nullptr) { set_flag(FLAG_ERROR); return; @@ -346,7 +346,7 @@ void pomemstream::vseek(const pos_type n) m_capacity *= 2; char *o = m_mem; m_mem = palloc_array(char, m_capacity); - if (m_mem == NULL) + if (m_mem == nullptr) { set_flag(FLAG_ERROR); return; diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp index 2acf1d789b1..172d543c06e 100644 --- a/src/lib/netlist/plib/pstring.cpp +++ b/src/lib/netlist/plib/pstring.cpp @@ -273,13 +273,13 @@ template<typename F> double pstring_t<F>::as_double(bool *error) const { double ret; - char *e = NULL; + char *e = nullptr; - if (error != NULL) + if (error != nullptr) *error = false; ret = strtod(cstr(), &e); if (*e != 0) - if (error != NULL) + if (error != nullptr) *error = true; return ret; } @@ -288,16 +288,16 @@ template<typename F> long pstring_t<F>::as_long(bool *error) const { long ret; - char *e = NULL; + char *e = nullptr; - if (error != NULL) + if (error != nullptr) *error = false; if (startsWith("0x")) ret = strtol(substr(2).cstr(), &e, 16); else ret = strtol(cstr(), &e, 10); if (*e != 0) - if (error != NULL) + if (error != nullptr) *error = true; return ret; } @@ -314,7 +314,7 @@ long pstring_t<F>::as_long(bool *error) const #if 1 -static std::stack<pstr_t *> *stk = NULL; +static std::stack<pstr_t *> *stk = nullptr; static inline unsigned countleadbits(unsigned x) { @@ -358,7 +358,7 @@ void pstring_t<F>::sfree(pstr_t *s) s->m_ref_count--; if (s->m_ref_count == 0 && s != &m_zero) { - if (stk != NULL) + if (stk != nullptr) { unsigned sn= ((32 - countleadbits(s->len())) + 1) / 2; stk[sn].push(s); @@ -372,7 +372,7 @@ void pstring_t<F>::sfree(pstr_t *s) template<typename F> pstr_t *pstring_t<F>::salloc(int n) { - if (stk == NULL) + if (stk == nullptr) stk = palloc_array(std::stack<pstr_t *>, 17); pstr_t *p; unsigned sn= ((32 - countleadbits(n)) + 1) / 2; @@ -392,7 +392,7 @@ pstr_t *pstring_t<F>::salloc(int n) template<typename F> void pstring_t<F>::resetmem() { - if (stk != NULL) + if (stk != nullptr) { for (unsigned i=0; i<=16; i++) { @@ -403,7 +403,7 @@ void pstring_t<F>::resetmem() } } pfree_array(stk); - stk = NULL; + stk = nullptr; } } @@ -532,13 +532,13 @@ int pstring_t<F>::pcmp(const mem_t *right) const pstringbuffer::~pstringbuffer() { - if (m_ptr != NULL) + if (m_ptr != nullptr) pfree_array(m_ptr); } void pstringbuffer::resize(const std::size_t size) { - if (m_ptr == NULL) + if (m_ptr == nullptr) { m_size = DEFAULT_SIZE; while (m_size <= size) diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h index b101ffc47a5..18cabd6fce5 100644 --- a/src/lib/netlist/plib/pstring.h +++ b/src/lib/netlist/plib/pstring.h @@ -58,7 +58,7 @@ public: ~pstring_t(); // construction with copy - pstring_t(const mem_t *string) {init(); if (string != NULL && *string != 0) pcopy(string); } + pstring_t(const mem_t *string) {init(); if (string != nullptr && *string != 0) pcopy(string); } pstring_t(const pstring_t &string) {init(); pcopy(string); } // assignment operators @@ -110,8 +110,8 @@ public: // conversions - double as_double(bool *error = NULL) const; - long as_long(bool *error = NULL) const; + double as_double(bool *error = nullptr) const; + long as_long(bool *error = nullptr) const; /* * everything below MAY not work for utf8. @@ -331,7 +331,7 @@ public: ~pstringbuffer(); // construction with copy - pstringbuffer(const char *string) {init(); if (string != NULL) pcopy(string); } + pstringbuffer(const char *string) {init(); if (string != nullptr) pcopy(string); } pstringbuffer(const pstring &string) {init(); pcopy(string); } // assignment operators @@ -359,7 +359,7 @@ private: void init() { - m_ptr = NULL; + m_ptr = nullptr; m_size = 0; m_len = 0; } diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index fe4cca62572..62a8af91b5a 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -91,13 +91,13 @@ class netlist_tool_t : public netlist::netlist_t public: netlist_tool_t(const pstring &aname) - : netlist::netlist_t(aname), m_opts(NULL), m_setup(NULL) + : netlist::netlist_t(aname), m_opts(nullptr), m_setup(nullptr) { } ~netlist_tool_t() { - if (m_setup != NULL) + if (m_setup != nullptr) pfree(m_setup); }; @@ -165,7 +165,7 @@ void usage(tool_options_t &opts) struct input_t { input_t() - : m_param(NULL), m_value(0.0) + : m_param(nullptr), m_value(0.0) { } input_t(netlist::netlist_t *netlist, const pstring &line) diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h index 444ddd85176..91cb7c9385f 100644 --- a/src/lib/netlist/solver/nld_ms_direct.h +++ b/src/lib/netlist/solver/nld_ms_direct.h @@ -308,10 +308,10 @@ void matrix_solver_direct_t<m_N, _storage_N>::LE_solve() x_i[p] = i; x_start[p] = chunks * p; x_stop[p] = nl_math::min(chunks*(p+1), eb); - if (p<num_thr && x_start[p] < x_stop[p]) thr_process(p, this, NULL); + if (p<num_thr && x_start[p] < x_stop[p]) thr_process(p, this, nullptr); } if (x_start[num_thr] < x_stop[num_thr]) - do_work(num_thr, NULL); + do_work(num_thr, nullptr); thr_wait(); } else if (eb > 0) @@ -319,7 +319,7 @@ void matrix_solver_direct_t<m_N, _storage_N>::LE_solve() x_i[0] = i; x_start[0] = 0; x_stop[0] = eb; - do_work(0, NULL); + do_work(0, nullptr); } #else diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h index 4dc6ff6015c..7670e036b8e 100644 --- a/src/lib/netlist/solver/nld_ms_gcr.h +++ b/src/lib/netlist/solver/nld_ms_gcr.h @@ -169,7 +169,7 @@ void matrix_solver_GCR_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets) { pstring symname = static_compile_name(); m_proc = this->netlist().lib().template getsym<extsolver>(symname); - if (m_proc != NULL) + if (m_proc != nullptr) this->log().verbose("External static solver {1} found ...", symname); else this->log().verbose("External static solver {1} not found ...", symname); diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index f9b64c9a93d..5341d1b70d1 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -69,7 +69,7 @@ ATTR_COLD void terms_t::add(terminal_t *term, int net_other, bool sorted) m_gt.insert_at(i, 0.0); m_go.insert_at(i, 0.0); m_Idr.insert_at(i, 0.0); - m_other_curanalog.insert_at(i, NULL); + m_other_curanalog.insert_at(i, nullptr); return; } } @@ -78,7 +78,7 @@ ATTR_COLD void terms_t::add(terminal_t *term, int net_other, bool sorted) m_gt.push_back(0.0); m_go.push_back(0.0); m_Idr.push_back(0.0); - m_other_curanalog.push_back(NULL); + m_other_curanalog.push_back(nullptr); } ATTR_COLD void terms_t::set_pointers() @@ -169,7 +169,7 @@ ATTR_COLD void matrix_solver_t::setup_base(analog_net_t::list_t &nets) break; case terminal_t::INPUT: { - analog_output_t *net_proxy_output = NULL; + analog_output_t *net_proxy_output = nullptr; for (auto & input : m_inps) if (input->m_proxied_net == &p->net().as_analog()) { @@ -177,7 +177,7 @@ ATTR_COLD void matrix_solver_t::setup_base(analog_net_t::list_t &nets) break; } - if (net_proxy_output == NULL) + if (net_proxy_output == nullptr) { //net_proxy_output = palloc(analog_output_t(*this, // this->name() + "." + pfmt("m{1}")(m_inps.size()))); @@ -755,7 +755,7 @@ matrix_solver_t * NETLIB_NAME(solver)::create_solver(int size, const bool use_sp else { netlist().log().fatal("Unknown solver type: {1}\n", m_iterative_solver.Value()); - return NULL; + return nullptr; } } else @@ -894,7 +894,7 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() else { netlist().log().fatal("Encountered netgroup with > 128 nets"); - ms = NULL; /* tease compilers */ + ms = nullptr; /* tease compilers */ } break; diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp index 099f913b307..a7b5611ea26 100644 --- a/src/lib/netlist/tools/nl_convert.cpp +++ b/src/lib/netlist/tools/nl_convert.cpp @@ -72,7 +72,7 @@ void nl_convert_base_t::add_device(const pstring &atype, const pstring &aname) void nl_convert_base_t::add_term(pstring netname, pstring termname) { - net_t * net = NULL; + net_t * net = nullptr; if (m_nets.contains(netname)) net = m_nets[netname]; else @@ -84,7 +84,7 @@ void nl_convert_base_t::add_term(pstring netname, pstring termname) /* if there is a pin alias, translate ... */ pin_alias_t *alias = m_pins[termname]; - if (alias != NULL) + if (alias != nullptr) net->terminals().push_back(alias->alias()); else net->terminals().push_back(termname); diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp index 339a4de3231..acd1a83a9b1 100644 --- a/src/lib/util/aviio.cpp +++ b/src/lib/util/aviio.cpp @@ -2161,7 +2161,7 @@ avi_file::error avi_file_impl::get_next_chunk_internal(const avi_chunk *parent, std::uint8_t buffer[12]; std::uint32_t bytesread; - /* NULL parent implies the root */ + /* nullptr parent implies the root */ if (parent == nullptr) parent = &m_rootchunk; diff --git a/src/lib/util/chd.cpp b/src/lib/util/chd.cpp index 3a97c6ce0fe..ce4396eac29 100644 --- a/src/lib/util/chd.cpp +++ b/src/lib/util/chd.cpp @@ -331,7 +331,7 @@ sha1_t chd_file::sha1() } catch (chd_error &) { - // on failure, return NULL + // on failure, return nullptr return sha1_t::null; } } @@ -364,7 +364,7 @@ sha1_t chd_file::raw_sha1() } catch (chd_error &) { - // on failure, return NULL + // on failure, return nullptr return sha1_t::null; } } @@ -397,7 +397,7 @@ sha1_t chd_file::parent_sha1() } catch (chd_error &) { - // on failure, return NULL + // on failure, return nullptr return sha1_t::null; } } diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h index b178c6083ba..a3b0e0c7304 100644 --- a/src/lib/util/chd.h +++ b/src/lib/util/chd.h @@ -416,7 +416,7 @@ private: UINT32 m_unitbytes; // size of each unit in bytes UINT64 m_unitcount; // number of units represented chd_codec_type m_compression[4]; // array of compression types used - chd_file * m_parent; // pointer to parent file, or NULL if none + chd_file * m_parent; // pointer to parent file, or nullptr if none bool m_parent_missing; // are we missing our parent? // key offsets within the header diff --git a/src/lib/util/chdcodec.cpp b/src/lib/util/chdcodec.cpp index ba1840489d6..736fd7fb094 100644 --- a/src/lib/util/chdcodec.cpp +++ b/src/lib/util/chdcodec.cpp @@ -632,7 +632,7 @@ chd_compressor_group::chd_compressor_group(chd_file &chd, UINT32 compressor_list throw CHDERR_UNKNOWN_COMPRESSION; #if CHDCODEC_VERIFY_COMPRESSION m_decompressor[codecnum] = chd_codec_list::new_decompressor(compressor_list[codecnum], chd); - if (m_decompressor[codecnum] == NULL) + if (m_decompressor[codecnum] == nullptr) throw CHDERR_UNKNOWN_COMPRESSION; #endif } diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp index e3d34ec3738..09d99c2072b 100644 --- a/src/lib/util/corefile.cpp +++ b/src/lib/util/corefile.cpp @@ -541,7 +541,7 @@ char *core_text_file::gets(char *s, int n) } } - // if we put nothing in, return NULL + // if we put nothing in, return nullptr if (cur == s) return nullptr; @@ -734,7 +734,7 @@ core_osd_file::~core_osd_file() { // close files and free memory if (m_zdata) - compress(FCOMPRESS_NONE); + core_osd_file::compress(FCOMPRESS_NONE); } diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h index 6ec00f63e22..81e9907ae29 100644 --- a/src/lib/util/coretmpl.h +++ b/src/lib/util/coretmpl.h @@ -141,7 +141,7 @@ private: m_count += count; } - // insert the given object after a particular object (NULL means prepend) + // insert the given object after a particular object (nullptr means prepend) _ElementType &insert_after(_ElementType &object, _ElementType *insert_after) noexcept { if (insert_after == nullptr) @@ -154,7 +154,7 @@ private: return object; } - // insert the given object before a particular object (NULL means append) + // insert the given object before a particular object (nullptr means append) _ElementType &insert_before(_ElementType &object, _ElementType *insert_before) noexcept { if (insert_before == nullptr) diff --git a/src/lib/util/cstrpool.cpp b/src/lib/util/cstrpool.cpp index 242c33380de..5a9e571366b 100644 --- a/src/lib/util/cstrpool.cpp +++ b/src/lib/util/cstrpool.cpp @@ -32,7 +32,7 @@ const_string_pool::const_string_pool() const char *const_string_pool::add(const char *string) { - // if NULL or a small number (for some hash strings), just return as-is + // if nullptr or a small number (for some hash strings), just return as-is if (FPTR(string) < 0x100) return string; @@ -58,7 +58,7 @@ const char *const_string_pool::add(const char *string) bool const_string_pool::contains(const char *string) { - // if NULL or a small number (for some hash strings), then yes, effectively + // if nullptr or a small number (for some hash strings), then yes, effectively if (FPTR(string) < 0x100) return true; @@ -102,7 +102,7 @@ const char *const_string_pool::pool_chunk::add(const char *string) int bytes = strlen(string) + 1; assert(bytes < POOL_SIZE); - // if too big, return NULL + // if too big, return nullptr if (m_used + bytes > POOL_SIZE) return nullptr; diff --git a/src/lib/util/delegate.h b/src/lib/util/delegate.h index ae469f86ed7..1d849b508f2 100644 --- a/src/lib/util/delegate.h +++ b/src/lib/util/delegate.h @@ -276,7 +276,7 @@ private: raw_mfp_data m_rawdata; // raw buffer to hold the copy of the function pointer delegate_generic_class * m_realobject; // pointer to the object used for calling delegate_generic_function m_stubfunction; // pointer to our matching stub function - static raw_mfp_data s_null_mfp; // NULL mfp + static raw_mfp_data s_null_mfp; // nullptr mfp }; #elif (USE_DELEGATE_TYPE == DELEGATE_TYPE_INTERNAL) diff --git a/src/lib/util/flac.cpp b/src/lib/util/flac.cpp index c66cc281931..fedcd6cd73e 100644 --- a/src/lib/util/flac.cpp +++ b/src/lib/util/flac.cpp @@ -277,12 +277,18 @@ FLAC__StreamEncoderWriteStatus flac_encoder::write_callback(const FLAC__byte buf flac_decoder::flac_decoder() : m_decoder(FLAC__stream_decoder_new()), - m_file(nullptr), - m_compressed_offset(0), - m_compressed_start(nullptr), - m_compressed_length(0), - m_compressed2_start(nullptr), - m_compressed2_length(0) + m_file(nullptr), + m_sample_rate(0), + m_channels(0), + m_bits_per_sample(0), + m_compressed_offset(0), + m_compressed_start(nullptr), + m_compressed_length(0), + m_compressed2_start(nullptr), + m_compressed2_length(0), + m_uncompressed_offset(0), + m_uncompressed_length(0), + m_uncompressed_swap(false) { } diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp index f8ef33b0d39..cd1ce38fce1 100644 --- a/src/lib/util/options.cpp +++ b/src/lib/util/options.cpp @@ -290,7 +290,7 @@ void core_options::add_entry(const char *name, const char *description, UINT32 f void core_options::add_entries(const options_entry *entrylist, bool override_existing) { - // loop over entries until we hit a NULL name + // loop over entries until we hit a nullptr name for ( ; entrylist->name != nullptr || (entrylist->flags & OPTION_HEADER) != 0; entrylist++) add_entry(*entrylist, override_existing); } diff --git a/src/lib/util/options.h b/src/lib/util/options.h index ff1cad115de..a0c3817651a 100644 --- a/src/lib/util/options.h +++ b/src/lib/util/options.h @@ -169,7 +169,6 @@ public: bool is_changed(const char *name) const; // setting - void set_command(const char *command); bool set_value(const char *name, const char *value, int priority, std::string &error_string); bool set_value(const char *name, int value, int priority, std::string &error_string); bool set_value(const char *name, float value, int priority, std::string &error_string); diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h index 2dfbac03a45..f8f932bc072 100644 --- a/src/lib/util/palette.h +++ b/src/lib/util/palette.h @@ -35,7 +35,7 @@ class rgb_t { public: // construction/destruction - rgb_t() { } + rgb_t(): m_data(0) { } rgb_t(UINT32 data) { m_data = data; } rgb_t(UINT8 r, UINT8 g, UINT8 b) { m_data = (255 << 24) | (r << 16) | (g << 8) | b; } rgb_t(UINT8 a, UINT8 r, UINT8 g, UINT8 b) { m_data = (a << 24) | (r << 16) | (g << 8) | b; } @@ -67,8 +67,8 @@ public: rgb_t &operator-=(const rgb_t &rhs) { m_data = rgb_t(clamplo(a() - rhs.a()), clamplo(r() - rhs.r()), clamplo(g() - rhs.g()), clamplo(b() - rhs.b())); return *this; } // arithmetic operators - const rgb_t operator+(const rgb_t &rhs) const { rgb_t result = *this; result += rhs; return result; } - const rgb_t operator-(const rgb_t &rhs) const { rgb_t result = *this; result -= rhs; return result; } + rgb_t operator+(const rgb_t &rhs) const { rgb_t result = *this; result += rhs; return result; } + rgb_t operator-(const rgb_t &rhs) const { rgb_t result = *this; result -= rhs; return result; } // static helpers static UINT8 clamp(INT32 value) { return (value < 0) ? 0 : (value > 255) ? 255 : value; } diff --git a/src/lib/util/png.cpp b/src/lib/util/png.cpp index 8023d350cdc..73c43e9cf90 100644 --- a/src/lib/util/png.cpp +++ b/src/lib/util/png.cpp @@ -312,7 +312,7 @@ static png_error process_chunk(png_private *png, UINT8 *data, UINT32 type, UINT3 text->next = nullptr; /* add to the end of the list */ - for (pt = nullptr, ct = png->pnginfo->textlist; ct != nullptr; pt = ct, ct = ct->next) ; + for (pt = nullptr, ct = png->pnginfo->textlist; ct != nullptr; pt = ct, ct = ct->next) { } if (pt == nullptr) png->pnginfo->textlist = text; else @@ -726,13 +726,13 @@ png_error png_add_text(png_info *pnginfo, const char *keyword, const char *text) strcpy(textdata, keyword); strcpy(textdata + keylen + 1, text); - /* text follows a trailing NULL */ + /* text follows a trailing nullptr */ newtext->keyword = textdata; newtext->text = textdata + keylen + 1; newtext->next = nullptr; /* add us to the end of the linked list */ - for (pt = nullptr, ct = pnginfo->textlist; ct != nullptr; pt = ct, ct = ct->next) ; + for (pt = nullptr, ct = pnginfo->textlist; ct != nullptr; pt = ct, ct = ct->next) { } if (pt == nullptr) pnginfo->textlist = newtext; else @@ -905,7 +905,7 @@ static png_error convert_bitmap_to_image_palette(png_info *pnginfo, const bitmap return PNGERR_OUT_OF_MEMORY; } - /* copy in the pixels, specifying a NULL filter */ + /* copy in the pixels, specifying a nullptr filter */ for (y = 0; y < pnginfo->height; y++) { UINT16 *src = reinterpret_cast<UINT16 *>(bitmap.raw_pixptr(y)); @@ -944,7 +944,7 @@ static png_error convert_bitmap_to_image_rgb(png_info *pnginfo, const bitmap_t & if (pnginfo->image == nullptr) return PNGERR_OUT_OF_MEMORY; - /* copy in the pixels, specifying a NULL filter */ + /* copy in the pixels, specifying a nullptr filter */ for (y = 0; y < pnginfo->height; y++) { UINT8 *dst = pnginfo->image + y * (rowbytes + 1); diff --git a/src/lib/util/pool.cpp b/src/lib/util/pool.cpp index 9712d8b6e00..f1f42bb58bf 100644 --- a/src/lib/util/pool.cpp +++ b/src/lib/util/pool.cpp @@ -269,10 +269,10 @@ void *pool_object_add_file_line(object_pool *pool, object_type _type, void *obje return object; } - /* if we get a NULL object, fail */ + /* if we get a nullptr object, fail */ if (object == nullptr) { - report_failure(pool, "pool_object_add (via %s:%d): Attempted to add a NULL object of size %d", file, line, (int)size); + report_failure(pool, "pool_object_add (via %s:%d): Attempted to add a nullptr object of size %d", file, line, (int)size); return object; } diff --git a/src/lib/util/un7z.cpp b/src/lib/util/un7z.cpp index 95f34179ea0..75377d4093a 100644 --- a/src/lib/util/un7z.cpp +++ b/src/lib/util/un7z.cpp @@ -340,7 +340,7 @@ void m7z_file_impl::close(ptr &&archive) osd_printf_verbose("un7z: closing archive file %s and sending to cache\n", archive->m_filename.c_str()); archive->m_archive_stream.osdfile.reset(); - // find the first NULL entry in the cache + // find the first nullptr entry in the cache std::lock_guard<std::mutex> guard(s_cache_mutex); std::size_t cachenum; for (cachenum = 0; cachenum < s_cache.size(); cachenum++) @@ -504,7 +504,7 @@ void m7z_file_impl::make_utf8_name(int index) archive_file::error archive_file::open_7z(const std::string &filename, ptr &result) { - // ensure we start with a NULL result + // ensure we start with a nullptr result result.reset(); // see if we are in the cache, and reopen if so diff --git a/src/lib/util/unzip.cpp b/src/lib/util/unzip.cpp index cce6c812a76..021d9602dae 100644 --- a/src/lib/util/unzip.cpp +++ b/src/lib/util/unzip.cpp @@ -585,7 +585,7 @@ void zip_file_impl::close(ptr &&zip) osd_printf_verbose("unzip: closing archive file %s and sending to cache\n", zip->m_filename.c_str()); zip->m_file.reset(); - // find the first NULL entry in the cache + // find the first nullptr entry in the cache std::lock_guard<std::mutex> guard(s_cache_mutex); std::size_t cachenum; for (cachenum = 0; cachenum < s_cache.size(); cachenum++) @@ -1334,7 +1334,7 @@ void m7z_file_cache_clear(); archive_file::error archive_file::open_zip(const std::string &filename, ptr &result) { - // ensure we start with a NULL result + // ensure we start with a nullptr result result.reset(); // see if we are in the cache, and reopen if so diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp index db288b0a807..b1ed844dc71 100644 --- a/src/lib/util/xmlfile.cpp +++ b/src/lib/util/xmlfile.cpp @@ -70,7 +70,7 @@ static const char *copystring(const char *input) { char *newstr; - /* NULL just passes through */ + /* nullptr just passes through */ if (input == nullptr) return nullptr; @@ -94,7 +94,7 @@ static const char *copystring_lower(const char *input) char *newstr; int i; - /* NULL just passes through */ + /* nullptr just passes through */ if (input == nullptr) return nullptr; @@ -300,7 +300,7 @@ xml_data_node *xml_find_matching_sibling(xml_data_node *node, const char *name, /* loop over siblings and find a matching attribute */ for ( ; node; node = node->next) { - /* can pass NULL as a wildcard for the node name */ + /* can pass nullptr as a wildcard for the node name */ if (name == nullptr || strcmp(name, node->name) == 0) { /* find a matching attribute */ @@ -373,7 +373,7 @@ void xml_delete_node(xml_data_node *node) /*------------------------------------------------- xml_get_attribute - get the value of the - specified attribute, or NULL if not found + specified attribute, or nullptr if not found -------------------------------------------------*/ xml_attribute_node *xml_get_attribute(xml_data_node *node, const char *attribute) @@ -934,7 +934,7 @@ static xml_data_node *add_child(xml_data_node *parent, const char *name, const c node->attribute = nullptr; /* add us to the end of the list of siblings */ - for (pnode = &parent->child; *pnode; pnode = &(*pnode)->next) ; + for (pnode = &parent->child; *pnode; pnode = &(*pnode)->next) { } *pnode = node; return node; @@ -984,7 +984,7 @@ static xml_attribute_node *add_attribute(xml_data_node *node, const char *name, } /* add us to the end of the list of attributes */ - for (panode = &node->attribute; *panode; panode = &(*panode)->next) ; + for (panode = &node->attribute; *panode; panode = &(*panode)->next) { } *panode = anode; return anode; diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 5c49d2df9a3..4cbca2cf5fc 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -79,8 +79,16 @@ class debug_imgui : public osd_module, public debug_module public: debug_imgui() : osd_module(OSD_DEBUG_PROVIDER, "imgui"), debug_module(), - m_machine(nullptr), - m_hide(false), + m_machine(nullptr), + m_mouse_x(0), + m_mouse_y(0), + m_mouse_button(false), + m_prev_mouse_button(false), + m_running(false), + font_name(nullptr), + font_size(0), + m_key_char(0), + m_hide(false), m_win_count(0) { } @@ -322,7 +330,7 @@ void debug_imgui::handle_keys() else io.KeyAlt = false; - for(input_item_id id = ITEM_ID_A; id <= ITEM_ID_CANCEL; id++) + for(input_item_id id = ITEM_ID_A; id <= ITEM_ID_CANCEL; ++id) { if(m_machine->input().code_pressed(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id))) io.KeysDown[id] = true; @@ -610,13 +618,13 @@ void debug_imgui::draw_disasm(debug_area* view_ptr, bool* opened) debug_view_disasm* disasm = downcast<debug_view_disasm*>(view_ptr->view); int rightcol = disasm->right_column(); - if(ImGui::MenuItem("Raw opcodes",NULL,(rightcol == DASM_RIGHTCOL_RAW) ? true : false)) + if(ImGui::MenuItem("Raw opcodes", nullptr,(rightcol == DASM_RIGHTCOL_RAW) ? true : false)) disasm->set_right_column(DASM_RIGHTCOL_RAW); - if(ImGui::MenuItem("Encrypted opcodes",NULL,(rightcol == DASM_RIGHTCOL_ENCRYPTED) ? true : false)) + if(ImGui::MenuItem("Encrypted opcodes", nullptr,(rightcol == DASM_RIGHTCOL_ENCRYPTED) ? true : false)) disasm->set_right_column(DASM_RIGHTCOL_ENCRYPTED); - if(ImGui::MenuItem("No opcodes",NULL,(rightcol == DASM_RIGHTCOL_NONE) ? true : false)) + if(ImGui::MenuItem("No opcodes", nullptr,(rightcol == DASM_RIGHTCOL_NONE) ? true : false)) disasm->set_right_column(DASM_RIGHTCOL_NONE); - if(ImGui::MenuItem("Comments",NULL,(rightcol == DASM_RIGHTCOL_COMMENTS) ? true : false)) + if(ImGui::MenuItem("Comments", nullptr,(rightcol == DASM_RIGHTCOL_COMMENTS) ? true : false)) disasm->set_right_column(DASM_RIGHTCOL_COMMENTS); ImGui::EndMenu(); @@ -748,27 +756,27 @@ void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened) int format = mem->get_data_format(); UINT32 chunks = mem->chunks_per_row(); - if(ImGui::MenuItem("1-byte chunks",NULL,(format == 1) ? true : false)) + if(ImGui::MenuItem("1-byte chunks", nullptr,(format == 1) ? true : false)) mem->set_data_format(1); - if(ImGui::MenuItem("2-byte chunks",NULL,(format == 2) ? true : false)) + if(ImGui::MenuItem("2-byte chunks", nullptr,(format == 2) ? true : false)) mem->set_data_format(2); - if(ImGui::MenuItem("4-byte chunks",NULL,(format == 4) ? true : false)) + if(ImGui::MenuItem("4-byte chunks", nullptr,(format == 4) ? true : false)) mem->set_data_format(4); - if(ImGui::MenuItem("8-byte chunks",NULL,(format == 8) ? true : false)) + if(ImGui::MenuItem("8-byte chunks", nullptr,(format == 8) ? true : false)) mem->set_data_format(8); - if(ImGui::MenuItem("32-bit floating point",NULL,(format == 9) ? true : false)) + if(ImGui::MenuItem("32-bit floating point", nullptr,(format == 9) ? true : false)) mem->set_data_format(9); - if(ImGui::MenuItem("64-bit floating point",NULL,(format == 10) ? true : false)) + if(ImGui::MenuItem("64-bit floating point", nullptr,(format == 10) ? true : false)) mem->set_data_format(10); - if(ImGui::MenuItem("80-bit floating point",NULL,(format == 11) ? true : false)) + if(ImGui::MenuItem("80-bit floating point", nullptr,(format == 11) ? true : false)) mem->set_data_format(11); ImGui::Separator(); - if(ImGui::MenuItem("Logical addresses",NULL,!physical)) + if(ImGui::MenuItem("Logical addresses", nullptr,!physical)) mem->set_physical(false); - if(ImGui::MenuItem("Physical addresses",NULL,physical)) + if(ImGui::MenuItem("Physical addresses", nullptr,physical)) mem->set_physical(true); ImGui::Separator(); - if(ImGui::MenuItem("Reverse view",NULL,rev)) + if(ImGui::MenuItem("Reverse view", nullptr,rev)) mem->set_reverse(!rev); ImGui::Separator(); if(ImGui::MenuItem("Increase bytes per line")) @@ -894,7 +902,7 @@ void debug_imgui::draw_console() ImGuiWindowFlags flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse; ImGui::SetNextWindowSize(ImVec2(view_main_regs->width + view_main_disasm->width,view_main_disasm->height + view_main_console->height + ImGui::GetTextLineHeight()*3),ImGuiSetCond_Once); - if(ImGui::Begin(view_main_console->title.c_str(),NULL,flags)) + if(ImGui::Begin(view_main_console->title.c_str(), nullptr,flags)) { const debug_view_char *viewdata; debug_view_xy vsize,totalsize; @@ -975,7 +983,7 @@ void debug_imgui::draw_console() collapsed = true; ImGui::End(); } - if(ImGui::MenuItem((*view_ptr)->title.c_str(),NULL,!collapsed)) + if(ImGui::MenuItem((*view_ptr)->title.c_str(), nullptr,!collapsed)) ImGui::SetWindowCollapsed((*view_ptr)->title.c_str(),false); } ImGui::EndMenu(); @@ -1176,7 +1184,7 @@ void debug_imgui::update() to_delete = (*view_ptr); break; } - view_ptr++; + ++view_ptr; count++; } // check for a closed window diff --git a/src/osd/modules/debugger/debugint.cpp b/src/osd/modules/debugger/debugint.cpp index 6ac60b81b41..b894f84f1a0 100644 --- a/src/osd/modules/debugger/debugint.cpp +++ b/src/osd/modules/debugger/debugint.cpp @@ -33,8 +33,8 @@ class debug_internal : public osd_module, public debug_module public: debug_internal() : osd_module(OSD_DEBUG_PROVIDER, "internal"), debug_module(), - m_machine(nullptr) - { + m_machine(nullptr), font_name(nullptr), font_size(0) +{ } virtual ~debug_internal() { } diff --git a/src/osd/modules/debugger/debugosx.mm b/src/osd/modules/debugger/debugosx.mm index 598a85dd569..56e85e21105 100644 --- a/src/osd/modules/debugger/debugosx.mm +++ b/src/osd/modules/debugger/debugosx.mm @@ -41,7 +41,7 @@ class debugger_osx : public osd_module, public debug_module public: debugger_osx() : osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(), - m_machine(NULL), + m_machine(nullptr), m_console(nil) { } @@ -95,7 +95,7 @@ void debugger_osx::exit() userInfo:info]; [m_console release]; m_console = nil; - m_machine = NULL; + m_machine = nullptr; } [pool release]; } diff --git a/src/osd/modules/debugger/debugqt.cpp b/src/osd/modules/debugger/debugqt.cpp index ac6c6a9d95c..e9abe538981 100644 --- a/src/osd/modules/debugger/debugqt.cpp +++ b/src/osd/modules/debugger/debugqt.cpp @@ -40,7 +40,7 @@ class debug_qt : public osd_module, public debug_module public: debug_qt() : osd_module(OSD_DEBUG_PROVIDER, "qt"), debug_module(), - m_machine(NULL) + m_machine(nullptr) { } @@ -64,10 +64,10 @@ private: //============================================================ int qtArgc = 0; -char** qtArgv = NULL; +char** qtArgv = nullptr; bool oneShot = true; -static MainWindow* mainQtWindow = NULL; +static MainWindow* mainQtWindow = nullptr; //============================================================ // XML configuration save/load @@ -84,7 +84,7 @@ static void xml_configuration_load(running_machine &machine, config_type cfg_typ return; // Might not have any data - if (parentnode == NULL) + if (parentnode == nullptr) return; for (int i = 0; i < xmlConfigurations.size(); i++) @@ -92,8 +92,8 @@ static void xml_configuration_load(running_machine &machine, config_type cfg_typ xmlConfigurations.clear(); // Configuration load - xml_data_node* wnode = NULL; - for (wnode = xml_get_sibling(parentnode->child, "window"); wnode != NULL; wnode = xml_get_sibling(wnode->next, "window")) + xml_data_node* wnode = nullptr; + for (wnode = xml_get_sibling(parentnode->child, "window"); wnode != nullptr; wnode = xml_get_sibling(wnode->next, "window")) { WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", WindowQtConfig::WIN_TYPE_UNKNOWN); switch (type) @@ -124,8 +124,8 @@ static void xml_configuration_save(running_machine &machine, config_type cfg_typ // Create an xml node xml_data_node *debugger_node; - debugger_node = xml_add_child(parentnode, "window", NULL); - if (debugger_node == NULL) + debugger_node = xml_add_child(parentnode, "window", nullptr); + if (debugger_node == nullptr) continue; // Insert the appropriate information @@ -195,7 +195,7 @@ static void setup_additional_startup_windows(running_machine& machine, std::vect { WindowQtConfig* config = configList[i]; - WindowQt* foo = NULL; + WindowQt* foo = nullptr; switch (config->m_type) { case WindowQtConfig::WIN_TYPE_MEMORY: @@ -246,7 +246,7 @@ bool debug_qt::nativeEventFilter(const QByteArray &eventType, void *message, lon void debug_qt::init_debugger(running_machine &machine) { - if (qApp == NULL) + if (qApp == nullptr) { // If you're starting from scratch, create a new qApp new QApplication(qtArgc, qtArgv); diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp index a32405c4aa8..1f68e6989eb 100644 --- a/src/osd/modules/debugger/debugwin.cpp +++ b/src/osd/modules/debugger/debugwin.cpp @@ -35,11 +35,11 @@ public: debugger_windows() : osd_module(OSD_DEBUG_PROVIDER, "windows"), debug_module(), - m_machine(NULL), + m_machine(nullptr), m_metrics(), m_waiting_for_debugger(false), m_window_list(), - m_main_console(NULL) + m_main_console(nullptr) { } @@ -83,12 +83,12 @@ private: void debugger_windows::exit() { // loop over windows and free them - while (m_window_list.first() != NULL) + while (m_window_list.first() != nullptr) m_window_list.first()->destroy(); - m_main_console = NULL; + m_main_console = nullptr; m_metrics.reset(); - m_machine = NULL; + m_machine = nullptr; } @@ -102,15 +102,15 @@ void debugger_windows::init_debugger(running_machine &machine) void debugger_windows::wait_for_debugger(device_t &device, bool firststop) { // create a console window - if (m_main_console == NULL) + if (m_main_console == nullptr) m_main_console = create_window<consolewin_info>(); // update the views in the console to reflect the current CPU - if (m_main_console != NULL) + if (m_main_console != nullptr) m_main_console->set_cpu(device); // when we are first stopped, adjust focus to us - if (firststop && (m_main_console != NULL)) + if (firststop && (m_main_console != nullptr)) { m_main_console->set_foreground(); if (winwindow_has_focus()) @@ -126,7 +126,7 @@ void debugger_windows::wait_for_debugger(device_t &device, bool firststop) // get and process messages MSG message; - GetMessage(&message, NULL, 0, 0); + GetMessage(&message, nullptr, 0, 0); switch (message.message) { @@ -254,7 +254,7 @@ template <typename T> T *debugger_windows::create_window() else { global_free(info); - return NULL; + return nullptr; } } diff --git a/src/osd/modules/debugger/osx/debugconsole.mm b/src/osd/modules/debugger/osx/debugconsole.mm index 4bd7e029295..dc86bd6f53e 100644 --- a/src/osd/modules/debugger/osx/debugconsole.mm +++ b/src/osd/modules/debugger/osx/debugconsole.mm @@ -236,7 +236,7 @@ // if it doesn't exist, add a new one NSString *command; - if (bp == NULL) + if (bp == nullptr) command = [NSString stringWithFormat:@"bpset 0x%lX", (unsigned long)address]; else command = [NSString stringWithFormat:@"bpclear 0x%X", (unsigned)bp->index()]; @@ -251,7 +251,7 @@ { device_debug::breakpoint *bp = [[self class] findBreakpointAtAddress:[dasmView selectedAddress] forDevice:device]; - if (bp != NULL) + if (bp != nullptr) { NSString *command; if (bp->enabled()) @@ -483,7 +483,7 @@ BOOL const haveCursor = [dasmView cursorVisible]; BOOL const isCurrent = (debug_cpu_get_visible_cpu(*machine) == &[dasmView source]->device()); - device_debug::breakpoint *breakpoint = NULL; + device_debug::breakpoint *breakpoint = nullptr; if (haveCursor) { breakpoint = [[self class] findBreakpointAtAddress:[dasmView selectedAddress] @@ -494,7 +494,7 @@ { if (haveCursor) { - if (breakpoint != NULL) + if (breakpoint != nullptr) { if (inContextMenu) [item setTitle:@"Clear Breakpoint"]; @@ -520,7 +520,7 @@ } else if (action == @selector(debugToggleBreakpointEnable:)) { - if ((breakpoint != NULL) && !breakpoint->enabled()) + if ((breakpoint != nullptr) && !breakpoint->enabled()) { if (inContextMenu) [item setTitle:@"Enable Breakpoint"]; @@ -534,7 +534,7 @@ else [item setTitle:@"Disable Breakpoint at Cursor"]; } - return (breakpoint != NULL) && isCurrent; + return (breakpoint != nullptr) && isCurrent; } else if (action == @selector(debugRunToCursor:)) { diff --git a/src/osd/modules/debugger/osx/debugview.mm b/src/osd/modules/debugger/osx/debugview.mm index 05d2e2dfc17..a32b99794dd 100644 --- a/src/osd/modules/debugger/osx/debugview.mm +++ b/src/osd/modules/debugger/osx/debugview.mm @@ -260,7 +260,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - if (view != NULL) machine->debug_view().free_view(*view); + if (view != nullptr) machine->debug_view().free_view(*view); if (font != nil) [font release]; if (text != nil) [text release]; [super dealloc]; diff --git a/src/osd/modules/debugger/osx/debugwindowhandler.mm b/src/osd/modules/debugger/osx/debugwindowhandler.mm index fd11fa89152..90260914f8e 100644 --- a/src/osd/modules/debugger/osx/debugwindowhandler.mm +++ b/src/osd/modules/debugger/osx/debugwindowhandler.mm @@ -131,7 +131,7 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD + (device_debug::breakpoint *)findBreakpointAtAddress:(offs_t)address forDevice:(device_t &)device { device_debug *const cpuinfo = device.debug(); device_debug::breakpoint *bp = cpuinfo->breakpoint_first(); - while ((bp != NULL) && (address != bp->address())) bp = bp->next(); + while ((bp != nullptr) && (address != bp->address())) bp = bp->next(); return bp; } diff --git a/src/osd/modules/debugger/osx/deviceinfoviewer.mm b/src/osd/modules/debugger/osx/deviceinfoviewer.mm index dd1b43ccf60..bbc2ac7d0f5 100644 --- a/src/osd/modules/debugger/osx/deviceinfoviewer.mm +++ b/src/osd/modules/debugger/osx/deviceinfoviewer.mm @@ -166,10 +166,10 @@ // add interfaces if present device_interface *interface = device->interfaces().first(); - if (interface != NULL) + if (interface != nullptr) { NSBox *const interfacesBox = [self makeBox:@"Interfaces" toFit:contentView]; - while (interface != NULL) + while (interface != nullptr) { [self addField:[NSString stringWithUTF8String:interface->interface_type()] toBox:interfacesBox]; diff --git a/src/osd/modules/debugger/osx/devicesviewer.mm b/src/osd/modules/debugger/osx/devicesviewer.mm index 356cc2d1393..8a87dedb1a6 100644 --- a/src/osd/modules/debugger/osx/devicesviewer.mm +++ b/src/osd/modules/debugger/osx/devicesviewer.mm @@ -34,7 +34,7 @@ - (void)wrapChildren { NSMutableArray *const tmp = [[NSMutableArray alloc] init]; - for (device_t *child = device->subdevices().first(); child != NULL; child = child->next()) + for (device_t *child = device->subdevices().first(); child != nullptr; child = child->next()) { MAMEDeviceWrapper *const wrap = [[MAMEDeviceWrapper alloc] initWithMachine:*machine device:*child]; diff --git a/src/osd/modules/debugger/osx/disassemblyview.mm b/src/osd/modules/debugger/osx/disassemblyview.mm index f82eb917fae..212f8194cd6 100644 --- a/src/osd/modules/debugger/osx/disassemblyview.mm +++ b/src/osd/modules/debugger/osx/disassemblyview.mm @@ -43,7 +43,7 @@ - (NSSize)maximumFrameSize { debug_view_xy max(0, 0); debug_view_source const *source = view->source(); - for (debug_view_source const *source = view->first_source(); source != NULL; source = source->next()) + for (debug_view_source const *source = view->first_source(); source != nullptr; source = source->next()) { view->set_source(*source); debug_view_xy const current = view->total_size(); @@ -105,7 +105,7 @@ - (NSString *)selectedSubviewName { const debug_view_source *source = view->source(); - if (source != NULL) + if (source != nullptr) return [NSString stringWithUTF8String:source->name()]; else return @""; @@ -114,7 +114,7 @@ - (int)selectedSubviewIndex { const debug_view_source *source = view->source(); - if (source != NULL) + if (source != nullptr) return view->source_list().indexof(*source); else return -1; @@ -133,7 +133,7 @@ - (BOOL)selectSubviewForDevice:(device_t *)device { debug_view_source const *const source = view->source_for_device(device); - if (source != NULL) + if (source != nullptr) { if (view->source() != source) { @@ -151,11 +151,11 @@ - (BOOL)selectSubviewForSpace:(address_space *)space { - if (space == NULL) return NO; + if (space == nullptr) return NO; debug_view_disasm_source const *source = downcast<debug_view_disasm_source const *>(view->first_source()); - while ((source != NULL) && (&source->space() != space)) + while ((source != nullptr) && (&source->space() != space)) source = downcast<debug_view_disasm_source *>(source->next()); - if (source != NULL) + if (source != nullptr) { if (view->source() != source) { @@ -253,7 +253,7 @@ - (void)insertSubviewItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index { - for (const debug_view_source *source = view->source_list().first(); source != NULL; source = source->next()) + for (const debug_view_source *source = view->source_list().first(); source != nullptr; source = source->next()) { [[menu insertItemWithTitle:[NSString stringWithUTF8String:source->name()] action:NULL diff --git a/src/osd/modules/debugger/osx/disassemblyviewer.mm b/src/osd/modules/debugger/osx/disassemblyviewer.mm index 83ca9d46c11..10e6c6d2cac 100644 --- a/src/osd/modules/debugger/osx/disassemblyviewer.mm +++ b/src/osd/modules/debugger/osx/disassemblyviewer.mm @@ -175,9 +175,9 @@ device_debug::breakpoint *bp = [[self class] findBreakpointAtAddress:address forDevice:device]; // if it doesn't exist, add a new one - if (bp == NULL) + if (bp == nullptr) { - UINT32 const bpnum = device.debug()->breakpoint_set(address, NULL, NULL); + UINT32 const bpnum = device.debug()->breakpoint_set(address, nullptr, nullptr); debug_console_printf(*machine, "Breakpoint %X set\n", bpnum); } else @@ -200,7 +200,7 @@ device_t &device = [dasmView source]->device(); offs_t const address = [dasmView selectedAddress]; device_debug::breakpoint *bp = [[self class] findBreakpointAtAddress:address forDevice:device]; - if (bp != NULL) + if (bp != nullptr) { device.debug()->breakpoint_enable(bp->index(), !bp->enabled()); debug_console_printf(*machine, @@ -231,7 +231,7 @@ BOOL const inContextMenu = ([item menu] == [dasmView menu]); BOOL const haveCursor = [dasmView cursorVisible]; - device_debug::breakpoint *breakpoint = NULL; + device_debug::breakpoint *breakpoint = nullptr; if (haveCursor) { breakpoint = [[self class] findBreakpointAtAddress:[dasmView selectedAddress] @@ -242,7 +242,7 @@ { if (haveCursor) { - if (breakpoint != NULL) + if (breakpoint != nullptr) { if (inContextMenu) [item setTitle:@"Clear Breakpoint"]; @@ -268,7 +268,7 @@ } else if (action == @selector(debugToggleBreakpointEnable:)) { - if ((breakpoint != NULL) && !breakpoint->enabled()) + if ((breakpoint != nullptr) && !breakpoint->enabled()) { if (inContextMenu) [item setTitle:@"Enable Breakpoint"]; @@ -282,7 +282,7 @@ else [item setTitle:@"Disable Breakpoint at Cursor"]; } - return breakpoint != NULL; + return breakpoint != nullptr; } else { diff --git a/src/osd/modules/debugger/osx/memoryview.mm b/src/osd/modules/debugger/osx/memoryview.mm index c32476bd89b..aac06f3e63a 100644 --- a/src/osd/modules/debugger/osx/memoryview.mm +++ b/src/osd/modules/debugger/osx/memoryview.mm @@ -65,7 +65,7 @@ - (NSSize)maximumFrameSize { debug_view_xy max(0, 0); debug_view_source const *source = view->source(); - for (debug_view_source const *source = view->first_source(); source != NULL; source = source->next()) + for (debug_view_source const *source = view->first_source(); source != nullptr; source = source->next()) { view->set_source(*source); debug_view_xy const current = view->total_size(); @@ -88,7 +88,7 @@ - (NSString *)selectedSubviewName { debug_view_source const *source = view->source(); - if (source != NULL) + if (source != nullptr) return [NSString stringWithUTF8String:source->name()]; else return @""; @@ -97,7 +97,7 @@ - (int)selectedSubviewIndex { debug_view_source const *source = view->source(); - if (source != NULL) + if (source != nullptr) return view->source_list().indexof(*source); else return -1; @@ -116,7 +116,7 @@ - (BOOL)selectSubviewForDevice:(device_t *)device { debug_view_source const *const source = view->source_for_device(device); - if (source != NULL) + if (source != nullptr) { if (view->source() != source) { @@ -134,11 +134,11 @@ - (BOOL)selectSubviewForSpace:(address_space *)space { - if (space == NULL) return NO; + if (space == nullptr) return NO; debug_view_memory_source const *source = downcast<debug_view_memory_source const *>(view->first_source()); - while ((source != NULL) && (source->space() != space)) + while ((source != nullptr) && (source->space() != space)) source = downcast<debug_view_memory_source *>(source->next()); - if (source != NULL) + if (source != nullptr) { if (view->source() != source) { @@ -275,7 +275,7 @@ - (void)insertSubviewItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index { - for (const debug_view_source *source = view->source_list().first(); source != NULL; source = source->next()) + for (const debug_view_source *source = view->source_list().first(); source != nullptr; source = source->next()) { [[menu insertItemWithTitle:[NSString stringWithUTF8String:source->name()] action:NULL diff --git a/src/osd/modules/debugger/osx/registersview.mm b/src/osd/modules/debugger/osx/registersview.mm index 7e6cfd2dd7a..c1e7dc8dce6 100644 --- a/src/osd/modules/debugger/osx/registersview.mm +++ b/src/osd/modules/debugger/osx/registersview.mm @@ -32,7 +32,7 @@ const debug_view_source *source = view->source_for_device(curcpu); max.x = max.y = 0; - for (const debug_view_source *source = view->source_list().first(); source != NULL; source = source->next()) + for (const debug_view_source *source = view->source_list().first(); source != nullptr; source = source->next()) { debug_view_xy current; view->set_source(*source); diff --git a/src/osd/modules/debugger/qt/breakpointswindow.cpp b/src/osd/modules/debugger/qt/breakpointswindow.cpp index 7b30459c8e9..3875d594391 100644 --- a/src/osd/modules/debugger/qt/breakpointswindow.cpp +++ b/src/osd/modules/debugger/qt/breakpointswindow.cpp @@ -15,11 +15,11 @@ BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent) : - WindowQt(machine, NULL) + WindowQt(machine, nullptr) { setWindowTitle("Debug: All Breakpoints"); - if (parent != NULL) + if (parent != nullptr) { QPoint parentPos = parent->pos(); setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400); @@ -75,7 +75,7 @@ void BreakpointsWindow::typeChanged(QAction* changedTo) { // Clean delete m_breakpointsView; - m_breakpointsView = NULL; + m_breakpointsView = nullptr; // Create if (changedTo->text() == "Breakpoints") diff --git a/src/osd/modules/debugger/qt/breakpointswindow.h b/src/osd/modules/debugger/qt/breakpointswindow.h index 6c4335e334c..a45781ea5ce 100644 --- a/src/osd/modules/debugger/qt/breakpointswindow.h +++ b/src/osd/modules/debugger/qt/breakpointswindow.h @@ -15,7 +15,7 @@ class BreakpointsWindow : public WindowQt Q_OBJECT public: - BreakpointsWindow(running_machine* machine, QWidget* parent=NULL); + BreakpointsWindow(running_machine* machine, QWidget* parent=nullptr); virtual ~BreakpointsWindow(); diff --git a/src/osd/modules/debugger/qt/dasmwindow.cpp b/src/osd/modules/debugger/qt/dasmwindow.cpp index 3a430f67a84..3cd1dca65ac 100644 --- a/src/osd/modules/debugger/qt/dasmwindow.cpp +++ b/src/osd/modules/debugger/qt/dasmwindow.cpp @@ -14,11 +14,11 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : - WindowQt(machine, NULL) + WindowQt(machine, nullptr) { setWindowTitle("Debug: Disassembly View"); - if (parent != NULL) + if (parent != nullptr) { QPoint parentPos = parent->pos(); setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400); @@ -144,7 +144,7 @@ void DasmWindow::toggleBreakpointAtCursor(bool changedTo) // Find an existing breakpoint at this address INT32 bpindex = -1; for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); - bp != NULL; + bp != nullptr; bp = bp->next()) { if (address == bp->address()) @@ -157,7 +157,7 @@ void DasmWindow::toggleBreakpointAtCursor(bool changedTo) // If none exists, add a new one if (bpindex == -1) { - bpindex = cpuinfo->breakpoint_set(address, NULL, NULL); + bpindex = cpuinfo->breakpoint_set(address, nullptr, nullptr); debug_console_printf(*m_machine, "Breakpoint %X set\n", bpindex); } else @@ -183,10 +183,10 @@ void DasmWindow::enableBreakpointAtCursor(bool changedTo) // Find an existing breakpoint at this address device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); - while ((bp != NULL) && (bp->address() != address)) + while ((bp != nullptr) && (bp->address() != address)) bp = bp->next(); - if (bp != NULL) + if (bp != nullptr) { cpuinfo->breakpoint_enable(bp->index(), !bp->enabled()); debug_console_printf(*m_machine, "Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled"); @@ -241,10 +241,10 @@ void DasmWindow::dasmViewUpdated() // Find an existing breakpoint at this address device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); - while ((bp != NULL) && (bp->address() != address)) + while ((bp != nullptr) && (bp->address() != address)) bp = bp->next(); - if (bp != NULL) + if (bp != nullptr) { haveBreakpoint = true; breakpointEnabled = bp->enabled(); @@ -261,7 +261,7 @@ void DasmWindow::dasmViewUpdated() void DasmWindow::populateComboBox() { - if (m_dasmView == NULL) + if (m_dasmView == nullptr) return; m_cpuComboBox->clear(); diff --git a/src/osd/modules/debugger/qt/dasmwindow.h b/src/osd/modules/debugger/qt/dasmwindow.h index 44368c4e11f..021c72fd2fd 100644 --- a/src/osd/modules/debugger/qt/dasmwindow.h +++ b/src/osd/modules/debugger/qt/dasmwindow.h @@ -18,7 +18,7 @@ class DasmWindow : public WindowQt Q_OBJECT public: - DasmWindow(running_machine* machine, QWidget* parent=NULL); + DasmWindow(running_machine* machine, QWidget* parent=nullptr); virtual ~DasmWindow(); diff --git a/src/osd/modules/debugger/qt/debuggerview.cpp b/src/osd/modules/debugger/qt/debuggerview.cpp index 319ee370392..f1d66abee42 100644 --- a/src/osd/modules/debugger/qt/debuggerview.cpp +++ b/src/osd/modules/debugger/qt/debuggerview.cpp @@ -15,7 +15,7 @@ DebuggerView::DebuggerView(const debug_view_type& type, QWidget* parent) : QAbstractScrollArea(parent), m_preferBottom(false), - m_view(NULL), + m_view(nullptr), m_machine(machine) { // I like setting the font per-view since it doesn't override the menuing fonts. @@ -163,7 +163,7 @@ void DebuggerView::paintEvent(QPaintEvent* event) void DebuggerView::keyPressEvent(QKeyEvent* event) { - if (m_view == NULL) + if (m_view == nullptr) return QWidget::keyPressEvent(event); Qt::KeyboardModifiers keyMods = QApplication::keyboardModifiers(); @@ -233,7 +233,7 @@ void DebuggerView::keyPressEvent(QKeyEvent* event) void DebuggerView::mousePressEvent(QMouseEvent* event) { - if (m_view == NULL) + if (m_view == nullptr) return; if (event->button() == Qt::LeftButton) diff --git a/src/osd/modules/debugger/qt/debuggerview.h b/src/osd/modules/debugger/qt/debuggerview.h index 7b1aed6fd2c..2e1f35eb306 100644 --- a/src/osd/modules/debugger/qt/debuggerview.h +++ b/src/osd/modules/debugger/qt/debuggerview.h @@ -15,7 +15,7 @@ class DebuggerView : public QAbstractScrollArea public: DebuggerView(const debug_view_type& type, running_machine* machine, - QWidget* parent=NULL); + QWidget* parent=nullptr); virtual ~DebuggerView(); void paintEvent(QPaintEvent* event); diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.cpp b/src/osd/modules/debugger/qt/deviceinformationwindow.cpp index 12a286ff2b6..acdddc13fbb 100644 --- a/src/osd/modules/debugger/qt/deviceinformationwindow.cpp +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.cpp @@ -8,11 +8,11 @@ DeviceInformationWindow::DeviceInformationWindow(running_machine* machine, device_t* device, QWidget* parent) : - WindowQt(machine, NULL) + WindowQt(machine, nullptr) { m_device = device; - if (parent != NULL) + if (parent != nullptr) { QPoint parentPos = parent->pos(); setGeometry(parentPos.x()+100, parentPos.y()+100, 600, 400); diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.h b/src/osd/modules/debugger/qt/deviceinformationwindow.h index b0d9898488a..c7a4c05204d 100644 --- a/src/osd/modules/debugger/qt/deviceinformationwindow.h +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.h @@ -13,7 +13,7 @@ class DeviceInformationWindow : public WindowQt Q_OBJECT public: - DeviceInformationWindow(running_machine* machine, device_t* device = NULL, QWidget* parent=NULL); + DeviceInformationWindow(running_machine* machine, device_t* device = nullptr, QWidget* parent=nullptr); virtual ~DeviceInformationWindow(); void set_device(const char *tag); diff --git a/src/osd/modules/debugger/qt/deviceswindow.cpp b/src/osd/modules/debugger/qt/deviceswindow.cpp index a4d4d74fc3b..18845f15074 100644 --- a/src/osd/modules/debugger/qt/deviceswindow.cpp +++ b/src/osd/modules/debugger/qt/deviceswindow.cpp @@ -46,7 +46,7 @@ QModelIndex DevicesWindowModel::index(int row, int column, const QModelIndex &pa if(!hasIndex(row, column, parent)) return QModelIndex(); - device_t *target = NULL; + device_t *target = nullptr; if(!parent.isValid()) { if(row == 0) @@ -102,14 +102,14 @@ int DevicesWindowModel::columnCount(const QModelIndex &parent) const DevicesWindow::DevicesWindow(running_machine* machine, QWidget* parent) : - WindowQt(machine, NULL), + WindowQt(machine, nullptr), m_devices_model(machine) { - m_selected_device = NULL; + m_selected_device = nullptr; setWindowTitle("Debug: All Devices"); - if (parent != NULL) + if (parent != nullptr) { QPoint parentPos = parent->pos(); setGeometry(parentPos.x()+100, parentPos.y()+100, 600, 400); diff --git a/src/osd/modules/debugger/qt/deviceswindow.h b/src/osd/modules/debugger/qt/deviceswindow.h index 13965b9dce5..3064354fd2e 100644 --- a/src/osd/modules/debugger/qt/deviceswindow.h +++ b/src/osd/modules/debugger/qt/deviceswindow.h @@ -42,7 +42,7 @@ class DevicesWindow : public WindowQt Q_OBJECT public: - DevicesWindow(running_machine* machine, QWidget* parent=NULL); + DevicesWindow(running_machine* machine, QWidget* parent=nullptr); virtual ~DevicesWindow(); public slots: diff --git a/src/osd/modules/debugger/qt/logwindow.cpp b/src/osd/modules/debugger/qt/logwindow.cpp index b6e704cd5c6..704a029e5ac 100644 --- a/src/osd/modules/debugger/qt/logwindow.cpp +++ b/src/osd/modules/debugger/qt/logwindow.cpp @@ -10,11 +10,11 @@ LogWindow::LogWindow(running_machine* machine, QWidget* parent) : - WindowQt(machine, NULL) + WindowQt(machine, nullptr) { setWindowTitle("Debug: Machine Log"); - if (parent != NULL) + if (parent != nullptr) { QPoint parentPos = parent->pos(); setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400); diff --git a/src/osd/modules/debugger/qt/logwindow.h b/src/osd/modules/debugger/qt/logwindow.h index a406cfb8eb3..1c3b18d38bb 100644 --- a/src/osd/modules/debugger/qt/logwindow.h +++ b/src/osd/modules/debugger/qt/logwindow.h @@ -15,7 +15,7 @@ class LogWindow : public WindowQt Q_OBJECT public: - LogWindow(running_machine* machine, QWidget* parent=NULL); + LogWindow(running_machine* machine, QWidget* parent=nullptr); virtual ~LogWindow(); diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp index aeca1d20b63..e366ba77247 100644 --- a/src/osd/modules/debugger/qt/mainwindow.cpp +++ b/src/osd/modules/debugger/qt/mainwindow.cpp @@ -16,7 +16,7 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : - WindowQt(machine, NULL), + WindowQt(machine, nullptr), m_historyIndex(0), m_inputHistory() { @@ -92,7 +92,7 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : // Images menu // image_interface_iterator imageIterTest(m_machine->root_device()); - if (imageIterTest.first() != NULL) + if (imageIterTest.first() != nullptr) { createImagesMenu(); } @@ -163,7 +163,7 @@ void MainWindow::closeEvent(QCloseEvent* event) bool MainWindow::eventFilter(QObject* obj, QEvent* event) { // Only filter keypresses - QKeyEvent* keyEvent = NULL; + QKeyEvent* keyEvent = nullptr; if (event->type() == QEvent::KeyPress) { keyEvent = static_cast<QKeyEvent*>(event); @@ -221,7 +221,7 @@ void MainWindow::toggleBreakpointAtCursor(bool changedTo) // Find an existing breakpoint at this address INT32 bpindex = -1; for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); - bp != NULL; + bp != nullptr; bp = bp->next()) { if (address == bp->address()) @@ -258,10 +258,10 @@ void MainWindow::enableBreakpointAtCursor(bool changedTo) // Find an existing breakpoint at this address device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); - while ((bp != NULL) && (bp->address() != address)) + while ((bp != nullptr) && (bp->address() != address)) bp = bp->next(); - if (bp != NULL) + if (bp != nullptr) { INT32 const bpindex = bp->index(); std::string command = string_format(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", bpindex); @@ -346,7 +346,7 @@ void MainWindow::mountImage(bool changedTo) const int imageIndex = dynamic_cast<QAction*>(sender())->data().toInt(); image_interface_iterator iter(m_machine->root_device()); device_image_interface *img = iter.byindex(imageIndex); - if (img == NULL) + if (img == nullptr) { debug_console_printf(*m_machine, "Something is wrong with the mount menu.\n"); refreshAll(); @@ -420,10 +420,10 @@ void MainWindow::dasmViewUpdated() // Find an existing breakpoint at this address device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); - while ((bp != NULL) && (bp->address() != address)) + while ((bp != nullptr) && (bp->address() != address)) bp = bp->next(); - if (bp != NULL) + if (bp != nullptr) { haveBreakpoint = true; breakpointEnabled = bp->enabled(); diff --git a/src/osd/modules/debugger/qt/mainwindow.h b/src/osd/modules/debugger/qt/mainwindow.h index 4a93608772f..2c8e7feee67 100644 --- a/src/osd/modules/debugger/qt/mainwindow.h +++ b/src/osd/modules/debugger/qt/mainwindow.h @@ -26,7 +26,7 @@ class MainWindow : public WindowQt Q_OBJECT public: - MainWindow(running_machine* machine, QWidget* parent=NULL); + MainWindow(running_machine* machine, QWidget* parent=nullptr); virtual ~MainWindow(); void setProcessor(device_t* processor); @@ -87,7 +87,7 @@ class DasmDockWidget : public QWidget Q_OBJECT public: - DasmDockWidget(running_machine* machine, QWidget* parent=NULL) : + DasmDockWidget(running_machine* machine, QWidget* parent=nullptr) : QWidget(parent), m_machine(machine) { @@ -138,9 +138,9 @@ class ProcessorDockWidget : public QWidget public: ProcessorDockWidget(running_machine* machine, - QWidget* parent=NULL) : + QWidget* parent=nullptr) : QWidget(parent), - m_processorView(NULL), + m_processorView(nullptr), m_machine(machine) { m_processorView = new DebuggerView(DVT_STATE, diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp index 7b86740fe51..9d10dbb5024 100644 --- a/src/osd/modules/debugger/qt/memorywindow.cpp +++ b/src/osd/modules/debugger/qt/memorywindow.cpp @@ -19,11 +19,11 @@ MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) : - WindowQt(machine, NULL) + WindowQt(machine, nullptr) { setWindowTitle("Debug: Memory View"); - if (parent != NULL) + if (parent != nullptr) { QPoint parentPos = parent->pos(); setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400); @@ -278,7 +278,7 @@ void MemoryWindow::decreaseBytesPerLine(bool checked) void MemoryWindow::populateComboBox() { - if (m_memTable == NULL) + if (m_memTable == nullptr) return; m_memoryComboBox->clear(); @@ -312,7 +312,7 @@ QAction* MemoryWindow::dataFormatMenuItem(const QString& itemName) return actions[j]; } } - return NULL; + return nullptr; } @@ -357,7 +357,7 @@ void DebuggerMemView::mousePressEvent(QMouseEvent* event) { // TODO: You can specify a box that the tooltip stays alive within - might be good? const QString addressAndPc = QString("Address %1 written at PC=%2").arg(address, 2, 16).arg(pc, 2, 16); - QToolTip::showText(QCursor::pos(), addressAndPc, NULL); + QToolTip::showText(QCursor::pos(), addressAndPc, nullptr); // Copy the PC into the clipboard as well QClipboard *clipboard = QApplication::clipboard(); @@ -365,7 +365,7 @@ void DebuggerMemView::mousePressEvent(QMouseEvent* event) } else { - QToolTip::showText(QCursor::pos(), "UNKNOWN PC", NULL); + QToolTip::showText(QCursor::pos(), "UNKNOWN PC", nullptr); } } diff --git a/src/osd/modules/debugger/qt/memorywindow.h b/src/osd/modules/debugger/qt/memorywindow.h index d5fb74f677a..7663787e890 100644 --- a/src/osd/modules/debugger/qt/memorywindow.h +++ b/src/osd/modules/debugger/qt/memorywindow.h @@ -20,7 +20,7 @@ class MemoryWindow : public WindowQt Q_OBJECT public: - MemoryWindow(running_machine* machine, QWidget* parent=NULL); + MemoryWindow(running_machine* machine, QWidget* parent=nullptr); virtual ~MemoryWindow(); @@ -56,7 +56,7 @@ class DebuggerMemView : public DebuggerView public: DebuggerMemView(const debug_view_type& type, running_machine* machine, - QWidget* parent=NULL) + QWidget* parent=nullptr) : DebuggerView(type, machine, parent) {} virtual ~DebuggerMemView() {} diff --git a/src/osd/modules/debugger/qt/windowqt.cpp b/src/osd/modules/debugger/qt/windowqt.cpp index adaf96ab2e1..a18fd9885b6 100644 --- a/src/osd/modules/debugger/qt/windowqt.cpp +++ b/src/osd/modules/debugger/qt/windowqt.cpp @@ -15,7 +15,7 @@ bool WindowQt::s_hideAll = false; // Since all debug windows are intended to be top-level, this inherited -// constructor is always called with a NULL parent. The passed-in parent widget, +// constructor is always called with a nullptr parent. The passed-in parent widget, // however, is often used to place each child window & the code to do this can // be found in most of the inherited classes. diff --git a/src/osd/modules/debugger/qt/windowqt.h b/src/osd/modules/debugger/qt/windowqt.h index e2e334792b2..881d5716db1 100644 --- a/src/osd/modules/debugger/qt/windowqt.h +++ b/src/osd/modules/debugger/qt/windowqt.h @@ -18,7 +18,7 @@ class WindowQt : public QMainWindow Q_OBJECT public: - WindowQt(running_machine* machine, QWidget* parent=NULL); + WindowQt(running_machine* machine, QWidget* parent=nullptr); virtual ~WindowQt(); // The interface to an all-window refresh diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp index cdd84efeb47..89c3061c688 100644 --- a/src/osd/modules/debugger/win/consolewininfo.cpp +++ b/src/osd/modules/debugger/win/consolewininfo.cpp @@ -20,10 +20,10 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) : - disasmbasewin_info(debugger, true, "Debug", NULL), - m_devices_menu(NULL) + disasmbasewin_info(debugger, true, "Debug", nullptr), + m_devices_menu(nullptr) { - if ((window() == NULL) || (m_views[0] == NULL)) + if ((window() == nullptr) || (m_views[0] == nullptr)) goto cleanup; // create the views @@ -43,7 +43,7 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) : for (device_image_interface &img : iter) { TCHAR *tc_buf = tstring_from_utf8(string_format("%s : %s", img.device().name(), img.exists() ? img.filename() : "[no image]").c_str()); - if (tc_buf != NULL) + if (tc_buf != nullptr) { AppendMenu(m_devices_menu, MF_ENABLED, 0, tc_buf); osd_free(tc_buf); @@ -159,7 +159,7 @@ void consolewin_info::update_menu() { disasmbasewin_info::update_menu(); - if (m_devices_menu != NULL) + if (m_devices_menu != nullptr) { // create the image menu UINT32 cnt = 0; @@ -186,7 +186,7 @@ void consolewin_info::update_menu() if (img.device().type() == CASSETTE) { cassette_state const state = (cassette_state)(img.exists() ? (downcast<cassette_image_device *>(&img.device())->get_state() & CASSETTE_MASK_UISTATE) : CASSETTE_STOPPED); - AppendMenu(devicesubmenu, MF_SEPARATOR, 0, NULL); + AppendMenu(devicesubmenu, MF_SEPARATOR, 0, nullptr); AppendMenu(devicesubmenu, flags_for_exists | ((state == CASSETTE_STOPPED) ? MF_CHECKED : 0), new_item + DEVOPTION_CASSETTE_STOPPAUSE, TEXT("Pause/Stop")); AppendMenu(devicesubmenu, flags_for_exists | ((state == CASSETTE_PLAY) ? MF_CHECKED : 0), new_item + DEVOPTION_CASSETTE_PLAY, TEXT("Play")); AppendMenu(devicesubmenu, flags_for_writing | ((state == CASSETTE_RECORD) ? MF_CHECKED : 0), new_item + DEVOPTION_CASSETTE_RECORD, TEXT("Record")); @@ -195,7 +195,7 @@ void consolewin_info::update_menu() } TCHAR *tc_buf = tstring_from_utf8(string_format("%s :%s", img.device().name(), img.exists() ? img.filename() : "[empty slot]").c_str()); - if (tc_buf != NULL) + if (tc_buf != nullptr) { ModifyMenu(m_devices_menu, cnt, MF_BYPOSITION | MF_POPUP, (UINT_PTR)devicesubmenu, tc_buf); osd_free(tc_buf); @@ -214,7 +214,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam) UINT32 const devid = (LOWORD(wparam) - ID_DEVICE_OPTIONS) / DEVOPTION_MAX; image_interface_iterator iter(machine().root_device()); device_image_interface *const img = iter.byindex(devid); - if (img != NULL) + if (img != nullptr) { switch ((LOWORD(wparam) - ID_DEVICE_OPTIONS) % DEVOPTION_MAX) { @@ -237,21 +237,21 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam) OPENFILENAME ofn; memset(&ofn, 0, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = NULL; + ofn.hwndOwner = nullptr; ofn.lpstrFile = selectedFilename; ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = MAX_PATH; ofn.lpstrFilter = t_filter; ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; + ofn.lpstrFileTitle = nullptr; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; + ofn.lpstrInitialDir = nullptr; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if (GetOpenFileName(&ofn)) { char *utf8_buf = utf8_from_tstring(selectedFilename); - if (utf8_buf != NULL) + if (utf8_buf != nullptr) { img->load(utf8_buf); osd_free(utf8_buf); diff --git a/src/osd/modules/debugger/win/debugviewinfo.cpp b/src/osd/modules/debugger/win/debugviewinfo.cpp index 3f355cf8a34..01a300f0733 100644 --- a/src/osd/modules/debugger/win/debugviewinfo.cpp +++ b/src/osd/modules/debugger/win/debugviewinfo.cpp @@ -41,53 +41,53 @@ bool debugview_info::s_window_class_registered = false; debugview_info::debugview_info(debugger_windows_interface &debugger, debugwin_info &owner, HWND parent, debug_view_type type) : debugbase_info(debugger), m_owner(owner), - m_view(NULL), - m_wnd(NULL), - m_hscroll(NULL), - m_vscroll(NULL) + m_view(nullptr), + m_wnd(nullptr), + m_hscroll(nullptr), + m_vscroll(nullptr) { register_window_class(); // create the child view - m_wnd = CreateWindowEx(DEBUG_VIEW_STYLE_EX, TEXT("MAMEDebugView"), NULL, DEBUG_VIEW_STYLE, - 0, 0, 100, 100, parent, NULL, GetModuleHandleUni(), this); - if (m_wnd == NULL) + m_wnd = CreateWindowEx(DEBUG_VIEW_STYLE_EX, TEXT("MAMEDebugView"), nullptr, DEBUG_VIEW_STYLE, + 0, 0, 100, 100, parent, nullptr, GetModuleHandleUni(), this); + if (m_wnd == nullptr) goto cleanup; // create the scroll bars - m_hscroll = CreateWindowEx(HSCROLL_STYLE_EX, TEXT("SCROLLBAR"), NULL, HSCROLL_STYLE, - 0, 0, 100, CW_USEDEFAULT, m_wnd, NULL, GetModuleHandleUni(), this); - m_vscroll = CreateWindowEx(VSCROLL_STYLE_EX, TEXT("SCROLLBAR"), NULL, VSCROLL_STYLE, - 0, 0, CW_USEDEFAULT, 100, m_wnd, NULL, GetModuleHandleUni(), this); - if ((m_hscroll == NULL) || (m_vscroll == NULL)) + m_hscroll = CreateWindowEx(HSCROLL_STYLE_EX, TEXT("SCROLLBAR"), nullptr, HSCROLL_STYLE, + 0, 0, 100, CW_USEDEFAULT, m_wnd, nullptr, GetModuleHandleUni(), this); + m_vscroll = CreateWindowEx(VSCROLL_STYLE_EX, TEXT("SCROLLBAR"), nullptr, VSCROLL_STYLE, + 0, 0, CW_USEDEFAULT, 100, m_wnd, nullptr, GetModuleHandleUni(), this); + if ((m_hscroll == nullptr) || (m_vscroll == nullptr)) goto cleanup; // create the debug view m_view = machine().debug_view().alloc_view(type, &debugview_info::static_update, this); - if (m_view == NULL) + if (m_view == nullptr) goto cleanup; return; cleanup: - if (m_hscroll != NULL) + if (m_hscroll != nullptr) DestroyWindow(m_hscroll); - m_hscroll = NULL; - if (m_vscroll != NULL) + m_hscroll = nullptr; + if (m_vscroll != nullptr) DestroyWindow(m_vscroll); - m_vscroll = NULL; - if (m_wnd != NULL) + m_vscroll = nullptr; + if (m_wnd != nullptr) DestroyWindow(m_wnd); - m_wnd = NULL; - if (m_view != NULL) + m_wnd = nullptr; + if (m_view != nullptr) machine().debug_view().free_view(*m_view); - m_view = NULL; + m_view = nullptr; } debugview_info::~debugview_info() { - if (m_wnd != NULL) + if (m_wnd != nullptr) DestroyWindow(m_wnd); if (m_view) machine().debug_view().free_view(*m_view); @@ -117,7 +117,7 @@ UINT32 debugview_info::maxwidth() if (max < chars) max = chars; } - if (cursource != NULL) + if (cursource != nullptr) m_view->set_source(*cursource); return (max * metrics().debug_font_width()) + metrics().vscroll_width(); } @@ -179,10 +179,10 @@ void debugview_info::send_pagedown() char const *debugview_info::source_name() const { - if (m_view != NULL) + if (m_view != nullptr) { debug_view_source const *const source = m_view->source(); - if (source != NULL) + if (source != nullptr) return source->name(); } return ""; @@ -191,22 +191,22 @@ char const *debugview_info::source_name() const device_t *debugview_info::source_device() const { - if (m_view != NULL) + if (m_view != nullptr) { debug_view_source const *const source = m_view->source(); - if (source != NULL) + if (source != nullptr) return source->device(); } - return NULL; + return nullptr; } bool debugview_info::source_is_visible_cpu() const { - if (m_view != NULL) + if (m_view != nullptr) { const debug_view_source *const source = m_view->source(); - return (source != NULL) && (debug_cpu_get_visible_cpu(machine()) == source->device()); + return (source != nullptr) && (debug_cpu_get_visible_cpu(machine()) == source->device()); } return false; } @@ -214,10 +214,10 @@ bool debugview_info::source_is_visible_cpu() const bool debugview_info::set_source_index(int index) { - if (m_view != NULL) + if (m_view != nullptr) { const debug_view_source *const source = m_view->source_list().find(index); - if (source != NULL) + if (source != nullptr) { m_view->set_source(*source); return true; @@ -229,10 +229,10 @@ bool debugview_info::set_source_index(int index) bool debugview_info::set_source_for_device(device_t &device) { - if (m_view != NULL) + if (m_view != nullptr) { const debug_view_source *const source = m_view->source_for_device(&device); - if (source != NULL) + if (source != nullptr) { m_view->set_source(*source); return true; @@ -245,7 +245,7 @@ bool debugview_info::set_source_for_device(device_t &device) bool debugview_info::set_source_for_visible_cpu() { device_t *const curcpu = debug_cpu_get_visible_cpu(machine()); - if (curcpu != NULL) + if (curcpu != nullptr) return set_source_for_device(*curcpu); else return false; @@ -255,15 +255,15 @@ bool debugview_info::set_source_for_visible_cpu() HWND debugview_info::create_source_combobox(HWND parent, LONG_PTR userdata) { // create a combo box - HWND const result = CreateWindowEx(COMBO_BOX_STYLE_EX, TEXT("COMBOBOX"), NULL, COMBO_BOX_STYLE, - 0, 0, 100, 1000, parent, NULL, GetModuleHandleUni(), NULL); + HWND const result = CreateWindowEx(COMBO_BOX_STYLE_EX, TEXT("COMBOBOX"), nullptr, COMBO_BOX_STYLE, + 0, 0, 100, 1000, parent, nullptr, GetModuleHandleUni(), nullptr); SetWindowLongPtr(result, GWLP_USERDATA, userdata); SendMessage(result, WM_SETFONT, (WPARAM)metrics().debug_font(), (LPARAM)FALSE); // populate the combobox debug_view_source const *const cursource = m_view->source(); int maxlength = 0; - for (debug_view_source const *source = m_view->first_source(); source != NULL; source = source->next()) + for (debug_view_source const *source = m_view->first_source(); source != nullptr; source = source->next()) { int const length = strlen(source->name()); if (length > maxlength) @@ -272,7 +272,7 @@ HWND debugview_info::create_source_combobox(HWND parent, LONG_PTR userdata) SendMessage(result, CB_ADDSTRING, 0, (LPARAM)t_name); osd_free(t_name); } - if (cursource != NULL) + if (cursource != nullptr) { SendMessage(result, CB_SETCURSEL, m_view->source_list().indexof(*cursource), 0); SendMessage(result, CB_SETDROPPEDWIDTH, ((maxlength + 2) * metrics().debug_font_width()) + metrics().vscroll_width(), 0); @@ -293,10 +293,10 @@ void debugview_info::draw_contents(HDC windc) // create a compatible DC and an offscreen bitmap HDC const dc = CreateCompatibleDC(windc); - if (dc == NULL) + if (dc == nullptr) return; HBITMAP const bitmap = CreateCompatibleBitmap(windc, client.right, client.bottom); - if (bitmap == NULL) + if (bitmap == nullptr) { DeleteDC(dc); return; @@ -317,7 +317,7 @@ void debugview_info::draw_contents(HDC windc) { COLORREF fgcolor; COLORREF bgcolor = RGB(0xff,0xff,0xff); - HBRUSH bgbrush = NULL; + HBRUSH bgbrush = nullptr; int last_attrib = -1; TCHAR buffer[256]; int count = 0; @@ -362,7 +362,7 @@ void debugview_info::draw_contents(HDC windc) if (iter == 0) FillRect(dc, &bounds, bgbrush); else - ExtTextOut(dc, bounds.left, bounds.top, 0, NULL, buffer, count, NULL); + ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, count, nullptr); bounds.left = bounds.right; count = 0; } @@ -389,7 +389,7 @@ void debugview_info::draw_contents(HDC windc) if (iter == 0) FillRect(dc, &bounds, bgbrush); else - ExtTextOut(dc, bounds.left, bounds.top, 0, NULL, buffer, count, NULL); + ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, count, nullptr); } // erase to the end of the line @@ -505,7 +505,7 @@ void debugview_info::update() m_view->set_visible_position(topleft); // invalidate the bounds - InvalidateRect(m_wnd, NULL, FALSE); + InvalidateRect(m_wnd, nullptr, FALSE); // adjust the bounds of the scrollbars and show/hide them if (m_vscroll) @@ -775,10 +775,10 @@ LRESULT CALLBACK debugview_info::static_view_proc(HWND wnd, UINT message, WPARAM } debugview_info *const info = (debugview_info *)(FPTR)GetWindowLongPtr(wnd, GWLP_USERDATA); - if (info == NULL) + if (info == nullptr) return DefWindowProc(wnd, message, wparam, lparam); - assert((info->m_wnd == wnd) || (info->m_wnd == NULL)); + assert((info->m_wnd == wnd) || (info->m_wnd == nullptr)); return info->view_proc(message, wparam, lparam); } @@ -793,10 +793,10 @@ void debugview_info::register_window_class() wc.lpszClassName = TEXT("MAMEDebugView"); wc.hInstance = GetModuleHandleUni(); wc.lpfnWndProc = &debugview_info::static_view_proc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(2)); - wc.lpszMenuName = NULL; - wc.hbrBackground = NULL; + wc.lpszMenuName = nullptr; + wc.hbrBackground = nullptr; wc.style = 0; wc.cbClsExtra = 0; wc.cbWndExtra = 0; diff --git a/src/osd/modules/debugger/win/debugviewinfo.h b/src/osd/modules/debugger/win/debugviewinfo.h index ec4eedf2e69..f3ef5f2cfe6 100644 --- a/src/osd/modules/debugger/win/debugviewinfo.h +++ b/src/osd/modules/debugger/win/debugviewinfo.h @@ -35,7 +35,7 @@ public: void send_vscroll(int delta); void send_pageup(); void send_pagedown(); - void set_focus() { SetFocus(m_wnd); } + void set_focus() const { SetFocus(m_wnd); } debug_view_type type() const { return m_view->type(); } debug_view_xy total_size() const { return m_view->total_size(); } diff --git a/src/osd/modules/debugger/win/debugwininfo.cpp b/src/osd/modules/debugger/win/debugwininfo.cpp index 1e75b464b72..d46b5a1d79c 100644 --- a/src/osd/modules/debugger/win/debugwininfo.cpp +++ b/src/osd/modules/debugger/win/debugwininfo.cpp @@ -23,8 +23,8 @@ bool debugwin_info::s_window_class_registered = false; debugwin_info::debugwin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler) : debugbase_info(debugger), m_is_main_console(is_main_console), - m_next(NULL), - m_wnd(NULL), + m_next(nullptr), + m_wnd(nullptr), m_handler(handler), m_minwidth(200), m_maxwidth(0), @@ -36,7 +36,7 @@ debugwin_info::debugwin_info(debugger_windows_interface &debugger, bool is_main_ m_wnd = win_create_window_ex_utf8(DEBUG_WINDOW_STYLE_EX, "MAMEDebugWindow", title, DEBUG_WINDOW_STYLE, 0, 0, 100, 100, win_window_list.front()->platform_window<HWND>(), create_standard_menubar(), GetModuleHandleUni(), this); - if (m_wnd == NULL) + if (m_wnd == nullptr) return; RECT work_bounds; @@ -70,7 +70,7 @@ void debugwin_info::prev_view(debugview_info *curview) int numviews; for (numviews = 0; numviews < MAX_VIEWS; numviews++) { - if (m_views[numviews] == NULL) + if (m_views[numviews] == nullptr) break; } @@ -100,7 +100,7 @@ void debugwin_info::prev_view(debugview_info *curview) // negative numbers mean the focuswnd break; } - else if (curindex >= 0 && m_views[curindex] != NULL && m_views[curindex]->cursor_supported()) + else if (curindex >= 0 && m_views[curindex] != nullptr && m_views[curindex]->cursor_supported()) { // positive numbers mean a view m_views[curindex]->set_focus(); @@ -116,7 +116,7 @@ void debugwin_info::next_view(debugview_info *curview) int numviews; for (numviews = 0; numviews < MAX_VIEWS; numviews++) { - if (m_views[numviews] == NULL) + if (m_views[numviews] == nullptr) break; } @@ -144,7 +144,7 @@ void debugwin_info::next_view(debugview_info *curview) // negative numbers mean the focuswnd break; } - else if (curindex >= 0 && m_views[curindex] != NULL && m_views[curindex]->cursor_supported()) + else if (curindex >= 0 && m_views[curindex] != nullptr && m_views[curindex]->cursor_supported()) { // positive numbers mean a view m_views[curindex]->set_focus(); @@ -248,7 +248,7 @@ bool debugwin_info::handle_key(WPARAM wparam, LPARAM lparam) void debugwin_info::recompute_children() { - if (m_views[0] != NULL) + if (m_views[0] != nullptr) { // compute a client rect RECT bounds; @@ -352,7 +352,7 @@ void debugwin_info::draw_contents(HDC dc) // draw edges around all views for (int curview = 0; curview < MAX_VIEWS; curview++) { - if (m_views[curview] != NULL) + if (m_views[curview] != nullptr) { RECT bounds; m_views[curview]->get_bounds(bounds); @@ -430,7 +430,7 @@ LRESULT debugwin_info::window_proc(UINT message, WPARAM wparam, LPARAM lparam) case WM_SIZE: case WM_SIZING: recompute_children(); - InvalidateRect(m_wnd, NULL, FALSE); + InvalidateRect(m_wnd, nullptr, FALSE); break; // mouse wheel: forward to the first view @@ -458,7 +458,7 @@ LRESULT debugwin_info::window_proc(UINT message, WPARAM wparam, LPARAM lparam) { for (viewnum = 0; viewnum < MAX_VIEWS; viewnum++) { - if ((m_views[viewnum] != NULL) && m_views[viewnum]->owns_window(child)) + if ((m_views[viewnum] != nullptr) && m_views[viewnum]->owns_window(child)) break; } if (viewnum == MAX_VIEWS) @@ -466,7 +466,7 @@ LRESULT debugwin_info::window_proc(UINT message, WPARAM wparam, LPARAM lparam) } // send the appropriate message to this view's scrollbar - if (m_views[viewnum] != NULL) + if (m_views[viewnum] != nullptr) m_views[viewnum]->send_vscroll(delta); break; @@ -498,7 +498,7 @@ LRESULT debugwin_info::window_proc(UINT message, WPARAM wparam, LPARAM lparam) // destroy: close down the window case WM_NCDESTROY: - m_wnd = NULL; + m_wnd = nullptr; debugger().remove_window(*this); break; @@ -515,8 +515,8 @@ HMENU debugwin_info::create_standard_menubar() { // create the debug menu HMENU const debugmenu = CreatePopupMenu(); - if (debugmenu == NULL) - return NULL; + if (debugmenu == nullptr) + return nullptr; AppendMenu(debugmenu, MF_ENABLED, ID_NEW_MEMORY_WND, TEXT("New Memory Window\tCtrl+M")); AppendMenu(debugmenu, MF_ENABLED, ID_NEW_DISASM_WND, TEXT("New Disassembly Window\tCtrl+D")); AppendMenu(debugmenu, MF_ENABLED, ID_NEW_LOG_WND, TEXT("New Error Log Window\tCtrl+L")); @@ -538,10 +538,10 @@ HMENU debugwin_info::create_standard_menubar() // create the menu bar HMENU const menubar = CreateMenu(); - if (menubar == NULL) + if (menubar == nullptr) { DestroyMenu(debugmenu); - return NULL; + return nullptr; } AppendMenu(menubar, MF_ENABLED | MF_POPUP, (UINT_PTR)debugmenu, TEXT("Debug")); @@ -563,10 +563,10 @@ LRESULT CALLBACK debugwin_info::static_window_proc(HWND wnd, UINT message, WPARA } debugwin_info *const info = (debugwin_info *)(FPTR)GetWindowLongPtr(wnd, GWLP_USERDATA); - if (info == NULL) + if (info == nullptr) return DefWindowProc(wnd, message, wparam, lparam); - assert((info->m_wnd == wnd) || (info->m_wnd == NULL)); + assert((info->m_wnd == wnd) || (info->m_wnd == nullptr)); return info->window_proc(message, wparam, lparam); } @@ -581,10 +581,10 @@ void debugwin_info::register_window_class() wc.lpszClassName = TEXT("MAMEDebugWindow"); wc.hInstance = GetModuleHandleUni(); wc.lpfnWndProc = &debugwin_info::static_window_proc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(2)); - wc.lpszMenuName = NULL; - wc.hbrBackground = NULL; + wc.lpszMenuName = nullptr; + wc.hbrBackground = nullptr; wc.style = 0; wc.cbClsExtra = 0; wc.cbWndExtra = 0; diff --git a/src/osd/modules/debugger/win/debugwininfo.h b/src/osd/modules/debugger/win/debugwininfo.h index c0825bcf8d1..4bab0e2a3a3 100644 --- a/src/osd/modules/debugger/win/debugwininfo.h +++ b/src/osd/modules/debugger/win/debugwininfo.h @@ -41,9 +41,9 @@ public: } } - void show() { smart_show_window(m_wnd, true); } - void hide() { smart_show_window(m_wnd, false); } - void set_foreground() { SetForegroundWindow(m_wnd); } + void show() const { smart_show_window(m_wnd, true); } + void hide() const { smart_show_window(m_wnd, false); } + void set_foreground() const { SetForegroundWindow(m_wnd); } void destroy(); virtual bool set_default_focus(); diff --git a/src/osd/modules/debugger/win/disasmwininfo.cpp b/src/osd/modules/debugger/win/disasmwininfo.cpp index ae7e3894458..eb6466e437d 100644 --- a/src/osd/modules/debugger/win/disasmwininfo.cpp +++ b/src/osd/modules/debugger/win/disasmwininfo.cpp @@ -15,10 +15,10 @@ disasmwin_info::disasmwin_info(debugger_windows_interface &debugger) : - disasmbasewin_info(debugger, false, "Disassembly", NULL), - m_combownd(NULL) + disasmbasewin_info(debugger, false, "Disassembly", nullptr), + m_combownd(nullptr) { - if ((window() == NULL) || (m_views[0] == NULL)) + if ((window() == nullptr) || (m_views[0] == nullptr)) return; // set up the view to track the initial expression diff --git a/src/osd/modules/debugger/win/editwininfo.cpp b/src/osd/modules/debugger/win/editwininfo.cpp index 279bc68fbe3..6bf98df4352 100644 --- a/src/osd/modules/debugger/win/editwininfo.cpp +++ b/src/osd/modules/debugger/win/editwininfo.cpp @@ -23,18 +23,18 @@ editwin_info::editwin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler) : debugwin_info(debugger, is_main_console, title, handler), - m_editwnd(NULL), + m_editwnd(nullptr), m_edit_defstr(), - m_original_editproc(NULL), + m_original_editproc(nullptr), m_history_count(0), m_last_history(0) { - if (window() == NULL) + if (window() == nullptr) return; // create an edit box and override its key handling - m_editwnd = CreateWindowEx(EDIT_BOX_STYLE_EX, TEXT("EDIT"), NULL, EDIT_BOX_STYLE, - 0, 0, 100, 100, window(), NULL, GetModuleHandleUni(), NULL); + m_editwnd = CreateWindowEx(EDIT_BOX_STYLE_EX, TEXT("EDIT"), nullptr, EDIT_BOX_STYLE, + 0, 0, 100, 100, window(), nullptr, GetModuleHandleUni(), nullptr); m_original_editproc = (WNDPROC)(FPTR)GetWindowLongPtr(m_editwnd, GWLP_WNDPROC); SetWindowLongPtr(m_editwnd, GWLP_USERDATA, (LONG_PTR)this); SetWindowLongPtr(m_editwnd, GWLP_WNDPROC, (LONG_PTR)&editwin_info::static_edit_proc); @@ -80,7 +80,7 @@ void editwin_info::set_editwnd_bounds(RECT const &bounds) void editwin_info::set_editwnd_text(char const *text) { TCHAR *tc_buffer = tstring_from_utf8(text); - if (tc_buffer != NULL) + if (tc_buffer != nullptr) { SendMessage(m_editwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)tc_buffer); osd_free(tc_buffer); @@ -138,20 +138,20 @@ LRESULT editwin_info::edit_proc(UINT message, WPARAM wparam, LPARAM lparam) break; case VK_PRIOR: - if (m_views[0] != NULL) + if (m_views[0] != nullptr) m_views[0]->send_pageup(); break; case VK_NEXT: - if (m_views[0] != NULL) + if (m_views[0] != nullptr) m_views[0]->send_pagedown(); break; case VK_TAB: if (GetAsyncKeyState(VK_SHIFT) & 0x8000) - prev_view(NULL); + prev_view(nullptr); else - next_view(NULL); + next_view(nullptr); set_ignore_char_lparam(lparam); break; @@ -191,7 +191,7 @@ LRESULT editwin_info::edit_proc(UINT message, WPARAM wparam, LPARAM lparam) // process char *utf8_buffer = utf8_from_tstring(buffer); - if (utf8_buffer != NULL) + if (utf8_buffer != nullptr) { process_string(utf8_buffer); osd_free(utf8_buffer); diff --git a/src/osd/modules/debugger/win/memoryviewinfo.h b/src/osd/modules/debugger/win/memoryviewinfo.h index 2245ace307d..a690df6d782 100644 --- a/src/osd/modules/debugger/win/memoryviewinfo.h +++ b/src/osd/modules/debugger/win/memoryviewinfo.h @@ -23,7 +23,6 @@ public: UINT8 data_format() const; UINT32 chunks_per_row() const; bool reverse() const; - bool ascii() const; bool physical() const; void set_expression(char const *string); diff --git a/src/osd/modules/debugger/win/memorywininfo.cpp b/src/osd/modules/debugger/win/memorywininfo.cpp index b6d2b83614b..5ff85a60e60 100644 --- a/src/osd/modules/debugger/win/memorywininfo.cpp +++ b/src/osd/modules/debugger/win/memorywininfo.cpp @@ -16,14 +16,14 @@ memorywin_info::memorywin_info(debugger_windows_interface &debugger) : - editwin_info(debugger, false, "Memory", NULL), - m_combownd(NULL) + editwin_info(debugger, false, "Memory", nullptr), + m_combownd(nullptr) { if (!window()) return; m_views[0].reset(global_alloc(memoryview_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; diff --git a/src/osd/modules/debugger/win/pointswininfo.cpp b/src/osd/modules/debugger/win/pointswininfo.cpp index 6dd56cc50cc..f055aa211f2 100644 --- a/src/osd/modules/debugger/win/pointswininfo.cpp +++ b/src/osd/modules/debugger/win/pointswininfo.cpp @@ -14,13 +14,13 @@ pointswin_info::pointswin_info(debugger_windows_interface &debugger) : - debugwin_info(debugger, false, std::string("All Breakpoints").c_str(), NULL) + debugwin_info(debugger, false, std::string("All Breakpoints").c_str(), nullptr) { if (!window()) return; m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_BREAK_POINTS))); - 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/debugger/win/uimetrics.cpp b/src/osd/modules/debugger/win/uimetrics.cpp index 7da41d6f79f..c2d165c6a94 100644 --- a/src/osd/modules/debugger/win/uimetrics.cpp +++ b/src/osd/modules/debugger/win/uimetrics.cpp @@ -20,8 +20,8 @@ ui_metrics::ui_metrics(osd_options const &options) : m_vscroll_width(GetSystemMetrics(SM_CXVSCROLL)) { // create a temporary DC - HDC const temp_dc = GetDC(NULL); - if (temp_dc != NULL) + HDC const temp_dc = GetDC(nullptr); + if (temp_dc != nullptr) { float const size = options.debugger_font_size(); char const *const face = options.debugger_font(); @@ -32,7 +32,7 @@ ui_metrics::ui_metrics(osd_options const &options) : ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, t_face); osd_free(t_face); - if (m_debug_font == NULL) + if (m_debug_font == nullptr) fatalerror("Unable to create debugger font\n"); // get the metrics @@ -45,13 +45,13 @@ ui_metrics::ui_metrics(osd_options const &options) : m_debug_font_ascent = metrics.tmAscent + metrics.tmExternalLeading; } SelectObject(temp_dc, old_font); - ReleaseDC(NULL, temp_dc); + ReleaseDC(nullptr, temp_dc); } } ui_metrics::ui_metrics(ui_metrics const &that) : - m_debug_font(NULL), + m_debug_font(nullptr), m_debug_font_height(that.m_debug_font_height), m_debug_font_width(that.m_debug_font_width), m_debug_font_ascent(that.m_debug_font_ascent), diff --git a/src/osd/modules/file/winfile.cpp b/src/osd/modules/file/winfile.cpp index 9695aac7363..9b6ecdc0535 100644 --- a/src/osd/modules/file/winfile.cpp +++ b/src/osd/modules/file/winfile.cpp @@ -65,7 +65,7 @@ public: // then perform the read DWORD result = 0; - if (!ReadFile(m_handle, buffer, length, &result, NULL)) + if (!ReadFile(m_handle, buffer, length, &result, nullptr)) return win_error_to_file_error(GetLastError()); actual = result; @@ -82,7 +82,7 @@ public: // then perform the write DWORD result = 0; - if (!WriteFile(m_handle, buffer, length, &result, NULL)) + if (!WriteFile(m_handle, buffer, length, &result, nullptr)) return win_error_to_file_error(GetLastError()); actual = result; @@ -157,7 +157,7 @@ DWORD create_path_recursive(TCHAR *path) WIN32_FILE_ATTRIBUTE_DATA fileinfo; if (GetFileAttributesEx(path, GetFileExInfoStandard, &fileinfo)) return NO_ERROR; - else if (!CreateDirectory(path, NULL)) + else if (!CreateDirectory(path, nullptr)) return GetLastError(); else return NO_ERROR; @@ -212,7 +212,7 @@ osd_file::error osd_file::open(std::string const &orig_path, UINT32 openflags, p } // attempt to open the file - HANDLE h = CreateFile(t_path, access, sharemode, NULL, disposition, 0, NULL); + HANDLE h = CreateFile(t_path, access, sharemode, nullptr, disposition, 0, nullptr); if (INVALID_HANDLE_VALUE == h) { DWORD err = GetLastError(); @@ -220,7 +220,7 @@ osd_file::error osd_file::open(std::string const &orig_path, UINT32 openflags, p if ((ERROR_PATH_NOT_FOUND == err) && (openflags & OPEN_FLAG_CREATE) && (openflags & OPEN_FLAG_CREATE_PATHS)) { TCHAR *pathsep = _tcsrchr(t_path, '\\'); - if (pathsep != NULL) + if (pathsep != nullptr) { // create the path up to the file *pathsep = 0; @@ -230,7 +230,7 @@ osd_file::error osd_file::open(std::string const &orig_path, UINT32 openflags, p // attempt to reopen the file if (err == NO_ERROR) { - h = CreateFile(t_path, access, sharemode, NULL, disposition, 0, NULL); + h = CreateFile(t_path, access, sharemode, nullptr, disposition, 0, nullptr); err = GetLastError(); } } @@ -318,15 +318,15 @@ int osd_get_physical_drive_geometry(const char *filename, UINT32 *cylinders, UIN // do a create file on the drive t_filename = tstring_from_utf8(filename); - if (t_filename == NULL) + if (t_filename == nullptr) return FALSE; - file = CreateFile(t_filename, GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL); + file = CreateFile(t_filename, GENERIC_READ, FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, nullptr); osd_free(t_filename); if (file == INVALID_HANDLE_VALUE) return FALSE; // device I/O control should return the geometry - result = DeviceIoControl(file, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &dg, sizeof(dg), &bytesRead, NULL); + result = DeviceIoControl(file, IOCTL_DISK_GET_DRIVE_GEOMETRY, nullptr, 0, &dg, sizeof(dg), &bytesRead, nullptr); CloseHandle(file); // if that failed, return false @@ -373,7 +373,7 @@ osd_directory_entry *osd_stat(const std::string &path) else { // attempt to find the first file - HANDLE find = FindFirstFileEx(t_path.get(), FindExInfoStandard, &find_data, FindExSearchNameMatch, NULL, 0); + HANDLE find = FindFirstFileEx(t_path.get(), FindExInfoStandard, &find_data, FindExSearchNameMatch, nullptr, 0); if (find == INVALID_HANDLE_VALUE) return nullptr; FindClose(find); @@ -407,7 +407,7 @@ osd_file::error osd_get_full_path(std::string &dst, std::string const &path) // cannonicalize the path TCHAR buffer[MAX_PATH]; - if (!GetFullPathName(t_path, ARRAY_LENGTH(buffer), buffer, NULL)) + if (!GetFullPathName(t_path, ARRAY_LENGTH(buffer), buffer, nullptr)) return win_error_to_file_error(GetLastError()); // convert the result back to UTF-8 @@ -430,7 +430,7 @@ bool osd_is_absolute_path(std::string const &path) { bool result = false; TCHAR *t_path = tstring_from_utf8(path.c_str()); - if (t_path != NULL) + if (t_path != nullptr) { result = !PathIsRelative(t_path); osd_free(t_path); @@ -454,7 +454,7 @@ const char *osd_get_volume_name(int idx) p = szBuffer; while(idx--) { p += strlen(p) + 1; - if (!*p) return NULL; + if (!*p) return nullptr; } return p; diff --git a/src/osd/modules/file/winptty.cpp b/src/osd/modules/file/winptty.cpp index 52e19491ea5..88920d69099 100644 --- a/src/osd/modules/file/winptty.cpp +++ b/src/osd/modules/file/winptty.cpp @@ -42,7 +42,7 @@ public: virtual error read(void *buffer, std::uint64_t offset, std::uint32_t count, std::uint32_t &actual) override { DWORD bytes_read; - if (!ReadFile(m_handle, buffer, count, &bytes_read, NULL)) + if (!ReadFile(m_handle, buffer, count, &bytes_read, nullptr)) return win_error_to_file_error(GetLastError()); actual = bytes_read; @@ -52,7 +52,7 @@ public: virtual error write(void const *buffer, std::uint64_t offset, std::uint32_t count, std::uint32_t &actual) override { DWORD bytes_written; - if (!WriteFile(m_handle, buffer, count, &bytes_written, NULL)) + if (!WriteFile(m_handle, buffer, count, &bytes_written, nullptr)) return win_error_to_file_error(GetLastError()); actual = bytes_written; @@ -91,7 +91,7 @@ osd_file::error win_open_ptty(std::string const &path, std::uint32_t openflags, if (!t_name) return osd_file::error::OUT_OF_MEMORY; - HANDLE pipe = CreateNamedPipe(t_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 32, 32, 0, NULL); + HANDLE pipe = CreateNamedPipe(t_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 32, 32, 0, nullptr); osd_free(t_name); if (INVALID_HANDLE_VALUE == pipe) diff --git a/src/osd/modules/font/font_dwrite.cpp b/src/osd/modules/font/font_dwrite.cpp index e3dfbfdbd85..670986f0cfc 100644 --- a/src/osd/modules/font/font_dwrite.cpp +++ b/src/osd/modules/font/font_dwrite.cpp @@ -109,7 +109,7 @@ void SaveBitmap(IWICBitmap* bitmap, GUID pixelFormat, const WCHAR *filename) reinterpret_cast<void**>(d2dfactory.GetAddressOf()))); // Initialize COM - ignore failure - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); // Create a DirectWrite factory. HR_RET(pfn_DWriteCreateFactory( @@ -119,7 +119,7 @@ void SaveBitmap(IWICBitmap* bitmap, GUID pixelFormat, const WCHAR *filename) HR_RET(CoCreateInstance( CLSID_WICImagingFactory, - NULL, + nullptr, CLSCTX_INPROC_SERVER, __uuidof(IWICImagingFactory), (void**)&wicFactory)); @@ -128,19 +128,19 @@ void SaveBitmap(IWICBitmap* bitmap, GUID pixelFormat, const WCHAR *filename) HR_RET(stream->InitializeFromFilename(filename, GENERIC_WRITE)); ComPtr<IWICBitmapEncoder> encoder; - HR_RET(wicFactory->CreateEncoder(GUID_ContainerFormatBmp, NULL, &encoder)); + HR_RET(wicFactory->CreateEncoder(GUID_ContainerFormatBmp, nullptr, &encoder)); HR_RET(encoder->Initialize(stream.Get(), WICBitmapEncoderNoCache)); ComPtr<IWICBitmapFrameEncode> frameEncode; - HR_RET(encoder->CreateNewFrame(&frameEncode, NULL)); - HR_RET(frameEncode->Initialize(NULL)); + HR_RET(encoder->CreateNewFrame(&frameEncode, nullptr)); + HR_RET(frameEncode->Initialize(nullptr)); UINT width, height; HR_RET(bitmap->GetSize(&width, &height)); HR_RET(frameEncode->SetSize(width, height)); HR_RET(frameEncode->SetPixelFormat(&pixelFormat)); - HR_RET(frameEncode->WriteSource(bitmap, NULL)); + HR_RET(frameEncode->WriteSource(bitmap, nullptr)); HR_RET(frameEncode->Commit()); HR_RET(encoder->Commit()); @@ -165,7 +165,7 @@ void SaveBitmap2(bitmap_argb32 &bitmap, const WCHAR *filename) ComPtr<IWICImagingFactory> wicFactory; HR_RET(CoCreateInstance( CLSID_WICImagingFactory, - NULL, + nullptr, CLSCTX_INPROC_SERVER, __uuidof(IWICImagingFactory), (void**)&wicFactory)); @@ -710,7 +710,7 @@ public: HR_RET1(CoCreateInstance( CLSID_WICImagingFactory, - NULL, + nullptr, CLSCTX_INPROC_SERVER, __uuidof(IWICImagingFactory), static_cast<void**>(&m_wicFactory))); diff --git a/src/osd/modules/font/font_osx.cpp b/src/osd/modules/font/font_osx.cpp index e1c5137b397..22662d3b8d3 100644 --- a/src/osd/modules/font/font_osx.cpp +++ b/src/osd/modules/font/font_osx.cpp @@ -24,8 +24,8 @@ class osd_font_osx : public osd_font { public: - osd_font_osx() : m_font(NULL) { } - osd_font_osx(osd_font_osx &&obj) : m_font(obj.m_font) { obj.m_font = NULL; } + osd_font_osx() : m_font(nullptr) { } + osd_font_osx(osd_font_osx &&obj) : m_font(obj.m_font) { obj.m_font = nullptr; } virtual ~osd_font_osx() { close(); } virtual bool open(std::string const &font_path, std::string const &name, int &height); @@ -60,14 +60,14 @@ bool osd_font_osx::open(std::string const &font_path, std::string const &name, i } #endif - CFStringRef const font_name = CFStringCreateWithCString(NULL, name.c_str(), kCFStringEncodingUTF8); + CFStringRef const font_name = CFStringCreateWithCString(nullptr, name.c_str(), kCFStringEncodingUTF8); if (font_name && (kCFNotFound != CFStringFind(font_name, CFSTR(".BDF"), kCFCompareCaseInsensitive | kCFCompareBackwards | kCFCompareAnchored | kCFCompareNonliteral).location)) { // handle bdf fonts in the core CFRelease(font_name); return false; } - CTFontRef ct_font = NULL; + CTFontRef ct_font = nullptr; if (font_name) { CTFontDescriptorRef const font_descriptor = CTFontDescriptorCreateWithNameAndSize(font_name, 0.0); @@ -109,9 +109,9 @@ bool osd_font_osx::open(std::string const &font_path, std::string const &name, i void osd_font_osx::close() { - if (m_font != NULL) + if (m_font != nullptr) CFRelease(m_font); - m_font = NULL; + m_font = nullptr; } //------------------------------------------------- @@ -170,10 +170,10 @@ bool osd_font_osx::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, std::in context_ref = CGBitmapContextCreate( bitmap.raw_pixptr(0), bitmap_width, bitmap_height, bits_per_component, bitmap.rowpixels()*4, color_space, bitmap_info ); - if( context_ref != NULL ) + if( context_ref != nullptr ) { CGFontRef font_ref; - font_ref = CTFontCopyGraphicsFont( ct_font, NULL ); + font_ref = CTFontCopyGraphicsFont( ct_font, nullptr ); CGContextSetTextPosition(context_ref, -bounding_rect.origin.x*EXTRA_WIDTH, CTFontGetDescent(ct_font)+CTFontGetLeading(ct_font) ); CGContextSetRGBFillColor(context_ref, 1.0, 1.0, 1.0, 1.0); CGContextSetFont( context_ref, font_ref ); @@ -202,9 +202,9 @@ public: private: static CFComparisonResult sort_callback(CTFontDescriptorRef first, CTFontDescriptorRef second, void *refCon) { - CFStringRef left = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute(first, kCTFontDisplayNameAttribute, NULL); + CFStringRef left = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute(first, kCTFontDisplayNameAttribute, nullptr); if (!left) left = (CFStringRef)CTFontDescriptorCopyAttribute(first, kCTFontNameAttribute); - CFStringRef right = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute(second, kCTFontDisplayNameAttribute, NULL); + CFStringRef right = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute(second, kCTFontDisplayNameAttribute, nullptr); if (!right) right = (CFStringRef)CTFontDescriptorCopyAttribute(second, kCTFontNameAttribute); CFComparisonResult result; @@ -223,8 +223,8 @@ bool font_osx::get_font_families(std::string const &font_path, std::vector<std:: { CFStringRef keys[] = { kCTFontCollectionRemoveDuplicatesOption }; std::uintptr_t values[ARRAY_LENGTH(keys)] = { 1 }; - CFDictionaryRef const options = CFDictionaryCreate(kCFAllocatorDefault, (void const **)keys, (void const **)values, ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, NULL); - CTFontCollectionRef const collection = CTFontCollectionCreateFromAvailableFonts(NULL); + CFDictionaryRef const options = CFDictionaryCreate(kCFAllocatorDefault, (void const **)keys, (void const **)values, ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, nullptr); + CTFontCollectionRef const collection = CTFontCollectionCreateFromAvailableFonts(nullptr); CFRelease(options); if (!collection) return false; @@ -239,7 +239,7 @@ bool font_osx::get_font_families(std::string const &font_path, std::vector<std:: { CTFontDescriptorRef const font = (CTFontDescriptorRef)CFArrayGetValueAtIndex(descriptors, i); CFStringRef const name = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontNameAttribute); - CFStringRef const display = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute(font, kCTFontDisplayNameAttribute, NULL); + CFStringRef const display = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute(font, kCTFontDisplayNameAttribute, nullptr); if (name && display) { diff --git a/src/osd/modules/font/font_windows.cpp b/src/osd/modules/font/font_windows.cpp index 851d3b6d646..5dbae434854 100644 --- a/src/osd/modules/font/font_windows.cpp +++ b/src/osd/modules/font/font_windows.cpp @@ -32,9 +32,9 @@ namespace { class osd_font_windows : public osd_font { public: - osd_font_windows(): m_font(NULL) { } - osd_font_windows(osd_font_windows &&obj) : m_font(obj.m_font) { obj.m_font = NULL; } - virtual ~osd_font_windows() {close(); } + osd_font_windows(): m_font(nullptr) { } + osd_font_windows(osd_font_windows &&obj) : m_font(obj.m_font) { obj.m_font = nullptr; } + virtual ~osd_font_windows() { osd_font_windows::close(); } virtual bool open(std::string const &font_path, std::string const &name, int &height) override; virtual void close() override; @@ -93,11 +93,11 @@ bool osd_font_windows::open(std::string const &font_path, std::string const &_na // create the font height = logfont.lfHeight; m_font = CreateFontIndirect(&logfont); - if (m_font == NULL) + if (m_font == nullptr) return false; // select it into a temp DC and get the real font name - HDC dummyDC = CreateCompatibleDC(NULL); + HDC dummyDC = CreateCompatibleDC(nullptr); HGDIOBJ oldfont = SelectObject(dummyDC, m_font); std::vector<TCHAR> realname((std::max)(GetTextFace(dummyDC, 0, nullptr), 0)); int facelen = GetTextFace(dummyDC, realname.size(), &realname[0]); @@ -106,7 +106,7 @@ bool osd_font_windows::open(std::string const &font_path, std::string const &_na if (facelen <= 0) { DeleteObject(m_font); - m_font = NULL; + m_font = nullptr; return false; } @@ -119,7 +119,7 @@ bool osd_font_windows::open(std::string const &font_path, std::string const &_na if (result != 0) { DeleteObject(m_font); - m_font = NULL; + m_font = nullptr; return false; } return true; @@ -133,9 +133,9 @@ bool osd_font_windows::open(std::string const &font_path, std::string const &_na void osd_font_windows::close() { // delete the font ojbect - if (m_font != NULL) + if (m_font != nullptr) DeleteObject(m_font); - m_font = NULL; + m_font = nullptr; } //------------------------------------------------- @@ -149,7 +149,7 @@ void osd_font_windows::close() bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) { // create a dummy DC to work with - HDC dummyDC = CreateCompatibleDC(NULL); + HDC dummyDC = CreateCompatibleDC(nullptr); HGDIOBJ oldfont = SelectObject(dummyDC, m_font); // get the text metrics @@ -191,7 +191,7 @@ bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT // create a DIB to render to BYTE *bits; - HBITMAP dib = CreateDIBSection(dummyDC, &info, DIB_RGB_COLORS, reinterpret_cast<VOID **>(&bits), NULL, 0); + HBITMAP dib = CreateDIBSection(dummyDC, &info, DIB_RGB_COLORS, reinterpret_cast<VOID **>(&bits), nullptr, 0); if (dib) { @@ -205,7 +205,7 @@ bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT WCHAR tempchar = chnum; SetTextColor(dummyDC, RGB(0xff, 0xff, 0xff)); SetBkColor(dummyDC, RGB(0x00, 0x00, 0x00)); - ExtTextOutW(dummyDC, 50 + abc.abcA, 50, ETO_OPAQUE, NULL, &tempchar, 1, NULL); + ExtTextOutW(dummyDC, 50 + abc.abcA, 50, ETO_OPAQUE, nullptr, &tempchar, 1, nullptr); // characters are expected to be full-height rectangle actbounds; diff --git a/src/osd/modules/input/input_common.h b/src/osd/modules/input/input_common.h index 41a9d762838..094f3873f05 100644 --- a/src/osd/modules/input/input_common.h +++ b/src/osd/modules/input/input_common.h @@ -215,10 +215,10 @@ public: // Getters running_machine & machine() const { return m_machine; } - const char * name() { return m_name.c_str(); } - input_device * device() { return m_device; } + const char * name() const { return m_name.c_str(); } + input_device * device() const { return m_device; } input_module & module() const { return m_module; } - input_device_class deviceclass() { return m_deviceclass; } + input_device_class deviceclass() const { return m_deviceclass; } // Poll and reset methods virtual void poll() {}; @@ -289,20 +289,20 @@ public: void poll_devices() { - for (auto iter = m_list.begin(); iter != m_list.end(); iter++) + for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) iter->get()->poll(); } void reset_devices() { - for (auto iter = m_list.begin(); iter != m_list.end(); iter++) + for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) iter->get()->reset(); } void free_device(device_info * devinfo) { // remove us from the list - for (auto iter = m_list.begin(); iter != m_list.end(); iter++) + for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { if (iter->get() == devinfo) { @@ -316,7 +316,7 @@ public: { // remove us from the list int i = 0; - for (auto iter = m_list.begin(); iter != m_list.end(); iter++) + for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { if (iter->get() == devinfo) { @@ -336,7 +336,7 @@ public: m_list.pop_back(); } - int size() + int size() const { return m_list.size(); } @@ -419,7 +419,7 @@ public: keyboard_trans_table(std::unique_ptr<key_trans_entry[]> table, unsigned int size); // getters/setters - UINT32 size() { return m_table_size; } + UINT32 size() const { return m_table_size; } // public methods input_item_id lookup_mame_code(const char * scode) const; @@ -436,7 +436,7 @@ public: return s_instance; } - key_trans_entry & operator [](int i) { return m_table[i]; } + key_trans_entry & operator [](int i) const { return m_table[i]; } }; //============================================================ @@ -479,12 +479,12 @@ protected: public: - const osd_options * options() { return m_options; } + const osd_options * options() const { return m_options; } input_device_list * devicelist() { return &m_devicelist; } - bool input_enabled() { return m_input_enabled; } - bool input_paused() { return m_input_paused; } - bool mouse_enabled() { return m_mouse_enabled; } - bool lightgun_enabled() { return m_lightgun_enabled; } + bool input_enabled() const { return m_input_enabled; } + bool input_paused() const { return m_input_paused; } + bool mouse_enabled() const { return m_mouse_enabled; } + bool lightgun_enabled() const { return m_lightgun_enabled; } int init(const osd_options &options) override; diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp index dfb63482570..5aa925edefe 100644 --- a/src/osd/modules/input/input_dinput.cpp +++ b/src/osd/modules/input/input_dinput.cpp @@ -236,7 +236,7 @@ public: instance.dwSize = sizeof(instance); result = devinfo->dinput.device->GetObjectInfo(&instance, offset, DIPH_BYOFFSET); - // if we got an error and have no default string, just return NULL + // if we got an error and have no default string, just return nullptr if (result != DI_OK) { if (defstring == nullptr) diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index eb9dbae1100..f91d083371d 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -157,7 +157,7 @@ public: auto window = GET_FOCUS_WINDOW(&event.text); //printf("Focus window is %p - wl %p\n", window, sdl_window_list); unicode_char result; - if (window != NULL) + if (window != nullptr) { osd_uchar_from_osdchar(&result, sdlevent.text.text, 1); machine().ui_input().push_char_event(window->target(), result); @@ -212,7 +212,7 @@ public: int cx = -1, cy = -1; auto window = GET_FOCUS_WINDOW(&sdlevent.motion); - if (window != NULL && window->xy_to_render_target(sdlevent.motion.x, sdlevent.motion.y, &cx, &cy)) + if (window != nullptr && window->xy_to_render_target(sdlevent.motion.x, sdlevent.motion.y, &cx, &cy)) machine().ui_input().push_mouse_move_event(window->target(), cx, cy); } break; @@ -229,7 +229,7 @@ public: int cx, cy; osd_ticks_t click = osd_ticks() * 1000 / osd_ticks_per_second(); auto window = GET_FOCUS_WINDOW(&sdlevent.button); - if (window != NULL && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) + if (window != nullptr && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) { machine().ui_input().push_mouse_down_event(window->target(), cx, cy); // FIXME Parameter ? @@ -254,7 +254,7 @@ public: int cx, cy; auto window = GET_FOCUS_WINDOW(&sdlevent.button); - if (window != NULL && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) + if (window != nullptr && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) { machine().ui_input().push_mouse_rdown_event(window->target(), cx, cy); } @@ -270,7 +270,7 @@ public: int cx, cy; auto window = GET_FOCUS_WINDOW(&sdlevent.button); - if (window != NULL && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) + if (window != nullptr && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) { machine().ui_input().push_mouse_up_event(window->target(), cx, cy); } @@ -280,7 +280,7 @@ public: int cx, cy; auto window = GET_FOCUS_WINDOW(&sdlevent.button); - if (window != NULL && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) + if (window != nullptr && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) { machine().ui_input().push_mouse_rup_event(window->target(), cx, cy); } @@ -289,7 +289,7 @@ public: case SDL_MOUSEWHEEL: auto window = GET_FOCUS_WINDOW(&sdlevent.wheel); - if (window != NULL) + if (window != nullptr) machine().ui_input().push_mouse_wheel_event(window->target(), 0, 0, sdlevent.wheel.y, 3); break; } @@ -324,7 +324,7 @@ public: sdl_joystick_device(running_machine &machine, const char *name, input_module &module) : sdl_device(machine, name, DEVICE_CLASS_JOYSTICK, module), joystick({{0}}), - sdl_state({0}) + sdl_state({ nullptr }) { } @@ -492,7 +492,7 @@ class sdl_keyboard_module : public sdl_input_module keyboard_trans_table * m_key_trans_table; public: sdl_keyboard_module() - : sdl_input_module(OSD_KEYBOARDINPUT_PROVIDER) + : sdl_input_module(OSD_KEYBOARDINPUT_PROVIDER), m_key_trans_table(nullptr) { } @@ -553,7 +553,7 @@ private: osd_printf_verbose("Keymap: Start reading keymap_file %s\n", keymap_filename); keymap_file = fopen(keymap_filename, "r"); - if (keymap_file == NULL) + if (keymap_file == nullptr) { osd_printf_warning("Keymap: Unable to open keymap %s, using default\n", keymap_filename); return &default_table; @@ -699,7 +699,7 @@ private: bool m_sixaxis_mode; public: sdl_joystick_module() - : sdl_input_module(OSD_JOYSTICKINPUT_PROVIDER) + : sdl_input_module(OSD_JOYSTICKINPUT_PROVIDER), m_sixaxis_mode(false) { } @@ -740,7 +740,7 @@ public: { sdl_joystick_device *devinfo = create_joystick_device(machine, &m_joy_map, stick, DEVICE_CLASS_JOYSTICK); - if (devinfo == NULL) + if (devinfo == nullptr) continue; physical_stick = m_joy_map.map[stick].physical; @@ -844,7 +844,7 @@ public: private: sdl_joystick_device* create_joystick_device(running_machine &machine, device_map_t *devmap, int index, input_device_class devclass) { - sdl_joystick_device *devinfo = NULL; + sdl_joystick_device *devinfo = nullptr; char tempname[20]; if (devmap->map[index].name.length() == 0) @@ -858,7 +858,7 @@ private: : devicelist()->create_device<sdl_joystick_device>(machine, tempname, *this); } - return NULL; + return nullptr; } else { diff --git a/src/osd/modules/input/input_sdlcommon.cpp b/src/osd/modules/input/input_sdlcommon.cpp index ebc20ddd319..82c470534b2 100644 --- a/src/osd/modules/input/input_sdlcommon.cpp +++ b/src/osd/modules/input/input_sdlcommon.cpp @@ -47,7 +47,7 @@ static inline std::shared_ptr<sdl_window_info> window_from_id(Uint32 windowID) return w; } } - return NULL; + return nullptr; } void sdl_event_manager::process_events(running_machine &machine) @@ -64,7 +64,7 @@ void sdl_event_manager::process_events(running_machine &machine) auto subscribers = m_subscription_index.equal_range(sdlevent.type); // Dispatch the events - for (auto iter = subscribers.first; iter != subscribers.second; iter++) + for (auto iter = subscribers.first; iter != subscribers.second; ++iter) iter->second->handle_event(sdlevent); } } @@ -73,7 +73,7 @@ void sdl_event_manager::process_window_event(running_machine &machine, SDL_Event { std::shared_ptr<sdl_window_info> window = GET_WINDOW(&sdlevent.window); - if (window == NULL) + if (window == nullptr) return; switch (sdlevent.window.event) diff --git a/src/osd/modules/input/input_sdlcommon.h b/src/osd/modules/input/input_sdlcommon.h index 2e40199c556..abdc4ddf4ed 100644 --- a/src/osd/modules/input/input_sdlcommon.h +++ b/src/osd/modules/input/input_sdlcommon.h @@ -62,7 +62,8 @@ struct device_map_t class sdl_event_subscriber { public: - virtual void handle_event(SDL_Event &sdlevent) = 0; + virtual ~sdl_event_subscriber() {} + virtual void handle_event(SDL_Event &sdlevent) = 0; }; template <class TSubscriber> @@ -130,7 +131,7 @@ private: public: bool mouse_over_window() const { return m_mouse_over_window; } bool has_focus() const { return m_focus_window != nullptr; } - std::shared_ptr<sdl_window_info> focus_window() { return m_focus_window; } + std::shared_ptr<sdl_window_info> focus_window() const { return m_focus_window; } static sdl_event_manager& instance() { diff --git a/src/osd/modules/input/input_win32.cpp b/src/osd/modules/input/input_win32.cpp index 0b44c510fa0..d02c73c987a 100644 --- a/src/osd/modules/input/input_win32.cpp +++ b/src/osd/modules/input/input_win32.cpp @@ -202,7 +202,7 @@ public: // allocate a device devinfo = devicelist()->create_device<win32_mouse_device>(machine, "Win32 Mouse 1", *this); - if (devinfo == NULL) + if (devinfo == nullptr) return; // populate the axes @@ -377,7 +377,7 @@ public: // allocate a device devinfo = devicelist()->create_device<win32_lightgun_device>(machine, gun_names[gunnum], *this); - if (devinfo == NULL) + if (devinfo == nullptr) break; // populate the axes diff --git a/src/osd/modules/input/input_x11.cpp b/src/osd/modules/input/input_x11.cpp index 91e819eed7b..63563e9b0d8 100644 --- a/src/osd/modules/input/input_x11.cpp +++ b/src/osd/modules/input/input_x11.cpp @@ -130,7 +130,7 @@ find_device_info(Display *display, bool only_extended) { XDeviceInfo *devices; - XDeviceInfo *found = NULL; + XDeviceInfo *found = nullptr; int loop; int num_devices; int len = strlen(name); @@ -287,7 +287,7 @@ public: if (m_display != nullptr) return 0; - m_display = XOpenDisplay(NULL); + m_display = XOpenDisplay(nullptr); if (m_display == nullptr) { osd_printf_verbose("Unable to connect to X server\n"); diff --git a/src/osd/modules/lib/osdlib_macosx.cpp b/src/osd/modules/lib/osdlib_macosx.cpp index 4d1f839cabd..d000a1cb058 100644 --- a/src/osd/modules/lib/osdlib_macosx.cpp +++ b/src/osd/modules/lib/osdlib_macosx.cpp @@ -153,14 +153,14 @@ char *osd_get_clipboard_text(void) PasteboardRef pasteboard_ref; err = PasteboardCreate(kPasteboardClipboard, &pasteboard_ref); if (err) - return NULL; + return nullptr; PasteboardSynchronize(pasteboard_ref); ItemCount item_count; err = PasteboardGetItemCount(pasteboard_ref, &item_count); - char *result = NULL; // core expects a malloced C string of uft8 data + char *result = nullptr; // core expects a malloced C string of uft8 data for (UInt32 item_index = 1; (item_index <= item_count) && !result; item_index++) { PasteboardItemID item_id; diff --git a/src/osd/modules/lib/osdlib_unix.cpp b/src/osd/modules/lib/osdlib_unix.cpp index 3b67e4a2f3a..ea7dd60c203 100644 --- a/src/osd/modules/lib/osdlib_unix.cpp +++ b/src/osd/modules/lib/osdlib_unix.cpp @@ -146,7 +146,7 @@ char *osd_get_clipboard_text(void) char *osd_get_clipboard_text(void) { - char *result = NULL; + char *result = nullptr; if (SDL_HasClipboardText()) { diff --git a/src/osd/modules/lib/osdlib_win32.cpp b/src/osd/modules/lib/osdlib_win32.cpp index c5792f0307d..f778977614a 100644 --- a/src/osd/modules/lib/osdlib_win32.cpp +++ b/src/osd/modules/lib/osdlib_win32.cpp @@ -53,7 +53,7 @@ //============================================================ #ifdef OSD_WINDOWS -void (*s_debugger_stack_crawler)() = NULL; +void (*s_debugger_stack_crawler)() = nullptr; #endif @@ -116,8 +116,8 @@ void *osd_malloc(size_t size) // basic objects just come from the heap UINT8 *const block = reinterpret_cast<UINT8 *>(HeapAlloc(GetProcessHeap(), 0, size)); - if (block == NULL) - return NULL; + if (block == nullptr) + return nullptr; UINT8 *const result = reinterpret_cast<UINT8 *>(reinterpret_cast<FPTR>(block + sizeof(size_t) + MAX_ALIGNMENT) & ~(FPTR(MAX_ALIGNMENT) - 1)); // store the size and return and pointer to the data afterward @@ -145,14 +145,14 @@ void *osd_malloc_array(size_t size) size_t const rounded_size = ((size + sizeof(void *) + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; // reserve that much memory, plus two guard pages - void *page_base = VirtualAlloc(NULL, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS); - if (page_base == NULL) - return NULL; + void *page_base = VirtualAlloc(nullptr, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS); + if (page_base == nullptr) + return nullptr; // now allow access to everything but the first and last pages page_base = VirtualAlloc(reinterpret_cast<UINT8 *>(page_base) + PAGE_SIZE, rounded_size, MEM_COMMIT, PAGE_READWRITE); - if (page_base == NULL) - return NULL; + if (page_base == nullptr) + return nullptr; // work backwards from the page base to get to the block base UINT8 *const block = GUARD_ALIGN_START ? reinterpret_cast<UINT8 *>(page_base) : (reinterpret_cast<UINT8 *>(page_base) + rounded_size - size); @@ -231,7 +231,7 @@ void osd_break_into_debugger(const char *message) win_output_debug_string_utf8(message); DebugBreak(); } - else if (s_debugger_stack_crawler != NULL) + else if (s_debugger_stack_crawler != nullptr) (*s_debugger_stack_crawler)(); #else if (IsDebuggerPresent()) @@ -248,7 +248,7 @@ void osd_break_into_debugger(const char *message) static char *get_clipboard_text_by_format(UINT format, char *(*convert)(LPCVOID data)) { - char *result = NULL; + char *result = nullptr; HANDLE data_handle; LPVOID data; @@ -256,15 +256,15 @@ static char *get_clipboard_text_by_format(UINT format, char *(*convert)(LPCVOID if (IsClipboardFormatAvailable(format)) { // open the clipboard - if (OpenClipboard(NULL)) + if (OpenClipboard(nullptr)) { // try to access clipboard data data_handle = GetClipboardData(format); - if (data_handle != NULL) + if (data_handle != nullptr) { // lock the data data = GlobalLock(data_handle); - if (data != NULL) + if (data != nullptr) { // invoke the convert result = (*convert)(data); diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 099c5fefb77..2afe86869b5 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -450,7 +450,7 @@ void osd_common_t::update(bool skip_redraw) // irregular intervals in some circumstances (e.g., multi-screen games // or games with asynchronous updates). // - if (m_watchdog != NULL) + if (m_watchdog != nullptr) m_watchdog->reset(); update_slider_list(); @@ -644,7 +644,7 @@ void osd_common_t::init_subsystems() m_midi = select_module_options<midi_module *>(options(), OSD_MIDI_PROVIDER); m_output = select_module_options<output_module *>(options(), OSD_OUTPUT_PROVIDER); - machine().output().set_notifier(NULL, output_notifier_callback, this); + machine().output().set_notifier(nullptr, output_notifier_callback, this); m_mod_man.init(options()); diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 46049d74fe9..fc0d2f7a925 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -155,7 +155,7 @@ public: // BGFX specific options const char *bgfx_path() const { return value(OSDOPTION_BGFX_PATH); } const char *bgfx_backend() const { return value(OSDOPTION_BGFX_BACKEND); } - const bool bgfx_debug() const { return bool_value(OSDOPTION_BGFX_DEBUG); } + bool bgfx_debug() const { return bool_value(OSDOPTION_BGFX_DEBUG); } const char *bgfx_screen_chains() const { return value(OSDOPTION_BGFX_SCREEN_CHAINS); } const char *bgfx_shadow_mask() const { return value(OSDOPTION_BGFX_SHADOW_MASK); } const char *bgfx_avi_name() const { return value(OSDOPTION_BGFX_AVI_NAME); } @@ -209,7 +209,7 @@ public: // this INTERFACE but part of the osd IMPLEMENTATION // getters - running_machine &machine() { assert(m_machine != nullptr); return *m_machine; } + running_machine &machine() const { assert(m_machine != nullptr); return *m_machine; } virtual void debugger_update(); @@ -230,14 +230,14 @@ public: virtual void video_options_add(const char *name, void *type); - osd_options &options() { return m_options; } + virtual osd_options &options() { return m_options; } // osd_output interface ... virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override; bool verbose() const { return m_print_verbose; } void set_verbose(bool print_verbose) { m_print_verbose = print_verbose; } - void notify(const char *outname, INT32 value) { m_output->notify(outname, value); } + void notify(const char *outname, INT32 value) const { m_output->notify(outname, value); } protected: virtual bool input_init(); virtual void input_pause(); diff --git a/src/osd/modules/netdev/pcap.cpp b/src/osd/modules/netdev/pcap.cpp index 4c85c1367c0..541ed422d8a 100644 --- a/src/osd/modules/netdev/pcap.cpp +++ b/src/osd/modules/netdev/pcap.cpp @@ -55,7 +55,7 @@ class pcap_module : public osd_module, public netdev_module public: pcap_module() - : osd_module(OSD_NETDEV_PROVIDER, "pcap"), netdev_module(), handle(NULL) + : osd_module(OSD_NETDEV_PROVIDER, "pcap"), netdev_module(), handle(nullptr) { } virtual ~pcap_module() { } @@ -68,15 +68,15 @@ public: HMODULE handle; }; -static int (*pcap_compile_dl)(pcap_t *, struct bpf_program *, char *, int, bpf_u_int32) = NULL; -static int (*pcap_findalldevs_dl)(pcap_if_t **, char *) = NULL; -static pcap_t *(*pcap_open_live_dl)(const char *name, int, int, int, char *) = NULL; -static int (*pcap_next_ex_dl)(pcap_t *, struct pcap_pkthdr **, const u_char **) = NULL; -static void (*pcap_close_dl)(pcap_t *) = NULL; -static int (*pcap_setfilter_dl)(pcap_t *, struct bpf_program *) = NULL; -static int (*pcap_sendpacket_dl)(pcap_t *, u_char *, int) = NULL; -static int (*pcap_set_datalink_dl)(pcap_t *, int) = NULL; -static int (*pcap_dispatch_dl)(pcap_t *, int, pcap_handler callback, u_char *) = NULL; +static int (*pcap_compile_dl)(pcap_t *, struct bpf_program *, char *, int, bpf_u_int32) = nullptr; +static int (*pcap_findalldevs_dl)(pcap_if_t **, char *) = nullptr; +static pcap_t *(*pcap_open_live_dl)(const char *name, int, int, int, char *) = nullptr; +static int (*pcap_next_ex_dl)(pcap_t *, struct pcap_pkthdr **, const u_char **) = nullptr; +static void (*pcap_close_dl)(pcap_t *) = nullptr; +static int (*pcap_setfilter_dl)(pcap_t *, struct bpf_program *) = nullptr; +static int (*pcap_sendpacket_dl)(pcap_t *, u_char *, int) = nullptr; +static int (*pcap_set_datalink_dl)(pcap_t *, int) = nullptr; +static int (*pcap_dispatch_dl)(pcap_t *, int, pcap_handler callback, u_char *) = nullptr; #if 0 @@ -165,7 +165,7 @@ netdev_pcap::netdev_pcap(const char *name, class device_network_interface *ifdev { osd_printf_error("Unable to set %s to ethernet", name); pcap_close_dl(m_p); - m_p = NULL; + m_p = nullptr; return; } netdev_pcap::set_mac(get_mac()); @@ -174,7 +174,7 @@ netdev_pcap::netdev_pcap(const char *name, class device_network_interface *ifdev m_ctx.head = 0; m_ctx.tail = 0; m_ctx.p = m_p; - pthread_create(&m_thread, NULL, netdev_pcap_blocker, &m_ctx); + pthread_create(&m_thread, nullptr, netdev_pcap_blocker, &m_ctx); #endif } @@ -235,12 +235,12 @@ int netdev_pcap::recv_dev(UINT8 **buf) netdev_pcap::~netdev_pcap() { #ifdef SDLMAME_MACOSX - m_ctx.p = NULL; + m_ctx.p = nullptr; pthread_cancel(m_thread); - pthread_join(m_thread, NULL); + pthread_join(m_thread, nullptr); #endif if(m_p) pcap_close_dl(m_p); - m_p = NULL; + m_p = nullptr; } static CREATE_NETDEV(create_pcap) @@ -251,10 +251,10 @@ static CREATE_NETDEV(create_pcap) bool pcap_module::probe() { - if (handle == NULL) + if (handle == nullptr) { handle = LoadDynamicLibrary(LIB_NAME); - return (handle != NULL); + return (handle != nullptr); } return true; } @@ -315,7 +315,7 @@ void pcap_module::exit() { clear_netdev(); //FreeLibrary(handle); - //handle = NULL; + //handle = nullptr; } #else #include "modules/osdmodule.h" diff --git a/src/osd/modules/opengl/gl_shader_mgr.cpp b/src/osd/modules/opengl/gl_shader_mgr.cpp index 21ee7f9fc54..9f8dc8acd05 100644 --- a/src/osd/modules/opengl/gl_shader_mgr.cpp +++ b/src/osd/modules/opengl/gl_shader_mgr.cpp @@ -122,7 +122,7 @@ glsl_shader_info *glsl_shader_init(osd_gl_context *gl_ctx) int i,j, err; err = gl_shader_loadExtention(gl_ctx); - if(err) return NULL; + if(err) return nullptr; for (i=0; !err && i<GLSL_VERTEX_SHADER_INT_NUMBER; i++) { @@ -137,7 +137,7 @@ glsl_shader_info *glsl_shader_init(osd_gl_context *gl_ctx) #endif } - if(err) return NULL; + if(err) return nullptr; for (j=0; !err && j<GLSL_SHADER_FEAT_INT_NUMBER; j++) { @@ -146,16 +146,16 @@ glsl_shader_info *glsl_shader_init(osd_gl_context *gl_ctx) err = gl_compile_shader_files (&glsl_mamebm_programs[j], &glsl_mamebm_vsh_shader[glsl_mamebm_fsh2vsh[j]], &glsl_mamebmfsh_shader[j], - NULL /*precompiled*/, glsl_mamebm_fsh_files[j], 0); + nullptr /*precompiled*/, glsl_mamebm_fsh_files[j], 0); #else if(glsl_mamebm_fsh_sources[j]) err = gl_compile_shader_sources(&glsl_mamebm_programs[j], &glsl_mamebm_vsh_shader[glsl_mamebm_fsh2vsh[j]], &glsl_mamebm_fsh_shader[j], - NULL /*precompiled*/, glsl_mamebm_fsh_sources[j]); + nullptr /*precompiled*/, glsl_mamebm_fsh_sources[j]); #endif } - if (err) return NULL; + if (err) return nullptr; return (glsl_shader_info *) malloc(sizeof(glsl_shader_info *)); } @@ -169,29 +169,29 @@ int glsl_shader_free(glsl_shader_info *shinfo) for (i=0; i<GLSL_VERTEX_SHADER_MAX_NUMBER+9; i++) { if ( glsl_mamebm_vsh_shader[i] ) - (void) gl_delete_shader( NULL, &glsl_mamebm_vsh_shader[i], NULL); + (void) gl_delete_shader(nullptr, &glsl_mamebm_vsh_shader[i], nullptr); } for (j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++) { if ( glsl_mamebm_fsh_shader[j] ) - (void) gl_delete_shader( NULL, NULL, &glsl_mamebm_fsh_shader[j]); + (void) gl_delete_shader(nullptr, nullptr, &glsl_mamebm_fsh_shader[j]); } for (j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++) { if ( glsl_mamebm_programs[j] ) - (void) gl_delete_shader( &glsl_mamebm_programs[j], NULL, NULL); + (void) gl_delete_shader( &glsl_mamebm_programs[j], nullptr, nullptr); } for (i=0; i<10; i++) { if ( glsl_scrn_vsh_shader[i] ) - (void) gl_delete_shader( NULL, &glsl_scrn_vsh_shader[i], NULL); + (void) gl_delete_shader(nullptr, &glsl_scrn_vsh_shader[i], nullptr); if ( glsl_scrn_fsh_shader[i] ) - (void) gl_delete_shader( NULL, NULL, &glsl_scrn_fsh_shader[i]); + (void) gl_delete_shader(nullptr, nullptr, &glsl_scrn_fsh_shader[i]); if ( glsl_scrn_programs[i] ) - (void) gl_delete_shader( &glsl_scrn_programs[i], NULL, NULL); + (void) gl_delete_shader( &glsl_scrn_programs[i], nullptr, nullptr); } free(shinfo); @@ -213,7 +213,7 @@ int glsl_shader_add_mamebm(glsl_shader_info *shinfo, const char * custShaderPref err = gl_compile_shader_files (&glsl_mamebm_programs[GLSL_SHADER_FEAT_CUSTOM+idx], &glsl_mamebm_vsh_shader[GLSL_VERTEX_SHADER_CUSTOM+idx], &glsl_mamebm_fsh_shader[GLSL_SHADER_FEAT_CUSTOM+idx], - NULL /*precompiled*/, fname, 0); + nullptr /*precompiled*/, fname, 0); return err; } @@ -233,6 +233,6 @@ int glsl_shader_add_scrn(glsl_shader_info *shinfo, const char * custShaderPrefix err = gl_compile_shader_files (&glsl_scrn_programs[idx], &glsl_scrn_vsh_shader[idx], &glsl_scrn_fsh_shader[idx], - NULL /*precompiled*/, fname, 0); + nullptr /*precompiled*/, fname, 0); return err; } diff --git a/src/osd/modules/opengl/gl_shader_mgr.h b/src/osd/modules/opengl/gl_shader_mgr.h index 532d40c30fe..b232243f636 100644 --- a/src/osd/modules/opengl/gl_shader_mgr.h +++ b/src/osd/modules/opengl/gl_shader_mgr.h @@ -26,7 +26,7 @@ struct glsl_shader_info /** - * returns pointer if ok, otherwise NULL + * returns pointer if ok, otherwise nullptr */ glsl_shader_info *glsl_shader_init(osd_gl_context *gl_ctx); diff --git a/src/osd/modules/opengl/gl_shader_tool.cpp b/src/osd/modules/opengl/gl_shader_tool.cpp index 8281691a607..5ee07661aa9 100644 --- a/src/osd/modules/opengl/gl_shader_tool.cpp +++ b/src/osd/modules/opengl/gl_shader_tool.cpp @@ -18,28 +18,28 @@ #include "emu.h" #include "gl_shader_tool.h" -PFNGLGETOBJECTPARAMETERIVARBPROC pfn_glGetObjectParameterivARB=NULL; -PFNGLGETINFOLOGARBPROC pfn_glGetInfoLogARB=NULL; -PFNGLDELETEOBJECTARBPROC pfn_glDeleteObjectARB=NULL; -PFNGLCREATESHADEROBJECTARBPROC pfn_glCreateShaderObjectARB=NULL; -PFNGLSHADERSOURCEARBPROC pfn_glShaderSourceARB=NULL; -PFNGLCOMPILESHADERARBPROC pfn_glCompileShaderARB=NULL; -PFNGLCREATEPROGRAMOBJECTARBPROC pfn_glCreateProgramObjectARB=NULL; -PFNGLATTACHOBJECTARBPROC pfn_glAttachObjectARB=NULL; -PFNGLLINKPROGRAMARBPROC pfn_glLinkProgramARB=NULL; -PFNGLVALIDATEPROGRAMARBPROC pfn_glValidateProgramARB=NULL; -PFNGLUSEPROGRAMOBJECTARBPROC pfn_glUseProgramObjectARB=NULL; -PFNGLGETUNIFORMLOCATIONARBPROC pfn_glGetUniformLocationARB=NULL; -PFNGLUNIFORM1FARBPROC pfn_glUniform1fARB=NULL; -PFNGLUNIFORM1IARBPROC pfn_glUniform1iARB=NULL; -PFNGLUNIFORM1FVARBPROC pfn_glUniform1fvARB=NULL; -PFNGLUNIFORM2FVARBPROC pfn_glUniform2fvARB=NULL; -PFNGLUNIFORM3FVARBPROC pfn_glUniform3fvARB=NULL; -PFNGLUNIFORM4FVARBPROC pfn_glUniform4fvARB=NULL; -PFNGLUNIFORM1IVARBPROC pfn_glUniform1ivARB=NULL; -PFNGLUNIFORM2IVARBPROC pfn_glUniform2ivARB=NULL; -PFNGLUNIFORM3IVARBPROC pfn_glUniform3ivARB=NULL; -PFNGLUNIFORM4IVARBPROC pfn_glUniform4ivARB=NULL; +PFNGLGETOBJECTPARAMETERIVARBPROC pfn_glGetObjectParameterivARB= nullptr; +PFNGLGETINFOLOGARBPROC pfn_glGetInfoLogARB= nullptr; +PFNGLDELETEOBJECTARBPROC pfn_glDeleteObjectARB= nullptr; +PFNGLCREATESHADEROBJECTARBPROC pfn_glCreateShaderObjectARB= nullptr; +PFNGLSHADERSOURCEARBPROC pfn_glShaderSourceARB= nullptr; +PFNGLCOMPILESHADERARBPROC pfn_glCompileShaderARB= nullptr; +PFNGLCREATEPROGRAMOBJECTARBPROC pfn_glCreateProgramObjectARB= nullptr; +PFNGLATTACHOBJECTARBPROC pfn_glAttachObjectARB= nullptr; +PFNGLLINKPROGRAMARBPROC pfn_glLinkProgramARB= nullptr; +PFNGLVALIDATEPROGRAMARBPROC pfn_glValidateProgramARB= nullptr; +PFNGLUSEPROGRAMOBJECTARBPROC pfn_glUseProgramObjectARB= nullptr; +PFNGLGETUNIFORMLOCATIONARBPROC pfn_glGetUniformLocationARB= nullptr; +PFNGLUNIFORM1FARBPROC pfn_glUniform1fARB= nullptr; +PFNGLUNIFORM1IARBPROC pfn_glUniform1iARB= nullptr; +PFNGLUNIFORM1FVARBPROC pfn_glUniform1fvARB= nullptr; +PFNGLUNIFORM2FVARBPROC pfn_glUniform2fvARB= nullptr; +PFNGLUNIFORM3FVARBPROC pfn_glUniform3fvARB= nullptr; +PFNGLUNIFORM4FVARBPROC pfn_glUniform4fvARB= nullptr; +PFNGLUNIFORM1IVARBPROC pfn_glUniform1ivARB= nullptr; +PFNGLUNIFORM2IVARBPROC pfn_glUniform2ivARB= nullptr; +PFNGLUNIFORM3IVARBPROC pfn_glUniform3ivARB= nullptr; +PFNGLUNIFORM4IVARBPROC pfn_glUniform4ivARB= nullptr; int gl_shader_loadExtention(osd_gl_context *gl_ctx) @@ -256,7 +256,7 @@ int gl_texture_check_size(GLenum target, GLint level, GLint internalFormat, GLsi glTexImage2D (texTargetProxy, level, internalFormat, width, height, - border, format, type, NULL); + border, format, type, nullptr); if ( 0!=(err=GL_CHECK_ERROR_NORMAL() )) return err; glGetTexLevelParameteriv( texTargetProxy, level, GL_TEXTURE_WIDTH, avail_width); @@ -305,7 +305,7 @@ static int delete_shader_tool( GLhandleARB *program, GLhandleARB *vertex_shader, int res=0; GL_CHECK_ERROR_QUIET(); - if(program!=NULL && *program!=0) + if(program!= nullptr && *program!=0) { pfn_glDeleteObjectARB(*program); if(externalcall) @@ -314,7 +314,7 @@ static int delete_shader_tool( GLhandleARB *program, GLhandleARB *vertex_shader, } *program=0; } - if(vertex_shader!=NULL && *vertex_shader!=0) + if(vertex_shader!= nullptr && *vertex_shader!=0) { pfn_glDeleteObjectARB(*vertex_shader); if(externalcall) @@ -323,7 +323,7 @@ static int delete_shader_tool( GLhandleARB *program, GLhandleARB *vertex_shader, } *vertex_shader=0; } - if(fragment_shader!=NULL && *fragment_shader!=0) + if(fragment_shader!= nullptr && *fragment_shader!=0) { pfn_glDeleteObjectARB(*fragment_shader); if(externalcall) @@ -340,19 +340,19 @@ int gl_compile_shader_source( GLhandleARB *shader, GLenum type, const char * sha { int err = 0; - if(shader==NULL || shader_source==NULL) + if(shader== nullptr || shader_source== nullptr) { - if(shader==NULL) - osd_printf_warning("error: gl_compile_shader_source: NULL shader passed\n"); - if(shader_source==NULL) - osd_printf_warning("error: gl_compile_shader_source: NULL shader source passed\n"); + if(shader== nullptr) + osd_printf_warning("error: gl_compile_shader_source: nullptr shader passed\n"); + if(shader_source== nullptr) + osd_printf_warning("error: gl_compile_shader_source: nullptr shader source passed\n"); return -1; } *shader = pfn_glCreateShaderObjectARB(type); err=GL_SHADER_CHECK(*shader, GL_OBJECT_TYPE_ARB); if(err) goto errout; - pfn_glShaderSourceARB(*shader, 1, (const GLcharARB **)&shader_source, NULL); + pfn_glShaderSourceARB(*shader, 1, (const GLcharARB **)&shader_source, nullptr); pfn_glCompileShaderARB(*shader); err=GL_SHADER_CHECK(*shader, GL_OBJECT_COMPILE_STATUS_ARB); @@ -374,12 +374,12 @@ errout: int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shader_file, int verbose ) { - if(shader==NULL || shader_file==NULL) + if(shader== nullptr || shader_file== nullptr) { - if(shader==NULL) - osd_printf_warning("error: gl_compile_shader_source: NULL shader passed\n"); - if(shader_file==NULL) - osd_printf_warning("error: gl_compile_shader_source: NULL shader file passed\n"); + if(shader== nullptr) + osd_printf_warning("error: gl_compile_shader_source: nullptr shader passed\n"); + if(shader_file== nullptr) + osd_printf_warning("error: gl_compile_shader_source: nullptr shader file passed\n"); return -1; } diff --git a/src/osd/modules/osdmodule.cpp b/src/osd/modules/osdmodule.cpp index 1c745effc6c..8ebf72f4cd4 100644 --- a/src/osd/modules/osdmodule.cpp +++ b/src/osd/modules/osdmodule.cpp @@ -44,7 +44,7 @@ void osd_module_manager::register_module(const module_type &mod_type) } } -bool osd_module_manager::type_has_name(const char *type, const char *name) +bool osd_module_manager::type_has_name(const char *type, const char *name) const { return (get_module_index(type, name) >= 0); } @@ -91,7 +91,7 @@ void osd_module_manager::exit() } } -int osd_module_manager::get_module_index(const char *type, const char *name) +int osd_module_manager::get_module_index(const char *type, const char *name) const { for (int i = 0; m_modules[i] != nullptr; i++) { @@ -101,7 +101,7 @@ int osd_module_manager::get_module_index(const char *type, const char *name) return -1; } -void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[]) +void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[]) const { *num = 0; for (int i = 0; m_modules[i] != nullptr; i++) diff --git a/src/osd/modules/osdmodule.h b/src/osd/modules/osdmodule.h index 1e545aa299b..1aa6c494855 100644 --- a/src/osd/modules/osdmodule.h +++ b/src/osd/modules/osdmodule.h @@ -68,7 +68,7 @@ public: ~osd_module_manager(); void register_module(const module_type &mod_type); - bool type_has_name(const char *type, const char *name); + bool type_has_name(const char *type, const char *name) const; osd_module *get_module_generic(const char *type, const char *name); @@ -80,14 +80,14 @@ public: osd_module *select_module(const char *type, const char *name = ""); - void get_module_names(const char *type, const int max, int *num, const char *names[]); + void get_module_names(const char *type, const int max, int *num, const char *names[]) const; void init(const osd_options &options); void exit(); private: - int get_module_index(const char *type, const char *name); + int get_module_index(const char *type, const char *name) const; osd_module *m_modules[MAX_MODULES]; osd_module *m_selected[MAX_MODULES]; diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index 05b1020d9ab..7f20c7c7b62 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -53,7 +53,7 @@ class osd_monitor_info { public: osd_monitor_info(void *handle, const char *monitor_device, float aspect) - : m_next(NULL), m_handle(handle), m_aspect(aspect) + : m_next(nullptr), m_is_primary(false), m_handle(handle), m_aspect(aspect) { strncpy(m_name, monitor_device, ARRAY_LENGTH(m_name) - 1); } @@ -62,21 +62,21 @@ public: virtual void refresh() = 0; - const void *oshandle() { return m_handle; } + const void *oshandle() const { return m_handle; } - const osd_rect &position_size() { return m_pos_size; } - const osd_rect &usuable_position_size() { return m_usuable_pos_size; } + const osd_rect &position_size() const { return m_pos_size; } + const osd_rect &usuable_position_size() const { return m_usuable_pos_size; } const char *devicename() { return m_name[0] ? m_name : "UNKNOWN"; } - float aspect() { return m_aspect; } - float pixel_aspect() { return m_aspect / ((float)m_pos_size.width() / (float)m_pos_size.height()); } + float aspect() const { return m_aspect; } + float pixel_aspect() const { return m_aspect / ((float)m_pos_size.width() / (float)m_pos_size.height()); } - void update_resolution(const int new_width, const int new_height) { m_pos_size.resize(new_width, new_height); } + void update_resolution(const int new_width, const int new_height) const { m_pos_size.resize(new_width, new_height); } void set_aspect(const float a) { m_aspect = a; } - bool is_primary() { return m_is_primary; } + bool is_primary() const { return m_is_primary; } - osd_monitor_info * next() { return m_next; } // pointer to next monitor in list + osd_monitor_info * next() const { return m_next; } // pointer to next monitor in list static osd_monitor_info *pick_monitor(osd_options &options, int index); static osd_monitor_info *list; @@ -114,7 +114,7 @@ public: osd_window() : #ifndef OSD_SDL - m_dc(0), m_resize_state(0), + m_dc(nullptr), m_resize_state(0), #endif m_primlist(nullptr), m_index(0), @@ -162,7 +162,7 @@ public: m_platform_window = window; } - std::shared_ptr<osd_window> main_window() { return m_main; } + std::shared_ptr<osd_window> main_window() const { return m_main; } void set_main_window(std::shared_ptr<osd_window> main) { m_main = main; } // Clips the pointer to the bounds of this window @@ -176,7 +176,7 @@ public: #ifndef OSD_SDL virtual bool win_has_menu() = 0; - // FIXME: cann we replace winwindow_video_window_monitor(NULL) with monitor() ? + // FIXME: cann we replace winwindow_video_window_monitor(nullptr) with monitor() ? virtual osd_monitor_info *winwindow_video_window_monitor(const osd_rect *proposed) = 0; HDC m_dc; // only used by GDI renderer! @@ -225,7 +225,7 @@ public: return m_window.lock(); } - bool has_flags(const int flag) { return ((m_flags & flag)) == flag; } + bool has_flags(const int flag) const { return ((m_flags & flag)) == flag; } void set_flags(int aflag) { m_flags |= aflag; } void clear_flags(int aflag) { m_flags &= ~aflag; } diff --git a/src/osd/modules/output/network.cpp b/src/osd/modules/output/network.cpp index 3bca29f3dbb..95f898fbf41 100644 --- a/src/osd/modules/output/network.cpp +++ b/src/osd/modules/output/network.cpp @@ -27,8 +27,8 @@ public: virtual ~output_network_server() { delete m_tcp_server; } - void terminate_all() { m_tcp_server->terminate(); } - void send_to_all(const uint8_t* data, size_t len) { m_tcp_server->send_to_all(data,len); } + void terminate_all() const { m_tcp_server->terminate(); } + void send_to_all(const uint8_t* data, size_t len) const { m_tcp_server->send_to_all(data,len); } /* Pure virtual methods inherited from raw_tcp_server::listener. */ virtual void on_raw_tcp_connection_closed(raw_tcp_server* tcpServer, raw_tcp_connection* connection, bool is_closed_by_peer) override { } diff --git a/src/osd/modules/render/bgfx/clearreader.cpp b/src/osd/modules/render/bgfx/clearreader.cpp index 78c3d139d25..3cbd714463c 100644 --- a/src/osd/modules/render/bgfx/clearreader.cpp +++ b/src/osd/modules/render/bgfx/clearreader.cpp @@ -30,10 +30,10 @@ clear_state* clear_reader::read_from_value(const Value& value, std::string prefi for (int i = 0; i < colors.Size(); i++) { if (!READER_CHECK(colors[i].IsNumber(), (prefix + "clearcolor[" + std::to_string(i) + "] must be a numeric value\n").c_str())) return nullptr; - int32_t value = int32_t(float(colors[i].GetDouble()) * 255.0f); - if (value > 255) value = 255; - if (value < 0) value = 0; - clear_color |= value << (24 - (i * 3)); + int32_t val = int32_t(float(colors[i].GetDouble()) * 255.0f); + if (val > 255) val = 255; + if (val < 0) val = 0; + clear_color |= val << (24 - (i * 3)); } clear_flags |= BGFX_CLEAR_COLOR; } diff --git a/src/osd/modules/render/bgfx/target.cpp b/src/osd/modules/render/bgfx/target.cpp index 4d1d3ea6b2a..e6ec9061389 100644 --- a/src/osd/modules/render/bgfx/target.cpp +++ b/src/osd/modules/render/bgfx/target.cpp @@ -57,6 +57,7 @@ bgfx_target::bgfx_target(void *handle, uint16_t width, uint16_t height) , m_double_buffer(false) , m_style(TARGET_STYLE_CUSTOM) , m_filter(false) + , m_scale(0) , m_screen(-1) , m_current_page(0) , m_initialized(true) diff --git a/src/osd/modules/render/blit13.h b/src/osd/modules/render/blit13.h index f199fc0f2ea..22a7a1fcea5 100644 --- a/src/osd/modules/render/blit13.h +++ b/src/osd/modules/render/blit13.h @@ -146,7 +146,7 @@ struct blit_texcopy : public blit_base x = texsource->width / (_len_div); while (x > 0) { *dst++ = m_op.op(*src, palbase); - src++; + ++src; x--; } } diff --git a/src/osd/modules/render/d3d/d3dcomm.h b/src/osd/modules/render/d3d/d3dcomm.h index c4ae5b4ff1d..2fd7477ac43 100644 --- a/src/osd/modules/render/d3d/d3dcomm.h +++ b/src/osd/modules/render/d3d/d3dcomm.h @@ -40,12 +40,12 @@ public: c.y = y; } - vec2f operator+(const vec2f& a) + vec2f operator+(const vec2f& a) const { return vec2f(c.x + a.c.x, c.y + a.c.y); } - vec2f operator-(const vec2f& a) + vec2f operator-(const vec2f& a) const { return vec2f(c.x - a.c.x, c.y - a.c.y); } @@ -59,7 +59,9 @@ public: class d3d_texture_manager { public: - d3d_texture_manager() { } + d3d_texture_manager(): m_renderer(nullptr), m_texlist(nullptr), m_dynamic_supported(0), m_stretch_supported(0), m_yuv_format(), m_texture_caps(0), m_texture_max_aspect(0), m_texture_max_width(0), m_texture_max_height(0), m_vector_texture(nullptr), m_default_texture(nullptr) + { } + d3d_texture_manager(renderer_d3d9 *d3d); ~d3d_texture_manager(); @@ -71,22 +73,22 @@ public: texture_info * find_texinfo(const render_texinfo *texture, UINT32 flags); UINT32 texture_compute_hash(const render_texinfo *texture, UINT32 flags); - texture_info * get_texlist() { return m_texlist; } + texture_info * get_texlist() const { return m_texlist; } void set_texlist(texture_info *texlist) { m_texlist = texlist; } - bool is_dynamic_supported() { return (bool)m_dynamic_supported; } + bool is_dynamic_supported() const { return (bool)m_dynamic_supported; } void set_dynamic_supported(bool dynamic_supported) { m_dynamic_supported = dynamic_supported; } - bool is_stretch_supported() { return (bool)m_stretch_supported; } - D3DFORMAT get_yuv_format() { return m_yuv_format; } + bool is_stretch_supported() const { return (bool)m_stretch_supported; } + D3DFORMAT get_yuv_format() const { return m_yuv_format; } - DWORD get_texture_caps() { return m_texture_caps; } - DWORD get_max_texture_aspect() { return m_texture_max_aspect; } - DWORD get_max_texture_width() { return m_texture_max_width; } - DWORD get_max_texture_height() { return m_texture_max_height; } + DWORD get_texture_caps() const { return m_texture_caps; } + DWORD get_max_texture_aspect() const { return m_texture_max_aspect; } + DWORD get_max_texture_width() const { return m_texture_max_width; } + DWORD get_max_texture_height() const { return m_texture_max_height; } - texture_info * get_default_texture() { return m_default_texture; } - texture_info * get_vector_texture() { return m_vector_texture; } + texture_info * get_default_texture() const { return m_default_texture; } + texture_info * get_vector_texture() const { return m_vector_texture; } - renderer_d3d9 * get_d3d() { return m_renderer; } + renderer_d3d9 * get_d3d() const { return m_renderer; } private: renderer_d3d9 * m_renderer; @@ -248,7 +250,9 @@ class cache_target { public: // construction/destruction - cache_target() { } + cache_target(): last_target(nullptr), last_texture(nullptr), target_width(0), target_height(0), width(0), height(0), screen_index(0), next(nullptr), prev(nullptr) + { } + ~cache_target(); bool init(renderer_d3d9 *d3d, d3d_base *d3dintf, int source_width, int source_height, int target_width, int target_height); @@ -273,7 +277,9 @@ class d3d_render_target { public: // construction/destruction - d3d_render_target() { } + d3d_render_target(): target_width(0), target_height(0), width(0), height(0), screen_index(0), page_index(0), next(nullptr), prev(nullptr), bloom_count(0) + { } + ~d3d_render_target(); bool init(renderer_d3d9 *d3d, d3d_base *d3dintf, int source_width, int source_height, int target_width, int target_height); diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 859914d741c..190c324d764 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -276,7 +276,7 @@ void shaders::render_snapshot(surface *surface) // add two text entries describing the image std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(emulator_info::get_build_version()); std::string text2 = std::string(machine->system().manufacturer).append(" ").append(machine->system().description); - png_info pnginfo = { 0 }; + png_info pnginfo = { nullptr }; png_add_text(&pnginfo, "Software", text1.c_str()); png_add_text(&pnginfo, "System", text2.c_str()); diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h index 8851531678e..c7813122308 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.h +++ b/src/osd/modules/render/d3d/d3dhlsl.h @@ -326,7 +326,7 @@ public: void window_save(); void window_record(); - bool recording() { return avi_output_file != nullptr; } + bool recording() const { return avi_output_file != nullptr; } void avi_update_snap(surface *surface); void render_snapshot(surface *surface); diff --git a/src/osd/modules/render/drawd3d.h b/src/osd/modules/render/drawd3d.h index 0777da977b0..3b1083881b3 100644 --- a/src/osd/modules/render/drawd3d.h +++ b/src/osd/modules/render/drawd3d.h @@ -91,36 +91,36 @@ public: void reset_render_states(); // Setters / getters - int get_adapter() { return m_adapter; } - int get_width() { return m_width; } - vec2f get_dims() { return vec2f(m_width, m_height); } - int get_height() { return m_height; } - int get_refresh() { return m_refresh; } + int get_adapter() const { return m_adapter; } + int get_width() const { return m_width; } + vec2f get_dims() const { return vec2f(m_width, m_height); } + int get_height() const { return m_height; } + int get_refresh() const { return m_refresh; } - device * get_device() { return m_device; } + device * get_device() const { return m_device; } present_parameters * get_presentation() { return &m_presentation; } - vertex_buffer * get_vertex_buffer() { return m_vertexbuf; } - vertex * get_locked_buffer() { return m_lockedbuf; } - VOID ** get_locked_buffer_ptr() { return (VOID **)&m_lockedbuf; } + vertex_buffer * get_vertex_buffer() const { return m_vertexbuf; } + vertex * get_locked_buffer() const { return m_lockedbuf; } + VOID ** get_locked_buffer_ptr()const { return (VOID **)&m_lockedbuf; } void set_locked_buffer(vertex *lockedbuf) { m_lockedbuf = lockedbuf; } void set_restarting(bool restarting) { m_restarting = restarting; } - bool is_mod2x_supported() { return (bool)m_mod2x_supported; } - bool is_mod4x_supported() { return (bool)m_mod4x_supported; } + bool is_mod2x_supported() const { return (bool)m_mod2x_supported; } + bool is_mod4x_supported() const { return (bool)m_mod4x_supported; } - D3DFORMAT get_screen_format() { return m_screen_format; } - D3DFORMAT get_pixel_format() { return m_pixformat; } - D3DDISPLAYMODE get_origmode() { return m_origmode; } + D3DFORMAT get_screen_format() const { return m_screen_format; } + D3DFORMAT get_pixel_format() const { return m_pixformat; } + D3DDISPLAYMODE get_origmode() const { return m_origmode; } - UINT32 get_last_texture_flags() { return m_last_texture_flags; } + UINT32 get_last_texture_flags() const { return m_last_texture_flags; } - d3d_texture_manager * get_texture_manager() { return m_texture_manager; } + d3d_texture_manager * get_texture_manager() const { return m_texture_manager; } texture_info * get_default_texture(); texture_info * get_vector_texture(); - shaders * get_shaders() { return m_shaders; } - hlsl_options * get_shaders_options() { return m_shaders_options; } + shaders * get_shaders() const { return m_shaders; } + hlsl_options * get_shaders_options() const { return m_shaders_options; } private: int m_adapter; // ordinal adapter number diff --git a/src/osd/modules/render/drawogl.h b/src/osd/modules/render/drawogl.h index 6b959f1da35..c96c3a45b1b 100644 --- a/src/osd/modules/render/drawogl.h +++ b/src/osd/modules/render/drawogl.h @@ -42,7 +42,7 @@ public: : hash(0), flags(0), rawwidth(0), rawheight(0), rawwidth_create(0), rawheight_create(0), type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0), - texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL), + texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(nullptr), data_own(0), texCoordBufferName(0) { for (int i=0; i<2; i++) @@ -101,7 +101,7 @@ public: , m_width(0) , m_height(0) , m_blit_dim(0, 0) - , m_gl_context(NULL) + , m_gl_context(nullptr) , m_initialized(0) , m_last_blendmode(0) , m_texture_max_width(0) @@ -122,7 +122,7 @@ public: , m_surf_h(0) { for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++) - m_texhash[i] = NULL; + m_texhash[i] = nullptr; for (int i=0; i < 2*GLSL_SHADER_MAX; i++) m_glsl_program[i] = 0; for (int i=0; i < 8; i++) diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index 38d18f42aa8..622c360df7e 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -59,9 +59,9 @@ static void yuv_RGB_to_YUY2X2(const UINT16 *bitmap, UINT8 *ptr, const int pitch, static const sdl_scale_mode scale_modes[] = { - { "none", 0, 0, 1, 1, DRAW2_SCALEMODE_NEAREST, 0, 0 }, - { "hwblit", 1, 0, 1, 1, DRAW2_SCALEMODE_LINEAR, 0, 0 }, - { "hwbest", 1, 0, 1, 1, DRAW2_SCALEMODE_BEST, 0, 0 }, + { "none", 0, 0, 1, 1, DRAW2_SCALEMODE_NEAREST, 0, nullptr }, + { "hwblit", 1, 0, 1, 1, DRAW2_SCALEMODE_LINEAR, 0, nullptr }, + { "hwbest", 1, 0, 1, 1, DRAW2_SCALEMODE_BEST, 0, nullptr }, /* SDL1.2 uses interpolation as well */ { "yv12", 1, 1, 1, 1, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YV12, yuv_RGB_to_YV12 }, { "yv12x2", 1, 1, 2, 2, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YV12, yuv_RGB_to_YV12X2 }, diff --git a/src/osd/modules/render/sdlglcontext.h b/src/osd/modules/render/sdlglcontext.h index 9a3194582ac..e20c351908a 100644 --- a/src/osd/modules/render/sdlglcontext.h +++ b/src/osd/modules/render/sdlglcontext.h @@ -45,7 +45,7 @@ public: virtual const char *LastErrorMsg() override { if (m_error[0] == 0) - return NULL; + return nullptr; else return m_error; } diff --git a/src/osd/modules/render/winglcontext.h b/src/osd/modules/render/winglcontext.h index de8e6537707..843532fe33f 100644 --- a/src/osd/modules/render/winglcontext.h +++ b/src/osd/modules/render/winglcontext.h @@ -18,7 +18,7 @@ class win_gl_context : public osd_gl_context { public: - win_gl_context(HWND window) : osd_gl_context(), m_context(0), m_window(NULL), m_hdc(0) + win_gl_context(HWND window) : osd_gl_context(), m_context(0), m_window(nullptr), m_hdc(0) { m_error[0] = 0; @@ -36,8 +36,8 @@ public: } else { - pfn_wglSwapIntervalEXT = NULL; - pfn_wglGetSwapIntervalEXT = NULL; + pfn_wglSwapIntervalEXT = nullptr; + pfn_wglGetSwapIntervalEXT = nullptr; } m_hdc = GetDC(window); @@ -46,7 +46,7 @@ public: m_context = this->pfn_wglCreateContext(m_hdc); if (!m_context) { - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, m_error, 255, NULL); + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, GetLastError(), 0, m_error, 255, nullptr); return; } this->pfn_wglMakeCurrent(m_hdc, m_context); @@ -67,7 +67,7 @@ public: virtual const char *LastErrorMsg() override { if (m_error[0] == 0) - return NULL; + return nullptr; else return m_error; } @@ -75,14 +75,14 @@ public: virtual void *getProcAddress(const char *proc) override { void *ret = (void *) GetProcAddress(m_module, proc); - if (ret == NULL) + if (ret == nullptr) ret = (void *) this->pfn_wglGetProcAddress(proc); return ret; } virtual int SetSwapInterval(const int swap) override { - if (this->pfn_wglSwapIntervalEXT != NULL) + if (this->pfn_wglSwapIntervalEXT != nullptr) { this->pfn_wglSwapIntervalEXT(swap ? 1 : 0); } @@ -141,10 +141,10 @@ private: bool WGLExtensionSupported(const char *extension_name) { - //if (pfn_wglGetExtensionsStringEXT != NULL) + //if (pfn_wglGetExtensionsStringEXT != nullptr) // printf("%s\n", this->pfn_wglGetExtensionsStringEXT()); - if (pfn_wglGetExtensionsStringEXT != NULL && strstr(pfn_wglGetExtensionsStringEXT(), extension_name) != NULL) + if (pfn_wglGetExtensionsStringEXT != nullptr && strstr(pfn_wglGetExtensionsStringEXT(), extension_name) != nullptr) return true; else return false; diff --git a/src/osd/modules/sound/coreaudio_sound.cpp b/src/osd/modules/sound/coreaudio_sound.cpp index ff6303b0df8..88ce712a396 100644 --- a/src/osd/modules/sound/coreaudio_sound.cpp +++ b/src/osd/modules/sound/coreaudio_sound.cpp @@ -39,12 +39,12 @@ public: sound_coreaudio() : osd_module(OSD_SOUND_PROVIDER, "coreaudio"), sound_module(), - m_graph(NULL), + m_graph(nullptr), m_node_count(0), m_sample_bytes(0), m_headroom(0), m_buffer_size(0), - m_buffer(NULL), + m_buffer(nullptr), m_playpos(0), m_writepos(0), m_in_underrun(false), @@ -68,7 +68,7 @@ public: private: struct node_detail { - node_detail() : m_node(0), m_unit(NULL) { } + node_detail() : m_node(0), m_unit(nullptr) { } AUNode m_node; AudioUnit m_unit; @@ -110,7 +110,7 @@ private: return AUGraphNodeInfo( m_graph, m_node_details[m_node_count].m_node, - NULL, + nullptr, &m_node_details[m_node_count].m_unit); } @@ -150,7 +150,7 @@ private: if (!CFStringGetCString(str, result, len + 1, kCFStringEncodingUTF8)) { global_free_array(result); - return NULL; + return nullptr; } return result; } @@ -261,11 +261,11 @@ int sound_coreaudio::init(const osd_options &options) free_buffer_and_return_error: global_free_array(m_buffer); m_buffer_size = 0; - m_buffer = NULL; + m_buffer = nullptr; close_graph_and_return_error: AUGraphClose(m_graph); DisposeAUGraph(m_graph); - m_graph = NULL; + m_graph = nullptr; m_node_count = 0; return -1; } @@ -280,13 +280,13 @@ void sound_coreaudio::exit() AUGraphStop(m_graph); AUGraphUninitialize(m_graph); DisposeAUGraph(m_graph); - m_graph = NULL; + m_graph = nullptr; m_node_count = 0; } if (m_buffer) { global_free_array(m_buffer); - m_buffer = NULL; + m_buffer = nullptr; } if (m_overflows || m_underflows) osd_printf_verbose("Sound buffer: overflows=%u underflows=%u\n", m_overflows, m_underflows); @@ -373,7 +373,7 @@ bool sound_coreaudio::create_graph(osd_options const &options) goto close_graph_and_return_error; } - err = AUGraphUpdate(m_graph, NULL); + err = AUGraphUpdate(m_graph, nullptr); if (noErr != err) { osd_printf_error( @@ -389,7 +389,7 @@ close_graph_and_return_error: dispose_graph_and_return_error: DisposeAUGraph(m_graph); return_error: - m_graph = NULL; + m_graph = nullptr; m_node_count = 0; return false; } @@ -537,7 +537,7 @@ bool sound_coreaudio::add_effect(char const *name) return true; CFPropertyListRef const properties = load_property_list(name); - if (NULL == properties) + if (nullptr == properties) return true; OSType type, subtype, manufacturer; @@ -589,7 +589,7 @@ bool sound_coreaudio::add_effect(char const *name) kAUParameterListener_AnyParameter, 0, 0 }; - err = AUParameterListenerNotify(NULL, NULL, &change); + err = AUParameterListenerNotify(nullptr, nullptr, &change); } if (noErr != err) { @@ -640,7 +640,7 @@ bool sound_coreaudio::get_output_device_id( kAudioObjectSystemObject, &devices_addr, 0, - NULL, + nullptr, &property_size); if (noErr != err) { @@ -654,7 +654,7 @@ bool sound_coreaudio::get_output_device_id( kAudioObjectSystemObject, &devices_addr, 0, - NULL, + nullptr, &property_size, devices); UInt32 const device_count = property_size / sizeof(AudioDeviceID); @@ -669,7 +669,7 @@ bool sound_coreaudio::get_output_device_id( { char *const device_uid = get_device_uid(devices[i]); char *const device_name = get_device_name(devices[i]); - if ((NULL == device_uid) && (NULL == device_name)) + if ((nullptr == device_uid) && (nullptr == device_name)) { osd_printf_warning( "Could not get UID or name for device %lu - skipping\n", @@ -685,10 +685,10 @@ bool sound_coreaudio::get_output_device_id( { osd_printf_verbose( "No output streams found for device %s (%s) - skipping\n", - (NULL != device_name) ? device_name : "<anonymous>", - (NULL != device_uid) ? device_uid : "<unknown>"); - if (NULL != device_uid) global_free_array(device_uid); - if (NULL != device_name) global_free_array(device_name); + (nullptr != device_name) ? device_name : "<anonymous>", + (nullptr != device_uid) ? device_uid : "<unknown>"); + if (nullptr != device_uid) global_free_array(device_uid); + if (nullptr != device_name) global_free_array(device_name); continue; } @@ -697,14 +697,14 @@ bool sound_coreaudio::get_output_device_id( for (std::size_t j = strlen(device_name); (0 < j) && (' ' == device_name[j - 1]); j--) device_name[j - 1] = '\0'; - bool const matched_uid = (NULL != device_uid) && !strcmp(name, device_uid); - bool const matched_name = (NULL != device_name) && !strcmp(name, device_name); + bool const matched_uid = (nullptr != device_uid) && !strcmp(name, device_uid); + bool const matched_name = (nullptr != device_name) && !strcmp(name, device_name); if (matched_uid || matched_name) { osd_printf_verbose( "Matched device %s (%s) with %lu output stream(s)\n", - (NULL != device_name) ? device_name : "<anonymous>", - (NULL != device_uid) ? device_uid : "<unknown>", + (nullptr != device_name) ? device_name : "<anonymous>", + (nullptr != device_uid) ? device_uid : "<unknown>", (unsigned long)streams); } global_free_array(device_uid); @@ -730,26 +730,26 @@ char *sound_coreaudio::get_device_uid(AudioDeviceID id) const kAudioDevicePropertyDeviceUID, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; - CFStringRef device_uid = NULL; + CFStringRef device_uid = nullptr; UInt32 property_size = sizeof(device_uid); OSStatus const err = AudioObjectGetPropertyData( id, &uid_addr, 0, - NULL, + nullptr, &property_size, &device_uid); - if ((noErr != err) || (NULL == device_uid)) + if ((noErr != err) || (nullptr == device_uid)) { osd_printf_warning( "Error getting UID for audio device %lu (%ld)\n", (unsigned long)id, (long)err); - return NULL; + return nullptr; } char *const result = convert_cfstring_to_utf8(device_uid); CFRelease(device_uid); - if (NULL == result) + if (nullptr == result) { osd_printf_warning( "Error converting UID for audio device %lu to UTF-8\n", @@ -765,26 +765,26 @@ char *sound_coreaudio::get_device_name(AudioDeviceID id) const kAudioDevicePropertyDeviceNameCFString, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; - CFStringRef device_name = NULL; + CFStringRef device_name = nullptr; UInt32 property_size = sizeof(device_name); OSStatus const err = AudioObjectGetPropertyData( id, &name_addr, 0, - NULL, + nullptr, &property_size, &device_name); - if ((noErr != err) || (NULL == device_name)) + if ((noErr != err) || (nullptr == device_name)) { osd_printf_warning( "Error getting name for audio device %lu (%ld)\n", (unsigned long)id, (long)err); - return NULL; + return nullptr; } char *const result = convert_cfstring_to_utf8(device_name); CFRelease(device_name); - if (NULL == result) + if (nullptr == result) { osd_printf_warning( "Error converting name for audio device %lu to UTF-8\n", @@ -808,14 +808,14 @@ UInt32 sound_coreaudio::get_output_stream_count( id, &streams_addr, 0, - NULL, + nullptr, &property_size); if (noErr != err) { osd_printf_warning( "Error getting output stream count for audio device %s (%s) (%ld)\n", - (NULL != name) ? name : "<anonymous>", - (NULL != uid) ? uid : "<unknown>", + (nullptr != name) ? name : "<anonymous>", + (nullptr != uid) ? uid : "<unknown>", (long)err); return 0; } @@ -840,9 +840,9 @@ bool sound_coreaudio::extract_effect_info( } CFDictionaryRef const desc = (CFDictionaryRef)properties; - CFTypeRef type_val = NULL; - CFTypeRef subtype_val = NULL; - CFTypeRef manufacturer_val = NULL; + CFTypeRef type_val = nullptr; + CFTypeRef subtype_val = nullptr; + CFTypeRef manufacturer_val = nullptr; if (CFDictionaryContainsKey(desc, CFSTR("ComponentType")) && CFDictionaryContainsKey(desc, CFSTR("ComponentSubType")) && CFDictionaryContainsKey(desc, CFSTR("ComponentManufacturer")) @@ -871,10 +871,10 @@ bool sound_coreaudio::extract_effect_info( } SInt64 type_int, subtype_int, manufacturer_int; - if ((NULL == type_val) - || (NULL == subtype_val) - || (NULL == manufacturer_val) - || (NULL == class_info) + if ((nullptr == type_val) + || (nullptr == subtype_val) + || (nullptr == manufacturer_val) + || (nullptr == class_info) || (CFNumberGetTypeID() != CFGetTypeID(type_val)) || (CFNumberGetTypeID() != CFGetTypeID(subtype_val)) || (CFNumberGetTypeID() != CFGetTypeID(manufacturer_val)) @@ -909,23 +909,23 @@ bool sound_coreaudio::extract_effect_info( CFPropertyListRef sound_coreaudio::load_property_list(char const *name) const { CFURLRef const url = CFURLCreateFromFileSystemRepresentation( - NULL, + nullptr, (UInt8 const *)name, strlen(name), false); - if (NULL == url) + if (nullptr == url) { - return NULL; + return nullptr; } - CFDataRef data = NULL; + CFDataRef data = nullptr; SInt32 err; Boolean const status = CFURLCreateDataAndPropertiesFromResource( - NULL, + nullptr, url, &data, - NULL, - NULL, + nullptr, + nullptr, &err); CFRelease(url); if (!status) @@ -934,24 +934,24 @@ CFPropertyListRef sound_coreaudio::load_property_list(char const *name) const "Error reading data from %s (%ld)\n", name, (long)err); - if (NULL != data) CFRelease(data); - return NULL; + if (nullptr != data) CFRelease(data); + return nullptr; } - CFStringRef msg = NULL; + CFStringRef msg = nullptr; CFPropertyListRef const result = CFPropertyListCreateFromXMLData( - NULL, + nullptr, data, kCFPropertyListImmutable, &msg); CFRelease(data); - if ((NULL == result) || (NULL != msg)) + if ((nullptr == result) || (nullptr != msg)) { - char *buf = (NULL != msg) ? convert_cfstring_to_utf8(msg) : NULL; - if (NULL != msg) + char *buf = (nullptr != msg) ? convert_cfstring_to_utf8(msg) : nullptr; + if (nullptr != msg) CFRelease(msg); - if (NULL != buf) + if (nullptr != buf) { osd_printf_error( "Error creating property list from %s: %s\n", @@ -965,8 +965,8 @@ CFPropertyListRef sound_coreaudio::load_property_list(char const *name) const "Error creating property list from %s\n", name); } - if (NULL != result) CFRelease(result); - return NULL; + if (nullptr != result) CFRelease(result); + return nullptr; } return result; diff --git a/src/osd/modules/sound/direct_sound.cpp b/src/osd/modules/sound/direct_sound.cpp index 5b20cfb61fa..25a82146d6b 100644 --- a/src/osd/modules/sound/direct_sound.cpp +++ b/src/osd/modules/sound/direct_sound.cpp @@ -51,7 +51,7 @@ public: sound_direct_sound() : osd_module(OSD_SOUND_PROVIDER, "dsound"), sound_module(), - m_dsound(NULL), + m_dsound(nullptr), m_bytes_per_sample(0), m_primary_buffer(), m_stream_buffer(), @@ -73,13 +73,13 @@ private: class buffer { public: - buffer() : m_buffer(NULL) { } + buffer() : m_buffer(nullptr) { } ~buffer() { release(); } ULONG release() { ULONG const result = m_buffer ? m_buffer->Release() : 0; - m_buffer = NULL; + m_buffer = nullptr; return result; } @@ -99,16 +99,16 @@ private: memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_GETCURRENTPOSITION2; - desc.lpwfxFormat = NULL; - return dsound->CreateSoundBuffer(&desc, &m_buffer, NULL); + desc.lpwfxFormat = nullptr; + return dsound->CreateSoundBuffer(&desc, &m_buffer, nullptr); } - HRESULT get_format(WAVEFORMATEX &format) + HRESULT get_format(WAVEFORMATEX &format) const { assert(m_buffer); - return m_buffer->GetFormat(&format, sizeof(format), NULL); + return m_buffer->GetFormat(&format, sizeof(format), nullptr); } - HRESULT set_format(WAVEFORMATEX const &format) + HRESULT set_format(WAVEFORMATEX const &format) const { assert(m_buffer); return m_buffer->SetFormat(&format); @@ -118,7 +118,7 @@ private: class stream_buffer : public buffer { public: - stream_buffer() : m_size(0), m_bytes1(NULL), m_bytes2(NULL), m_locked1(0), m_locked2(0) { } + stream_buffer() : m_size(0), m_bytes1(nullptr), m_bytes2(nullptr), m_locked1(0), m_locked2(0) { } HRESULT create(LPDIRECTSOUND dsound, DWORD size, WAVEFORMATEX &format) { @@ -130,27 +130,27 @@ private: desc.dwBufferBytes = size; desc.lpwfxFormat = &format; m_size = size; - return dsound->CreateSoundBuffer(&desc, &m_buffer, NULL); + return dsound->CreateSoundBuffer(&desc, &m_buffer, nullptr); } - HRESULT play_looping() + HRESULT play_looping() const { assert(m_buffer); return m_buffer->Play(0, 0, DSBPLAY_LOOPING); } - HRESULT stop() + HRESULT stop() const { assert(m_buffer); return m_buffer->Stop(); } - HRESULT set_volume(LONG volume) + HRESULT set_volume(LONG volume) const { assert(m_buffer); return m_buffer->SetVolume(volume); } HRESULT set_min_volume() { return set_volume(DSBVOLUME_MIN); } - HRESULT get_current_positions(DWORD &play_pos, DWORD &write_pos) + HRESULT get_current_positions(DWORD &play_pos, DWORD &write_pos) const { assert(m_buffer); return m_buffer->GetCurrentPosition(&play_pos, &write_pos); @@ -216,7 +216,7 @@ private: m_locked1, m_bytes2, m_locked2); - m_bytes1 = m_bytes2 = NULL; + m_bytes1 = m_bytes2 = nullptr; m_locked1 = m_locked2 = 0; return result; } @@ -382,7 +382,7 @@ HRESULT sound_direct_sound::dsound_init() HRESULT result; // create the DirectSound object - result = DirectSoundCreate(NULL, &m_dsound, NULL); + result = DirectSoundCreate(nullptr, &m_dsound, nullptr); if (result != DS_OK) { osd_printf_error("Error creating DirectSound: %08x\n", (unsigned)result); @@ -467,7 +467,7 @@ void sound_direct_sound::dsound_kill() // release the object if (m_dsound) m_dsound->Release(); - m_dsound = NULL; + m_dsound = nullptr; } diff --git a/src/osd/modules/sound/sdl_sound.cpp b/src/osd/modules/sound/sdl_sound.cpp index c1e3e3dff2b..31c2d651f1d 100644 --- a/src/osd/modules/sound/sdl_sound.cpp +++ b/src/osd/modules/sound/sdl_sound.cpp @@ -51,8 +51,8 @@ public: : osd_module(OSD_SOUND_PROVIDER, "sdl"), sound_module(), stream_in_initialized(0), stream_loop(0), - attenuation(0) - { + attenuation(0), buf_locked(0), stream_buffer(nullptr), stream_playpos(0), stream_buffer_size(0), stream_buffer_in(0), buffer_underflows(0), buffer_overflows(0) +{ sdl_xfer_samples = SDL_XFER_SAMPLES; } virtual ~sound_sdl() { } @@ -200,7 +200,7 @@ void sound_sdl::att_memcpy(void *dest, const INT16 *data, int bytes_to_copy) void sound_sdl::copy_sample_data(bool is_throttled, const INT16 *data, int bytes_to_copy) { - void *buffer1, *buffer2 = (void *)NULL; + void *buffer1, *buffer2 = (void *)nullptr; long length1, length2; int cur_bytes; @@ -529,7 +529,7 @@ void sound_sdl::sdl_destroy_buffers(void) // release the buffer if (stream_buffer) global_free_array(stream_buffer); - stream_buffer = NULL; + stream_buffer = nullptr; } diff --git a/src/osd/modules/sound/sound_module.h b/src/osd/modules/sound/sound_module.h index b467cea8177..c68a943bcce 100644 --- a/src/osd/modules/sound/sound_module.h +++ b/src/osd/modules/sound/sound_module.h @@ -27,7 +27,7 @@ public: virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) = 0; virtual void set_mastervolume(int attenuation) = 0; - int sample_rate() { return m_sample_rate; } + int sample_rate() const { return m_sample_rate; } int m_sample_rate; int m_audio_latency; diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h index 623c3ee3f11..c712b3fea8e 100644 --- a/src/osd/osdcore.h +++ b/src/osd/osdcore.h @@ -330,7 +330,7 @@ struct osd_directory_entry upon success, this function should return an osd_directory pointer which contains opaque data necessary to traverse the directory; on - failure, this function should return NULL + failure, this function should return nullptr -----------------------------------------------------------------------------*/ osd_directory *osd_opendir(const char *dirname); @@ -346,7 +346,7 @@ osd_directory *osd_opendir(const char *dirname); Return value: a constant pointer to an osd_directory_entry representing the current item - in the directory, or NULL, indicating that no more entries are + in the directory, or nullptr, indicating that no more entries are present -----------------------------------------------------------------------------*/ const osd_directory_entry *osd_readdir(osd_directory *dir); @@ -901,7 +901,7 @@ public: static void pop(osd_output *delegate); protected: - void chain_output(osd_output_channel channel, const char *msg, va_list args) + void chain_output(osd_output_channel channel, const char *msg, va_list args) const { if (m_chain != nullptr) m_chain->output_callback(channel, msg, args); diff --git a/src/osd/osdsync.cpp b/src/osd/osdsync.cpp index 84c8bac6ccb..20d5151c8a6 100644 --- a/src/osd/osdsync.cpp +++ b/src/osd/osdsync.cpp @@ -269,7 +269,7 @@ osd_work_queue *osd_work_queue_alloc(int flags) else threadnum = (flags & WORK_QUEUE_FLAG_MULTI) ? (numprocs - 1) : 1; - if (osdworkqueuemaxthreads != NULL && sscanf(osdworkqueuemaxthreads, "%d", &osdthreadnum) == 1 && threadnum > osdthreadnum) + if (osdworkqueuemaxthreads != nullptr && sscanf(osdworkqueuemaxthreads, "%d", &osdthreadnum) == 1 && threadnum > osdthreadnum) threadnum = osdthreadnum; // clamp to the maximum @@ -315,7 +315,7 @@ osd_work_queue *osd_work_queue_alloc(int flags) error: osd_work_queue_free(queue); - return NULL; + return nullptr; } @@ -406,7 +406,7 @@ void osd_work_queue_free(osd_work_queue *queue) work_thread_info *thread = queue->thread[threadnum]; // block on the thread going away, then close the handle - if (thread->handle != NULL) + if (thread->handle != nullptr) { thread->handle->join(); delete thread->handle; @@ -439,7 +439,7 @@ void osd_work_queue_free(osd_work_queue *queue) { osd_work_item *item = (osd_work_item *)queue->free; queue->free = item->next; - if (item->event != NULL) + if (item->event != nullptr) delete item->event; delete item; } @@ -449,7 +449,7 @@ void osd_work_queue_free(osd_work_queue *queue) { osd_work_item *item = (osd_work_item *)queue->list; queue->list = item->next; - if (item->event != NULL) + if (item->event != nullptr) delete item->event; delete item; } @@ -472,7 +472,7 @@ void osd_work_queue_free(osd_work_queue *queue) osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_callback callback, INT32 numitems, void *parambase, INT32 paramstep, UINT32 flags) { - osd_work_item *itemlist = NULL, *lastitem = NULL; + osd_work_item *itemlist = nullptr, *lastitem = nullptr; osd_work_item **item_tailptr = &itemlist; int itemnum; @@ -487,16 +487,16 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call do { item = (osd_work_item *)queue->free; - } while (item != NULL && !queue->free.compare_exchange_weak(item, item->next, std::memory_order_release, std::memory_order_relaxed)); + } while (item != nullptr && !queue->free.compare_exchange_weak(item, item->next, std::memory_order_release, std::memory_order_relaxed)); } // if nothing, allocate something new - if (item == NULL) + if (item == nullptr) { // allocate the item item = new osd_work_item(*queue); - if (item == NULL) - return NULL; + if (item == nullptr) + return nullptr; } else { @@ -504,10 +504,10 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call } // fill in the basics - item->next = NULL; + item->next = nullptr; item->callback = callback; item->param = parambase; - item->result = NULL; + item->result = nullptr; item->flags = flags; // advance to the next @@ -559,7 +559,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call begin_timing(queue->thread[0]->waittime); } // only return the item if it won't get released automatically - return (flags & WORK_ITEM_FLAG_AUTO_RELEASE) ? NULL : lastitem; + return (flags & WORK_ITEM_FLAG_AUTO_RELEASE) ? nullptr : lastitem; } @@ -574,7 +574,7 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout) return TRUE; // if we don't have an event, create one - if (item->event == NULL) + if (item->event == nullptr) { std::lock_guard<std::mutex> lock(item->queue.lock); item->event = new osd_event(TRUE, FALSE); // manual reset, not signalled @@ -583,7 +583,7 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout) item->event->reset(); // if we don't have an event, we need to spin (shouldn't ever really happen) - if (item->event == NULL) + if (item->event == nullptr) { // TODO: do we need to measure the spin time here as well? and how can we do it? spin_while<std::atomic<int>,int>(&item->done, 0, timeout); @@ -649,7 +649,7 @@ static int effective_num_processors(void) // if the OSDPROCESSORS environment variable is set, use that value if valid // note that we permit more than the real number of processors for testing const char *procsoverride = osd_getenv(ENV_PROCESSORS); - if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0) + if (procsoverride != nullptr && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0) return MIN(4 * physprocs, numprocs); // otherwise, return the info from the system @@ -715,7 +715,7 @@ static void *worker_thread_entry(void *param) --queue.livethreads; } - return NULL; + return nullptr; } @@ -732,7 +732,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa // loop until everything is processed while (true) { - osd_work_item *item = NULL; + osd_work_item *item = nullptr; bool end_loop = false; @@ -748,7 +748,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa { // pull the item from the queue item = (osd_work_item *)queue->list; - if (item != NULL) + if (item != nullptr) { queue->list = item->next; if (queue->list.load() == nullptr) @@ -761,7 +761,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa break; // process non-NULL items - if (item != NULL) + if (item != nullptr) { // call the callback and stash the result begin_timing(thread->actruntime); @@ -782,7 +782,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa { std::lock_guard<std::mutex> lock(queue->lock); - if (item->event != NULL) + if (item->event != nullptr) { item->event->set(); add_to_stat(item->queue.setevents, 1); diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index c45c807efd5..46a1faa606b 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -140,7 +140,7 @@ public: bool should_hide_mouse(); void process_events_buf(); - sdl_options &options() { return m_options; } + virtual sdl_options &options() override { return m_options; } protected: virtual void build_slider_list() override; diff --git a/src/osd/sdl/sdldir.cpp b/src/osd/sdl/sdldir.cpp index abf1f126b94..fcae732ed53 100644 --- a/src/osd/sdl/sdldir.cpp +++ b/src/osd/sdl/sdldir.cpp @@ -139,7 +139,7 @@ static UINT64 osd_get_file_size(const char *file) osd_directory *osd_opendir(const char *dirname) { - osd_directory *dir = NULL; + osd_directory *dir = nullptr; char *tmpstr, *envstr; int i, j; @@ -147,7 +147,7 @@ osd_directory *osd_opendir(const char *dirname) if (dir) { memset(dir, 0, sizeof(osd_directory)); - dir->fd = NULL; + dir->fd = nullptr; } tmpstr = (char *) osd_malloc_array(strlen(dirname)+1); @@ -168,7 +168,7 @@ osd_directory *osd_opendir(const char *dirname) envstr[i] = '\0'; const char *envval = osd_getenv(&envstr[1]); - if (envval != NULL) + if (envval != nullptr) { j = strlen(envval) + strlen(tmpstr) + 1; osd_free(tmpstr); @@ -189,11 +189,11 @@ osd_directory *osd_opendir(const char *dirname) dir->fd = opendir(tmpstr); dir->path = tmpstr; - if (dir && (dir->fd == NULL)) + if (dir && (dir->fd == nullptr)) { osd_free(dir->path); osd_free(dir); - dir = NULL; + dir = nullptr; } return dir; @@ -209,8 +209,8 @@ const osd_directory_entry *osd_readdir(osd_directory *dir) char *temp; dir->data = sdl_readdir(dir->fd); - if (dir->data == NULL) - return NULL; + if (dir->data == nullptr) + return nullptr; dir->ent.name = dir->data->d_name; temp = build_full_path(dir->path, dir->data->d_name); @@ -231,7 +231,7 @@ const osd_directory_entry *osd_readdir(osd_directory *dir) void osd_closedir(osd_directory *dir) { - if (dir->fd != NULL) + if (dir->fd != nullptr) closedir(dir->fd); osd_free(dir->path); osd_free(dir); diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp index a465e64655a..5112b3a3628 100644 --- a/src/osd/sdl/sdlmain.cpp +++ b/src/osd/sdl/sdlmain.cpp @@ -85,10 +85,10 @@ const options_entry sdl_options::s_option_entries[] = { SDLOPTION_INIPATH, INI_PATH, OPTION_STRING, "path to ini files" }, // performance options - { NULL, NULL, OPTION_HEADER, "SDL PERFORMANCE OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "SDL PERFORMANCE OPTIONS" }, { SDLOPTION_SDLVIDEOFPS, "0", OPTION_BOOLEAN, "show sdl video performance" }, // video options - { NULL, NULL, OPTION_HEADER, "SDL VIDEO OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "SDL VIDEO OPTIONS" }, // OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience { SDLOPTION_CENTERH, "1", OPTION_BOOLEAN, "center horizontally within the view area" }, { SDLOPTION_CENTERV, "1", OPTION_BOOLEAN, "center vertically within the view area" }, @@ -96,17 +96,17 @@ const options_entry sdl_options::s_option_entries[] = // full screen options #ifdef SDLMAME_X11 - { NULL, NULL, OPTION_HEADER, "SDL FULL SCREEN OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "SDL FULL SCREEN OPTIONS" }, { SDLOPTION_USEALLHEADS, "0", OPTION_BOOLEAN, "split full screen image across monitors" }, #endif // keyboard mapping - { NULL, NULL, OPTION_HEADER, "SDL KEYBOARD MAPPING" }, + { nullptr, nullptr, OPTION_HEADER, "SDL KEYBOARD MAPPING" }, { SDLOPTION_KEYMAP, "0", OPTION_BOOLEAN, "enable keymap" }, { SDLOPTION_KEYMAP_FILE, "keymap.dat", OPTION_STRING, "keymap filename" }, // joystick mapping - { NULL, NULL, OPTION_HEADER, "SDL JOYSTICK MAPPING" }, + { nullptr, nullptr, OPTION_HEADER, "SDL JOYSTICK MAPPING" }, { SDLOPTION_JOYINDEX "1", OSDOPTVAL_AUTO, OPTION_STRING, "name of joystick mapped to joystick #1" }, { SDLOPTION_JOYINDEX "2", OSDOPTVAL_AUTO, OPTION_STRING, "name of joystick mapped to joystick #2" }, { SDLOPTION_JOYINDEX "3", OSDOPTVAL_AUTO, OPTION_STRING, "name of joystick mapped to joystick #3" }, @@ -119,7 +119,7 @@ const options_entry sdl_options::s_option_entries[] = #if (USE_XINPUT) // lightgun mapping - { NULL, NULL, OPTION_HEADER, "SDL LIGHTGUN MAPPING" }, + { nullptr, nullptr, OPTION_HEADER, "SDL LIGHTGUN MAPPING" }, { SDLOPTION_LIGHTGUNINDEX "1", OSDOPTVAL_AUTO, OPTION_STRING, "name of lightgun mapped to lightgun #1" }, { SDLOPTION_LIGHTGUNINDEX "2", OSDOPTVAL_AUTO, OPTION_STRING, "name of lightgun mapped to lightgun #2" }, { SDLOPTION_LIGHTGUNINDEX "3", OSDOPTVAL_AUTO, OPTION_STRING, "name of lightgun mapped to lightgun #3" }, @@ -130,7 +130,7 @@ const options_entry sdl_options::s_option_entries[] = { SDLOPTION_LIGHTGUNINDEX "8", OSDOPTVAL_AUTO, OPTION_STRING, "name of lightgun mapped to lightgun #8" }, #endif - { NULL, NULL, OPTION_HEADER, "SDL MOUSE MAPPING" }, + { nullptr, nullptr, OPTION_HEADER, "SDL MOUSE MAPPING" }, { SDLOPTION_MOUSEINDEX "1", OSDOPTVAL_AUTO, OPTION_STRING, "name of mouse mapped to mouse #1" }, { SDLOPTION_MOUSEINDEX "2", OSDOPTVAL_AUTO, OPTION_STRING, "name of mouse mapped to mouse #2" }, { SDLOPTION_MOUSEINDEX "3", OSDOPTVAL_AUTO, OPTION_STRING, "name of mouse mapped to mouse #3" }, @@ -140,7 +140,7 @@ const options_entry sdl_options::s_option_entries[] = { SDLOPTION_MOUSEINDEX "7", OSDOPTVAL_AUTO, OPTION_STRING, "name of mouse mapped to mouse #7" }, { SDLOPTION_MOUSEINDEX "8", OSDOPTVAL_AUTO, OPTION_STRING, "name of mouse mapped to mouse #8" }, - { NULL, NULL, OPTION_HEADER, "SDL KEYBOARD MAPPING" }, + { nullptr, nullptr, OPTION_HEADER, "SDL KEYBOARD MAPPING" }, { SDLOPTION_KEYBINDEX "1", OSDOPTVAL_AUTO, OPTION_STRING, "name of keyboard mapped to keyboard #1" }, { SDLOPTION_KEYBINDEX "2", OSDOPTVAL_AUTO, OPTION_STRING, "name of keyboard mapped to keyboard #2" }, { SDLOPTION_KEYBINDEX "3", OSDOPTVAL_AUTO, OPTION_STRING, "name of keyboard mapped to keyboard #3" }, @@ -151,7 +151,7 @@ const options_entry sdl_options::s_option_entries[] = { SDLOPTION_KEYBINDEX "8", OSDOPTVAL_AUTO, OPTION_STRING, "name of keyboard mapped to keyboard #8" }, // SDL low level driver options - { NULL, NULL, OPTION_HEADER, "SDL LOWLEVEL DRIVER OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "SDL LOWLEVEL DRIVER OPTIONS" }, { SDLOPTION_VIDEODRIVER ";vd", OSDOPTVAL_AUTO, OPTION_STRING, "sdl video driver to use ('x11', 'directfb', ... or 'auto' for SDL default" }, { SDLOPTION_RENDERDRIVER ";rd", OSDOPTVAL_AUTO, OPTION_STRING, "sdl render driver to use ('software', 'opengl', 'directfb' ... or 'auto' for SDL default" }, { SDLOPTION_AUDIODRIVER ";ad", OSDOPTVAL_AUTO, OPTION_STRING, "sdl audio driver to use ('alsa', 'arts', ... or 'auto' for SDL default" }, @@ -160,7 +160,7 @@ const options_entry sdl_options::s_option_entries[] = #endif // End of list - { NULL } + { nullptr } }; //============================================================ @@ -193,8 +193,8 @@ int main(int argc, char *argv[]) int res = 0; // disable I/O buffering - setvbuf(stdout, (char *) NULL, _IONBF, 0); - setvbuf(stderr, (char *) NULL, _IONBF, 0); + setvbuf(stdout, (char *) nullptr, _IONBF, 0); + setvbuf(stderr, (char *) nullptr, _IONBF, 0); // Initialize crash diagnostics diagnostics_module::get_instance()->init_crash_diagnostics(); @@ -390,10 +390,10 @@ static void osd_sdl_info(void) void sdl_osd_interface::video_register() { - video_options_add("soft", NULL); - video_options_add("opengl", NULL); - video_options_add("bgfx", NULL); - //video_options_add("auto", NULL); // making d3d video default one + video_options_add("soft", nullptr); + video_options_add("opengl", nullptr); + video_options_add("bgfx", nullptr); + //video_options_add("auto", nullptr); // making d3d video default one } //============================================================ @@ -422,21 +422,21 @@ void sdl_osd_interface::init(running_machine &machine) // Some driver options - must be before audio init! stemp = options().audio_driver(); - if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) != 0) + if (stemp != nullptr && strcmp(stemp, OSDOPTVAL_AUTO) != 0) { osd_printf_verbose("Setting SDL audiodriver '%s' ...\n", stemp); osd_setenv(SDLENV_AUDIODRIVER, stemp, 1); } stemp = options().video_driver(); - if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) != 0) + if (stemp != nullptr && strcmp(stemp, OSDOPTVAL_AUTO) != 0) { osd_printf_verbose("Setting SDL videodriver '%s' ...\n", stemp); osd_setenv(SDLENV_VIDEODRIVER, stemp, 1); } stemp = options().render_driver(); - if (stemp != NULL) + if (stemp != nullptr) { if (strcmp(stemp, OSDOPTVAL_AUTO) != 0) { @@ -462,7 +462,7 @@ void sdl_osd_interface::init(running_machine &machine) /* FIXME: move lib loading code from drawogl.c here */ stemp = options().gl_lib(); - if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) != 0) + if (stemp != nullptr && strcmp(stemp, OSDOPTVAL_AUTO) != 0) { osd_setenv("SDL_VIDEO_GL_DRIVER", stemp, 1); osd_printf_verbose("Setting SDL_VIDEO_GL_DRIVER = '%s' ...\n", stemp); diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index 61b118e8e1b..418df2cbe89 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -35,7 +35,7 @@ osd_video_config video_config; // monitor info -osd_monitor_info *osd_monitor_info::list = NULL; +osd_monitor_info *osd_monitor_info::list = nullptr; //============================================================ @@ -164,7 +164,7 @@ void sdl_monitor_info::init() osd_monitor_info **tailptr; // make a list of monitors - osd_monitor_info::list = NULL; + osd_monitor_info::list = nullptr; tailptr = &osd_monitor_info::list; { @@ -200,7 +200,7 @@ void sdl_monitor_info::init() void sdl_monitor_info::exit() { // free all of our monitor information - while (sdl_monitor_info::list != NULL) + while (sdl_monitor_info::list != nullptr) { osd_monitor_info *temp = sdl_monitor_info::list; sdl_monitor_info::list = temp->next(); @@ -233,9 +233,9 @@ osd_monitor_info *osd_monitor_info::pick_monitor(osd_options &generic_options, i aspect = get_aspect(options.aspect(), options.aspect(index), TRUE); // look for a match in the name first - if (scrname != NULL && (scrname[0] != 0)) + if (scrname != nullptr && (scrname[0] != 0)) { - for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next()) + for (monitor = osd_monitor_info::list; monitor != nullptr; monitor = monitor->next()) { moncount++; if (strcmp(scrname, monitor->devicename()) == 0) @@ -245,12 +245,12 @@ osd_monitor_info *osd_monitor_info::pick_monitor(osd_options &generic_options, i // didn't find it; alternate monitors until we hit the jackpot index %= moncount; - for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next()) + for (monitor = osd_monitor_info::list; monitor != nullptr; monitor = monitor->next()) if (index-- == 0) goto finishit; // return the primary just in case all else fails - for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next()) + for (monitor = osd_monitor_info::list; monitor != nullptr; monitor = monitor->next()) if (monitor->is_primary()) goto finishit; @@ -421,7 +421,7 @@ void sdl_osd_interface::extract_video_config() strcpy(video_config.glsl_shader_mamebm[i], stemp); video_config.glsl_shader_mamebm_num++; } else { - video_config.glsl_shader_mamebm[i] = NULL; + video_config.glsl_shader_mamebm[i] = nullptr; } } @@ -436,7 +436,7 @@ void sdl_osd_interface::extract_video_config() strcpy(video_config.glsl_shader_scrn[i], stemp); video_config.glsl_shader_scrn_num++; } else { - video_config.glsl_shader_scrn[i] = NULL; + video_config.glsl_shader_scrn[i] = nullptr; } } } else { @@ -445,12 +445,12 @@ void sdl_osd_interface::extract_video_config() video_config.glsl_shader_mamebm_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { - video_config.glsl_shader_mamebm[i] = NULL; + video_config.glsl_shader_mamebm[i] = nullptr; } video_config.glsl_shader_scrn_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { - video_config.glsl_shader_scrn[i] = NULL; + video_config.glsl_shader_scrn[i] = nullptr; } } diff --git a/src/osd/sdl/video.h b/src/osd/sdl/video.h index 1c6993c0c0b..82db031aba1 100644 --- a/src/osd/sdl/video.h +++ b/src/osd/sdl/video.h @@ -24,7 +24,7 @@ public: sdl_monitor_info(const UINT64 handle, const char *monitor_device, float aspect) : osd_monitor_info(&m_handle, monitor_device, aspect), m_handle(handle) { - refresh(); + sdl_monitor_info::refresh(); } // STATIC diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 8c36ede4d36..b1bd5cc0396 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -1318,12 +1318,12 @@ osd_dim sdl_window_info::get_max_bounds(int constrain) sdl_window_info::sdl_window_info(running_machine &a_machine, int index, osd_monitor_info *a_monitor, const osd_window_config *config) -: osd_window(), m_next(NULL), - // Following three are used by input code to defer resizes +: osd_window(), m_next(nullptr), m_startmaximized(0), + // Following three are used by input code to defer resizes m_minimum_dim(0,0), m_windowed_dim(0,0), - m_rendered_event(0, 1), m_target(0), - m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0) + m_rendered_event(0, 1), m_target(nullptr), m_extra_flags(0), + m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0) { m_win_config = *config; m_index = index; diff --git a/src/osd/strconv.cpp b/src/osd/strconv.cpp index c5c02edd2f5..eec1bcc4059 100644 --- a/src/osd/strconv.cpp +++ b/src/osd/strconv.cpp @@ -26,15 +26,15 @@ CHAR *astring_from_utf8(const char *utf8string) CHAR *result; // convert MAME string (UTF-8) to UTF-16 - char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0); + char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, nullptr, 0); wstring = (WCHAR *)alloca(char_count * sizeof(*wstring)); MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, wstring, char_count); // convert UTF-16 to "ANSI code page" string - char_count = WideCharToMultiByte(CP_ACP, 0, wstring, -1, NULL, 0, NULL, NULL); + char_count = WideCharToMultiByte(CP_ACP, 0, wstring, -1, nullptr, 0, nullptr, nullptr); result = (CHAR *)osd_malloc_array(char_count * sizeof(*result)); - if (result != NULL) - WideCharToMultiByte(CP_ACP, 0, wstring, -1, result, char_count, NULL, NULL); + if (result != nullptr) + WideCharToMultiByte(CP_ACP, 0, wstring, -1, result, char_count, nullptr, nullptr); return result; } @@ -51,15 +51,15 @@ char *utf8_from_astring(const CHAR *astring) CHAR *result; // convert "ANSI code page" string to UTF-16 - char_count = MultiByteToWideChar(CP_ACP, 0, astring, -1, NULL, 0); + char_count = MultiByteToWideChar(CP_ACP, 0, astring, -1, nullptr, 0); wstring = (WCHAR *)alloca(char_count * sizeof(*wstring)); MultiByteToWideChar(CP_ACP, 0, astring, -1, wstring, char_count); // convert UTF-16 to MAME string (UTF-8) - char_count = WideCharToMultiByte(CP_UTF8, 0, wstring, -1, NULL, 0, NULL, NULL); + char_count = WideCharToMultiByte(CP_UTF8, 0, wstring, -1, nullptr, 0, nullptr, nullptr); result = (CHAR *)osd_malloc_array(char_count * sizeof(*result)); - if (result != NULL) - WideCharToMultiByte(CP_UTF8, 0, wstring, -1, result, char_count, NULL, NULL); + if (result != nullptr) + WideCharToMultiByte(CP_UTF8, 0, wstring, -1, result, char_count, nullptr, nullptr); return result; } @@ -75,9 +75,9 @@ WCHAR *wstring_from_utf8(const char *utf8string) WCHAR *result; // convert MAME string (UTF-8) to UTF-16 - char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0); + char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, nullptr, 0); result = (WCHAR *)osd_malloc_array(char_count * sizeof(*result)); - if (result != NULL) + if (result != nullptr) MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, result, char_count); return result; @@ -94,10 +94,10 @@ char *utf8_from_wstring(const WCHAR *wstring) char *result; // convert UTF-16 to MAME string (UTF-8) - char_count = WideCharToMultiByte(CP_UTF8, 0, wstring, -1, NULL, 0, NULL, NULL); + char_count = WideCharToMultiByte(CP_UTF8, 0, wstring, -1, nullptr, 0, nullptr, nullptr); result = (char *)osd_malloc_array(char_count * sizeof(*result)); - if (result != NULL) - WideCharToMultiByte(CP_UTF8, 0, wstring, -1, result, char_count, NULL, NULL); + if (result != nullptr) + WideCharToMultiByte(CP_UTF8, 0, wstring, -1, result, char_count, nullptr, nullptr); return result; } diff --git a/src/osd/strconv.h b/src/osd/strconv.h index aaab2527d25..c9674cc486e 100644 --- a/src/osd/strconv.h +++ b/src/osd/strconv.h @@ -35,7 +35,7 @@ char *utf8_from_wstring(const WCHAR *s); struct osd_wstr_deleter { - void operator () (wchar_t* wstr) + void operator () (wchar_t* wstr) const { if (wstr != nullptr) osd_free(wstr); diff --git a/src/osd/watchdog.h b/src/osd/watchdog.h index dbcccf43abf..415c1269882 100644 --- a/src/osd/watchdog.h +++ b/src/osd/watchdog.h @@ -23,8 +23,8 @@ public: void reset() { m_event.set(); } osd_event & event(void) { return m_event; } - INT32 do_exit(void) { return m_do_exit; } - osd_ticks_t getTimeout(void) { return m_timeout; } + INT32 do_exit(void) const { return m_do_exit; } + osd_ticks_t getTimeout(void) const { return m_timeout; } void setTimeout(int timeout); private: osd_event m_event; diff --git a/src/osd/windows/main.cpp b/src/osd/windows/main.cpp index 6e7717349bb..f4be66a2b98 100644 --- a/src/osd/windows/main.cpp +++ b/src/osd/windows/main.cpp @@ -32,12 +32,12 @@ extern "C" int _tmain(int argc, TCHAR **argv) /* convert arguments to UTF-8 */ utf8_argv = (char **) malloc(argc * sizeof(*argv)); - if (utf8_argv == NULL) + if (utf8_argv == nullptr) return 999; for (i = 0; i < argc; i++) { utf8_argv[i] = utf8_from_tstring(argv[i]); - if (utf8_argv[i] == NULL) + if (utf8_argv[i] == nullptr) return 999; } diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index 82a756d7dd6..fc6f787b698 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -36,7 +36,7 @@ osd_video_config video_config; // monitor info -osd_monitor_info *osd_monitor_info::list = NULL; +osd_monitor_info *osd_monitor_info::list = nullptr; //============================================================ @@ -94,7 +94,7 @@ void windows_osd_interface::video_exit() window_exit(); // free all of our monitor information - while (osd_monitor_info::list != NULL) + while (osd_monitor_info::list != nullptr) { osd_monitor_info *temp = osd_monitor_info::list; osd_monitor_info::list = temp->m_next; @@ -149,10 +149,10 @@ osd_monitor_info *win_monitor_info::monitor_from_handle(HMONITOR hmonitor) osd_monitor_info *monitor; // find the matching monitor - for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->m_next) + for (monitor = osd_monitor_info::list; monitor != nullptr; monitor = monitor->m_next) if (*((HMONITOR *)monitor->oshandle()) == hmonitor) return monitor; - return NULL; + return nullptr; } @@ -231,14 +231,14 @@ static void init_monitors(void) osd_monitor_info **tailptr; // make a list of monitors - osd_monitor_info::list = NULL; + osd_monitor_info::list = nullptr; tailptr = &osd_monitor_info::list; - EnumDisplayMonitors(NULL, NULL, win_monitor_info::monitor_enum_callback, (LPARAM)&tailptr); + EnumDisplayMonitors(nullptr, nullptr, win_monitor_info::monitor_enum_callback, (LPARAM)&tailptr); // if we're verbose, print the list of monitors { osd_monitor_info *monitor; - for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->m_next) + for (monitor = osd_monitor_info::list; monitor != nullptr; monitor = monitor->m_next) { osd_printf_verbose("Video: Monitor %p = \"%s\" %s\n", monitor->oshandle(), monitor->devicename(), monitor->is_primary() ? "(primary)" : ""); } @@ -270,9 +270,9 @@ osd_monitor_info *osd_monitor_info::pick_monitor(osd_options &osdopts, int index aspect = get_aspect(options.aspect(), options.aspect(index), TRUE); // look for a match in the name first - if (scrname != NULL && (scrname[0] != 0)) + if (scrname != nullptr && (scrname[0] != 0)) { - for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next()) + for (monitor = osd_monitor_info::list; monitor != nullptr; monitor = monitor->next()) { moncount++; if (strcmp(scrname, monitor->devicename()) == 0) @@ -282,12 +282,12 @@ osd_monitor_info *osd_monitor_info::pick_monitor(osd_options &osdopts, int index // didn't find it; alternate monitors until we hit the jackpot index %= moncount; - for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next()) + for (monitor = osd_monitor_info::list; monitor != nullptr; monitor = monitor->next()) if (index-- == 0) goto finishit; // return the primary just in case all else fails - for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next()) + for (monitor = osd_monitor_info::list; monitor != nullptr; monitor = monitor->next()) if (monitor->is_primary()) goto finishit; @@ -411,7 +411,7 @@ void windows_osd_interface::extract_video_config() strcpy(video_config.glsl_shader_mamebm[i], stemp); video_config.glsl_shader_mamebm_num++; } else { - video_config.glsl_shader_mamebm[i] = NULL; + video_config.glsl_shader_mamebm[i] = nullptr; } } @@ -426,7 +426,7 @@ void windows_osd_interface::extract_video_config() strcpy(video_config.glsl_shader_scrn[i], stemp); video_config.glsl_shader_scrn_num++; } else { - video_config.glsl_shader_scrn[i] = NULL; + video_config.glsl_shader_scrn[i] = nullptr; } } } else { @@ -435,12 +435,12 @@ void windows_osd_interface::extract_video_config() video_config.glsl_shader_mamebm_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { - video_config.glsl_shader_mamebm[i] = NULL; + video_config.glsl_shader_mamebm[i] = nullptr; } video_config.glsl_shader_scrn_num=0; for(i=0; i<GLSL_SHADER_MAX; i++) { - video_config.glsl_shader_scrn[i] = NULL; + video_config.glsl_shader_scrn[i] = nullptr; } } diff --git a/src/osd/windows/video.h b/src/osd/windows/video.h index f47a5260b8e..171cfa1aaec 100644 --- a/src/osd/windows/video.h +++ b/src/osd/windows/video.h @@ -35,7 +35,7 @@ public: static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, LPARAM data); static osd_monitor_info *monitor_from_handle(HMONITOR monitor); - HMONITOR handle() { return m_handle; } + HMONITOR handle() const { return m_handle; } private: HMONITOR m_handle; // handle to the monitor diff --git a/src/osd/windows/windir.cpp b/src/osd/windows/windir.cpp index 87b1b5e05ce..f7b7fd44c6a 100644 --- a/src/osd/windows/windir.cpp +++ b/src/osd/windows/windir.cpp @@ -44,14 +44,14 @@ struct osd_directory osd_directory *osd_opendir(const char *dirname) { - osd_directory *dir = NULL; - TCHAR *t_dirname = NULL; - TCHAR *dirfilter = NULL; + osd_directory *dir = nullptr; + TCHAR *t_dirname = nullptr; + TCHAR *dirfilter = nullptr; size_t dirfilter_size; // allocate memory to hold the osd_tool_directory structure dir = (osd_directory *)malloc(sizeof(*dir)); - if (dir == NULL) + if (dir == nullptr) goto error; memset(dir, 0, sizeof(*dir)); @@ -61,13 +61,13 @@ osd_directory *osd_opendir(const char *dirname) // convert the path to TCHARs t_dirname = tstring_from_utf8(dirname); - if (t_dirname == NULL) + if (t_dirname == nullptr) goto error; // append \*.* to the directory name dirfilter_size = _tcslen(t_dirname) + 5; dirfilter = (TCHAR *)malloc(dirfilter_size * sizeof(*dirfilter)); - if (dirfilter == NULL) + if (dirfilter == nullptr) goto error; _sntprintf(dirfilter, dirfilter_size, TEXT("%s\\*.*"), t_dirname); @@ -76,14 +76,14 @@ osd_directory *osd_opendir(const char *dirname) error: // cleanup - if (t_dirname != NULL) + if (t_dirname != nullptr) osd_free(t_dirname); - if (dirfilter != NULL) + if (dirfilter != nullptr) free(dirfilter); - if (dir != NULL && dir->find == INVALID_HANDLE_VALUE) + if (dir != nullptr && dir->find == INVALID_HANDLE_VALUE) { free(dir); - dir = NULL; + dir = nullptr; } return dir; } @@ -96,17 +96,17 @@ error: const osd_directory_entry *osd_readdir(osd_directory *dir) { // if we've previously allocated a name, free it now - if (dir->entry.name != NULL) + if (dir->entry.name != nullptr) { osd_free((void *)dir->entry.name); - dir->entry.name = NULL; + dir->entry.name = nullptr; } // if this isn't the first file, do a find next if (!dir->is_first) { if (!FindNextFile(dir->find, &dir->data)) - return NULL; + return nullptr; } // otherwise, just use the data we already had @@ -117,7 +117,7 @@ const osd_directory_entry *osd_readdir(osd_directory *dir) dir->entry.name = utf8_from_tstring(dir->data.cFileName); dir->entry.type = win_attributes_to_entry_type(dir->data.dwFileAttributes); dir->entry.size = dir->data.nFileSizeLow | ((UINT64) dir->data.nFileSizeHigh << 32); - return (dir->entry.name != NULL) ? &dir->entry : NULL; + return (dir->entry.name != nullptr) ? &dir->entry : nullptr; } @@ -128,7 +128,7 @@ const osd_directory_entry *osd_readdir(osd_directory *dir) void osd_closedir(osd_directory *dir) { // free any data associated - if (dir->entry.name != NULL) + if (dir->entry.name != nullptr) osd_free((void *)dir->entry.name); if (dir->find != INVALID_HANDLE_VALUE) FindClose(dir->find); diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index f5534a13544..3f3e84b004c 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -1991,7 +1991,7 @@ void win_window_info::set_fullscreen(int fullscreen) // adjust the style SetWindowLong(platform_window<HWND>(), GWL_STYLE, WINDOW_STYLE); SetWindowLong(platform_window<HWND>(), GWL_EXSTYLE, WINDOW_STYLE_EX); - SetWindowPos(platform_window<HWND>(), 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowPos(platform_window<HWND>(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); // force to the bottom, then back on top SetWindowPos(platform_window<HWND>(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); @@ -2022,7 +2022,7 @@ void win_window_info::set_fullscreen(int fullscreen) // adjust the style SetWindowLong(platform_window<HWND>(), GWL_STYLE, FULLSCREEN_STYLE); SetWindowLong(platform_window<HWND>(), GWL_EXSTYLE, FULLSCREEN_STYLE_EX); - SetWindowPos(platform_window<HWND>(), 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowPos(platform_window<HWND>(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); // set topmost SetWindowPos(platform_window<HWND>(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 940746ff484..136daea0636 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -380,7 +380,7 @@ void MameMainApp::Run() // To satisfy the latter things, pass in the module path name char exe_path[MAX_PATH]; - GetModuleFileNameA(NULL, exe_path, MAX_PATH); + GetModuleFileNameA(nullptr, exe_path, MAX_PATH); char* args[2] = { exe_path, (char*)"-verbose" }; DWORD result = emulator_info::start_frontend(*m_options.get(), *m_osd.get(), ARRAY_LENGTH(args), args); diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index 8f0bd77f4a7..72e2112a04b 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -291,7 +291,7 @@ public: bool should_hide_mouse() const; void poll_input(running_machine &machine) const; - windows_options &options() { return m_options; } + virtual windows_options &options() override { return m_options; } int window_count(); @@ -307,7 +307,6 @@ private: windows_options & m_options; static const int DEFAULT_FONT_HEIGHT = 200; - static long __stdcall exception_filter(struct _EXCEPTION_POINTERS *info); }; #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) diff --git a/src/osd/windows/winutf8.cpp b/src/osd/windows/winutf8.cpp index cd34b1d12fe..08abcb58dd8 100644 --- a/src/osd/windows/winutf8.cpp +++ b/src/osd/windows/winutf8.cpp @@ -24,7 +24,7 @@ void win_output_debug_string_utf8(const char *string) { TCHAR *t_string = tstring_from_utf8(string); - if (t_string != NULL) + if (t_string != nullptr) { OutputDebugString(t_string); osd_free(t_string); @@ -40,8 +40,8 @@ void win_output_debug_string_utf8(const char *string) int win_message_box_utf8(HWND window, const char *text, const char *caption, UINT type) { int result = IDNO; - TCHAR *t_text = NULL; - TCHAR *t_caption = NULL; + TCHAR *t_text = nullptr; + TCHAR *t_caption = nullptr; if (text) { @@ -76,7 +76,7 @@ done: BOOL win_set_window_text_utf8(HWND window, const char *text) { BOOL result = FALSE; - TCHAR *t_text = NULL; + TCHAR *t_text = nullptr; if (text) { @@ -107,7 +107,7 @@ done: int win_get_window_text_utf8(HWND window, char *buffer, size_t buffer_size) { int result = 0; - char *utf8_buffer = NULL; + char *utf8_buffer = nullptr; TCHAR t_buffer[256]; t_buffer[0] = '\0'; @@ -143,8 +143,8 @@ HWND win_create_window_ex_utf8(DWORD exstyle, const char* classname, const char* HINSTANCE instance, void* param) { TCHAR* t_classname; - TCHAR* t_windowname = NULL; - HWND result = 0; + TCHAR* t_windowname = nullptr; + HWND result = nullptr; t_classname = tstring_from_utf8(classname); if( !t_classname ) diff --git a/src/osd/windows/winutil.cpp b/src/osd/windows/winutil.cpp index 607699749bb..3574f00f398 100644 --- a/src/osd/windows/winutil.cpp +++ b/src/osd/windows/winutil.cpp @@ -122,7 +122,7 @@ lazy_loaded_function::lazy_loaded_function(const char * name, const wchar_t* dll } lazy_loaded_function::lazy_loaded_function(const char * name, const wchar_t** dll_names, int dll_count) - : m_name(name), m_module(NULL), m_initialized(false), m_pfn(nullptr) + : m_name(name), m_module(nullptr), m_initialized(false), m_pfn(nullptr) { for (int i = 0; i < dll_count; i++) m_dll_names.push_back(std::wstring(dll_names[i])); @@ -144,11 +144,11 @@ int lazy_loaded_function::initialize() for (int i = 0; i < m_dll_names.size(); i++) { m_module = LoadLibraryW(m_dll_names[i].c_str()); - if (m_module != NULL) + if (m_module != nullptr) break; } - if (m_module == NULL) + if (m_module == nullptr) { osd_printf_verbose("Could not find DLL to dynamically link function %s.\n", m_name.c_str()); return ERROR_DLL_NOT_FOUND; @@ -170,7 +170,7 @@ int lazy_loaded_function::initialize() return 0; } -void lazy_loaded_function::check_init() +void lazy_loaded_function::check_init() const { if (!m_initialized) fatalerror("Attempt to use function pointer for function %s prior to init!", name()); diff --git a/src/osd/windows/winutil.h b/src/osd/windows/winutil.h index 6cb8297c277..d122679438e 100644 --- a/src/osd/windows/winutil.h +++ b/src/osd/windows/winutil.h @@ -31,7 +31,7 @@ private: bool m_initialized; protected: - void check_init(); + void check_init() const; FARPROC m_pfn; public: @@ -39,7 +39,7 @@ public: lazy_loaded_function(const char * name, const wchar_t** dll_names, int dll_count); ~lazy_loaded_function(); int initialize(); - const char * name() { return m_name.c_str(); } + const char * name() const { return m_name.c_str(); } }; // No parameters |