Skip to content

Commit

Permalink
Merge pull request opencog#1165 from serval2412/master
Browse files Browse the repository at this point in the history
Fix some cppcheck reports (part3)
  • Loading branch information
linas committed Dec 28, 2014
2 parents 150c11f + 14265f0 commit 6810c8e
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 14 deletions.
1 change: 0 additions & 1 deletion opencog/comboreduct/type_checker/type_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,6 @@ void reduce_type_tree(type_tree& tt, type_tree_pre_it it,
else if (*it == id::union_type) {
OC_ASSERT(!it.is_childless(),
"union_type must have at least a child");
type_tree_seq utt;
//apply reduce recursively to the children of the union
for (type_tree_sib_it sib = it.begin(); sib != it.end(); ++sib) {
reduce_type_tree(tt, type_tree_pre_it(sib), arg_types,
Expand Down
1 change: 0 additions & 1 deletion opencog/dynamics/attention/ImportanceDiffusionAgent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ void ImportanceDiffusionAgent::spreadImportance()
int totalDiffusionAtoms = 0;

std::vector<Handle> links;
std::vector<Handle>::iterator hi;
std::back_insert_iterator< std::vector<Handle> > out_hi(links);

log->debug("Begin diffusive importance spread.");
Expand Down
1 change: 0 additions & 1 deletion opencog/dynamics/attention/ImportanceSpreadingAgent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ void ImportanceSpreadingAgent::spreadImportance()
// to avoid retrieving them twice
int ImportanceSpreadingAgent::sumTotalDifference(Handle source, HandleSeq& links)
{
std::vector<Handle> targets;
int totalDifference = 0;
// sum total difference
foreach(Handle handle, links) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,6 @@ void Pet::getAllActionsDoneInATrickAtTime(const Temporal& time, HandleSeq& actio
true);
foreach(Handle learningSessionHandle, learningSessionHandles) {
if (atomSpace->getArity(learningSessionHandle) > 1) {
std::set<Handle> actionHandles;
std::vector<HandleTemporalPair> learningSessionIntervals;
// Get temporal info for all the Handles that pertain to this
// trick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ std::string PAIUtils::getSerializedXMLString(XERCES_CPP_NAMESPACE::DOMDocument *
throw opencog::RuntimeException(TRACE_INFO, "PAIUtils - Out of Memory Exception!");
} catch (const XERCES_CPP_NAMESPACE::XMLException& toCatch) {
char* message = XERCES_CPP_NAMESPACE::XMLString::transcode(toCatch.getMessage());
throw opencog::RuntimeException(TRACE_INFO, "PAIUtils - Exception message is: %s.", message);
XERCES_CPP_NAMESPACE::XMLString::release(&message);
throw opencog::RuntimeException(TRACE_INFO, "PAIUtils - Exception message is: %s.", message);
}

return result;
Expand Down
3 changes: 0 additions & 3 deletions opencog/embodiment/WorldWrapper/PAIWorldWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,6 @@ bool PAIWorldWrapper::build_goto_plan(Handle goalHandle,

if (config().get_bool("ENABLE_UNITY_CONNECTOR"))
{
std::vector<SpaceServer::SpaceMapPoint> actions;


float speed = ( walkSpeed != 0 ) ?
walkSpeed : pai.getAvatarInterface().computeWalkingSpeed();

Expand Down
1 change: 0 additions & 1 deletion opencog/guile/load-file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ void load_scm_files_from_config(AtomSpace& atomSpace,
std::vector<std::string> scm_modules;
tokenize(config()["SCM_PRELOAD"], std::back_inserter(scm_modules), ", ");

std::vector<std::string>::const_iterator it;
for (const std::string& scm_module : scm_modules)
load_scm_file_relative(atomSpace, scm_module, search_paths);
}
Expand Down
1 change: 0 additions & 1 deletion opencog/learning/moses/main/eval-diversity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ int main(int argc, char** argv)

if (!edp.moses_files.empty()) {
// load the bscores
vector<behavioral_score> bscores;
vector<scored_combo_tree> bcts;
for (const string& file : edp.moses_files) {
ifstream in(file);
Expand Down
1 change: 1 addition & 0 deletions opencog/persist/file/SavingLoading.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ void SavingLoading::load(const char *fileName,
// reads the total number of atoms. Just an idea for now.
int atomCount = 0;
if ( fread(&atomCount, sizeof(int), 1, f) != 1 ) {
fclose(f);
throw RuntimeException(TRACE_INFO, "SavingLoading - failed to read.");
}

Expand Down
1 change: 0 additions & 1 deletion opencog/server/ListRequest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ bool ListRequest::execute()
Handle handle = Handle::UNDEFINED;
bool subtypes = false;
AtomSpace& as = _cogserver.getAtomSpace();
std::ostringstream err;

if (0 == _parameters.size()) {
_error << "Error: option required" << std::endl;
Expand Down
4 changes: 1 addition & 3 deletions opencog/visualization/ubigraph/Ubigrapher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void Ubigrapher::updateColourOfHandle(Handle h, property_t p, unsigned char star
unsigned char val[3];
float scaler = 0.0f;
int j;
std::ostringstream ost, ost2;
std::ostringstream ost;
unsigned char diff[3];
float multiplierForTV = 10.0f;

Expand Down Expand Up @@ -292,8 +292,6 @@ void Ubigrapher::updateColourOfHandle(Handle h, property_t p, unsigned char star
ubigraph_set_vertex_attribute(h.value(), "color", ost.str().c_str());
} else {
ubigraph_set_vertex_attribute(h.value(), "color", ost.str().c_str());
// ost2 << 1.0 + 4 * space->getNormalisedZeroToOneSTI(h,false,true);
// ubigraph_set_vertex_attribute(h.value(), "size", ost2.str().c_str());
}
}

Expand Down

0 comments on commit 6810c8e

Please sign in to comment.