Make compiler more anal and fix what comes up

Probably got multiple Lua crash bugs...
This commit is contained in:
Ilari Liusvaara 2014-03-29 20:43:58 +02:00
parent c50c458bd1
commit 4a027d5f4e
106 changed files with 253 additions and 218 deletions

View file

@ -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;

View file

@ -232,6 +232,7 @@ template<class T> 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)

View file

@ -194,7 +194,6 @@ template<typename T> T read_endian(const void* value, int endian)
template<typename T> void write_endian(void* value, const T& val, int endian)
{
T val2;
memcpy(value, &val, sizeof(T));
swap_endian(*reinterpret_cast<T*>(value), endian);
}

View file

@ -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;

View file

@ -86,12 +86,14 @@ public:
*/
lambda_output_iterator<T>& operator++() throw()
{
return *this;
}
/**
* Increment.
*/
lambda_output_iterator<T> operator++(int) throw()
{
return *this;
}
private:
helper<T> h;
@ -258,7 +260,6 @@ template<typename T> 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<T>::min() : std::numeric_limits<T>::max();
T val = 0;
if(value.length() > idx + 2 && value[idx] == '0' && value[idx + 1] == 'x') {

View file

@ -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

View file

@ -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);

View file

@ -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;
}

View file

@ -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<unsigned char> p;
float tmp[OPUS_MAX_OUT];
@ -697,7 +695,7 @@ out:
uint32_t postgap_throw = 0;
std::vector<unsigned char> 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;

View file

@ -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<uint32_t>(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();

View file

@ -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();

View file

@ -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<uint8_t*>(buf), sizeof(buf));
sha256::hash(buf, reinterpret_cast<uint8_t*>(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];

View file

@ -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;

View file

@ -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<char> _rrd;
count = rrd.write(_rrd);
rrd.write(_rrd);
s.blob_implicit(_rrd);
});

View file

@ -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<typename T>
uint64_t map_index(const std::map<std::string, T>& b, const std::string& n)

View file

@ -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;

View file

@ -41,7 +41,6 @@
namespace
{
const char* null_chars = "F";
uint16_t null_cover_fbmem[512 * 448];
settingvar::variable<settingvar::model_bool<settingvar::yes_no>> 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}
};

View file

@ -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);

View file

@ -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

View file

@ -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=

View file

@ -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++) {

View file

@ -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<const std::string&> start_trace(lsnes_cmd, "set-trace", "No description available",

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -15,7 +15,7 @@ namespace sky
image(const std::vector<char>& data);
uint16_t width;
uint16_t height;
uint8_t colors;
unsigned colors;
uint16_t unknown1;
std::vector<uint8_t> decode;
uint32_t operator[](size_t ptr) { return palette[decode[ptr]]; }

View file

@ -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.

View file

@ -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;

View file

@ -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)

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -309,7 +309,6 @@ namespace
std::pair<uint32_t, uint32_t> 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<char>& 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<std::string, std::string>& 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);

View file

@ -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

View file

@ -176,12 +176,12 @@ void input::blob_implicit(std::vector<char>& 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");

View file

@ -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<unsigned, unsigned> 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);

View file

@ -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);

View file

@ -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)

View file

@ -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);
}

View file

@ -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.

View file

@ -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)

View file

@ -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;
}
}

View file

@ -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:

View file

@ -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;
}
}

View file

@ -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 "<WTF?>"; //NOTREACHED.
}
std::string printer_indenting::array_separator()
@ -1831,6 +1831,7 @@ std::string printer_indenting::array_end()
--depth;
return std::string("]") + (depth ? "" : "\n");
}
return "<WTF?>"; //NOTREACHED.
}
std::string printer_indenting::object_begin()
@ -1853,6 +1854,7 @@ std::string printer_indenting::object_begin()
state = S_START;
return linestart(depth++) + "{";
}
return "<WTF?>"; //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 "<WTF?>"; //NOTREACHED.
}
std::string printer_indenting::object_separator()
@ -1901,6 +1904,7 @@ std::string printer_indenting::object_end()
--depth;
return "}";
}
return "<WTF?>"; //NOTREACHED.
}
}

View file

@ -508,12 +508,11 @@ std::vector<std::string> 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;

View file

@ -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
}

View file

@ -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

View file

@ -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);
}

View file

