Merge pull request #1310 from reicast/lk/lgtm

Core: Address some obvious lgtm issues
This commit is contained in:
Abandoned Cart 2018-08-21 10:08:32 -04:00 committed by GitHub
commit 3905d6e9fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 39 additions and 24 deletions

View File

@ -302,10 +302,9 @@ function reset() {
}
socket_lm.onmessage =function got_packet(msg) {
j = msg.data.split(';');
f = 0;
var j = msg.data.split(';'), f = 0;
while (f < j.length - 1) {
i = j[f].split(' ');
var i = j[f].split(' ');
if (i[0] == 'd') {
ctx.strokeStyle = i[1];
ctx.beginPath();

View File

@ -281,9 +281,6 @@ int core_fclose(core_file* fc)
if (f->f) {
fclose(f->f);
}
else {
}
delete f;

View File

@ -396,8 +396,7 @@ int lws_client_socket_service(struct libwebsocket_context *context,
* definitively ready from browser pov.
*/
len = 1;
while (wsi->u.hdr.parser_state != WSI_PARSING_COMPLETE &&
len > 0) {
while (wsi->u.hdr.parser_state != WSI_PARSING_COMPLETE) {
n = lws_ssl_capable_read(wsi, &c, 1);
lws_latency(context, wsi, "send lws_issue_raw", n, n == 1);
switch (n) {

View File

@ -1,4 +1,4 @@
#pragma once
#include "deps/zlib/zlib.h"
#define DEFLATE_FRAME_COMPRESSION_LEVEL_SERVER 1

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#pragma once
#include "build.h"
/* The Libwebsocket version */

View File

@ -1,5 +1,10 @@
#ifndef NAOMI_CART_H
#define NAOMI_CART_H
#include "types.h"
bool naomi_cart_Read(u32 offset, u32 size, void* dst);
void* naomi_cart_GetPtr(u32 offset, u32 size);
bool naomi_cart_SelectFile(void* handle);
bool naomi_cart_SelectFile(void* handle);
#endif //NAOMI_CART_H

View File

@ -1,3 +1,6 @@
#ifndef SH4_SCHED_H
#define SH4_SCHED_H
#include "types.h"
/*
@ -44,4 +47,6 @@ int sh4_sched_elapsed(int id);
*/
void sh4_sched_tick(int cycles);
extern u32 sh4_sched_intr;
extern u32 sh4_sched_intr;
#endif //SH4_SCHED_H

View File

@ -140,7 +140,7 @@ bool CHDDisc::TryOpen(const wchar* file)
if (total_frames!=549300 || tracks.size()<3)
{
printf("WARNING: chd: Total frames is wrong: %d frames in %d tracks\n",total_frames,tracks.size());
printf("WARNING: chd: Total frames is wrong: %u frames in %u tracks\n",total_frames,tracks.size());
#ifndef NOT_REICAST
msgboxf("This is an improper dump!",MBX_ICONEXCLAMATION);
#endif

View File

@ -243,7 +243,7 @@ bool DiscSwap(u32 fileflags)
printf("Loading default image \"%s\"\n",settings.imgread.DefaultImage);
if (!InitDrive_(settings.imgread.DefaultImage))
{
msgboxf("Default image \"%s\" failed to load",MBX_ICONERROR);
msgboxf("Default image \"%s\" failed to load",MBX_ICONERROR,settings.imgread.DefaultImage);
return false;
}
else

View File

@ -330,7 +330,7 @@ void common_linux_setup()
settings.profile.run_counts=0;
printf("Linux paging: %08X %08X %08X\n",sysconf(_SC_PAGESIZE),PAGE_SIZE,PAGE_MASK);
printf("Linux paging: %ld %08X %08X\n",sysconf(_SC_PAGESIZE),PAGE_SIZE,PAGE_MASK);
verify(PAGE_MASK==(sysconf(_SC_PAGESIZE)-1));
}
#endif

View File

@ -1,3 +1,8 @@
#ifndef DESCRAMBL_H
#define DESCRAMBL_H
#include "types.h"
void descrambl_file(u32 FAD, u32 file_size, u8* dst);
void descrambl_file(u32 FAD, u32 file_size, u8* dst);
#endif //DESCRAMBL_H

View File

@ -1,5 +1,7 @@
#include "types.h"
#ifndef REIOS_H
#define REIOS_H
#include "types.h"
bool reios_init(u8* rom, u8* flash);
@ -13,3 +15,5 @@ char* reios_disk_id();
extern char reios_software_name[129];
#define REIOS_OPCODE 0x085B
#endif //REIOS_H

View File

@ -1,3 +1,8 @@
#ifndef REIOS_ELF_H
#define REIOS_ELF_H
#include "types.h"
bool reios_loadElf(const string& elf);
bool reios_loadElf(const string& elf);
#endif //REIOS_ELF_H

View File

@ -746,8 +746,6 @@ GLuint gl_CompileShader(const char* shader,GLuint type)
if (!result && compile_log_len>0)
{
if (compile_log_len==0)
compile_log_len=1;
char* compile_log=(char*)malloc(compile_log_len);
*compile_log=0;
@ -791,8 +789,6 @@ GLuint gl_CompileAndLink(const char* VertexShader, const char* FragmentShader)
if (!result && compile_log_len>0)
{
if (compile_log_len==0)
compile_log_len=1;
compile_log_len+= 1024;
char* compile_log=(char*)malloc(compile_log_len);
*compile_log=0;
@ -1035,7 +1031,7 @@ void tryfit(float* x,float* y)
int rep=1;
//discard values clipped to 0 or 1
if (i<128 && y[i]==1 && y[i+1]==1)
if (y[i]==1 && y[i+1]==1)
continue;
if (i>0 && y[i]==0 && y[i-1]==0)
@ -1045,7 +1041,7 @@ void tryfit(float* x,float* y)
if (i>0 && y[i]!=1 && y[i-1]==1)
rep=10000;
if (i<128 && y[i]!=0 && y[i+1]==0)
if (y[i]!=0 && y[i+1]==0)
rep=10000;
for (int j=0;j<rep;j++)