Fix some warnings with GCC -Wall

develop
lethosor 2016-10-15 00:37:18 -04:00
parent 2e290f4837
commit 9f541481ea
7 changed files with 11 additions and 17 deletions

@ -300,12 +300,6 @@ static void listScripts(PluginManager *plug_mgr, std::map<string,string> &pset,
}
}
static bool fileExists(std::string path)
{
ifstream script(path.c_str());
return script.good();
}
namespace {
struct ScriptArgs {
const string *pcmd;
@ -1612,16 +1606,19 @@ bool Core::Init()
cerr << "Starting IO thread.\n";
// create IO thread
thread * IO = new thread(fIOthread, (void *) temp);
(void)IO;
}
else
{
cerr << "Starting dfhack.init thread.\n";
thread * init = new thread(fInitthread, (void *) temp);
(void)init;
}
cerr << "Starting DF input capture thread.\n";
// set up hotkey capture
thread * HK = new thread(fHKthread, (void *) temp);
(void)HK;
screen_window = new Windows::top_level_window();
screen_window->addChild(new Windows::dfhack_dummy(5,10));
started = true;
@ -1819,6 +1816,7 @@ void Core::Resume()
lock_guard<mutex> lock(d->AccessMutex);
assert(d->df_suspend_depth > 0 && d->df_suspend_thread == tid);
(void)tid;
if (--d->df_suspend_depth == 0)
d->core_cond.Unlock();
@ -1858,6 +1856,7 @@ void Core::DisclaimSuspend(int level)
lock_guard<mutex> lock(d->AccessMutex);
assert(d->df_suspend_depth == level && d->df_suspend_thread == tid);
(void)tid;
if (level == 1000000)
d->df_suspend_depth = 0;

@ -271,8 +271,6 @@ virtual_identity *virtual_identity::find(void *vtable)
Core &core = Core::getInstance();
std::string name = core.p->doReadClassName(vtable);
virtual_identity *actual = NULL;
auto name_it = name_lookup.find(name);
if (name_it != name_lookup.end()) {
virtual_identity *p = name_it->second;

@ -2243,7 +2243,7 @@ static int filesystem_listdir(lua_State *L)
return 3;
}
lua_newtable(L);
for(int i=0;i<files.size();i++)
for(size_t i=0;i<files.size();i++)
{
lua_pushinteger(L,i+1);
lua_pushstring(L,files[i].c_str());
@ -2492,7 +2492,7 @@ static int internal_patchBytes(lua_State *L)
{
uint8_t *addr = (uint8_t*)checkaddr(L, -2, true);
int isnum;
uint8_t value = (uint8_t)lua_tounsignedx(L, -1, &isnum);
lua_tounsignedx(L, -1, &isnum);
if (!isnum)
luaL_error(L, "invalid value in write table");
lua_pop(L, 1);

@ -953,6 +953,7 @@ bool DFHack::Lua::SafeCallString(color_ostream &out, lua_State *state, const std
env_idx = lua_absindex(state, env_idx);
int base = lua_gettop(state);
(void)base; // used in assert()
// Parse the code
if (luaL_loadbuffer(state, code.data(), code.size(), debug_tag) != LUA_OK)

@ -911,6 +911,7 @@ static int method_container_insert(lua_State *state)
static int meta_bitfield_len(lua_State *state)
{
uint8_t *ptr = get_object_addr(state, 1, 0, "get size");
(void)ptr;
auto id = (bitfield_identity*)lua_touserdata(state, UPVAL_CONTAINER_ID);
lua_pushinteger(state, id->getNumBits());
return 1;

@ -46,8 +46,6 @@ distribution.
using namespace DFHack;
using namespace DFHack::LuaWrapper;
static luaL_Reg no_functions[] = { { NULL, NULL } };
/**
* Report an error while accessing a field (index = field name).
*/
@ -1594,8 +1592,6 @@ static void RenderTypeChildren(lua_State *state, const std::vector<compound_iden
static int DoAttach(lua_State *state)
{
int base = lua_gettop(state);
lua_newtable(state);
lua_rawsetp(state, LUA_REGISTRYINDEX, &DFHACK_PTR_IDTABLE_TOKEN);

@ -184,8 +184,8 @@ struct Plugin::LuaEvent : public Lua::Event::Owner {
Plugin::Plugin(Core * core, const std::string & path,
const std::string &name, PluginManager * pm)
:name(name),
path(path),
:path(path),
name(name),
parent(pm)
{
plugin_lib = 0;
@ -492,7 +492,6 @@ command_result Plugin::invoke(color_ostream &out, const std::string & command, s
bool Plugin::can_invoke_hotkey(const std::string & command, df::viewscreen *top )
{
Core & c = Core::getInstance();
bool cr = false;
access->lock_add();
if(state == PS_LOADED)