Backport parts of 73c0760236

This commit is contained in:
twinaphex 2021-11-09 23:12:57 +01:00
parent 89002e6b72
commit 619398bbe4
11 changed files with 20 additions and 12 deletions

View File

@ -337,7 +337,7 @@ bool disk_control_set_index(
bool error = false; bool error = false;
unsigned num_images = 0; unsigned num_images = 0;
unsigned msg_duration = 0; unsigned msg_duration = 0;
char msg[PATH_MAX_LENGTH]; char msg[NAME_MAX_LENGTH];
msg[0] = '\0'; msg[0] = '\0';
@ -377,7 +377,8 @@ bool disk_control_set_index(
runloop_msg_queue_push( runloop_msg_queue_push(
msg, 1, msg_duration, msg, 1, msg_duration,
true, NULL, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO);
} }
/* If operation was successful, update disk /* If operation was successful, update disk

View File

@ -159,7 +159,7 @@ int system_property_get(const char *command,
FILE *pipe; FILE *pipe;
int length = 0; int length = 0;
char buffer[PATH_MAX_LENGTH] = {0}; char buffer[PATH_MAX_LENGTH] = {0};
char cmd[PATH_MAX_LENGTH] = {0}; char cmd[NAME_MAX_LENGTH] = {0};
char *curpos = NULL; char *curpos = NULL;
size_t buf_pos = strlcpy(cmd, command, sizeof(cmd)); size_t buf_pos = strlcpy(cmd, command, sizeof(cmd));

View File

@ -21,6 +21,7 @@
#include <stdint.h> #include <stdint.h>
#include <boolean.h> #include <boolean.h>
#include <retro_miscellaneous.h>
#include "../../config.def.h" #include "../../config.def.h"
@ -144,7 +145,7 @@ struct android_app
const ASensor* accelerometerSensor; const ASensor* accelerometerSensor;
const ASensor* gyroscopeSensor; const ASensor* gyroscopeSensor;
uint64_t sensor_state_mask; uint64_t sensor_state_mask;
char current_ime[PATH_MAX_LENGTH]; char current_ime[NAME_MAX_LENGTH];
bool input_alive; bool input_alive;
int16_t analog_state[DEFAULT_MAX_PADS][MAX_AXIS]; int16_t analog_state[DEFAULT_MAX_PADS][MAX_AXIS];
int8_t hat_state[DEFAULT_MAX_PADS][2]; int8_t hat_state[DEFAULT_MAX_PADS][2];

View File

@ -22,6 +22,7 @@
#include <boolean.h> #include <boolean.h>
#include <retro_common_api.h> #include <retro_common_api.h>
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>
#include <retro_miscellaneous.h>
#include "font_driver.h" #include "font_driver.h"
@ -229,7 +230,7 @@ typedef struct thread_video
unsigned width; unsigned width;
unsigned height; unsigned height;
unsigned pitch; unsigned pitch;
char msg[255]; char msg[NAME_MAX_LENGTH];
bool updated; bool updated;
bool within_thread; bool within_thread;
} frame; } frame;

View File

@ -124,7 +124,7 @@ struct udev_input_device
dev_t dev; dev_t dev;
udev_input_mouse_t mouse; udev_input_mouse_t mouse;
enum udev_input_dev_type type; enum udev_input_dev_type type;
char devnode[PATH_MAX_LENGTH]; char devnode[NAME_MAX_LENGTH];
char ident[255]; /* could be mouse or keyboards store here */ char ident[255]; /* could be mouse or keyboards store here */
}; };

View File

@ -52,7 +52,7 @@ struct iohidmanager_hid_adapter
uint32_t slot; uint32_t slot;
IOHIDDeviceRef handle; IOHIDDeviceRef handle;
uint32_t locationId; uint32_t locationId;
char name[PATH_MAX_LENGTH]; char name[NAME_MAX_LENGTH];
apple_input_rec_t *axes; apple_input_rec_t *axes;
apple_input_rec_t *hats; apple_input_rec_t *hats;
apple_input_rec_t *buttons; apple_input_rec_t *buttons;

View File

@ -86,7 +86,7 @@ struct udev_joypad
uint16_t configured_strength[2]; uint16_t configured_strength[2];
unsigned rumble_gain; unsigned rumble_gain;
char ident[255]; char ident[NAME_MAX_LENGTH];
bool has_set_ff[2]; bool has_set_ff[2];
/* Deal with analog triggers that report -32767 to 32767 */ /* Deal with analog triggers that report -32767 to 32767 */
bool neg_trigger[NUM_AXES]; bool neg_trigger[NUM_AXES];

View File

@ -31,6 +31,7 @@
#include <boolean.h> #include <boolean.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_assert.h> #include <retro_assert.h>
#include <retro_miscellaneous.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include <time/rtime.h> #include <time/rtime.h>
@ -961,7 +962,7 @@ size_t fill_pathname_join_delim_concat(char *out_path, const char *dir,
size_t fill_short_pathname_representation(char* out_rep, size_t fill_short_pathname_representation(char* out_rep,
const char *in_path, size_t size) const char *in_path, size_t size)
{ {
char path_short[PATH_MAX_LENGTH]; char path_short[NAME_MAX_LENGTH];
path_short[0] = '\0'; path_short[0] = '\0';

View File

@ -82,6 +82,10 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
#endif #endif
#endif #endif
#ifndef NAME_MAX_LENGTH
#define NAME_MAX_LENGTH 256
#endif
#ifndef MAX #ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif #endif

View File

@ -322,7 +322,7 @@ global_t *global_get_ptr(void)
int driver_find_index(const char *label, const char *drv) int driver_find_index(const char *label, const char *drv)
{ {
unsigned i; unsigned i;
char str[256]; char str[NAME_MAX_LENGTH];
str[0] = '\0'; str[0] = '\0';

View File

@ -445,7 +445,7 @@ static void input_autoconfigure_connect_handler(retro_task_t *task)
autoconfig_handle_t *autoconfig_handle = NULL; autoconfig_handle_t *autoconfig_handle = NULL;
bool match_found = false; bool match_found = false;
const char *device_display_name = NULL; const char *device_display_name = NULL;
char task_title[PATH_MAX_LENGTH]; char task_title[NAME_MAX_LENGTH];
task_title[0] = '\0'; task_title[0] = '\0';
@ -782,7 +782,7 @@ static void cb_input_autoconfigure_disconnect(
static void input_autoconfigure_disconnect_handler(retro_task_t *task) static void input_autoconfigure_disconnect_handler(retro_task_t *task)
{ {
autoconfig_handle_t *autoconfig_handle = NULL; autoconfig_handle_t *autoconfig_handle = NULL;
char task_title[PATH_MAX_LENGTH]; char task_title[NAME_MAX_LENGTH];
task_title[0] = '\0'; task_title[0] = '\0';