SUSE Lint: fix a few classes of warnings #136

- drop unused variables

- unused-but-set-variable

- stray trailing comments

- in viewsupt.cpp replace redundant expression with variable that holds the same value
This commit is contained in:
Avindra Goolcharan 2017-08-08 23:05:38 -04:00 committed by Rafael Kitover
parent dd91abf72e
commit 0bdbcf3188
15 changed files with 6 additions and 96 deletions

View File

@ -276,7 +276,6 @@ blargg_err_t Zip7_Extractor::next_v()
CSzFileItem const& item = impl->db.db.Files [index];
if ( !item.IsDir )
{
unsigned long date = 0;
if ( item.MTimeDefined )
{
const UInt64 epoch = ((UInt64)0x019db1de << 32) + 0xd53e8000;
@ -294,12 +293,6 @@ blargg_err_t Zip7_Extractor::next_v()
localtime_r( &_time, &tm );
#endif
date = (( tm.tm_sec >> 1 ) & 0x1F) |
(( tm.tm_min & 0x3F ) << 5 ) |
(( tm.tm_hour & 0x1F ) << 11 ) |
(( tm.tm_mday & 0x1F ) << 16 ) |
(( ( tm.tm_mon + 1 ) & 0x0F ) << 21 ) |
(( ( tm.tm_year - 80 ) & 0x7F ) << 25 );
}
size_t name_length = SzArEx_GetFileNameUtf16( &impl->db, index, 0 );

View File

@ -421,7 +421,6 @@ int removeConditionalBreakNo(uint32_t addrNo, uint8_t number)
if (conditionals[addrNo >> 24]) {
struct ConditionalBreak* base = conditionals[addrNo >> 24];
struct ConditionalBreak* curr = conditionals[addrNo >> 24];
uint8_t count = 1;
while (curr->break_address < addrNo) {
base = curr;
curr = curr->next;
@ -462,7 +461,6 @@ int removeFlagFromConditionalBreakNo(uint32_t addrNo, uint8_t number, uint8_t fl
if (conditionals[addrNo >> 24]) {
struct ConditionalBreak* base = conditionals[addrNo >> 24];
struct ConditionalBreak* curr = conditionals[addrNo >> 24];
uint8_t count = 1;
while (curr->break_address < addrNo) {
base = curr;
curr = curr->next;
@ -618,7 +616,6 @@ void parseAndCreateConditionalBreaks(uint32_t address, uint8_t flags, char** exp
flags &= 0xf;
if (!flags)
return;
bool notBk = true;
struct ConditionalBreakNode* now = (struct ConditionalBreakNode*)malloc(sizeof(struct ConditionalBreakNode));
struct ConditionalBreakNode* toAdd = now;
for (int i = 0; i < n; i++) {

View File

@ -1491,7 +1491,7 @@ void SetMapMasks()
if (map[i].size > 0) {
map[i].trace = (uint8_t*)calloc(map[i].size >> 3, sizeof(uint8_t));
map[i].breakPoints = (uint8_t*)calloc(map[i].size >> 1, sizeof(uint8_t)); //\\
map[i].breakPoints = (uint8_t*)calloc(map[i].size >> 1, sizeof(uint8_t));
if (map[i].trace == NULL || map[i].breakPoints == NULL) {
systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"),
@ -1499,7 +1499,7 @@ void SetMapMasks()
}
} else {
map[i].trace = NULL;
map[i].breakPoints = NULL; //\\
map[i].breakPoints = NULL;
}
}

View File

@ -334,9 +334,6 @@ static uint16_t numtransfers = 0;
// time until next broadcast
static int rfu_last_broadcast_time;
// timer to sync data
static int rfu_last_host_send_time;
static uint32_t rfu_masterdata[255];
bool rfu_enabled = false;
bool rfu_initialized = false;
@ -1781,7 +1778,6 @@ static void StartRFUSocket(uint16_t value)
}
uint32_t CurCOM = 0, CurDAT = 0;
bool rfulogd = (READ16LE(&ioMem[COMM_SIOCNT]) != value);
switch (GetSIOMode(value, READ16LE(&ioMem[COMM_RCNT]))) {
case NORMAL8:
@ -1842,17 +1838,12 @@ static void StartRFUSocket(uint16_t value)
rfu_lastcmd = rfu_cmd;
rfu_cmd = ioMem[COMM_SIODATA32_L];
rfu_cmd2 = 0;
int maskid;
if (rfu_cmd == 0x27 || rfu_cmd == 0x37) {
rfu_lastcmd2 = rfu_cmd;
rfu_lasttime = linktime;
} else if (rfu_cmd == 0x24) { //non-important data shouldn't overwrite important data from 0x25
rfu_lastcmd2 = rfu_cmd;
rfu_cansend = false;
if (rfu_ishost)
maskid = ~rfu_data.rfu_is_host[linkid];
else
maskid = ~(1 << gbaid);
//previous important data need to be received successfully before sending another important data
rfu_lasttime = linktime; //just to mark the last time a data being sent
if (rfu_data.rfu_q[linkid] < 2) { //can overwrite now
@ -1864,10 +1855,6 @@ static void StartRFUSocket(uint16_t value)
} else if (rfu_cmd == 0x25 || rfu_cmd == 0x35) {
rfu_lastcmd2 = rfu_cmd;
rfu_cansend = false;
if (rfu_ishost)
maskid = ~rfu_data.rfu_is_host[linkid];
else
maskid = ~(1 << gbaid);
//previous important data need to be received successfully before sending another important data
rfu_lasttime = linktime;
if (rfu_data.rfu_q[linkid] < 2) {
@ -1878,7 +1865,6 @@ static void StartRFUSocket(uint16_t value)
rfu_waiting = true; //don't wait with speedhack
} else if (rfu_cmd == 0xa8 || rfu_cmd == 0xb6) {
//wait for [important] data when previously sent is important data, might only need to wait for the 1st 0x25 cmd
bool ok = false;
} else if (rfu_cmd == 0x11 || rfu_cmd == 0x1a || rfu_cmd == 0x26) {
if (rfu_lastcmd2 == 0x24)
rfu_waiting = true;
@ -2425,7 +2411,6 @@ bool LinkRFUUpdateSocket()
if (rfu_enabled) {
if (transfer_direction == RECEIVING && rfu_transfer_end <= 0) {
if (rfu_waiting) {
bool ok = false;
if (rfu_state != RFU_INIT) {
if (rfu_cmd == 0x24 || rfu_cmd == 0x25 || rfu_cmd == 0x35) {
if (rfu_data.rfu_q[linkid] < 2 || rfu_qsend > 1) {
@ -2562,7 +2547,6 @@ uint16_t gbLinkUpdate(uint8_t b, int gbSerialOn) //used on external clock
{
uint8_t dat = b; //0xff; //slave (w/ external clocks) won't be getting 0xff if master turned off
uint8_t recvd = 0;
int idx = 0;
gba_link_enabled = true; //(gbMemory[0xff02]!=0);
rfu_enabled = false;
@ -3060,17 +3044,12 @@ static void StartRFU(uint16_t value)
rfu_lastcmd = rfu_cmd;
rfu_cmd = ioMem[COMM_SIODATA32_L];
rfu_cmd2 = 0;
int maskid;
if (rfu_cmd == 0x27 || rfu_cmd == 0x37) {
rfu_lastcmd2 = rfu_cmd;
rfu_lasttime = GetTickCount();
} else if (rfu_cmd == 0x24) { //non-important data shouldn't overwrite important data from 0x25
rfu_lastcmd2 = rfu_cmd;
rfu_cansend = false;
if (rfu_ishost)
maskid = ~linkmem->rfu_is_host[vbaid];
else
maskid = ~(1 << gbaid);
//previous important data need to be received successfully before sending another important data
rfu_lasttime = GetTickCount(); //just to mark the last time a data being sent
if (!speedhack) {
@ -3111,10 +3090,6 @@ static void StartRFU(uint16_t value)
} else if (rfu_cmd == 0x25 || rfu_cmd == 0x35) {
rfu_lastcmd2 = rfu_cmd;
rfu_cansend = false;
if (rfu_ishost)
maskid = ~linkmem->rfu_is_host[vbaid];
else
maskid = ~(1 << gbaid);
//previous important data need to be received successfully before sending another important data
rfu_lasttime = GetTickCount();
if (!speedhack) {

View File

@ -1402,7 +1402,6 @@ void BIOS_SndDriverMain() // 0x1dc4 -> 0x08004024 phantasy star
int const user2 = CPUReadMemory(puser1 + 0x20);
if (user2) {
int const par1 = CPUReadMemory(puser1 + 0x24);
// Call 0x2102 sub_16A8 - -> param r1
}

View File

@ -1204,9 +1204,7 @@ void elfParseLineInfo(CompileUnit* unit, uint8_t* top)
uint32_t address = 0;
int file = 1;
int line = 1;
int col = 0;
int isStmt = defaultIsStmt;
int basicBlock = 0;
int endSeq = 0;
while (!endSeq) {
@ -1231,7 +1229,6 @@ void elfParseLineInfo(CompileUnit* unit, uint8_t* top)
case DW_LNS_copy:
// fprintf(stderr, "Address %08x line %d (%d)\n", address, line, file);
elfAddLine(l, address, file, line, &max);
basicBlock = 0;
break;
case DW_LNS_advance_pc:
address += minInstrSize * elfReadLEB128(data, &bytes);
@ -1246,14 +1243,13 @@ void elfParseLineInfo(CompileUnit* unit, uint8_t* top)
data += bytes;
break;
case DW_LNS_set_column:
col = elfReadLEB128(data, &bytes);
elfReadLEB128(data, &bytes);
data += bytes;
break;
case DW_LNS_negate_stmt:
isStmt = !isStmt;
break;
case DW_LNS_set_basic_block:
basicBlock = 1;
break;
case DW_LNS_const_add_pc:
address += (minInstrSize * ((255 - opcodeBase) / lineRange));
@ -1268,7 +1264,6 @@ void elfParseLineInfo(CompileUnit* unit, uint8_t* top)
line += lineBase + (op % lineRange);
elfAddLine(l, address, file, line, &max);
// fprintf(stderr, "Address %08x line %d (%d)\n", address, line,file);
basicBlock = 1;
break;
}
}
@ -1955,7 +1950,6 @@ uint8_t* elfParseBlock(uint8_t* data, ELFAbbrev* abbrev, CompileUnit* unit,
{
int bytes;
uint32_t start = func->lowPC;
uint32_t end = func->highPC;
for (int i = 0; i < abbrev->numAttrs; i++) {
ELFAttr* attr = &abbrev->attrs[i];
@ -1967,7 +1961,6 @@ uint8_t* elfParseBlock(uint8_t* data, ELFAbbrev* abbrev, CompileUnit* unit,
start = attr->value;
break;
case DW_AT_high_pc:
end = attr->value;
break;
case DW_AT_ranges: // ignore for now
break;
@ -2117,7 +2110,6 @@ uint8_t* elfParseFunction(uint8_t* data, ELFAbbrev* abbrev, CompileUnit* unit,
*f = func;
int bytes;
bool mangled = false;
bool declaration = false;
for (int i = 0; i < abbrev->numAttrs; i++) {
ELFAttr* attr = &abbrev->attrs[i];
@ -2131,7 +2123,6 @@ uint8_t* elfParseFunction(uint8_t* data, ELFAbbrev* abbrev, CompileUnit* unit,
break;
case DW_AT_MIPS_linkage_name:
func->name = attr->string;
mangled = true;
break;
case DW_AT_low_pc:
func->lowPC = attr->value;

View File

@ -125,11 +125,6 @@ int LoadDotCodeData(int size, uint32_t* DCdata, unsigned long MEM1, unsigned lon
0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1,
0xF1, 0xF2, 0xB1, 0xB1
};
unsigned char shortdotcodescan[18] = {
0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1,
0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1,
0xF1, 0xF1, 0xF1, 0xF2, 0xB1, 0xB1
};
temp1 = CPUReadMemory(MEM1 - 4);
for (i = 0; i < 0x60; i += 4)

View File

@ -3917,7 +3917,7 @@ void remoteWriteWatch(char* p, bool active)
// return;
//}
uint32_t final = address + count;
// uint32_t final = address + count;
//if(address < 0x2040000 && final > 0x2040000) {
// remotePutPacket("E01");

View File

@ -495,37 +495,6 @@ protected:
bmp += 3 * (1024 - sizeX);
}
uint32_t xx;
uint32_t yy;
switch (bg) {
case 2:
xx = BG2X_L | BG2X_H << 16;
yy = BG2Y_L | BG2Y_H << 16;
#if 0
renderView(xx, yy,
BG2PA, BG2PC,
BG2PB, BG2PD,
(sizeX - 1) << 8,
(sizeY - 1) << 8,
(control & 0x2000) != 0);
#endif
break;
case 3:
xx = BG3X_L | BG3X_H << 16;
yy = BG3Y_L | BG3Y_H << 16;
#if 0
renderView(xx, yy,
BG3PA, BG3PC,
BG3PB, BG3PD,
(sizeX - 1) << 8,
(sizeY - 1) << 8,
(control & 0x2000) != 0);
#endif
break;
}
}
void renderMode3()
@ -624,7 +593,6 @@ public:
int tile_map_address = mapbase;
// following copied almost verbatim from win32/GBMapView.cpp
int tile = 0;
for (int y = 0; y < 32; y++) {
for (int x = 0; x < 32; x++) {
@ -879,7 +847,6 @@ public:
wxImage spriteData(64, 64);
uint8_t* bmp = spriteData.GetData();
int sy = (a0 & 255);
if (a0 & 0x2000) {
int c = (a2 & 0x3FF);

View File

@ -3401,8 +3401,7 @@ bool MainFrame::BindControls()
NULL, &sound_config_handler);
sound_config_handler.AdjustFrames(10);
/// Game Boy
wxPanel* p;
p = SafeXRCCTRL<wxPanel>(d, "GBEnhanceSoundDep");
SafeXRCCTRL<wxPanel>(d, "GBEnhanceSoundDep");
getsl("GBEcho", gopts.gb_echo);
getsl("GBStereo", gopts.gb_stereo);
/// Game Boy Advance

View File

@ -478,7 +478,6 @@ void load_opts()
opt_desc& opt = opts[i];
if (opt.stropt) {
bool gotit = cfg->Read(opt.opt, opt.stropt, *opt.stropt);
opt.curstr = *opt.stropt;
} else if (opt.enumvals) {
opt.curint = *opt.intopt;

View File

@ -896,7 +896,6 @@ void systemGbPrint(uint8_t* data, int len, int pages, int feed, int pal, int con
static uint16_t* accum_prdata;
static int accum_prdata_len = 0, accum_prdata_size = 0;
static uint16_t prdata[162 * 145] = { 0 };
static int picno = 0;
int lines = len / 40;
uint16_t* out = prdata + 162; // 1-pix top border

View File

@ -138,7 +138,6 @@ void DisList::MoveSB()
else
pos = 250;
int sz = nlines > 20 ? 20 : nlines;
sb.SetScrollbar(pos, 20, 500, 20);
}
@ -250,7 +249,7 @@ void DisList::SetSel()
start += i;
end += i + 1;
#endif
tc.SetSelection(start, start + strings[i].size() + 1);
tc.SetSelection(start, end);
return;
}
@ -563,7 +562,6 @@ void MemView::MoveSB()
else
pos = 250;
int sz = nlines > 20 ? 20 : nlines;
sb.SetScrollbar(pos, 20, 500, 20);
}

View File

@ -129,7 +129,6 @@ void wxSDLJoy::Notify()
if (dev) {
int nax = joystate[i].nax, nhat = joystate[i].nhat,
nbut = joystate[i].nbut;
int ctrl = 0;
short val;
for (int j = 0; j < nax; j++) {

View File

@ -629,7 +629,6 @@ void MainFrame::OnActivate(wxActivateEvent& event)
void MainFrame::OnDropFile(wxDropFilesEvent& event)
{
int n = event.GetNumberOfFiles();
wxString* f = event.GetFiles();
// ignore all but last
wxGetApp().pending_load = f[event.GetNumberOfFiles() - 1];