Remove the use of std::memset
This commit is contained in:
parent
6451a29f49
commit
ca9531bcbd
@ -97,10 +97,8 @@ bool SoundFileReaderMp3::check(InputStream& stream)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SoundFileReaderMp3::SoundFileReaderMp3() : m_numSamples(0), m_position(0)
|
SoundFileReaderMp3::SoundFileReaderMp3() : m_io(), m_decoder(), m_numSamples(0), m_position(0)
|
||||||
{
|
{
|
||||||
std::memset(&m_io, 0, sizeof(m_io));
|
|
||||||
std::memset(&m_decoder, 0, sizeof(m_decoder));
|
|
||||||
m_io.read = readCallback;
|
m_io.read = readCallback;
|
||||||
m_io.seek = seekCallback;
|
m_io.seek = seekCallback;
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,6 @@ bool Font::loadFromStream(InputStream& stream)
|
|||||||
|
|
||||||
// Prepare a wrapper for our stream, that we'll pass to FreeType callbacks
|
// Prepare a wrapper for our stream, that we'll pass to FreeType callbacks
|
||||||
fontHandles->streamRec = std::make_unique<FT_StreamRec>();
|
fontHandles->streamRec = std::make_unique<FT_StreamRec>();
|
||||||
std::memset(fontHandles->streamRec.get(), 0, sizeof(*fontHandles->streamRec));
|
|
||||||
fontHandles->streamRec->base = nullptr;
|
fontHandles->streamRec->base = nullptr;
|
||||||
fontHandles->streamRec->size = static_cast<unsigned long>(stream.getSize());
|
fontHandles->streamRec->size = static_cast<unsigned long>(stream.getSize());
|
||||||
fontHandles->streamRec->pos = 0;
|
fontHandles->streamRec->pos = 0;
|
||||||
|
@ -41,8 +41,7 @@ namespace priv
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sockaddr_in SocketImpl::createAddress(std::uint32_t address, unsigned short port)
|
sockaddr_in SocketImpl::createAddress(std::uint32_t address, unsigned short port)
|
||||||
{
|
{
|
||||||
sockaddr_in addr;
|
auto addr = sockaddr_in();
|
||||||
std::memset(&addr, 0, sizeof(addr));
|
|
||||||
addr.sin_addr.s_addr = htonl(address);
|
addr.sin_addr.s_addr = htonl(address);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
addr.sin_port = htons(port);
|
addr.sin_port = htons(port);
|
||||||
|
@ -37,8 +37,7 @@ namespace priv
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sockaddr_in SocketImpl::createAddress(std::uint32_t address, unsigned short port)
|
sockaddr_in SocketImpl::createAddress(std::uint32_t address, unsigned short port)
|
||||||
{
|
{
|
||||||
sockaddr_in addr;
|
auto addr = sockaddr_in();
|
||||||
std::memset(&addr, 0, sizeof(addr));
|
|
||||||
addr.sin_addr.s_addr = htonl(address);
|
addr.sin_addr.s_addr = htonl(address);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
addr.sin_port = htons(port);
|
addr.sin_port = htons(port);
|
||||||
|
@ -119,8 +119,8 @@ void cleanup()
|
|||||||
drmNode.fd = -1;
|
drmNode.fd = -1;
|
||||||
drmNode.mode = 0;
|
drmNode.mode = 0;
|
||||||
|
|
||||||
std::memset(&pollFD, 0, sizeof(pollfd));
|
pollFD = {};
|
||||||
std::memset(&drmEventCtx, 0, sizeof(drmEventContext));
|
drmEventCtx = {};
|
||||||
|
|
||||||
waitingForFlip = 0;
|
waitingForFlip = 0;
|
||||||
|
|
||||||
|
@ -398,8 +398,7 @@ std::string getJoystickName(unsigned int index)
|
|||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
// Get the name
|
// Get the name
|
||||||
char name[128];
|
char name[128] = {};
|
||||||
std::memset(name, 0, sizeof(name));
|
|
||||||
|
|
||||||
int result = ioctl(fd, JSIOCGNAME(sizeof(name)), name);
|
int result = ioctl(fd, JSIOCGNAME(sizeof(name)), name);
|
||||||
|
|
||||||
|
@ -662,8 +662,7 @@ m_lastInputTime(0)
|
|||||||
unsigned long state;
|
unsigned long state;
|
||||||
};
|
};
|
||||||
|
|
||||||
WMHints hints;
|
auto hints = WMHints();
|
||||||
std::memset(&hints, 0, sizeof(hints));
|
|
||||||
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||||
hints.decorations = 0;
|
hints.decorations = 0;
|
||||||
hints.functions = 0;
|
hints.functions = 0;
|
||||||
@ -1324,9 +1323,7 @@ void WindowImplX11::grabFocus()
|
|||||||
|
|
||||||
if (netActiveWindow)
|
if (netActiveWindow)
|
||||||
{
|
{
|
||||||
XEvent event;
|
auto event = XEvent();
|
||||||
std::memset(&event, 0, sizeof(event));
|
|
||||||
|
|
||||||
event.type = ClientMessage;
|
event.type = ClientMessage;
|
||||||
event.xclient.window = m_window;
|
event.xclient.window = m_window;
|
||||||
event.xclient.format = 32;
|
event.xclient.format = 32;
|
||||||
@ -1550,9 +1547,7 @@ void WindowImplX11::switchToFullscreen()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
XEvent event;
|
auto event = XEvent();
|
||||||
std::memset(&event, 0, sizeof(event));
|
|
||||||
|
|
||||||
event.type = ClientMessage;
|
event.type = ClientMessage;
|
||||||
event.xclient.window = m_window;
|
event.xclient.window = m_window;
|
||||||
event.xclient.format = 32;
|
event.xclient.format = 32;
|
||||||
|
@ -58,9 +58,7 @@ bool CursorImpl::loadFromPixels(const std::uint8_t* pixels, Vector2u size, Vecto
|
|||||||
release();
|
release();
|
||||||
|
|
||||||
// Create the bitmap that will hold our color data
|
// Create the bitmap that will hold our color data
|
||||||
BITMAPV5HEADER bitmapHeader;
|
auto bitmapHeader = BITMAPV5HEADER();
|
||||||
std::memset(&bitmapHeader, 0, sizeof(BITMAPV5HEADER));
|
|
||||||
|
|
||||||
bitmapHeader.bV5Size = sizeof(BITMAPV5HEADER);
|
bitmapHeader.bV5Size = sizeof(BITMAPV5HEADER);
|
||||||
bitmapHeader.bV5Width = static_cast<LONG>(size.x);
|
bitmapHeader.bV5Width = static_cast<LONG>(size.x);
|
||||||
bitmapHeader.bV5Height = -static_cast<LONG>(size.y); // Negative indicates origin is in upper-left corner
|
bitmapHeader.bV5Height = -static_cast<LONG>(size.y); // Negative indicates origin is in upper-left corner
|
||||||
@ -108,9 +106,7 @@ bool CursorImpl::loadFromPixels(const std::uint8_t* pixels, Vector2u size, Vecto
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the structure that describes our cursor
|
// Create the structure that describes our cursor
|
||||||
ICONINFO cursorInfo;
|
auto cursorInfo = ICONINFO();
|
||||||
std::memset(&cursorInfo, 0, sizeof(ICONINFO));
|
|
||||||
|
|
||||||
cursorInfo.fIcon = FALSE; // This is a cursor and not an icon
|
cursorInfo.fIcon = FALSE; // This is a cursor and not an icon
|
||||||
cursorInfo.xHotspot = hotspot.x;
|
cursorInfo.xHotspot = hotspot.x;
|
||||||
cursorInfo.yHotspot = hotspot.y;
|
cursorInfo.yHotspot = hotspot.y;
|
||||||
|
@ -545,7 +545,7 @@ bool JoystickImpl::openDInput(unsigned int index)
|
|||||||
for (int& button : m_buttons)
|
for (int& button : m_buttons)
|
||||||
button = -1;
|
button = -1;
|
||||||
|
|
||||||
std::memset(&m_deviceCaps, 0, sizeof(DIDEVCAPS));
|
m_deviceCaps = {};
|
||||||
m_deviceCaps.dwSize = sizeof(DIDEVCAPS);
|
m_deviceCaps.dwSize = sizeof(DIDEVCAPS);
|
||||||
m_state = JoystickState();
|
m_state = JoystickState();
|
||||||
m_buffered = false;
|
m_buffered = false;
|
||||||
@ -566,8 +566,7 @@ bool JoystickImpl::openDInput(unsigned int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get vendor and product id of the device
|
// Get vendor and product id of the device
|
||||||
DIPROPDWORD property;
|
auto property = DIPROPDWORD();
|
||||||
std::memset(&property, 0, sizeof(property));
|
|
||||||
property.diph.dwSize = sizeof(property);
|
property.diph.dwSize = sizeof(property);
|
||||||
property.diph.dwHeaderSize = sizeof(property.diph);
|
property.diph.dwHeaderSize = sizeof(property.diph);
|
||||||
property.diph.dwHow = DIPH_DEVICE;
|
property.diph.dwHow = DIPH_DEVICE;
|
||||||
@ -596,8 +595,7 @@ bool JoystickImpl::openDInput(unsigned int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get friendly product name of the device
|
// Get friendly product name of the device
|
||||||
DIPROPSTRING stringProperty;
|
auto stringProperty = DIPROPSTRING();
|
||||||
std::memset(&stringProperty, 0, sizeof(stringProperty));
|
|
||||||
stringProperty.diph.dwSize = sizeof(stringProperty);
|
stringProperty.diph.dwSize = sizeof(stringProperty);
|
||||||
stringProperty.diph.dwHeaderSize = sizeof(stringProperty.diph);
|
stringProperty.diph.dwHeaderSize = sizeof(stringProperty.diph);
|
||||||
stringProperty.diph.dwHow = DIPH_DEVICE;
|
stringProperty.diph.dwHow = DIPH_DEVICE;
|
||||||
@ -740,7 +738,7 @@ bool JoystickImpl::openDInput(unsigned int index)
|
|||||||
{
|
{
|
||||||
if (axis != -1)
|
if (axis != -1)
|
||||||
{
|
{
|
||||||
std::memset(&property, 0, sizeof(property));
|
property = {};
|
||||||
property.diph.dwSize = sizeof(property);
|
property.diph.dwSize = sizeof(property);
|
||||||
property.diph.dwHeaderSize = sizeof(property.diph);
|
property.diph.dwHeaderSize = sizeof(property.diph);
|
||||||
property.diph.dwHow = DIPH_DEVICE;
|
property.diph.dwHow = DIPH_DEVICE;
|
||||||
@ -763,7 +761,7 @@ bool JoystickImpl::openDInput(unsigned int index)
|
|||||||
if (property.dwData == DIPROPAXISMODE_ABS)
|
if (property.dwData == DIPROPAXISMODE_ABS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
std::memset(&property, 0, sizeof(property));
|
property = {};
|
||||||
property.diph.dwSize = sizeof(property);
|
property.diph.dwSize = sizeof(property);
|
||||||
property.diph.dwHeaderSize = sizeof(property.diph);
|
property.diph.dwHeaderSize = sizeof(property.diph);
|
||||||
property.diph.dwHow = DIPH_DEVICE;
|
property.diph.dwHow = DIPH_DEVICE;
|
||||||
@ -772,7 +770,7 @@ bool JoystickImpl::openDInput(unsigned int index)
|
|||||||
m_device->SetProperty(DIPROP_AXISMODE, &property.diph);
|
m_device->SetProperty(DIPROP_AXISMODE, &property.diph);
|
||||||
|
|
||||||
// Check if the axis mode has been set to absolute
|
// Check if the axis mode has been set to absolute
|
||||||
std::memset(&property, 0, sizeof(property));
|
property = {};
|
||||||
property.diph.dwSize = sizeof(property);
|
property.diph.dwSize = sizeof(property);
|
||||||
property.diph.dwHeaderSize = sizeof(property.diph);
|
property.diph.dwHeaderSize = sizeof(property.diph);
|
||||||
property.diph.dwHow = DIPH_DEVICE;
|
property.diph.dwHow = DIPH_DEVICE;
|
||||||
@ -816,7 +814,7 @@ bool JoystickImpl::openDInput(unsigned int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to enable buffering by setting the buffer size
|
// Try to enable buffering by setting the buffer size
|
||||||
std::memset(&property, 0, sizeof(property));
|
property = {};
|
||||||
property.diph.dwSize = sizeof(property);
|
property.diph.dwSize = sizeof(property);
|
||||||
property.diph.dwHeaderSize = sizeof(property.diph);
|
property.diph.dwHeaderSize = sizeof(property.diph);
|
||||||
property.diph.dwHow = DIPH_DEVICE;
|
property.diph.dwHow = DIPH_DEVICE;
|
||||||
@ -1129,9 +1127,7 @@ BOOL CALLBACK JoystickImpl::deviceObjectEnumerationCallback(const DIDEVICEOBJECT
|
|||||||
return DIENUM_CONTINUE;
|
return DIENUM_CONTINUE;
|
||||||
|
|
||||||
// Set the axis' value range to that of a signed short: [-32768, 32767]
|
// Set the axis' value range to that of a signed short: [-32768, 32767]
|
||||||
DIPROPRANGE propertyRange;
|
auto propertyRange = DIPROPRANGE();
|
||||||
|
|
||||||
std::memset(&propertyRange, 0, sizeof(propertyRange));
|
|
||||||
propertyRange.diph.dwSize = sizeof(propertyRange);
|
propertyRange.diph.dwSize = sizeof(propertyRange);
|
||||||
propertyRange.diph.dwHeaderSize = sizeof(propertyRange.diph);
|
propertyRange.diph.dwHeaderSize = sizeof(propertyRange.diph);
|
||||||
propertyRange.diph.dwObj = deviceObjectInstance->dwType;
|
propertyRange.diph.dwObj = deviceObjectInstance->dwType;
|
||||||
|
Loading…
Reference in New Issue
Block a user