Fixed a few coverity errors, several of which are real bugs.

This commit is contained in:
Vas Crabb 2021-12-02 08:04:41 +11:00
parent 404b7add29
commit 1c8ba9d5c8
10 changed files with 232 additions and 269 deletions

View File

@ -4785,8 +4785,6 @@ files {
MAME_DIR .. "src/mame/includes/ampoker2.h", MAME_DIR .. "src/mame/includes/ampoker2.h",
MAME_DIR .. "src/mame/video/ampoker2.cpp", MAME_DIR .. "src/mame/video/ampoker2.cpp",
MAME_DIR .. "src/mame/drivers/amspdwy.cpp", MAME_DIR .. "src/mame/drivers/amspdwy.cpp",
MAME_DIR .. "src/mame/includes/amspdwy.h",
MAME_DIR .. "src/mame/video/amspdwy.cpp",
MAME_DIR .. "src/mame/drivers/amusco.cpp", MAME_DIR .. "src/mame/drivers/amusco.cpp",
MAME_DIR .. "src/mame/drivers/anes.cpp", MAME_DIR .. "src/mame/drivers/anes.cpp",
MAME_DIR .. "src/mame/drivers/arachnid.cpp", MAME_DIR .. "src/mame/drivers/arachnid.cpp",

View File

@ -121,7 +121,7 @@ std::string xavix2_disassembler::val3u()
std::string xavix2_disassembler::off19s() std::string xavix2_disassembler::off19s()
{ {
u16 r = m_opcode & 0x7ffff; u32 r = m_opcode & 0x7ffff;
if(r & 0x40000) if(r & 0x40000)
return util::string_format(" - %05x", 0x80000 - r); return util::string_format(" - %05x", 0x80000 - r);
else if(r) else if(r)

View File

@ -31,7 +31,7 @@ static int sorc_get_tracks_per_disk(floppy_image_legacy *floppy)
static uint64_t sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector) static uint64_t sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector)
{ {
return 270*(16*track+sector); return 270*(16*uint64_t(track+sector));
} }
static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, bool sector_is_index, uint64_t *offset) static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, bool sector_is_index, uint64_t *offset)

View File

