clang-modernize part 5

This commit is contained in:
Miodrag Milanovic 2015-12-04 07:06:18 +01:00
parent 41681c1703
commit 5a2f80dcde
123 changed files with 974 additions and 974 deletions

View File

@ -65,7 +65,7 @@ public:
template<class _FunctionClass> device_delegate(typename basetype::template traits<_FunctionClass>::member_func_type funcptr, const char *name, const char *devname, _FunctionClass *object) : basetype(funcptr, name, (_FunctionClass *)nullptr), device_delegate_helper(devname) { }
#ifdef USE_STATIC_DELEGATE
template<class _FunctionClass> device_delegate(typename basetype::template traits<_FunctionClass>::static_func_type funcptr, const char *name, const char *devname, _FunctionClass *object) : basetype(funcptr, name, (_FunctionClass *)0), device_delegate_helper(devname) { }
template<class _FunctionClass> device_delegate(typename basetype::template traits<_FunctionClass>::static_ref_func_type funcptr, const char *name, const char *devname, _FunctionClass *object) : basetype(funcptr, name, (_FunctionClass *)0), device_delegate_helper(devname) { }
template<class _FunctionClass> device_delegate(typename basetype::template traits<_FunctionClass>::static_ref_func_type funcptr, const char *name, const char *devname, _FunctionClass *object) : basetype(funcptr, name, (_FunctionClass *)nullptr), device_delegate_helper(devname) { }
device_delegate(typename basetype::template traits<device_t>::static_func_type funcptr, const char *name) : basetype(funcptr, name, (device_t *)nullptr), device_delegate_helper(NULL) { }
device_delegate(typename basetype::template traits<device_t>::static_ref_func_type funcptr, const char *name) : basetype(funcptr, name, (device_t *)nullptr), device_delegate_helper(NULL) { }
#endif

View File

@ -336,7 +336,7 @@ public:
{
if (isvalidation) return true;
this->m_target = reinterpret_cast<_PointerType *>(this->find_memregion(sizeof(_PointerType), m_length, _Required));
return this->report_missing(this->m_target != NULL, "memory region", _Required);
return this->report_missing(this->m_target != nullptr, "memory region", _Required);
}
protected:

View File

@ -150,7 +150,7 @@ public:
template<typename _ItemType>
void save_item(_ItemType &value, const char *valname, int index = 0) { save_item(nullptr, "global", nullptr, index, value, valname); }
template<typename _ItemType>
void save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { save_pointer(NULL, "global", NULL, index, value, valname, count); }
void save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { save_pointer(nullptr, "global", nullptr, index, value, valname, count); }
// file processing
static save_error check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...));

View File

@ -457,7 +457,7 @@ typedef device_type_iterator<&device_creator<screen_device>, screen_device> scre
template<class _FunctionClass>
inline screen_update_ind16_delegate screen_update_delegate_smart(UINT32 (_FunctionClass::*callback)(screen_device &, bitmap_ind16 &, const rectangle &), const char *name, const char *devname)
{
return screen_update_ind16_delegate(callback, name, devname, (_FunctionClass *)0);
return screen_update_ind16_delegate(callback, name, devname, (_FunctionClass *)nullptr);
}
template<class _FunctionClass>

View File

