mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
C++11 cleanup on constructors (#6000)
* C++11 cleanup on constructors dir script
This commit is contained in:
parent
4a78949083
commit
4a5e8ad343
@ -33,13 +33,6 @@ extern "C" {
|
||||
#include "porting.h"
|
||||
#include "common/c_internal.h"
|
||||
|
||||
/******************************************************************************/
|
||||
AsyncEngine::AsyncEngine() :
|
||||
initDone(false),
|
||||
jobIdCounter(0)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
AsyncEngine::~AsyncEngine()
|
||||
{
|
||||
|
@ -39,24 +39,18 @@ class AsyncEngine;
|
||||
// Data required to queue a job
|
||||
struct LuaJobInfo
|
||||
{
|
||||
LuaJobInfo() :
|
||||
serializedFunction(""),
|
||||
serializedParams(""),
|
||||
serializedResult(""),
|
||||
id(0),
|
||||
valid(false)
|
||||
{}
|
||||
LuaJobInfo() {};
|
||||
|
||||
// Function to be called in async environment
|
||||
std::string serializedFunction;
|
||||
std::string serializedFunction = "";
|
||||
// Parameter to be passed to function
|
||||
std::string serializedParams;
|
||||
std::string serializedParams = "";
|
||||
// Result of function call
|
||||
std::string serializedResult;
|
||||
std::string serializedResult = "";
|
||||
// JobID used to identify a job and match it to callback
|
||||
unsigned int id;
|
||||
unsigned int id = 0;
|
||||
|
||||
bool valid;
|
||||
bool valid = false;
|
||||
};
|
||||
|
||||
// Asynchronous working environment
|
||||
@ -68,7 +62,7 @@ public:
|
||||
void *run();
|
||||
|
||||
private:
|
||||
AsyncEngine *jobDispatcher;
|
||||
AsyncEngine *jobDispatcher = nullptr;
|
||||
};
|
||||
|
||||
// Asynchornous thread and job management
|
||||
@ -76,7 +70,7 @@ class AsyncEngine {
|
||||
friend class AsyncWorkerThread;
|
||||
typedef void (*StateInitializer)(lua_State *L, int top);
|
||||
public:
|
||||
AsyncEngine();
|
||||
AsyncEngine() {};
|
||||
~AsyncEngine();
|
||||
|
||||
/**
|
||||
@ -137,13 +131,13 @@ protected:
|
||||
|
||||
private:
|
||||
// Variable locking the engine against further modification
|
||||
bool initDone;
|
||||
bool initDone = false;
|
||||
|
||||
// Internal store for registred state initializers
|
||||
std::vector<StateInitializer> stateInitializers;
|
||||
|
||||
// Internal counter to create job IDs
|
||||
unsigned int jobIdCounter;
|
||||
unsigned int jobIdCounter = 0;
|
||||
|
||||
// Mutex to protect job queue
|
||||
std::mutex jobQueueMutex;
|
||||
|
@ -71,9 +71,7 @@ public:
|
||||
ScriptApiBase
|
||||
*/
|
||||
|
||||
ScriptApiBase::ScriptApiBase() :
|
||||
m_luastackmutex(),
|
||||
m_gamedef(NULL)
|
||||
ScriptApiBase::ScriptApiBase()
|
||||
{
|
||||
#ifdef SCRIPTAPI_LOCK_DEBUG
|
||||
m_lock_recursion_count = 0;
|
||||
@ -111,14 +109,6 @@ ScriptApiBase::ScriptApiBase() :
|
||||
|
||||
lua_pushstring(m_luastack, porting::getPlatformName());
|
||||
lua_setglobal(m_luastack, "PLATFORM");
|
||||
|
||||
// m_secure gets set to true inside
|
||||
// ScriptApiSecurity::initializeSecurity(), if neccessary.
|
||||
// Default to false otherwise
|
||||
m_secure = false;
|
||||
|
||||
m_environment = NULL;
|
||||
m_guiengine = NULL;
|
||||
}
|
||||
|
||||
ScriptApiBase::~ScriptApiBase()
|
||||
|
@ -119,7 +119,7 @@ protected:
|
||||
|
||||
std::recursive_mutex m_luastackmutex;
|
||||
std::string m_last_run_mod;
|
||||
bool m_secure;
|
||||
bool m_secure = false;
|
||||
#ifdef SCRIPTAPI_LOCK_DEBUG
|
||||
int m_lock_recursion_count;
|
||||
std::thread::id m_owning_thread;
|
||||
@ -128,11 +128,11 @@ protected:
|
||||
private:
|
||||
static int luaPanic(lua_State *L);
|
||||
|
||||
lua_State* m_luastack;
|
||||
lua_State *m_luastack = nullptr;
|
||||
|
||||
IGameDef* m_gamedef;
|
||||
Environment* m_environment;
|
||||
GUIEngine* m_guiengine;
|
||||
IGameDef *m_gamedef = nullptr;
|
||||
Environment *m_environment = nullptr;
|
||||
GUIEngine *m_guiengine = nullptr;
|
||||
};
|
||||
|
||||
#endif /* S_BASE_H_ */
|
||||
|
@ -300,20 +300,19 @@ int LuaAreaStore::l_from_file(lua_State *L)
|
||||
return deserialization_helper(L, o->as, is);
|
||||
}
|
||||
|
||||
LuaAreaStore::LuaAreaStore()
|
||||
LuaAreaStore::LuaAreaStore() : as(AreaStore::getOptimalImplementation())
|
||||
{
|
||||
this->as = AreaStore::getOptimalImplementation();
|
||||
}
|
||||
|
||||
LuaAreaStore::LuaAreaStore(const std::string &type)
|
||||
{
|
||||
#if USE_SPATIAL
|
||||
if (type == "LibSpatial") {
|
||||
this->as = new SpatialAreaStore();
|
||||
as = new SpatialAreaStore();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
this->as = new VectorAreaStore();
|
||||
as = new VectorAreaStore();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
static int l_from_file(lua_State *L);
|
||||
|
||||
public:
|
||||
AreaStore *as;
|
||||
AreaStore *as = nullptr;
|
||||
|
||||
LuaAreaStore();
|
||||
LuaAreaStore(const std::string &type);
|
||||
|
@ -4,9 +4,8 @@
|
||||
#include "content_cao.h"
|
||||
#include "camera.h"
|
||||
|
||||
LuaCamera::LuaCamera(Camera *m)
|
||||
LuaCamera::LuaCamera(Camera *m) : m_camera(m)
|
||||
{
|
||||
m_camera = m;
|
||||
}
|
||||
|
||||
void LuaCamera::create(lua_State *L, Camera *m)
|
||||
|
@ -26,7 +26,7 @@ private:
|
||||
static int l_get_look_horizontal(lua_State *L);
|
||||
static int l_get_aspect_ratio(lua_State *L);
|
||||
|
||||
Camera *m_camera;
|
||||
Camera *m_camera = nullptr;
|
||||
|
||||
public:
|
||||
LuaCamera(Camera *m);
|
||||
|
@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
class ItemStackMetaRef : public MetaDataRef
|
||||
{
|
||||
private:
|
||||
ItemStack *istack;
|
||||
ItemStack *istack = nullptr;
|
||||
|
||||
static const char className[];
|
||||
static const luaL_Reg methods[];
|
||||
|
@ -21,9 +21,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "l_internal.h"
|
||||
#include "script/common/c_converter.h"
|
||||
|
||||
LuaLocalPlayer::LuaLocalPlayer(LocalPlayer *m)
|
||||
LuaLocalPlayer::LuaLocalPlayer(LocalPlayer *m) : m_localplayer(m)
|
||||
{
|
||||
m_localplayer = m;
|
||||
}
|
||||
|
||||
void LuaLocalPlayer::create(lua_State *L, LocalPlayer *m)
|
||||
|
@ -67,7 +67,7 @@ private:
|
||||
|
||||
static int l_get_movement(lua_State *L);
|
||||
|
||||
LocalPlayer *m_localplayer;
|
||||
LocalPlayer *m_localplayer = nullptr;
|
||||
|
||||
public:
|
||||
LuaLocalPlayer(LocalPlayer *m);
|
||||
|
@ -24,9 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "minimap.h"
|
||||
#include "settings.h"
|
||||
|
||||
LuaMinimap::LuaMinimap(Minimap *m)
|
||||
LuaMinimap::LuaMinimap(Minimap *m) : m_minimap(m)
|
||||
{
|
||||
m_minimap = m;
|
||||
}
|
||||
|
||||
void LuaMinimap::create(lua_State *L, Minimap *m)
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
static int l_set_shape(lua_State *L);
|
||||
static int l_get_shape(lua_State *L);
|
||||
|
||||
Minimap *m_minimap;
|
||||
Minimap *m_minimap = nullptr;
|
||||
|
||||
public:
|
||||
LuaMinimap(Minimap *m);
|
||||
|
@ -171,14 +171,12 @@ bool NodeMetaRef::handleFromTable(lua_State *L, int table, Metadata *_meta)
|
||||
|
||||
NodeMetaRef::NodeMetaRef(v3s16 p, ServerEnvironment *env):
|
||||
m_p(p),
|
||||
m_env(env),
|
||||
m_is_local(false)
|
||||
m_env(env)
|
||||
{
|
||||
}
|
||||
|
||||
NodeMetaRef::NodeMetaRef(Metadata *meta):
|
||||
m_meta(meta),
|
||||
m_is_local(true)
|
||||
m_meta(meta)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,9 @@ class NodeMetadata;
|
||||
class NodeMetaRef : public MetaDataRef {
|
||||
private:
|
||||
v3s16 m_p;
|
||||
ServerEnvironment *m_env;
|
||||
Metadata *m_meta;
|
||||
bool m_is_local;
|
||||
ServerEnvironment *m_env = nullptr;
|
||||
Metadata *m_meta = nullptr;
|
||||
bool m_is_local = false;
|
||||
|
||||
static const char className[];
|
||||
static const luaL_Reg methodsServer[];
|
||||
|
@ -29,7 +29,7 @@ class NodeTimerRef : public ModApiBase
|
||||
{
|
||||
private:
|
||||
v3s16 m_p;
|
||||
ServerEnvironment *m_env;
|
||||
ServerEnvironment *m_env = nullptr;
|
||||
|
||||
static const char className[];
|
||||
static const luaL_Reg methods[];
|
||||
|
@ -33,16 +33,29 @@ class RemotePlayer;
|
||||
*/
|
||||
|
||||
class ObjectRef : public ModApiBase {
|
||||
private:
|
||||
ServerActiveObject *m_object;
|
||||
|
||||
static const char className[];
|
||||
static const luaL_Reg methods[];
|
||||
public:
|
||||
ObjectRef(ServerActiveObject *object);
|
||||
|
||||
~ObjectRef();
|
||||
|
||||
// Creates an ObjectRef and leaves it on top of stack
|
||||
// Not callable from Lua; all references are created on the C side.
|
||||
static void create(lua_State *L, ServerActiveObject *object);
|
||||
|
||||
static void set_null(lua_State *L);
|
||||
|
||||
static void Register(lua_State *L);
|
||||
|
||||
static ObjectRef *checkobject(lua_State *L, int narg);
|
||||
|
||||
static ServerActiveObject* getobject(ObjectRef *ref);
|
||||
private:
|
||||
ServerActiveObject *m_object = nullptr;
|
||||
|
||||
static const char className[];
|
||||
static const luaL_Reg methods[];
|
||||
|
||||
|
||||
static LuaEntitySAO* getluaobject(ObjectRef *ref);
|
||||
|
||||
static PlayerSAO* getplayersao(ObjectRef *ref);
|
||||
@ -319,18 +332,6 @@ private:
|
||||
// get_nametag_attributes(self)
|
||||
static int l_get_nametag_attributes(lua_State *L);
|
||||
|
||||
public:
|
||||
ObjectRef(ServerActiveObject *object);
|
||||
|
||||
~ObjectRef();
|
||||
|
||||
// Creates an ObjectRef and leaves it on top of stack
|
||||
// Not callable from Lua; all references are created on the C side.
|
||||
static void create(lua_State *L, ServerActiveObject *object);
|
||||
|
||||
static void set_null(lua_State *L);
|
||||
|
||||
static void Register(lua_State *L);
|
||||
};
|
||||
|
||||
#endif /* L_OBJECT_H_ */
|
||||
|
@ -32,9 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
LuaSettings::LuaSettings(Settings *settings, const std::string &filename) :
|
||||
m_settings(settings),
|
||||
m_filename(filename),
|
||||
m_is_own_settings(false),
|
||||
m_write_allowed(true)
|
||||
m_filename(filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -57,10 +57,10 @@ private:
|
||||
// to_table(self) -> {[key1]=value1,...}
|
||||
static int l_to_table(lua_State *L);
|
||||
|
||||
Settings *m_settings;
|
||||
Settings *m_settings = nullptr;
|
||||
std::string m_filename;
|
||||
bool m_is_own_settings;
|
||||
bool m_write_allowed;
|
||||
bool m_is_own_settings = false;
|
||||
bool m_write_allowed = true;
|
||||
|
||||
public:
|
||||
LuaSettings(Settings *settings, const std::string &filename);
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
class StorageRef : public MetaDataRef
|
||||
{
|
||||
private:
|
||||
ModMetadata *m_object;
|
||||
ModMetadata *m_object = nullptr;
|
||||
|
||||
static const char className[];
|
||||
static const luaL_Reg methods[];
|
||||
|
@ -365,22 +365,17 @@ int LuaVoxelManip::l_get_emerged_area(lua_State *L)
|
||||
return 2;
|
||||
}
|
||||
|
||||
LuaVoxelManip::LuaVoxelManip(MMVManip *mmvm, bool is_mg_vm)
|
||||
LuaVoxelManip::LuaVoxelManip(MMVManip *mmvm, bool is_mg_vm) : vm(mmvm), is_mapgen_vm(is_mg_vm)
|
||||
{
|
||||
this->vm = mmvm;
|
||||
this->is_mapgen_vm = is_mg_vm;
|
||||
}
|
||||
|
||||
LuaVoxelManip::LuaVoxelManip(Map *map)
|
||||
LuaVoxelManip::LuaVoxelManip(Map *map) : vm(new MMVManip(map))
|
||||
{
|
||||
this->vm = new MMVManip(map);
|
||||
this->is_mapgen_vm = false;
|
||||
}
|
||||
|
||||
LuaVoxelManip::LuaVoxelManip(Map *map, v3s16 p1, v3s16 p2)
|
||||
{
|
||||
this->vm = new MMVManip(map);
|
||||
this->is_mapgen_vm = false;
|
||||
vm = new MMVManip(map);
|
||||
|
||||
v3s16 bp1 = getNodeBlockPos(p1);
|
||||
v3s16 bp2 = getNodeBlockPos(p2);
|
||||
|
@ -35,7 +35,7 @@ class LuaVoxelManip : public ModApiBase
|
||||
{
|
||||
private:
|
||||
std::map<v3s16, MapBlock *> modified_blocks;
|
||||
bool is_mapgen_vm;
|
||||
bool is_mapgen_vm = false;
|
||||
|
||||
static const char className[];
|
||||
static const luaL_Reg methods[];
|
||||
@ -65,7 +65,7 @@ private:
|
||||
static int l_get_emerged_area(lua_State *L);
|
||||
|
||||
public:
|
||||
MMVManip *vm;
|
||||
MMVManip *vm = nullptr;
|
||||
|
||||
LuaVoxelManip(MMVManip *mmvm, bool is_mapgen_vm);
|
||||
LuaVoxelManip(Map *map, v3s16 p1, v3s16 p2);
|
||||
|
@ -60,8 +60,6 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Thread::Thread(const std::string &name) :
|
||||
m_name(name),
|
||||
m_retval(NULL),
|
||||
m_joinable(false),
|
||||
m_request_stop(false),
|
||||
m_running(false)
|
||||
{
|
||||
@ -130,7 +128,7 @@ bool Thread::wait()
|
||||
m_thread_obj->join();
|
||||
|
||||
delete m_thread_obj;
|
||||
m_thread_obj = NULL;
|
||||
m_thread_obj = nullptr;
|
||||
|
||||
assert(m_running == false);
|
||||
m_joinable = false;
|
||||
@ -162,7 +160,7 @@ bool Thread::kill()
|
||||
wait();
|
||||
#endif
|
||||
|
||||
m_retval = NULL;
|
||||
m_retval = nullptr;
|
||||
m_joinable = false;
|
||||
m_request_stop = false;
|
||||
|
||||
|
@ -145,8 +145,8 @@ private:
|
||||
|
||||
static void threadProc(Thread *thr);
|
||||
|
||||
void *m_retval;
|
||||
bool m_joinable;
|
||||
void *m_retval = nullptr;
|
||||
bool m_joinable = false;
|
||||
std::atomic<bool> m_request_stop;
|
||||
std::atomic<bool> m_running;
|
||||
std::mutex m_mutex;
|
||||
|
@ -70,16 +70,16 @@ public:
|
||||
virtual void unregisterModStorage(const std::string &name) {}
|
||||
|
||||
private:
|
||||
IItemDefManager *m_itemdef;
|
||||
INodeDefManager *m_nodedef;
|
||||
ICraftDefManager *m_craftdef;
|
||||
ITextureSource *m_texturesrc;
|
||||
IShaderSource *m_shadersrc;
|
||||
ISoundManager *m_soundmgr;
|
||||
MtEventManager *m_eventmgr;
|
||||
scene::ISceneManager *m_scenemgr;
|
||||
IRollbackManager *m_rollbackmgr;
|
||||
EmergeManager *m_emergemgr;
|
||||
IItemDefManager *m_itemdef = nullptr;
|
||||
INodeDefManager *m_nodedef = nullptr;
|
||||
ICraftDefManager *m_craftdef = nullptr;
|
||||
ITextureSource *m_texturesrc = nullptr;
|
||||
IShaderSource *m_shadersrc = nullptr;
|
||||
ISoundManager *m_soundmgr = nullptr;
|
||||
MtEventManager *m_eventmgr = nullptr;
|
||||
scene::ISceneManager *m_scenemgr = nullptr;
|
||||
IRollbackManager *m_rollbackmgr = nullptr;
|
||||
EmergeManager *m_emergemgr = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
@ -53,12 +53,7 @@ void TestConnection::runTests(IGameDef *gamedef)
|
||||
|
||||
struct Handler : public con::PeerHandler
|
||||
{
|
||||
Handler(const char *a_name)
|
||||
{
|
||||
count = 0;
|
||||
last_id = 0;
|
||||
name = a_name;
|
||||
}
|
||||
Handler(const char *a_name) : name(a_name) {}
|
||||
|
||||
void peerAdded(con::Peer *peer)
|
||||
{
|
||||
@ -76,8 +71,8 @@ struct Handler : public con::PeerHandler
|
||||
count--;
|
||||
}
|
||||
|
||||
s32 count;
|
||||
u16 last_id;
|
||||
s32 count = 0;
|
||||
u16 last_id = 0;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
|
@ -58,7 +58,7 @@ const Area *AreaStore::getArea(u32 id) const
|
||||
{
|
||||
AreaMap::const_iterator it = areas_map.find(id);
|
||||
if (it == areas_map.end())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ bool SpatialAreaStore::insertArea(Area *a)
|
||||
if (!areas_map.insert(std::make_pair(a->id, *a)).second)
|
||||
// ID is not unique
|
||||
return false;
|
||||
m_tree->insertData(0, NULL, get_spatial_region(a->minedge, a->maxedge), a->id);
|
||||
m_tree->insertData(0, nullptr, get_spatial_region(a->minedge, a->maxedge), a->id);
|
||||
invalidateCache();
|
||||
return true;
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
|
||||
struct Area {
|
||||
Area() : id(U32_MAX) {}
|
||||
Area() {}
|
||||
Area(const v3s16 &mine, const v3s16 &maxe) :
|
||||
id(U32_MAX), minedge(mine), maxedge(maxe)
|
||||
minedge(mine), maxedge(maxe)
|
||||
{
|
||||
sortBoxVerticies(minedge, maxedge);
|
||||
}
|
||||
|
||||
u32 id;
|
||||
u32 id = U32_MAX;
|
||||
v3s16 minedge, maxedge;
|
||||
std::string data;
|
||||
};
|
||||
@ -54,10 +54,7 @@ struct Area {
|
||||
class AreaStore {
|
||||
public:
|
||||
AreaStore() :
|
||||
m_cache_enabled(true),
|
||||
m_cacheblock_radius(64),
|
||||
m_res_cache(1000, &cacheMiss, this),
|
||||
m_next_id(0)
|
||||
m_res_cache(1000, &cacheMiss, this)
|
||||
{}
|
||||
|
||||
virtual ~AreaStore() {}
|
||||
@ -123,13 +120,13 @@ private:
|
||||
/// Called by the cache when a value isn't found in the cache.
|
||||
static void cacheMiss(void *data, const v3s16 &mpos, std::vector<Area *> *dest);
|
||||
|
||||
bool m_cache_enabled;
|
||||
bool m_cache_enabled = true;
|
||||
/// Range, in nodes, of the getAreasForPos cache.
|
||||
/// If you modify this, call invalidateCache()
|
||||
u8 m_cacheblock_radius;
|
||||
u8 m_cacheblock_radius = 64;
|
||||
LRUCache<v3s16, std::vector<Area *> > m_res_cache;
|
||||
|
||||
u32 m_next_id;
|
||||
u32 m_next_id = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -165,8 +162,8 @@ protected:
|
||||
virtual void getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos);
|
||||
|
||||
private:
|
||||
SpatialIndex::ISpatialIndex *m_tree;
|
||||
SpatialIndex::IStorageManager *m_storagemanager;
|
||||
SpatialIndex::ISpatialIndex *m_tree = nullptr;
|
||||
SpatialIndex::IStorageManager *m_storagemanager = nullptr;
|
||||
|
||||
class VectorResultVisitor : public SpatialIndex::IVisitor {
|
||||
public:
|
||||
@ -194,8 +191,8 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
SpatialAreaStore *m_store;
|
||||
std::vector<Area *> *m_result;
|
||||
SpatialAreaStore *m_store = nullptr;
|
||||
std::vector<Area *> *m_result = nullptr;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -71,7 +71,7 @@ std::string generate_srp_verifier(const std::string &name,
|
||||
// get modified if &salt_ptr isn't NULL.
|
||||
char *salt_ptr = (char *)salt.c_str();
|
||||
|
||||
char *bytes_v = NULL;
|
||||
char *bytes_v = nullptr;
|
||||
size_t verifier_len = 0;
|
||||
gen_srp_v(name, password, &salt_ptr, &salt_len, &bytes_v, &verifier_len);
|
||||
std::string verifier = std::string(bytes_v, verifier_len);
|
||||
@ -84,9 +84,9 @@ void generate_srp_verifier_and_salt(const std::string &name,
|
||||
const std::string &password, std::string *verifier,
|
||||
std::string *salt)
|
||||
{
|
||||
char *bytes_v = NULL;
|
||||
char *bytes_v = nullptr;
|
||||
size_t verifier_len;
|
||||
char *salt_ptr = NULL;
|
||||
char *salt_ptr = nullptr;
|
||||
size_t salt_len;
|
||||
gen_srp_v(name, password, &salt_ptr, &salt_len, &bytes_v, &verifier_len);
|
||||
*verifier = std::string(bytes_v, verifier_len);
|
||||
|
@ -30,8 +30,7 @@ EnrichedString::EnrichedString()
|
||||
EnrichedString::EnrichedString(const std::wstring &string,
|
||||
const std::vector<SColor> &colors):
|
||||
m_string(string),
|
||||
m_colors(colors),
|
||||
m_has_background(false)
|
||||
m_colors(colors)
|
||||
{}
|
||||
|
||||
EnrichedString::EnrichedString(const std::wstring &s, const SColor &color)
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
private:
|
||||
std::wstring m_string;
|
||||
std::vector<irr::video::SColor> m_colors;
|
||||
bool m_has_background;
|
||||
bool m_has_background = false;
|
||||
irr::video::SColor m_background;
|
||||
};
|
||||
|
||||
|
@ -282,7 +282,7 @@ inline aabb3f getNodeBox(v3s16 p, float d)
|
||||
class IntervalLimiter
|
||||
{
|
||||
public:
|
||||
IntervalLimiter() : m_accumulator(0) {}
|
||||
IntervalLimiter() {}
|
||||
/*
|
||||
dtime: time from last call to this method
|
||||
wanted_interval: interval wanted
|
||||
@ -300,7 +300,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
float m_accumulator;
|
||||
float m_accumulator = 0.0f;
|
||||
};
|
||||
|
||||
|
||||
|
@ -23,16 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "../exceptions.h"
|
||||
#include <sstream>
|
||||
|
||||
PointedThing::PointedThing():
|
||||
type(POINTEDTHING_NOTHING),
|
||||
node_undersurface(0,0,0),
|
||||
node_abovesurface(0,0,0),
|
||||
node_real_undersurface(0,0,0),
|
||||
intersection_point(0,0,0),
|
||||
intersection_normal(0,0,0),
|
||||
object_id(-1)
|
||||
{}
|
||||
|
||||
std::string PointedThing::dump() const
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
|
@ -36,7 +36,7 @@ enum PointedThingType
|
||||
struct PointedThing
|
||||
{
|
||||
//! The type of the pointed object.
|
||||
PointedThingType type;
|
||||
PointedThingType type = POINTEDTHING_NOTHING;
|
||||
/*!
|
||||
* Only valid if type is POINTEDTHING_NODE.
|
||||
* The coordinates of the node which owns the
|
||||
@ -74,9 +74,9 @@ struct PointedThing
|
||||
* Only valid if type is POINTEDTHING_OBJECT.
|
||||
* The ID of the object the ray hit.
|
||||
*/
|
||||
s16 object_id;
|
||||
s16 object_id = -1;
|
||||
|
||||
PointedThing();
|
||||
PointedThing() {};
|
||||
std::string dump() const;
|
||||
void serialize(std::ostream &os) const;
|
||||
void deSerialize(std::istream &is);
|
||||
|
@ -422,7 +422,7 @@ bool deSerializeStringToStruct(std::string valstr,
|
||||
|
||||
char *fmtpos, *fmt = &format[0];
|
||||
while ((f = strtok_r(fmt, ",", &fmtpos)) && s) {
|
||||
fmt = NULL;
|
||||
fmt = nullptr;
|
||||
|
||||
bool is_unsigned = false;
|
||||
int width = 0;
|
||||
@ -510,7 +510,7 @@ bool deSerializeStringToStruct(std::string valstr,
|
||||
bufpos += sizeof(std::string *);
|
||||
strs_alloced.push_back(str);
|
||||
|
||||
s = *snext ? snext + 1 : NULL;
|
||||
s = *snext ? snext + 1 : nullptr;
|
||||
break;
|
||||
case 'v':
|
||||
while (*s == ' ' || *s == '\t')
|
||||
@ -582,7 +582,7 @@ bool serializeStructToString(std::string *out,
|
||||
char *bufpos = (char *) value;
|
||||
char *fmtpos, *fmt = &format[0];
|
||||
while ((f = strtok_r(fmt, ",", &fmtpos))) {
|
||||
fmt = NULL;
|
||||
fmt = nullptr;
|
||||
bool is_unsigned = false;
|
||||
int width = 0;
|
||||
char valtype = *f;
|
||||
|
@ -454,8 +454,7 @@ class BufReader {
|
||||
public:
|
||||
BufReader(const u8 *data_, size_t size_) :
|
||||
data(data_),
|
||||
size(size_),
|
||||
pos(0)
|
||||
size(size_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -515,7 +514,7 @@ public:
|
||||
|
||||
const u8 *data;
|
||||
size_t size;
|
||||
size_t pos;
|
||||
size_t pos = 0;
|
||||
};
|
||||
|
||||
#undef MAKE_BUFREADER_GET_FXN
|
||||
|
@ -66,15 +66,6 @@ SHA1::SHA1()
|
||||
{
|
||||
// make sure that the data type is the right size
|
||||
assert( sizeof( Uint32 ) * 5 == 20 );
|
||||
|
||||
// initialize
|
||||
H0 = 0x67452301;
|
||||
H1 = 0xefcdab89;
|
||||
H2 = 0x98badcfe;
|
||||
H3 = 0x10325476;
|
||||
H4 = 0xc3d2e1f0;
|
||||
unprocessedBytes = 0;
|
||||
size = 0;
|
||||
}
|
||||
|
||||
// Destructor ********************************************************
|
||||
|
@ -31,10 +31,14 @@ class SHA1
|
||||
{
|
||||
private:
|
||||
// fields
|
||||
Uint32 H0, H1, H2, H3, H4;
|
||||
Uint32 H0 = 0x67452301;
|
||||
Uint32 H1 = 0xefcdab89;
|
||||
Uint32 H2 = 0x98badcfe;
|
||||
Uint32 H3 = 0x10325476;
|
||||
Uint32 H4 = 0xc3d2e1f0;
|
||||
unsigned char bytes[64];
|
||||
int unprocessedBytes;
|
||||
Uint32 size;
|
||||
int unprocessedBytes = 0;
|
||||
Uint32 size = 0;
|
||||
void process();
|
||||
|
||||
public:
|
||||
|
@ -27,7 +27,6 @@ TimeTaker::TimeTaker(const std::string &name, u64 *result, TimePrecision prec)
|
||||
{
|
||||
m_name = name;
|
||||
m_result = result;
|
||||
m_running = true;
|
||||
m_precision = prec;
|
||||
m_time1 = porting::getTime(prec);
|
||||
}
|
||||
@ -36,7 +35,7 @@ u64 TimeTaker::stop(bool quiet)
|
||||
{
|
||||
if (m_running) {
|
||||
u64 dtime = porting::getTime(m_precision) - m_time1;
|
||||
if (m_result != NULL) {
|
||||
if (m_result != nullptr) {
|
||||
(*m_result) += dtime;
|
||||
} else {
|
||||
if (!quiet) {
|
||||
|
@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
class TimeTaker
|
||||
{
|
||||
public:
|
||||
TimeTaker(const std::string &name, u64 *result=NULL,
|
||||
TimeTaker(const std::string &name, u64 *result=nullptr,
|
||||
TimePrecision prec=PRECISION_MILLI);
|
||||
|
||||
~TimeTaker()
|
||||
@ -45,9 +45,9 @@ public:
|
||||
private:
|
||||
std::string m_name;
|
||||
u64 m_time1;
|
||||
bool m_running;
|
||||
bool m_running = true;
|
||||
TimePrecision m_precision;
|
||||
u64 *m_result;
|
||||
u64 *m_result = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user