@ -16,9 +16,213 @@ Sound: YM2151
***************************************************************************/ ***************************************************************************/
#include "emu.h" #include "emu.h"
#include "includes/amspdwy.h"
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "sound/ymopm.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h" #include "speaker.h"
#include "tilemap.h"
namespace {
class amspdwy_state : public driver_device
{
public:
amspdwy_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_ym2151(*this, "ymsnd"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
m_io_analog(*this, "AN%u", 1U),
m_io_wheel(*this, "WHEEL%u", 1U),
m_io_in0(*this, "IN0")
{ }
void amspdwy(machine_config &config);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
private:
/* memory pointers */
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_colorram;
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<ym2151_device> m_ym2151;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
/* I/O ports */
required_ioport_array<2> m_io_analog;
required_ioport_array<2> m_io_wheel;
required_ioport m_io_in0;
/* video-related */
tilemap_t *m_bg_tilemap;
int m_flipscreen;
/* misc */
uint16_t m_wheel_old[2];
uint8_t m_wheel_return[2];
void amspdwy_flipscreen_w(uint8_t data);
void amspdwy_videoram_w(offs_t offset, uint8_t data);
void amspdwy_colorram_w(offs_t offset, uint8_t data);
uint8_t amspdwy_sound_r();
TILE_GET_INFO_MEMBER(get_tile_info);
TILEMAP_MAPPER_MEMBER(tilemap_scan_cols_back);
uint32_t screen_update_amspdwy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
template <unsigned Index> uint8_t amspdwy_wheel_r();
void amspdwy_map(address_map &map);
void amspdwy_portmap(address_map &map);
void amspdwy_sound_map(address_map &map);
};
void amspdwy_state::amspdwy_flipscreen_w(uint8_t data)
{
m_flipscreen ^= 1;
flip_screen_set(m_flipscreen);
}
/***************************************************************************
Callbacks for the TileMap code
[ Tiles Format ]
Videoram: 76543210 Code Low Bits
Colorram: 765-----
---43--- Code High Bits
-----210 Color
***************************************************************************/
TILE_GET_INFO_MEMBER(amspdwy_state::get_tile_info)
{
uint8_t code = m_videoram[tile_index];
uint8_t color = m_colorram[tile_index];
tileinfo.set(0,
code + ((color & 0x18)<<5),
color & 0x07,
0);
}
void amspdwy_state::amspdwy_videoram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void amspdwy_state::amspdwy_colorram_w(offs_t offset, uint8_t data)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
/* logical (col,row) -> memory offset */
TILEMAP_MAPPER_MEMBER(amspdwy_state::tilemap_scan_cols_back)
{
return col * num_rows + (num_rows - row - 1);
}
void amspdwy_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(amspdwy_state::get_tile_info)), tilemap_mapper_delegate(*this, FUNC(amspdwy_state::tilemap_scan_cols_back)), 8, 8, 0x20, 0x20);
}
/***************************************************************************
Sprites Drawing
Offset: Format: Value:
0 Y
1 X
2 Code Low Bits
3 7------- Flip X
-6------ Flip Y
--5-----
---4---- ?
----3--- Code High Bit?
-----210 Color
***************************************************************************/
void amspdwy_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
int const max_x = m_screen->width() - 1;
int const max_y = m_screen->height() - 1;
for (int i = 0; i < m_spriteram.bytes(); i += 4)
{
int y = m_spriteram[i + 0];
int x = m_spriteram[i + 1];
int const code = m_spriteram[i + 2];
int const attr = m_spriteram[i + 3];
int flipx = attr & 0x80;
int flipy = attr & 0x40;
if (flip_screen())
{
x = max_x - x - 8;
y = max_y - y - 8;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
// code + ((attr & 0x18)<<5),
code + ((attr & 0x08)<<5),
attr,
flipx, flipy,
x,y,0 );
}
}
/***************************************************************************
Screen Drawing
***************************************************************************/
uint32_t amspdwy_state::screen_update_amspdwy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}
/*************************************************************************** /***************************************************************************
@ -37,38 +241,26 @@ Sound: YM2151
Or last value when wheel delta = 0 Or last value when wheel delta = 0
*/ */
uint8_t amspdwy_state::amspdwy_wheel_r( int index ) template <unsigned Index>
uint8_t amspdwy_state::amspdwy_wheel_r()
{ {
static const char *const portnames[] = { "WHEEL1", "WHEEL2", "AN1", "AN2" }; uint16_t wheel = m_io_analog[Index]->read();
uint8_t wheel = ioport(portnames[2 + index])->read(); if (wheel != m_wheel_old[Index])
if (wheel != m_wheel_old[index])
{ {
wheel = (wheel & 0x7fff) - (wheel & 0x8000); wheel = (wheel & 0x7fff) - (wheel & 0x8000);
if (wheel > m_wheel_old[index]) if (wheel > m_wheel_old[Index])
m_wheel_return[index] = ((+wheel) & 0xf) | 0x00; m_wheel_return[Index] = ((+wheel) & 0xf) | 0x00;
else else
m_wheel_return[index] = ((-wheel) & 0xf) | 0x10; m_wheel_return[Index] = ((-wheel) & 0xf) | 0x10;
m_wheel_old[index] = wheel; m_wheel_old[Index] = wheel;
} }
return m_wheel_return[index] | ioport(portnames[index])->read(); return m_wheel_return[Index] | m_io_wheel[Index]->read();
}
uint8_t amspdwy_state::amspdwy_wheel_0_r()
{
// player 1
return amspdwy_wheel_r(0);
}
uint8_t amspdwy_state::amspdwy_wheel_1_r()
{
// player 2
return amspdwy_wheel_r(1);
} }
uint8_t amspdwy_state::amspdwy_sound_r() uint8_t amspdwy_state::amspdwy_sound_r()
{ {
return (m_ym2151->status_r() & ~0x30) | ioport("IN0")->read(); return (m_ym2151->status_r() & ~0x30) | m_io_in0->read();
} }
void amspdwy_state::amspdwy_map(address_map &map) void amspdwy_state::amspdwy_map(address_map &map)
@ -81,8 +273,8 @@ void amspdwy_state::amspdwy_map(address_map &map)
// map(0xa000, 0xa000).nopw(); // ? // map(0xa000, 0xa000).nopw(); // ?
map(0xa000, 0xa000).portr("DSW1"); map(0xa000, 0xa000).portr("DSW1");
map(0xa400, 0xa400).portr("DSW2").w(FUNC(amspdwy_state::amspdwy_flipscreen_w)); map(0xa400, 0xa400).portr("DSW2").w(FUNC(amspdwy_state::amspdwy_flipscreen_w));
map(0xa800, 0xa800).r(FUNC(amspdwy_state::amspdwy_wheel_0_r)); map(0xa800, 0xa800).r(FUNC(amspdwy_state::amspdwy_wheel_r<0>)); // player 1
map(0xac00, 0xac00).r(FUNC(amspdwy_state::amspdwy_wheel_1_r)); map(0xac00, 0xac00).r(FUNC(amspdwy_state::amspdwy_wheel_r<1>)); // player 2
map(0xb000, 0xb000).nopw(); // irq ack? map(0xb000, 0xb000).nopw(); // irq ack?
map(0xb400, 0xb400).r(FUNC(amspdwy_state::amspdwy_sound_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0xb400, 0xb400).r(FUNC(amspdwy_state::amspdwy_sound_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0xc000, 0xc0ff).ram().share("spriteram"); map(0xc000, 0xc0ff).ram().share("spriteram");
@ -378,6 +570,8 @@ ROM_START( amspdwya )
ROM_LOAD( "lohi4644.2a", 0x3000, 0x1000, CRC(a1d802b1) SHA1(1249ce406b1aa518885a02ab063fa14906ccec2e) ) ROM_LOAD( "lohi4644.2a", 0x3000, 0x1000, CRC(a1d802b1) SHA1(1249ce406b1aa518885a02ab063fa14906ccec2e) )
ROM_END ROM_END
} // anonymous namespace
/* (C) 1987 ETI 8402 MAGNOLIA ST. #C SANTEE, CA 92071 */ /* (C) 1987 ETI 8402 MAGNOLIA ST. #C SANTEE, CA 92071 */

View File

@ -181,13 +181,13 @@ template <unsigned N> void dcebridge_state::cts(int state)
ioport_value const conf_local(m_conf[N]->read()); ioport_value const conf_local(m_conf[N]->read());
if ((conf_local & DTR_SOURCE_MASK) == DTR_SOURCE_CTS_LOCAL) if ((conf_local & DTR_SOURCE_MASK) == DTR_SOURCE_CTS_LOCAL)
m_ports[N]->write_dtr(state); m_ports[N]->write_dtr(state);
if ((conf_local & RTS_SOURCE_MASK) == DTR_SOURCE_CTS_LOCAL) if ((conf_local & RTS_SOURCE_MASK) == RTS_SOURCE_CTS_LOCAL)
m_ports[N]->write_rts(state); m_ports[N]->write_rts(state);
ioport_value const conf_remote(m_conf[N ^ 1U]->read()); ioport_value const conf_remote(m_conf[N ^ 1U]->read());
if ((conf_remote & DTR_SOURCE_MASK) == DTR_SOURCE_CTS_REMOTE) if ((conf_remote & DTR_SOURCE_MASK) == DTR_SOURCE_CTS_REMOTE)
m_ports[N ^ 1U]->write_dtr(state); m_ports[N ^ 1U]->write_dtr(state);
if ((conf_remote & RTS_SOURCE_MASK) == DTR_SOURCE_CTS_REMOTE) if ((conf_remote & RTS_SOURCE_MASK) == RTS_SOURCE_CTS_REMOTE)
m_ports[N ^ 1U]->write_rts(state); m_ports[N ^ 1U]->write_rts(state);
} }
} }

