mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-01 07:15:54 +00:00
Fix several build warnings
This commit is contained in:
parent
c007eabf50
commit
dc03235a62
@ -90,7 +90,7 @@ void cec_init() {
|
||||
g_iface.init_video_standalone(g_iface.connection);
|
||||
|
||||
cec_adapter devices[10];
|
||||
int8_t iDevicesFound = g_iface.find_adapters(g_iface.connection, devices, sizeof(devices) / sizeof(devices), NULL);
|
||||
int8_t iDevicesFound = g_iface.find_adapters(g_iface.connection, devices, sizeof(devices) / sizeof(devices[0]), NULL);
|
||||
|
||||
if (iDevicesFound <= 0) {
|
||||
fprintf(stderr, "No CEC devices found\n");
|
||||
|
@ -1009,9 +1009,9 @@ void evdev_map(char* device) {
|
||||
for (int i = 0; i < 16; i++)
|
||||
buf += sprintf(buf, "%02x", ((unsigned char*) guid)[i]);
|
||||
|
||||
struct mapping map;
|
||||
strncpy(map.name, name, sizeof(map.name));
|
||||
strncpy(map.guid, str_guid, sizeof(map.guid));
|
||||
struct mapping map = {0};
|
||||
strncpy(map.name, name, sizeof(map.name) - 1);
|
||||
strncpy(map.guid, str_guid, sizeof(map.guid) - 1);
|
||||
|
||||
libevdev_free(evdev);
|
||||
close(fd);
|
||||
|
@ -38,8 +38,8 @@ struct mapping* mapping_parse(char* mapping) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
strncpy(map->guid, guid, sizeof(map->guid));
|
||||
strncpy(map->name, name, sizeof(map->name));
|
||||
strncpy(map->guid, guid, sizeof(map->guid) - 1);
|
||||
strncpy(map->name, name, sizeof(map->name) - 1);
|
||||
|
||||
/* Initialize all mapping indices to -1 to ensure they won't match anything */
|
||||
memset(&map->abs_leftx, -1, offsetof(struct mapping, next) - offsetof(struct mapping, abs_leftx));
|
||||
@ -58,7 +58,7 @@ struct mapping* mapping_parse(char* mapping) {
|
||||
value++;
|
||||
}
|
||||
if (strcmp("platform", key) == 0)
|
||||
strncpy(map->platform, value, sizeof(map->platform));
|
||||
strncpy(map->platform, value, sizeof(map->platform) - 1);
|
||||
else if (sscanf(value, "b%d", &int_value) == 1) {
|
||||
if (strcmp("a", key) == 0)
|
||||
map->btn_a = int_value;
|
||||
|
@ -74,7 +74,7 @@ void loop_add_fd(int fd, FdHandler handler, int events) {
|
||||
|
||||
void loop_remove_fd(int fd) {
|
||||
numFds--;
|
||||
int fdindex;
|
||||
int fdindex = numFds;
|
||||
|
||||
for (int i=0;i<=numFds;i++) {
|
||||
if (fds[i].fd == fd) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user