Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!)

This commit is contained in:
Sam Lantinga 2023-03-09 15:10:00 -08:00
parent ad95c93bf4
commit c6443d86c9
57 changed files with 176 additions and 179 deletions

View file

@ -1474,7 +1474,7 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture,
const size_t stacksize = is_internal_thread ? 64 * 1024 : 0;
char threadname[64];
(void)SDL_snprintf(threadname, sizeof threadname, "SDLAudio%c%" SDL_PRIu32, (iscapture) ? 'C' : 'P', device->id);
(void)SDL_snprintf(threadname, sizeof(threadname), "SDLAudio%c%" SDL_PRIu32, (iscapture) ? 'C' : 'P', device->id);
device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, stacksize, device);
if (device->thread == NULL) {

View file

@ -1806,7 +1806,7 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
if (RIFFchunk.fourcc == RIFF) {
Uint32 formtype;
/* Read the form type. "WAVE" expected. */
if (SDL_RWread(src, &formtype, sizeof(Uint32)) != sizeof (Uint32)) {
if (SDL_RWread(src, &formtype, sizeof(Uint32)) != sizeof(Uint32)) {
return SDL_SetError("Could not read RIFF form type");
} else if (SDL_SwapLE32(formtype) != WAVE) {
return SDL_SetError("RIFF form type is not WAVE (not a Waveform file)");

View file

@ -91,7 +91,7 @@ static int aaudio_OpenDevice(_THIS, const char *devname)
audioDevice = this;
}
this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, (sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -535,8 +535,7 @@ static int ALSA_OpenDevice(_THIS, const char *devname)
#endif
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -49,7 +49,7 @@ static int ANDROIDAUDIO_OpenDevice(_THIS, const char *devname)
audioDevice = this;
}
this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, (sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -1013,8 +1013,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname)
SDL_AudioDevice **new_open_devices;
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -489,8 +489,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname)
DWORD bufsize;
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -83,8 +83,7 @@ static int DSP_OpenDevice(_THIS, const char *devname)
}
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -124,7 +124,7 @@ static void HandleCaptureProcess(_THIS)
}
}
}
}, this->work_buffer, (this->spec.size / sizeof (float)) / this->spec.channels);
}, this->work_buffer, (this->spec.size / sizeof(float)) / this->spec.channels);
/* *INDENT-ON* */ /* clang-format on */
/* okay, we've got an interleaved float32 array in C now. */
@ -253,8 +253,7 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname)
/* Initialize all variables that we clean on shutdown */
#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL3 namespace? --ryan. */
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -129,6 +129,7 @@ static int load_jack_syms(void)
SDL_JACK_SYM(jack_port_type);
SDL_JACK_SYM(jack_connect);
SDL_JACK_SYM(jack_set_process_callback);
return 0;
}
@ -298,7 +299,7 @@ static int JACK_OpenDevice(_THIS, const char *devname)
}
/* Filter out non-audio ports */
audio_ports = SDL_calloc(ports, sizeof *audio_ports);
audio_ports = SDL_calloc(ports, sizeof(*audio_ports));
for (i = 0; i < ports; i++) {
const jack_port_t *dport = JACK_jack_port_by_name(client, devports[i]);
const char *type = JACK_jack_port_type(dport);

View file

@ -93,7 +93,7 @@ static int N3DSAUDIO_OpenDevice(_THIS, const char *devname)
Result ndsp_init_res;
Uint8 *data_vaddr;
float mix[12];
this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof *this->hidden);
this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();

View file