@ -4,7 +4,7 @@
#include "filter.h"
static filter* filter_alloc(void) {
auto f = global_alloc(filter);
auto f = global_alloc(filter);
return f;
}
@ -22,7 +22,7 @@ void filter_state_reset(filter* f, filter_state* s) {
filter_state* filter_state_alloc(void) {
int i;
auto s = global_alloc(filter_state);
auto s = global_alloc(filter_state);
s->prev_mac = 0;
for(i=0;i<FILTER_ORDER_MAX;++i)
s->xprev[i] = 0;

View File

@ -89,7 +89,7 @@ protected:
: device_t(mconfig, type, name, tag, owner, 0, shortname, file),
m_xorigin(0),
m_yorigin(0),
m_spriteram(NULL),
m_spriteram(nullptr),
m_spriteram_bytes(0),
m_dirty(dirty_granularity)
{

View File

@ -129,7 +129,7 @@ static int a26_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
}
static int a26_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
return a26_cas_do_work( NULL, casdata );
return a26_cas_do_work( nullptr, casdata );
}
static const struct CassetteLegacyWaveFiller a26_legacy_fill_wave = {
@ -160,7 +160,7 @@ static const struct CassetteFormat a26_cassette_format = {
"a26",
a26_cassette_identify,
a26_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(a26_cassette_formats)

View File

@ -151,7 +151,7 @@ static int ace_tap_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen;
return ace_handle_tap( NULL, casdata );
return ace_handle_tap( nullptr, casdata );
}
@ -184,7 +184,7 @@ static const struct CassetteFormat ace_tap_format =
"tap",
ace_tap_identify,
ace_tap_load,
NULL
nullptr
};

View File

@ -204,7 +204,7 @@ static casserr_t coladam_ddp_load( cassette_image *cass )
static const struct CassetteFormat coladam_ddp =
{ "ddp", coladam_ddp_identify, coladam_ddp_load, NULL /* no save */ };
{ "ddp", coladam_ddp_identify, coladam_ddp_load, nullptr /* no save */ };
CASSETTE_FORMATLIST_START(coleco_adam_cassette_formats)
CASSETTE_FORMAT(coladam_ddp)

View File

@ -232,7 +232,7 @@ static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, i
nibble = (UINT8 *)buffer;
nibble += sector * APPLE2_SMALL_NIBBLE_SIZE;
disk_decode_nib(sector_buffer, nibble, NULL, NULL, NULL);
disk_decode_nib(sector_buffer, nibble, nullptr, nullptr, nullptr);
floppy_write_sector(floppy, head, track, sector, 0, sector_buffer, sizeof(sector_buffer), 0);
}
@ -376,14 +376,14 @@ static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, i
if (buflen != APPLE2_SECTOR_SIZE)
return FLOPPY_ERROR_INTERNAL;
err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, NULL);
err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, nullptr);
if (err)
return err;
track_data = (UINT8 *) track_data_v;
nibble = track_data + (sector * APPLE2_NIBBLE_SIZE);
if (disk_decode_nib((UINT8 *)buffer, nibble, NULL, NULL, NULL))
if (disk_decode_nib((UINT8 *)buffer, nibble, nullptr, nullptr, nullptr))
return FLOPPY_ERROR_INVALIDIMAGE;
return FLOPPY_ERROR_SUCCESS;
@ -465,7 +465,7 @@ static floperr_t apple2_nib_write_sector(floppy_image_legacy *floppy, int head,
if (buflen != APPLE2_SECTOR_SIZE)
return FLOPPY_ERROR_INTERNAL;
err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, NULL);
err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, nullptr);
if (err)
return err;
track_data = (UINT8 *) track_data_v;
@ -494,19 +494,19 @@ static UINT32 apple2_get_track_size(floppy_image_legacy *floppy, int head, int t
/* ----------------------------------------------------------------------- */
LEGACY_FLOPPY_OPTIONS_START( apple2 )
LEGACY_FLOPPY_OPTION( apple2_do, "do,dsk,bin", "Apple ][ DOS order disk image", apple2_dsk_identify, apple2_do_construct, NULL,
LEGACY_FLOPPY_OPTION( apple2_do, "do,dsk,bin", "Apple ][ DOS order disk image", apple2_dsk_identify, apple2_do_construct, nullptr,
HEADS([1])
TRACKS([35])
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([0]))
LEGACY_FLOPPY_OPTION( apple2_po, "po,dsk,bin", "Apple ][ ProDOS order disk image", apple2_dsk_identify, apple2_po_construct, NULL,
LEGACY_FLOPPY_OPTION( apple2_po, "po,dsk,bin", "Apple ][ ProDOS order disk image", apple2_dsk_identify, apple2_po_construct, nullptr,
HEADS([1])
TRACKS([35])
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([0]))
LEGACY_FLOPPY_OPTION( apple2_nib, "dsk,nib", "Apple ][ Nibble order disk image", apple2_nib_identify, apple2_nib_construct, NULL,
LEGACY_FLOPPY_OPTION( apple2_nib, "dsk,nib", "Apple ][ Nibble order disk image", apple2_nib_identify, apple2_nib_construct, nullptr,
HEADS([1])
TRACKS([35])
SECTORS([16])

View File

@ -488,7 +488,7 @@ static UINT32 apple35_get_offset(floppy_image_legacy *floppy, int head, int trac
static floperr_t apple35_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
UINT32 data_offset;
data_offset = apple35_get_offset(floppy, head, track, sector, NULL);
data_offset = apple35_get_offset(floppy, head, track, sector, nullptr);
if (data_offset == ~0)
{
return FLOPPY_ERROR_SEEKERROR;
@ -503,7 +503,7 @@ static floperr_t apple35_write_sector(floppy_image_legacy *floppy, int head, int
{
UINT32 data_offset;
data_offset = apple35_get_offset(floppy, head, track, sector, NULL);
data_offset = apple35_get_offset(floppy, head, track, sector, nullptr);
if (data_offset == ~0)
return FLOPPY_ERROR_SEEKERROR;
floppy_image_write(floppy, buffer, data_offset, buflen);
@ -976,7 +976,7 @@ static floperr_t apple35_diskcopy_headerdecode(floppy_image_legacy *floppy, UINT
static FLOPPY_IDENTIFY(apple35_diskcopy_identify)
{
*vote = apple35_diskcopy_headerdecode(floppy, NULL, NULL, NULL, NULL, NULL, NULL) ? 0 : 100;
*vote = apple35_diskcopy_headerdecode(floppy, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) ? 0 : 100;
return FLOPPY_ERROR_SUCCESS;
}
@ -1121,7 +1121,7 @@ static floperr_t apple35_2img_decode(floppy_image_legacy *floppy, UINT32 *image_
static FLOPPY_IDENTIFY(apple35_2img_identify)
{
*vote = apple35_2img_decode(floppy, NULL, NULL, NULL) ? 0 : 100;
*vote = apple35_2img_decode(floppy, nullptr, nullptr, nullptr) ? 0 : 100;
return FLOPPY_ERROR_SUCCESS;
}
@ -1175,12 +1175,12 @@ static FLOPPY_CONSTRUCT(apple35_2img_construct)
LEGACY_FLOPPY_OPTIONS_START( apple35_mac )
LEGACY_FLOPPY_OPTION( apple35_raw, "dsk,img,image", "Apple raw 3.5\" disk image", apple35_raw_identify, apple35_raw_construct, NULL,
LEGACY_FLOPPY_OPTION( apple35_raw, "dsk,img,image", "Apple raw 3.5\" disk image", apple35_raw_identify, apple35_raw_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])
FIRST_SECTOR_ID([0]))
LEGACY_FLOPPY_OPTION( apple35_dc, "dc,dc42,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, NULL,
LEGACY_FLOPPY_OPTION( apple35_dc, "dc,dc42,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])
@ -1188,17 +1188,17 @@ LEGACY_FLOPPY_OPTIONS_START( apple35_mac )
LEGACY_FLOPPY_OPTIONS_END
LEGACY_FLOPPY_OPTIONS_START( apple35_iigs )
LEGACY_FLOPPY_OPTION( apple35_raw, "dsk,img,image,po", "Apple raw 3.5\" disk image", apple35_raw_identify, apple35_raw_construct, NULL,
LEGACY_FLOPPY_OPTION( apple35_raw, "dsk,img,image,po", "Apple raw 3.5\" disk image", apple35_raw_identify, apple35_raw_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])
FIRST_SECTOR_ID([0]))
LEGACY_FLOPPY_OPTION( apple35_dc, "dc,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, NULL,
LEGACY_FLOPPY_OPTION( apple35_dc, "dc,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])
FIRST_SECTOR_ID([0]))
LEGACY_FLOPPY_OPTION( apple35_2img, "2img,2mg", "Apple ][gs 2IMG disk image", apple35_2img_identify, apple35_2img_construct, NULL,
LEGACY_FLOPPY_OPTION( apple35_2img, "2img,2mg", "Apple ][gs 2IMG disk image", apple35_2img_identify, apple35_2img_construct, nullptr,
HEADS([1]-2)
TRACKS([80])
SECTOR_LENGTH([512])

View File

@ -172,14 +172,14 @@ static int apf_apt_calculate_size_in_samples(const UINT8 *bytes, int length)
{
apf_image_size = length;
return apf_apt_handle_cassette(NULL, bytes);
return apf_apt_handle_cassette(nullptr, bytes);
}
static int apf_cpf_calculate_size_in_samples(const UINT8 *bytes, int length)
{
apf_image_size = length;
return apf_cpf_handle_cassette(NULL, bytes);
return apf_cpf_handle_cassette(nullptr, bytes);
}
//*********************************************************************************
@ -210,7 +210,7 @@ static const struct CassetteFormat apf_cpf_format =
"cas,cpf",
apf_cpf_identify,
apf_cpf_load,
NULL
nullptr
};
//*********************************************************************************
@ -241,7 +241,7 @@ static const struct CassetteFormat apf_apt_format =
"apt",
apf_apt_identify,
apf_apt_load,
NULL
nullptr
};
//*********************************************************************************

View File

@ -31,7 +31,7 @@ LEGACY_FLOPPY_OPTIONS_START( atari_only )
"Atari floppy disk image",
atari_dsk_identify,
atari_dsk_construct,
NULL,
NULL
nullptr,
nullptr
)
LEGACY_FLOPPY_OPTIONS_END0

View File

@ -138,7 +138,7 @@ const struct CassetteFormat atom_tap_format =
"tap",
atom_tap_identify,
atom_tap_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START( atom_cassette_formats )

View File

@ -184,7 +184,7 @@ static floperr_t basicdsk_format_track(floppy_image_legacy *floppy, int head, in
{
floperr_t err = FLOPPY_ERROR_SUCCESS;
UINT8 local_buffer[512];
void *alloc_buffer = NULL;
void *alloc_buffer = nullptr;
void *buffer;
UINT32 sector_length;
int sector;
@ -206,7 +206,7 @@ static floperr_t basicdsk_format_track(floppy_image_legacy *floppy, int head, in
}
else
{
alloc_buffer = NULL;
alloc_buffer = nullptr;
buffer = local_buffer;
}
@ -245,7 +245,7 @@ static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int hea
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, NULL);
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;

View File

@ -150,7 +150,7 @@ static int camplynx_cassette_calculate_size_in_samples(const UINT8 *bytes, int l
{
camplynx_image_size = length;
return camplynx_handle_cassette(NULL, bytes);
return camplynx_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller lynx48k_legacy_fill_wave =
@ -200,7 +200,7 @@ static const struct CassetteFormat lynx48k_cassette_image_format =
"tap",
lynx48k_cassette_identify,
lynx48k_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat lynx128k_cassette_image_format =
@ -208,7 +208,7 @@ static const struct CassetteFormat lynx128k_cassette_image_format =
"tap",
lynx128k_cassette_identify,
lynx128k_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(lynx48k_cassette_formats)

View File

@ -100,7 +100,7 @@ static void cassette_finishinit(casserr_t err, cassette_image *cassette, cassett
if (cassette && (err || !outcassette))
{
cassette_close(cassette);
cassette = NULL;
cassette = nullptr;
}
if (outcassette)
*outcassette = cassette;
@ -133,7 +133,7 @@ casserr_t cassette_open_choices(void *file, const struct io_procs *procs, const
formats = cassette_default_formats;
/* create the cassette object */
cassette = cassette_init(NULL, file, procs, flags);
cassette = cassette_init(nullptr, file, procs, flags);
if (!cassette)
{
err = CASSETTE_ERROR_OUTOFMEMORY;
@ -141,7 +141,7 @@ casserr_t cassette_open_choices(void *file, const struct io_procs *procs, const
}
/* identify the image */
format = NULL;
format = nullptr;
for (i = 0; !format && formats[i]; i++)
{
if (good_format(formats[i], extension, flags))
@ -150,7 +150,7 @@ casserr_t cassette_open_choices(void *file, const struct io_procs *procs, const
memset(&opts, 0, sizeof(opts));
err = format->identify(cassette, &opts);
if (err == CASSETTE_ERROR_INVALIDIMAGE)
format = NULL;
format = nullptr;
else if (err)
goto done;
}
@ -189,8 +189,8 @@ casserr_t cassette_open(void *file, const struct io_procs *procs,
{
const struct CassetteFormat *formats[2];
formats[0] = format;
formats[1] = NULL;
return cassette_open_choices(file, procs, NULL, formats, flags, outcassette);
formats[1] = nullptr;
return cassette_open_choices(file, procs, nullptr, formats, flags, outcassette);
}
@ -207,7 +207,7 @@ casserr_t cassette_create(void *file, const struct io_procs *procs, const struct
return CASSETTE_ERROR_INVALIDIMAGE;
/* is this a good format? */
if (!good_format(format, NULL, flags))
if (!good_format(format, nullptr, flags))
return CASSETTE_ERROR_INVALIDIMAGE;
/* normalize arguments */
@ -374,7 +374,7 @@ static casserr_t compute_manipulation_ranges(cassette_image *cassette, int chann
static casserr_t lookup_sample(cassette_image *cassette, int channel, size_t sample, INT32 **ptr)
{
*ptr = NULL;
*ptr = nullptr;
size_t sample_blocknum = (sample / SAMPLES_PER_BLOCK) * cassette->channels + channel;
size_t sample_index = sample % SAMPLES_PER_BLOCK;
@ -385,7 +385,7 @@ static casserr_t lookup_sample(cassette_image *cassette, int channel, size_t sam
memset(&cassette->blocks[osize], 0, (cassette->blocks.size()-osize)*sizeof(cassette->blocks[0]));
}
if (cassette->blocks[sample_blocknum] == NULL)
if (cassette->blocks[sample_blocknum] == nullptr)
cassette->blocks[sample_blocknum] = global_alloc(sample_block);
sample_block &block = *cassette->blocks[sample_blocknum];
@ -763,7 +763,7 @@ casserr_t cassette_read_modulated_data(cassette_image *cassette, int channel, do
casserr_t err;
UINT8 buffer_stack[1024];
UINT8 *buffer;
UINT8 *alloc_buffer = NULL;
UINT8 *alloc_buffer = nullptr;
double delta;
double total_displacement = 0.0;
size_t this_length;

View File

@ -157,7 +157,7 @@ static void toggle_wave_data(void )
static void cbm_output_wave( INT16 **buffer, int length )
{
if (buffer == NULL)
if (buffer == nullptr)
return;
for( ; length > 0; length-- )
@ -187,7 +187,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
/* int waveamp_high, waveamp_low; */
/* Log .TAP info but only once */
if (!(buffer == NULL))
if (!(buffer == nullptr))
{
LOG_FORMATS("TAP version : %d\n", version);
LOG_FORMATS("Machine type : %d\n", system);
@ -204,7 +204,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
}
/* is the .tap file corrupted? */
if ((data == NULL) || (length <= CBM_HEADER_SIZE))
if ((data == nullptr) || (length <= CBM_HEADER_SIZE))
return -1;
@ -321,7 +321,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
static int cbm_tap_to_wav_size( const UINT8 *tapdata, int taplen )
{
int size = cbm_tap_do_work(NULL, taplen, tapdata);
int size = cbm_tap_do_work(nullptr, taplen, tapdata);
len = taplen;
return size;
@ -364,7 +364,7 @@ static const struct CassetteFormat cbm_tap_cassette_format = {
"tap",
cbm_cassette_identify,
cbm_cassette_load,
NULL
nullptr
};

View File

@ -109,7 +109,7 @@ bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if (byteoffs==78720) break;
hex[0]=line[byte * 2];
hex[1]=line[(byte * 2) + 1];
bytes[byteoffs++] = strtol(hex, NULL, 16);
bytes[byteoffs++] = strtol(hex, nullptr, 16);
}
}
start = end + 1;

View File

@ -111,7 +111,7 @@ static int cgenie_cas_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen;
return cgenie_handle_cas( NULL, casdata );
return cgenie_handle_cas( nullptr, casdata );
}
static const struct CassetteLegacyWaveFiller cgenie_cas_legacy_fill_wave =
@ -143,7 +143,7 @@ static const struct CassetteFormat cgenie_cas_format =
"cas",
cgenie_cas_identify,
cgenie_cas_load,
NULL
nullptr
};

View File

@ -277,7 +277,7 @@ const struct CassetteFormat coco_cas_format =
"cas",
coco_cas_identify,
coco_cas_load,
NULL
nullptr
};
const struct CassetteFormat alice32_cas_format =
@ -285,7 +285,7 @@ const struct CassetteFormat alice32_cas_format =
"cas,c10,k7",
coco_cas_identify,
alice32_cas_load,
NULL
nullptr
};

View File

@ -128,7 +128,7 @@ static floperr_t cqm_read_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t cqm_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, NULL);
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;

View File

@ -110,9 +110,9 @@ static int csw_cas_to_wav_size( const UINT8 *casdata, int caslen )
d_stream.avail_out = 1;
d_stream.total_out=0;
d_stream.zalloc = 0;
d_stream.zfree = 0;
d_stream.opaque = 0;
d_stream.zalloc = nullptr;
d_stream.zfree = nullptr;
d_stream.opaque = nullptr;
d_stream.data_type=0;
err = inflateInit( &d_stream );
@ -218,9 +218,9 @@ static int csw_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
d_stream.avail_out = 1;
d_stream.total_out=0;
d_stream.zalloc = 0;
d_stream.zfree = 0;
d_stream.opaque = 0;
d_stream.zalloc = nullptr;
d_stream.zfree = nullptr;
d_stream.opaque = nullptr;
d_stream.data_type=0;
err = inflateInit( &d_stream );
@ -300,7 +300,7 @@ static const struct CassetteFormat csw_cassette_format = {
"csw",
csw_cassette_identify,
csw_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(csw_cassette_formats)

View File

@ -319,7 +319,7 @@ FLOPPY_IDENTIFY(d88_dsk_identify)
{
UINT32 size;
d88_get_header(floppy,&size,NULL,NULL,NULL);
d88_get_header(floppy,&size,nullptr,nullptr,nullptr);
if(floppy_image_size(floppy) == size)
{
@ -517,7 +517,7 @@ bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sdatapos += size;
} else
sects[i].data = NULL;
sects[i].data = nullptr;
}
build_pc_track_mfm(track, head, image, cell_count, sector_count, sects, calc_default_pc_gap3_size(form_factor, sects[0].actual_size));

View File

@ -162,7 +162,7 @@ static floperr_t dsk_write_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t dsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, NULL);
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@ -179,7 +179,7 @@ static floperr_t dsk_get_indexed_sector_info(floppy_image_legacy *floppy, int he
UINT8 sector_info[0x100];
int pos;
retVal = get_offset(floppy, head, track, sector_index, FALSE, NULL);
retVal = get_offset(floppy, head, track, sector_index, FALSE, nullptr);
offset = dsk_get_track_offset(floppy,head,track);
pos = 0x18 + (sector_index << 3);
floppy_image_read(floppy, sector_info, offset, 0x100);
@ -419,7 +419,7 @@ bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sdatapos += sects[j].actual_size;
} else
sects[j].data = NULL;
sects[j].data = nullptr;
if(extendformat)
pos += sector.data_length;

View File

@ -119,7 +119,7 @@ static int fc100_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
{
fc100_image_size = length;
return fc100_handle_cassette(NULL, bytes);
return fc100_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller fc100_legacy_fill_wave =
@ -148,7 +148,7 @@ static const struct CassetteFormat fc100_cassette_image_format =
"cas",
fc100_cassette_identify,
fc100_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(fc100_cassette_formats)

View File

@ -81,11 +81,11 @@ static floppy_image_legacy *floppy_init(void *fp, const struct io_procs *procs,
floppy = (floppy_image_legacy *)malloc(sizeof(floppy_image_legacy));
if (!floppy)
return NULL;
return nullptr;
memset(floppy, 0, sizeof(*floppy));
floppy->tags = pool_alloc_lib(NULL);
floppy->tag_data = NULL;
floppy->tags = pool_alloc_lib(nullptr);
floppy->tag_data = nullptr;
floppy->io.file = fp;
floppy->io.procs = procs;
floppy->io.filler = 0xFF;
@ -151,7 +151,7 @@ static floperr_t floppy_open_internal(void *fp, const struct io_procs *procs, co
if (outfloppy)
{
/* call the format constructor */
err = floppy_options[best_option].construct(floppy, &floppy_options[best_option], NULL);
err = floppy_options[best_option].construct(floppy, &floppy_options[best_option], nullptr);
if (err)
goto done;
@ -168,7 +168,7 @@ done:
if (floppy && (!outfloppy || err))
{
floppy_close_internal(floppy, FALSE);
floppy = NULL;
floppy = nullptr;
}
if (outoption)
@ -183,7 +183,7 @@ done:
floperr_t floppy_identify(void *fp, const struct io_procs *procs, const char *extension,
const struct FloppyFormat *formats, int *identified_format)
{
return floppy_open_internal(fp, procs, extension, formats, INT_MAX, FLOPPY_FLAGS_READONLY, NULL, identified_format);
return floppy_open_internal(fp, procs, extension, formats, INT_MAX, FLOPPY_FLAGS_READONLY, nullptr, identified_format);
}
@ -191,7 +191,7 @@ floperr_t floppy_identify(void *fp, const struct io_procs *procs, const char *ex
floperr_t floppy_open(void *fp, const struct io_procs *procs, const char *extension,
const struct FloppyFormat *format, int flags, floppy_image_legacy **outfloppy)
{
return floppy_open_internal(fp, procs, extension, format, 1, flags, outfloppy, NULL);
return floppy_open_internal(fp, procs, extension, format, 1, flags, outfloppy, nullptr);
}
@ -199,7 +199,7 @@ floperr_t floppy_open(void *fp, const struct io_procs *procs, const char *extens
floperr_t floppy_open_choices(void *fp, const struct io_procs *procs, const char *extension,
const struct FloppyFormat *formats, int flags, floppy_image_legacy **outfloppy)
{
return floppy_open_internal(fp, procs, extension, formats, INT_MAX, flags, outfloppy, NULL);
return floppy_open_internal(fp, procs, extension, formats, INT_MAX, flags, outfloppy, nullptr);
}
@ -231,11 +231,11 @@ static floperr_t option_to_floppy_error(optreserr_t oerr)
floperr_t floppy_create(void *fp, const struct io_procs *procs, const struct FloppyFormat *format, option_resolution *parameters, floppy_image_legacy **outfloppy)
{
floppy_image_legacy *floppy = NULL;
floppy_image_legacy *floppy = nullptr;
optreserr_t oerr;
floperr_t err;
int heads, tracks, h, t;
option_resolution *alloc_resolution = NULL;
option_resolution *alloc_resolution = nullptr;
assert(format);
@ -307,7 +307,7 @@ done:
if (err && floppy)
{
floppy_close_internal(floppy, FALSE);
floppy = NULL;
floppy = nullptr;
}
if (outfloppy)
@ -474,7 +474,7 @@ static floperr_t floppy_readwrite_sector(floppy_image_legacy *floppy, int head,
{
/* find out the size of this sector */
if (indexed)
err = fmt->get_indexed_sector_info(floppy, head, track, sector, NULL, NULL, NULL, &sector_length, NULL);
err = fmt->get_indexed_sector_info(floppy, head, track, sector, nullptr, nullptr, nullptr, &sector_length, nullptr);
else
err = fmt->get_sector_length(floppy, head, track, sector, &sector_length);
if (err)
@ -683,7 +683,7 @@ floperr_t floppy_format_track(floppy_image_legacy *floppy, int head, int track,
{
floperr_t err;
struct FloppyCallbacks *format;
option_resolution *alloc_resolution = NULL;
option_resolution *alloc_resolution = nullptr;
optreserr_t oerr;
/* supported? */
@ -785,7 +785,7 @@ floperr_t floppy_get_sector_count(floppy_image_legacy *floppy, int head, int tra
do
{
err = floppy_get_indexed_sector_info(floppy, head, track, sector_index, NULL, NULL, NULL, NULL, NULL);
err = floppy_get_indexed_sector_info(floppy, head, track, sector_index, nullptr, nullptr, nullptr, nullptr, nullptr);
if (!err)
sector_index++;
}
@ -867,7 +867,7 @@ floperr_t floppy_load_track(floppy_image_legacy *floppy, int head, int track, in
error:
if (track_data)
*track_data = NULL;
*track_data = nullptr;
if (track_length)
*track_length = 0;
return err;
@ -923,7 +923,7 @@ const char *floppy_error(floperr_t err)
};
if ((err < 0) || (err >= ARRAY_LENGTH(error_messages)))
return NULL;
return nullptr;
return error_messages[err];
}
@ -1017,7 +1017,7 @@ const char *floppy_image::get_variant_name(UINT32 form_factor, UINT32 variant)
floppy_image_format_t::floppy_image_format_t()
{
next = 0;
next = nullptr;
}
floppy_image_format_t::~floppy_image_format_t()
@ -2184,7 +2184,7 @@ const floppy_image_format_t::desc_e *floppy_image_format_t::atari_st_fcp_get_des
case 11:
return atari_st_fcp_11;
}
return 0;
return nullptr;
}
// Amiga layouts

View File

@ -65,7 +65,7 @@ static int fm7_cas_to_wav_size (const UINT8 *casdata, int caslen)
{
cas_size = caslen;
return fm7_handle_t77(NULL,casdata);
return fm7_handle_t77(nullptr,casdata);
}
/*******************************************************************
@ -104,7 +104,7 @@ static const struct CassetteFormat fm7_cassette_format = {
"t77",
fm7_cas_identify,
fm7_cas_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(fm7_cassette_formats)

View File

@ -136,7 +136,7 @@ static const struct CassetteFormat fmsx_cas_format =
"tap,cas",
fmsx_cas_identify,
fmsx_cas_load,
NULL
nullptr
};

View File

@ -33,7 +33,7 @@ static INT16 len;
static void gtp_output_wave( INT16 **buffer, int length ) {
if ( buffer == NULL ) {
if ( buffer == nullptr ) {
return;
}
@ -111,7 +111,7 @@ static int gtp_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
int size,n;
size = 0;
n = 0;
if (casdata == NULL) return -1;
if (casdata == nullptr) return -1;
while(n<caslen) {
int block_type = casdata[n];
int block_size = casdata[n+2]*256 + casdata[n+1];
@ -132,7 +132,7 @@ static int gtp_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
int i,size,n;
size = 0;
n = 0;
if (bytes == NULL) return -1;
if (bytes == nullptr) return -1;
while(n<len)
{
int block_type = bytes[n];
@ -192,7 +192,7 @@ static const struct CassetteFormat gtp_cassette_format = {
"gtp",
gtp_cassette_identify,
gtp_cassette_load,
NULL
nullptr
};

View File

@ -94,7 +94,7 @@ static FLOPPY_CONSTRUCT(hector_disc2_dsk800_construct)
}
LEGACY_FLOPPY_OPTIONS_START( hector_disc2 )
LEGACY_FLOPPY_OPTION( hector_dsk, "HE2", "hector disc2 floppy disk image 200K", hector_disc2_dsk200_identify, hector_disc2_dsk200_construct, NULL, NULL)
LEGACY_FLOPPY_OPTION( hector_dsk, "HE7", "hector disc2 floppy disk image 720K", hector_disc2_dsk720_identify, hector_disc2_dsk720_construct, NULL, NULL)
LEGACY_FLOPPY_OPTION( hector_dsk, "HE8", "hector disc2 floppy disk image 800K", hector_disc2_dsk800_identify, hector_disc2_dsk800_construct, NULL, NULL)
LEGACY_FLOPPY_OPTION( hector_dsk, "HE2", "hector disc2 floppy disk image 200K", hector_disc2_dsk200_identify, hector_disc2_dsk200_construct, nullptr, nullptr)
LEGACY_FLOPPY_OPTION( hector_dsk, "HE7", "hector disc2 floppy disk image 720K", hector_disc2_dsk720_identify, hector_disc2_dsk720_construct, nullptr, nullptr)
LEGACY_FLOPPY_OPTION( hector_dsk, "HE8", "hector disc2 floppy disk image 800K", hector_disc2_dsk800_identify, hector_disc2_dsk800_construct, nullptr, nullptr)
LEGACY_FLOPPY_OPTIONS_END

View File

@ -217,7 +217,7 @@ static int hector_tap_forth_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen ;
return hector_handle_forth_tap( NULL, casdata );
return hector_handle_forth_tap( nullptr, casdata );
}
/*******************************************************************
@ -236,7 +236,7 @@ static int hector_tap_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen ;
return hector_handle_tap( NULL, casdata );//forth removed here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
return hector_handle_tap( nullptr, casdata );//forth removed here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
@ -291,7 +291,7 @@ static const struct CassetteFormat hector_k7_format =
"k7,cin",
hector_k7_identify,
hector_k7_load,
NULL
nullptr
};
static const struct CassetteFormat hector_k7Forth_format =
@ -299,7 +299,7 @@ static const struct CassetteFormat hector_k7Forth_format =
"for",
hector_k7forth_identify,
hector_k7forth_load,
NULL
nullptr
};

View File

@ -168,7 +168,7 @@ void image_specify_extension(char *buffer, size_t buffer_len, const char *extens
len = strlen(buffer);
/* be aware that extension can be NULL */
if (extension != NULL)
if (extension != nullptr)
{
while(extension[extension_pos] != '\0')
{

View File

@ -155,7 +155,7 @@ static floperr_t imd_expand_file(floppy_image_legacy *floppy , UINT64 offset , s
return FLOPPY_ERROR_SUCCESS;
}
UINT8 *buffer = global_alloc_array(UINT8 , size_after_off);
auto buffer = global_alloc_array(UINT8 , size_after_off);
// Read the part of file after offset
floppy_image_read(floppy , buffer , offset , size_after_off);
@ -225,7 +225,7 @@ static floperr_t imd_write_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t imd_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, NULL);
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@ -453,10 +453,10 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
const UINT8 *snum = &img[pos];
pos += sector_count;
const UINT8 *tnum = head & 0x80 ? &img[pos] : NULL;
const UINT8 *tnum = head & 0x80 ? &img[pos] : nullptr;
if(tnum)
pos += sector_count;
const UINT8 *hnum = head & 0x40 ? &img[pos] : NULL;
const UINT8 *hnum = head & 0x40 ? &img[pos] : nullptr;
if(hnum)
pos += sector_count;
@ -475,7 +475,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sects[i].actual_size = actual_size;
if(stype == 0 || stype > 8) {
sects[i].data = NULL;
sects[i].data = nullptr;
} else {
sects[i].deleted = stype == 3 || stype == 4 || stype == 7 || stype == 8;

View File

@ -55,7 +55,7 @@ const struct io_procs stdio_ioprocs =
const struct io_procs stdio_ioprocs_noclose =
{
NULL,
nullptr,
stdio_seekproc,
stdio_readproc,
stdio_writeproc,
@ -109,7 +109,7 @@ const struct io_procs corefile_ioprocs =
const struct io_procs corefile_ioprocs_noclose =
{
NULL,
nullptr,
corefile_seekproc,
corefile_readproc,
corefile_writeproc,

View File

@ -88,7 +88,7 @@ bool ipf_format::parse(dynamic_buffer &data, floppy_image *image)
if(res)
res = generate_tracks(image);
global_free_array(tinfos);
tinfos = NULL;
tinfos = nullptr;
return res;
}
@ -118,9 +118,9 @@ bool ipf_format::parse_info(const UINT8 *info)
ipf_format::track_info *ipf_format::get_index(UINT32 idx)
{
if(idx > 1000)
return 0;
return nullptr;
if(idx >= tcount) {
track_info *ti1 = global_alloc_array_clear(track_info, idx+1);
auto ti1 = global_alloc_array_clear(track_info, idx+1);
memcpy(ti1, tinfos, tcount*sizeof(tinfos));
global_free_array(tinfos);
tcount = idx+1;

View File

@ -245,7 +245,7 @@ static int kc_kcc_to_wav_size(const UINT8 *casdata, int caslen)
{
kc_image_size = caslen ;
return kc_handle_kcc( NULL, casdata );
return kc_handle_kcc( nullptr, casdata );
}
@ -277,7 +277,7 @@ static const struct CassetteFormat kc_kcc_format =
"kcc,kcb",
kc_kcc_identify,
kc_kcc_load,
NULL
nullptr
};
@ -297,7 +297,7 @@ static int kc_tap_to_wav_size(const UINT8 *casdata, int caslen)
{
kc_image_size = caslen ;
return kc_handle_tap( NULL, casdata );
return kc_handle_tap( nullptr, casdata );
}
@ -329,7 +329,7 @@ static const struct CassetteFormat kc_tap_format =
"tap,853,854,855,tp2,kcm",
kc_tap_identify,
kc_tap_load,
NULL
nullptr
};
@ -349,7 +349,7 @@ static int kc_sss_to_wav_size(const UINT8 *casdata, int caslen)
{
kc_image_size = caslen ;
return kc_handle_sss( NULL, casdata );
return kc_handle_sss( nullptr, casdata );
}
@ -380,7 +380,7 @@ static const struct CassetteFormat kc_sss_format =
"sss",
kc_sss_identify,
kc_sss_load,
NULL
nullptr
};

View File

@ -156,7 +156,7 @@ static int kim1_kim_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen;
return kim1_handle_kim( NULL, casdata );
return kim1_handle_kim( nullptr, casdata );
}
static const struct CassetteLegacyWaveFiller kim1_kim_legacy_fill_wave =
@ -188,7 +188,7 @@ static const struct CassetteFormat kim1_kim_format =
"kim,kim1",
kim1_kim_identify,
kim1_kim_load,
NULL
nullptr
};

View File

@ -143,7 +143,7 @@ static const struct CassetteFormat lviv_lvt_image_format =
"lvt,lvr,lv0,lv1,lv2,lv3",
lviv_lvt_identify,
lviv_lvt_load,
NULL
nullptr
};

View File

@ -224,7 +224,7 @@ static int mbee_tap_calculate_size_in_samples(const UINT8 *bytes, int length)
{
mbee_image_size = length;
return mbee_handle_tap(NULL, bytes);
return mbee_handle_tap(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller mbee_tap_config =
@ -253,7 +253,7 @@ static const struct CassetteFormat mbee_tap_image_format =
"tap",
mbee_tap_identify,
mbee_tap_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(mbee_cassette_formats)

View File

@ -187,8 +187,8 @@ bool mfi_format::save(io_generic *io, floppy_image *image)
int pos = sizeof(header) + (tracks << resolution)*heads*sizeof(entry);
int epos = 0;
UINT32 *precomp = global_alloc_array(UINT32, max_track_size);
UINT8 *postcomp = global_alloc_array(UINT8, max_track_size*4 + 1000);
auto precomp = global_alloc_array(UINT32, max_track_size);
auto postcomp = global_alloc_array(UINT8, max_track_size*4 + 1000);
for(int track=0; track <= (tracks-1) << 2; track += 4 >> resolution)
for(int head=0; head<heads; head++) {

View File

@ -306,7 +306,7 @@ static const struct CassetteLegacyWaveFiller mz700_legacy_fill_wave =
fill_wave, /* fill_wave */
1, /* chunk_size */
2 * BYTE_SAMPLES, /* chunk_samples */
NULL, /* chunk_sample_calc */
nullptr, /* chunk_sample_calc */
4400, // sample_frequency (tested ok with MZ-80K, MZ-80A, MZ-700, MZ-800, MZ-1500)
MZ700_WAVESAMPLES_HEADER, /* header_samples */
1 /* trailer_samples */
@ -333,7 +333,7 @@ static const struct CassetteFormat mz700_cas_format =
"m12,mzf,mzt",
mz700_cas_identify,
mz700_cas_load,
NULL
nullptr
};

View File

@ -69,7 +69,7 @@ LEGACY_FLOPPY_OPTIONS_START( nes_only )
"NES floppy disk image",
nes_dsk_identify,
nes_dsk_construct,
NULL,
NULL
nullptr,
nullptr
)
LEGACY_FLOPPY_OPTIONS_END0

View File

@ -23,7 +23,7 @@ static INT16 wave_data;
static int len;
static void orao_output_wave( INT16 **buffer, int length ) {
if ( buffer == NULL ) {
if ( buffer == nullptr ) {
return;
}
@ -36,7 +36,7 @@ static int orao_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
int i,j,size;
UINT8 b;
if (casdata == NULL) return -1;
if (casdata == nullptr) return -1;
if (caslen <= ORAO_HEADER_SIZE) {
return -1;
}
@ -59,7 +59,7 @@ static int orao_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
int i,j,size;
UINT8 b;
size = 0;
if (bytes == NULL) return -1;
if (bytes == nullptr) return -1;
for (i=ORAO_HEADER_SIZE;i<len-ORAO_HEADER_SIZE;i++) {
for (j=0;j<8;j++) {
b = (bytes[i] >> j) & 1;
@ -113,7 +113,7 @@ static const struct CassetteFormat orao_cassette_format = {
"tap",
orao_cassette_identify,
orao_cassette_load,
NULL
nullptr
};

View File

@ -513,7 +513,7 @@ static const struct CassetteFormat oric_tap_format =
"tap",
oric_tap_identify,
oric_tap_load,
NULL
nullptr
};

View File

@ -50,7 +50,7 @@ static int pc6001_cas_to_wav_size (const UINT8 *casdata, int caslen)
{
cas_size = caslen*8;
return pc6001_handle_cas(NULL,casdata);
return pc6001_handle_cas(nullptr,casdata);
}
/*******************************************************************
@ -89,7 +89,7 @@ static const struct CassetteFormat pc6001_cassette_format = {
"cas",
pc6001_cas_identify,
pc6001_cas_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(pc6001_cassette_formats)

View File

@ -90,7 +90,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
io_generic_read(io, &raw_track[0], pos+16, entry_len-16);
UINT8 *fuzz = fuzz_len ? &raw_track[16*sect] : 0;
UINT8 *fuzz = fuzz_len ? &raw_track[16*sect] : nullptr;
UINT8 *bdata = fuzz ? fuzz+fuzz_len : &raw_track[16*sect];
UINT8 *tdata = bdata;
@ -105,7 +105,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
tsize = tdata[0] | (tdata[1] << 8);
tdata += 2;
} else
tdata = 0;
tdata = nullptr;
if(0) {
printf("Track %2d.%d: el=%d fl=%d sect=%d flags=%04x tlen=%d/%d tnum=%d flags2=%02x sync=%x\n",
@ -133,7 +133,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int s_flags = sh[14] | (sh[15] << 8);
obs.sectors[s].data = bdata + s_off;
obs.sectors[s].fuzzy_mask = 0;
obs.sectors[s].fuzzy_mask = nullptr;
memcpy(obs.sectors[s].id, sh+8, 6);
obs.sectors[s].time_ratio = s_time ? s_time / 16384.0 : 1;
obs.sectors[s].position = s_pos/8-12;

View File

@ -134,7 +134,7 @@ static FLOPPY_CONSTRUCT(pc_dsk_construct)
/* ----------------------------------------------------------------------- */
LEGACY_FLOPPY_OPTIONS_START( pc )
LEGACY_FLOPPY_OPTION( pc_dsk, "dsk,ima,img,ufi,360", "PC floppy disk image", pc_dsk_identify, pc_dsk_construct, NULL,
LEGACY_FLOPPY_OPTION( pc_dsk, "dsk,ima,img,ufi,360", "PC floppy disk image", pc_dsk_identify, pc_dsk_construct, nullptr,
HEADS([1]-2)
TRACKS(40/[80])
SECTORS(8/[9]/10/15/18/36))

View File

@ -144,7 +144,7 @@ static int phc25_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
{
phc25_image_size = length;
return phc25_handle_cassette(NULL, bytes);
return phc25_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller phc25_legacy_fill_wave =
@ -173,7 +173,7 @@ static const struct CassetteFormat phc25_cassette_image_format =
"phc",
phc25_cassette_identify,
phc25_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(phc25_cassette_formats)

View File

@ -181,7 +181,7 @@ static int pmd85_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
{
pmd85_image_size = length;
return pmd85_handle_cassette(NULL, bytes);
return pmd85_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller pmd85_legacy_fill_wave =
@ -210,7 +210,7 @@ static const struct CassetteFormat pmd85_cassette_image_format =
"pmd,tap,ptp",
pmd85_cassette_identify,
pmd85_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(pmd85_cassette_formats)

View File

@ -241,7 +241,7 @@ static const struct CassetteFormat primo_ptp_image_format =
"ptp",
primo_ptp_identify,
primo_ptp_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(primo_ptp_format)

View File

@ -217,63 +217,63 @@ static const struct CassetteFormat rku_cassette_format = {
"rku",
rk20_cassette_identify,
rk20_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat rk8_cassette_format = {
"rk8",
rk60_cassette_identify,
rk60_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat rks_cassette_format = {
"rks",
rk20_cassette_identify,
rk20_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat rko_cassette_format = {
"rko",
rk20_cassette_identify,
rk20_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat rkr_cassette_format = {
"rk,rkr",
rk20_cassette_identify,
rk20_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat rka_cassette_format = {
"rka",
rk20_cassette_identify,
rk20_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat rkm_cassette_format = {
"rkm",
rk22_cassette_identify,
rk22_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat rkp_cassette_format = {
"rkp",
rk20_cassette_identify,
rk20_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat gam_cassette_format = {
"gam,g16,pki",
gam_cassette_identify,
gam_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(rku_cassette_formats)

View File

@ -98,7 +98,7 @@ const struct CassetteFormat sc3000_bit_format =
"bit",
sc3000_bit_identify,
sc3000_bit_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START( sc3000_cassette_formats )

View File

@ -342,7 +342,7 @@ static int sol20_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
{
sol20_image_size = length;
return sol20_handle_cassette(NULL, bytes);
return sol20_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller sol20_legacy_fill_wave =
@ -371,7 +371,7 @@ static const struct CassetteFormat sol20_cassette_image_format =
"svt",
sol20_cassette_identify,
sol20_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(sol20_cassette_formats)

View File

@ -121,7 +121,7 @@ static int sorcerer_cassette_calculate_size_in_samples(const UINT8 *bytes, int l
{
sorcerer_image_size = length;
return sorcerer_handle_cassette(NULL, bytes);
return sorcerer_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller sorcerer_legacy_fill_wave =
@ -150,7 +150,7 @@ static const struct CassetteFormat sorcerer_cassette_image_format =
"tape",
sorcerer_cassette_identify,
sorcerer_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(sorcerer_cassette_formats)

View File

@ -107,7 +107,7 @@ static floperr_t sorc_write_indexed_sector(floppy_image_legacy *floppy, int head
static floperr_t sorc_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, NULL);
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@ -156,5 +156,5 @@ static FLOPPY_CONSTRUCT(sorc_dsk_construct)
/* ----------------------------------------------------------------------- */
LEGACY_FLOPPY_OPTIONS_START( sorcerer )
LEGACY_FLOPPY_OPTION( sorc_dsk, "dsk", "Exidy Sorcerer floppy disk image", sorc_dsk_identify, sorc_dsk_construct, NULL, NULL)
LEGACY_FLOPPY_OPTION( sorc_dsk, "dsk", "Exidy Sorcerer floppy disk image", sorc_dsk_identify, sorc_dsk_construct, nullptr, nullptr)
LEGACY_FLOPPY_OPTIONS_END

View File

@ -133,7 +133,7 @@ static const struct CassetteFormat sordm5_cas_format =
"cas",
sordm5_tap_identify,
sordm5_tap_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(sordm5_cassette_formats)

View File

@ -108,14 +108,14 @@ static int spc1000_tap_calculate_size_in_samples(const UINT8 *bytes, int length)
{
spc1000_image_size = length;
return spc1000_handle_tap(NULL, bytes);
return spc1000_handle_tap(nullptr, bytes);
}
static int spc1000_cas_calculate_size_in_samples(const UINT8 *bytes, int length)
{
spc1000_image_size = length;
return spc1000_handle_cas(NULL, bytes);
return spc1000_handle_cas(nullptr, bytes);
}
@ -151,7 +151,7 @@ static const struct CassetteFormat spc1000_tap_cassette_image_format =
"tap",
spc1000_tap_cassette_identify,
spc1000_tap_cassette_load,
NULL
nullptr
};
@ -182,7 +182,7 @@ static const struct CassetteFormat spc1000_cas_cassette_image_format =
"cas",
spc1000_cas_cassette_identify,
spc1000_cas_cassette_load,
NULL
nullptr
};

View File

@ -203,7 +203,7 @@ static const struct CassetteFormat svi_cas_format =
"cas",
svi_cas_identify,
svi_cas_load,
NULL
nullptr
};

View File

@ -298,7 +298,7 @@ static floperr_t td0_read_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, NULL);
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@ -699,7 +699,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
return FLOPPY_ERROR_OUTOFMEMORY;
tag->data = (UINT8*)malloc(floppy_image_size(floppy));
if (tag->data==NULL) {
if (tag->data==nullptr) {
return FLOPPY_ERROR_OUTOFMEMORY;
}
floppy_image_read(floppy, tag->data, 0, floppy_image_size(floppy));
@ -720,7 +720,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
memcpy(obuf,tag->data,12);
free(tag->data);
tag->data = (UINT8*)malloc(size+12);
if (tag->data==NULL) {
if (tag->data==nullptr) {
return FLOPPY_ERROR_OUTOFMEMORY;
}
memcpy(tag->data,obuf,12);
@ -786,7 +786,7 @@ FLOPPY_DESTRUCT( td0_dsk_destruct )
{
struct td0dsk_tag *tag = get_tag(floppy);
free(tag->data);
tag->data = NULL;
tag->data = nullptr;
return FLOPPY_ERROR_SUCCESS;
}
@ -999,7 +999,7 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sdatapos += size;
}
else
sects[i].data = NULL;
sects[i].data = nullptr;
}
track_count = track;

View File

@ -119,7 +119,7 @@ static casserr_t to7_k7_load( cassette_image *cass )
if ( to7_k7_bits )
{
free( to7_k7_bits );
to7_k7_bits = NULL;
to7_k7_bits = nullptr;
}
to7_k7_bitsize = 0;
@ -366,7 +366,7 @@ static casserr_t to7_k7_load( cassette_image *cass )
static const struct CassetteFormat to7_k7 =
{ "k7", to7_k7_identify, to7_k7_load, NULL /* no save */ };
{ "k7", to7_k7_identify, to7_k7_load, nullptr /* no save */ };
@ -392,7 +392,7 @@ static casserr_t to7_wav_load ( cassette_image *cass )
if ( to7_k7_bits )
{
free( to7_k7_bits );
to7_k7_bits = NULL;
to7_k7_bits = nullptr;
}
if ( e != CASSETTE_ERROR_SUCCESS )
@ -730,7 +730,7 @@ static casserr_t mo5_k5_load( cassette_image *cass )
static const struct CassetteFormat mo5_k5 =
{ "k5,k7", mo5_k5_identify, mo5_k5_load, NULL /* no save */ };
{ "k5,k7", mo5_k5_identify, mo5_k5_load, nullptr /* no save */ };
/********************* MO5 WAV format ************************/
@ -781,8 +781,8 @@ static const struct CassetteFormat mo5_wav =
const struct CassetteFormat *const to7_cassette_formats[] =
{ &to7_wav, &to7_k7, NULL };
{ &to7_wav, &to7_k7, nullptr };
const struct CassetteFormat *const mo5_cassette_formats[] =
{ &mo5_wav, &mo5_k5, NULL };
{ &mo5_wav, &mo5_k5, nullptr };

View File

@ -175,7 +175,7 @@ static floperr_t sap_write_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t sap_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, NULL);
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
if (err)
return err;
@ -353,37 +353,37 @@ static FLOPPY_CONSTRUCT(qdd_dsk_construct)
LEGACY_FLOPPY_OPTIONS_START(thomson)
LEGACY_FLOPPY_OPTION(fdmfm2, "fd", "Thomson FD (MFM) 80 tracks disk image (3\"1/2 DD)", basicdsk_identify_default, basicdsk_construct_default, NULL,
LEGACY_FLOPPY_OPTION(fdmfm2, "fd", "Thomson FD (MFM) 80 tracks disk image (3\"1/2 DD)", basicdsk_identify_default, basicdsk_construct_default, nullptr,
HEADS([1])
TRACKS([80])
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([1]))
LEGACY_FLOPPY_OPTION(fdmfm, "fd", "Thomson FD (MFM) 40 tracks disk image (5\"1/4 DD)", basicdsk_identify_default, basicdsk_construct_default, NULL,
LEGACY_FLOPPY_OPTION(fdmfm, "fd", "Thomson FD (MFM) 40 tracks disk image (5\"1/4 DD)", basicdsk_identify_default, basicdsk_construct_default, nullptr,
HEADS([1])
TRACKS([40])
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([1]))
LEGACY_FLOPPY_OPTION(fd2, "fd", "Thomson FD (FM) 80 tracks disk image (3\"1/2 SD)", basicdsk_identify_default, basicdsk_construct_default, NULL,
LEGACY_FLOPPY_OPTION(fd2, "fd", "Thomson FD (FM) 80 tracks disk image (3\"1/2 SD)", basicdsk_identify_default, basicdsk_construct_default, nullptr,
HEADS([1])
TRACKS([80])
SECTORS([16])
SECTOR_LENGTH([128])
FIRST_SECTOR_ID([1]))
LEGACY_FLOPPY_OPTION(fd, "fd", "Thomson FD (FM) 40 tracks disk image (5\"1/4 SD)", basicdsk_identify_default, basicdsk_construct_default, NULL,
LEGACY_FLOPPY_OPTION(fd, "fd", "Thomson FD (FM) 40 tracks disk image (5\"1/4 SD)", basicdsk_identify_default, basicdsk_construct_default, nullptr,
HEADS([1])
TRACKS([40])
SECTORS([16])
SECTOR_LENGTH([128])
FIRST_SECTOR_ID([1]))
LEGACY_FLOPPY_OPTION(sap,"sap", "Thomson SAP floppy disk image", sap_dsk_identify, sap_dsk_construct, NULL, NULL)
LEGACY_FLOPPY_OPTION(sap,"sap", "Thomson SAP floppy disk image", sap_dsk_identify, sap_dsk_construct, nullptr, nullptr)
LEGACY_FLOPPY_OPTION(qdd,"qd", "Thomson QDD floppy disk image (2\"8 SD)", qdd_dsk_identify, qdd_dsk_construct, NULL,
LEGACY_FLOPPY_OPTION(qdd,"qd", "Thomson QDD floppy disk image (2\"8 SD)", qdd_dsk_identify, qdd_dsk_construct, nullptr,
HEADS([1])
TRACKS([1])
SECTORS([400])

View File

@ -96,7 +96,7 @@ static int trs80l2_cas_to_wav_size(const UINT8 *casdata, int caslen)
{
cas_size = caslen;
return trs80l2_handle_cas( NULL, casdata );
return trs80l2_handle_cas( nullptr, casdata );
}
static const struct CassetteLegacyWaveFiller trs80l2_cas_legacy_fill_wave =
@ -128,7 +128,7 @@ static const struct CassetteFormat trs80l2_cas_format =
"cas",
trs80l2_cas_identify,
trs80l2_cas_load,
NULL
nullptr
};

View File

@ -221,7 +221,7 @@ static const struct CassetteFormat tvc64_cassette_image_format =
"cas",
tvc64_cassette_identify,
tvc64_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(tvc64_cassette_formats)

View File

@ -66,7 +66,7 @@ static const UINT8 TZX_HEADER[8] = { 'Z','X','T','a','p','e','!',0x1a };
static INT16 wave_data = 0;
static int block_count = 0;
static UINT8** blocks = NULL;
static UINT8** blocks = nullptr;
static float t_scale = 1; /* for scaling T-states to the 4MHz CPC */
static void toggle_wave_data(void)
@ -219,7 +219,7 @@ INLINE int tcycles_to_samplecount( int tcycles )
static void tzx_output_wave( INT16 **buffer, int length )
{
if (buffer == NULL)
if (buffer == nullptr)
{
return;
}
@ -805,7 +805,7 @@ static int tzx_cas_to_wav_size( const UINT8 *casdata, int caslen )
goto cleanup;
}
size = tzx_cas_do_work(NULL);
size = tzx_cas_do_work(nullptr);
return size;
@ -843,7 +843,7 @@ static int tap_cas_to_wav_size( const UINT8 *casdata, int caslen )
// int pilot_length = (p[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */
LOG_FORMATS("tap_cas_to_wav_size: Handling TAP block containing 0x%X bytes", data_size);
p += 2;
size += tzx_cas_handle_block(NULL, p, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8);
size += tzx_cas_handle_block(nullptr, p, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8);
LOG_FORMATS(", total size is now: %d\n", size);
p += data_size;
}
@ -936,7 +936,7 @@ static const struct CassetteFormat tzx_cassette_format =
"tzx",
tzx_cassette_identify,
tzx_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat tap_cassette_format =
@ -944,7 +944,7 @@ static const struct CassetteFormat tap_cassette_format =
"tap,blk",
tap_cassette_identify,
tap_cassette_load,
NULL
nullptr
};
static const struct CassetteFormat cdt_cassette_format =
@ -952,7 +952,7 @@ static const struct CassetteFormat cdt_cassette_format =
"cdt",
cdt_cassette_identify,
cdt_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(tzx_cassette_formats)

View File

@ -50,7 +50,7 @@ static const UINT8* skip_gz_header( const UINT8 *p ) {
method = *p; p++;
flags = *p; p++;
if ( method != Z_DEFLATED || ( flags & RESERVED ) != 0 ) {
return NULL;
return nullptr;
}
/* Skip time, xflags and OS code */
p += 6;
@ -75,7 +75,7 @@ static const UINT8* skip_gz_header( const UINT8 *p ) {
return p;
}
static UINT8 *gz_ptr = NULL;
static UINT8 *gz_ptr = nullptr;
static float get_uef_float( const UINT8 *Float)
{
@ -114,14 +114,14 @@ static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
int inflate_size = ( casdata[ caslen - 1 ] << 24 ) | ( casdata[ caslen - 2 ] << 16 ) | ( casdata[ caslen - 3 ] << 8 ) | casdata[ caslen - 4 ];
const UINT8 *in_ptr = skip_gz_header( casdata );
if ( in_ptr == NULL ) {
if ( in_ptr == nullptr ) {
goto cleanup;
}
gz_ptr = (UINT8 *)malloc( inflate_size );
d_stream.zalloc = 0;
d_stream.zfree = 0;
d_stream.opaque = 0;
d_stream.zalloc = nullptr;
d_stream.zfree = nullptr;
d_stream.opaque = nullptr;
d_stream.next_in = (unsigned char *)in_ptr;
d_stream.avail_in = caslen - ( in_ptr - casdata );
d_stream.next_out = gz_ptr;
@ -207,7 +207,7 @@ static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
cleanup:
if ( gz_ptr ) {
free( gz_ptr );
gz_ptr = NULL;
gz_ptr = nullptr;
}
return -1;
}
@ -232,7 +232,7 @@ static int uef_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
INT16 *p = buffer;
if ( bytes[0] == 0x1f && bytes[1] == 0x8b ) {
if ( gz_ptr == NULL ) {
if ( gz_ptr == nullptr ) {
return 1;
}
bytes = gz_ptr;
@ -327,7 +327,7 @@ const struct CassetteFormat uef_cassette_format = {
"uef",
uef_cassette_identify,
uef_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(uef_cassette_formats)

View File

@ -196,7 +196,7 @@ static int vg5k_k7_to_wav_size(const UINT8 *casdata, int caslen)
{
k7_size = caslen ;
return vg5k_handle_tap( NULL, casdata );
return vg5k_handle_tap( nullptr, casdata );
}
@ -228,7 +228,7 @@ static const struct CassetteFormat vg5k_k7_format =
"k7",
vg5k_k7_identify,
vg5k_k7_load,
NULL
nullptr
};

View File

@ -102,7 +102,7 @@ static const struct CassetteLegacyWaveFiller vtech1_legacy_fill_wave =
vtech1_cassette_fill_wave, /* fill_wave */
1, /* chunk_size */
V1_BYTESAMPLES, /* chunk_samples */
NULL, /* chunk_sample_calc */
nullptr, /* chunk_sample_calc */
600*V1_BITSAMPLES, /* sample_frequency */
600*V1_BITSAMPLES, /* header_samples */
600*V1_BITSAMPLES /* trailer_samples */
@ -123,7 +123,7 @@ static const struct CassetteFormat vtech1_cas_format =
"cas",
vtech1_cas_identify,
vtech1_cas_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(vtech1_cassette_formats)
@ -197,7 +197,7 @@ static const struct CassetteLegacyWaveFiller vtech2_legacy_fill_wave =
vtech2_cassette_fill_wave, /* fill_wave */
1, /* chunk_size */
VT2_BYTESAMPLES, /* chunk_samples */
NULL, /* chunk_sample_calc */
nullptr, /* chunk_sample_calc */
600*VT2_BITSAMPLES, /* sample_frequency */
600*VT2_BITSAMPLES, /* header_samples */
600*VT2_BITSAMPLES /* trailer_samples */
@ -218,7 +218,7 @@ static const struct CassetteFormat vtech2_cas_format =
"cas",
vtech2_cas_identify,
vtech2_cas_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(vtech2_cassette_formats)

View File

@ -137,7 +137,7 @@ static int x07_cassette_calculate_size_in_samples(const UINT8 *bytes, int length
{
x07_image_size = length;
return x07_handle_cassette(NULL, bytes);
return x07_handle_cassette(nullptr, bytes);
}
static const struct CassetteLegacyWaveFiller x07_legacy_fill_wave =
@ -166,7 +166,7 @@ static const struct CassetteFormat x07_cassette_image_format =
"k7,lst,cas",
x07_cassette_identify,
x07_cassette_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(x07_cassette_formats)

View File

@ -131,7 +131,7 @@ static const struct CassetteFormat x1_cassette_format = {
"tap",
x1_cas_identify,
x1_cas_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(x1_cassette_formats)

View File

@ -226,7 +226,7 @@ static const struct CassetteFormat zx81_p_image_format =
"p,81",
zx81_p_identify,
zx81_p_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(zx81_p_format)
@ -289,7 +289,7 @@ static const struct CassetteFormat zx80_o_image_format =
"o,80",
zx80_o_identify,
zx80_o_load,
NULL
nullptr
};
CASSETTE_FORMATLIST_START(zx80_o_format)

View File

@ -1249,7 +1249,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
// read the metadata
// TODO: how to properly allocate a dynamic char buffer?
auto metabuf = new char[metaentry.length+1];
auto metabuf = new char[metaentry.length+1];
memset(metabuf, 0x00, metaentry.length+1);
file_read(metaentry.offset + METADATA_HEADER_SIZE, metabuf, metaentry.length);
output.assign(metabuf);

View File

@ -255,7 +255,7 @@ bool core_options::operator!=(const core_options &rhs)
void core_options::add_entry(const char *name, const char *description, UINT32 flags, const char *defvalue, bool override_existing)
{
// allocate a new entry
auto newentry = global_alloc(entry(name, description, flags, defvalue));
auto newentry = global_alloc(entry(name, description, flags, defvalue));
if (newentry->name() != nullptr)
{
// see if we match an existing entry

View File

@ -327,7 +327,7 @@ tagmap_error tagmap_t<_ElementType, _HashSize>::add_common(const char *tag, _Ele
}
// now allocate a new entry and add to the head of the list
auto entry = global_alloc(entry_t(tag, fullhash, object));
auto entry = global_alloc(entry_t(tag, fullhash, object));
entry->m_next = m_table[hashindex];
m_table[hashindex] = entry;
return TMERR_NONE;

View File

@ -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();
}

View File

@ -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)
{
}

View File

@ -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);

View File

@ -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; }

View File

@ -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())
{

View File

@ -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;

View File

@ -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);
}

View File

@ -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();

View File

@ -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;

View File

@ -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))
{

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}
//============================================================

View File

@ -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)

View File

@ -38,7 +38,7 @@ static void *watchdog_thread(void *param)
osd_process_kill();
}
}
return NULL;
return nullptr;
}
watchdog::watchdog(void)

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -121,7 +121,7 @@ const struct SupportedCassetteFormats formats[] = {
{NULL,NULL,NULL}
{nullptr,nullptr,nullptr}
};
@ -129,9 +129,9 @@ static const char *get_extension(const char *name)
{
const char *s;
s = name;
if (s != NULL)
if (s != nullptr)
s = strrchr(s, '.');
return s ? s+1 : NULL;
return s ? s+1 : nullptr;
}
static void display_usage(void)
@ -156,7 +156,7 @@ int CLIB_DECL main(int argc, char *argv[])
{
int i;
int found =0;
const struct CassetteFormat * const *selected_formats = NULL;
const struct CassetteFormat * const *selected_formats = nullptr;
cassette_image *cassette;
FILE *f;

View File

@ -189,7 +189,7 @@ public:
chd_rawfile_compressor(core_file *file, UINT64 offset = 0, UINT64 maxoffset = ~0)
: m_file(file),
m_offset(offset),
m_maxoffset(MIN(maxoffset, (file != NULL) ? core_fsize(file) : 0)) { }
m_maxoffset(MIN(maxoffset, (file != nullptr) ? core_fsize(file) : 0)) { }
// read interface
virtual UINT32 read_data(void *dest, UINT64 offset, UINT32 length)
@ -218,7 +218,7 @@ class chd_chdfile_compressor : public chd_file_compressor
public:
// construction/destruction
chd_chdfile_compressor(chd_file &file, UINT64 offset = 0, UINT64 maxoffset = ~0)
: m_toc(NULL),
: m_toc(nullptr),
m_file(file),
m_offset(offset),
m_maxoffset(MIN(maxoffset, file.logical_bytes())) { }
@ -289,13 +289,13 @@ class chd_cd_compressor : public chd_file_compressor
public:
// construction/destruction
chd_cd_compressor(cdrom_toc &toc, chdcd_track_input_info &info)
: m_file(NULL),
: m_file(nullptr),
m_toc(toc),
m_info(info) { }
~chd_cd_compressor()
{
if (m_file != NULL)
if (m_file != nullptr)
core_fclose(m_file);
}
@ -320,9 +320,9 @@ public:
if (offset >= startoffs && offset < endoffs)
{
// if we don't already have this file open, open it now
if (m_file == NULL || m_lastfile.compare(m_info.track[tracknum].fname)!=0)
if (m_file == nullptr || m_lastfile.compare(m_info.track[tracknum].fname)!=0)
{
if (m_file != NULL)
if (m_file != nullptr)
core_fclose(m_file);
m_lastfile = m_info.track[tracknum].fname;
file_error filerr = core_fopen(m_lastfile.c_str(), OPEN_FLAG_READ, &m_file);
@ -764,10 +764,10 @@ static void ATTR_PRINTF(2,3) progress(bool forceit, const char *format, ...)
// print_help - print help for all the commands
//-------------------------------------------------
static int print_help(const char *argv0, const char *error = NULL)
static int print_help(const char *argv0, const char *error = nullptr)
{
// print the error message first
if (error != NULL)
if (error != nullptr)
fprintf(stderr, "Error: %s\n\n", error);
// print a summary of each command
@ -788,10 +788,10 @@ static int print_help(const char *argv0, const char *error = NULL)
// command
//-------------------------------------------------
static int print_help(const char *argv0, const command_description &desc, const char *error = NULL)
static int print_help(const char *argv0, const command_description &desc, const char *error = nullptr)
{
// print the error message first
if (error != NULL)
if (error != nullptr)
fprintf(stderr, "Error: %s\n\n", error);
// print usage for this command
@ -801,7 +801,7 @@ static int print_help(const char *argv0, const command_description &desc, const
{
// determine whether we are required
const char *option = desc.valid_options[valid];
if (option == NULL)
if (option == nullptr)
break;
bool required = (option[0] == REQUIRED[0]);
if (required)
@ -813,7 +813,7 @@ static int print_help(const char *argv0, const command_description &desc, const
{
const option_description &odesc = s_options[optnum];
printf(" --%s", odesc.name);
if (odesc.shortname != NULL)
if (odesc.shortname != nullptr)
printf(", -%s", odesc.shortname);
printf("%s%s\n", odesc.description, required ? " (required)" : "");
}
@ -904,7 +904,7 @@ UINT64 parse_number(const char *string)
static void guess_chs(std::string *filename, UINT64 filesize, int sectorsize, UINT32 &cylinders, UINT32 &heads, UINT32 &sectors, UINT32 &bps)
{
// if this is a direct physical drive read, handle it specially
if (filename != NULL && osd_get_physical_drive_geometry(filename->c_str(), &cylinders, &heads, &sectors, &bps))
if (filename != nullptr && osd_get_physical_drive_geometry(filename->c_str(), &cylinders, &heads, &sectors, &bps))
return;
// if we have no length to work with, we can't guess
@ -941,7 +941,7 @@ static void parse_input_chd_parameters(const parameters_t &params, chd_file &inp
{
// process input parent file
std::string *input_chd_parent_str = params.find(OPTION_INPUT_PARENT);
if (input_chd_parent_str != NULL)
if (input_chd_parent_str != nullptr)
{
chd_error err = input_parent_chd.open(input_chd_parent_str->c_str());
if (err != CHDERR_NONE)
@ -950,9 +950,9 @@ static void parse_input_chd_parameters(const parameters_t &params, chd_file &inp
// process input file
std::string *input_chd_str = params.find(OPTION_INPUT);
if (input_chd_str != NULL)
if (input_chd_str != nullptr)
{
chd_error err = input_chd.open(input_chd_str->c_str(), writeable, input_parent_chd.opened() ? &input_parent_chd : NULL);
chd_error err = input_chd.open(input_chd_str->c_str(), writeable, input_parent_chd.opened() ? &input_parent_chd : nullptr);
if (err != CHDERR_NONE)
report_error(1, "Error opening CHD file (%s): %s", input_chd_str->c_str(), chd_file::error_string(err));
}
@ -974,11 +974,11 @@ static void parse_input_start_end(const parameters_t &params, UINT64 logical_siz
std::string *input_start_byte_str = params.find(OPTION_INPUT_START_BYTE);
std::string *input_start_hunk_str = params.find(OPTION_INPUT_START_HUNK);
std::string *input_start_frame_str = params.find(OPTION_INPUT_START_FRAME);
if (input_start_byte_str != NULL)
if (input_start_byte_str != nullptr)
input_start = parse_number(input_start_byte_str->c_str());
if (input_start_hunk_str != NULL)
if (input_start_hunk_str != nullptr)
input_start = parse_number(input_start_hunk_str->c_str()) * hunkbytes;
if (input_start_frame_str != NULL)
if (input_start_frame_str != nullptr)
input_start = parse_number(input_start_frame_str->c_str()) * framebytes;
if (input_start >= input_end)
report_error(1, "Input start offset greater than input file size");
@ -988,11 +988,11 @@ static void parse_input_start_end(const parameters_t &params, UINT64 logical_siz
std::string *input_length_hunks_str = params.find(OPTION_INPUT_LENGTH_HUNKS);
std::string *input_length_frames_str = params.find(OPTION_INPUT_LENGTH_FRAMES);
UINT64 input_length = input_end;
if (input_length_bytes_str != NULL)
if (input_length_bytes_str != nullptr)
input_length = parse_number(input_length_bytes_str->c_str());
if (input_length_hunks_str != NULL)
if (input_length_hunks_str != nullptr)
input_length = parse_number(input_length_hunks_str->c_str()) * hunkbytes;
if (input_length_frames_str != NULL)
if (input_length_frames_str != nullptr)
input_length = parse_number(input_length_frames_str->c_str()) * framebytes;
if (input_start + input_length < input_end)
input_end = input_start + input_length;
@ -1007,7 +1007,7 @@ static void parse_input_start_end(const parameters_t &params, UINT64 logical_siz
static void check_existing_output_file(const parameters_t &params, const char *filename)
{
if (params.find(OPTION_OUTPUT_FORCE) == NULL)
if (params.find(OPTION_OUTPUT_FORCE) == nullptr)
{
core_file *file;
file_error filerr = core_fopen(filename, OPEN_FLAG_READ, &file);
@ -1029,7 +1029,7 @@ static std::string *parse_output_chd_parameters(const parameters_t &params, chd_
{
// process output parent file
std::string *output_chd_parent_str = params.find(OPTION_OUTPUT_PARENT);
if (output_chd_parent_str != NULL)
if (output_chd_parent_str != nullptr)
{
chd_error err = output_parent_chd.open(output_chd_parent_str->c_str());
if (err != CHDERR_NONE)
@ -1038,7 +1038,7 @@ static std::string *parse_output_chd_parameters(const parameters_t &params, chd_
// process output file
std::string *output_chd_str = params.find(OPTION_OUTPUT);
if (output_chd_str != NULL)
if (output_chd_str != nullptr)
check_existing_output_file(params, output_chd_str->c_str());
return output_chd_str;
}
@ -1052,7 +1052,7 @@ static std::string *parse_output_chd_parameters(const parameters_t &params, chd_
static void parse_hunk_size(const parameters_t &params, UINT32 required_granularity, UINT32 &hunk_size)
{
std::string *hunk_size_str = params.find(OPTION_HUNK_SIZE);
if (hunk_size_str != NULL)
if (hunk_size_str != nullptr)
{
hunk_size = parse_number(hunk_size_str->c_str());
if (hunk_size < 16 || hunk_size > 1024 * 1024)
@ -1072,7 +1072,7 @@ static void parse_compression(const parameters_t &params, chd_codec_type compres
{
// see if anything was specified
std::string *compression_str = params.find(OPTION_COMPRESSION);
if (compression_str == NULL)
if (compression_str == nullptr)
return;
// special case: 'none'
@ -1112,7 +1112,7 @@ static void parse_compression(const parameters_t &params, chd_codec_type compres
static void parse_numprocessors(const parameters_t &params)
{
std::string *numprocessors_str = params.find(OPTION_NUMPROCESSORS);
if (numprocessors_str == NULL)
if (numprocessors_str == nullptr)
return;
int count = atoi(numprocessors_str->c_str());
@ -1234,7 +1234,7 @@ void output_track_metadata(int mode, core_file *file, int tracknum, const cdrom_
size = 2352;
break;
}
bool needquote = strchr(filename, ' ') != NULL;
bool needquote = strchr(filename, ' ') != nullptr;
core_fprintf(file, "%d %d %d %d %s%s%s %" I64FMT "d\n", tracknum+1, frameoffs, mode, size, needquote?"\"":"", filename, needquote?"\"":"", discoffs);
}
else if (mode == MODE_CUEBIN)
@ -1421,7 +1421,7 @@ static void do_info(parameters_t &params)
}
// print compression stats if verbose
if (params.find(OPTION_VERBOSE) != NULL)
if (params.find(OPTION_VERBOSE) != nullptr)
{
UINT32 compression_types[10] = { 0 };
for (UINT32 hunknum = 0; hunknum < input_chd.hunk_count(); hunknum++)
@ -1528,7 +1528,7 @@ static void do_verify(parameters_t &params)
fprintf(stderr, " actual SHA1 = %s\n", computed_sha1.as_string(tempstr));
// fix it if requested; this also fixes the overall one so we don't need to do any more
if (params.find(OPTION_FIX) != NULL)
if (params.find(OPTION_FIX) != nullptr)
{
input_chd.set_raw_sha1(computed_sha1);
printf("SHA-1 updated to correct value in input CHD\n");
@ -1551,7 +1551,7 @@ static void do_verify(parameters_t &params)
fprintf(stderr, " actual SHA1 = %s\n", computed_overall_sha1.as_string(tempstr));
// fix it if requested
if (params.find(OPTION_FIX) != NULL)
if (params.find(OPTION_FIX) != nullptr)
{
input_chd.set_raw_sha1(computed_sha1);
printf("SHA-1 updated to correct value in input CHD\n");
@ -1570,9 +1570,9 @@ static void do_verify(parameters_t &params)
static void do_create_raw(parameters_t &params)
{
// process input file
core_file *input_file = NULL;
core_file *input_file = nullptr;
std::string *input_file_str = params.find(OPTION_INPUT);
if (input_file_str != NULL)
if (input_file_str != nullptr)
{
file_error filerr = core_fopen(input_file_str->c_str(), OPEN_FLAG_READ, &input_file);
if (filerr != FILERR_NONE)
@ -1590,7 +1590,7 @@ static void do_create_raw(parameters_t &params)
// process unit size
UINT32 unit_size = output_parent.opened() ? output_parent.unit_bytes() : 0;
std::string *unit_size_str = params.find(OPTION_UNIT_SIZE);
if (unit_size_str != NULL)
if (unit_size_str != nullptr)
{
unit_size = parse_number(unit_size_str->c_str());
if (hunk_size % unit_size != 0)
@ -1626,7 +1626,7 @@ static void do_create_raw(parameters_t &params)
printf("Logical size: %s\n", big_int_string(tempstr, input_end - input_start));
// catch errors so we can close & delete the output file
chd_rawfile_compressor *chd = NULL;
chd_rawfile_compressor *chd = nullptr;
try
{
// create the new CHD
@ -1652,7 +1652,7 @@ static void do_create_raw(parameters_t &params)
delete chd;
// delete the output file
std::string *output_chd_str = params.find(OPTION_OUTPUT);
if (output_chd_str != NULL)
if (output_chd_str != nullptr)
osd_rmfile(output_chd_str->c_str());
throw;
}
@ -1667,9 +1667,9 @@ static void do_create_raw(parameters_t &params)
static void do_create_hd(parameters_t &params)
{
// process input file
core_file *input_file = NULL;
core_file *input_file = nullptr;
std::string *input_file_str = params.find(OPTION_INPUT);
if (input_file_str != NULL)
if (input_file_str != nullptr)
{
file_error filerr = core_fopen(input_file_str->c_str(), OPEN_FLAG_READ, &input_file);
if (filerr != FILERR_NONE)
@ -1683,7 +1683,7 @@ static void do_create_hd(parameters_t &params)
// process sectorsize
UINT32 sector_size = output_parent.opened() ? output_parent.unit_bytes() : IDE_SECTOR_SIZE;
std::string *sectorsize_str = params.find(OPTION_SECTOR_SIZE);
if (sectorsize_str != NULL)
if (sectorsize_str != nullptr)
{
if (output_parent.opened())
report_error(1, "Sector size does not apply when creating a diff from the parent");
@ -1698,7 +1698,7 @@ static void do_create_hd(parameters_t &params)
UINT64 filesize = 0;
UINT64 input_start = 0;
UINT64 input_end = 0;
if (input_file != NULL)
if (input_file != nullptr)
{
parse_input_start_end(params, core_fsize(input_file), hunk_size, hunk_size, input_start, input_end);
filesize = input_end - input_start;
@ -1706,7 +1706,7 @@ static void do_create_hd(parameters_t &params)
else
{
std::string *size_str = params.find(OPTION_SIZE);
if (size_str != NULL)
if (size_str != nullptr)
{
if (sscanf(size_str->c_str(), "%" I64FMT"d", &filesize) != 1)
report_error(1, "Invalid size string");
@ -1716,10 +1716,10 @@ static void do_create_hd(parameters_t &params)
// process compression
chd_codec_type compression[4];
memcpy(compression, s_default_hd_compression, sizeof(compression));
if (input_file == NULL)
if (input_file == nullptr)
compression[0] = compression[1] = compression[2] = compression[3] = CHD_CODEC_NONE;
parse_compression(params, compression);
if (input_file == NULL && compression[0] != CHD_CODEC_NONE)
if (input_file == nullptr && compression[0] != CHD_CODEC_NONE)
report_error(1, "Blank hard disks must be uncompressed");
// process numprocessors
@ -1730,7 +1730,7 @@ static void do_create_hd(parameters_t &params)
UINT32 heads = 0;
UINT32 sectors = 0;
std::string *chs_str = params.find(OPTION_CHS);
if (chs_str != NULL)
if (chs_str != nullptr)
{
if (output_parent.opened())
report_error(1, "CHS does not apply when creating a diff from the parent");
@ -1743,7 +1743,7 @@ static void do_create_hd(parameters_t &params)
if (output_parent.opened())
output_parent.read_metadata(HARD_DISK_IDENT_METADATA_TAG, 0, identdata);
std::string *ident_str = params.find(OPTION_IDENT);
if (ident_str != NULL)
if (ident_str != nullptr)
{
// load the file
file_error filerr = core_fload(ident_str->c_str(), identdata);
@ -1775,7 +1775,7 @@ static void do_create_hd(parameters_t &params)
// if no CHS values, try to guess them
if (cylinders == 0)
{
if (input_file == NULL && filesize == 0)
if (input_file == nullptr && filesize == 0)
report_error(1, "Blank hard drives must specify either a length or a set of CHS values");
guess_chs(input_file_str, filesize, sector_size, cylinders, heads, sectors, sector_size);
}
@ -1786,7 +1786,7 @@ static void do_create_hd(parameters_t &params)
printf("Output CHD: %s\n", output_chd_str->c_str());
if (output_parent.opened())
printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str());
if (input_file != NULL)
if (input_file != nullptr)
{
printf("Input file: %s\n", input_file_str->c_str());
if (input_start != 0 || input_end != core_fsize(input_file))
@ -1804,7 +1804,7 @@ static void do_create_hd(parameters_t &params)
printf("Logical size: %s\n", big_int_string(tempstr, UINT64(totalsectors) * UINT64(sector_size)));
// catch errors so we can close & delete the output file
chd_rawfile_compressor *chd = NULL;
chd_rawfile_compressor *chd = nullptr;
try
{
// create the new hard drive
@ -1833,7 +1833,7 @@ static void do_create_hd(parameters_t &params)
}
// compress it generically
if (input_file != NULL)
if (input_file != nullptr)
compress_common(*chd);
delete chd;
}
@ -1842,7 +1842,7 @@ static void do_create_hd(parameters_t &params)
delete chd;
// delete the output file
std::string *output_chd_str = params.find(OPTION_OUTPUT);
if (output_chd_str != NULL)
if (output_chd_str != nullptr)
osd_rmfile(output_chd_str->c_str());
throw;
}
@ -1860,7 +1860,7 @@ static void do_create_cd(parameters_t &params)
chdcd_track_input_info track_info;
cdrom_toc toc = { 0 };
std::string *input_file_str = params.find(OPTION_INPUT);
if (input_file_str != NULL)
if (input_file_str != nullptr)
{
chd_error err = chdcd_parse_toc(input_file_str->c_str(), toc, track_info);
if (err != CHDERR_NONE)
@ -1907,7 +1907,7 @@ static void do_create_cd(parameters_t &params)
printf("Logical size: %s\n", big_int_string(tempstr, UINT64(totalsectors) * CD_FRAME_SIZE));
// catch errors so we can close & delete the output file
chd_cd_compressor *chd = NULL;
chd_cd_compressor *chd = nullptr;
try
{
// create the new CD
@ -1934,7 +1934,7 @@ static void do_create_cd(parameters_t &params)
delete chd;
// delete the output file
std::string *output_chd_str = params.find(OPTION_OUTPUT);
if (output_chd_str != NULL)
if (output_chd_str != nullptr)
osd_rmfile(output_chd_str->c_str());
throw;
}
@ -1949,9 +1949,9 @@ static void do_create_cd(parameters_t &params)
static void do_create_ld(parameters_t &params)
{
// process input file
avi_file *input_file = NULL;
avi_file *input_file = nullptr;
std::string *input_file_str = params.find(OPTION_INPUT);
if (input_file_str != NULL)
if (input_file_str != nullptr)
{
avi_error avierr = avi_open(input_file_str->c_str(), &input_file);
if (avierr != AVIERR_NONE)
@ -2025,7 +2025,7 @@ static void do_create_ld(parameters_t &params)
printf("Logical size: %s\n", big_int_string(tempstr, UINT64(input_end - input_start) * hunk_size));
// catch errors so we can close & delete the output file
chd_avi_compressor *chd = NULL;
chd_avi_compressor *chd = nullptr;
try
{
// create the new CHD
@ -2062,7 +2062,7 @@ static void do_create_ld(parameters_t &params)
delete chd;
// delete the output file
std::string *output_chd_str = params.find(OPTION_OUTPUT);
if (output_chd_str != NULL)
if (output_chd_str != nullptr)
osd_rmfile(output_chd_str->c_str());
throw;
}
@ -2134,7 +2134,7 @@ static void do_copy(parameters_t &params)
printf("Logical size: %s\n", big_int_string(tempstr, input_end - input_start));
// catch errors so we can close & delete the output file
chd_chdfile_compressor *chd = NULL;
chd_chdfile_compressor *chd = nullptr;
try
{
// create the new CHD
@ -2179,7 +2179,7 @@ static void do_copy(parameters_t &params)
if (redo_cd)
{
cdrom_file *cdrom = cdrom_open(&input_chd);
if (cdrom == NULL)
if (cdrom == nullptr)
report_error(1, "Error upgrading CD metadata");
const cdrom_toc *toc = cdrom_get_toc(cdrom);
err = cdrom_write_metadata(chd, toc);
@ -2198,7 +2198,7 @@ static void do_copy(parameters_t &params)
delete chd;
// delete the output file
std::string *output_chd_str = params.find(OPTION_OUTPUT);
if (output_chd_str != NULL)
if (output_chd_str != nullptr)
osd_rmfile(output_chd_str->c_str());
throw;
}
@ -2224,7 +2224,7 @@ static void do_extract_raw(parameters_t &params)
// verify output file doesn't exist
std::string *output_file_str = params.find(OPTION_OUTPUT);
if (output_file_str != NULL)
if (output_file_str != nullptr)
check_existing_output_file(params, output_file_str->c_str());
// print some info
@ -2238,7 +2238,7 @@ static void do_extract_raw(parameters_t &params)
}
// catch errors so we can close & delete the output file
core_file *output_file = NULL;
core_file *output_file = nullptr;
try
{
// process output file
@ -2274,7 +2274,7 @@ static void do_extract_raw(parameters_t &params)
catch (...)
{
// delete the output file
if (output_file != NULL)
if (output_file != nullptr)
{
core_fclose(output_file);
osd_rmfile(output_file_str->c_str());
@ -2298,13 +2298,13 @@ static void do_extract_cd(parameters_t &params)
// further process input file
cdrom_file *cdrom = cdrom_open(&input_chd);
if (cdrom == NULL)
if (cdrom == nullptr)
report_error(1, "Unable to recognize CHD file as a CD");
const cdrom_toc *toc = cdrom_get_toc(cdrom);
// verify output file doesn't exist
std::string *output_file_str = params.find(OPTION_OUTPUT);
if (output_file_str != NULL)
if (output_file_str != nullptr)
check_existing_output_file(params, output_file_str->c_str());
// verify output BIN file doesn't exist
@ -2316,7 +2316,7 @@ static void do_extract_cd(parameters_t &params)
char basename[128];
strncpy(basename, default_name.c_str(), 127);
default_name.append(".bin");
if (output_bin_file_str == NULL)
if (output_bin_file_str == nullptr)
output_bin_file_str = &default_name;
check_existing_output_file(params, output_bin_file_str->c_str());
@ -2327,8 +2327,8 @@ static void do_extract_cd(parameters_t &params)
printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str());
// catch errors so we can close & delete the output file
core_file *output_bin_file = NULL;
core_file *output_toc_file = NULL;
core_file *output_bin_file = nullptr;
core_file *output_toc_file = nullptr;
try
{
int mode = MODE_NORMAL;
@ -2387,7 +2387,7 @@ static void do_extract_cd(parameters_t &params)
if (output_bin_file)
{
core_fclose(output_bin_file);
output_bin_file = NULL;
output_bin_file = nullptr;
}
filerr = core_fopen(trackbin_name.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_bin_file);
@ -2474,9 +2474,9 @@ static void do_extract_cd(parameters_t &params)
catch (...)
{
// delete the output files
if (output_bin_file != NULL)
if (output_bin_file != nullptr)
core_fclose(output_bin_file);
if (output_toc_file != NULL)
if (output_toc_file != nullptr)
core_fclose(output_toc_file);
osd_rmfile(output_bin_file_str->c_str());
osd_rmfile(output_file_str->c_str());
@ -2551,7 +2551,7 @@ static void do_extract_ld(parameters_t &params)
// verify output file doesn't exist
std::string *output_file_str = params.find(OPTION_OUTPUT);
if (output_file_str != NULL)
if (output_file_str != nullptr)
check_existing_output_file(params, output_file_str->c_str());
// print some info
@ -2565,7 +2565,7 @@ static void do_extract_ld(parameters_t &params)
}
// catch errors so we can close & delete the output file
avi_file *output_file = NULL;
avi_file *output_file = nullptr;
try
{
// process output file
@ -2596,7 +2596,7 @@ static void do_extract_ld(parameters_t &params)
input_chd.codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig);
// read the hunk into the buffers
chd_error err = input_chd.read_hunk(framenum, NULL);
chd_error err = input_chd.read_hunk(framenum, nullptr);
if (err != CHDERR_NONE)
{
UINT64 filepos = core_ftell(input_chd);
@ -2627,7 +2627,7 @@ static void do_extract_ld(parameters_t &params)
catch (...)
{
// delete the output file
if (output_file != NULL)
if (output_file != nullptr)
avi_close(output_file);
osd_rmfile(output_file_str->c_str());
throw;
@ -2650,7 +2650,7 @@ static void do_add_metadata(parameters_t &params)
// process tag
chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?');
std::string *tag_str = params.find(OPTION_TAG);
if (tag_str != NULL)
if (tag_str != nullptr)
{
tag_str->append(" ");
tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]);
@ -2659,13 +2659,13 @@ static void do_add_metadata(parameters_t &params)
// process index
UINT32 index = 0;
std::string *index_str = params.find(OPTION_INDEX);
if (index_str != NULL)
if (index_str != nullptr)
index = atoi(index_str->c_str());
// process text input
std::string *text_str = params.find(OPTION_VALUE_TEXT);
std::string text;
if (text_str != NULL)
if (text_str != nullptr)
{
text = *text_str;
if (text[0] == '"' && text[text.length() - 1] == '"')
@ -2675,7 +2675,7 @@ static void do_add_metadata(parameters_t &params)
// process file input
std::string *file_str = params.find(OPTION_VALUE_FILE);
dynamic_buffer file;
if (file_str != NULL)
if (file_str != nullptr)
{
file_error filerr = core_fload(file_str->c_str(), file);
if (filerr != FILERR_NONE)
@ -2683,14 +2683,14 @@ static void do_add_metadata(parameters_t &params)
}
// make sure we have one or the other
if (text_str == NULL && file_str == NULL)
if (text_str == nullptr && file_str == nullptr)
report_error(1, "Error: missing either --valuetext/-vt or --valuefile/-vf parameters");
if (text_str != NULL && file_str != NULL)
if (text_str != nullptr && file_str != nullptr)
report_error(1, "Error: both --valuetext/-vt or --valuefile/-vf parameters specified; only one permitted");
// process no checksum
UINT8 flags = CHD_MDFLAGS_CHECKSUM;
if (params.find(OPTION_NO_CHECKSUM) != NULL)
if (params.find(OPTION_NO_CHECKSUM) != nullptr)
flags &= ~CHD_MDFLAGS_CHECKSUM;
// print some info
@ -2698,14 +2698,14 @@ static void do_add_metadata(parameters_t &params)
printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str());
printf("Tag: %c%c%c%c\n", (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff);
printf("Index: %d\n", index);
if (text_str != NULL)
if (text_str != nullptr)
printf("Text: %s\n", text.c_str());
else
printf("Data: %s (%d bytes)\n", file_str->c_str(), int(file.size()));
// write the metadata
chd_error err;
if (text_str != NULL)
if (text_str != nullptr)
err = input_chd.write_metadata(tag, index, text, flags);
else
err = input_chd.write_metadata(tag, index, &file[0], flags);
@ -2730,7 +2730,7 @@ static void do_del_metadata(parameters_t &params)
// process tag
chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?');
std::string *tag_str = params.find(OPTION_TAG);
if (tag_str != NULL)
if (tag_str != nullptr)
{
tag_str->append(" ");
tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]);
@ -2739,7 +2739,7 @@ static void do_del_metadata(parameters_t &params)
// process index
UINT32 index = 0;
std::string *index_str = params.find(OPTION_INDEX);
if (index_str != NULL)
if (index_str != nullptr)
index = atoi(index_str->c_str());
// print some info
@ -2770,13 +2770,13 @@ static void do_dump_metadata(parameters_t &params)
// verify output file doesn't exist
std::string *output_file_str = params.find(OPTION_OUTPUT);
if (output_file_str != NULL)
if (output_file_str != nullptr)
check_existing_output_file(params, output_file_str->c_str());
// process tag
chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?');
std::string *tag_str = params.find(OPTION_TAG);
if (tag_str != NULL)
if (tag_str != nullptr)
{
tag_str->append(" ");
tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]);
@ -2785,7 +2785,7 @@ static void do_dump_metadata(parameters_t &params)
// process index
UINT32 index = 0;
std::string *index_str = params.find(OPTION_INDEX);
if (index_str != NULL)
if (index_str != nullptr)
index = atoi(index_str->c_str());
// write the metadata
@ -2795,11 +2795,11 @@ static void do_dump_metadata(parameters_t &params)
report_error(1, "Error reading metadata: %s", chd_file::error_string(err));
// catch errors so we can close & delete the output file
core_file *output_file = NULL;
core_file *output_file = nullptr;
try
{
// create the file
if (output_file_str != NULL)
if (output_file_str != nullptr)
{
file_error filerr = core_fopen(output_file_str->c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_file);
if (filerr != FILERR_NONE)
@ -2826,7 +2826,7 @@ static void do_dump_metadata(parameters_t &params)
catch (...)
{
// delete the output file
if (output_file != NULL)
if (output_file != nullptr)
core_fclose(output_file);
osd_rmfile(output_file_str->c_str());
throw;
@ -2882,7 +2882,7 @@ int CLIB_DECL main(int argc, char *argv[])
{
// reduce to the option name
const char *validname = desc.valid_options[valid];
if (validname == NULL)
if (validname == nullptr)
break;
if (*validname == REQUIRED[0])
validname++;
@ -2897,7 +2897,7 @@ int CLIB_DECL main(int argc, char *argv[])
// do we match?
const option_description &odesc = s_options[optnum];
if ((arg[1] == '-' && strcmp(odesc.name, &arg[2]) == 0) ||
(arg[1] != '-' && odesc.shortname != NULL && strcmp(odesc.shortname, &arg[1]) == 0))
(arg[1] != '-' && odesc.shortname != nullptr && strcmp(odesc.shortname, &arg[1]) == 0))
{
// if we need a parameter, consume it
const char *param = "";
@ -2924,9 +2924,9 @@ int CLIB_DECL main(int argc, char *argv[])
for (int valid = 0; valid < ARRAY_LENGTH(desc.valid_options); valid++)
{
const char *validname = desc.valid_options[valid];
if (validname == NULL)
if (validname == nullptr)
break;
if (*validname == REQUIRED[0] && parameters.find(++validname) == NULL)
if (*validname == REQUIRED[0] && parameters.find(++validname) == nullptr)
return print_help(argv[0], desc, "Required parameters missing");
}

Some files were not shown because too many files have changed in this diff Show More