More static code analysis nits

This commit is contained in:
twinaphex 2015-09-28 18:22:27 +02:00
parent 4ca5d31f9b
commit 631da50dfa
8 changed files with 21 additions and 18 deletions

View File

@ -302,6 +302,7 @@ static void iir_filter_init(struct iir_data *iir,
a1pha = sn / (2.0 * 0.4845);
A = exp(log(10.0) * -9.477 / 40.0);
beta = sqrt(A + A);
(void)a1pha;
case HSH:
b0 = A * ((A + 1.0) + (A - 1.0) * cs + beta * sn);
b1 = -2.0 * A * ((A - 1.0) + (A + 1.0) * cs);

View File

@ -222,8 +222,7 @@ static int check_pcm_status(void *data, int channel_type)
static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size)
{
alsa_t *alsa = (alsa_t*)data;
snd_pcm_channel_status_t cstatus = {0};
alsa_t *alsa = (alsa_t*)data;
snd_pcm_sframes_t written = 0;
while (size)

View File

@ -58,7 +58,6 @@ static void *ra_init(const char *device, unsigned rate, unsigned latency)
static ssize_t ra_write(void *data, const void *buf, size_t size)
{
int err;
ssize_t rc;
size_t written = 0;
roar_t *roar = (roar_t*)data;
@ -67,6 +66,7 @@ static ssize_t ra_write(void *data, const void *buf, size_t size)
while (written < size)
{
ssize_t rc;
size_t write_amt = size - written;
if ((rc = roar_vs_write(roar->vss, (const char*)buf + written, write_amt, &err)) < (ssize_t)write_amt)
@ -123,7 +123,6 @@ static void ra_free(void *data)
static bool ra_use_float(void *data)
{
alsa_t *alsa = (alsa_t*)data;
return false;
}

View File

@ -268,12 +268,13 @@ bool cheat_manager_realloc(cheat_manager_t *handle, unsigned new_size)
void cheat_manager_free(cheat_manager_t *handle)
{
unsigned i;
if (!handle)
return;
if (handle->cheats)
{
unsigned i;
for (i = 0; i < handle->size; i++)
{
free(handle->cheats[i].desc);

View File

@ -132,28 +132,29 @@ rarch_cmd_t *rarch_cmd_new(bool stdin_enable,
if (!handle)
return NULL;
(void)network_enable;
(void)port;
(void)stdin_enable;
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
handle->net_fd = -1;
if (network_enable && !cmd_init_network(handle, port))
goto error;
#else
(void)network_enable;
(void)port;
#endif
#ifdef HAVE_STDIN_CMD
handle->stdin_enable = stdin_enable;
if (stdin_enable && !cmd_init_stdin(handle))
goto error;
#else
(void)stdin_enable;
#endif
return handle;
#if (defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)) || defined(HAVE_STDIN_CMD)
error:
rarch_cmd_free(handle);
return NULL;
#endif
}
void rarch_cmd_free(rarch_cmd_t *handle)

View File

@ -370,9 +370,7 @@ static int database_cursor_open(libretrodb_t *db,
error:
if (q)
libretrodb_query_free(q);
query = NULL;
libretrodb_close(db);
db = NULL;
return -1;
}

View File

@ -181,7 +181,6 @@ static INLINE unsigned align_common(unsigned i, unsigned j)
/* Find the index of a compatible DRM device. */
static int exynos_get_device_index(void)
{
int fd;
drmVersionPtr ver;
char buf[32] = {0};
int index = 0;
@ -189,6 +188,8 @@ static int exynos_get_device_index(void)
while (!found)
{
int fd;
snprintf(buf, sizeof(buf), "/dev/dri/card%d", index);
fd = open(buf, O_RDWR);
@ -370,10 +371,14 @@ static int exynos_realloc_buffer(struct exynos_data *pdata,
enum exynos_buffer_type type, unsigned size)
{
struct exynos_bo *buf = pdata->buf[type];
unsigned i;
if (!buf)
return -1;
if (size > buf->size)
{
unsigned i;
#if (EXYNOS_GFX_DEBUG_LOG == 1)
RARCH_LOG("[video_exynos]: reallocating %s buffer (%u -> %u bytes)\n",
exynos_buffer_name(type), buf->size, size);

View File

@ -1074,7 +1074,6 @@ static void gl_frame_fbo(gl_t *gl, uint64_t frame_count,
{
unsigned width, height;
const struct gfx_fbo_rect *prev_rect;
const struct gfx_fbo_rect *rect;
struct gfx_tex_info *fbo_info;
struct gfx_tex_info fbo_tex_info[GFX_MAX_SHADERS];
int i;
@ -1091,8 +1090,9 @@ static void gl_frame_fbo(gl_t *gl, uint64_t frame_count,
* and render all passes from FBOs, to another FBO. */
for (i = 1; i < gl->fbo_pass; i++)
{
const struct gfx_fbo_rect *rect = &gl->fbo_rect[i];
prev_rect = &gl->fbo_rect[i - 1];
rect = &gl->fbo_rect[i];
fbo_info = &fbo_tex_info[i - 1];
xamt = (GLfloat)prev_rect->img_width / prev_rect->width;
@ -2775,10 +2775,9 @@ static bool gl_set_shader(void *data,
if (!gl->shader->init(gl, path))
{
bool ret = false;
bool ret = gl->shader->init(gl, NULL);
RARCH_WARN("[GL]: Failed to set multipass shader. Falling back to stock.\n");
ret = gl->shader->init(gl, NULL);
if (!ret)
gl->shader = NULL;