View File

@ -1,84 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia
/*************************************************************************
American Speedway
*************************************************************************/
#ifndef MAME_INCLUDES_AMSPDWY_H
#define MAME_INCLUDES_AMSPDWY_H
#pragma once
#include "machine/gen_latch.h"
#include "sound/ymopm.h"
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"
class amspdwy_state : public driver_device
{
public:
amspdwy_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_ym2151(*this, "ymsnd"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch")
{ }
void amspdwy(machine_config &config);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
private:
/* memory pointers */
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_colorram;
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<ym2151_device> m_ym2151;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
/* video-related */
tilemap_t *m_bg_tilemap;
int m_flipscreen;
/* misc */
uint8_t m_wheel_old[2];
uint8_t m_wheel_return[2];
uint8_t amspdwy_wheel_0_r();
uint8_t amspdwy_wheel_1_r();
void amspdwy_flipscreen_w(uint8_t data);
void amspdwy_videoram_w(offs_t offset, uint8_t data);
void amspdwy_colorram_w(offs_t offset, uint8_t data);
uint8_t amspdwy_sound_r();
TILE_GET_INFO_MEMBER(get_tile_info);
TILEMAP_MAPPER_MEMBER(tilemap_scan_cols_back);
uint32_t screen_update_amspdwy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
uint8_t amspdwy_wheel_r(int index);
void amspdwy_map(address_map &map);
void amspdwy_portmap(address_map &map);
void amspdwy_sound_map(address_map &map);
};
#endif // MAME_INCLUDES_AMSPDWY_H

View File

@ -1,142 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia
/***************************************************************************
-= American Speedway =-
driver by Luca Elia (l.elia@tin.it)
- 8x8 4 Color Tiles (with 8 palettes) used for both:
- 1 256x256 non scrolling layer
- 64 (32?) Sprites
***************************************************************************/
#include "emu.h"
#include "includes/amspdwy.h"
void amspdwy_state::amspdwy_flipscreen_w(uint8_t data)
{
m_flipscreen ^= 1;
flip_screen_set(m_flipscreen);
}
/***************************************************************************
Callbacks for the TileMap code
[ Tiles Format ]
Videoram: 76543210 Code Low Bits
Colorram: 765-----
---43--- Code High Bits
-----210 Color
***************************************************************************/
TILE_GET_INFO_MEMBER(amspdwy_state::get_tile_info)
{
uint8_t code = m_videoram[tile_index];
uint8_t color = m_colorram[tile_index];
tileinfo.set(0,
code + ((color & 0x18)<<5),
color & 0x07,
0);
}
void amspdwy_state::amspdwy_videoram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void amspdwy_state::amspdwy_colorram_w(offs_t offset, uint8_t data)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
/* logical (col,row) -> memory offset */
TILEMAP_MAPPER_MEMBER(amspdwy_state::tilemap_scan_cols_back)
{
return col * num_rows + (num_rows - row - 1);
}
void amspdwy_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(amspdwy_state::get_tile_info)), tilemap_mapper_delegate(*this, FUNC(amspdwy_state::tilemap_scan_cols_back)), 8, 8, 0x20, 0x20);
}
/***************************************************************************
Sprites Drawing
Offset: Format: Value:
0 Y
1 X
2 Code Low Bits
3 7------- Flip X
-6------ Flip Y
--5-----
---4---- ?
----3--- Code High Bit?
-----210 Color
***************************************************************************/
void amspdwy_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
uint8_t *spriteram = m_spriteram;
int i;
int max_x = m_screen->width() - 1;
int max_y = m_screen->height() - 1;
for (i = 0; i < m_spriteram.bytes() ; i += 4)
{
int y = spriteram[i + 0];
int x = spriteram[i + 1];
int code = spriteram[i + 2];
int attr = spriteram[i + 3];
int flipx = attr & 0x80;
int flipy = attr & 0x40;
if (flip_screen())
{
x = max_x - x - 8;
y = max_y - y - 8;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
// code + ((attr & 0x18)<<5),
code + ((attr & 0x08)<<5),
attr,
flipx, flipy,
x,y,0 );
}
}
/***************************************************************************
Screen Drawing
***************************************************************************/
uint32_t amspdwy_state::screen_update_amspdwy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -161,35 +161,33 @@ glsl_shader_info *glsl_shader_init(osd_gl_context *gl_ctx)
#endif #endif
} }
if (err) return nullptr; if (err) return nullptr;
return (glsl_shader_info *) malloc(sizeof(glsl_shader_info *)); return new glsl_shader_info{ 0 };
} }
int glsl_shader_free(glsl_shader_info *shinfo) int glsl_shader_free(glsl_shader_info *shinfo)
{ {
int i,j;
pfn_glUseProgramObjectARB(0); // back to fixed function pipeline pfn_glUseProgramObjectARB(0); // back to fixed function pipeline
glFinish(); glFinish();
for (i=0; i<GLSL_VERTEX_SHADER_MAX_NUMBER+9; i++) for (int i=0; i<GLSL_VERTEX_SHADER_MAX_NUMBER+9; i++)
{ {
if ( glsl_mamebm_vsh_shader[i] ) if ( glsl_mamebm_vsh_shader[i] )
(void) gl_delete_shader(nullptr, &glsl_mamebm_vsh_shader[i], nullptr); (void) gl_delete_shader(nullptr, &glsl_mamebm_vsh_shader[i], nullptr);
} }
for (j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++) for (int j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++)
{ {
if ( glsl_mamebm_fsh_shader[j] ) if ( glsl_mamebm_fsh_shader[j] )
(void) gl_delete_shader(nullptr, nullptr, &glsl_mamebm_fsh_shader[j]); (void) gl_delete_shader(nullptr, nullptr, &glsl_mamebm_fsh_shader[j]);
} }
for (j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++) for (int j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++)
{ {
if ( glsl_mamebm_programs[j] ) if ( glsl_mamebm_programs[j] )
(void) gl_delete_shader( &glsl_mamebm_programs[j], nullptr, nullptr); (void) gl_delete_shader( &glsl_mamebm_programs[j], nullptr, nullptr);
} }
for (i=0; i<10; i++) for (int i=0; i<10; i++)
{ {
if ( glsl_scrn_vsh_shader[i] ) if ( glsl_scrn_vsh_shader[i] )
(void) gl_delete_shader(nullptr, &glsl_scrn_vsh_shader[i], nullptr); (void) gl_delete_shader(nullptr, &glsl_scrn_vsh_shader[i], nullptr);
@ -199,7 +197,7 @@ int glsl_shader_free(glsl_shader_info *shinfo)
(void) gl_delete_shader( &glsl_scrn_programs[i], nullptr, nullptr); (void) gl_delete_shader( &glsl_scrn_programs[i], nullptr, nullptr);
} }
free(shinfo); delete shinfo;
return 0; return 0;
} }

