diff options
author | Michael Pavone <pavone@retrodev.com> | 2018-06-29 09:33:23 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2018-06-29 09:33:23 -0700 |
commit | aad75c86365b71d625a730a0d42c6537a9016feb (patch) | |
tree | d365c39a527093019d356f03765788c40bf89953 | |
parent | 5f1a3e5c10bd84d5049b1a8a56c5aace468761cb (diff) |
Fix some issues identified by cppcheck
-rw-r--r-- | dis.c | 1 | ||||
-rw-r--r-- | jagcpu_x86.c | 4 | ||||
-rw-r--r-- | nuklear_ui/font_win.c | 1 | ||||
-rw-r--r-- | util.c | 5 | ||||
-rw-r--r-- | zdis.c | 1 | ||||
-rw-r--r-- | zip.c | 2 |
6 files changed, 9 insertions, 5 deletions
@@ -206,6 +206,7 @@ int main(int argc, char ** argv) } } } + fclose(address_log); } } else { char *end; diff --git a/jagcpu_x86.c b/jagcpu_x86.c index c7a599d..322e6b4 100644 --- a/jagcpu_x86.c +++ b/jagcpu_x86.c @@ -102,7 +102,7 @@ void jag_check_resultwrite_singleread(jag_cpu options *opts, uint8_t reg) code_ptr no_delay = code-.cur + 1; jcc(code, CC_NZ, no_delay + 1); ccylces(code, 1); - *no_delay = code->cur - (no_delay = 1); + *no_delay = code->cur - (no_delay + 1); *no_result = code->cur - (no_result + 1); mov_rr(code, opts->resultreg, opts->writeback, SZ_B); } @@ -122,7 +122,7 @@ void translate_jag_quickimmed(jag_cpu_options *opts, uint32_t address, uint16_t uint16_t *translate_jag_inst(uint16_t *stream, jag_cpu_options *opts, uint32_t address) { - uint16_t inst = *stream + uint16_t inst = *stream; ++stream; uint16_t opcode = jag_opcode(inst, opts->is_gpu); check_cycles_int(&opts->gen, address); diff --git a/nuklear_ui/font_win.c b/nuklear_ui/font_win.c index b2c5d75..b47e8ae 100644 --- a/nuklear_ui/font_win.c +++ b/nuklear_ui/font_win.c @@ -136,6 +136,7 @@ uint8_t *default_font(uint32_t *size_out) free(path); } } + free(pref_prefix); free(fonts); free_dir_list(entries, num_entries); if (selected) { @@ -255,8 +255,8 @@ int utf8_codepoint(const char **text) if (initial < 0x80) { return initial; } - int base; - uint8_t extended_bytes; + int base = 0; + uint8_t extended_bytes = 0; if ((initial & 0xE0) == 0xC0) { base = 0x80; initial &= 0x1F; @@ -873,6 +873,7 @@ char *read_bundled_file(char *name, uint32_t *sizeret) } else { ret = NULL; } + fclose(f); return ret; } @@ -112,6 +112,7 @@ int main(int argc, char ** argv) } } } + fclose(address_log); break; case 's': opt++; @@ -176,8 +176,8 @@ uint8_t *zip_read(zip_file *f, uint32_t index, size_t *out_size) } } break; -#endif } +#endif default: free(buf); return NULL; |