mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-27 12:02:05 +00:00
Silence some MSVC code analysis warnings
This commit is contained in:
parent
c11a798467
commit
4d112da58d
@ -136,8 +136,8 @@ static void dsound_thread(void *data)
|
||||
static DWORD CALLBACK dsound_thread(PVOID data)
|
||||
#endif
|
||||
{
|
||||
DWORD write_ptr;
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
DWORD write_ptr = 0;
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
|
||||
@ -315,15 +315,20 @@ static BOOL CALLBACK enumerate_cb(LPGUID guid,
|
||||
|
||||
if (guid)
|
||||
{
|
||||
unsigned i;
|
||||
LPGUID guid_copy = (LPGUID)malloc(sizeof(GUID) * 1);
|
||||
guid_copy->Data1 = guid->Data1;
|
||||
guid_copy->Data2 = guid->Data2;
|
||||
guid_copy->Data3 = guid->Data3;
|
||||
for (i = 0; i < 8; i++)
|
||||
guid_copy->Data4[i] = guid->Data4[i];
|
||||
|
||||
list->elems[list->size-1].userdata = guid_copy;
|
||||
if (guid_copy)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
guid_copy->Data1 = guid->Data1;
|
||||
guid_copy->Data2 = guid->Data2;
|
||||
guid_copy->Data3 = guid->Data3;
|
||||
for (i = 0; i < 8; i++)
|
||||
guid_copy->Data4[i] = guid->Data4[i];
|
||||
|
||||
list->elems[list->size - 1].userdata = guid_copy;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -96,6 +96,8 @@ static bool command_get_arg(const char *tok,
|
||||
if (str == tok)
|
||||
{
|
||||
const char *argument = str + strlen(action_map[i].str);
|
||||
if (!argument)
|
||||
return false;
|
||||
if (*argument != ' ' && *argument != '\0')
|
||||
return false;
|
||||
|
||||
|
@ -1828,12 +1828,16 @@ void win32_clip_window(bool state)
|
||||
{
|
||||
PWINDOWINFO info;
|
||||
info = (PWINDOWINFO)malloc(sizeof(*info));
|
||||
info->cbSize = sizeof(PWINDOWINFO);
|
||||
|
||||
if (GetWindowInfo(main_window.hwnd, info))
|
||||
clip_rect = info->rcClient;
|
||||
if (info)
|
||||
{
|
||||
info->cbSize = sizeof(PWINDOWINFO);
|
||||
|
||||
free(info);
|
||||
if (GetWindowInfo(main_window.hwnd, info))
|
||||
clip_rect = info->rcClient;
|
||||
|
||||
free(info);
|
||||
}
|
||||
info = NULL;
|
||||
}
|
||||
else
|
||||
|
@ -115,6 +115,9 @@ static void win32_display_server_destroy(void *data)
|
||||
{
|
||||
dispserv_win32_t *dispserv = (dispserv_win32_t*)data;
|
||||
|
||||
if (!dispserv)
|
||||
return;
|
||||
|
||||
if (dispserv->orig_width > 0 && dispserv->orig_height > 0)
|
||||
video_display_server_set_resolution(
|
||||
dispserv->orig_width,
|
||||
@ -131,8 +134,7 @@ static void win32_display_server_destroy(void *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dispserv)
|
||||
free(dispserv);
|
||||
free(dispserv);
|
||||
}
|
||||
|
||||
static bool win32_display_server_set_window_opacity(
|
||||
@ -170,8 +172,10 @@ static bool win32_display_server_set_window_progress(
|
||||
HWND hwnd = win32_get_window();
|
||||
dispserv_win32_t *serv = (dispserv_win32_t*)data;
|
||||
|
||||
if (serv)
|
||||
serv->progress = progress;
|
||||
if (!serv)
|
||||
return false;
|
||||
|
||||
serv->progress = progress;
|
||||
|
||||
#ifdef HAS_TASKBAR_EXT
|
||||
if (!serv->taskbar_list || !win32_taskbar_is_created())
|
||||
@ -208,8 +212,10 @@ static bool win32_display_server_set_window_decorations(void *data, bool on)
|
||||
{
|
||||
dispserv_win32_t *serv = (dispserv_win32_t*)data;
|
||||
|
||||
if (serv)
|
||||
serv->decorations = on;
|
||||
if (!serv)
|
||||
return false;
|
||||
|
||||
serv->decorations = on;
|
||||
|
||||
/* menu_setting performs a reinit instead to properly
|
||||
* apply decoration changes */
|
||||
@ -316,6 +322,8 @@ static int resolution_list_qsort_func(
|
||||
if (!a || !b)
|
||||
return 0;
|
||||
|
||||
str_a[0] = str_b[0] = '\0';
|
||||
|
||||
snprintf(str_a, sizeof(str_a), "%04dx%04d (%d Hz)",
|
||||
a->width,
|
||||
a->height,
|
||||
@ -333,7 +341,9 @@ static void *win32_display_server_get_resolution_list(
|
||||
void *data, unsigned *len)
|
||||
{
|
||||
DEVMODE dm = {0};
|
||||
unsigned i, j, count = 0;
|
||||
unsigned i = 0;
|
||||
unsigned j = 0;
|
||||
unsigned count = 0;
|
||||
unsigned curr_width = 0;
|
||||
unsigned curr_height = 0;
|
||||
unsigned curr_bpp = 0;
|
||||
|
@ -96,10 +96,14 @@ d3d10_overlay_vertex_geom(void* data, unsigned index, float x, float y, float w,
|
||||
|
||||
D3D10MapBuffer(d3d10->overlays.vbo,
|
||||
D3D10_MAP_WRITE_NO_OVERWRITE, 0, (void**)&sprites);
|
||||
sprites[index].pos.x = x;
|
||||
sprites[index].pos.y = y;
|
||||
sprites[index].pos.w = w;
|
||||
sprites[index].pos.h = h;
|
||||
|
||||
if (sprites)
|
||||
{
|
||||
sprites[index].pos.x = x;
|
||||
sprites[index].pos.y = y;
|
||||
sprites[index].pos.w = w;
|
||||
sprites[index].pos.h = h;
|
||||
}
|
||||
D3D10UnmapBuffer(d3d10->overlays.vbo);
|
||||
}
|
||||
|
||||
@ -132,20 +136,24 @@ static void d3d10_overlay_set_alpha(void* data, unsigned index, float mod)
|
||||
D3D10MapBuffer(
|
||||
d3d10->overlays.vbo,
|
||||
D3D10_MAP_WRITE_NO_OVERWRITE, 0, (void**)&sprites);
|
||||
sprites[index].colors[0] = DXGI_COLOR_RGBA(0xFF, 0xFF, 0xFF, mod * 0xFF);
|
||||
sprites[index].colors[1] = sprites[index].colors[0];
|
||||
sprites[index].colors[2] = sprites[index].colors[0];
|
||||
sprites[index].colors[3] = sprites[index].colors[0];
|
||||
|
||||
if (sprites)
|
||||
{
|
||||
sprites[index].colors[0] = DXGI_COLOR_RGBA(0xFF, 0xFF, 0xFF, mod * 0xFF);
|
||||
sprites[index].colors[1] = sprites[index].colors[0];
|
||||
sprites[index].colors[2] = sprites[index].colors[0];
|
||||
sprites[index].colors[3] = sprites[index].colors[0];
|
||||
}
|
||||
D3D10UnmapBuffer(d3d10->overlays.vbo);
|
||||
}
|
||||
|
||||
static bool d3d10_overlay_load(void* data, const void* image_data, unsigned num_images)
|
||||
{
|
||||
D3D10_BUFFER_DESC desc;
|
||||
unsigned i;
|
||||
d3d10_sprite_t* sprites;
|
||||
d3d10_video_t* d3d10 = (d3d10_video_t*)data;
|
||||
const struct texture_image* images = (const struct texture_image*)image_data;
|
||||
unsigned i = 0;
|
||||
d3d10_sprite_t* sprites = NULL;
|
||||
d3d10_video_t* d3d10 = (d3d10_video_t*)data;
|
||||
const struct texture_image* images = (const struct texture_image*)image_data;
|
||||
|
||||
if (!d3d10)
|
||||
return false;
|
||||
@ -268,11 +276,14 @@ static void d3d10_set_filtering(void* data, unsigned index, bool smooth, bool ct
|
||||
unsigned i;
|
||||
d3d10_video_t* d3d10 = (d3d10_video_t*)data;
|
||||
|
||||
for (i = 0; i < RARCH_WRAP_MAX; i++)
|
||||
if (smooth)
|
||||
{
|
||||
if (smooth)
|
||||
for (i = 0; i < RARCH_WRAP_MAX; i++)
|
||||
d3d10->samplers[RARCH_FILTER_UNSPEC][i] = d3d10->samplers[RARCH_FILTER_LINEAR][i];
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < RARCH_WRAP_MAX; i++)
|
||||
d3d10->samplers[RARCH_FILTER_UNSPEC][i] = d3d10->samplers[RARCH_FILTER_NEAREST][i];
|
||||
}
|
||||
}
|
||||
@ -332,6 +343,9 @@ static void d3d10_free_shader_preset(d3d10_video_t* d3d10)
|
||||
free(d3d10->shader_preset->pass[i].source.string.vertex);
|
||||
free(d3d10->shader_preset->pass[i].source.string.fragment);
|
||||
free(d3d10->pass[i].semantics.textures);
|
||||
d3d10->shader_preset->pass[i].source.string.vertex = NULL;
|
||||
d3d10->shader_preset->pass[i].source.string.fragment = NULL;
|
||||
d3d10->pass[i].semantics.textures = NULL;
|
||||
d3d10_release_shader(&d3d10->pass[i].shader);
|
||||
d3d10_release_texture(&d3d10->pass[i].rt);
|
||||
d3d10_release_texture(&d3d10->pass[i].feedback);
|
||||
@ -994,9 +1008,9 @@ static void *d3d10_gfx_init(const video_info_t* video,
|
||||
{
|
||||
D3D10_RASTERIZER_DESC desc = { (D3D10_FILL_MODE)0 };
|
||||
|
||||
desc.FillMode = D3D10_FILL_SOLID;
|
||||
desc.CullMode = D3D10_CULL_NONE;
|
||||
desc.ScissorEnable = TRUE;
|
||||
desc.FillMode = D3D10_FILL_SOLID;
|
||||
desc.CullMode = D3D10_CULL_NONE;
|
||||
desc.ScissorEnable = TRUE;
|
||||
|
||||
D3D10CreateRasterizerState(d3d10->device, &desc, &d3d10->state);
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ static void gfx_display_d3d10_draw(gfx_display_ctx_draw_t *draw,
|
||||
D3D10SetVertexBuffer(d3d10->device, 0, d3d10->sprites.vbo, sizeof(d3d10_sprite_t), 0);
|
||||
D3D10SetPrimitiveTopology(d3d10->device, D3D10_PRIMITIVE_TOPOLOGY_POINTLIST);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (draw->coords->vertex && draw->coords->tex_coord && draw->coords->color)
|
||||
@ -79,44 +81,44 @@ static void gfx_display_d3d10_draw(gfx_display_ctx_draw_t *draw,
|
||||
d3d10->sprites.offset = 0;
|
||||
|
||||
{
|
||||
void* mapped_vbo;
|
||||
d3d10_sprite_t* sprite = NULL;
|
||||
void* mapped_vbo = NULL;
|
||||
d3d10_sprite_t* sprite = NULL;
|
||||
|
||||
D3D10MapBuffer(d3d10->sprites.vbo, D3D10_MAP_WRITE_NO_OVERWRITE, 0, &mapped_vbo);
|
||||
|
||||
sprite = (d3d10_sprite_t*)mapped_vbo + d3d10->sprites.offset;
|
||||
sprite = (d3d10_sprite_t*)mapped_vbo + d3d10->sprites.offset;
|
||||
|
||||
if (vertex_count == 1)
|
||||
{
|
||||
sprite->pos.x = draw->x / (float)d3d10->viewport.Width;
|
||||
sprite->pos.y =
|
||||
sprite->pos.x = draw->x / (float)d3d10->viewport.Width;
|
||||
sprite->pos.y =
|
||||
(d3d10->viewport.Height - draw->y - draw->height)
|
||||
/ (float)d3d10->viewport.Height;
|
||||
sprite->pos.w = draw->width / (float)d3d10->viewport.Width;
|
||||
sprite->pos.h = draw->height / (float)d3d10->viewport.Height;
|
||||
sprite->pos.w = draw->width / (float)d3d10->viewport.Width;
|
||||
sprite->pos.h = draw->height / (float)d3d10->viewport.Height;
|
||||
|
||||
sprite->coords.u = 0.0f;
|
||||
sprite->coords.v = 0.0f;
|
||||
sprite->coords.w = 1.0f;
|
||||
sprite->coords.h = 1.0f;
|
||||
sprite->coords.u = 0.0f;
|
||||
sprite->coords.v = 0.0f;
|
||||
sprite->coords.w = 1.0f;
|
||||
sprite->coords.h = 1.0f;
|
||||
|
||||
if (draw->scale_factor)
|
||||
sprite->params.scaling = draw->scale_factor;
|
||||
else
|
||||
sprite->params.scaling = 1.0f;
|
||||
|
||||
sprite->params.rotation = draw->rotation;
|
||||
sprite->params.rotation = draw->rotation;
|
||||
|
||||
sprite->colors[3] = DXGI_COLOR_RGBA(
|
||||
sprite->colors[3] = DXGI_COLOR_RGBA(
|
||||
0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1],
|
||||
0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]);
|
||||
sprite->colors[2] = DXGI_COLOR_RGBA(
|
||||
sprite->colors[2] = DXGI_COLOR_RGBA(
|
||||
0xFF * draw->coords->color[4], 0xFF * draw->coords->color[5],
|
||||
0xFF * draw->coords->color[6], 0xFF * draw->coords->color[7]);
|
||||
sprite->colors[1] = DXGI_COLOR_RGBA(
|
||||
sprite->colors[1] = DXGI_COLOR_RGBA(
|
||||
0xFF * draw->coords->color[8], 0xFF * draw->coords->color[9],
|
||||
0xFF * draw->coords->color[10], 0xFF * draw->coords->color[11]);
|
||||
sprite->colors[0] = DXGI_COLOR_RGBA(
|
||||
sprite->colors[0] = DXGI_COLOR_RGBA(
|
||||
0xFF * draw->coords->color[12], 0xFF * draw->coords->color[13],
|
||||
0xFF * draw->coords->color[14], 0xFF * draw->coords->color[15]);
|
||||
}
|
||||
@ -212,7 +214,7 @@ static void gfx_display_d3d10_draw_pipeline(gfx_display_ctx_draw_t* draw,
|
||||
d3d10->ubo_values.time += 0.01f;
|
||||
|
||||
{
|
||||
void* mapped_ubo;
|
||||
void *mapped_ubo = NULL;
|
||||
D3D10MapBuffer(d3d10->ubo, D3D10_MAP_WRITE_DISCARD, 0, (void**)&mapped_ubo);
|
||||
*(d3d10_uniform_t*)mapped_ubo = d3d10->ubo_values;
|
||||
D3D10UnmapBuffer(d3d10->ubo);
|
||||
|
@ -1302,7 +1302,6 @@ font_data_t *font_driver_init_first(
|
||||
void *font_handle = NULL;
|
||||
bool ok = false;
|
||||
#ifdef HAVE_THREADS
|
||||
|
||||
if ( threading_hint
|
||||
&& is_threaded
|
||||
&& !video_driver_is_hw_context())
|
||||
@ -1316,11 +1315,15 @@ font_data_t *font_driver_init_first(
|
||||
|
||||
if (ok)
|
||||
{
|
||||
font_data_t *font = (font_data_t*)malloc(sizeof(*font));
|
||||
font->renderer = (const font_renderer_t*)font_driver;
|
||||
font->renderer_data = font_handle;
|
||||
font->size = font_size;
|
||||
return font;
|
||||
font_data_t *font = (font_data_t*)malloc(sizeof(*font));
|
||||
|
||||
if (font)
|
||||
{
|
||||
font->renderer = (const font_renderer_t*)font_driver;
|
||||
font->renderer_data = font_handle;
|
||||
font->size = font_size;
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -820,31 +820,31 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
|
||||
/* Linear filter ON or OFF */
|
||||
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
|
||||
{
|
||||
char key[128];
|
||||
key[0] = '\0';
|
||||
strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
strlcat(key, "_linear", sizeof(key));
|
||||
config_set_bool(conf, key,
|
||||
char k[128];
|
||||
k[0] = '\0';
|
||||
strlcpy(k, shader->lut[i].id, sizeof(k));
|
||||
strlcat(k, "_linear", sizeof(k));
|
||||
config_set_bool(conf, k,
|
||||
shader->lut[i].filter == RARCH_FILTER_LINEAR);
|
||||
}
|
||||
|
||||
/* Wrap Mode */
|
||||
{
|
||||
char key[128];
|
||||
key[0] = '\0';
|
||||
strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
strlcat(key, "_wrap_mode", sizeof(key));
|
||||
config_set_string(conf, key,
|
||||
char k[128];
|
||||
k[0] = '\0';
|
||||
strlcpy(k, shader->lut[i].id, sizeof(k));
|
||||
strlcat(k, "_wrap_mode", sizeof(k));
|
||||
config_set_string(conf, k,
|
||||
wrap_mode_to_str(shader->lut[i].wrap));
|
||||
}
|
||||
|
||||
/* Mipmap On or Off */
|
||||
{
|
||||
char key[128];
|
||||
key[0] = '\0';
|
||||
strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
strlcat(key, "_mipmap", sizeof(key));
|
||||
config_set_bool(conf, key, shader->lut[i].mipmap);
|
||||
char k[128];
|
||||
k[0] = '\0';
|
||||
strlcpy(k, shader->lut[i].id, sizeof(k));
|
||||
strlcat(k, "_mipmap", sizeof(k));
|
||||
config_set_bool(conf, k, shader->lut[i].mipmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user