View File

@ -335,7 +335,6 @@ int sound_sdl::init(const osd_options &options)
int n_channels = 2; int n_channels = 2;
int audio_latency; int audio_latency;
SDL_AudioSpec aspec, obtained; SDL_AudioSpec aspec, obtained;
char audio_driver[16] = "";
if (LOG_SOUND) if (LOG_SOUND)
sound_log = std::make_unique<std::ofstream>(SDLMAME_SOUND_LOG); sound_log = std::make_unique<std::ofstream>(SDLMAME_SOUND_LOG);
@ -350,8 +349,8 @@ int sound_sdl::init(const osd_options &options)
} }
osd_printf_verbose("Audio: Start initialization\n"); osd_printf_verbose("Audio: Start initialization\n");
strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver)); char const *const audio_driver = SDL_GetCurrentAudioDriver();
osd_printf_verbose("Audio: Driver is %s\n", audio_driver); osd_printf_verbose("Audio: Driver is %s\n", audio_driver ? audio_driver : "not initialized");
sdl_xfer_samples = SDL_XFER_SAMPLES; sdl_xfer_samples = SDL_XFER_SAMPLES;
stream_in_initialized = 0; stream_in_initialized = 0;

View File

@ -2251,7 +2251,7 @@ imgtool::directory::directory(imgtool::partition &partition)
if (partition.m_directory_extra_bytes > 0) if (partition.m_directory_extra_bytes > 0)
{ {
m_extra_bytes = std::make_unique<uint8_t[]>(partition.m_directory_extra_bytes); m_extra_bytes = std::make_unique<uint8_t[]>(partition.m_directory_extra_bytes);
memset(m_extra_bytes.get(), 0, sizeof(m_extra_bytes.get()[0] * partition.m_directory_extra_bytes)); memset(m_extra_bytes.get(), 0, sizeof(m_extra_bytes[0]) * partition.m_directory_extra_bytes);
} }
} }