Cleanup add brace (#6545)
* Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line
This commit is contained in:
parent
4958dafdc3
commit
6a2200823c
387 changed files with 6094 additions and 4633 deletions
|
@ -182,7 +182,9 @@ static int SDL_inotify_init1(void) {
|
|||
#else
|
||||
static int SDL_inotify_init1(void) {
|
||||
int fd = inotify_init();
|
||||
if (fd < 0) return -1;
|
||||
if (fd < 0) {
|
||||
return -1;
|
||||
}
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
return fd;
|
||||
|
@ -192,7 +194,7 @@ static int SDL_inotify_init1(void) {
|
|||
static int
|
||||
StrHasPrefix(const char *string, const char *prefix)
|
||||
{
|
||||
return (SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0);
|
||||
return SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -321,8 +323,7 @@ HIDAPI_InitializeDiscovery()
|
|||
SDL_HIDAPI_discovery.m_bCanGetNotifications = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
{
|
||||
#if defined(HAVE_INOTIFY)
|
||||
|
@ -418,15 +419,14 @@ HIDAPI_UpdateDiscovery()
|
|||
if (pUdevDevice) {
|
||||
const char *action = NULL;
|
||||
action = usyms->udev_device_get_action(pUdevDevice);
|
||||
if (!action || SDL_strcmp(action, "add") == 0 || SDL_strcmp(action, "remove") == 0) {
|
||||
if (action == NULL || SDL_strcmp(action, "add") == 0 || SDL_strcmp(action, "remove") == 0) {
|
||||
++SDL_HIDAPI_discovery.m_unDeviceChangeCounter;
|
||||
}
|
||||
usyms->udev_device_unref(pUdevDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
{
|
||||
#if defined(HAVE_INOTIFY)
|
||||
|
@ -478,8 +478,9 @@ HIDAPI_ShutdownDiscovery()
|
|||
}
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
if (SDL_HIDAPI_discovery.m_hNotify)
|
||||
if (SDL_HIDAPI_discovery.m_hNotify) {
|
||||
UnregisterDeviceNotification(SDL_HIDAPI_discovery.m_hNotify);
|
||||
}
|
||||
|
||||
if (SDL_HIDAPI_discovery.m_hwndMsg) {
|
||||
DestroyWindow(SDL_HIDAPI_discovery.m_hwndMsg);
|
||||
|
@ -506,8 +507,7 @@ HIDAPI_ShutdownDiscovery()
|
|||
SDL_UDEV_ReleaseUdevSyms();
|
||||
usyms = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
{
|
||||
#if defined(HAVE_INOTIFY)
|
||||
|
@ -805,14 +805,8 @@ SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
|
|||
uint8_t descriptor_index, uint16_t lang_id,
|
||||
unsigned char *data, int length)
|
||||
{
|
||||
return libusb_control_transfer(dev,
|
||||
LIBUSB_ENDPOINT_IN | 0x0, /* Endpoint 0 IN */
|
||||
LIBUSB_REQUEST_GET_DESCRIPTOR,
|
||||
(LIBUSB_DT_STRING << 8) | descriptor_index,
|
||||
lang_id,
|
||||
data,
|
||||
(uint16_t) length,
|
||||
1000);
|
||||
return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN | 0x0, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | descriptor_index, lang_id,
|
||||
data, (uint16_t)length, 1000); /* Endpoint 0 IN */
|
||||
}
|
||||
#define libusb_get_string_descriptor SDL_libusb_get_string_descriptor
|
||||
#endif /* __FreeBSD__ */
|
||||
|
@ -1237,7 +1231,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
|||
#endif
|
||||
for (usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next) {
|
||||
new_dev = (struct SDL_hid_device_info*) SDL_malloc(sizeof(struct SDL_hid_device_info));
|
||||
if (!new_dev) {
|
||||
if (new_dev == NULL) {
|
||||
LIBUSB_hid_free_enumeration(usb_devs);
|
||||
SDL_hid_free_enumeration(devs);
|
||||
SDL_OutOfMemory();
|
||||
|
@ -1310,7 +1304,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
|||
#endif
|
||||
if (!bFound) {
|
||||
new_dev = (struct SDL_hid_device_info*) SDL_malloc(sizeof(struct SDL_hid_device_info));
|
||||
if (!new_dev) {
|
||||
if (new_dev == NULL) {
|
||||
#ifdef HAVE_LIBUSB
|
||||
if (libusb_ctx.libhandle) {
|
||||
LIBUSB_hid_free_enumeration(usb_devs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue