Be more safe with these functions - this was causing crashes on

MSVC 2005
This commit is contained in:
twinaphex 2020-02-18 04:18:31 +01:00
parent bd63d28b0f
commit 6d09d29093
3 changed files with 29 additions and 15 deletions

View File

@ -4401,14 +4401,27 @@ static void gl2_get_video_output_next(void *data)
static void video_texture_load_gl2(
struct texture_image *ti,
enum texture_filter_type filter_type,
uintptr_t *id)
uintptr_t *idptr)
{
GLuint id;
unsigned width = 0;
unsigned height = 0;
const void *pixels = NULL;
/* Generate the OpenGL texture object */
glGenTextures(1, (GLuint*)id);
gl_load_texture_data((GLuint)*id,
glGenTextures(1, &id);
*idptr = id;
if (ti)
{
width = ti->width;
height = ti->height;
pixels = ti->pixels;
}
gl_load_texture_data(id,
RARCH_WRAP_EDGE, filter_type,
4 /* TODO/FIXME - dehardcode */,
ti->width, ti->height, ti->pixels,
width, height, pixels,
sizeof(uint32_t) /* TODO/FIXME - dehardcode */
);
}

View File

@ -2058,7 +2058,7 @@ static int video_texture_load_wrap_gl_core(void *data)
#endif
static uintptr_t gl_core_load_texture(void *video_data, void *data,
bool threaded, enum texture_filter_type filter_type)
bool threaded, enum texture_filter_type filter_type)
{
uintptr_t id = 0;

View File

@ -5601,33 +5601,34 @@ error:
static void xmb_context_reset_background(const char *iconpath)
{
char *path = NULL;
settings_t *settings = config_get_ptr();
const char *path_menu_wp = settings->paths.path_menu_wallpaper;
if (!string_is_empty(path_menu_wp))
path = strdup(path_menu_wp);
{
if (path_is_valid(path_menu_wp))
task_push_image_load(path_menu_wp,
video_driver_supports_rgba(), 0,
menu_display_handle_wallpaper_upload, NULL);
}
else if (!string_is_empty(iconpath))
{
path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
char path[PATH_MAX_LENGTH];
path[0] = '\0';
fill_pathname_join(path, iconpath, "bg.png",
PATH_MAX_LENGTH * sizeof(char));
if (path_is_valid(path))
task_push_image_load(path,
video_driver_supports_rgba(), 0,
menu_display_handle_wallpaper_upload, NULL);
}
if (path_is_valid(path))
task_push_image_load(path,
video_driver_supports_rgba(), 0,
menu_display_handle_wallpaper_upload, NULL);
#ifdef ORBIS
/* To avoid weird behaviour on orbis with remote host */
RARCH_LOG("[XMB] after task\n");
sleep(5);
#endif
if (path)
free(path);
}
static void xmb_context_reset_internal(xmb_handle_t *xmb,