summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-12-04 07:06:18 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2015-12-04 07:06:18 +0100
commit5a2f80dcde2e76356bf568f1e2d71b054a7db45b (patch)
tree31e8369980a2e4548223f529c31e8ca6ade5ce20 /src/osd
parent41681c1703244abe68cbcf3096ca259bd061cc08 (diff)
clang-modernize part 5
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/modules/debugger/debugint.cpp104
-rw-r--r--src/osd/modules/debugger/none.cpp2
-rw-r--r--src/osd/modules/debugger/win/debugbaseinfo.cpp4
-rw-r--r--src/osd/modules/debugger/win/debugwininfo.h2
-rw-r--r--src/osd/modules/debugger/win/disasmbasewininfo.cpp16
-rw-r--r--src/osd/modules/debugger/win/logwininfo.cpp4
-rw-r--r--src/osd/modules/lib/osdlib_win32.cpp4
-rw-r--r--src/osd/modules/lib/osdobj_common.h2
-rw-r--r--src/osd/modules/midi/portmidi.cpp6
-rw-r--r--src/osd/modules/osdmodule.cpp22
-rw-r--r--src/osd/modules/render/d3d/d3d9intf.cpp28
-rw-r--r--src/osd/modules/sync/sync_mini.cpp4
-rw-r--r--src/osd/modules/sync/sync_windows.cpp24
-rw-r--r--src/osd/modules/sync/work_mini.cpp6
-rw-r--r--src/osd/osdcore.cpp2
-rw-r--r--src/osd/osdmini/minidir.cpp4
-rw-r--r--src/osd/osdmini/minifile.cpp18
-rw-r--r--src/osd/osdmini/minimain.cpp2
-rw-r--r--src/osd/osdmini/minimisc.cpp4
-rw-r--r--src/osd/osdnet.cpp6
-rw-r--r--src/osd/sdl/watchdog.cpp2
-rw-r--r--src/osd/windows/ledutil.cpp50
-rw-r--r--src/osd/windows/output.cpp26
-rw-r--r--src/osd/windows/winsocket.cpp14
24 files changed, 178 insertions, 178 deletions
diff --git a/src/osd/modules/debugger/debugint.cpp b/src/osd/modules/debugger/debugint.cpp
index 2598f481ca6..49ae108e881 100644
--- a/src/osd/modules/debugger/debugint.cpp
+++ b/src/osd/modules/debugger/debugint.cpp
@@ -28,7 +28,7 @@ class debug_internal : public osd_module, public debug_module
public:
debug_internal()
: osd_module(OSD_DEBUG_PROVIDER, "internal"), debug_module(),
- m_machine(NULL)
+ m_machine(nullptr)
{
}
@@ -150,7 +150,7 @@ class DView_edit
DISABLE_COPYING(DView_edit);
public:
- DView_edit(): active(0), container(NULL) { }
+ DView_edit(): active(0), container(nullptr) { }
~DView_edit() { }
int active;
render_container * container;
@@ -170,7 +170,7 @@ class DView
public:
DView(render_target *target, running_machine &machine, debug_view_type type, int flags)
- : next(NULL),
+ : next(nullptr),
type(0),
state(0),
ofs_x(0),
@@ -205,7 +205,7 @@ public:
machine().debug_view().free_view(*this->view);
}
- running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
+ running_machine &machine() const { assert(m_machine != nullptr); return *m_machine; }
DView * next;
@@ -259,11 +259,11 @@ INLINE void dview_set_state(DView *dv, int state, int onoff)
LOCAL VARIABLES
***************************************************************************/
-static render_font * debug_font = NULL;
+static render_font * debug_font = nullptr;
static int debug_font_width;
static int debug_font_height;
static float debug_font_aspect;
-static DView * list = NULL;
+static DView * list = nullptr;
static DView * focus_view;
static ui_menu * menu;
@@ -271,10 +271,10 @@ static DView_edit * cur_editor;
static void set_focus_view(DView *dv)
{
- if (focus_view != NULL)
+ if (focus_view != nullptr)
dview_set_state(focus_view, VIEW_STATE_NEEDS_UPDATE, TRUE);
- if (dv != NULL)
+ if (dv != nullptr)
dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE);
if (focus_view != dv)
@@ -863,16 +863,16 @@ static void dview_update(debug_view &dw, void *osdprivate)
void debug_internal::exit()
{
- for (DView *ndv = list; ndv != NULL; )
+ for (DView *ndv = list; ndv != nullptr; )
{
DView *temp = ndv;
ndv = ndv->next;
dview_free(temp);
}
- if (debug_font != NULL)
+ if (debug_font != nullptr)
{
m_machine->render().font_free(debug_font);
- debug_font = NULL;
+ debug_font = nullptr;
}
if (menu)
global_free(menu);
@@ -889,10 +889,10 @@ void debug_internal::init_debugger(running_machine &machine)
debug_font_width = 0;
debug_font_height = 15;
- menu = NULL;
- cur_editor = NULL;
- list = NULL;
- focus_view = NULL;
+ menu = nullptr;
+ cur_editor = nullptr;
+ list = nullptr;
+ focus_view = nullptr;
debug_font_aspect = m_machine->render().ui_aspect();
@@ -980,7 +980,7 @@ static void on_disasm_cpu_activate(DView *dv, const ui_menu_event *event)
if (event->iptkey == IPT_UI_RIGHT)
{
current = current->next();
- if (current == NULL)
+ if (current == nullptr)
current = dv->view->first_source();
dv->view->set_source(*current);
dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE);
@@ -1111,7 +1111,7 @@ static void render_editor(DView_edit *editor)
editor->container->empty();
/* get the size of the text */
editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
- DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL);
+ DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(width, 0.5f);
@@ -1131,7 +1131,7 @@ static void render_editor(DView_edit *editor)
/* draw the text within it */
editor->container->manager().machine().ui().draw_text_full(editor->container, editor->str.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
- DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
+ DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -1176,8 +1176,8 @@ static void CreateMainMenu(running_machine &machine)
break;
}
- menu->item_append(title.append(focus_view->title).c_str(), NULL, MENU_FLAG_DISABLE, NULL);
- menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
+ menu->item_append(title.append(focus_view->title).c_str(), nullptr, MENU_FLAG_DISABLE, nullptr);
+ menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
switch (focus_view->type)
{
@@ -1191,37 +1191,37 @@ static void CreateMainMenu(running_machine &machine)
case DASM_RIGHTCOL_COMMENTS: subtext = "Comments"; break;
}
menu->item_append("View", subtext, MENU_FLAG_RIGHT_ARROW, (void *)on_view_opcodes_activate);
- menu->item_append("Run to cursor", NULL, 0, (void *)on_run_to_cursor_activate);
+ menu->item_append("Run to cursor", nullptr, 0, (void *)on_run_to_cursor_activate);
if (!dview_is_state(focus_view, VIEW_STATE_FOLLOW_CPU))
{
menu->item_append("CPU", focus_view->view->source()->name(), MENU_FLAG_RIGHT_ARROW, (void *)on_disasm_cpu_activate);
}
- menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
+ menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
break;
}
}
/* add input menu items */
- menu->item_append("New Memory Window", NULL, 0, (void *)on_memory_window_activate);
- menu->item_append("New Disassembly Window", NULL, 0, (void *)on_disassembly_window_activate);
- menu->item_append("New Error Log Window", NULL, 0, (void *)on_log_window_activate);
- menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
- menu->item_append("Run", NULL, 0, (void *)on_run_activate);
- menu->item_append("Run to Next CPU", NULL, 0, (void *)on_run_cpu_activate);
- menu->item_append("Run until Next Interrupt on This CPU", NULL, 0, (void *)on_run_irq_activate);
- menu->item_append("Run until Next VBLANK", NULL, 0, (void *)on_run_vbl_activate);
- menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
- menu->item_append("Step Into", NULL, 0, (void *)on_step_into_activate);
- menu->item_append("Step Over", NULL, 0, (void *)on_step_over_activate);
- menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
- menu->item_append("Soft Reset", NULL, 0, (void *)on_soft_reset_activate);
- menu->item_append("Hard Reset", NULL, 0, (void *)on_hard_reset_activate);
- menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
+ menu->item_append("New Memory Window", nullptr, 0, (void *)on_memory_window_activate);
+ menu->item_append("New Disassembly Window", nullptr, 0, (void *)on_disassembly_window_activate);
+ menu->item_append("New Error Log Window", nullptr, 0, (void *)on_log_window_activate);
+ menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
+ menu->item_append("Run", nullptr, 0, (void *)on_run_activate);
+ menu->item_append("Run to Next CPU", nullptr, 0, (void *)on_run_cpu_activate);
+ menu->item_append("Run until Next Interrupt on This CPU", nullptr, 0, (void *)on_run_irq_activate);
+ menu->item_append("Run until Next VBLANK", nullptr, 0, (void *)on_run_vbl_activate);
+ menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
+ menu->item_append("Step Into", nullptr, 0, (void *)on_step_into_activate);
+ menu->item_append("Step Over", nullptr, 0, (void *)on_step_over_activate);
+ menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
+ menu->item_append("Soft Reset", nullptr, 0, (void *)on_soft_reset_activate);
+ menu->item_append("Hard Reset", nullptr, 0, (void *)on_hard_reset_activate);
+ menu->item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
if (!dview_is_state(focus_view, VIEW_STATE_FOLLOW_CPU))
- menu->item_append("Close Window", NULL, 0, (void *)on_close_activate);
- menu->item_append("Exit", NULL, 0, (void *)on_exit_activate);
+ menu->item_append("Close Window", nullptr, 0, (void *)on_close_activate);
+ menu->item_append("Exit", nullptr, 0, (void *)on_exit_activate);
}
static int map_point(DView *dv, INT32 target_x, INT32 target_y, INT32 *mapped_x, INT32 *mapped_y)
@@ -1254,16 +1254,16 @@ static void handle_mouse(running_machine &machine)
INT32 x,y;
bool button;
- if (menu != NULL)
+ if (menu != nullptr)
return;
mouse_target = ui_input_find_mouse(machine, &x, &y, &button);
- if (mouse_target == NULL)
+ if (mouse_target == nullptr)
return;
//printf("mouse %d %d %d\n", x, y, button);
- for (DView *dv = list; dv != NULL; dv = dv->next)
+ for (DView *dv = list; dv != nullptr; dv = dv->next)
{
if (mouse_target == dv->target)
{
@@ -1313,17 +1313,17 @@ static void handle_editor(running_machine &machine)
break;
}
}
- if (cur_editor != NULL)
+ if (cur_editor != nullptr)
{
render_editor(cur_editor);
if (ui_input_pressed(machine, IPT_UI_SELECT))
{
process_string(focus_view, focus_view->editor.str.c_str());
focus_view->editor.str = "";
- cur_editor = NULL;
+ cur_editor = nullptr;
}
if (ui_input_pressed(machine, IPT_UI_CANCEL))
- cur_editor = NULL;
+ cur_editor = nullptr;
}
}
@@ -1340,11 +1340,11 @@ static void handle_menus(running_machine &machine)
machine.render().ui_container().empty();
ui_input_frame_update(machine);
- if (menu != NULL)
+ if (menu != nullptr)
{
/* process the menu */
event = menu->process(0);
- if (event != NULL && (event->iptkey == IPT_UI_SELECT || (event->iptkey == IPT_UI_RIGHT)))
+ if (event != nullptr && (event->iptkey == IPT_UI_SELECT || (event->iptkey == IPT_UI_RIGHT)))
{
//global_free(menu);
//menu = NULL;
@@ -1355,7 +1355,7 @@ static void handle_menus(running_machine &machine)
else if (ui_input_pressed(machine, IPT_UI_CONFIGURE))
{
global_free(menu);
- menu = NULL;
+ menu = nullptr;
}
}
else
@@ -1378,7 +1378,7 @@ static void followers_set_cpu(device_t *device)
{
std::string title;
- for (DView *dv = list; dv != NULL; dv = dv->next)
+ for (DView *dv = list; dv != nullptr; dv = dv->next)
{
if (dview_is_state(dv, VIEW_STATE_FOLLOW_CPU))
{
@@ -1420,7 +1420,7 @@ static void update_views(void)
DView *dv, *prev;
LIST_GET_LAST(list, dv);
- while (dv != NULL)
+ while (dv != nullptr)
{
dview_update_view(dv);
LIST_GET_PREVIOUS(list, dv, prev);
@@ -1431,7 +1431,7 @@ static void update_views(void)
void debug_internal::wait_for_debugger(device_t &device, bool firststop)
{
- if (firststop && list == NULL)
+ if (firststop && list == nullptr)
{
render_target *target = &device.machine().render().ui_target();
@@ -1463,7 +1463,7 @@ void debug_internal::wait_for_debugger(device_t &device, bool firststop)
void debug_internal::debugger_update()
{
- if ((m_machine != NULL) && (!debug_cpu_is_stopped(*m_machine)) && (m_machine->phase() == MACHINE_PHASE_RUNNING))
+ if ((m_machine != nullptr) && (!debug_cpu_is_stopped(*m_machine)) && (m_machine->phase() == MACHINE_PHASE_RUNNING))
{
update_views();
}
diff --git a/src/osd/modules/debugger/none.cpp b/src/osd/modules/debugger/none.cpp
index 48085afd089..f6b22a1883a 100644
--- a/src/osd/modules/debugger/none.cpp
+++ b/src/osd/modules/debugger/none.cpp
@@ -16,7 +16,7 @@ class debug_none : public osd_module, public debug_module
public:
debug_none()
: osd_module(OSD_DEBUG_PROVIDER, "none"), debug_module(),
- m_machine(NULL)
+ m_machine(nullptr)
{
}
diff --git a/src/osd/modules/debugger/win/debugbaseinfo.cpp b/src/osd/modules/debugger/win/debugbaseinfo.cpp
index 66824b9f029..9f53899affd 100644
--- a/src/osd/modules/debugger/win/debugbaseinfo.cpp
+++ b/src/osd/modules/debugger/win/debugbaseinfo.cpp
@@ -25,7 +25,7 @@ void debugbase_info::smart_set_window_bounds(HWND wnd, HWND parent, RECT const &
// first get the current bounds, relative to the parent
GetWindowRect(wnd, &curbounds);
- if (parent != NULL)
+ if (parent != nullptr)
{
RECT parentbounds;
GetWindowRect(parent, &parentbounds);
@@ -44,7 +44,7 @@ void debugbase_info::smart_set_window_bounds(HWND wnd, HWND parent, RECT const &
// if we need to, reposition the window
if (flags != (SWP_NOMOVE | SWP_NOSIZE))
- SetWindowPos(wnd, NULL,
+ SetWindowPos(wnd, nullptr,
bounds.left, bounds.top,
bounds.right - bounds.left, bounds.bottom - bounds.top,
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | flags);
diff --git a/src/osd/modules/debugger/win/debugwininfo.h b/src/osd/modules/debugger/win/debugwininfo.h
index 78c088a5eef..08e08d79de9 100644
--- a/src/osd/modules/debugger/win/debugwininfo.h
+++ b/src/osd/modules/debugger/win/debugwininfo.h
@@ -24,7 +24,7 @@ public:
debugwin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler);
virtual ~debugwin_info();
- bool is_valid() const { return m_wnd != NULL; }
+ bool is_valid() const { return m_wnd != nullptr; }
debugwin_info *next() const { return m_next; }
void set_ignore_char_lparam(LPARAM value) { m_ignore_char_lparam = value >> 16; }
diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.cpp b/src/osd/modules/debugger/win/disasmbasewininfo.cpp
index 783cc8d75fa..f7f516ca24c 100644
--- a/src/osd/modules/debugger/win/disasmbasewininfo.cpp
+++ b/src/osd/modules/debugger/win/disasmbasewininfo.cpp
@@ -25,7 +25,7 @@ disasmbasewin_info::disasmbasewin_info(debugger_windows_interface &debugger, boo
return;
m_views[0].reset(global_alloc(disasmview_info(debugger, *this, window())));
- if ((m_views[0] == NULL) || !m_views[0]->is_valid())
+ if ((m_views[0] == nullptr) || !m_views[0]->is_valid())
{
m_views[0].reset();
return;
@@ -115,10 +115,10 @@ void disasmbasewin_info::update_menu()
// first find an existing breakpoint at this address
device_debug::breakpoint *bp = debug->breakpoint_first();
- while ((bp != NULL) && (bp->address() != address))
+ while ((bp != nullptr) && (bp->address() != address))
bp = bp->next();
- if (bp == NULL)
+ if (bp == nullptr)
{
ModifyMenu(menu, ID_TOGGLE_BREAKPOINT, MF_BYCOMMAND, ID_TOGGLE_BREAKPOINT, TEXT("Set breakpoint at cursor\tF9"));
ModifyMenu(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND, ID_DISABLE_BREAKPOINT, TEXT("Disable breakpoint at cursor\tShift+F9"));
@@ -131,7 +131,7 @@ void disasmbasewin_info::update_menu()
else
ModifyMenu(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND, ID_DISABLE_BREAKPOINT, TEXT("Enable breakpoint at cursor\tShift+F9"));
}
- bool const available = (bp != NULL) && (!is_main_console() || dasmview->source_is_visible_cpu());
+ bool const available = (bp != nullptr) && (!is_main_console() || dasmview->source_is_visible_cpu());
EnableMenuItem(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND | (available ? MF_ENABLED : MF_GRAYED));
}
else
@@ -168,7 +168,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
INT32 bpindex = -1;
// first find an existing breakpoint at this address
- for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != NULL; bp = bp->next())
+ for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != nullptr; bp = bp->next())
{
if (address == bp->address())
{
@@ -182,7 +182,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
if (bpindex == -1)
{
- bpindex = debug->breakpoint_set(address, NULL, NULL);
+ bpindex = debug->breakpoint_set(address, nullptr, nullptr);
debug_console_printf(machine(), "Breakpoint %X set\n", bpindex);
}
else
@@ -213,11 +213,11 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
// first find an existing breakpoint at this address
device_debug::breakpoint *bp = debug->breakpoint_first();
- while ((bp != NULL) && (bp->address() != address))
+ while ((bp != nullptr) && (bp->address() != address))
bp = bp->next();
// if it doesn't exist, add a new one
- if (bp != NULL)
+ if (bp != nullptr)
{
if (!is_main_console())
{
diff --git a/src/osd/modules/debugger/win/logwininfo.cpp b/src/osd/modules/debugger/win/logwininfo.cpp
index 6610e8a296f..2f631e199d3 100644
--- a/src/osd/modules/debugger/win/logwininfo.cpp
+++ b/src/osd/modules/debugger/win/logwininfo.cpp
@@ -12,13 +12,13 @@
logwin_info::logwin_info(debugger_windows_interface &debugger) :
- debugwin_info(debugger, false, std::string("Errorlog: ").append(debugger.machine().system().description).append(" [").append(debugger.machine().system().name).append("]").c_str(), NULL)
+ debugwin_info(debugger, false, std::string("Errorlog: ").append(debugger.machine().system().description).append(" [").append(debugger.machine().system().name).append("]").c_str(), nullptr)
{
if (!window())
return;
m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_LOG)));
- if ((m_views[0] == NULL) || !m_views[0]->is_valid())
+ if ((m_views[0] == nullptr) || !m_views[0]->is_valid())
{
m_views[0].reset();
return;
diff --git a/src/osd/modules/lib/osdlib_win32.cpp b/src/osd/modules/lib/osdlib_win32.cpp
index 85334fd8ddc..75218574aff 100644
--- a/src/osd/modules/lib/osdlib_win32.cpp
+++ b/src/osd/modules/lib/osdlib_win32.cpp
@@ -77,7 +77,7 @@ int osd_setenv(const char *name, const char *value, int overwrite)
if (!overwrite)
{
- if (osd_getenv(name) != NULL)
+ if (osd_getenv(name) != nullptr)
return 0;
}
buf = (char *) osd_malloc_array(strlen(name)+strlen(value)+2);
@@ -217,7 +217,7 @@ void osd_free(void *ptr)
void *osd_alloc_executable(size_t size)
{
- return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+ return VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
}
diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h
index ddbc8c974d4..c3501ec84b6 100644
--- a/src/osd/modules/lib/osdobj_common.h
+++ b/src/osd/modules/lib/osdobj_common.h
@@ -200,7 +200,7 @@ public:
// this INTERFACE but part of the osd IMPLEMENTATION
// getters
- running_machine &machine() { assert(m_machine != NULL); return *m_machine; }
+ running_machine &machine() { assert(m_machine != nullptr); return *m_machine; }
virtual void debugger_update();
diff --git a/src/osd/modules/midi/portmidi.cpp b/src/osd/modules/midi/portmidi.cpp
index dd75d58ff17..9aa02c63c5b 100644
--- a/src/osd/modules/midi/portmidi.cpp
+++ b/src/osd/modules/midi/portmidi.cpp
@@ -46,7 +46,7 @@ static const int RX_EVENT_BUF_SIZE = 512;
class osd_midi_device_pm : public osd_midi_device
{
public:
- osd_midi_device_pm(): pmStream(NULL), xmit_cnt(0), last_status(0), rx_sysex(false) { }
+ osd_midi_device_pm(): pmStream(nullptr), xmit_cnt(0), last_status(0), rx_sysex(false) { }
virtual ~osd_midi_device_pm() { }
virtual bool open_input(const char *devname);
virtual bool open_output(const char *devname);
@@ -147,7 +147,7 @@ bool osd_midi_device_pm::open_input(const char *devname)
if (found_dev >= 0)
{
- if (Pm_OpenInput(&stm, found_dev, NULL, RX_EVENT_BUF_SIZE, NULL, NULL) == pmNoError)
+ if (Pm_OpenInput(&stm, found_dev, nullptr, RX_EVENT_BUF_SIZE, nullptr, nullptr) == pmNoError)
{
pmStream = stm;
return true;
@@ -194,7 +194,7 @@ bool osd_midi_device_pm::open_output(const char *devname)
if (found_dev >= 0)
{
- if (Pm_OpenOutput(&stm, found_dev, NULL, 100, NULL, NULL, 0) == pmNoError)
+ if (Pm_OpenOutput(&stm, found_dev, nullptr, 100, nullptr, nullptr, 0) == pmNoError)
{
pmStream = stm;
return true;
diff --git a/src/osd/modules/osdmodule.cpp b/src/osd/modules/osdmodule.cpp
index e0d7781ace0..1c745effc6c 100644
--- a/src/osd/modules/osdmodule.cpp
+++ b/src/osd/modules/osdmodule.cpp
@@ -11,13 +11,13 @@ osd_module_manager::osd_module_manager()
{
for (int i=0; i<MAX_MODULES; i++)
{
- m_modules[i] = NULL;
- m_selected[i] = NULL;
+ m_modules[i] = nullptr;
+ m_selected[i] = nullptr;
}
}
osd_module_manager::~osd_module_manager()
{
- for (int i = 0; m_modules[i] != NULL; i++)
+ for (int i = 0; m_modules[i] != nullptr; i++)
{
m_modules[i]->~osd_module();
osd_free(m_modules[i]);
@@ -32,7 +32,7 @@ void osd_module_manager::register_module(const module_type &mod_type)
osd_printf_verbose("===> registered module %s %s\n", module->name(), module->type());
int i;
- for (i = 0; m_modules[i] != NULL; i++)
+ for (i = 0; m_modules[i] != nullptr; i++)
;
m_modules[i] = module;
}
@@ -55,7 +55,7 @@ osd_module *osd_module_manager::get_module_generic(const char *type, const char
if (i>=0)
return m_modules[i];
else
- return NULL;
+ return nullptr;
}
osd_module *osd_module_manager::select_module(const char *type, const char *name)
@@ -64,7 +64,7 @@ osd_module *osd_module_manager::select_module(const char *type, const char *name
// FIXME: check if already exists!
int i;
- for (i = 0; m_selected[i] != NULL; i++)
+ for (i = 0; m_selected[i] != nullptr; i++)
;
m_selected[i] = m;
return m;
@@ -72,7 +72,7 @@ osd_module *osd_module_manager::select_module(const char *type, const char *name
void osd_module_manager::init(const osd_options &options)
{
- for (int i = 0; m_selected[i] != NULL; i++)
+ for (int i = 0; m_selected[i] != nullptr; i++)
{
m_selected[i]->init(options);
}
@@ -82,18 +82,18 @@ void osd_module_manager::exit()
{
// Find count
int cnt;
- for (cnt = 0; m_selected[cnt] != NULL; cnt++)
+ for (cnt = 0; m_selected[cnt] != nullptr; cnt++)
;
for (int i = cnt - 1; i >= 0; i--)
{
m_selected[i]->exit();
- m_selected[i] = NULL;
+ m_selected[i] = nullptr;
}
}
int osd_module_manager::get_module_index(const char *type, const char *name)
{
- for (int i = 0; m_modules[i] != NULL; i++)
+ for (int i = 0; m_modules[i] != nullptr; i++)
{
if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0)))
return i;
@@ -104,7 +104,7 @@ int osd_module_manager::get_module_index(const char *type, const char *name)
void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[])
{
*num = 0;
- for (int i = 0; m_modules[i] != NULL; i++)
+ for (int i = 0; m_modules[i] != nullptr; i++)
{
if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max))
{
diff --git a/src/osd/modules/render/d3d/d3d9intf.cpp b/src/osd/modules/render/d3d/d3d9intf.cpp
index d6751b6ca21..cb8eb741f65 100644
--- a/src/osd/modules/render/d3d/d3d9intf.cpp
+++ b/src/osd/modules/render/d3d/d3d9intf.cpp
@@ -70,32 +70,32 @@ base *drawd3d9_init(void)
// dynamically grab the create function from d3d9.dll
HINSTANCE dllhandle = LoadLibrary(TEXT("d3d9.dll"));
- if (dllhandle == NULL)
+ if (dllhandle == nullptr)
{
osd_printf_verbose("Direct3D: Unable to access d3d9.dll\n");
- return NULL;
+ return nullptr;
}
// import the create function
direct3dcreate9_ptr direct3dcreate9 = (direct3dcreate9_ptr)GetProcAddress(dllhandle, "Direct3DCreate9");
- if (direct3dcreate9 == NULL)
+ if (direct3dcreate9 == nullptr)
{
osd_printf_verbose("Direct3D: Unable to find Direct3DCreate9\n");
FreeLibrary(dllhandle);
- return NULL;
+ return nullptr;
}
// create our core direct 3d object
IDirect3D9 *d3d9 = (*direct3dcreate9)(D3D_SDK_VERSION);
- if (d3d9 == NULL)
+ if (d3d9 == nullptr)
{
osd_printf_verbose("Direct3D: Error attempting to initialize Direct3D9\n");
FreeLibrary(dllhandle);
- return NULL;
+ return nullptr;
}
// dynamically grab the shader load function from d3dx9.dll
- HINSTANCE fxhandle = NULL;
+ HINSTANCE fxhandle = nullptr;
for (int idx = 99; idx >= 0; idx--) // a shameful moogle
{
#ifdef UNICODE
@@ -107,19 +107,19 @@ base *drawd3d9_init(void)
sprintf(dllbuf, "d3dx9_%d.dll", idx);
fxhandle = LoadLibraryA(dllbuf);
#endif
- if (fxhandle != NULL)
+ if (fxhandle != nullptr)
{
break;
}
}
- if (fxhandle == NULL)
+ if (fxhandle == nullptr)
{
osd_printf_verbose("Direct3D: Warning - Unable find any D3D9 DLLs; disabling post-effect rendering\n");
post_available = false;
}
// allocate an object to hold our data
- base *d3dptr = global_alloc(base);
+ auto d3dptr = global_alloc(base);
d3dptr->version = 9;
d3dptr->d3dobj = d3d9;
d3dptr->dllhandle = dllhandle;
@@ -284,20 +284,20 @@ static HRESULT device_clear(device *dev, DWORD count, const D3DRECT *rects, DWOR
static HRESULT device_create_offscreen_plain_surface(device *dev, UINT width, UINT height, D3DFORMAT format, D3DPOOL pool, surface **surface)
{
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
- return IDirect3DDevice9_CreateOffscreenPlainSurface(device, width, height, format, pool, (IDirect3DSurface9 **)surface, NULL);
+ return IDirect3DDevice9_CreateOffscreenPlainSurface(device, width, height, format, pool, (IDirect3DSurface9 **)surface, nullptr);
}
static HRESULT device_create_texture(device *dev, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, texture **texture)
{
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
- return IDirect3DDevice9_CreateTexture(device, width, height, levels, usage, format, pool, (IDirect3DTexture9 **)texture, NULL);
+ return IDirect3DDevice9_CreateTexture(device, width, height, levels, usage, format, pool, (IDirect3DTexture9 **)texture, nullptr);
}
static HRESULT device_create_vertex_buffer(device *dev, UINT length, DWORD usage, DWORD fvf, D3DPOOL pool, vertex_buffer **buf)
{
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
- return IDirect3DDevice9_CreateVertexBuffer(device, length, usage, fvf, pool, (IDirect3DVertexBuffer9 **)buf, NULL);
+ return IDirect3DDevice9_CreateVertexBuffer(device, length, usage, fvf, pool, (IDirect3DVertexBuffer9 **)buf, nullptr);
}
@@ -395,7 +395,7 @@ static HRESULT device_set_render_target(device *dev, DWORD index, surface *surf)
static HRESULT device_create_render_target(device *dev, UINT width, UINT height, D3DFORMAT format, surface **surface)
{
IDirect3DDevice9 *device = (IDirect3DDevice9 *)dev;
- return IDirect3DDevice9_CreateRenderTarget(device, width, height, format, D3DMULTISAMPLE_NONE, 0, false, (IDirect3DSurface9 **)surface, NULL);
+ return IDirect3DDevice9_CreateRenderTarget(device, width, height, format, D3DMULTISAMPLE_NONE, 0, false, (IDirect3DSurface9 **)surface, nullptr);
}
diff --git a/src/osd/modules/sync/sync_mini.cpp b/src/osd/modules/sync/sync_mini.cpp
index a09303aed80..f5e6accb0c7 100644
--- a/src/osd/modules/sync/sync_mini.cpp
+++ b/src/osd/modules/sync/sync_mini.cpp
@@ -82,7 +82,7 @@ void osd_lock_free(osd_lock *lock)
osd_event *osd_event_alloc(int manualreset, int initialstate)
{
- return NULL;
+ return nullptr;
}
@@ -129,7 +129,7 @@ int osd_event_wait(osd_event *event, osd_ticks_t timeout)
osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam)
{
- return NULL;
+ return nullptr;
}
diff --git a/src/osd/modules/sync/sync_windows.cpp b/src/osd/modules/sync/sync_windows.cpp
index c3d93c75fc9..9439d68b72c 100644
--- a/src/osd/modules/sync/sync_windows.cpp
+++ b/src/osd/modules/sync/sync_windows.cpp
@@ -68,7 +68,7 @@ struct osd_scalable_lock
// GLOBAL VARIABLES
//============================================================
-static try_enter_critical_section_ptr try_enter_critical_section = NULL;
+static try_enter_critical_section_ptr try_enter_critical_section = nullptr;
static int checked_for_try_enter = FALSE;
@@ -80,8 +80,8 @@ static int checked_for_try_enter = FALSE;
osd_lock *osd_lock_alloc(void)
{
osd_lock *lock = (osd_lock *)malloc(sizeof(*lock));
- if (lock == NULL)
- return NULL;
+ if (lock == nullptr)
+ return nullptr;
InitializeCriticalSection(&lock->critsect);
return lock;
}
@@ -121,13 +121,13 @@ int osd_lock_try(osd_lock *lock)
{
// see if we can use TryEnterCriticalSection
HMODULE library = LoadLibrary(TEXT("kernel32.dll"));
- if (library != NULL)
+ if (library != nullptr)
try_enter_critical_section = (try_enter_critical_section_ptr)GetProcAddress(library, "TryEnterCriticalSection");
checked_for_try_enter = TRUE;
}
// if we have it, use it, otherwise just block
- if (try_enter_critical_section != NULL)
+ if (try_enter_critical_section != nullptr)
result = (*try_enter_critical_section)(&lock->critsect);
else
EnterCriticalSection(&lock->critsect);
@@ -203,7 +203,7 @@ INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta)
osd_event *osd_event_alloc(int manualreset, int initialstate)
{
- return (osd_event *) CreateEvent(NULL, manualreset, initialstate, NULL);
+ return (osd_event *) CreateEvent(nullptr, manualreset, initialstate, nullptr);
}
//============================================================
@@ -271,15 +271,15 @@ osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam)
uintptr_t handle;
thread = (osd_thread *)calloc(1, sizeof(osd_thread));
- if (thread == NULL)
- return NULL;
+ if (thread == nullptr)
+ return nullptr;
thread->callback = callback;
thread->param = cbparam;
- handle = _beginthreadex(NULL, 0, worker_thread_entry, thread, 0, NULL);
+ handle = _beginthreadex(nullptr, 0, worker_thread_entry, thread, 0, nullptr);
if (handle == 0)
{
free(thread);
- return NULL;
+ return nullptr;
}
thread->handle = (HANDLE) handle;
return thread;
@@ -327,8 +327,8 @@ osd_scalable_lock *osd_scalable_lock_alloc(void)
osd_scalable_lock *lock;
lock = (osd_scalable_lock *)calloc(1, sizeof(*lock));
- if (lock == NULL)
- return NULL;
+ if (lock == nullptr)
+ return nullptr;
memset(lock, 0, sizeof(*lock));
#if USE_SCALABLE_LOCKS
diff --git a/src/osd/modules/sync/work_mini.cpp b/src/osd/modules/sync/work_mini.cpp
index fd359c6ee40..3d4b10fc539 100644
--- a/src/osd/modules/sync/work_mini.cpp
+++ b/src/osd/modules/sync/work_mini.cpp
@@ -80,8 +80,8 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
// allocate memory to hold the result
item = (osd_work_item *)malloc(sizeof(*item));
- if (item == NULL)
- return NULL;
+ if (item == nullptr)
+ return nullptr;
// loop over all requested items
for (itemnum = 0; itemnum < numitems; itemnum++)
@@ -97,7 +97,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
if (flags & WORK_ITEM_FLAG_AUTO_RELEASE)
{
free(item);
- item = NULL;
+ item = nullptr;
}
return item;
}
diff --git a/src/osd/osdcore.cpp b/src/osd/osdcore.cpp
index 82bbf1ee63b..91ba3fc4266 100644
--- a/src/osd/osdcore.cpp
+++ b/src/osd/osdcore.cpp
@@ -17,7 +17,7 @@ void osd_output::push(osd_output *delegate)
{
if (m_ptr < MAXSTACK)
{
- delegate->m_chain = (m_ptr >= 0 ? m_stack[m_ptr] : NULL);
+ delegate->m_chain = (m_ptr >= 0 ? m_stack[m_ptr] : nullptr);
m_ptr++;
m_stack[m_ptr] = delegate;
}
diff --git a/src/osd/osdmini/minidir.cpp b/src/osd/osdmini/minidir.cpp
index 66b815daabb..e061b644cdf 100644
--- a/src/osd/osdmini/minidir.cpp
+++ b/src/osd/osdmini/minidir.cpp
@@ -17,7 +17,7 @@ osd_directory *osd_opendir(const char *dirname)
{
// since there are no standard C library routines for walking directories,
// we always return an error here
- return NULL;
+ return nullptr;
}
@@ -29,7 +29,7 @@ const osd_directory_entry *osd_readdir(osd_directory *dir)
{
// since there are no standard C library routines for walking directories,
// we always return an error here
- return NULL;
+ return nullptr;
}
diff --git a/src/osd/osdmini/minifile.cpp b/src/osd/osdmini/minifile.cpp
index b55a3ad77e9..b30b566585c 100644
--- a/src/osd/osdmini/minifile.cpp
+++ b/src/osd/osdmini/minifile.cpp
@@ -35,7 +35,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
// open the file
fileptr = fopen(path, mode);
- if (fileptr == NULL)
+ if (fileptr == nullptr)
return FILERR_NOT_FOUND;
// store the file pointer directly as an osd_file
@@ -75,7 +75,7 @@ file_error osd_read(osd_file *file, void *buffer, UINT64 offset, UINT32 length,
// perform the read
count = fread(buffer, 1, length, (FILE *)file);
- if (actual != NULL)
+ if (actual != nullptr)
*actual = count;
return FILERR_NONE;
@@ -95,7 +95,7 @@ file_error osd_write(osd_file *file, const void *buffer, UINT64 offset, UINT32 l
// perform the write
count = fwrite(buffer, 1, length, (FILE *)file);
- if (actual != NULL)
+ if (actual != nullptr)
*actual = count;
return FILERR_NONE;
@@ -169,7 +169,7 @@ int osd_uchar_from_osdchar(UINT32 /* unicode_char */ *uchar, const char *osdchar
osd_directory_entry *osd_stat(const char *path)
{
- osd_directory_entry *result = NULL;
+ osd_directory_entry *result = nullptr;
// create an osd_directory_entry; be sure to make sure that the caller can
// free all resources by just freeing the resulting osd_directory_entry
@@ -180,7 +180,7 @@ osd_directory_entry *osd_stat(const char *path)
result->size = 0;
FILE *f = fopen(path, "rb");
- if (f != NULL)
+ if (f != nullptr)
{
fseek(f, 0, SEEK_END);
result->type = ENTTYPE_FILE;
@@ -199,11 +199,11 @@ file_error osd_get_full_path(char **dst, const char *path)
{
// derive the full path of the file in an allocated string
// for now just fake it since we don't presume any underlying file system
- *dst = NULL;
- if (path != NULL)
+ *dst = nullptr;
+ if (path != nullptr)
{
*dst = (char *)osd_malloc_array(strlen(path) + 1);
- if (*dst != NULL)
+ if (*dst != nullptr)
strcpy(*dst, path);
}
@@ -218,5 +218,5 @@ file_error osd_get_full_path(char **dst, const char *path)
const char *osd_get_volume_name(int idx)
{
// we don't expose volumes
- return NULL;
+ return nullptr;
}
diff --git a/src/osd/osdmini/minimain.cpp b/src/osd/osdmini/minimain.cpp
index c0598e65dfd..18fbba1bc37 100644
--- a/src/osd/osdmini/minimain.cpp
+++ b/src/osd/osdmini/minimain.cpp
@@ -117,7 +117,7 @@ void mini_osd_interface::init(running_machine &machine)
// initialize the input system by adding devices
// let's pretend like we have a keyboard device
keyboard_device = machine.input().device_class(DEVICE_CLASS_KEYBOARD).add_device("Keyboard");
- if (keyboard_device == NULL)
+ if (keyboard_device == nullptr)
fatalerror("Error creating keyboard device\n");
// our faux keyboard only has a couple of keys (corresponding to the
diff --git a/src/osd/osdmini/minimisc.cpp b/src/osd/osdmini/minimisc.cpp
index 21d658ace5b..c6bb413b292 100644
--- a/src/osd/osdmini/minimisc.cpp
+++ b/src/osd/osdmini/minimisc.cpp
@@ -79,7 +79,7 @@ void osd_break_into_debugger(const char *message)
char *osd_get_clipboard_text(void)
{
// can't support clipboards generically
- return NULL;
+ return nullptr;
}
//============================================================
@@ -88,7 +88,7 @@ char *osd_get_clipboard_text(void)
const char *osd_getenv(const char *name)
{
- return NULL;
+ return nullptr;
}
//============================================================
diff --git a/src/osd/osdnet.cpp b/src/osd/osdnet.cpp
index 4c167251cea..057a562ee76 100644
--- a/src/osd/osdnet.cpp
+++ b/src/osd/osdnet.cpp
@@ -7,11 +7,11 @@ static class simple_list<osd_netdev::entry_t> netdev_list;
void add_netdev(const char *name, const char *description, create_netdev func)
{
- osd_netdev::entry_t *entry = global_alloc_clear(osd_netdev::entry_t);
+ auto entry = global_alloc_clear(osd_netdev::entry_t);
entry->id = netdev_list.count();
strncpy(entry->name, name, 255);
entry->name[255] = '\0';
- strncpy(entry->description, (description != NULL) ? description : "(no name)", 255);
+ strncpy(entry->description, (description != nullptr) ? description : "(no name)", 255);
entry->description[255] = '\0';
entry->func = func;
netdev_list.append(*entry);
@@ -35,7 +35,7 @@ class osd_netdev *open_netdev(int id, class device_network_interface *ifdev, int
entry = entry->m_next;
}
- return NULL;
+ return nullptr;
}
osd_netdev::osd_netdev(class device_network_interface *ifdev, int rate)
diff --git a/src/osd/sdl/watchdog.cpp b/src/osd/sdl/watchdog.cpp
index c3fef7a7709..01d98f460dc 100644
--- a/src/osd/sdl/watchdog.cpp
+++ b/src/osd/sdl/watchdog.cpp
@@ -38,7 +38,7 @@ static void *watchdog_thread(void *param)
osd_process_kill();
}
}
- return NULL;
+ return nullptr;
}
watchdog::watchdog(void)
diff --git a/src/osd/windows/ledutil.cpp b/src/osd/windows/ledutil.cpp
index 6788fdaf53e..6106005145e 100644
--- a/src/osd/windows/ledutil.cpp
+++ b/src/osd/windows/ledutil.cpp
@@ -180,13 +180,13 @@ int main(int argc, char *argv[])
// if the argument is "-kill", post a close message
if (strcmp(arg, "-kill") == 0)
{
- if (otherwnd != NULL)
+ if (otherwnd != nullptr)
PostMessage(otherwnd, WM_QUIT, 0, 0);
- return (otherwnd != NULL) ? 1 : 0;
+ return (otherwnd != nullptr) ? 1 : 0;
}
// if we had another instance, defer to it
- if (otherwnd != NULL)
+ if (otherwnd != nullptr)
return 0;
// call the startup code
@@ -205,11 +205,11 @@ int main(int argc, char *argv[])
WINDOW_STYLE,
0, 0,
1, 1,
- NULL,
- NULL,
- GetModuleHandle(NULL),
- NULL);
- if (listener_hwnd == NULL)
+ nullptr,
+ nullptr,
+ GetModuleHandle(nullptr),
+ nullptr);
+ if (listener_hwnd == nullptr)
goto error;
// allocate message ids
@@ -235,18 +235,18 @@ int main(int argc, char *argv[])
// see if MAME is already running
otherwnd = FindWindow(OUTPUT_WINDOW_CLASS, OUTPUT_WINDOW_NAME);
- if (otherwnd != NULL)
+ if (otherwnd != nullptr)
handle_mame_start((WPARAM)otherwnd, 0);
// process messages
- while (GetMessage(&message, NULL, 0, 0))
+ while (GetMessage(&message, nullptr, 0, 0))
{
TranslateMessage(&message);
DispatchMessage(&message);
}
// reset on the way out if still live
- if (mame_target != NULL)
+ if (mame_target != nullptr)
handle_mame_stop((WPARAM)mame_target, 0);
exitcode = 0;
@@ -273,7 +273,7 @@ static int create_window_class(void)
// initialize the description of the window class
wc.lpszClassName = WINDOW_CLASS;
- wc.hInstance = GetModuleHandle(NULL);
+ wc.hInstance = GetModuleHandle(nullptr);
wc.lpfnWndProc = listener_window_proc;
// register the class; fail if we can't
@@ -351,7 +351,7 @@ static LRESULT handle_mame_stop(WPARAM wparam, LPARAM lparam)
return 1;
// clear our target out
- mame_target = NULL;
+ mame_target = nullptr;
reset_id_to_outname_cache();
// reset the LED states
@@ -379,11 +379,11 @@ static LRESULT handle_copydata(WPARAM wparam, LPARAM lparam)
// allocate memory
entry = (id_map_entry *)malloc(sizeof(*entry));
- if (entry == NULL)
+ if (entry == nullptr)
return 0;
string = (char *)malloc(strlen(data->string) + 1);
- if (string == NULL)
+ if (string == nullptr)
{
free(entry);
return 0;
@@ -411,7 +411,7 @@ static LRESULT handle_copydata(WPARAM wparam, LPARAM lparam)
static void reset_id_to_outname_cache(void)
{
// free our ID list
- while (idmaplist != NULL)
+ while (idmaplist != nullptr)
{
id_map_entry *temp = idmaplist;
idmaplist = temp->next;
@@ -430,7 +430,7 @@ static const char *map_id_to_outname(WPARAM id)
id_map_entry *entry;
// see if we have an entry in our map
- for (entry = idmaplist; entry != NULL; entry = entry->next)
+ for (entry = idmaplist; entry != nullptr; entry = entry->next)
if (entry->id == id)
return entry->name;
@@ -438,7 +438,7 @@ static const char *map_id_to_outname(WPARAM id)
SendMessage(mame_target, om_mame_get_id_string, (WPARAM)listener_hwnd, id);
// now see if we have the entry in our map
- for (entry = idmaplist; entry != NULL; entry = entry->next)
+ for (entry = idmaplist; entry != nullptr; entry = entry->next)
if (entry->id == id)
return entry->name;
@@ -476,7 +476,7 @@ static void output_startup(const char *commandline)
{
// default to PS/2, override if USB is specified as a parameter
ledmethod = LED_METHOD_PS2;
- if (commandline != NULL && strcmp(commandline, "-usb") == 0)
+ if (commandline != nullptr && strcmp(commandline, "-usb") == 0)
ledmethod = LED_METHOD_USB;
// output the method
@@ -522,7 +522,7 @@ static void output_mame_start(void)
return;
}
- hKbdDev = CreateFile(TEXT("\\\\.\\Kbd"), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+ hKbdDev = CreateFile(TEXT("\\\\.\\Kbd"), GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
if (hKbdDev == INVALID_HANDLE_VALUE)
{
error_number = GetLastError();
@@ -551,7 +551,7 @@ static void output_mame_stop(void)
switch (ledmethod)
{
case LED_METHOD_PS2:
- if (!DefineDosDevice(DDD_REMOVE_DEFINITION, TEXT("Kbd"), NULL))
+ if (!DefineDosDevice(DDD_REMOVE_DEFINITION, TEXT("Kbd"), nullptr))
{
error_number = GetLastError();
fprintf(stderr, "Unable to close the keyboard device. (error %d)\n", error_number);
@@ -632,9 +632,9 @@ static int led_get_state(void)
OutputBuffer.UnitId = 0;
DeviceIoControl(hKbdDev, IOCTL_KEYBOARD_QUERY_INDICATORS,
- NULL, 0,
+ nullptr, 0,
&OutputBuffer, DataLength,
- &ReturnedLength, NULL);
+ &ReturnedLength, nullptr);
// Demangle lights to match 95/98
if (OutputBuffer.LedFlags & KEYBOARD_NUM_LOCK_ON) result |= 0x1;
@@ -702,8 +702,8 @@ static void led_set_state(int state)
InputBuffer.LedFlags = LedFlags;
DeviceIoControl(hKbdDev, IOCTL_KEYBOARD_SET_INDICATORS,
&InputBuffer, DataLength,
- NULL, 0,
- &ReturnedLength, NULL);
+ nullptr, 0,
+ &ReturnedLength, nullptr);
break;
}
}
diff --git a/src/osd/windows/output.cpp b/src/osd/windows/output.cpp
index 41f2fd26201..0419d9bc2a7 100644
--- a/src/osd/windows/output.cpp
+++ b/src/osd/windows/output.cpp
@@ -85,7 +85,7 @@ bool windows_osd_interface::output_init()
int result;
// reset globals
- clientlist = NULL;
+ clientlist = nullptr;
// create our window class
result = create_window_class();
@@ -100,11 +100,11 @@ bool windows_osd_interface::output_init()
WINDOW_STYLE,
0, 0,
1, 1,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
GetModuleHandleUni(),
- NULL);
- assert(output_hwnd != NULL);
+ nullptr);
+ assert(output_hwnd != nullptr);
// set a pointer to the running machine
SetWindowLongPtr(output_hwnd, GWLP_USERDATA, (LONG_PTR)&machine());
@@ -128,7 +128,7 @@ bool windows_osd_interface::output_init()
PostMessage(HWND_BROADCAST, om_mame_start, (WPARAM)output_hwnd, 0);
// register a notifier for output changes
- output_set_notifier(NULL, notifier_callback, NULL);
+ output_set_notifier(nullptr, notifier_callback, nullptr);
return true;
}
@@ -141,7 +141,7 @@ bool windows_osd_interface::output_init()
void windows_osd_interface::output_exit()
{
// free all the clients
- while (clientlist != NULL)
+ while (clientlist != nullptr)
{
registered_client *temp = clientlist;
clientlist = temp->next;
@@ -219,7 +219,7 @@ static LRESULT register_client(HWND hwnd, LPARAM id)
// find the end of the list; if we find ourself already registered,
// return 1
- for (client = &clientlist; *client != NULL; client = &(*client)->next)
+ for (client = &clientlist; *client != nullptr; client = &(*client)->next)
if ((*client)->id == id)
{
(*client)->hwnd = hwnd;
@@ -229,7 +229,7 @@ static LRESULT register_client(HWND hwnd, LPARAM id)
// add us to the end
*client = global_alloc(registered_client);
- (*client)->next = NULL;
+ (*client)->next = nullptr;
(*client)->id = id;
(*client)->hwnd = hwnd;
@@ -249,7 +249,7 @@ static LRESULT unregister_client(HWND hwnd, LPARAM id)
int found = FALSE;
// find any matching IDs in the list and remove them
- for (client = &clientlist; *client != NULL; client = &(*client)->next)
+ for (client = &clientlist; *client != nullptr; client = &(*client)->next)
if ((*client)->id == id)
{
registered_client *temp = *client;
@@ -281,7 +281,7 @@ static LRESULT send_id_string(running_machine &machine, HWND hwnd, LPARAM id)
name = output_id_to_name(id);
// a NULL name is an empty string
- if (name == NULL)
+ if (name == nullptr)
name = "";
// allocate memory for the message
@@ -310,7 +310,7 @@ static void notifier_callback(const char *outname, INT32 value, void *param)
registered_client *client;
// loop over clients and notify them
- for (client = clientlist; client != NULL; client = client->next)
- if (param == NULL || param == client)
+ for (client = clientlist; client != nullptr; client = client->next)
+ if (param == nullptr || param == client)
PostMessage(client->hwnd, om_mame_update_state, output_name_to_id(outname), value);
}
diff --git a/src/osd/windows/winsocket.cpp b/src/osd/windows/winsocket.cpp
index 78c3a6161d4..cfa22dbbcb1 100644
--- a/src/osd/windows/winsocket.cpp
+++ b/src/osd/windows/winsocket.cpp
@@ -59,7 +59,7 @@ bool win_check_socket_path(const char *path)
{
if (strlen(winfile_socket_identifier) > 0 &&
strncmp(path, winfile_socket_identifier, strlen(winfile_socket_identifier)) == 0 &&
- strchr(path, ':') != NULL) return true;
+ strchr(path, ':') != nullptr) return true;
return false;
}
@@ -105,7 +105,7 @@ file_error win_open_socket(const char *path, UINT32 openflags, osd_file **file,
}
// mark socket as "listening"
- (*file)->handle = 0;
+ (*file)->handle = nullptr;
*filesize = 0;
return FILERR_NONE;
}
@@ -131,7 +131,7 @@ file_error win_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 c
FD_SET(file->socket, &readfds);
timeout.tv_sec = timeout.tv_usec = 0;
- if (select(file->socket + 1, &readfds, NULL, NULL, &timeout) < 0)
+ if (select(file->socket + 1, &readfds, nullptr, nullptr, &timeout) < 0)
{
sprintf(line, "win_read_socket : %s : %d ", __FILE__, __LINE__);
perror(line);
@@ -148,7 +148,7 @@ file_error win_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 c
{
// listening socket
SOCKET AcceptSocket;
- AcceptSocket = accept(file->socket, NULL, NULL);
+ AcceptSocket = accept(file->socket, nullptr, nullptr);
if (AcceptSocket == INVALID_SOCKET)
{
return FILERR_FAILURE;
@@ -156,7 +156,7 @@ file_error win_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 c
closesocket(file->socket);
file->socket = AcceptSocket;
file->handle = INVALID_HANDLE_VALUE;
- if (actual != NULL )
+ if (actual != nullptr )
{
*actual = 0;
}
@@ -174,7 +174,7 @@ file_error win_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 c
return win_error_to_mame_file_error(GetLastError());
}
- if (actual != NULL )
+ if (actual != nullptr )
{
*actual = result;
}
@@ -190,7 +190,7 @@ file_error win_write_socket(osd_file *file, const void *buffer, UINT64 offset, U
return win_error_to_mame_file_error(GetLastError());
}
- if (actual != NULL )
+ if (actual != nullptr )
{
*actual = result;
}