From 7a55c2b8eb83f842cf078be53ff94a6df6432015 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 9 Jan 2016 03:06:18 +0100 Subject: [PATCH] Revert "Don't attempt to use std::string anymore in gfx/d3d/d3d.cpp" This reverts commit f76b7f2b609204b4a25e9e4369c0ff05657b8dc5. --- gfx/d3d/d3d.cpp | 20 ++++++++++---------- gfx/d3d/d3d.h | 5 ++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 8289200fc8..7de8f4deee 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -1084,7 +1084,7 @@ static bool d3d_init_multipass(d3d_video_t *d3d) unsigned i; bool use_extra_pass; video_shader_pass *pass = NULL; - config_file_t *conf = config_file_new(d3d->shader_path); + config_file_t *conf = config_file_new(d3d->shader_path.c_str()); if (!conf) { @@ -1103,7 +1103,7 @@ static bool d3d_init_multipass(d3d_video_t *d3d) config_file_free(conf); - video_shader_resolve_relative(&d3d->shader, d3d->shader_path); + video_shader_resolve_relative(&d3d->shader, d3d->shader_path.c_str()); RARCH_LOG("[D3D9 Meta-Cg] Found %u shaders.\n", d3d->shader.passes); @@ -1162,7 +1162,7 @@ static bool d3d_init_singlepass(d3d_video_t *d3d) pass->fbo.type_y = RARCH_SCALE_VIEWPORT; pass->fbo.scale_x = pass->fbo.scale_y; pass->fbo.type_x = pass->fbo.type_y; - strlcpy(pass->source.path, d3d->shader_path, + strlcpy(pass->source.path, d3d->shader_path.c_str(), sizeof(pass->source.path)); #endif @@ -1172,7 +1172,8 @@ static bool d3d_init_singlepass(d3d_video_t *d3d) static bool d3d_process_shader(d3d_video_t *d3d) { #ifdef HAVE_FBO - if (strcmp(path_get_extension(d3d->shader_path), "cgp") == 0) + if (strcmp(path_get_extension( + d3d->shader_path.c_str()), "cgp") == 0) return d3d_init_multipass(d3d); #endif @@ -1597,14 +1598,13 @@ static bool d3d_set_shader(void *data, { bool restore_old = false; d3d_video_t *d3d = (d3d_video_t*)data; - char old_shader[PATH_MAX_LENGTH]; - char shader[PATH_MAX_LENGTH]; + std::string shader = ""; switch (type) { case RARCH_SHADER_CG: if (path) - strlcpy(shader, path, sizeof(shader)); + shader = path; #ifdef HAVE_HLSL d3d->shader = &hlsl_backend; #endif @@ -1613,8 +1613,8 @@ static bool d3d_set_shader(void *data, break; } - strlcpy(old_shader, d3d->shader_path, sizeof(old_shader)); - strlcpy(d3d->shader_path, shader, sizeof(d3d->shader_path)); + std::string old_shader = d3d->shader_path; + d3d->shader_path = shader; if (!d3d_process_shader(d3d) || !d3d_restore(d3d)) { @@ -1624,7 +1624,7 @@ static bool d3d_set_shader(void *data, if (restore_old) { - strlcpy(d3d->shader_path, old_shader, sizeof(d3d->shader_path)); + d3d->shader_path = old_shader; d3d_process_shader(d3d); d3d_restore(d3d); } diff --git a/gfx/d3d/d3d.h b/gfx/d3d/d3d.h index 2ab4d41d02..8fcbe90640 100644 --- a/gfx/d3d/d3d.h +++ b/gfx/d3d/d3d.h @@ -17,10 +17,9 @@ #ifndef __D3DVIDEO_INTF_H__ #define __D3DVIDEO_INTF_H__ +#include #include -#include - #ifdef HAVE_CONFIG_H #include "../../config.h" #endif @@ -100,7 +99,7 @@ typedef struct d3d_video unsigned dev_rotation; D3DVIEWPORT final_viewport; - char shader_path[PATH_MAX_LENGTH]; + std::string shader_path; struct video_shader shader; video_info_t video_info;