X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2FResource.cc;fp=src%2FResource.cc;h=5ff05657c28a7822991e0556ea82106e97e1a63a;hb=17ef2638592a4be20fb2b41e045c4ee51196271e;hp=a6254bcb3ee334b9dbca2c469e7a65bbefd4175b;hpb=3da13c168283b7192910af28c417a166dd317eba;p=chaz%2Fopenbox diff --git a/src/Resource.cc b/src/Resource.cc index a6254bcb..5ff05657 100644 --- a/src/Resource.cc +++ b/src/Resource.cc @@ -42,6 +42,12 @@ obResource::obResource(const std::string &file) { m_autosave = true; } +obResource::obResource() { + m_modified = false; + m_database = NULL; + m_autosave = true; +} + obResource::~obResource() { if (m_database != NULL) XrmDestroyDatabase(m_database); @@ -49,7 +55,6 @@ obResource::~obResource() { void obResource::setFile(const std::string &file) { m_file = file; - assert(m_file.c_str() != NULL); } void obResource::setAutoSave(bool autosave) { @@ -57,12 +62,14 @@ void obResource::setAutoSave(bool autosave) { } void obResource::save() { + assert(m_file.c_str() != NULL); assert(m_database != NULL); XrmPutFileDatabase(m_database, m_file.c_str()); m_modified = false; } bool obResource::load() { + assert(m_file.c_str() != NULL); if (m_database != NULL) XrmDestroyDatabase(m_database); m_modified = false; @@ -72,6 +79,7 @@ bool obResource::load() { } void obResource::setValue(const std::string &rname, bool value) { + assert(rname.c_str() != NULL); assert(m_database != NULL); const char *val = (value ? "True" : "False"); @@ -84,6 +92,7 @@ void obResource::setValue(const std::string &rname, bool value) { } void obResource::setValue(const std::string &rname, long value) { + assert(rname.c_str() != NULL); assert(m_database != NULL); char val[11]; @@ -97,6 +106,7 @@ void obResource::setValue(const std::string &rname, long value) { } void obResource::setValue(const std::string &rname, const char *value) { + assert(rname.c_str() != NULL); assert(m_database != NULL); std::string rc_string = rname + ": " + value; @@ -108,6 +118,7 @@ void obResource::setValue(const std::string &rname, const char *value) { } void obResource::setValue(const std::string &rname, const std::string &value) { + assert(rname.c_str() != NULL); assert(m_database != NULL); std::string rc_string = rname + ": " + value;