@ -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
{

View file

@ -398,7 +398,6 @@ template<typename T> T memory_search::v_readold(uint64_t addr) throw()
template<typename T> void memorysearch_pull_type(memory_search& s)
{
T val;
eat_argument(&memory_search::s_value<T>);
eat_argument(&memory_search::s_difference<T>);
eat_argument(&memory_search::s_lt<T>);
@ -418,7 +417,6 @@ template<typename T> void memorysearch_pull_type(memory_search& s)
template<typename T> void memorysearch_pull_type2(memory_search& s)
{
T val;
eat_argument(&memory_search::s_value<T>);
eat_argument(&memory_search::s_difference<T>);
eat_argument(&memory_search::s_lt<T>);
@ -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.

View file

@ -8,7 +8,6 @@ namespace
{
template<typename T, bool linear> inline T internal_read(memory_space& m, uint64_t addr)
{
const int system_endian = memory_space::get_system_endian();
std::pair<memory_region*, uint64_t> g;
if(linear)
g = m.lookup_linear(addr);
@ -27,7 +26,6 @@ namespace
template<typename T, bool linear> inline bool internal_write(memory_space& m, uint64_t addr, T value)
{
const int system_endian = memory_space::get_system_endian();
std::pair<memory_region*, uint64_t> g;
if(linear)
g = m.lookup_linear(addr);

View file

@ -4,6 +4,14 @@
#include <sstream>
#include "string.hpp"
namespace
{
template<typename T> T* pointer_cast(char* ptr)
{
return reinterpret_cast<T*>(ptr);
}
}
memorywatch_memread_oper::memorywatch_memread_oper()
: mathexpr_operinfo("(readmemory)")
{
@ -41,41 +49,41 @@ void memorywatch_memread_oper::evaluate(mathexpr_value target, std::vector<std::
if(float_flag)
throw mathexpr_error(mathexpr_error::SIZE, "1 byte floats not supported");
else if(signed_flag)
target.type->parse_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<int16_t>(buf));
else
target.type->parse_u(target.value, *(uint16_t*)buf);
target.type->parse_u(target.value, *pointer_cast<uint16_t>(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<ss_int24_t>(buf));
else
target.type->parse_u(target.value, *(ss_uint24_t*)buf);
target.type->parse_u(target.value, *pointer_cast<ss_uint24_t>(buf));
break;
case 4:
if(float_flag)
target.type->parse_f(target.value, *(float*)buf);
target.type->parse_f(target.value, *pointer_cast<float>(buf));
else if(signed_flag)
target.type->parse_s(target.value, *(int32_t*)buf);
target.type->parse_s(target.value, *pointer_cast<int32_t>(buf));
else
target.type->parse_u(target.value, *(uint32_t*)buf);
target.type->parse_u(target.value, *pointer_cast<uint32_t>(buf));
break;
case 8:
if(float_flag)
target.type->parse_f(target.value, *(double*)buf);
target.type->parse_f(target.value, *pointer_cast<double>(buf));
else if(signed_flag)
target.type->parse_s(target.value, *(int64_t*)buf);
target.type->parse_s(target.value, *pointer_cast<int64_t>(buf));
else
target.type->parse_u(target.value, *(uint64_t*)buf);
target.type->parse_u(target.value, *pointer_cast<uint64_t>(buf));
break;
default:
throw mathexpr_error(mathexpr_error::SIZE, "Memory address size not supported");

View file

@ -169,5 +169,6 @@ uint32_t ogg_tags::serialize(std::function<void(const ogg::page& p)> output,
break;
written = ptr - &contents[0];
}
return next_page;
}
}

View file

@ -691,6 +691,7 @@ template<typename T> T generic_ctl(encoder& e, int32_t ctl)
template<typename T> T generic_ctl(encoder& e, int32_t ctl, T val)
{
throwex(opus_encoder_ctl(E(e), ctl, val));
return val;
}
template<typename T> T generic_ctl(decoder& d, int32_t ctl)
@ -703,16 +704,19 @@ template<typename T> T generic_ctl(decoder& d, int32_t ctl)
template<typename T> T generic_ctl(decoder& d, int32_t ctl, T val)
{
throwex(opus_decoder_ctl(D(d), ctl, val));
return val;
}
template<typename T> T generic_ctl(multistream_encoder& e, int32_t ctl, T val)
{
throwex(opus_multistream_encoder_ctl(ME(e), ctl, val));
return val;
}
template<typename T> T generic_ctl(surround_encoder& e, int32_t ctl, T val)
{
throwex(opus_multistream_encoder_ctl(ME(e), ctl, val));
return val;
}
template<typename T> T generic_ctl(multistream_encoder& e, int32_t ctl)
@ -733,6 +737,7 @@ template<typename T> T generic_ctl(surround_encoder& e, int32_t ctl)
template<typename T> T generic_ctl(multistream_decoder& d, int32_t ctl, T val)
{
throwex(opus_multistream_decoder_ctl(MD(d), ctl, val));
return val;
}
template<typename T> 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.
}
}

View file

@ -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);
}

View file

@ -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)

View file

@ -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,

View file

@ -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<char>& out) throw(std::bad_alloc,

View file

@ -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

View file

@ -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<int64_t>(r[1]);
high = parse_value<int64_t>(r[2]);

View file

@ -253,8 +253,6 @@ namespace
template<typename T, bool littleendian>
int bit_ldbinarynumber(lua::state& L, lua::parameters& P)
{
T val;
char buffer[sizeof(T)];
size_t pos;
const char* str;
size_t len;

View file

@ -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]);
}

View file

