Code analysis cleanups/fixes
This commit is contained in:
parent
dd480aac94
commit
ab9535c827
|
@ -178,7 +178,8 @@ done:
|
|||
if (options)
|
||||
{
|
||||
const AVDictionaryEntry prev;
|
||||
while ((e = av_dict_get(options, "", &prev, AV_DICT_IGNORE_SUFFIX))) {
|
||||
while ((e = av_dict_get(options, "", &prev, AV_DICT_IGNORE_SUFFIX)))
|
||||
{
|
||||
/* av_dict_iterate isn't always available, so we use av_dict_get's legacy behavior instead */
|
||||
RARCH_WARN("[FFMPEG] Unrecognized option on video input device: %s=%s.\n", e->key, e->value);
|
||||
}
|
||||
|
@ -196,11 +197,12 @@ static void *ffmpeg_camera_init(const char *device, uint64_t caps, unsigned widt
|
|||
{
|
||||
ffmpeg_camera_t *ffmpeg = NULL;
|
||||
AVDeviceInfoList *device_list = NULL;
|
||||
int result = 0;
|
||||
int result = 0;
|
||||
int num_sources = 0;
|
||||
|
||||
/* If the core didn't ask for raw framebuffers... */
|
||||
if ((caps & (UINT64_C(1) << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER)) == 0)
|
||||
{ /* If the core didn't ask for raw framebuffers... */
|
||||
{
|
||||
RARCH_ERR("[FFMPEG] Camera driver only supports raw framebuffer output.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -309,11 +311,13 @@ static bool ffmpeg_camera_start(void *data)
|
|||
goto error;
|
||||
}
|
||||
|
||||
while ((e = av_dict_get(options, "", &prev, AV_DICT_IGNORE_SUFFIX))) {
|
||||
while ((e = av_dict_get(options, "", &prev, AV_DICT_IGNORE_SUFFIX)))
|
||||
{
|
||||
RARCH_WARN("[FFMPEG] Unrecognized option on video input device: %s=%s.\n", e->key, e->value);
|
||||
}
|
||||
|
||||
result = av_find_best_stream(ffmpeg->format_context, AVMEDIA_TYPE_VIDEO, -1, -1, &ffmpeg->decoder, 0);
|
||||
result = av_find_best_stream(ffmpeg->format_context,
|
||||
AVMEDIA_TYPE_VIDEO, -1, -1, &ffmpeg->decoder, 0);
|
||||
if (result < 0)
|
||||
{
|
||||
RARCH_ERR("[FFMPEG] Failed to find video stream: %s.\n", av_err2str(result));
|
||||
|
@ -357,7 +361,8 @@ static bool ffmpeg_camera_start(void *data)
|
|||
goto error;
|
||||
}
|
||||
|
||||
while ((e = av_dict_get(options, "", &prev, AV_DICT_IGNORE_SUFFIX))) {
|
||||
while ((e = av_dict_get(options, "", &prev, AV_DICT_IGNORE_SUFFIX)))
|
||||
{
|
||||
RARCH_WARN("[FFMPEG] Unrecognized option on video input device: %s=%s.\n", e->key, e->value);
|
||||
}
|
||||
|
||||
|
@ -573,9 +578,8 @@ static void ffmpeg_camera_poll_thread(void *data)
|
|||
ffmpeg->target_height,
|
||||
1
|
||||
);
|
||||
if (result >= 0) {
|
||||
if (result >= 0)
|
||||
ffmpeg->active_buffer = ffmpeg->active_buffer == ffmpeg->target_buffers[0] ? ffmpeg->target_buffers[1] : ffmpeg->target_buffers[0];
|
||||
}
|
||||
slock_unlock(ffmpeg->target_buffer_lock);
|
||||
if (result < 0)
|
||||
{
|
||||
|
|
|
@ -311,8 +311,8 @@ static void switch_res_crt(
|
|||
char current_content_dir[DIR_MAX_LENGTH];
|
||||
double rr = p_switch->ra_core_hz;
|
||||
const char *_core_name = (const char*)runloop_state_get_ptr()->system.info.library_name;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const char* hSize = (const char*)_hSize;
|
||||
const char* hShift = (const char*)_hShift;
|
||||
|
@ -320,7 +320,7 @@ static void switch_res_crt(
|
|||
|
||||
if (p_switch->rotated)
|
||||
flags |= SR_MODE_ROTATED;
|
||||
|
||||
|
||||
/* Check for core and content changes in case we need
|
||||
to make any adjustments */
|
||||
if (string_is_empty(_core_name))
|
||||
|
@ -360,7 +360,7 @@ static void switch_res_crt(
|
|||
|
||||
RARCH_LOG("[CRT] SR temporary mode for windows geometry adjustment (640x400).\n");
|
||||
}
|
||||
|
||||
|
||||
ret = sr_add_mode(tempw, temph, rr, flags, &srm);
|
||||
|
||||
if (!ret)
|
||||
|
@ -370,7 +370,7 @@ static void switch_res_crt(
|
|||
ret = sr_set_mode(srm.id);
|
||||
RARCH_LOG("[CRT] SR added temporary mode for windows geometry adjustment.\n");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -437,7 +437,7 @@ void crt_switch_res_core(
|
|||
unsigned video_aspect_ratio_idx,
|
||||
int crt_switch_vert_adjust)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (height <= 4)
|
||||
{
|
||||
|
@ -451,7 +451,7 @@ void crt_switch_res_core(
|
|||
{
|
||||
native_width = 320;
|
||||
height = 240;
|
||||
}
|
||||
}
|
||||
width = native_width;
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ void crt_switch_res_core(
|
|||
#if defined(HAVE_VIDEOCORE)
|
||||
crt_rpi_switch(p_switch, width, height, hz, 0, native_width);
|
||||
#else
|
||||
|
||||
|
||||
sprintf(_hSize, "%lf", 1+
|
||||
((float)crt_switch_porch_adjust/100.0));
|
||||
sprintf(_hShift, "%d",
|
||||
|
@ -517,26 +517,24 @@ void crt_switch_res_core(
|
|||
|
||||
static char* get_game_name(char* full_path)
|
||||
{
|
||||
int i;
|
||||
int n = strlen(full_path);
|
||||
char* rom_filename = full_path + n;
|
||||
char delimiter = (char) path_get(RARCH_PATH_BASENAME)[0];
|
||||
|
||||
for( int i = 0; i < n; i++)
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
if (full_path[i] == '/' || full_path[i] =='\\')
|
||||
{
|
||||
delimiter = full_path[i];
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (0 < n && (full_path[--n] != delimiter ));
|
||||
if (full_path[n] == delimiter ) {
|
||||
rom_filename = full_path + n + 1;
|
||||
|
||||
}
|
||||
if (full_path[n] == delimiter )
|
||||
rom_filename = full_path + n + 1;
|
||||
return rom_filename;
|
||||
|
||||
}
|
||||
|
||||
void crt_adjust_sr_ini(videocrt_switch_t *p_switch)
|
||||
|
@ -548,7 +546,7 @@ void crt_adjust_sr_ini(videocrt_switch_t *p_switch)
|
|||
|
||||
strlcpy(content_name, rom_filename, sizeof(current_content_name));
|
||||
|
||||
RARCH_LOG("[CRT] Game info \"%s\".\n", rom_filename);
|
||||
RARCH_LOG("[CRT] Game info \"%s\".\n", rom_filename);
|
||||
|
||||
if (p_switch->sr2_active)
|
||||
{
|
||||
|
|
|
@ -337,11 +337,16 @@ static uint8_t *rtga_tga_load(rtga_context *s,
|
|||
/* read in the data raw */
|
||||
/* manually unroll, probably GCC bug 92955 */
|
||||
j = 0;
|
||||
switch (tga_bits_per_pixel) {
|
||||
case 32: raw_data[j++] = rtga_get8(s); /* fallthrough */
|
||||
case 24: raw_data[j++] = rtga_get8(s); /* fallthrough */
|
||||
case 16: raw_data[j++] = rtga_get8(s); /* fallthrough */
|
||||
case 8: raw_data[j++] = rtga_get8(s);
|
||||
switch (tga_bits_per_pixel)
|
||||
{
|
||||
case 32:
|
||||
raw_data[j++] = rtga_get8(s); /* fallthrough */
|
||||
case 24:
|
||||
raw_data[j++] = rtga_get8(s); /* fallthrough */
|
||||
case 16:
|
||||
raw_data[j++] = rtga_get8(s); /* fallthrough */
|
||||
case 8:
|
||||
raw_data[j++] = rtga_get8(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
if (self)
|
||||
{
|
||||
_locationManager = [[CLLocationManager alloc] init];
|
||||
_locationManager.delegate = self;
|
||||
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
|
||||
|
@ -91,71 +92,75 @@ typedef struct corelocation {
|
|||
CoreLocationManager *manager;
|
||||
} corelocation_t;
|
||||
|
||||
static void *corelocation_init(void) {
|
||||
corelocation_t *corelocation = (corelocation_t*)calloc(1, sizeof(*corelocation));
|
||||
if (!corelocation)
|
||||
return NULL;
|
||||
static void *corelocation_init(void)
|
||||
{
|
||||
corelocation_t *corelocation = (corelocation_t*)calloc(1, sizeof(*corelocation));
|
||||
if (!corelocation)
|
||||
return NULL;
|
||||
|
||||
corelocation->manager = [CoreLocationManager sharedInstance];
|
||||
[corelocation->manager requestAuthorization];
|
||||
corelocation->manager = [CoreLocationManager sharedInstance];
|
||||
[corelocation->manager requestAuthorization];
|
||||
|
||||
return corelocation;
|
||||
return corelocation;
|
||||
}
|
||||
|
||||
static void corelocation_free(void *data) {
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (!corelocation)
|
||||
return;
|
||||
static void corelocation_free(void *data)
|
||||
{
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (!corelocation)
|
||||
return;
|
||||
|
||||
free(corelocation);
|
||||
free(corelocation);
|
||||
}
|
||||
|
||||
static bool corelocation_start(void *data) {
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (!corelocation || !corelocation->manager.authorized)
|
||||
return false;
|
||||
static bool corelocation_start(void *data)
|
||||
{
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (!corelocation || !corelocation->manager.authorized)
|
||||
return false;
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
[corelocation->manager.locationManager startUpdatingLocation];
|
||||
[corelocation->manager.locationManager startUpdatingLocation];
|
||||
#endif
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void corelocation_stop(void *data) {
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (!corelocation)
|
||||
return;
|
||||
|
||||
[corelocation->manager.locationManager stopUpdatingLocation];
|
||||
static void corelocation_stop(void *data)
|
||||
{
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (corelocation)
|
||||
[corelocation->manager.locationManager stopUpdatingLocation];
|
||||
}
|
||||
|
||||
static bool corelocation_get_position(void *data, double *lat, double *lon,
|
||||
double *horiz_accuracy, double *vert_accuracy) {
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (!corelocation || !corelocation->manager.authorized)
|
||||
return false;
|
||||
double *horiz_accuracy, double *vert_accuracy)
|
||||
{
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (!corelocation || !corelocation->manager.authorized)
|
||||
return false;
|
||||
|
||||
#if TARGET_OS_TV
|
||||
CLLocation *location = [corelocation->manager.locationManager location];
|
||||
*lat = location.coordinate.latitude;
|
||||
*lon = location.coordinate.longitude;
|
||||
CLLocation *location = [corelocation->manager.locationManager location];
|
||||
*lat = location.coordinate.latitude;
|
||||
*lon = location.coordinate.longitude;
|
||||
#else
|
||||
*lat = corelocation->manager.latitude;
|
||||
*lon = corelocation->manager.longitude;
|
||||
*lat = corelocation->manager.latitude;
|
||||
*lon = corelocation->manager.longitude;
|
||||
#endif
|
||||
*horiz_accuracy = 0.0; // CoreLocation doesn't provide this directly
|
||||
*vert_accuracy = 0.0; // CoreLocation doesn't provide this directly
|
||||
return true;
|
||||
*horiz_accuracy = 0.0; // CoreLocation doesn't provide this directly
|
||||
*vert_accuracy = 0.0; // CoreLocation doesn't provide this directly
|
||||
return true;
|
||||
}
|
||||
|
||||
static void corelocation_set_interval(void *data, unsigned interval_ms,
|
||||
unsigned interval_distance) {
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (!corelocation)
|
||||
return;
|
||||
unsigned interval_distance)
|
||||
{
|
||||
corelocation_t *corelocation = (corelocation_t*)data;
|
||||
if (!corelocation)
|
||||
return;
|
||||
|
||||
corelocation->manager.locationManager.distanceFilter = interval_distance;
|
||||
corelocation->manager.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
|
||||
corelocation->manager.locationManager.distanceFilter = interval_distance;
|
||||
corelocation->manager.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
|
||||
}
|
||||
|
||||
location_driver_t location_corelocation = {
|
||||
|
|
|
@ -1812,7 +1812,7 @@ static int action_bind_sublabel_netplay_room(file_list_t *list,
|
|||
{
|
||||
_len += strlcpy(s + _len, "(", len - _len);
|
||||
_len += strlcpy(s + _len, room->subsystem_name, len - _len);
|
||||
_len += strlcpy(s + _len, ")", len - _len);
|
||||
strlcpy(s + _len, ")", len - _len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ static unsigned input_autoconfigure_get_config_file_affinity(
|
|||
|
||||
_len = strlcpy(config_key, "input_product_id",
|
||||
sizeof(config_key));
|
||||
_len += strlcpy(config_key + _len, config_key_postfix,
|
||||
strlcpy(config_key + _len, config_key_postfix,
|
||||
sizeof(config_key) - _len);
|
||||
if (config_get_int(config, config_key, &tmp_int))
|
||||
config_pid = (uint16_t)tmp_int;
|
||||
|
|
Loading…
Reference in New Issue