mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
Rewrite path from nbio struct
This commit is contained in:
parent
35376a7961
commit
127d98fb68
@ -23,6 +23,7 @@
|
||||
#include <file/nbio.h>
|
||||
#include <audio/audio_mixer.h>
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../audio/audio_driver.h"
|
||||
@ -52,6 +53,8 @@ static void task_audio_mixer_load_free(retro_task_t *task)
|
||||
free(image->buffer);
|
||||
}
|
||||
|
||||
if (nbio->path && !string_is_empty(nbio->path))
|
||||
free(nbio->path);
|
||||
if (nbio->data)
|
||||
free(nbio->data);
|
||||
nbio_free(nbio->handle);
|
||||
@ -188,7 +191,7 @@ bool task_push_audio_mixer_load(const char *fullpath, retro_task_callback_t cb,
|
||||
if (!nbio)
|
||||
goto error;
|
||||
|
||||
strlcpy(nbio->path, fullpath, sizeof(nbio->path));
|
||||
nbio->path = strdup(fullpath);
|
||||
|
||||
image = (struct audio_mixer_handle*)calloc(1, sizeof(*image));
|
||||
if (!image)
|
||||
@ -239,6 +242,8 @@ bool task_push_audio_mixer_load(const char *fullpath, retro_task_callback_t cb,
|
||||
error:
|
||||
if (nbio)
|
||||
{
|
||||
if (nbio->path && !string_is_empty(nbio->path))
|
||||
free(nbio->path);
|
||||
if (nbio->data)
|
||||
free(nbio->data);
|
||||
nbio_free(nbio->handle);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <file/nbio.h>
|
||||
#include <formats/image.h>
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../gfx/video_driver.h"
|
||||
@ -157,9 +158,12 @@ static void task_image_cleanup(nbio_handle_t *nbio)
|
||||
image->handle = NULL;
|
||||
image->cb = NULL;
|
||||
}
|
||||
if (nbio->path && !string_is_empty(nbio->path))
|
||||
free(nbio->path);
|
||||
if (nbio->data)
|
||||
free(nbio->data);
|
||||
nbio_free(nbio->handle);
|
||||
nbio->path = NULL;
|
||||
nbio->data = NULL;
|
||||
nbio->handle = NULL;
|
||||
}
|
||||
@ -296,7 +300,7 @@ bool task_push_image_load(const char *fullpath, retro_task_callback_t cb, void *
|
||||
if (!nbio)
|
||||
goto error;
|
||||
|
||||
strlcpy(nbio->path, fullpath, sizeof(nbio->path));
|
||||
nbio->path = strdup(fullpath);
|
||||
|
||||
if (video_driver_supports_rgba())
|
||||
BIT32_SET(nbio->status_flags, NBIO_FLAG_IMAGE_SUPPORTS_RGBA);
|
||||
@ -352,7 +356,12 @@ error:
|
||||
task_image_load_free(t);
|
||||
free(t);
|
||||
if (nbio)
|
||||
{
|
||||
if (nbio->path
|
||||
&& !string_is_empty(nbio->path))
|
||||
free(nbio->path);
|
||||
free(nbio);
|
||||
}
|
||||
|
||||
error_msg:
|
||||
RARCH_ERR("[image load] Failed to open '%s': %s.\n",
|
||||
|
@ -81,22 +81,22 @@ enum nbio_type
|
||||
typedef struct nbio_handle
|
||||
{
|
||||
enum nbio_type type;
|
||||
void *data;
|
||||
bool is_finished;
|
||||
transfer_cb_t cb;
|
||||
struct nbio_t *handle;
|
||||
unsigned pos_increment;
|
||||
msg_queue_t *msg_queue;
|
||||
unsigned status;
|
||||
unsigned pos_increment;
|
||||
uint32_t status_flags;
|
||||
char path[4096];
|
||||
void *data;
|
||||
char *path;
|
||||
struct nbio_t *handle;
|
||||
msg_queue_t *msg_queue;
|
||||
transfer_cb_t cb;
|
||||
} nbio_handle_t;
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
typedef struct
|
||||
{
|
||||
char *data;
|
||||
size_t len;
|
||||
char *data;
|
||||
size_t len;
|
||||
} http_transfer_data_t;
|
||||
|
||||
void *task_push_http_transfer(const char *url, bool mute, const char *type,
|
||||
|
Loading…
Reference in New Issue
Block a user