@ -208,8 +208,7 @@ static int NETBSDAUDIO_OpenDevice(_THIS, const char *devname)
}
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -589,7 +589,7 @@ failed:
static int openslES_OpenDevice(_THIS, const char *devname)
{
this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, (sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -529,8 +529,7 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname)
int rc = 0;
/* Initialize all variables that we clean on shutdown */
h = this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
h = this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -47,6 +47,7 @@
static const IID SDL_IID_IAudioRenderClient = { 0xf294acfc, 0x3146, 0x4483, { 0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2 } };
static const IID SDL_IID_IAudioCaptureClient = { 0xc8adbd64, 0xe71e, 0x48a0, { 0xa4, 0xde, 0x18, 0x5c, 0x39, 0x5c, 0xd3, 0x17 } };
static void WASAPI_DetectDevices(void)
{
WASAPI_EnumerateEndpoints();
@ -528,8 +529,7 @@ static int WASAPI_OpenDevice(_THIS, const char *devname)
LPCWSTR devid = (LPCWSTR)this->handle;
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}

View file

@ -287,7 +287,7 @@ void SDL_EVDEV_Poll(void)
mouse = SDL_GetMouse();
for (item = _this->first; item != NULL; item = item->next) {
while ((len = read(item->fd, events, (sizeof events))) > 0) {
while ((len = read(item->fd, events, sizeof(events))) > 0) {
len /= sizeof(events[0]);
for (i = 0; i < len; ++i) {
struct input_event *event = &events[i];

View file

@ -62,9 +62,9 @@ static char *GetAppName(void)
int linksize;
#if defined(__LINUX__)
(void)SDL_snprintf(procfile, sizeof procfile, "/proc/%d/exe", getpid());
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid());
#elif defined(__FREEBSD__)
(void)SDL_snprintf(procfile, sizeof procfile, "/proc/%d/file", getpid());
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid());
#endif
linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
if (linksize > 0) {

View file

@ -405,13 +405,13 @@ static char *IBus_GetDBusAddressFilename(void)
SDL_free(display);
return NULL;
}
(void)SDL_snprintf(config_dir, sizeof config_dir, "%s/.config", home_env);
(void)SDL_snprintf(config_dir, sizeof(config_dir), "%s/.config", home_env);
}
key = dbus->get_local_machine_id();
SDL_memset(file_path, 0, sizeof(file_path));
(void)SDL_snprintf(file_path, sizeof file_path, "%s/ibus/bus/%s-%s-%s",
(void)SDL_snprintf(file_path, sizeof(file_path), "%s/ibus/bus/%s-%s-%s",
config_dir, key, host, disp_num);
dbus->free(key);
SDL_free(display);
@ -489,7 +489,7 @@ static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr)
if (result) {
char matchstr[128];
(void)SDL_snprintf(matchstr, sizeof matchstr, "type='signal',interface='%s'", ibus_input_interface);
(void)SDL_snprintf(matchstr, sizeof(matchstr), "type='signal',interface='%s'", ibus_input_interface);
SDL_free(input_ctx_path);
input_ctx_path = SDL_strdup(path);
SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL);

View file

@ -266,7 +266,7 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
}
ptr = (const unsigned char *)guid;
(void)SDL_snprintf(keystr, sizeof keystr,
(void)SDL_snprintf(keystr, sizeof(keystr),
"System\\CurrentControlSet\\Control\\MediaCategories\\{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
ptr[3], ptr[2], ptr[1], ptr[0], ptr[5], ptr[4], ptr[7], ptr[6],
ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13], ptr[14], ptr[15]);

View file

@ -654,7 +654,7 @@ SDL_CreateRW(void)
{
SDL_RWops *area;
area = (SDL_RWops *)SDL_malloc(sizeof *area);
area = (SDL_RWops *)SDL_malloc(sizeof(*area));
if (area == NULL) {
SDL_OutOfMemory();
} else {

View file

@ -125,14 +125,14 @@ SDL_HapticOpen(int device_index)
}
/* Create the haptic device */
haptic = (SDL_Haptic *)SDL_malloc((sizeof *haptic));
haptic = (SDL_Haptic *)SDL_malloc(sizeof(*haptic));
if (haptic == NULL) {
SDL_OutOfMemory();
return NULL;
}
/* Initialize the haptic device */
SDL_memset(haptic, 0, (sizeof *haptic));
SDL_memset(haptic, 0, sizeof(*haptic));
haptic->rumble_id = -1;
haptic->index = device_index;
if (SDL_SYS_HapticOpen(haptic) < 0) {
@ -299,7 +299,7 @@ SDL_HapticOpenFromJoystick(SDL_Joystick *joystick)
}
/* Create the haptic device */
haptic = (SDL_Haptic *)SDL_malloc((sizeof *haptic));
haptic = (SDL_Haptic *)SDL_malloc(sizeof(*haptic));
if (haptic == NULL) {
SDL_OutOfMemory();
SDL_UnlockJoysticks();

View file

@ -88,7 +88,7 @@ int SDL_XINPUT_HapticMaybeAddDevice(const DWORD dwUserid)
/* !!! FIXME: I'm not bothering to query for a real name right now (can we even?) */
{
char buf[64];
(void)SDL_snprintf(buf, sizeof buf, "XInput Controller #%u", userid + 1);
(void)SDL_snprintf(buf, sizeof(buf), "XInput Controller #%u", userid + 1);
item->name = SDL_strdup(buf);
}
@ -199,7 +199,7 @@ static int SDL_XINPUT_HapticOpenFromUserIndex(SDL_Haptic *haptic, const Uint8 us
return SDL_SetError("Couldn't create XInput haptic mutex");
}
(void)SDL_snprintf(threadName, sizeof threadName, "SDLXInputDev%u", userid);
(void)SDL_snprintf(threadName, sizeof(threadName), "SDLXInputDev%d", userid);
haptic->hwdata->thread = SDL_CreateThreadInternal(SDL_RunXInputHaptic, threadName, 64 * 1024, haptic->hwdata);
if (haptic->hwdata->thread == NULL) {

View file

@ -1376,13 +1376,13 @@ static void SDL_PrivateAppendToMappingString(char *mapping_string,
SDL_strlcat(mapping_string, ":", mapping_string_len);
switch (mapping->kind) {
case EMappingKind_Button:
(void)SDL_snprintf(buffer, sizeof buffer, "b%i", mapping->target);
(void)SDL_snprintf(buffer, sizeof(buffer), "b%i", mapping->target);
break;
case EMappingKind_Axis:
(void)SDL_snprintf(buffer, sizeof buffer, "a%i", mapping->target);
(void)SDL_snprintf(buffer, sizeof(buffer), "a%i", mapping->target);
break;
case EMappingKind_Hat:
(void)SDL_snprintf(buffer, sizeof buffer, "h%i.%i", mapping->target >> 4, mapping->target & 0x0F);
(void)SDL_snprintf(buffer, sizeof(buffer), "h%i.%i", mapping->target >> 4, mapping->target & 0x0F);
break;
default:
SDL_assert(SDL_FALSE);
@ -1410,7 +1410,7 @@ static GamepadMapping_t *SDL_PrivateGenerateAutomaticGamepadMapping(const char *
}
}
}
(void)SDL_snprintf(mapping, sizeof mapping, "none,%s,", name_string);
(void)SDL_snprintf(mapping, sizeof(mapping), "none,%s,", name_string);
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "a", &raw_map->a);
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "b", &raw_map->b);
SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "x", &raw_map->x);

View file

@ -647,7 +647,7 @@ static void BSD_JoystickUpdate(SDL_Joystick *joy)
static int x, y, xmin = 0xffff, ymin = 0xffff, xmax = 0, ymax = 0;
if (joy->hwdata->type == BSDJOY_JOY) {
while (read(joy->hwdata->fd, &gameport, sizeof gameport) == sizeof gameport) {
while (read(joy->hwdata->fd, &gameport, sizeof(gameport)) == sizeof(gameport)) {
if (SDL_abs(x - gameport.x) > 8) {
x = gameport.x;
if (x < xmin) {

View file

@ -65,8 +65,8 @@ extern "C"
/* Search for attached joysticks */
nports = joystick.CountDevices();
numjoysticks = 0;
SDL_memset(SDL_joyport, 0, (sizeof SDL_joyport));
SDL_memset(SDL_joyname, 0, (sizeof SDL_joyname));
SDL_memset(SDL_joyport, 0, sizeof(SDL_joyport));
SDL_memset(SDL_joyname, 0, sizeof(SDL_joyname));
for (i = 0; (numjoysticks < MAX_JOYSTICKS) && (i < nports); ++i) {
if (joystick.GetDeviceName(i, name) == B_OK) {
if (joystick.Open(name) != B_ERROR) {

View file

@ -583,7 +583,7 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_IsSupportedDevice(SDL_HIDAPI_Device *
if (HIDAPI_SupportsPlaystationDetection(vendor_id, product_id)) {
if (device && device->dev) {
size = ReadFeatureReport(device->dev, 0x03, data, sizeof data);
size = ReadFeatureReport(device->dev, 0x03, data, sizeof(data));
if (size == 8 && data[2] == 0x26) {
/* Supported third party controller */
return SDL_TRUE;

View file

@ -185,7 +185,7 @@ static SDL_bool HIDAPI_DriverPS4_IsSupportedDevice(SDL_HIDAPI_Device *device, co
if (HIDAPI_SupportsPlaystationDetection(vendor_id, product_id)) {
if (device && device->dev) {
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof data);
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof(data));
if (size == 48 && data[2] == 0x27) {
/* Supported third party controller */
return SDL_TRUE;
@ -264,7 +264,7 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
if (ctx->is_dongle) {
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdSerialNumber, data, sizeof(data));
if (size >= 7 && (data[1] || data[2] || data[3] || data[4] || data[5] || data[6])) {
(void)SDL_snprintf(serial, sizeof serial, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
(void)SDL_snprintf(serial, sizeof(serial), "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
data[6], data[5], data[4], data[3], data[2], data[1]);
}
device->is_bluetooth = SDL_FALSE;
@ -277,7 +277,7 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
/* This will fail if we're on Bluetooth */
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdSerialNumber, data, sizeof(data));
if (size >= 7 && (data[1] || data[2] || data[3] || data[4] || data[5] || data[6])) {
(void)SDL_snprintf(serial, sizeof serial, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
(void)SDL_snprintf(serial, sizeof(serial), "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
data[6], data[5], data[4], data[3], data[2], data[1]);
device->is_bluetooth = SDL_FALSE;
ctx->enhanced_mode = SDL_TRUE;
@ -308,7 +308,7 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
SDL_Log("PS4 dongle = %s, bluetooth = %s\n", ctx->is_dongle ? "TRUE" : "FALSE", device->is_bluetooth ? "TRUE" : "FALSE");
#endif
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof data);
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof(data));
/* Get the device capabilities */
if (size == 48 && data[2] == 0x27) {
Uint8 capabilities = data[4];
@ -1121,7 +1121,7 @@ static SDL_bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device)
char serial[18];
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdSerialNumber, data, sizeof(data));
if (size >= 7 && (data[1] || data[2] || data[3] || data[4] || data[5] || data[6])) {
(void)SDL_snprintf(serial, sizeof serial, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
(void)SDL_snprintf(serial, sizeof(serial), "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
data[6], data[5], data[4], data[3], data[2], data[1]);
HIDAPI_SetDeviceSerial(device, serial);
}

View file

@ -280,7 +280,7 @@ static SDL_bool HIDAPI_DriverPS5_IsSupportedDevice(SDL_HIDAPI_Device *device, co
if (HIDAPI_SupportsPlaystationDetection(vendor_id, product_id)) {
if (device && device->dev) {
size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof data);
size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof(data));
if (size == 48 && data[2] == 0x28) {
/* Supported third party controller */
return SDL_TRUE;
@ -405,7 +405,7 @@ static SDL_bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
This will also enable enhanced reports over Bluetooth
*/
if (ReadFeatureReport(device->dev, k_EPS5FeatureReportIdSerialNumber, data, sizeof(data)) >= 7) {
(void)SDL_snprintf(serial, sizeof serial, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
(void)SDL_snprintf(serial, sizeof(serial), "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
data[6], data[5], data[4], data[3], data[2], data[1]);
}
@ -417,7 +417,7 @@ static SDL_bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
}
}
size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof data);
size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof(data));
/* Get the device capabilities */
if (device->vendor_id == USB_VENDOR_SONY) {
ctx->sensors_supported = SDL_TRUE;

View file

@ -1214,7 +1214,7 @@ static void UpdateDeviceIdentity(SDL_HIDAPI_Device *device)
}
device->guid.data[15] = ctx->m_eControllerType;
(void)SDL_snprintf(serial, sizeof serial, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
(void)SDL_snprintf(serial, sizeof(serial), "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
ctx->m_rgucMACAddress[0],
ctx->m_rgucMACAddress[1],
ctx->m_rgucMACAddress[2],

View file

@ -1414,7 +1414,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
joystick->hwdata->fresh = SDL_FALSE;
}
while ((len = read(joystick->hwdata->fd, events, (sizeof events))) > 0) {
while ((len = read(joystick->hwdata->fd, events, sizeof(events))) > 0) {
len /= sizeof(events[0]);
for (i = 0; i < len; ++i) {
struct input_event *event = &events[i];
@ -1495,7 +1495,7 @@ static void HandleClassicEvents(SDL_Joystick *joystick)
SDL_AssertJoysticksLocked();
joystick->hwdata->fresh = SDL_FALSE;
while ((len = read(joystick->hwdata->fd, events, (sizeof events))) > 0) {
while ((len = read(joystick->hwdata->fd, events, sizeof(events))) > 0) {
len /= sizeof(events[0]);
for (i = 0; i < len; ++i) {
switch (events[i].type) {

View file

@ -621,19 +621,19 @@ static BOOL CALLBACK EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE pDeviceObj
in->type = AXIS;
in->num = joystick->naxes;
if (SDL_memcmp(&pDeviceObject->guidType, &GUID_XAxis, sizeof pDeviceObject->guidType) == 0) {
if (SDL_memcmp(&pDeviceObject->guidType, &GUID_XAxis, sizeof(pDeviceObject->guidType)) == 0) {
in->ofs = DIJOFS_X;
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_YAxis, sizeof pDeviceObject->guidType) == 0) {
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_YAxis, sizeof(pDeviceObject->guidType)) == 0) {
in->ofs = DIJOFS_Y;
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_ZAxis, sizeof pDeviceObject->guidType) == 0) {
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_ZAxis, sizeof(pDeviceObject->guidType)) == 0) {
in->ofs = DIJOFS_Z;
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_RxAxis, sizeof pDeviceObject->guidType) == 0) {
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_RxAxis, sizeof(pDeviceObject->guidType)) == 0) {
in->ofs = DIJOFS_RX;
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_RyAxis, sizeof pDeviceObject->guidType) == 0) {
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_RyAxis, sizeof(pDeviceObject->guidType)) == 0) {
in->ofs = DIJOFS_RY;
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_RzAxis, sizeof pDeviceObject->guidType) == 0) {
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_RzAxis, sizeof(pDeviceObject->guidType)) == 0) {
in->ofs = DIJOFS_RZ;
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_Slider, sizeof pDeviceObject->guidType) == 0) {
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_Slider, sizeof(pDeviceObject->guidType)) == 0) {
in->ofs = DIJOFS_SLIDER(joystick->hwdata->NumSliders);
++joystick->hwdata->NumSliders;
} else {

View file

@ -97,9 +97,11 @@ static const IID IID_IRacingWheelStatics = { 0x3AC12CD5, 0x581B, 0x4936, { 0x9F,
static const IID IID_IRacingWheelStatics2 = { 0xE666BCAA, 0xEDFD, 0x4323, { 0xA9, 0xF6, 0x3C, 0x38, 0x40, 0x48, 0xD1, 0xED } };
/*static const IID IID_IRacingWheel = { 0xF546656F, 0xE106, 0x4C82, { 0xA9, 0x0F, 0x55, 0x40, 0x12, 0x90, 0x4B, 0x85 } };*/
extern SDL_bool SDL_XINPUT_Enabled(void);
extern SDL_bool SDL_DINPUT_JoystickPresent(Uint16 vendor, Uint16 product, Uint16 version);
static SDL_bool SDL_IsXInputDevice(Uint16 vendor, Uint16 product)
{
#ifdef SDL_JOYSTICK_XINPUT
@ -185,7 +187,7 @@ static SDL_bool SDL_IsXInputDevice(Uint16 vendor, Uint16 product)
continue;
}
(void)SDL_snprintf(devVidPidString, sizeof devVidPidString, "VID_%04X&PID_%04X", vendor, product);
(void)SDL_snprintf(devVidPidString, sizeof(devVidPidString), "VID_%04X&PID_%04X", vendor, product);
while (CM_Get_Parent(&devNode, devNode, 0) == CR_SUCCESS) {
char deviceId[MAX_DEVICE_ID_LEN];

View file

@ -84,37 +84,37 @@ static const char *GetXInputName(const Uint8 userid, BYTE SubType)
static char name[32];
if (SDL_XInputUseOldJoystickMapping()) {
(void)SDL_snprintf(name, sizeof name, "X360 Controller #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "X360 Controller #%u", 1 + userid);
} else {
switch (SubType) {
case XINPUT_DEVSUBTYPE_GAMEPAD:
(void)SDL_snprintf(name, sizeof name, "XInput Controller #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "XInput Controller #%u", 1 + userid);
break;
case XINPUT_DEVSUBTYPE_WHEEL:
(void)SDL_snprintf(name, sizeof name, "XInput Wheel #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "XInput Wheel #%u", 1 + userid);
break;
case XINPUT_DEVSUBTYPE_ARCADE_STICK:
(void)SDL_snprintf(name, sizeof name, "XInput ArcadeStick #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "XInput ArcadeStick #%u", 1 + userid);
break;
case XINPUT_DEVSUBTYPE_FLIGHT_STICK:
(void)SDL_snprintf(name, sizeof name, "XInput FlightStick #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "XInput FlightStick #%u", 1 + userid);
break;
case XINPUT_DEVSUBTYPE_DANCE_PAD:
(void)SDL_snprintf(name, sizeof name, "XInput DancePad #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "XInput DancePad #%u", 1 + userid);
break;
case XINPUT_DEVSUBTYPE_GUITAR:
case XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE:
case XINPUT_DEVSUBTYPE_GUITAR_BASS:
(void)SDL_snprintf(name, sizeof name, "XInput Guitar #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "XInput Guitar #%u", 1 + userid);
break;
case XINPUT_DEVSUBTYPE_DRUM_KIT:
(void)SDL_snprintf(name, sizeof name, "XInput DrumKit #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "XInput DrumKit #%u", 1 + userid);
break;
case XINPUT_DEVSUBTYPE_ARCADE_PAD:
(void)SDL_snprintf(name, sizeof name, "XInput ArcadePad #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "XInput ArcadePad #%u", 1 + userid);
break;
default:
(void)SDL_snprintf(name, sizeof name, "XInput Device #%u", 1 + userid);
(void)SDL_snprintf(name, sizeof(name), "XInput Device #%u", 1 + userid);
break;
}
}
@ -277,7 +277,7 @@ static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pC
SDL_free(pNewJoystick);
return; /* better luck next time? */
}
(void)SDL_snprintf(pNewJoystick->path, sizeof pNewJoystick->path, "XInput#%d", userid);
(void)SDL_snprintf(pNewJoystick->path, sizeof(pNewJoystick->path), "XInput#%d", userid);
if (!SDL_XInputUseOldJoystickMapping()) {
GuessXInputDevice(userid, &vendor, &product, &version);

View file

@ -157,7 +157,7 @@ UpdateN3DSAccelerometer(SDL_Sensor *sensor)
data[0] = (float)current_state.x * SDL_STANDARD_GRAVITY;
data[1] = (float)current_state.y * SDL_STANDARD_GRAVITY;
data[2] = (float)current_state.z * SDL_STANDARD_GRAVITY;
SDL_SendSensorUpdate(timestamp, sensor, timestamp, data, sizeof data);
SDL_SendSensorUpdate(timestamp, sensor, timestamp, data, sizeof(data));
}
}
@ -175,7 +175,7 @@ UpdateN3DSGyroscope(SDL_Sensor *sensor)
data[0] = (float)current_state.x;
data[1] = (float)current_state.y;
data[2] = (float)current_state.z;
SDL_SendSensorUpdate(timestamp, sensor, timestamp, data, sizeof data);
SDL_SendSensorUpdate(timestamp, sensor, timestamp, data, sizeof(data));
}
}

View file

@ -1015,28 +1015,28 @@ static void SDLTest_PrintRenderer(SDL_RendererInfo *info)
SDL_Log(" Renderer %s:\n", info->name);
(void)SDL_snprintf(text, sizeof text, " Flags: 0x%8.8" SDL_PRIX32, info->flags);
SDL_snprintfcat(text, sizeof text, " (");
(void)SDL_snprintf(text, sizeof(text), " Flags: 0x%8.8" SDL_PRIX32, info->flags);
SDL_snprintfcat(text, sizeof(text), " (");
count = 0;
for (i = 0; i < 8 * sizeof info->flags; ++i) {
for (i = 0; i < 8 * sizeof(info->flags); ++i) {
Uint32 flag = (1 << i);
if (info->flags & flag) {
if (count > 0) {
SDL_snprintfcat(text, sizeof text, " | ");
SDL_snprintfcat(text, sizeof(text), " | ");
}
SDLTest_PrintRendererFlag(text, sizeof text, flag);
SDLTest_PrintRendererFlag(text, sizeof(text), flag);
++count;
}
}
SDL_snprintfcat(text, sizeof text, ")");
SDL_snprintfcat(text, sizeof(text), ")");
SDL_Log("%s\n", text);
(void)SDL_snprintf(text, sizeof text, " Texture formats (%" SDL_PRIu32 "): ", info->num_texture_formats);
(void)SDL_snprintf(text, sizeof(text), " Texture formats (%" SDL_PRIu32 "): ", info->num_texture_formats);
for (i = 0; i < (int)info->num_texture_formats; ++i) {
if (i > 0) {
SDL_snprintfcat(text, sizeof text, ", ");
SDL_snprintfcat(text, sizeof(text), ", ");
}
SDLTest_PrintPixelFormat(text, sizeof text, info->texture_formats[i]);
SDLTest_PrintPixelFormat(text, sizeof(text), info->texture_formats[i]);
}
SDL_Log("%s\n", text);
@ -1123,12 +1123,12 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
if (n == 0) {
SDL_Log("No built-in video drivers\n");
} else {
(void)SDL_snprintf(text, sizeof text, "Built-in video drivers:");
(void)SDL_snprintf(text, sizeof(text), "Built-in video drivers:");
for (i = 0; i < n; ++i) {
if (i > 0) {
SDL_snprintfcat(text, sizeof text, ",");
SDL_snprintfcat(text, sizeof(text), ",");
}
SDL_snprintfcat(text, sizeof text, " %s", SDL_GetVideoDriver(i));
SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i));
}
SDL_Log("%s\n", text);
}
@ -1407,12 +1407,12 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
if (n == 0) {
SDL_Log("No built-in audio drivers\n");
} else {
(void)SDL_snprintf(text, sizeof text, "Built-in audio drivers:");
(void)SDL_snprintf(text, sizeof(text), "Built-in audio drivers:");
for (i = 0; i < n; ++i) {
if (i > 0) {
SDL_snprintfcat(text, sizeof text, ",");
SDL_snprintfcat(text, sizeof(text), ",");
}
SDL_snprintfcat(text, sizeof text, " %s", SDL_GetAudioDriver(i));
SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetAudioDriver(i));
}
SDL_Log("%s\n", text);
}
@ -2243,7 +2243,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
char message[256];
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
(void)SDL_snprintf(message, sizeof message, "(%g, %g), rel (%g, %g)\n",
(void)SDL_snprintf(message, sizeof(message), "(%g, %g), rel (%g, %g)\n",
lastEvent.x, lastEvent.y, lastEvent.xrel, lastEvent.yrel);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Last mouse position", message, window);
break;
@ -2330,7 +2330,7 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
SDL_SetRenderDrawColor(renderer, 170, 170, 170, 255);
(void)SDL_snprintf(text, sizeof text, "SDL_GetCurrentVideoDriver: %s", SDL_GetCurrentVideoDriver());
(void)SDL_snprintf(text, sizeof(text), "SDL_GetCurrentVideoDriver: %s", SDL_GetCurrentVideoDriver());
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
@ -2343,40 +2343,40 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
SDL_SetRenderDrawColor(renderer, 170, 170, 170, 255);
if (0 == SDL_GetRendererInfo(renderer, &info)) {
(void)SDL_snprintf(text, sizeof text, "SDL_GetRendererInfo: name: %s", info.name);
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRendererInfo: name: %s", info.name);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
}
if (0 == SDL_GetRenderOutputSize(renderer, &w, &h)) {
(void)SDL_snprintf(text, sizeof text, "SDL_GetRenderOutputSize: %dx%d", w, h);
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderOutputSize: %dx%d", w, h);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
}
if (0 == SDL_GetCurrentRenderOutputSize(renderer, &w, &h)) {
(void)SDL_snprintf(text, sizeof text, "SDL_GetCurrentRenderOutputSize: %dx%d", w, h);
(void)SDL_snprintf(text, sizeof(text), "SDL_GetCurrentRenderOutputSize: %dx%d", w, h);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
}
SDL_GetRenderViewport(renderer, &rect);
(void)SDL_snprintf(text, sizeof text, "SDL_GetRenderViewport: %d,%d, %dx%d",
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderViewport: %d,%d, %dx%d",
rect.x, rect.y, rect.w, rect.h);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
SDL_GetRenderScale(renderer, &scaleX, &scaleY);
(void)SDL_snprintf(text, sizeof text, "SDL_GetRenderScale: %g,%g",
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderScale: %g,%g",
scaleX, scaleY);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
SDL_GetRenderLogicalPresentation(renderer, &w, &h, &logical_presentation, &logical_scale_mode);
(void)SDL_snprintf(text, sizeof text, "SDL_GetRenderLogicalPresentation: %dx%d ", w, h);
SDLTest_PrintLogicalPresentation(text, sizeof text, logical_presentation);
SDL_snprintfcat(text, sizeof text, ", ");
SDLTest_PrintScaleMode(text, sizeof text, logical_scale_mode);
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderLogicalPresentation: %dx%d ", w, h);
SDLTest_PrintLogicalPresentation(text, sizeof(text), logical_presentation);
SDL_snprintfcat(text, sizeof(text), ", ");
SDLTest_PrintScaleMode(text, sizeof(text), logical_scale_mode);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
@ -2389,23 +2389,23 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
SDL_SetRenderDrawColor(renderer, 170, 170, 170, 255);
SDL_GetWindowPosition(window, &x, &y);
(void)SDL_snprintf(text, sizeof text, "SDL_GetWindowPosition: %d,%d", x, y);
(void)SDL_snprintf(text, sizeof(text), "SDL_GetWindowPosition: %d,%d", x, y);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
SDL_GetWindowSize(window, &w, &h);
(void)SDL_snprintf(text, sizeof text, "SDL_GetWindowSize: %dx%d", w, h);
(void)SDL_snprintf(text, sizeof(text), "SDL_GetWindowSize: %dx%d", w, h);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
(void)SDL_snprintf(text, sizeof text, "SDL_GetWindowFlags: ");
SDLTest_PrintWindowFlags(text, sizeof text, SDL_GetWindowFlags(window));
(void)SDL_snprintf(text, sizeof(text), "SDL_GetWindowFlags: ");
SDLTest_PrintWindowFlags(text, sizeof(text), SDL_GetWindowFlags(window));
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
mode = SDL_GetWindowFullscreenMode(window);
if (mode) {
(void)SDL_snprintf(text, sizeof text, "SDL_GetWindowFullscreenMode: %dx%d@%gHz %d%% scale, (%s)",
(void)SDL_snprintf(text, sizeof(text), "SDL_GetWindowFullscreenMode: %dx%d@%gHz %d%% scale, (%s)",
mode->pixel_w, mode->pixel_h, mode->refresh_rate, (int)(mode->display_scale * 100.0f), SDL_GetPixelFormatName(mode->format));
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
@ -2419,16 +2419,16 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
SDL_SetRenderDrawColor(renderer, 170, 170, 170, 255);
(void)SDL_snprintf(text, sizeof text, "SDL_GetDisplayForWindow: %" SDL_PRIu32 "", windowDisplayID);
(void)SDL_snprintf(text, sizeof(text), "SDL_GetDisplayForWindow: %" SDL_PRIu32 "", windowDisplayID);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
(void)SDL_snprintf(text, sizeof text, "SDL_GetDisplayName: %s", SDL_GetDisplayName(windowDisplayID));
(void)SDL_snprintf(text, sizeof(text), "SDL_GetDisplayName: %s", SDL_GetDisplayName(windowDisplayID));
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
if (0 == SDL_GetDisplayBounds(windowDisplayID, &rect)) {
(void)SDL_snprintf(text, sizeof text, "SDL_GetDisplayBounds: %d,%d, %dx%d",
(void)SDL_snprintf(text, sizeof(text), "SDL_GetDisplayBounds: %d,%d, %dx%d",
rect.x, rect.y, rect.w, rect.h);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
@ -2436,7 +2436,7 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
mode = SDL_GetCurrentDisplayMode(windowDisplayID);
if (mode) {
(void)SDL_snprintf(text, sizeof text, "SDL_GetCurrentDisplayMode: %dx%d@%gHz %d%% scale, (%s)",
(void)SDL_snprintf(text, sizeof(text), "SDL_GetCurrentDisplayMode: %dx%d@%gHz %d%% scale, (%s)",
mode->pixel_w, mode->pixel_h, mode->refresh_rate, (int)(mode->display_scale * 100.0f), SDL_GetPixelFormatName(mode->format));
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
@ -2444,14 +2444,14 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
mode = SDL_GetDesktopDisplayMode(windowDisplayID);
if (mode) {
(void)SDL_snprintf(text, sizeof text, "SDL_GetDesktopDisplayMode: %dx%d@%gHz %d%% scale, (%s)",
(void)SDL_snprintf(text, sizeof(text), "SDL_GetDesktopDisplayMode: %dx%d@%gHz %d%% scale, (%s)",
mode->pixel_w, mode->pixel_h, mode->refresh_rate, (int)(mode->display_scale * 100.0f), SDL_GetPixelFormatName(mode->format));
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
}
(void)SDL_snprintf(text, sizeof text, "SDL_GetDisplayOrientation: ");
SDLTest_PrintDisplayOrientation(text, sizeof text, SDL_GetDisplayOrientation(windowDisplayID));
(void)SDL_snprintf(text, sizeof(text), "SDL_GetDisplayOrientation: ");
SDLTest_PrintDisplayOrientation(text, sizeof(text), SDL_GetDisplayOrientation(windowDisplayID));
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
@ -2464,14 +2464,14 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
SDL_SetRenderDrawColor(renderer, 170, 170, 170, 255);
flags = SDL_GetMouseState(&fx, &fy);
(void)SDL_snprintf(text, sizeof text, "SDL_GetMouseState: %g,%g ", fx, fy);
SDLTest_PrintButtonMask(text, sizeof text, flags);
(void)SDL_snprintf(text, sizeof(text), "SDL_GetMouseState: %g,%g ", fx, fy);
SDLTest_PrintButtonMask(text, sizeof(text), flags);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;
flags = SDL_GetGlobalMouseState(&fx, &fy);
(void)SDL_snprintf(text, sizeof text, "SDL_GetGlobalMouseState: %g,%g ", fx, fy);
SDLTest_PrintButtonMask(text, sizeof text, flags);
(void)SDL_snprintf(text, sizeof(text), "SDL_GetGlobalMouseState: %g,%g ", fx, fy);
SDLTest_PrintButtonMask(text, sizeof(text), flags);
SDLTest_DrawString(renderer, 0.0f, textY, text);
textY += lineHeight;

View file

@ -3390,7 +3390,7 @@ void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, const char *fmt, ...
va_list ap;
va_start(ap, fmt);
(void)SDL_vsnprintf(text, sizeof text, fmt, ap);
(void)SDL_vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
SDLTest_TextWindowAddTextWithLength(textwin, text, SDL_strlen(text));

View file

@ -124,8 +124,8 @@ static Uint64 SDLTest_GenerateExecKey(const char *runSeed, const char *suiteName
}
/* Convert iteration number into a string */
SDL_memset(iterationString, 0, sizeof iterationString);
(void)SDL_snprintf(iterationString, sizeof iterationString - 1, "%d", iteration);
SDL_memset(iterationString, 0, sizeof(iterationString));
(void)SDL_snprintf(iterationString, sizeof(iterationString) - 1, "%d", iteration);
/* Combine the parameters into single string */
runSeedLength = SDL_strlen(runSeed);

View file

@ -68,7 +68,7 @@ SDLTest_TimestampToString(const time_t timestamp)
SDL_memset(buffer, 0, sizeof(buffer));
copy = timestamp;
local = localtime(&copy);
result = strftime(buffer, sizeof buffer, "%x %X", local);
result = strftime(buffer, sizeof(buffer), "%x %X", local);
if (result == 0) {
return "";
}

View file

@ -243,30 +243,30 @@ void SDLTest_LogAllocations(void)
message = tmp; \
SDL_strlcat(message, line, message_size)
SDL_strlcpy(line, "Memory allocations:\n", sizeof line);
SDL_strlcpy(line, "Memory allocations:\n", sizeof(line));
ADD_LINE();
SDL_strlcpy(line, "Expect 2 allocations from within SDL_GetErrBuf()\n", sizeof line);
SDL_strlcpy(line, "Expect 2 allocations from within SDL_GetErrBuf()\n", sizeof(line));
ADD_LINE();
count = 0;
total_allocated = 0;
for (index = 0; index < SDL_arraysize(s_tracked_allocations); ++index) {
for (entry = s_tracked_allocations[index]; entry; entry = entry->next) {
(void)SDL_snprintf(line, sizeof line, "Allocation %d: %d bytes\n", count, (int)entry->size);
(void)SDL_snprintf(line, sizeof(line), "Allocation %d: %d bytes\n", count, (int)entry->size);
ADD_LINE();
/* Start at stack index 1 to skip our tracking functions */
for (stack_index = 1; stack_index < SDL_arraysize(entry->stack); ++stack_index) {
if (!entry->stack[stack_index]) {
break;
}
(void)SDL_snprintf(line, sizeof line, "\t0x%" SDL_PRIx64 ": %s\n", entry->stack[stack_index], entry->stack_names[stack_index]);
(void)SDL_snprintf(line, sizeof(line), "\t0x%" SDL_PRIx64 ": %s\n", entry->stack[stack_index], entry->stack_names[stack_index]);
ADD_LINE();
}
total_allocated += entry->size;
++count;
}
}
(void)SDL_snprintf(line, sizeof line, "Total: %.2f Kb in %d allocations\n", total_allocated / 1024.0, count);
(void)SDL_snprintf(line, sizeof(line), "Total: %.2f Kb in %d allocations\n", total_allocated / 1024.0, count);
ADD_LINE();
#undef ADD_LINE

View file

@ -64,7 +64,7 @@ int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect
/* Send the data to the display */
if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) {
char file[128];
(void)SDL_snprintf(file, sizeof file, "SDL_window%" SDL_PRIu32 "-%8.8d.bmp",
(void)SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIu32 "-%8.8d.bmp",
SDL_GetWindowID(window), ++frame_number);
SDL_SaveBMP(surface, file);
}

View file

@ -218,7 +218,7 @@ static int KMSDRM_Available(void)
kmsdrm_dri_pathsize = SDL_strlen(kmsdrm_dri_path);
kmsdrm_dri_devnamesize = SDL_strlen(kmsdrm_dri_devname);
(void)SDL_snprintf(kmsdrm_dri_cardpath, sizeof kmsdrm_dri_cardpath, "%s%s",
(void)SDL_snprintf(kmsdrm_dri_cardpath, sizeof(kmsdrm_dri_cardpath), "%s%s",
kmsdrm_dri_path, kmsdrm_dri_devname);
ret = get_driindex();
@ -914,7 +914,7 @@ static int KMSDRM_InitDisplays(_THIS)
int i;
/* Open /dev/dri/cardNN (/dev/drmN if on OpenBSD version less than 6.9) */
(void)SDL_snprintf(viddata->devpath, sizeof viddata->devpath, "%s%d",
(void)SDL_snprintf(viddata->devpath, sizeof(viddata->devpath), "%s%d",
kmsdrm_dri_cardpath, viddata->devindex);
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Opening device %s", viddata->devpath);

View file

@ -48,6 +48,7 @@ int SDL_OFFSCREEN_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *for
*format = surface_format;
*pixels = surface->pixels;
*pitch = surface->pitch;
return 0;
}
@ -64,7 +65,7 @@ int SDL_OFFSCREEN_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_R
/* Send the data to the display */
if (SDL_getenv("SDL_VIDEO_OFFSCREEN_SAVE_FRAMES")) {
char file[128];
(void)SDL_snprintf(file, sizeof file, "SDL_window%" SDL_PRIu32 "-%8.8d.bmp",
(void)SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIu32 "-%8.8d.bmp",
SDL_GetWindowID(window), ++frame_number);
SDL_SaveBMP(surface, file);
}

View file

@ -78,6 +78,7 @@
#define XKB_MOD_NAME_MODE "Mod5"
#endif
struct SDL_WaylandTouchPoint
{
SDL_TouchID id;
@ -876,7 +877,7 @@ static void pointer_handle_frame(void *data, struct wl_pointer *pointer)
}
/* clear pointer_curr_axis_info for next frame */
SDL_memset(&input->pointer_curr_axis_info, 0, sizeof input->pointer_curr_axis_info);
SDL_memset(&input->pointer_curr_axis_info, 0, sizeof(input->pointer_curr_axis_info));
if (x != 0.0f || y != 0.0f) {
SDL_SendMouseWheel(input->pointer_curr_axis_info.timestamp_ns,
@ -1581,7 +1582,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *seat,
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) {
input->pointer = wl_seat_get_pointer(seat);
SDL_memset(&input->pointer_curr_axis_info, 0, sizeof input->pointer_curr_axis_info);
SDL_memset(&input->pointer_curr_axis_info, 0, sizeof(input->pointer_curr_axis_info));
input->display->pointer = input->pointer;
wl_pointer_set_user_data(input->pointer, input);
wl_pointer_add_listener(input->pointer, &pointer_listener,
@ -1701,7 +1702,7 @@ SDL_WaylandDataSource *Wayland_data_source_create(_THIS)
if (id == NULL) {
SDL_SetError("Wayland unable to create data source");
} else {
data_source = SDL_calloc(1, sizeof *data_source);
data_source = SDL_calloc(1, sizeof(*data_source));
if (data_source == NULL) {
SDL_OutOfMemory();
wl_data_source_destroy(id);
@ -1736,7 +1737,7 @@ SDL_WaylandPrimarySelectionSource *Wayland_primary_selection_source_create(_THIS
if (id == NULL) {
SDL_SetError("Wayland unable to create primary selection source");
} else {
primary_selection_source = SDL_calloc(1, sizeof *primary_selection_source);
primary_selection_source = SDL_calloc(1, sizeof(*primary_selection_source));
if (primary_selection_source == NULL) {
SDL_OutOfMemory();
zwp_primary_selection_source_v1_destroy(id);
@ -1790,7 +1791,7 @@ static void data_device_handle_data_offer(void *data, struct wl_data_device *wl_
{
SDL_WaylandDataOffer *data_offer = NULL;
data_offer = SDL_calloc(1, sizeof *data_offer);
data_offer = SDL_calloc(1, sizeof(*data_offer));
if (data_offer == NULL) {
SDL_OutOfMemory();
} else {
@ -2060,7 +2061,7 @@ static void primary_selection_device_handle_offer(void *data, struct zwp_primary
{
SDL_WaylandPrimarySelectionOffer *primary_selection_offer = NULL;
primary_selection_offer = SDL_calloc(1, sizeof *primary_selection_offer);
primary_selection_offer = SDL_calloc(1, sizeof(*primary_selection_offer));
if (primary_selection_offer == NULL) {
SDL_OutOfMemory();
} else {
@ -2201,7 +2202,7 @@ static void Wayland_create_data_device(SDL_VideoData *d)
{
SDL_WaylandDataDevice *data_device = NULL;
data_device = SDL_calloc(1, sizeof *data_device);
data_device = SDL_calloc(1, sizeof(*data_device));
if (data_device == NULL) {
return;
}
@ -2224,7 +2225,7 @@ static void Wayland_create_primary_selection_device(SDL_VideoData *d)
{
SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL;
primary_selection_device = SDL_calloc(1, sizeof *primary_selection_device);
primary_selection_device = SDL_calloc(1, sizeof(*primary_selection_device));
if (primary_selection_device == NULL) {
return;
}
@ -2248,7 +2249,7 @@ static void Wayland_create_text_input(SDL_VideoData *d)
{
SDL_WaylandTextInput *text_input = NULL;
text_input = SDL_calloc(1, sizeof *text_input);
text_input = SDL_calloc(1, sizeof(*text_input));
if (text_input == NULL) {
return;
}
@ -2516,7 +2517,7 @@ static struct SDL_WaylandTabletObjectListNode *tablet_object_list_new_node(void
{
struct SDL_WaylandTabletObjectListNode *node;
node = SDL_calloc(1, sizeof *node);
node = SDL_calloc(1, sizeof(*node));
if (node == NULL) {
return NULL;
}
@ -2591,7 +2592,7 @@ void Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_Wayland
return;
}
tablet_input = SDL_calloc(1, sizeof *tablet_input);
tablet_input = SDL_calloc(1, sizeof(*tablet_input));
if (tablet_input == NULL) {
return;
}
@ -2624,7 +2625,7 @@ void Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version)
{
struct SDL_WaylandInput *input;
input = SDL_calloc(1, sizeof *input);
input = SDL_calloc(1, sizeof(*input));
if (input == NULL) {
return;
}

View file

@ -1811,7 +1811,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
SDL_WindowData *data;
SDL_VideoData *c;
data = SDL_calloc(1, sizeof *data);
data = SDL_calloc(1, sizeof(*data));
if (data == NULL) {
return SDL_OutOfMemory();
}

View file

@ -446,7 +446,7 @@ void X11_ShowScreenKeyboard(_THIS, SDL_Window *window)
* https://partner.steamgames.com/doc/api/ISteamUtils#ShowFloatingGamepadTextInput
*/
char deeplink[128];
(void)SDL_snprintf(deeplink, sizeof deeplink,
(void)SDL_snprintf(deeplink, sizeof(deeplink),
"steam://open/keyboard?XPosition=0&YPosition=0&Width=0&Height=0&Mode=%d",
SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE) ? 0 : 1);
SDL_OpenURL(deeplink);

View file

@ -160,7 +160,7 @@ PrintText(const char *eventtype, const char *text)
expanded[0] = '\0';
for (spot = text; *spot; ++spot) {
size_t length = SDL_strlen(expanded);
(void)SDL_snprintf(expanded + length, sizeof expanded - length, "\\x%.2x", (unsigned char)*spot);
(void)SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", (unsigned char)*spot);
}
SDL_Log("%s Text (%s): \"%s%s\"\n", eventtype, expanded, *text == '"' ? "\\" : "", text);
}

View file

@ -157,7 +157,7 @@ PrintText(const char *eventtype, const char *text)
expanded[0] = '\0';
for (spot = text; *spot; ++spot) {
size_t length = SDL_strlen(expanded);
(void)SDL_snprintf(expanded + length, sizeof expanded - length, "\\x%.2x", (unsigned char)*spot);
(void)SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", (unsigned char)*spot);
}
SDL_Log("%s Text (%s): \"%s%s\"\n", eventtype, expanded, *text == '"' ? "\\" : "", text);
}

View file

@ -593,7 +593,7 @@ WatchJoystick(SDL_Joystick *joystick)
char crc_string[5];
SDL_strlcat(mapping, "crc:", SDL_arraysize(mapping));
(void)SDL_snprintf(crc_string, sizeof crc_string, "%.4x", crc);
(void)SDL_snprintf(crc_string, sizeof(crc_string), "%.4x", crc);
SDL_strlcat(mapping, crc_string, SDL_arraysize(mapping));
SDL_strlcat(mapping, ",", SDL_arraysize(mapping));
}
@ -666,17 +666,17 @@ WatchJoystick(SDL_Joystick *joystick)
pszElement[0] = '\0';
switch (pBinding->bindType) {
case SDL_GAMEPAD_BINDTYPE_BUTTON:
(void)SDL_snprintf(pszElement, sizeof pszElement, "b%d", pBinding->value.button);
(void)SDL_snprintf(pszElement, sizeof(pszElement), "b%d", pBinding->value.button);
break;
case SDL_GAMEPAD_BINDTYPE_AXIS:
if (pBinding->value.axis.axis_min == 0 && pBinding->value.axis.axis_max == SDL_JOYSTICK_AXIS_MIN) {
/* The negative half axis */
(void)SDL_snprintf(pszElement, sizeof pszElement, "-a%d", pBinding->value.axis.axis);
(void)SDL_snprintf(pszElement, sizeof(pszElement), "-a%d", pBinding->value.axis.axis);
} else if (pBinding->value.axis.axis_min == 0 && pBinding->value.axis.axis_max == SDL_JOYSTICK_AXIS_MAX) {
/* The positive half axis */
(void)SDL_snprintf(pszElement, sizeof pszElement, "+a%d", pBinding->value.axis.axis);
(void)SDL_snprintf(pszElement, sizeof(pszElement), "+a%d", pBinding->value.axis.axis);
} else {
(void)SDL_snprintf(pszElement, sizeof pszElement, "a%d", pBinding->value.axis.axis);
(void)SDL_snprintf(pszElement, sizeof(pszElement), "a%d", pBinding->value.axis.axis);
if (pBinding->value.axis.axis_min > pBinding->value.axis.axis_max) {
/* Invert the axis */
SDL_strlcat(pszElement, "~", SDL_arraysize(pszElement));
@ -684,7 +684,7 @@ WatchJoystick(SDL_Joystick *joystick)
}
break;
case SDL_GAMEPAD_BINDTYPE_HAT:
(void)SDL_snprintf(pszElement, sizeof pszElement, "h%d.%d", pBinding->value.hat.hat, pBinding->value.hat.hat_mask);
(void)SDL_snprintf(pszElement, sizeof(pszElement), "h%d.%d", pBinding->value.hat.hat, pBinding->value.hat.hat_mask);
break;
default:
SDL_assert(!"Unknown bind type");

View file

@ -614,7 +614,7 @@ static void RunFIFOTest(SDL_bool lock_free)
SDL_zeroa(readerData);
for (i = 0; i < NUM_READERS; ++i) {
char name[64];
(void)SDL_snprintf(name, sizeof name, "FIFOReader%d", i);
(void)SDL_snprintf(name, sizeof(name), "FIFOReader%d", i);
readerData[i].queue = &queue;
readerData[i].lock_free = lock_free;
readerData[i].thread = SDL_CreateThread(FIFO_Reader, name, &readerData[i]);
@ -625,7 +625,7 @@ static void RunFIFOTest(SDL_bool lock_free)
SDL_zeroa(writerData);
for (i = 0; i < NUM_WRITERS; ++i) {
char name[64];
(void)SDL_snprintf(name, sizeof name, "FIFOWriter%d", i);
(void)SDL_snprintf(name, sizeof(name), "FIFOWriter%d", i);
writerData[i].queue = &queue;
writerData[i].index = i;
writerData[i].lock_free = lock_free;
@ -674,17 +674,17 @@ static void RunFIFOTest(SDL_bool lock_free)
}
grand_total += total;
SDL_Log("Reader %d read %d events, had %d waits\n", i, total, readerData[i].waits);
(void)SDL_snprintf(textBuffer, sizeof textBuffer, " { ");
(void)SDL_snprintf(textBuffer, sizeof(textBuffer), " { ");
for (j = 0; j < NUM_WRITERS; ++j) {
if (j > 0) {
len = SDL_strlen(textBuffer);
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, ", ");
(void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, ", ");
}
len = SDL_strlen(textBuffer);
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, "%d", readerData[i].counters[j]);
(void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, "%d", readerData[i].counters[j]);
}
len = SDL_strlen(textBuffer);
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, " }\n");
(void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n");
SDL_Log("%s", textBuffer);
}
SDL_Log("Readers read %d total events\n", grand_total);

View file

@ -75,7 +75,7 @@ int main(int argc, char *argv[])
for (m = 0; m < num_modes; m++) {
char prefix[64];
(void)SDL_snprintf(prefix, sizeof prefix, " MODE %d", m);
(void)SDL_snprintf(prefix, sizeof(prefix), " MODE %d", m);
print_mode(prefix, modes[i]);
}
SDL_free(modes);

View file

@ -27,7 +27,7 @@ static SDL_AtomicInt doterminate;
/**
* SDL_Quit() shouldn't be used with atexit() directly because
* calling conventions may differ...
* calling conventions may differ...
*/
static void
SDL_Quit_Wrapper(void)
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
(void)atexit(printid);
for (i = 0; i < maxproc; ++i) {
char name[64];
(void)SDL_snprintf(name, sizeof name, "Worker%d", i);
(void)SDL_snprintf(name, sizeof(name), "Worker%d", i);
threads[i] = SDL_CreateThread(Run, name, NULL);
if (threads[i] == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread!\n");

View file

@ -61,7 +61,7 @@ static void save_surface_to_bmp(void)
SDL_RenderReadPixels(renderer, NULL, pixel_format, surface->pixels, surface->pitch);
(void)SDL_snprintf(file, sizeof file, "SDL_window%" SDL_PRIs32 "-%8.8d.bmp",
(void)SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIs32 "-%8.8d.bmp",
SDL_GetWindowID(window), ++frame_number);
SDL_SaveBMP(surface, file);
@ -113,8 +113,7 @@ int main(int argc, char *argv[])
window = SDL_CreateWindow("Offscreen Test", width, height, 0);
if (window == NULL) {
SDL_Log("Couldn't create window: %s\n",
SDL_GetError());
SDL_Log("Couldn't create window: %s\n", SDL_GetError());
return SDL_FALSE;
}

View file

@ -75,7 +75,7 @@ TestRealWorld(int init_sem)
/* Create all the threads */
for (i = 0; i < NUM_THREADS; ++i) {
char name[64];
(void)SDL_snprintf(name, sizeof name, "Thread%u", (unsigned int)i);
(void)SDL_snprintf(name, sizeof(name), "Thread%u", (unsigned int)i);
thread_states[i].number = i;
thread_states[i].thread = SDL_CreateThread(ThreadFuncRealWorld, name, (void *)&thread_states[i]);
}
@ -197,7 +197,7 @@ TestOverheadContended(SDL_bool try_wait)
/* Create multiple threads to starve the semaphore and cause contention */
for (i = 0; i < NUM_THREADS; ++i) {
char name[64];
(void)SDL_snprintf(name, sizeof name, "Thread%u", (unsigned int)i);
(void)SDL_snprintf(name, sizeof(name), "Thread%u", (unsigned int)i);
thread_states[i].flag = try_wait;
thread_states[i].thread = SDL_CreateThread(ThreadFuncOverheadContended, name, (void *)&thread_states[i]);
}
@ -230,17 +230,17 @@ TestOverheadContended(SDL_bool try_wait)
duration, try_wait ? "where contended" : "timed out", content_count,
loop_count, ((float)content_count * 100) / loop_count);
/* Print how many semaphores where consumed per thread */
(void)SDL_snprintf(textBuffer, sizeof textBuffer, "{ ");
(void)SDL_snprintf(textBuffer, sizeof(textBuffer), "{ ");
for (i = 0; i < NUM_THREADS; ++i) {
if (i > 0) {
len = SDL_strlen(textBuffer);
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, ", ");
(void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, ", ");
}
len = SDL_strlen(textBuffer);
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, "%d", thread_states[i].loop_count - thread_states[i].content_count);
(void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, "%d", thread_states[i].loop_count - thread_states[i].content_count);
}
len = SDL_strlen(textBuffer);
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, " }\n");
(void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n");
SDL_Log("%s\n", textBuffer);
SDL_DestroySemaphore(sem);

View file

@ -29,7 +29,7 @@ static const char *GetSensorTypeString(SDL_SensorType type)
case SDL_SENSOR_GYRO:
return "SDL_SENSOR_GYRO";
default:
(void)SDL_snprintf(unknown_type, sizeof unknown_type, "UNKNOWN (%d)", type);
(void)SDL_snprintf(unknown_type, sizeof(unknown_type), "UNKNOWN (%d)", type);
return unknown_type;
}
}

View file

@ -82,12 +82,12 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport)
y += lineHeight;
SDL_strlcpy(text, "Click on a mode to set it with SDL_SetWindowFullscreenMode", sizeof text);
SDL_strlcpy(text, "Click on a mode to set it with SDL_SetWindowFullscreenMode", sizeof(text));
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDLTest_DrawString(renderer, x, y, text);
y += lineHeight;
SDL_strlcpy(text, "Press Ctrl+Enter to toggle SDL_WINDOW_FULLSCREEN", sizeof text);
SDL_strlcpy(text, "Press Ctrl+Enter to toggle SDL_WINDOW_FULLSCREEN", sizeof(text));
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDLTest_DrawString(renderer, x, y, text);
y += lineHeight;
@ -109,7 +109,7 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport)
SDL_FRect cell_rect;
const SDL_DisplayMode *mode = modes[j];
(void)SDL_snprintf(text, sizeof text, "%s mode %d: %dx%d@%gHz",
(void)SDL_snprintf(text, sizeof(text), "%s mode %d: %dx%d@%gHz",
SDL_GetDisplayName(display_id),
j, mode->pixel_w, mode->pixel_h, mode->refresh_rate);

View file

@ -430,7 +430,7 @@ int main(int argc, char **argv)
if (current == 0) {
SDLTest_DrawString(renderer, 4, 4, titles[current]);
} else {
(void)SDL_snprintf(title, sizeof title, "%s %s %s", titles[current], yuv_name, yuv_mode);
(void)SDL_snprintf(title, sizeof(title), "%s %s %s", titles[current], yuv_name, yuv_mode);
SDLTest_DrawString(renderer, 4, 4, title);
}
SDL_RenderPresent(renderer);

View file

@ -51,7 +51,7 @@ ThreadFunc(void *data)
for (i = 0; i < NUMTHREADS; i++) {
char name[64];
(void)SDL_snprintf(name, sizeof name, "Child%d_%d", tid, i);
(void)SDL_snprintf(name, sizeof(name), "Child%d_%d", tid, i);
flags[i] = 0;
sub_threads[i] = SDL_CreateThread(SubThreadFunc, name, &flags[i]);
}
@ -89,7 +89,7 @@ int main(int argc, char *argv[])
(void)signal(SIGSEGV, SIG_DFL);
for (i = 0; i < NUMTHREADS; i++) {
char name[64];
(void)SDL_snprintf(name, sizeof name, "Parent%d", i);
(void)SDL_snprintf(name, sizeof(name), "Parent%d", i);
SDL_AtomicSet(&time_for_threads_to_die[i], 0);
threads[i] = SDL_CreateThread(ThreadFunc, name, (void *)(uintptr_t)i);