diff --git a/include/library/assembler.hpp b/include/library/assembler.hpp index e01bc97c..0d976da4 100644 --- a/include/library/assembler.hpp +++ b/include/library/assembler.hpp @@ -63,6 +63,7 @@ public: case L_GLOBAL: return addr; case L_RELATIVE: return base->resolve(localbase) + offset; } + throw std::runtime_error("Unknown relocation type"); } private: enum _kind { L_LOCAL_U, L_LOCAL_R, L_GLOBAL, L_RELATIVE } kind; diff --git a/include/library/lua-class.hpp b/include/library/lua-class.hpp index fdd3d9a4..8bbdf448 100644 --- a/include/library/lua-class.hpp +++ b/include/library/lua-class.hpp @@ -232,6 +232,7 @@ template class _class : public class_base lua_pushlstring(LS, err.c_str(), err.length()); lua_error(LS); } + return 0; //NOTREACHED } T* _get(state& _state, int arg, const std::string& fname, bool optional = false) diff --git a/include/library/serialization.hpp b/include/library/serialization.hpp index 4189cbd6..0c3b5ff3 100644 --- a/include/library/serialization.hpp +++ b/include/library/serialization.hpp @@ -194,7 +194,6 @@ template T read_endian(const void* value, int endian) template void write_endian(void* value, const T& val, int endian) { - T val2; memcpy(value, &val, sizeof(T)); swap_endian(*reinterpret_cast(value), endian); } diff --git a/include/library/streamcompress.hpp b/include/library/streamcompress.hpp index ad620db3..90c7525a 100644 --- a/include/library/streamcompress.hpp +++ b/include/library/streamcompress.hpp @@ -90,7 +90,6 @@ public: size_t insize = inbuf_use; uint8_t* out = outbuffer + outbuf_use; size_t outsize = sizeof(outbuffer) - outbuf_use; - size_t tmp = outbuf_use; oeof_flag = compressor->process(in, insize, out, outsize, ieof_flag); outbuf_use = sizeof(outbuffer) - outsize; size_t in_r = inbuf_use - insize; diff --git a/include/library/string.hpp b/include/library/string.hpp index 6d6ed663..de4d2abf 100644 --- a/include/library/string.hpp +++ b/include/library/string.hpp @@ -86,12 +86,14 @@ public: */ lambda_output_iterator& operator++() throw() { + return *this; } /** * Increment. */ lambda_output_iterator operator++(int) throw() { + return *this; } private: helper h; @@ -258,7 +260,6 @@ template inline T parse_value(const std::string& value) throw(std::b if(value[idx] == '-' || value[idx] == '+') idx++; bool sign = (value[0] == '-'); - T mult = sign ? -1 : 1; T bound = sign ? std::numeric_limits::min() : std::numeric_limits::max(); T val = 0; if(value.length() > idx + 2 && value[idx] == '0' && value[idx + 1] == 'x') { diff --git a/src/core/Makefile b/src/core/Makefile index 5644a1c3..262286cc 100644 --- a/src/core/Makefile +++ b/src/core/Makefile @@ -7,7 +7,7 @@ __all__.files: $(OBJECTS) touch __all__.ldflags %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep - $(REALCC) $(CFLAGS) -c -o $@ $< -I../../include + $(REALCC) $(CFLAGS) -c -o $@ $< -I../../include -Wall -Werror precheck: ../../buildaux/mkdeps.exe ../../include -- *.cpp diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 3c4b40db..270789fc 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -389,7 +389,8 @@ namespace return; int rmin = x.bind.rmin; int rmax = x.bind.rmax; - bool centered = x.bind.centered; + //FIXME: Do something with this? + //bool centered = x.bind.centered; int64_t pvalue = value + 32768; _value = pvalue * (rmax - rmin) / 65535 + rmin; controls.analog(x.port, x.controller, x.bind.control1, _value); diff --git a/src/core/controllerframe.cpp b/src/core/controllerframe.cpp index a740d30e..e47ce0a5 100644 --- a/src/core/controllerframe.cpp +++ b/src/core/controllerframe.cpp @@ -98,7 +98,6 @@ bool controller_state::autofire_info::eval_at(uint64_t frame) uint64_t diff = first_frame - frame; frame += ((diff / cyclelen) + 1) * cyclelen; } - uint64_t diff2 = frame - first_frame; return frame % cyclelen < duty; } diff --git a/src/core/inthread.cpp b/src/core/inthread.cpp index e080a80b..71182043 100644 --- a/src/core/inthread.cpp +++ b/src/core/inthread.cpp @@ -529,7 +529,6 @@ out: void opus_stream::import_stream_sox(std::ifstream& data) { bitrate_tracker brtrack; - int err; unsigned char tmpi[65536]; float tmp[OPUS_MAX_OUT]; char header[260]; @@ -676,7 +675,6 @@ out: void opus_stream::export_stream_sox(std::ofstream& data) { - int err; opus::decoder dec(opus::samplerate::r48k, false); std::vector p; float tmp[OPUS_MAX_OUT]; @@ -697,7 +695,7 @@ out: uint32_t postgap_throw = 0; std::vector p = packet(i); uint32_t len = packet_length(i); - size_t r = dec.decode(&p[0], p.size(), tmp, OPUS_MAX_OUT); + dec.decode(&p[0], p.size(), tmp, OPUS_MAX_OUT); bool is_last = (i == packets.size() - 1); if(lookahead_thrown < pregap_length) { //We haven't yet thrown the full pregap. Throw some. @@ -816,7 +814,6 @@ out: opus_playback_stream::opus_playback_stream(opus_stream& data) : stream(data) { - int err; stream.get_ref(); stream.lock(); next_block = 0; @@ -1341,6 +1338,7 @@ out: s = new opus_playback_stream(*i); } catch(std::exception& e) { messages << "Can't start stream: " << e.what() << std::endl; + return; } i->put_ref(); if(!s) @@ -1579,7 +1577,6 @@ out: if(quit) return; - int err; opus::encoder oenc(opus::samplerate::r48k, false, opus::application::voice); oenc.ctl(opus::bitrate(opus_bitrate.get())); audioapi_resampler rin; diff --git a/src/core/mainloop.cpp b/src/core/mainloop.cpp index 7c3f80d3..380efbe3 100644 --- a/src/core/mainloop.cpp +++ b/src/core/mainloop.cpp @@ -94,9 +94,6 @@ namespace size_t save_jukebox_pointer; //Special subframe location. One of SPECIAL_* constants. int location_special; - //Last frame params. - bool last_hires = false; - bool last_interlace = false; //Unsafe rewind. bool do_unsafe_rewind = false; void* unsafe_rewind_obj = NULL; @@ -291,7 +288,7 @@ namespace void on_setting_change(settingvar::group& grp, const settingvar::base& val) { if(val.get_iname() == "jukebox-size") { - if(save_jukebox_pointer >= jukebox_size) + if(save_jukebox_pointer >= (size_t)jukebox_size) save_jukebox_pointer = 0; } update_movie_state(); @@ -618,7 +615,7 @@ namespace save_jukebox_pointer = jukebox_size - 1; else save_jukebox_pointer--; - if(save_jukebox_pointer >= jukebox_size) + if(save_jukebox_pointer >= (size_t)jukebox_size) save_jukebox_pointer = 0; update_movie_state(); }); @@ -628,11 +625,11 @@ namespace []() throw(std::bad_alloc, std::runtime_error) { if(jukebox_size == 0) return; - if(save_jukebox_pointer >= jukebox_size - 1) + if(save_jukebox_pointer + 1 >= (size_t)jukebox_size) save_jukebox_pointer = 0; else save_jukebox_pointer++; - if(save_jukebox_pointer >= jukebox_size) + if(save_jukebox_pointer >= (size_t)jukebox_size) save_jukebox_pointer = 0; update_movie_state(); }); @@ -643,7 +640,7 @@ namespace if(!regex_match("[1-9][0-9]{0,8}", args)) throw std::runtime_error("Bad slot number"); uint32_t slot = parse_value(args); - if(slot >= jukebox_size) + if(slot >= (size_t)jukebox_size) throw std::runtime_error("Bad slot number"); save_jukebox_pointer = slot - 1; update_movie_state(); diff --git a/src/core/mbranch.cpp b/src/core/mbranch.cpp index 1ac1622f..7be758c0 100644 --- a/src/core/mbranch.cpp +++ b/src/core/mbranch.cpp @@ -155,7 +155,6 @@ void mbranch_export(const std::string& filename, const std::string& branchname, if(!file) (stringfmt() << "Can't open '" << filename << "' for writing.").throwex(); if(binary) { - uint64_t pages = v.get_page_count(); uint64_t stride = v.get_stride(); uint64_t pageframes = v.get_frames_per_page(); uint64_t vsize = v.size(); diff --git a/src/core/misc.cpp b/src/core/misc.cpp index 1cfe71cc..d5a74d58 100644 --- a/src/core/misc.cpp +++ b/src/core/misc.cpp @@ -42,7 +42,6 @@ namespace { skein::prng prng; - uint64_t rcounter = 0; bool reached_main_flag; threads::lock seed_mutex; @@ -78,12 +77,12 @@ namespace tmp[1025] = tsc >> 32; for(unsigned i = 0; i < 1024; i++) tmp[i] = arch_get_random(); - sha256::hash(buf, reinterpret_cast(buf), sizeof(buf)); + sha256::hash(buf, reinterpret_cast(tmp), sizeof(tmp)); } void do_mix_tsc() { - const int slots = 32; + const unsigned slots = 32; static unsigned count = 0; static uint64_t last_reseed = 0; static uint64_t buf[slots + 1]; diff --git a/src/core/moviedata.cpp b/src/core/moviedata.cpp index 8c961ce7..1831e479 100644 --- a/src/core/moviedata.cpp +++ b/src/core/moviedata.cpp @@ -354,7 +354,7 @@ namespace if(mov_core == rom_core) return; std::ostringstream x; - x << loadstate ? "Error: " : "Warning: "; + x << (loadstate ? "Error: " : "Warning: "); x << "Emulator core version mismatch!" << std::endl << "\tCrurrent: " << rom_core << std::endl << "\tMovie: " << mov_core << std::endl; @@ -769,11 +769,11 @@ void try_request_rom(const std::string& moviefile) rom_request req; req.selected = 0; size_t idx = 0; - bool has_bios = false; req.core_guessed = false; for(auto i : sysregs) { - if(i->get_type().get_biosname() != "" && info.hash[1] != "") - has_bios = true; + //FIXME: Do something with this? + //if(i->get_type().get_biosname() != "" && info.hash[1] != "") + // has_bios = true; req.cores.push_back(&i->get_type()); if(i->get_type().get_core_identifier() == info.corename) { req.selected = idx; diff --git a/src/core/moviefile-binary.cpp b/src/core/moviefile-binary.cpp index e6b9e8f9..4fec61d4 100644 --- a/src/core/moviefile-binary.cpp +++ b/src/core/moviefile-binary.cpp @@ -95,9 +95,8 @@ void moviefile::binary_io(std::ostream& _stream, rrdata_set& rrd) throw(std::bad } out.extension(TAG_RRDATA, [this, &rrd](binarystream::output& s) { - uint64_t count; std::vector _rrd; - count = rrd.write(_rrd); + rrd.write(_rrd); s.blob_implicit(_rrd); }); diff --git a/src/core/moviefile-esave.cpp b/src/core/moviefile-esave.cpp index 4ae5cd5a..81504e70 100644 --- a/src/core/moviefile-esave.cpp +++ b/src/core/moviefile-esave.cpp @@ -77,7 +77,6 @@ namespace } void emerg_write_movie(int handle, const controller_frame_vector& v, uint32_t tag) { - uint64_t pages = v.get_page_count(); uint64_t stride = v.get_stride(); uint64_t pageframes = v.get_frames_per_page(); uint64_t vsize = v.size(); @@ -104,6 +103,7 @@ namespace n /= 10; } ptr[digits] = 0; + return digits; } template uint64_t map_index(const std::map& b, const std::string& n) diff --git a/src/core/multitrack.cpp b/src/core/multitrack.cpp index 8dce8890..75a59dca 100644 --- a/src/core/multitrack.cpp +++ b/src/core/multitrack.cpp @@ -114,7 +114,7 @@ void multitrack_edit::process_frame(controller_frame& input) input.axis3(t.port, t.controller, t.control, v); } else { int16_t v = movb.get_movie().read_subframe_at_index(pc, t.port, t.controller, t.control); - auto m = controllerstate[key]; + controllerstate[key]; const port_type& pt = portset.port_type(t.port); auto pci = pt.controller_info->get(t.controller); auto pb = pci ? pci->get(t.control) : NULL; diff --git a/src/core/rom.cpp b/src/core/rom.cpp index 8f245960..c5eed06a 100644 --- a/src/core/rom.cpp +++ b/src/core/rom.cpp @@ -41,7 +41,6 @@ namespace { - const char* null_chars = "F"; uint16_t null_cover_fbmem[512 * 448]; settingvar::variable> savestate_no_check(lsnes_vset, @@ -56,8 +55,6 @@ namespace 0, 0 //Offset. }; - port_index_triple sync_triple = {true, 0, 0, 0 }; - struct interface_device_reg null_registers[] = { {NULL, NULL, NULL} }; diff --git a/src/core/romloader.cpp b/src/core/romloader.cpp index 4a57ca7d..2b670c39 100644 --- a/src/core/romloader.cpp +++ b/src/core/romloader.cpp @@ -182,11 +182,12 @@ loaded_rom construct_rom_multifile(core_type* ctype, const moviefile::brief_info romid = std::string("ROM ") + j; } regex_results r = get_argument(cmdline, optregex); - if(i >= ctype->get_image_count()) + if(i >= ctype->get_image_count()) { if(r) throw std::runtime_error("This ROM type has no " + romid); else continue; + } if(info.hash[i] == "" && have_movie && r) throw std::runtime_error("This movie has no " + romid); diff --git a/src/emulation/Makefile b/src/emulation/Makefile index 65e8406e..59982b4f 100644 --- a/src/emulation/Makefile +++ b/src/emulation/Makefile @@ -9,7 +9,7 @@ __all__.files: $(CORES_FILES) cat $(CORES_FLAGS) >$(ALLFLAGS) make-ports.exe: make-ports.cpp ../library/json.cpp ../library/utf8.cpp ../library/string.cpp ../library/controller-parse.cpp ../library/controller-data.cpp ../library/sha256.cpp ../library/assembler.cpp ../library/hex.cpp ../library/eatarg.cpp ../library/int24.cpp ../library/binarystream.cpp ../library/integer-pool.cpp - $(HOSTCC) -g -std=gnu++0x -I../../include/library -o $@ $^ -lboost_regex$(HOST_BOOST_POSTFIX) -lboost_system$(HOST_BOOST_POSTFIX) + $(HOSTCC) -g -std=gnu++0x -I../../include/library -o $@ $^ -lboost_regex$(HOST_BOOST_POSTFIX) -lboost_system$(HOST_BOOST_POSTFIX) -Wall -Werror bsnes-legacy/$(ALLFILES): forcelook make-ports.exe $(MAKE) -C bsnes-legacy diff --git a/src/emulation/bsnes-legacy/Makefile b/src/emulation/bsnes-legacy/Makefile index 551144cd..2ae5aab1 100644 --- a/src/emulation/bsnes-legacy/Makefile +++ b/src/emulation/bsnes-legacy/Makefile @@ -41,7 +41,7 @@ ports.inc: ports.json ../make-ports.exe ../make-ports.exe <$< >$@ %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep ports.inc - $(REALCC) -c -o $@ $< -I../../../include -I../../../bsnes $(CFLAGS) $(BSNES_CFLAGS) + $(REALCC) -c -o $@ $< -I../../../include -I../../../bsnes $(CFLAGS) $(BSNES_CFLAGS) -Werror=return-type else OBJECTS= diff --git a/src/emulation/bsnes-legacy/bitmap.cpp b/src/emulation/bsnes-legacy/bitmap.cpp index dfb95336..a7e55f5c 100644 --- a/src/emulation/bsnes-legacy/bitmap.cpp +++ b/src/emulation/bsnes-legacy/bitmap.cpp @@ -53,7 +53,7 @@ namespace rangesize = (width - 1) * stride1 + (height - 1) * stride2 + 32; } - char* mem = lsnes_memory.get_physical_mapping(rangebase, rangesize); + char* mem = map ? lsnes_memory.get_physical_mapping(rangebase, rangesize) : NULL; if(mem) { for(unsigned j = 0; j < height; j++) for(unsigned i = 0; i < width; i++) { diff --git a/src/emulation/bsnes-legacy/core.cpp b/src/emulation/bsnes-legacy/core.cpp index 999e4033..d9385c9f 100644 --- a/src/emulation/bsnes-legacy/core.cpp +++ b/src/emulation/bsnes-legacy/core.cpp @@ -1276,6 +1276,7 @@ again2: return SNES::ppu.layer_enabled[y][id % 4] ? 3 : 1; } #endif + return 0; //WTF? } int c_reset_action(bool hard) { @@ -1831,6 +1832,7 @@ again2: return 0; } else P.expected("table or nil"); + return 0; //NOTREACHED. } int setstep(lua::state& L, lua::parameters& P) @@ -1856,6 +1858,7 @@ again2: P(r); lsnes_cmd.invoke("tracelog cpu " + r); + return 0; } command::fnptr start_trace(lsnes_cmd, "set-trace", "No description available", diff --git a/src/emulation/gambatte/Makefile b/src/emulation/gambatte/Makefile index 0607cfe3..35430eea 100644 --- a/src/emulation/gambatte/Makefile +++ b/src/emulation/gambatte/Makefile @@ -19,7 +19,7 @@ ports.inc: ports.json ../make-ports.exe ../make-ports.exe <$< >$@ %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep ports.inc - $(REALCC) -c -o $@ $< -I../../../include -I../../../gambatte $(CFLAGS) $(GAMBATTE_CFLAGS) + $(REALCC) -c -o $@ $< -I../../../include -I../../../gambatte $(CFLAGS) $(GAMBATTE_CFLAGS) -Werror=return-type else diff --git a/src/emulation/sky/Makefile b/src/emulation/sky/Makefile index faf92e28..8a243043 100644 --- a/src/emulation/sky/Makefile +++ b/src/emulation/sky/Makefile @@ -7,7 +7,7 @@ __all__.files: $(OBJECTS) echo >__all__.ldflags %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep - $(REALCC) -c -o $@ $< -I../../../include -I. $(CFLAGS) + $(REALCC) -c -o $@ $< -I../../../include -I. $(CFLAGS) -Wall -Werror forcelook: @true diff --git a/src/emulation/sky/draw.cpp b/src/emulation/sky/draw.cpp index 19cfa13c..77fd7726 100644 --- a/src/emulation/sky/draw.cpp +++ b/src/emulation/sky/draw.cpp @@ -383,13 +383,11 @@ namespace sky void draw_quad_z_pipefront(struct instance& inst, double z, int x, uint32_t color) { - struct pipe_cache& p = inst.pipecache[x + 3]; auto p5 = point_project_b(x - 0.5, 0, z); auto p6 = point_project_b(x, 1, z); auto p7 = point_project_b(x + 0.5, 0, z); double ymind = p6.y; double ymaxd = p5.y; - int16_t ymin = floor(ymind); int16_t ymax = ceil(ymaxd); if(ymaxd - ymind < 0.1) return; @@ -503,7 +501,7 @@ namespace sky p.colors[x] = mix_color(c, c2); } for(unsigned i = 0; i < 256; i++) { - if(p.colors[i] == 0xFFFFFFFF) + if(p.colors[i] == 0xFFFFFFFF) { if(i == 0) { for(unsigned j = 0; j < 255; j++) if(p.colors[j] != 0xFFFFFFFF) { @@ -512,6 +510,7 @@ namespace sky } } else p.colors[i] = p.colors[i - 1]; + } } //for(unsigned i = 0; i < 256; i++) // p.colors[i] = 0xFF8000 + i; @@ -547,9 +546,7 @@ namespace sky return; if(p4.y - p2.y < 0.1) return; - double ymind = p6.y; double ymaxd = p5.y; - int16_t ymin = floor(ymind); int16_t ymax = ceil(ymaxd); double sl1 = (p3.x - p1.x) / (p3.y - p1.y); double sl2 = (p4.x - p2.x) / (p4.y - p2.y); @@ -588,7 +585,8 @@ namespace sky } else for(signed i = dstart; i < dend; i++) { - framebuffer_blend2(inst.framebuffer[base + i], fcolor | p.colors[color >> 16]); + framebuffer_blend2(inst.framebuffer[base + i], fcolor | + p.colors[color >> 16]); color += cstep; } } @@ -655,7 +653,7 @@ namespace sky if(x > 0) dend = min((int16_t)dend, cend); } else { - uint16_t dist; + uint16_t dist = 0; if(x < 0) dist = cstart - dstart; if(x > 0) diff --git a/src/emulation/sky/image.hpp b/src/emulation/sky/image.hpp index b844fc59..d3f860a6 100644 --- a/src/emulation/sky/image.hpp +++ b/src/emulation/sky/image.hpp @@ -15,7 +15,7 @@ namespace sky image(const std::vector& data); uint16_t width; uint16_t height; - uint8_t colors; + unsigned colors; uint16_t unknown1; std::vector decode; uint32_t operator[](size_t ptr) { return palette[decode[ptr]]; } diff --git a/src/emulation/sky/level.cpp b/src/emulation/sky/level.cpp index 42fc322a..15a31b72 100644 --- a/src/emulation/sky/level.cpp +++ b/src/emulation/sky/level.cpp @@ -94,8 +94,6 @@ namespace sky bool level::collides(uint32_t lpos, uint16_t hpos, int16_t vpos) { - bool debug = (lpos == 1248904); - uint16_t ltile = lpos / 65536; tile a = at(lpos, hpos - 1792); tile b = at(lpos, hpos + 1792); //Floor collision check. diff --git a/src/emulation/sky/lzs.cpp b/src/emulation/sky/lzs.cpp index e6eba6d3..b61c3c3e 100644 --- a/src/emulation/sky/lzs.cpp +++ b/src/emulation/sky/lzs.cpp @@ -90,7 +90,6 @@ namespace sky uint8_t pending_byte = 0; uint8_t pending_bits = 0; - int pending_mode = 0; size_t output = 0; size_t copy_remaining = 0; size_t copy_backward = 0; diff --git a/src/emulation/sky/music.cpp b/src/emulation/sky/music.cpp index 76be40bf..69fbf24d 100644 --- a/src/emulation/sky/music.cpp +++ b/src/emulation/sky/music.cpp @@ -46,6 +46,7 @@ namespace sky for(auto i : candidates) if(!(r--)) return i; + return 0; } void fill_msc_downmix_family0(struct multistream_characteristics& c, unsigned chan) @@ -266,7 +267,7 @@ namespace sky parse_ogg_page(p, psids[psid]); } else for(auto& i : psids) - if(parse_ogg_page(p, i.second) && p.get_eos()) + if(parse_ogg_page(p, i.second) && p.get_eos()) { if(i.second.pts <= i.second.pregap) { //Invalid or blank stream. messages << "Warning: " << p.stream_debug_id() << " has " @@ -277,6 +278,7 @@ namespace sky break; } else i.second.eos_seen = true; + } for(auto& i : psids) if(!i.second.eos_seen) messages << "Warning: No EOS on stream " << hex::to(i.second.oggid, true) @@ -443,7 +445,7 @@ namespace sky } } //Make sure substream 0 exits. - auto dummy = register_lsid((stringfmt() << "PSID" << ctx.psid).str(), ctx.psid); + register_lsid((stringfmt() << "PSID" << ctx.psid).str(), ctx.psid); } void song_buffer::parse_ogg_data(ogg::packet& p, subsong_context& ctx, const ogg::page& debug) diff --git a/src/emulation/sky/sky.cpp b/src/emulation/sky/sky.cpp index 7d715e87..abf90922 100644 --- a/src/emulation/sky/sky.cpp +++ b/src/emulation/sky/sky.cpp @@ -166,7 +166,6 @@ namespace sky size_t port_serialize(const port_type* _this, const unsigned char* buffer, char* textbuf) { size_t ptr = 0; - short tmp; textbuf[ptr++] = (buffer[0] & 1) ? 'F' : '.'; textbuf[ptr++] = '|'; textbuf[ptr++] = (buffer[0] & 2) ? 'L' : '.'; @@ -183,7 +182,6 @@ namespace sky { memset(buffer, 0, 2); size_t ptr = 0; - short tmp; if(read_button_value(textbuf, ptr)) buffer[0] |= 1; skip_rest_of_field(textbuf, ptr, true); if(read_button_value(textbuf, ptr)) buffer[0] |= 2; @@ -194,6 +192,7 @@ namespace sky if(read_button_value(textbuf, ptr)) buffer[0] |= 64; if(read_button_value(textbuf, ptr)) buffer[0] |= 128; skip_rest_of_field(textbuf, ptr, false); + return ptr; }; struct _psystem : public port_type diff --git a/src/emulation/sky/sound.hpp b/src/emulation/sky/sound.hpp index 5929d483..06759ee2 100644 --- a/src/emulation/sky/sound.hpp +++ b/src/emulation/sky/sound.hpp @@ -59,7 +59,7 @@ namespace sky bool hipri() { return (_hipri > 0); } void hipri(bool hi) { _hipri = hi ? 1 : 0; } private: - uint8_t access(const struct sounds& snds, uint32_t addr) { snds.access(addr); } + uint8_t access(const struct sounds& snds, uint32_t addr) { return snds.access(addr); } int64_t left; uint32_t pointer; uint32_t subsample; diff --git a/src/emulation/test/Makefile b/src/emulation/test/Makefile index feedca7b..3256542a 100644 --- a/src/emulation/test/Makefile +++ b/src/emulation/test/Makefile @@ -10,7 +10,7 @@ ports.inc: ports.json ../make-ports.exe ../make-ports.exe <$< >$@ %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep ports.inc - $(REALCC) -c -o $@ $< -I../../../include -I../../../gambatte $(CFLAGS) + $(REALCC) -c -o $@ $< -I../../../include $(CFLAGS) forcelook: @true diff --git a/src/fonts/Makefile b/src/fonts/Makefile index 890e32a4..33beb396 100644 --- a/src/fonts/Makefile +++ b/src/fonts/Makefile @@ -9,7 +9,7 @@ __all__.files: $(OBJECTS) .PRECIOUS: font.$(OBJECT_SUFFIX) font.cpp %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep - $(REALCC) $(CFLAGS) -c -o $@ $< -I../../include + $(REALCC) $(CFLAGS) -c -o $@ $< -I../../include -Wall -Werror font.cpp font.cpp.dep: $(FONT_SRC) echo "extern const char* font_hex_data;" >font.cpp diff --git a/src/interface/Makefile b/src/interface/Makefile index 652a488d..e29c9986 100644 --- a/src/interface/Makefile +++ b/src/interface/Makefile @@ -7,7 +7,7 @@ __all__.files: $(OBJECTS) touch __all__.ldflags %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep - $(REALCC) $(CFLAGS) -c -o $@ $< -I../../include + $(REALCC) $(CFLAGS) -c -o $@ $< -I../../include -Wall -Werror precheck: ../../buildaux/mkdeps.exe ../../include -- *.cpp diff --git a/src/interface/c-interface.cpp b/src/interface/c-interface.cpp index 0911ec11..5aabee2c 100644 --- a/src/interface/c-interface.cpp +++ b/src/interface/c-interface.cpp @@ -309,7 +309,6 @@ namespace std::pair c_get_scale_factors(uint32_t width, uint32_t height) { lsnes_core_compute_scale s; - bool r = -1; uint32_t hscale, vscale; if(width >= 360) hscale = 1; else hscale = 360 / width + 1; @@ -410,7 +409,6 @@ namespace void c_serialize(std::vector& out) { lsnes_core_savestate s; - const char* err; entrypoint(id, s, [](const char* name, const char* err) { throw std::runtime_error("Savestate failed: " + std::string(err)); }); @@ -753,7 +751,6 @@ failed: std::map& settings) { size_t asize = 0; - lsnes_core_get_controllerconfig r; for(auto i : settings) asize += i.first.length() + i.second.length() + 2; tmpmem.resize(asize); diff --git a/src/library/Makefile b/src/library/Makefile index 9fbedfc6..f1e707b8 100644 --- a/src/library/Makefile +++ b/src/library/Makefile @@ -7,7 +7,7 @@ __all__.files: $(OBJECTS) touch __all__.ldflags %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep - $(REALCC) $(CFLAGS) -c -o $@ $< -I../../include/library + $(REALCC) $(CFLAGS) -c -o $@ $< -I../../include/library -Wall -Werror precheck: forcelook ../../buildaux/mkdeps.exe ../../include/library -- *.cpp diff --git a/src/library/binarystream.cpp b/src/library/binarystream.cpp index 05a15340..d84035b5 100644 --- a/src/library/binarystream.cpp +++ b/src/library/binarystream.cpp @@ -176,12 +176,12 @@ void input::blob_implicit(std::vector& blob) } input::input(std::istream& s) - : strm(s), left(0), parent(NULL) + : parent(NULL), strm(s), left(0) { } input::input(input& s, uint64_t len) - : strm(s.strm), left(len), parent(&s) + : parent(&s), strm(s.strm), left(len) { if(parent->parent && left > parent->left) throw std::runtime_error("Substream length greater than its parent"); diff --git a/src/library/controller-data.cpp b/src/library/controller-data.cpp index b339cf9e..a38d6ad0 100644 --- a/src/library/controller-data.cpp +++ b/src/library/controller-data.cpp @@ -724,7 +724,6 @@ uint64_t controller_frame_vector::binary_size() const throw() void controller_frame_vector::save_binary(binarystream::output& stream) const throw(std::runtime_error) { - uint64_t pages = get_page_count(); uint64_t stride = get_stride(); uint64_t pageframes = get_frames_per_page(); uint64_t vsize = size(); @@ -777,14 +776,12 @@ void controller_frame_vector::swap_data(controller_frame_vector& v) throw() int64_t controller_frame_vector::find_frame(uint64_t n) { if(!n) return -1; - uint64_t pages = get_page_count(); uint64_t stride = get_stride(); uint64_t pageframes = get_frames_per_page(); uint64_t vsize = size(); size_t pagenum = 0; while(vsize > 0) { uint64_t count = (vsize > pageframes) ? pageframes : vsize; - size_t bytes = count * stride; const unsigned char* content = get_page_buffer(pagenum++); size_t offset = 0; for(unsigned i = 0; i < count; i++) { @@ -820,6 +817,9 @@ unsigned port_controller::analog_actions() const case port_controller_button::TYPE_TAXIS: s++; break; + case port_controller_button::TYPE_NULL: + case port_controller_button::TYPE_BUTTON: + ; }; } return (r + 1)/ 2 + s; @@ -861,6 +861,9 @@ std::pair port_controller::analog_action(unsigned k) const } r++; break; + case port_controller_button::TYPE_NULL: + case port_controller_button::TYPE_BUTTON: + ; }; } out: @@ -1175,7 +1178,7 @@ void controller_macro_data::write(controller_frame& frame, unsigned port, unsign { if(!enabled) return; - if(autoterminate && (nframe < 0 || nframe >= get_frames())) + if(autoterminate && (nframe < 0 || nframe >= (int64_t)get_frames())) return; if(nframe < 0) nframe += ((-nframe / get_frames()) + 3) * get_frames(); @@ -1200,6 +1203,9 @@ void controller_macro_data::write(controller_frame& frame, unsigned port, unsign case AM_OVERWRITE: frame.axis3(port, controller, lb, 0); break; + case AM_OR: + case AM_XOR: + ; } } const port_controller* _ctrl = frame.porttypes().port_type(port).controller_info->get(controller); diff --git a/src/library/controller-parse.cpp b/src/library/controller-parse.cpp index 82439251..80945d47 100644 --- a/src/library/controller-parse.cpp +++ b/src/library/controller-parse.cpp @@ -129,6 +129,7 @@ namespace return pcb_axis(root, ptr, type); else (stringfmt() << "Unknown type '" << type << "' for '" << ptr << "'").throwex(); + return pcb_null(root, ptr); //NOTREACHED. } struct port_controller pcs_parse_controller(const JSON::node& root, JSON::pointer ptr) @@ -362,12 +363,9 @@ struct port_controller_set* pcs_from_json(const JSON::node& root, const std::str std::string pcs_write_class(const struct port_controller_set& pset, unsigned& tmp_idx) { - size_t buttonidx = 0; - size_t axisidx = 0; std::ostringstream s; write_portdata(s, pset, tmp_idx); unsigned pidx = tmp_idx - 1; - size_t aoffset = get_aoffset(pset); auto repr = get_ser_instructions(pset); auto idxr = get_idx_instructions(pset); s << "struct _" << pset.symbol << " : public port_type\n"; @@ -415,8 +413,6 @@ std::string pcs_write_class(const struct port_controller_set& pset, unsigned& tm s << "\t\t};\n"; s << "\t\tread = [](const port_type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl) -> " << "short {\n"; - buttonidx = 0; - axisidx = 0; s << "\t\t\tswitch(idx) {\n"; last_controller = -1; for(auto i : idxr) { @@ -448,6 +444,7 @@ std::string pcs_write_class(const struct port_controller_set& pset, unsigned& tm } s << "\t\t\treturn 0;\n"; s << "\t\t\t}\n"; + s << "\t\t\treturn 0;\n"; s << "\t\t};\n"; s << "\t\tserialize = [](const port_type* _this, const unsigned char* buffer, char* textbuf) -> size_t {\n"; s << "\t\t\tsize_t ptr = 0;\n"; @@ -587,6 +584,7 @@ short port_type_generic::_read(const port_type* _this, const unsigned char* buff case 2: return (short)((unsigned short)buffer[ii.offset] + ((unsigned short)buffer[ii.offset+1] << 8)); } + return 0; //NOTREACHED } size_t port_type_generic::_serialize(const port_type* _this, const unsigned char* buffer, char* textbuf) @@ -688,7 +686,6 @@ port_type_generic::port_type_generic(const JSON::node& root, const std::string& indexbase[ii++] = ibase; ibase += i.buttons.size(); } - size_t aoffset = get_aoffset(*controller_info); serialize_instructions = get_ser_instructions(*controller_info); indexinfo = get_idx_instructions(*controller_info); _serialize(this, NULL, NULL); diff --git a/src/library/fileimage.cpp b/src/library/fileimage.cpp index f189accf..ee8449e8 100644 --- a/src/library/fileimage.cpp +++ b/src/library/fileimage.cpp @@ -195,6 +195,7 @@ hashval& hashval::operator=(const hashval& f) hasher = f.hasher; if(!is_ready && hasher) hasher->link(*this); + return *this; } void hashval::resolve(unsigned id, const std::string& hash, uint64_t _prefix) diff --git a/src/library/filelist.cpp b/src/library/filelist.cpp index e3b1d9a6..68899bb2 100644 --- a/src/library/filelist.cpp +++ b/src/library/filelist.cpp @@ -38,7 +38,8 @@ void filelist::add(const std::string& filename) void filelist::remove(const std::string& filename) { auto contents = readfile(); - int64_t ts = file_get_mtime(directory + "/" + filename); + //FIXME: Do something with this? + //int64_t ts = file_get_mtime(directory + "/" + filename); contents.erase(filename); writeback(contents); } diff --git a/src/library/filesystem.cpp b/src/library/filesystem.cpp index e0d9cca9..c9a65b1a 100644 --- a/src/library/filesystem.cpp +++ b/src/library/filesystem.cpp @@ -289,8 +289,6 @@ filesystem::ref& filesystem::ref::operator=(const filesystem::ref& r) if(this == &r) return *this; //This is tricky, due to having to lock two objects. - size_t A = (size_t)this; - size_t B = (size_t)&r; threads::lock* mtodelete = NULL; if(!refcnt) { //We just have to grab a ref and copy. diff --git a/src/library/framebuffer.cpp b/src/library/framebuffer.cpp index 4ed0df37..fb685e6c 100644 --- a/src/library/framebuffer.cpp +++ b/src/library/framebuffer.cpp @@ -913,7 +913,6 @@ color::color(const std::string& clr) throw(std::bad_alloc, std::runtime_error) std::string color::stringify(int64_t number) { - auto& cspecs = colornames(); for(auto& i : colornames()) { int64_t col = -1; if(i.second.second) diff --git a/src/library/gamepad.cpp b/src/library/gamepad.cpp index 3b8369cb..a4117ae6 100644 --- a/src/library/gamepad.cpp +++ b/src/library/gamepad.cpp @@ -247,7 +247,7 @@ void pad::report_axis(uint64_t id, int64_t val) hat_info& i = *_axes_hat[id]; bool is_x = (id == i.id); bool is_y = (id == i.id2); - unsigned ostate = i.state; + signed ostate = i.state; if(is_x) { i.state = (val <= -i.mindev) ? (i.state | 0x8) : (i.state & 0x7); } if(is_x) { i.state = (val >= i.mindev) ? (i.state | 0x2) : (i.state & 0xD); } if(is_y) { i.state = (val <= -i.mindev) ? (i.state | 0x1) : (i.state & 0xE); } @@ -287,7 +287,7 @@ void pad::report_hat(uint64_t id, int angle) return; } hat_info& i = _hats[id]; - unsigned ostate = i.state; + signed ostate = i.state; i.state = h; int16_t nstate = i.state; unsigned inum = i.num; @@ -720,6 +720,7 @@ unsigned set::add(const std::string& name) return _gamepads.size() - 1; } catch(...) { delete gp; + throw; } } diff --git a/src/library/httpreq.cpp b/src/library/httpreq.cpp index 32c0f4e7..73e4e234 100644 --- a/src/library/httpreq.cpp +++ b/src/library/httpreq.cpp @@ -349,7 +349,6 @@ void property_upload_request::len_helper(size_t len, char*& target, size_t& maxr size_t property_upload_request::read(char* target, size_t maxread) { size_t x = 0; - size_t y; while(maxread > 0) { switch(state) { case 0: diff --git a/src/library/int24.cpp b/src/library/int24.cpp index 75e0c864..b2dfca28 100644 --- a/src/library/int24.cpp +++ b/src/library/int24.cpp @@ -47,4 +47,12 @@ namespace { char assert1[(sizeof(ss_int24_t) == 3) ? 1 : -1]; char assert2[(sizeof(ss_uint24_t) == 3) ? 1 : -1]; + + void foo() + { + char* x = assert1; + x[0] = 0; + x = assert2; + x[0] = 1; + } } diff --git a/src/library/json.cpp b/src/library/json.cpp index 28861f86..0444f2eb 100644 --- a/src/library/json.cpp +++ b/src/library/json.cpp @@ -105,8 +105,9 @@ const char* error::what() const throw() if(state == PARSE_NOT_PARSING) return error_desc[code]; else { - sprintf(buffer, "%s (while expecting %s) at byte %llu", error_desc[code], state_desc[state], - (unsigned long long)position); + //Windows is crap. + sprintf(buffer, "%s (while expecting %s) at byte %u", error_desc[code], state_desc[state], + (unsigned)position); return buffer; } } @@ -131,7 +132,7 @@ std::string error::extended_error(const std::string& doc) if(p >= doc.length()) break; if(doc[p] < 32) { - sample << "<" << asciinames[doc[p++]] << ">"; + sample << "<" << asciinames[(unsigned char)doc[p++]] << ">"; } else if(doc[p] < 127) sample << doc[p++]; else if(doc[p] < 128) @@ -547,7 +548,6 @@ namespace errorcode node::follow_soft(const std::u32string& pointer, const node*& current) const throw(std::bad_alloc) { - errorcode e; current = this; size_t ptr = 0; while(ptr < pointer.length()) { @@ -578,7 +578,6 @@ errorcode node::follow_soft(const std::u32string& pointer, const node*& current) errorcode node::follow_soft(const std::u32string& pointer, node*& current) throw(std::bad_alloc) { current = this; - errorcode e; size_t ptr = 0; while(ptr < pointer.length()) { size_t p = pointer.find_first_of(U"/", ptr); @@ -1799,6 +1798,7 @@ std::string printer_indenting::array_begin() state = S_START; return linestart(depth++) + "["; } + return ""; //NOTREACHED. } std::string printer_indenting::array_separator() @@ -1831,6 +1831,7 @@ std::string printer_indenting::array_end() --depth; return std::string("]") + (depth ? "" : "\n"); } + return ""; //NOTREACHED. } std::string printer_indenting::object_begin() @@ -1853,6 +1854,7 @@ std::string printer_indenting::object_begin() state = S_START; return linestart(depth++) + "{"; } + return ""; //NOTREACHED. } std::string printer_indenting::object_key(const std::u32string& s) @@ -1869,6 +1871,7 @@ std::string printer_indenting::object_key(const std::u32string& s) state = S_NORMAL; return json_string_escape(s) + ":"; } + return ""; //NOTREACHED. } std::string printer_indenting::object_separator() @@ -1901,6 +1904,7 @@ std::string printer_indenting::object_end() --depth; return "}"; } + return ""; //NOTREACHED. } } diff --git a/src/library/keyboard.cpp b/src/library/keyboard.cpp index b3535044..91c5cb7d 100644 --- a/src/library/keyboard.cpp +++ b/src/library/keyboard.cpp @@ -508,12 +508,11 @@ std::vector key_axis::get_subkeys() throw(std::bad_alloc) void key_axis::set_state(modifier_set mods, int32_t _rawstate) throw() { bool edge = false; - int32_t state, ostate; + int32_t state; uint32_t change = 0; int dold = 0, dnew = 0; mlock.lock(); if(rawstate != _rawstate) { - ostate = rawstate; dold = digitalstate; rawstate = _rawstate; state = rawstate; diff --git a/src/library/lua-framebuffer.cpp b/src/library/lua-framebuffer.cpp index ca00f370..43b478a6 100644 --- a/src/library/lua-framebuffer.cpp +++ b/src/library/lua-framebuffer.cpp @@ -12,6 +12,7 @@ framebuffer::color lua_get_fb_color(lua::state& L, int index, const std::string& else (stringfmt() << "Expected argument #" << index << " to " << fname << " be string or number").throwex(); + return 0; //NOTREACHED } framebuffer::color lua_get_fb_color(lua::state& L, int index, const std::string& fname, int64_t dflt) @@ -26,4 +27,5 @@ framebuffer::color lua_get_fb_color(lua::state& L, int index, const std::string& else (stringfmt() << "Expected argument #" << index << " to " << fname << " be string, number or nil").throwex(); + return 0; //NOTREACHED } diff --git a/src/library/lua.cpp b/src/library/lua.cpp index 6c5776d8..6690c1f4 100644 --- a/src/library/lua.cpp +++ b/src/library/lua.cpp @@ -81,11 +81,13 @@ namespace lua_pushstring(L, err.c_str()); lua_error(L); } + return 0; //NOTREACHED } int class_info::newindex(lua_State* L) { lua_pushstring(L, "Writing into class table not allowed"); lua_error(L); + return 0; //NOTREACHED } int class_info::pairs(lua_State* _xL) @@ -94,7 +96,6 @@ namespace lua::state* _L = (lua::state*)lua_touserdata(_xL, lua_upvalueindex(1)); state L(*_L, _xL); - class_base* obj = ((class_info*)L.touserdata(1))->obj; L.pushvalue(lua_upvalueindex(1)); L.pushcclosure(class_info::pairs_next, 1); //Next diff --git a/src/library/mathexpr-format.cpp b/src/library/mathexpr-format.cpp index dc79ed0f..d63ed979 100644 --- a/src/library/mathexpr-format.cpp +++ b/src/library/mathexpr-format.cpp @@ -65,7 +65,6 @@ again: out += std::string(1, expsep); out += (stringfmt() << exponent).str(); } else { - double vint = floor(v); //TODO: Print whole part. double tail = v - floor(v); if(fmt.precision < 0) { @@ -79,10 +78,11 @@ again: out += print_decimals(tail, base, fmt.precision, false, fmt.uppercasehex); } } - if(!exponential && out.length() > fmt.width) { + if(!exponential && (ssize_t)out.length() > fmt.width) { exponential = true; goto again; } + return out; } std::string format_float_10(double v, mathexpr_format fmt) @@ -134,6 +134,10 @@ std::string math_format_unsigned(uint64_t v, mathexpr_format fmt) if(fmt.uppercasehex) _out << std::uppercase; _out << std::hex << v; break; + case mathexpr_format::BOOLEAN: + case mathexpr_format::STRING: + case mathexpr_format::DEFAULT: + ; } std::string out = _out.str(); if(fmt.showsign) @@ -172,6 +176,10 @@ std::string math_format_signed(int64_t v, mathexpr_format fmt) if(fmt.uppercasehex) _out << std::uppercase; _out << std::hex << std::abs(v); break; + case mathexpr_format::BOOLEAN: + case mathexpr_format::STRING: + case mathexpr_format::DEFAULT: + ; } std::string out = _out.str(); if(fmt.showsign && v >= 0) @@ -210,6 +218,10 @@ std::string math_format_float(double v, mathexpr_format fmt) //out = format_float_base(v, fmt, 16); //break; return "<#Badbase>"; + case mathexpr_format::BOOLEAN: + case mathexpr_format::STRING: + case mathexpr_format::DEFAULT: + ; } return pad(out, fmt.width, fmt.fillzeros, false); } @@ -238,7 +250,7 @@ std::string math_format_string(std::string v, mathexpr_format fmt) return pad((v != "") ? "true" : "false", fmt.width, false, true); if(fmt.type != mathexpr_format::STRING) return "<#Badformat>"; - if(fmt.precision > 0 && v.length() > fmt.precision) + if(fmt.precision > 0 && (ssize_t)v.length() > fmt.precision) v = v.substr(0, fmt.precision); return pad(v, fmt.width, false, true); } diff --git a/src/library/mathexpr-ntype.cpp b/src/library/mathexpr-ntype.cpp index a98bdad1..baee9b39 100644 --- a/src/library/mathexpr-ntype.cpp +++ b/src/library/mathexpr-ntype.cpp @@ -481,6 +481,7 @@ namespace return expr_val_numeric(unsigned_tag(), _a); } else throw_domain("Bit operations are only for integers"); + return expr_val_numeric(unsigned_tag(), 0); //NOTREACHED } static expr_val_numeric op_pi() { @@ -582,6 +583,7 @@ namespace case T_FLOAT: return expr_val_numeric(unsigned_tag(), a.v_float); default: throw_domain("Can't convert non-real into unsigned"); } + return expr_val_numeric(unsigned_tag(), 0); //NOTREACHED. } static expr_val_numeric x_signed(expr_val_numeric a) { @@ -591,6 +593,7 @@ namespace case T_FLOAT: return expr_val_numeric(signed_tag(), a.v_float); default: throw_domain("Can't convert non-real into signed"); } + return expr_val_numeric(signed_tag(), 0); //NOTREACHED. } static expr_val_numeric x_float(expr_val_numeric a) { @@ -600,6 +603,7 @@ namespace case T_FLOAT: return expr_val_numeric(float_tag(), a.v_float); default: throw_domain("Can't convert non-real into float"); } + return expr_val_numeric(float_tag(), 0); //NOTREACHED. } expr_val_numeric re() const { diff --git a/src/library/memorysearch.cpp b/src/library/memorysearch.cpp index 911e6623..6189e4b5 100644 --- a/src/library/memorysearch.cpp +++ b/src/library/memorysearch.cpp @@ -398,7 +398,6 @@ template T memory_search::v_readold(uint64_t addr) throw() template void memorysearch_pull_type(memory_search& s) { - T val; eat_argument(&memory_search::s_value); eat_argument(&memory_search::s_difference); eat_argument(&memory_search::s_lt); @@ -418,7 +417,6 @@ template void memorysearch_pull_type(memory_search& s) template void memorysearch_pull_type2(memory_search& s) { - T val; eat_argument(&memory_search::s_value); eat_argument(&memory_search::s_difference); eat_argument(&memory_search::s_lt); @@ -487,7 +485,6 @@ bool memory_search::is_candidate(uint64_t addr) throw() if(i >= previous_content.size()) return false; uint64_t rsize = t.first->size; - uint64_t switch_at = i + rsize - t.second; //The smallest i not in this region. rsize = min(rsize, previous_content.size() - i); if(addr >= t.first->base + t.second && addr < t.first->base + rsize) { uint64_t adv = addr - (t.first->base + t.second); @@ -513,13 +510,13 @@ uint64_t memory_search::cycle_candidate_vma(uint64_t addr, bool next) throw() if(i >= previous_content.size()) return addr; uint64_t rsize = t.first->size; - uint64_t switch_at = i + rsize - t.second; //The smallest i not in this region. + int64_t switch_at = i + rsize - t.second; //The smallest i not in this region. rsize = min(rsize, previous_content.size() - i); if(addr >= t.first->base + t.second && addr < t.first->base + rsize) { uint64_t baseaddr = t.first->base + t.second; int64_t tryoff = addr - baseaddr + i; - uint64_t finoff = tryoff; - uint64_t warp = i; + int64_t finoff = tryoff; + int64_t warp = i; bool warped = false; if(next) { //Cycle forwards. diff --git a/src/library/memoryspace.cpp b/src/library/memoryspace.cpp index 605183a1..463f064f 100644 --- a/src/library/memoryspace.cpp +++ b/src/library/memoryspace.cpp @@ -8,7 +8,6 @@ namespace { template inline T internal_read(memory_space& m, uint64_t addr) { - const int system_endian = memory_space::get_system_endian(); std::pair g; if(linear) g = m.lookup_linear(addr); @@ -27,7 +26,6 @@ namespace template inline bool internal_write(memory_space& m, uint64_t addr, T value) { - const int system_endian = memory_space::get_system_endian(); std::pair g; if(linear) g = m.lookup_linear(addr); diff --git a/src/library/memorywatch.cpp b/src/library/memorywatch.cpp index 268269cd..935863af 100644 --- a/src/library/memorywatch.cpp +++ b/src/library/memorywatch.cpp @@ -4,6 +4,14 @@ #include #include "string.hpp" +namespace +{ + template T* pointer_cast(char* ptr) + { + return reinterpret_cast(ptr); + } +} + memorywatch_memread_oper::memorywatch_memread_oper() : mathexpr_operinfo("(readmemory)") { @@ -41,41 +49,41 @@ void memorywatch_memread_oper::evaluate(mathexpr_value target, std::vectorparse_s(target.value, *(int8_t*)buf); + target.type->parse_s(target.value, *(const int8_t*)buf); else - target.type->parse_u(target.value, *(uint8_t*)buf); + target.type->parse_u(target.value, *(const uint8_t*)buf); break; case 2: if(float_flag) throw mathexpr_error(mathexpr_error::SIZE, "2 byte floats not supported"); else if(signed_flag) - target.type->parse_s(target.value, *(int16_t*)buf); + target.type->parse_s(target.value, *pointer_cast(buf)); else - target.type->parse_u(target.value, *(uint16_t*)buf); + target.type->parse_u(target.value, *pointer_cast(buf)); break; case 3: if(float_flag) throw mathexpr_error(mathexpr_error::SIZE, "3 byte floats not supported"); else if(signed_flag) - target.type->parse_s(target.value, *(ss_int24_t*)buf); + target.type->parse_s(target.value, *pointer_cast(buf)); else - target.type->parse_u(target.value, *(ss_uint24_t*)buf); + target.type->parse_u(target.value, *pointer_cast(buf)); break; case 4: if(float_flag) - target.type->parse_f(target.value, *(float*)buf); + target.type->parse_f(target.value, *pointer_cast(buf)); else if(signed_flag) - target.type->parse_s(target.value, *(int32_t*)buf); + target.type->parse_s(target.value, *pointer_cast(buf)); else - target.type->parse_u(target.value, *(uint32_t*)buf); + target.type->parse_u(target.value, *pointer_cast(buf)); break; case 8: if(float_flag) - target.type->parse_f(target.value, *(double*)buf); + target.type->parse_f(target.value, *pointer_cast(buf)); else if(signed_flag) - target.type->parse_s(target.value, *(int64_t*)buf); + target.type->parse_s(target.value, *pointer_cast(buf)); else - target.type->parse_u(target.value, *(uint64_t*)buf); + target.type->parse_u(target.value, *pointer_cast(buf)); break; default: throw mathexpr_error(mathexpr_error::SIZE, "Memory address size not supported"); diff --git a/src/library/opus-ogg.cpp b/src/library/opus-ogg.cpp index 1b35a5a6..38fbb935 100644 --- a/src/library/opus-ogg.cpp +++ b/src/library/opus-ogg.cpp @@ -169,5 +169,6 @@ uint32_t ogg_tags::serialize(std::function output, break; written = ptr - &contents[0]; } + return next_page; } } diff --git a/src/library/opus.cpp b/src/library/opus.cpp index d126d68c..ee713f99 100644 --- a/src/library/opus.cpp +++ b/src/library/opus.cpp @@ -691,6 +691,7 @@ template T generic_ctl(encoder& e, int32_t ctl) template T generic_ctl(encoder& e, int32_t ctl, T val) { throwex(opus_encoder_ctl(E(e), ctl, val)); + return val; } template T generic_ctl(decoder& d, int32_t ctl) @@ -703,16 +704,19 @@ template T generic_ctl(decoder& d, int32_t ctl) template T generic_ctl(decoder& d, int32_t ctl, T val) { throwex(opus_decoder_ctl(D(d), ctl, val)); + return val; } template T generic_ctl(multistream_encoder& e, int32_t ctl, T val) { throwex(opus_multistream_encoder_ctl(ME(e), ctl, val)); + return val; } template T generic_ctl(surround_encoder& e, int32_t ctl, T val) { throwex(opus_multistream_encoder_ctl(ME(e), ctl, val)); + return val; } template T generic_ctl(multistream_encoder& e, int32_t ctl) @@ -733,6 +737,7 @@ template T generic_ctl(surround_encoder& e, int32_t ctl) template T generic_ctl(multistream_decoder& d, int32_t ctl, T val) { throwex(opus_multistream_decoder_ctl(MD(d), ctl, val)); + return val; } template T generic_ctl(multistream_decoder& d, int32_t ctl) @@ -1588,7 +1593,7 @@ void multistream_decoder::init_structures(unsigned _channels, unsigned _streams, streams = _streams; coupled = _coupled; opussize = opus_multistream_decoder_get_size(streams, coupled); - for(int32_t i = 0; i < (size_t)streams; i++) { + for(uint32_t i = 0; i < (size_t)streams; i++) { OpusDecoder* d; opus_multistream_decoder_ctl(MD(*this), OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, (int)i, &d); new(substream(i)) decoder(d, i < coupled); @@ -1683,5 +1688,6 @@ uint8_t packet_tick_count(const uint8_t* packet, size_t packetsize) case 2: return x << 1; case 3: return (z <= 48) ? z : 0; }; + return 0; //NOTREACHED. } } diff --git a/src/library/png.cpp b/src/library/png.cpp index 4f91166c..1e33fa7d 100644 --- a/src/library/png.cpp +++ b/src/library/png.cpp @@ -555,7 +555,7 @@ badtype: { public: png_pixel_decoder(png_filterbank& _filter, uint8_t _type, uint8_t _depth, size_t _width) - : filter(_filter), type(_type), depth(_depth), width(_width) + : width(_width), type(_type), depth(_depth), filter(_filter) { tmp.resize((png_filterbank::get_bits(type, depth) * width + 7) / 8); } diff --git a/src/library/rrdata.cpp b/src/library/rrdata.cpp index 194c2f30..a4c7e686 100644 --- a/src/library/rrdata.cpp +++ b/src/library/rrdata.cpp @@ -21,7 +21,7 @@ rrdata_set::instance::instance(const std::string& id) throw() { memset(bytes, 0, RRDATA_BYTES); for(unsigned i = 0; i < id.length() && i < 2 * RRDATA_BYTES; i++) { - unsigned h; + unsigned h = 0; char ch = id[i]; if(ch >= '0' && ch <= '9') h = ch - '0'; @@ -233,7 +233,6 @@ uint64_t rrdata_set::emerg_action(struct rrdata_set::esave_state& state, char* b { uint64_t rsize = 0; size_t lbytes; - unsigned encode_count = 0; state.init(data); while(!state.finished() || state.segptr != state.segend) { if(state.segptr == state.segend) { @@ -358,6 +357,7 @@ uint64_t rrdata_set::count() throw() std::ostream& operator<<(std::ostream& os, const struct rrdata_set::instance& j) { os << hex::b_to(j.bytes, 32, true); + return os; } bool rrdata_set::_add(const instance& b) diff --git a/src/library/streamcompress.cpp b/src/library/streamcompress.cpp index 31a5443f..0a3279a8 100644 --- a/src/library/streamcompress.cpp +++ b/src/library/streamcompress.cpp @@ -30,7 +30,7 @@ base* base::create_compressor(const std::string& name, { if(!compressors().count(name)) throw std::runtime_error("No such compressor"); - compressors()[name](args); + return compressors()[name](args); } void base::do_register(const std::string& name, diff --git a/src/library/zip.cpp b/src/library/zip.cpp index ae45ef83..156a6b29 100644 --- a/src/library/zip.cpp +++ b/src/library/zip.cpp @@ -44,7 +44,7 @@ namespace left_unlimited = true; } - file_input(std::ifstream& _stream, uint32_t size, size_t* _refcnt) + file_input(std::ifstream& _stream, uint64_t size, size_t* _refcnt) : stream(_stream), stream_refcnt(*_refcnt) { stream_refcnt++; @@ -65,7 +65,7 @@ namespace throw std::runtime_error("Can't seek ZIP file"); if(!left_unlimited && left == 0) return -1; - if(!left_unlimited && n > left) + if(!left_unlimited && n > (int64_t)left) n = left; stream.read(s, n); std::streamsize r = stream.gcount(); @@ -99,7 +99,7 @@ namespace size_t& stream_refcnt; std::streamoff position; bool left_unlimited; - uint32_t left; + uint64_t left; private: file_input& operator=(const file_input& f); }; @@ -385,6 +385,7 @@ bool reader::read_linefile(const std::string& member, std::string& out, bool con delete &m; throw; } + return true; } void reader::read_raw_file(const std::string& member, std::vector& out) throw(std::bad_alloc, diff --git a/src/lua/Makefile b/src/lua/Makefile index d636ee3a..c0cdb754 100644 --- a/src/lua/Makefile +++ b/src/lua/Makefile @@ -14,7 +14,7 @@ sysrc.cpp.dep: sysrc.cpp touch sysrc.cpp.dep %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep - $(REALCC) -c -o $@ $< -I../../include $(CFLAGS) + $(REALCC) -c -o $@ $< -I../../include $(CFLAGS) -Wall -Werror precheck: ../../buildaux/mkdeps.exe ../../include -- *.cpp diff --git a/src/lua/actions.cpp b/src/lua/actions.cpp index 6fec28e0..f742143d 100644 --- a/src/lua/actions.cpp +++ b/src/lua/actions.cpp @@ -38,7 +38,7 @@ namespace if(bad) throw std::runtime_error("String does not satisfy constraints."); } else if(r = regex("int:([0-9]+),([0-9]+)", i.model)) { - int64_t low, high, v; + int64_t low, high; try { low = parse_value(r[1]); high = parse_value(r[2]); diff --git a/src/lua/bit.cpp b/src/lua/bit.cpp index 65dfd4ea..e712fede 100644 --- a/src/lua/bit.cpp +++ b/src/lua/bit.cpp @@ -253,8 +253,6 @@ namespace template int bit_ldbinarynumber(lua::state& L, lua::parameters& P) { - T val; - char buffer[sizeof(T)]; size_t pos; const char* str; size_t len; diff --git a/src/lua/gui-arrow.cpp b/src/lua/gui-arrow.cpp index e347aadd..351989e7 100644 --- a/src/lua/gui-arrow.cpp +++ b/src/lua/gui-arrow.cpp @@ -31,12 +31,12 @@ namespace int dx = _dx[direction & 7]; int dy = _dy[direction & 7]; auto drange = drawrange(o); - for(unsigned d = drange.first; d < drange.second; d++) { + for(signed d = drange.first; d < drange.second; d++) { int32_t xc = bpx + dx * d; int32_t yc = bpy + dy * d; - if(xc < 0 || xc >= scr.get_width()) + if(xc < 0 || xc >= (ssize_t)scr.get_width()) continue; - if(yc < 0 || yc >= scr.get_height()) + if(yc < 0 || yc >= (ssize_t)scr.get_height()) continue; color.apply(scr.rowptr(yc)[xc]); } diff --git a/src/lua/gui-bitmap.cpp b/src/lua/gui-bitmap.cpp index e602ba40..60dd07e9 100644 --- a/src/lua/gui-bitmap.cpp +++ b/src/lua/gui-bitmap.cpp @@ -105,6 +105,7 @@ namespace w = b->width; h = b->height; } else { + palette = NULL; //Won't be accessed. w = b2->width; h = b2->height; } @@ -320,6 +321,7 @@ namespace if(oper == "Clear") return PD_CLEAR; if(oper == "Xor") return PD_XOR; (stringfmt() << "Bad Porter-Duff operator '" << oper << "'").throwex(); + return PD_SRC; //NOTREACHED } template struct srcdest_porterduff @@ -512,7 +514,6 @@ namespace int bitmap_load_fn(lua::state& L, std::function src) { - uint32_t w, h; auto bitmap = src(); if(bitmap.d) { lua_dbitmap* b = lua::_class::create(L, bitmap.w, bitmap.h); @@ -665,7 +666,6 @@ namespace cg = parse_value(r[2]); cb = parse_value(r[3]); ca = 256 - parse_value(r[4]); - int64_t clr; if(ca == 256) p->colors.push_back(framebuffer::color(-1)); else @@ -999,7 +999,7 @@ int lua_bitmap::save_png(lua::state& L, lua::parameters& P) bool was_filename; P(P.skipped()); - if(was_filename = P.is_string()) P(name); + if((was_filename = P.is_string())) P(name); if(P.is_string()) P(name2); P(p); @@ -1163,7 +1163,7 @@ template int lua_dbitmap::blit(lua::state& L, lua: xblit_pduff(dest, src, dx, dy, sx, sy, w, h, hscl, vscl, pd_oper); else xblit_dir(dest, src, ckx, dx, dy, sx, sy, w, h, hscl, vscl); - } else { + } else if(src_p) { operand_bitmap_pal src(*P.arg(sidx), *P.arg(spal)); if(porterduff) xblit_pduff(dest, src, dx, dy, sx, sy, w, h, hscl, vscl, pd_oper); @@ -1176,11 +1176,10 @@ template int lua_dbitmap::blit(lua::state& L, lua: int lua_dbitmap::save_png(lua::state& L, lua::parameters& P) { std::string name, name2; - lua_palette* p; bool was_filename; P(P.skipped()); - if(was_filename = P.is_string()) P(name); + if((was_filename = P.is_string())) P(name); if(P.is_string()) P(name2); auto buf = this->save_png(); diff --git a/src/lua/gui-core.cpp b/src/lua/gui-core.cpp index 5c62517d..af7b544f 100644 --- a/src/lua/gui-core.cpp +++ b/src/lua/gui-core.cpp @@ -101,6 +101,7 @@ namespace { if(lua_kill_frame) *lua_kill_frame = true; + return 0; } int set_video_scale(lua::state& L, lua::parameters& P) @@ -113,6 +114,7 @@ namespace *lua_hscl = h; *lua_vscl = v; } + return 0; } lua::functions guicore_fns(lua_func_misc, "gui", { diff --git a/src/lua/gui-rqueue.cpp b/src/lua/gui-rqueue.cpp index d362a132..11db40d0 100644 --- a/src/lua/gui-rqueue.cpp +++ b/src/lua/gui-rqueue.cpp @@ -56,6 +56,7 @@ namespace ptr->bottom_gap = std::numeric_limits::max(); ptr->left_gap = std::numeric_limits::max(); ptr->queue->clear(); + return 0; } int set(lua::state& L, lua::parameters& P) { @@ -68,6 +69,7 @@ namespace saved = lua_render_ctx; lua_render_ctx = last = ptr; redirect = true; + return 0; } int render(lua::state& L, lua::parameters& P) { @@ -80,10 +82,10 @@ namespace fb.set_origin(xoff, yoff); rqueue.run(fb); lua_dbitmap* b = lua::_class::create(L, rwidth, rheight); - for(auto y = 0; y < rheight; y++) { + for(auto y = 0U; y < rheight; y++) { const uint32_t* rowp = fb.rowptr(y); auto rowt = &b->pixels[y * rwidth]; - for(auto x = 0; x < rwidth; x++) { + for(auto x = 0U; x < rwidth; x++) { uint32_t v = rowp[x]; uint64_t c = -1; if(v >> 24) diff --git a/src/lua/gui-text-cf.cpp b/src/lua/gui-text-cf.cpp index 283910ed..51fe9b9e 100644 --- a/src/lua/gui-text-cf.cpp +++ b/src/lua/gui-text-cf.cpp @@ -159,6 +159,7 @@ namespace } } font.add(utf8::to32(text), glyph); + return 0; } int lua_customfont::create(lua::state& L, lua::parameters& P) diff --git a/src/lua/gui-tilemap.cpp b/src/lua/gui-tilemap.cpp index 5a09ab71..93befbe3 100644 --- a/src/lua/gui-tilemap.cpp +++ b/src/lua/gui-tilemap.cpp @@ -296,7 +296,7 @@ namespace P(w, h, px, py); - tilemap* t = lua::_class::create(L, w, h, px, py); + lua::_class::create(L, w, h, px, py); return 1; } diff --git a/src/lua/ibind.cpp b/src/lua/ibind.cpp index 026e4746..d6f34871 100644 --- a/src/lua/ibind.cpp +++ b/src/lua/ibind.cpp @@ -169,7 +169,7 @@ int lua_inverse_bind::create(lua::state& L, lua::parameters& P) P(name, command); - lua_inverse_bind* b = lua::_class::create(L, name, command); + lua::_class::create(L, name, command); return 1; } @@ -183,6 +183,6 @@ int lua_command_bind::create(lua::state& L, lua::parameters& P) lfn2 = P.skip(); else P.expected("function or nil"); - lua_command_bind* b = lua::_class::create(L.get_master(), name, lfn1, lfn2); + lua::_class::create(L.get_master(), name, lfn1, lfn2); return 1; } diff --git a/src/lua/input.cpp b/src/lua/input.cpp index 42c649ca..696c8b00 100644 --- a/src/lua/input.cpp +++ b/src/lua/input.cpp @@ -406,7 +406,7 @@ namespace auto pcid = controls.lcid_to_pcid(i); if(pcid.first < 0) continue; - if(pcid.first == port && pcid.second == controller) { + if(pcid.first == (int)port && pcid.second == (int)controller) { lcid = i + 1; break; } diff --git a/src/lua/inputmovie.cpp b/src/lua/inputmovie.cpp index a17bda8f..f5f76233 100644 --- a/src/lua/inputmovie.cpp +++ b/src/lua/inputmovie.cpp @@ -153,7 +153,7 @@ namespace { controller_frame_vector& v = framevector(L, P); - lua_inputmovie* m = lua::_class::create(L, v); + lua::_class::create(L, v); return 1; } @@ -167,7 +167,7 @@ namespace if(n >= v.size()) throw std::runtime_error("Requested frame outside movie"); controller_frame _f = v[n]; - lua_inputframe* f = lua::_class::create(L, _f); + lua::_class::create(L, _f); return 1; } @@ -197,7 +197,6 @@ namespace int _get_size(lua::state& L, lua::parameters& P) { - int ptr = 1; controller_frame_vector& v = framevector(L, P); L.pushnumber(v.size()); @@ -206,7 +205,6 @@ namespace int _count_frames(lua::state& L, lua::parameters& P) { - int ptr = 1; controller_frame_vector& v = framevector(L, P); L.pushnumber(v.count_frames()); @@ -226,11 +224,10 @@ namespace int _blank_frame(lua::state& L, lua::parameters& P) { - int ptr = 1; controller_frame_vector& v = framevector(L, P); controller_frame _f = v.blank_frame(true); - lua_inputframe* f = lua::_class::create(L, _f); + lua::_class::create(L, _f); return 1; } @@ -308,7 +305,6 @@ namespace else P.expected("number or boolean"); - movie& m = movb.get_movie(); if(&v == movb.get_mfile().input) check_can_edit(port, controller, button, frame); v[frame].axis3(port, controller, button, value); @@ -337,7 +333,6 @@ namespace if(dst > dstv.size() || dst + count < dst) throw std::runtime_error("Destination index out of movie"); - movie& m = movb.get_movie(); if(&dstv == movb.get_mfile().input) check_can_edit(0, 0, 0, dst, true); @@ -370,7 +365,6 @@ namespace if(!file) throw std::runtime_error("Can't open file to write output to"); if(binary) { - uint64_t pages = v.get_page_count(); uint64_t stride = v.get_stride(); uint64_t pageframes = v.get_frames_per_page(); uint64_t vsize = v.size(); diff --git a/src/lua/loadbitmap.cpp b/src/lua/loadbitmap.cpp index 4bd589b9..70a41f6f 100644 --- a/src/lua/loadbitmap.cpp +++ b/src/lua/loadbitmap.cpp @@ -68,6 +68,7 @@ struct lua_loaded_bitmap lua_loaded_bitmap::load(std::istream& file) } if(!file) throw std::runtime_error("Bitmap load: Error reading bitmap"); + return b; } struct lua_loaded_bitmap lua_loaded_bitmap::load(const std::string& name) diff --git a/src/lua/loadfile.cpp b/src/lua/loadfile.cpp index b63ce1be..776038ce 100644 --- a/src/lua/loadfile.cpp +++ b/src/lua/loadfile.cpp @@ -197,6 +197,7 @@ namespace return 1; } else P.expected("number or nil"); + return 0; //NOTREACHED } int lines(lua::state& L, lua::parameters& P) { @@ -222,7 +223,8 @@ namespace } static int lines_helper2(lua_State* L) { - reinterpret_cast(lua_touserdata(L, lua_upvalueindex(1)))->lines_helper(L); + return reinterpret_cast(lua_touserdata(L, lua_upvalueindex(1)))-> + lines_helper(L); } private: std::istream& s; diff --git a/src/lua/lua.cpp b/src/lua/lua.cpp index 580117ab..4bdcee0e 100644 --- a/src/lua/lua.cpp +++ b/src/lua/lua.cpp @@ -70,7 +70,6 @@ namespace void push_keygroup_parameters(lua::state& L, keyboard::key& p) { keyboard::mouse_calibration p2; - keyboard::axis_calibration p3; int mode; L.newtable(); switch(p.get_type()) { diff --git a/src/lua/memory.cpp b/src/lua/memory.cpp index 373d3163..da7c39f5 100644 --- a/src/lua/memory.cpp +++ b/src/lua/memory.cpp @@ -445,8 +445,6 @@ namespace return write ? 0 : 1; } - const char* hexes = "0123456789ABCDEF"; - #define BLOCKSIZE 256 int vma_count(lua::state& L, lua::parameters& P) @@ -507,7 +505,6 @@ namespace int hash_state(lua::state& L, lua::parameters& P) { - char hash[64]; auto x = our_rom.save_core_state(); size_t offset = x.size() - 32; L.pushlstring(hex::b_to((uint8_t*)&x[offset], 32)); diff --git a/src/lua/memory2.cpp b/src/lua/memory2.cpp index ad71703b..e6f4405f 100644 --- a/src/lua/memory2.cpp +++ b/src/lua/memory2.cpp @@ -186,6 +186,7 @@ namespace if(i->name == vma) return handle_push_vma(L, *i); (stringfmt() << P.get_fname() << ": Stale region").throwex(); + return 0; //NOTREACHED } template int lua_vma::rw(lua::state& L, lua::parameters& P) @@ -213,6 +214,7 @@ namespace return 0; } else P.expected("number or nil"); + return 0; //NOTREACHED } template int lua_vma::scattergather(lua::state& L, lua::parameters& P) @@ -250,7 +252,6 @@ namespace template int lua_vma::hash(lua::state& L, lua::parameters& P) { uint64_t addr, size, rows, stride = 0; - bool equals = true; P(P.skipped(), addr, size, P.optional(rows, 1)); if(rows > 1) P(stride); @@ -353,6 +354,7 @@ namespace L.pop(1); } } + return 0; } template int lua_vma::storecmp(lua::state& L, lua::parameters& P) @@ -475,6 +477,7 @@ namespace return 1; } (stringfmt() << P.get_fname() << ": No such VMA").throwex(); + return 0; //NOTREACHED } int lua_vma_list::newindex(lua::state& L, lua::parameters& P) diff --git a/src/lua/zip.cpp b/src/lua/zip.cpp index ed18e707..fc8e3bb6 100644 --- a/src/lua/zip.cpp +++ b/src/lua/zip.cpp @@ -34,6 +34,7 @@ namespace w->commit(); delete w; w = NULL; + return 0; } int rollback(lua::state& L, lua::parameters& P) { @@ -41,6 +42,7 @@ namespace delete w; w = NULL; + return 0; } int close_file(lua::state& L, lua::parameters& P) { @@ -49,6 +51,7 @@ namespace w->close_file(); file_open = NULL; + return 0; } int create_file(lua::state& L, lua::parameters& P) { @@ -63,6 +66,7 @@ namespace file_open = NULL; } file_open = &w->create_file(filename); + return 0; } int write(lua::state& L, lua::parameters& P) { @@ -76,6 +80,7 @@ namespace std::vector data(_data.length()); std::copy(_data.begin(), _data.end(), data.begin()); file_open->write(&data[0], data.size()); + return 0; } std::string print() { diff --git a/src/platform/evdev/Makefile b/src/platform/evdev/Makefile index 82556a09..93826fcc 100644 --- a/src/platform/evdev/Makefile +++ b/src/platform/evdev/Makefile @@ -11,7 +11,7 @@ __all__.files: $(OBJECTS) touch __all__.ldflags %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep - $(REALCC) -c -o $@ $< -I../../../include $(CFLAGS) + $(REALCC) -c -o $@ $< -I../../../include $(CFLAGS) -Wall -Werror precheck: ../../../buildaux/mkdeps.exe ../../../include -- *.cpp diff --git a/src/platform/portaudio/Makefile b/src/platform/portaudio/Makefile index 11f45f52..da25fde4 100644 --- a/src/platform/portaudio/Makefile +++ b/src/platform/portaudio/Makefile @@ -14,7 +14,7 @@ __all__.files: $(OBJECTS) echo $(PA_LDFLAGS) >__all__.ldflags %.$(OBJECT_SUFFIX): %.cpp %.cpp.dep - $(REALCC) -c -o $@ $< -I../../../include $(CFLAGS) $(PA_CFLAGS) + $(REALCC) -c -o $@ $< -I../../../include $(CFLAGS) $(PA_CFLAGS) -Wall -Werror precheck: ../../../buildaux/mkdeps.exe ../../../include -- *.cpp diff --git a/src/platform/wxwidgets/Makefile b/src/platform/wxwidgets/Makefile index d7072e0f..a35919e0 100644 --- a/src/platform/wxwidgets/Makefile +++ b/src/platform/wxwidgets/Makefile @@ -1,6 +1,6 @@ ifeq ($(GRAPHICS), WXWIDGETS) OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) -WXW_CFLAGS += $(shell $(CROSS_PREFIX)wx-config --cxxflags) $(shell $(CROSS_PREFIX)pkg-config libswscale --cflags) +WXW_CFLAGS += $(shell $(CROSS_PREFIX)wx-config --cxxflags) $(shell $(CROSS_PREFIX)pkg-config libswscale --cflags) -Wall -Werror WXW_LDFLAGS += $(shell $(CROSS_PREFIX)wx-config --libs) $(shell $(CROSS_PREFIX)pkg-config libswscale --libs) else OBJECTS = diff --git a/src/platform/wxwidgets/editor-action.cpp b/src/platform/wxwidgets/editor-action.cpp index d39216b6..ef76b857 100644 --- a/src/platform/wxwidgets/editor-action.cpp +++ b/src/platform/wxwidgets/editor-action.cpp @@ -46,14 +46,15 @@ wxeditor_action::wxeditor_action(wxWindow* parent, const std::string& label, if(r = regex("string(:(.*))?", i.model)) { wxBoxSizer* tmp1 = new wxBoxSizer(wxHORIZONTAL); tmp1->Add(new wxStaticText(this, wxID_ANY, towxstring(i.name)), 0, wxGROW); - wxTextCtrl* tmp2 = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(200, -1)); + wxTextCtrl* tmp2 = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, + wxSize(200, -1)); controls.push_back(tmp2); tmp1->Add(tmp2, 1, wxGROW); tmp2->Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(wxeditor_action::on_change), NULL, this); top_s->Add(tmp1, 0, wxGROW); } else if(r = regex("int:(-?[0-9]+),(-?[0-9]+)", i.model)) { - int64_t low, high, v; + int64_t low, high; try { low = parse_value(r[1]); high = parse_value(r[2]); diff --git a/src/platform/wxwidgets/editor-authors.cpp b/src/platform/wxwidgets/editor-authors.cpp index 9509bb08..c12196a0 100644 --- a/src/platform/wxwidgets/editor-authors.cpp +++ b/src/platform/wxwidgets/editor-authors.cpp @@ -212,7 +212,7 @@ void wxeditor_authors::on_ok(wxCommandEvent& e) newauthors.push_back(split_author(l)); } if(luascripts) - for(int i = 0; i < luascripts->GetCount(); i++) + for(unsigned i = 0; i < luascripts->GetCount(); i++) luascriptlist.push_back(tostdstring(luascripts->GetString(i))); bool run_new = autorunlua ? autorunlua->GetValue() : false; @@ -334,6 +334,7 @@ void wxeditor_authors_display(wxWindow* parent) editor = new wxeditor_authors(parent); editor->ShowModal(); } catch(...) { + return; } editor->Destroy(); } diff --git a/src/platform/wxwidgets/editor-autohold.cpp b/src/platform/wxwidgets/editor-autohold.cpp index 2419d0a8..28e5d6bc 100644 --- a/src/platform/wxwidgets/editor-autohold.cpp +++ b/src/platform/wxwidgets/editor-autohold.cpp @@ -174,7 +174,6 @@ void wxeditor_autohold::update_controls() std::map next_in_class; controller_frame model = controls.get_blank(); const port_type_set& pts = model.porttypes(); - unsigned pcnt = pts.ports(); unsigned cnum_g = 0; for(unsigned i = 0;; i++) { auto pcid = controls.lcid_to_pcid(i); @@ -182,7 +181,7 @@ void wxeditor_autohold::update_controls() break; const port_type& pt = pts.port_type(pcid.first); const port_controller_set& pci = *(pt.controller_info); - if(pci.controllers.size() <= pcid.second) + if((ssize_t)pci.controllers.size() <= pcid.second) continue; const port_controller& pc = pci.controllers[pcid.second]; //First check that this has non-hidden buttons. @@ -219,8 +218,8 @@ void wxeditor_autohold::update_controls() }); int next_id = wxID_HIGHEST + 1; unsigned last_logical = 0xFFFFFFFFUL; - wxSizer* current; - wxPanel* current_p; + wxSizer* current = NULL; + wxPanel* current_p = NULL; wxSizer* current_t = NULL; for(auto i : _autoholds) { if(i.logical != last_logical) { diff --git a/src/platform/wxwidgets/editor-conflict.cpp b/src/platform/wxwidgets/editor-conflict.cpp index 133806ec..8f9fb840 100644 --- a/src/platform/wxwidgets/editor-conflict.cpp +++ b/src/platform/wxwidgets/editor-conflict.cpp @@ -154,6 +154,7 @@ void show_conflictwindow(wxWindow* parent) editor = new wxeditor_conflict(parent); editor->ShowModal(); } catch(...) { + return; } editor->Destroy(); } diff --git a/src/platform/wxwidgets/editor-hexedit.cpp b/src/platform/wxwidgets/editor-hexedit.cpp index 7976212b..a17e5199 100644 --- a/src/platform/wxwidgets/editor-hexedit.cpp +++ b/src/platform/wxwidgets/editor-hexedit.cpp @@ -549,7 +549,7 @@ public: size = j->size; } } - if(ent.sel >= size || ent.scroll >= (size + 15) / 16) + if(ent.sel >= size || ent.scroll >= (ssize_t)((size + 15) / 16)) goto invalid_bookmark; current_vma = r; regionmenu->FindItem(wxID_REGIONS_FIRST + current_vma)->Check(); @@ -674,7 +674,7 @@ invalid_bookmark: std::string vma = "(none)"; if(it) vma = tostdstring(it->GetItemLabelText()); unsigned addrlen = 1; - while(hpanel->vmasize > (1 << (4 * addrlen))) + while(hpanel->vmasize > (1ULL << (4 * addrlen))) addrlen++; std::string addr = (stringfmt() << std::hex << std::setw(addrlen) << std::setfill('0') << hpanel->seloff).str(); @@ -788,7 +788,7 @@ invalid_bookmark: runemufn([_vmabase, _vmasize, paint_offset, _seloff, _value, _lines, this]() { memory_search* memsearch = wxwindow_memorysearch_active(); //Paint the stuff - for(size_t j = 0; j < _lines; j++) { + for(ssize_t j = 0; j < _lines; j++) { uint64_t addr = paint_offset + j * 16; if(addr >= _vmasize) { //Past-the-end. @@ -811,7 +811,7 @@ invalid_bookmark: uint32_t fg = 0; uint32_t bg = 0xFFFFFF; bool candidate = (memsearch && memsearch->is_candidate(laddr + i)); - if(candidate) bg = bg & 0xC0C0C0 | 0x3F0000; + if(candidate) bg = (bg & 0xC0C0C0) | 0x3F0000; if(addr + i == _seloff) std::swap(fg, bg); uint8_t b = lsnes_memory.read(laddr + i); @@ -923,4 +923,5 @@ bool wxeditor_hexeditor_jumpto(uint64_t addr) { if(editor) editor->jumpto(addr); + return editor; } diff --git a/src/platform/wxwidgets/editor-macro.cpp b/src/platform/wxwidgets/editor-macro.cpp index 15fb9d94..49acd762 100644 --- a/src/platform/wxwidgets/editor-macro.cpp +++ b/src/platform/wxwidgets/editor-macro.cpp @@ -430,6 +430,7 @@ bool wxeditor_macro::do_edit(const std::string& mname, controller_macro& m) if(ret) m = editor->get_macro(); } catch(...) { + return false; } editor->Destroy(); return ret; @@ -443,6 +444,7 @@ void wxeditor_macro_display(wxWindow* parent) editor = new wxeditor_macro(parent); editor->ShowModal(); } catch(...) { + return; } editor->Destroy(); } diff --git a/src/platform/wxwidgets/editor-memorywatch.cpp b/src/platform/wxwidgets/editor-memorywatch.cpp index bd326e1b..0d16c5f6 100644 --- a/src/platform/wxwidgets/editor-memorywatch.cpp +++ b/src/platform/wxwidgets/editor-memorywatch.cpp @@ -357,6 +357,7 @@ lsnes_memorywatch_printer::position_category wxeditor_memorywatch::get_poscatego if(position->GetSelection() == 0) return lsnes_memorywatch_printer::PC_DISABLED; if(position->GetSelection() == 1) return lsnes_memorywatch_printer::PC_MEMORYWATCH; if(position->GetSelection() == 2) return lsnes_memorywatch_printer::PC_ONSCREEN; + return lsnes_memorywatch_printer::PC_DISABLED; //NOTREACHED. } void wxeditor_memorywatch::enable_for_pos(lsnes_memorywatch_printer::position_category p) @@ -686,6 +687,7 @@ void wxeditor_memorywatches_display(wxWindow* parent) editor = new wxeditor_memorywatches(parent); editor->ShowModal(); } catch(...) { + return; } editor->Destroy(); } diff --git a/src/platform/wxwidgets/editor-movie.cpp b/src/platform/wxwidgets/editor-movie.cpp index 97f6c705..ba084155 100644 --- a/src/platform/wxwidgets/editor-movie.cpp +++ b/src/platform/wxwidgets/editor-movie.cpp @@ -595,6 +595,7 @@ namespace int32_t cc2 = (dim - 1 - cc); return (val * (int64_t)cc2 + (rmax / 2)) / rmax + cc; } + return 0; //NOTREACHED. } int32_t coordinate_to_value(int32_t rmin, int32_t rmax, int32_t val, int32_t dim) @@ -616,6 +617,7 @@ namespace uint32_t cc2 = (dim - 1 - cc); return ((rmax - center) * (int64_t)(val - cc) + cc2 / 2) / cc2 + center; } + return 0; //NOTREACHED. } std::string windowname(control_info X, control_info Y) @@ -1490,7 +1492,7 @@ void wxeditor_movie::_moviepanel::do_scroll_to_frame() wxMessageBox(wxT("Invalid value"), _T("Error"), wxICON_EXCLAMATION | wxOK, m); return; } - uint64_t wouldbe; + uint64_t wouldbe = 0; uint64_t low = 0; uint64_t high = max_subframe; while(low < high) { @@ -1913,7 +1915,7 @@ void wxeditor_movie::_moviepanel::on_mouse2(unsigned x, unsigned y, bool polarit enable_cut_frame = (!not_editable && press_line >= econtroller_low && press_line < linecount && rpress_line >= econtroller_low && rpress_line < linecount && !click_zero); else - enable_cut_frame = (!not_editable && press_line >= eframe_low & press_line < linecount + enable_cut_frame = (!not_editable && press_line >= eframe_low && press_line < linecount && rpress_line >= eframe_low && rpress_line < linecount); if(clicked_button && clipboard_get_data_type() == 0) { enable_paste_append = (!not_editable && linecount >= eframe_low); @@ -1921,7 +1923,7 @@ void wxeditor_movie::_moviepanel::on_mouse2(unsigned x, unsigned y, bool polarit && rpress_line >= econtroller_low && rpress_line < linecount && !click_zero); } else if(clipboard_get_data_type() == 1) { enable_paste_append = (!not_editable && linecount >= econtroller_low); - enable_paste_frame = (!not_editable && press_line >= eframe_low & press_line < linecount + enable_paste_frame = (!not_editable && press_line >= eframe_low && press_line < linecount && rpress_line >= eframe_low && rpress_line < linecount); } //Copy frames is enabled if range exists. diff --git a/src/platform/wxwidgets/editor-multitrack.cpp b/src/platform/wxwidgets/editor-multitrack.cpp index 16797a74..f0c6ca90 100644 --- a/src/platform/wxwidgets/editor-multitrack.cpp +++ b/src/platform/wxwidgets/editor-multitrack.cpp @@ -165,7 +165,6 @@ void wxeditor_multitrack::update_controls() controller_frame model = controls.get_blank(); const port_type_set& pts = model.porttypes(); typeset = &pts; - unsigned pcnt = pts.ports(); unsigned cnum_g = 0; for(unsigned i = 0;; i++) { auto pcid = controls.lcid_to_pcid(i); @@ -173,7 +172,7 @@ void wxeditor_multitrack::update_controls() break; const port_type& pt = pts.port_type(pcid.first); const port_controller_set& pci = *(pt.controller_info); - if(pci.controllers.size() <= pcid.second) + if((ssize_t)pci.controllers.size() <= pcid.second) continue; const port_controller& pc = pci.controllers[pcid.second]; //First check that this has non-hidden stuff. diff --git a/src/platform/wxwidgets/editor-plugin.cpp b/src/platform/wxwidgets/editor-plugin.cpp index 172b9470..85d19ffe 100644 --- a/src/platform/wxwidgets/editor-plugin.cpp +++ b/src/platform/wxwidgets/editor-plugin.cpp @@ -137,7 +137,7 @@ void wxeditor_plugins::reload_plugins() { int sel = plugins->GetSelection(); std::string name; - if(sel == wxNOT_FOUND || sel >= pluginstbl.size()) + if(sel == wxNOT_FOUND || sel >= (ssize_t)pluginstbl.size()) name = ""; else name = pluginstbl[sel].first; @@ -165,7 +165,6 @@ void wxeditor_plugins::reload_plugins() plugins->Append(towxstring(r1 + attributes)); } - bool found = false; for(size_t i = 0; i < pluginstbl.size(); i++) { if(pluginstbl[i].first == name) plugins->SetSelection(i); @@ -177,7 +176,7 @@ void wxeditor_plugins::reload_plugins() void wxeditor_plugins::on_selection_change(wxCommandEvent& e) { int sel = plugins->GetSelection(); - if(sel == wxNOT_FOUND || sel >= pluginstbl.size()) { + if(sel == wxNOT_FOUND || sel >= (ssize_t)pluginstbl.size()) { renamebutton->Enable(false); enablebutton->Enable(false); deletebutton->Enable(false); @@ -276,7 +275,7 @@ void wxeditor_plugins::on_add(wxCommandEvent& e) void wxeditor_plugins::on_rename(wxCommandEvent& e) { int sel = plugins->GetSelection(); - if(sel == wxNOT_FOUND || sel >= pluginstbl.size()) + if(sel == wxNOT_FOUND || sel >= (ssize_t)pluginstbl.size()) return; std::string name = pluginstbl[sel].first; std::string name2; @@ -303,7 +302,7 @@ void wxeditor_plugins::on_rename(wxCommandEvent& e) void wxeditor_plugins::on_enable(wxCommandEvent& e) { int sel = plugins->GetSelection(); - if(sel == wxNOT_FOUND || sel >= pluginstbl.size()) + if(sel == wxNOT_FOUND || sel >= (ssize_t)pluginstbl.size()) return; try { if(pluginstbl[sel].second) @@ -323,7 +322,7 @@ void wxeditor_plugins::on_enable(wxCommandEvent& e) void wxeditor_plugins::on_delete(wxCommandEvent& e) { int sel = plugins->GetSelection(); - if(sel == wxNOT_FOUND || sel >= pluginstbl.size()) + if(sel == wxNOT_FOUND || sel >= (ssize_t)pluginstbl.size()) return; std::string oname = pathpfx + "/" + pluginstbl[sel].first + "." + extension; if(remove(oname.c_str()) < 0) { @@ -368,6 +367,7 @@ bool wxeditor_plugin_manager_display(wxWindow* parent) editor = new wxeditor_plugins(parent); r = editor->ShowModal(); } catch(...) { + return false; } editor->Destroy(); if(hld) delete hld; diff --git a/src/platform/wxwidgets/editor-tasinput.cpp b/src/platform/wxwidgets/editor-tasinput.cpp index cf596608..a1367ac7 100644 --- a/src/platform/wxwidgets/editor-tasinput.cpp +++ b/src/platform/wxwidgets/editor-tasinput.cpp @@ -58,6 +58,7 @@ namespace int32_t cc2 = (dim - 1 - cc); return (val * (int64_t)cc2 + (rmax / 2)) / rmax + cc; } + return 0; //NOTREACHED. } int32_t coordinate_to_value(int32_t rmin, int32_t rmax, int32_t val, int32_t dim) @@ -78,6 +79,7 @@ namespace uint32_t cc2 = (dim - 1 - cc); return ((rmax - center) * (int64_t)(val - cc) + cc2 / 2) / cc2 + center; } + return 0; //NOTREACHED. } } @@ -215,8 +217,6 @@ void wxeditor_tasinput::xypanel::on_click(wxMouseEvent& e) if(!e.Dragging() && !e.LeftDown()) return; wxCommandEvent e2(0, wxid); - unsigned xrange = t.xmax - t.xmin; - unsigned yrange = t.ymax - t.ymin; wxSize ps = graphics->GetSize(); x = coordinate_to_value(t.xmin, t.xmax, e.GetX(), ps.GetWidth()); y = coordinate_to_value(t.ymin, t.ymax, e.GetY(), ps.GetHeight()); @@ -389,7 +389,6 @@ void wxeditor_tasinput::update_controls() std::map next_in_class; controller_frame model = controls.get_blank(); const port_type_set& pts = model.porttypes(); - unsigned pcnt = pts.ports(); unsigned cnum_g = 0; for(unsigned i = 0;; i++) { auto pcid = controls.lcid_to_pcid(i); @@ -397,7 +396,7 @@ void wxeditor_tasinput::update_controls() break; const port_type& pt = pts.port_type(pcid.first); const port_controller_set& pci = *(pt.controller_info); - if(pci.controllers.size() <= pcid.second) + if((ssize_t)pci.controllers.size() <= pcid.second) continue; const port_controller& pc = pci.controllers[pcid.second]; //First check that this has non-hidden stuff. @@ -468,8 +467,8 @@ void wxeditor_tasinput::update_controls() }); int next_id = wxID_HIGHEST + 1; unsigned last_logical = 0xFFFFFFFFUL; - wxSizer* current; - wxPanel* current_p; + wxSizer* current = NULL; + wxPanel* current_p = NULL; for(auto i : _inputs) { if(i.logical != last_logical) { //New controller starts. diff --git a/src/platform/wxwidgets/mainwindow.cpp b/src/platform/wxwidgets/mainwindow.cpp index 1719967a..7c8ef66d 100644 --- a/src/platform/wxwidgets/mainwindow.cpp +++ b/src/platform/wxwidgets/mainwindow.cpp @@ -247,7 +247,7 @@ namespace hashing_in_progress = true; hashing_left = left; hashing_total = total; - uint64_t this_update = get_utime(); + int64_t this_update = get_utime(); if(this_update < last_update - 1000000 || this_update > last_update + 1000000) { runuifun([mwin]() { if(mwin) mwin->notify_update_status(); }); last_update = this_update; diff --git a/src/platform/wxwidgets/memorysearch.cpp b/src/platform/wxwidgets/memorysearch.cpp index 8fe419f1..6df8a512 100644 --- a/src/platform/wxwidgets/memorysearch.cpp +++ b/src/platform/wxwidgets/memorysearch.cpp @@ -732,7 +732,7 @@ void wxwindow_memorysearch::panel::prepare_paint() } if(addr_count <= CANDIDATE_LIMIT) { std::list addrs2 = ms->get_candidates(); - long j = 0; + unsigned long j = 0; for(auto i : addrs2) { std::string row = hex::to(i) + " "; row += (_parent->*displays[_parent->typecode])(i, _parent->hexmode, false); @@ -802,7 +802,6 @@ void wxwindow_memorysearch::dump_candidates_text() auto ms = msearch; runemufn([ms, this, &out]() { std::list addrs2 = ms->get_candidates(); - long j = 0; for(auto i : addrs2) { std::string row = hex::to(i) + " "; row += (this->*displays[this->typecode])(i, this->hexmode, false); @@ -1011,7 +1010,7 @@ void wxwindow_memorysearch::on_button_click(wxCommandEvent& e) start = act_line; end = act_line + 1; } - for(long r = start; r < end; r++) { + for(uint64_t r = start; r < end; r++) { if(!addresses.count(r)) continue; uint64_t addr = addresses[r]; @@ -1048,7 +1047,7 @@ void wxwindow_memorysearch::on_button_click(wxCommandEvent& e) end = act_line + 1; } push_undo(); - for(long r = start; r < end; r++) { + for(uint64_t r = start; r < end; r++) { if(!addresses.count(r)) return; uint64_t addr = addresses[r]; @@ -1078,7 +1077,7 @@ void wxwindow_memorysearch::on_button_click(wxCommandEvent& e) start = act_line; end = act_line + 1; } - for(long r = start; r < end; r++) { + for(uint64_t r = start; r < end; r++) { if(!addresses.count(r)) continue; uint64_t addr = addresses[r]; @@ -1095,13 +1094,14 @@ void wxwindow_memorysearch::on_button_click(wxCommandEvent& e) start = act_line; end = act_line + 1; } - for(long r = start; r < end; r++) { + for(uint64_t r = start; r < end; r++) { if(!addresses.count(r)) continue; wxeditor_hexeditor_jumpto(addresses[r]); return; } - } else if(id >= wxID_BUTTONS_BASE && id < wxID_BUTTONS_BASE + (sizeof(searchtbl)/sizeof(searchtbl[0]))) { + } else if(id >= wxID_BUTTONS_BASE && id < wxID_BUTTONS_BASE + + (ssize_t)(sizeof(searchtbl)/sizeof(searchtbl[0]))) { int button = id - wxID_BUTTONS_BASE; push_undo(); uint64_t old_count = msearch->get_candidate_count(); diff --git a/src/platform/wxwidgets/requestrom.cpp b/src/platform/wxwidgets/requestrom.cpp index 32ee1c3f..8e465bb1 100644 --- a/src/platform/wxwidgets/requestrom.cpp +++ b/src/platform/wxwidgets/requestrom.cpp @@ -269,7 +269,7 @@ namespace } //TODO: Handle files inside ZIP files. hashfutures[i] = lsnes_image_hasher(filename, fileimage::std_headersize_fn(header)); - if(hash_ready[i] = hashfutures[i].ready()) + if((hash_ready[i] = hashfutures[i].ready())) try { hashes[i]->SetLabel(towxstring("Hash: " + hashfutures[i].read())); } catch(std::runtime_error& e) { diff --git a/src/platform/wxwidgets/romselect.cpp b/src/platform/wxwidgets/romselect.cpp index e4bfb99f..8755f157 100644 --- a/src/platform/wxwidgets/romselect.cpp +++ b/src/platform/wxwidgets/romselect.cpp @@ -190,7 +190,7 @@ namespace c2_s->Add(new wxStaticText(this, wxID_ANY, wxT("Memory watch:")), 0, wxGROW); c2_s->Add(memwatch = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(350, -1)), 1, wxGROW); - wxButton* pdir; + c2_s->Add(swatch = new wxButton(this, wxID_ANY, wxT("...")), 1, wxGROW); swatch->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxwin_newproject::on_memorywatch_select), NULL, this); diff --git a/src/platform/wxwidgets/settings-advanced.cpp b/src/platform/wxwidgets/settings-advanced.cpp index 39767997..c87b2f7b 100644 --- a/src/platform/wxwidgets/settings-advanced.cpp +++ b/src/platform/wxwidgets/settings-advanced.cpp @@ -23,7 +23,7 @@ namespace struct listener : public settingvar::listener { listener(settingvar::group& group, wxeditor_esettings_advanced& _obj) - : grp(group), obj(_obj) + : obj(_obj), grp(group) { group.add_listener(*this); } @@ -188,7 +188,6 @@ namespace d->Destroy(); } void on_button(wxCommandEvent& e) { - wxDirDialog* d; switch(e.GetId()) { case wxID_OK: case wxID_CANCEL: @@ -353,7 +352,8 @@ namespace for(auto i : settings) sort.insert(std::make_pair(names[i], i)); for(auto i : sort) { - auto description = lsnes_vsetc.get_description(i.second); + //FIXME: Do something with this? + //auto description = lsnes_vsetc.get_description(i.second); strings.push_back(towxstring(names[i.second] + " (Value: " + values[i.second] + ")")); selections[k++] = i.second; } diff --git a/src/platform/wxwidgets/settings-common.cpp b/src/platform/wxwidgets/settings-common.cpp index 2db45027..14ada618 100644 --- a/src/platform/wxwidgets/settings-common.cpp +++ b/src/platform/wxwidgets/settings-common.cpp @@ -35,15 +35,14 @@ std::list settings_tab_factory::factories() settings_menu::settings_menu(wxWindow* win, int id) { parent = win; - wxMenuItem* n; items[id] = NULL; - n = Append(id, towxstring("All as tabs...")); + Append(id, towxstring("All as tabs...")); win->Connect(id++, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(settings_menu::on_selected), NULL, this); AppendSeparator(); for(auto i : settings_tab_factory::factories()) { items[id] = i; - n = Append(id, towxstring(i->get_name() + "...")); + Append(id, towxstring(i->get_name() + "...")); win->Connect(id++, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(settings_menu::on_selected), NULL, this); } @@ -210,6 +209,7 @@ void display_settings_dialog(wxWindow* parent, settings_tab_factory* singletab) } editor->ShowModal(); } catch(...) { + return; } dlg = NULL; editor->Destroy(); diff --git a/src/platform/wxwidgets/settings-controllers.cpp b/src/platform/wxwidgets/settings-controllers.cpp index f0ea8075..ac5e1893 100644 --- a/src/platform/wxwidgets/settings-controllers.cpp +++ b/src/platform/wxwidgets/settings-controllers.cpp @@ -38,7 +38,6 @@ namespace { wxSizer* top_s = new wxBoxSizer(wxVERTICAL); SetSizer(top_s); - wxString empty[1]; top_s->Add(controls = new wxTreeCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT | wxTR_LINES_AT_ROOT), 1, wxGROW); diff --git a/src/platform/wxwidgets/settings-joysticks.cpp b/src/platform/wxwidgets/settings-joysticks.cpp index fe4d1fce..bae203ce 100644 --- a/src/platform/wxwidgets/settings-joysticks.cpp +++ b/src/platform/wxwidgets/settings-joysticks.cpp @@ -141,7 +141,7 @@ namespace { public: joystick_panel(wxWindow* parent, unsigned jid, gamepad::pad& gp) - : text_framebuffer_panel(parent, 60, 32, -1, NULL), _gp(gp), _jid(jid) + : text_framebuffer_panel(parent, 60, 32, -1, NULL), _jid(jid), _gp(gp) { const unsigned pwidth = 80; const unsigned b_perrow = 8; diff --git a/src/platform/wxwidgets/settings-video.cpp b/src/platform/wxwidgets/settings-video.cpp index 8d77aaac..ed049a0a 100644 --- a/src/platform/wxwidgets/settings-video.cpp +++ b/src/platform/wxwidgets/settings-video.cpp @@ -61,7 +61,6 @@ namespace for(size_t i = 0; i < sizeof(orientations)/sizeof(orientations[0]); i++) orients.push_back(towxstring(orientations[i])); - wxButton* tmp; top_s = new wxFlexGridSizer(4, 2, 0, 0); SetSizer(top_s); top_s->Add(new wxStaticText(this, -1, wxT("Scale %: ")), 0, wxGROW); @@ -98,7 +97,6 @@ namespace { std::vector sa_choices; std::string v; - int newflags = 1; for(size_t i = 0; i < sizeof(scalealgo_choices) / sizeof(scalealgo_choices[0]); i++) sa_choices.push_back(scalealgo_choices[i]); std::string name; diff --git a/src/platform/wxwidgets/tracelogger.cpp b/src/platform/wxwidgets/tracelogger.cpp index 18385a7e..87048df2 100644 --- a/src/platform/wxwidgets/tracelogger.cpp +++ b/src/platform/wxwidgets/tracelogger.cpp @@ -279,7 +279,7 @@ namespace case 'b': endian->SetSelection(3); break; } } else { - int j = 0; + unsigned j = 0; //Set default disasm. for(auto& i : disasms) { if(i == dflt_lang) @@ -312,7 +312,7 @@ namespace std::string dialog_disassemble::get_disassembler() { - if(type->GetSelection() >= code_types && type->GetSelection() < type->GetCount()) { + if(type->GetSelection() >= (ssize_t)code_types && type->GetSelection() < (ssize_t)type->GetCount()) { int _endian = endian->GetSelection(); int dtsel = type->GetSelection() - code_types; std::string _vma = tostdstring(vma->GetStringSelection()); @@ -345,7 +345,6 @@ namespace uint64_t dialog_disassemble::get_address() { - bool found; uint64_t base = 0; if(vma->GetSelection() && vma->GetSelection() != wxNOT_FOUND) { std::string _vma = tostdstring(vma->GetStringSelection()); @@ -379,7 +378,8 @@ namespace } is_ok = is_ok && (type->GetSelection() != wxNOT_FOUND); is_ok = is_ok && (vma->GetSelection() != wxNOT_FOUND); - endian->Enable(type->GetSelection() >= code_types && type->GetSelection() < type->GetCount()); + endian->Enable(type->GetSelection() >= (ssize_t)code_types && type->GetSelection() < + (ssize_t)type->GetCount()); is_ok = is_ok && (!endian->IsEnabled() || endian->GetSelection() != wxNOT_FOUND); //If VMA is global, ensure there is valid endian. is_ok = is_ok && (vma->GetSelection() != 0 || !endian->IsEnabled() || endian->GetSelection() != 0); @@ -1272,7 +1272,7 @@ back: std::string to = pick_text(this, "Goto", "Enter address to go to:", ""); runemufn_async([this, to]() { uint64_t addr; - uint64_t base; + uint64_t base = 0; std::string vma; std::string offset; std::string _to = to; @@ -1312,7 +1312,7 @@ back: } addr += base; runuifun([this, addr]() { - uint64_t nrow; + uint64_t nrow = 0; uint64_t low = 0; uint64_t high = this->panel->rows.size(); while(low < high && low < high - 1) { @@ -1337,7 +1337,7 @@ back: //Binary search for the element to remove. size_t low = 0; size_t high = v.size(); - size_t mid; + size_t mid = 0; while(low < high) { mid = (low + high) / 2; if(v[mid] < e) @@ -1471,7 +1471,7 @@ back: //Binary search for the gap to insert to. size_t low = 0; size_t high = v.size(); - size_t mid; + size_t mid = 0; while(low < high) { mid = (low + high) / 2; int s1 = sign_compare(v[mid], e); diff --git a/src/platform/wxwidgets/window-fileupload.cpp b/src/platform/wxwidgets/window-fileupload.cpp index 872e6681..03df18de 100644 --- a/src/platform/wxwidgets/window-fileupload.cpp +++ b/src/platform/wxwidgets/window-fileupload.cpp @@ -104,7 +104,6 @@ public: cancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxwin_gameselect::on_cancel), NULL, this); top_s->Add(pbutton_s, 0, wxGROW); - wxBoxSizer* button_s = new wxBoxSizer(wxHORIZONTAL); auto dsplit = split_name(dflt); bool wrong_default = (dflt != NO_GAME_NAME && system != "" && dsplit.first != system); @@ -515,7 +514,7 @@ void wxeditor_uploadtargets::refresh() x = i.first; if(x != wxNOT_FOUND) list->SetSelection(x); - } else if(sel < list->GetCount()) + } else if(sel < (signed)list->GetCount()) list->SetSelection(sel); } diff --git a/src/util/lsnes-dumpavi.cpp b/src/util/lsnes-dumpavi.cpp index 25187b3e..099e3772 100644 --- a/src/util/lsnes-dumpavi.cpp +++ b/src/util/lsnes-dumpavi.cpp @@ -42,7 +42,7 @@ namespace } hashing_in_progress = true; hashing_left = left; - uint64_t this_update = get_utime(); + int64_t this_update = get_utime(); if(this_update < last_update - 1000000 || this_update > last_update + 1000000) { std::cout << ((hashing_left + 524288) >> 20) << "..." << std::flush; last_update = this_update; diff --git a/src/util/lsnes-romloadtest.cpp b/src/util/lsnes-romloadtest.cpp index fc743777..123f7f31 100644 --- a/src/util/lsnes-romloadtest.cpp +++ b/src/util/lsnes-romloadtest.cpp @@ -42,7 +42,7 @@ namespace } hashing_in_progress = true; hashing_left = left; - uint64_t this_update = get_utime(); + int64_t this_update = get_utime(); if(this_update < last_update - 1000000 || this_update > last_update + 1000000) { std::cout << ((hashing_left + 524288) >> 20) << "..." << std::flush; last_update = this_update;