@ -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<porterduff_oper oper, class _src, class _dest> struct srcdest_porterduff
@ -512,7 +514,6 @@ namespace
int bitmap_load_fn(lua::state& L, std::function<lua_loaded_bitmap()> src)
{
uint32_t w, h;
auto bitmap = src();
if(bitmap.d) {
lua_dbitmap* b = lua::_class<lua_dbitmap>::create(L, bitmap.w, bitmap.h);
@ -665,7 +666,6 @@ namespace
cg = parse_value<uint8_t>(r[2]);
cb = parse_value<uint8_t>(r[3]);
ca = 256 - parse_value<uint16_t>(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<bool scaled, bool porterduff> int lua_dbitmap::blit(lua::state& L, lua:
xblit_pduff<scaled>(dest, src, dx, dy, sx, sy, w, h, hscl, vscl, pd_oper);
else
xblit_dir<scaled>(dest, src, ckx, dx, dy, sx, sy, w, h, hscl, vscl);
} else {
} else if(src_p) {
operand_bitmap_pal src(*P.arg<lua_bitmap*>(sidx), *P.arg<lua_palette*>(spal));
if(porterduff)
xblit_pduff<scaled>(dest, src, dx, dy, sx, sy, w, h, hscl, vscl, pd_oper);
@ -1176,11 +1176,10 @@ template<bool scaled, bool porterduff> 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();

View file

@ -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", {

View file

@ -56,6 +56,7 @@ namespace
ptr->bottom_gap = std::numeric_limits<uint32_t>::max();
ptr->left_gap = std::numeric_limits<uint32_t>::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<lua_dbitmap>::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)

View file

@ -159,6 +159,7 @@ namespace
}
}
font.add(utf8::to32(text), glyph);
return 0;
}
int lua_customfont::create(lua::state& L, lua::parameters& P)

View file

@ -296,7 +296,7 @@ namespace
P(w, h, px, py);
tilemap* t = lua::_class<tilemap>::create(L, w, h, px, py);
lua::_class<tilemap>::create(L, w, h, px, py);
return 1;
}

View file

@ -169,7 +169,7 @@ int lua_inverse_bind::create(lua::state& L, lua::parameters& P)
P(name, command);
lua_inverse_bind* b = lua::_class<lua_inverse_bind>::create(L, name, command);
lua::_class<lua_inverse_bind>::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<lua_command_bind>::create(L.get_master(), name, lfn1, lfn2);
lua::_class<lua_command_bind>::create(L.get_master(), name, lfn1, lfn2);
return 1;
}

View file

@ -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;
}

View file

@ -153,7 +153,7 @@ namespace
{
controller_frame_vector& v = framevector(L, P);
lua_inputmovie* m = lua::_class<lua_inputmovie>::create(L, v);
lua::_class<lua_inputmovie>::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<lua_inputframe>::create(L, _f);
lua::_class<lua_inputframe>::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<lua_inputframe>::create(L, _f);
lua::_class<lua_inputframe>::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();

View file

@ -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)

View file

@ -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_file_reader*>(lua_touserdata(L, lua_upvalueindex(1)))->lines_helper(L);
return reinterpret_cast<lua_file_reader*>(lua_touserdata(L, lua_upvalueindex(1)))->
lines_helper(L);
}
private:
std::istream& s;

View file

@ -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()) {

View file

@ -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));

View file

@ -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<class T, bool _bswap> 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<bool write, bool sign> int lua_vma::scattergather(lua::state& L, lua::parameters& P)
@ -250,7 +252,6 @@ namespace
template<class T> 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<bool cmp> 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)

View file

@ -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<char> data(_data.length());
std::copy(_data.begin(), _data.end(), data.begin());
file_open->write(&data[0], data.size());
return 0;
}
std::string print()
{

View file

@ -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

View file

@ -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

View file

@ -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 =

View file

@ -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<int64_t>(r[1]);
high = parse_value<int64_t>(r[2]);

View file

@ -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();
}

View file

@ -174,7 +174,6 @@ void wxeditor_autohold::update_controls()
std::map<std::string, unsigned> 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) {

View file

@ -154,6 +154,7 @@ void show_conflictwindow(wxWindow* parent)
editor = new wxeditor_conflict(parent);
editor->ShowModal();
} catch(...) {
return;
}
editor->Destroy();
}

View file

@ -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<uint8_t>(laddr + i);
@ -923,4 +923,5 @@ bool wxeditor_hexeditor_jumpto(uint64_t addr)
{
if(editor)
editor->jumpto(addr);
return editor;
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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.

View file

@ -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.

View file

@ -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;

View file

@ -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<std::string, unsigned> 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.

View file

@ -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;

View file

@ -732,7 +732,7 @@ void wxwindow_memorysearch::panel::prepare_paint()
}
if(addr_count <= CANDIDATE_LIMIT) {
std::list<uint64_t> 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<uint64_t> 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();

View file

@ -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) {

View file

@ -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);

View file

@ -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;
}

View file

@ -35,15 +35,14 @@ std::list<settings_tab_factory*> 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();

View file

@ -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);

Some files were not shown because too many files have changed in this diff Show more