More sprintf and warning cleanup (#3540)

Co-authored-by: cold-brewed <cold-brewed@users.noreply.github.com>
This commit is contained in:
cold-brewed
2023-08-11 15:34:06 -04:00
committed by GitHub
parent 750f0ef90e
commit bff9eea9ae
5 changed files with 98 additions and 102 deletions

View File

@@ -938,9 +938,6 @@ VulkanRenderer2::startNextFrame()
if (err != VK_SUCCESS)
qFatal("Failed to map memory: %d", err);
QMatrix4x4 m = m_proj;
#if 0
m.rotate(m_rotation, 0, 0, 1);
#endif
memcpy(p, m.constData(), 16 * sizeof(float));
m_devFuncs->vkUnmapMemory(dev, m_bufMem);
p = nullptr;

View File

@@ -89,6 +89,5 @@ private:
VkFormat m_texFormat;
QMatrix4x4 m_proj;
float m_rotation = 0.0f;
};
#endif

View File

@@ -41,15 +41,15 @@ joystick_init()
plat_joystick_state[c].nr_povs = SDL_JoystickNumHats(sdl_joy[c]);
for (d = 0; d < std::min(plat_joystick_state[c].nr_axes, 8); d++) {
sprintf(plat_joystick_state[c].axis[d].name, "Axis %i", d);
snprintf(plat_joystick_state[c].axis[d].name, sizeof(plat_joystick_state[c].axis[d].name), "Axis %i", d);
plat_joystick_state[c].axis[d].id = d;
}
for (d = 0; d < std::min(plat_joystick_state[c].nr_buttons, 8); d++) {
sprintf(plat_joystick_state[c].button[d].name, "Button %i", d);
snprintf(plat_joystick_state[c].button[d].name, sizeof(plat_joystick_state[c].button[d].name), "Button %i", d);
plat_joystick_state[c].button[d].id = d;
}
for (d = 0; d < std::min(plat_joystick_state[c].nr_povs, 4); d++) {
sprintf(plat_joystick_state[c].pov[d].name, "POV %i", d);
snprintf(plat_joystick_state[c].pov[d].name, sizeof(plat_joystick_state[c].pov[d].name), "POV %i", d);
plat_joystick_state[c].pov[d].id = d;
}
}

View File

@@ -191,7 +191,7 @@ Bit32u MidiStreamParserImpl::parseShortMessageDataBytes(const Bit8u stream[], Bi
} else if (dataByte < 0xF8) {
// Discard invalid bytes and start over
char s[128];
sprintf(s, "parseShortMessageDataBytes: Invalid short message: status %02x, expected length %i, actual %i -> ignored", *streamBuffer, shortMessageLength, streamBufferSize);
snprintf(s, sizeof(s), "parseShortMessageDataBytes: Invalid short message: status %02x, expected length %i, actual %i -> ignored", *streamBuffer, shortMessageLength, streamBufferSize);
midiReporter.printDebug(s);
streamBufferSize = 0; // Clear streamBuffer
return parsedLength;

View File

@@ -54,7 +54,7 @@ Part::Part(Synth *useSynth, unsigned int usePartNum) {
// Nasty hack for rhythm
timbreTemp = NULL;
} else {
sprintf(name, "Part %d", partNum + 1);
snprintf(name, sizeof(name), "Part %d", partNum + 1);
timbreTemp = &synth->mt32ram.timbreTemp[partNum];
}
currentInstr[0] = 0;