From ca0fe086de1ea16a6cdd40903a767c8c26aca1bf Mon Sep 17 00:00:00 2001 From: Greg Landrum Date: Thu, 14 Feb 2008 06:44:17 +0000 Subject: [PATCH] Remove some compiler warnings and problems found with msvc-8 --- Code/GraphMol/RWMol.cpp | 10 +++++++--- Code/GraphMol/RankAtoms.cpp | 3 ++- Code/GraphMol/RankAtoms.h | 3 +-- Code/Numerics/Vector.h | 4 +--- Code/RDGeneral/Invariant.cpp | 9 +++------ Code/RDGeneral/Invariant.h | 8 ++++---- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Code/GraphMol/RWMol.cpp b/Code/GraphMol/RWMol.cpp index fdb97a137..5844d1e67 100755 --- a/Code/GraphMol/RWMol.cpp +++ b/Code/GraphMol/RWMol.cpp @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2003-2006 Greg Landrum and Rational Discovery LLC +// Copyright (C) 2003-2008 Greg Landrum and Rational Discovery LLC // // @@ All Rights Reserved @@ // @@ -119,11 +119,15 @@ namespace RDKit{ } // remove bonds attached to the atom + std::vector > nbrs; ADJ_ITER b1,b2; boost::tie(b1,b2)=getAtomNeighbors(oatom); while(b1!=b2){ - removeBond(oatom->getIdx(),*b1); - b1++; + nbrs.push_back(std::make_pair(oatom->getIdx(),*b1)); + ++b1; + } + for(unsigned int i=0;i(elem)); + accum *= pow(static_cast(valVect[j]), + static_cast(elem)); } } } diff --git a/Code/GraphMol/RankAtoms.h b/Code/GraphMol/RankAtoms.h index 8e5847216..b45658986 100644 --- a/Code/GraphMol/RankAtoms.h +++ b/Code/GraphMol/RankAtoms.h @@ -148,8 +148,7 @@ namespace RankAtoms { #endif INT_VECT idxVect; - idxVect.reserve(indicesInPlay.size()); - std::copy(indicesInPlay.begin(),indicesInPlay.end(),idxVect.begin()); + idxVect.assign(indicesInPlay.begin(),indicesInPlay.end()); // ------------- // diff --git a/Code/Numerics/Vector.h b/Code/Numerics/Vector.h index 7fd49074f..ffe043117 100644 --- a/Code/Numerics/Vector.h +++ b/Code/Numerics/Vector.h @@ -1,5 +1,5 @@ // -// Copyright (C) 2004-2006 Rational Discovery LLC +// Copyright (C) 2004-2008 Greg Landrum and Rational Discovery LLC // // @@ All Rights Reserved @@ // @@ -13,8 +13,6 @@ #include #include #include -#include -#include #include namespace RDNumeric { diff --git a/Code/RDGeneral/Invariant.cpp b/Code/RDGeneral/Invariant.cpp index dda1dac4e..7f380cc82 100755 --- a/Code/RDGeneral/Invariant.cpp +++ b/Code/RDGeneral/Invariant.cpp @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2001-2006 Randal M. Henne and Rational Discovery LLC +// Copyright (C) 2001-2008 Greg Landrum, Randal M. Henne, and Rational Discovery LLC // // @@ All Rights Reserved @@ // @@ -8,8 +8,8 @@ #include "Invariant.h" #include -#include #include +#include namespace Invar { @@ -22,10 +22,7 @@ namespace Invar { std::string& Invariant:: toString() { - char - line[10]; - - sprintf( line, "%d", this->getLine() ); + std::string line=boost::lexical_cast(this->getLine()); stringRep_d += "\n" + this->getMessage() + "\nViolation occurred on line " + line + " in file " + this->getFile() + "\nFailed Expression: " diff --git a/Code/RDGeneral/Invariant.h b/Code/RDGeneral/Invariant.h index 827236823..d676495ca 100755 --- a/Code/RDGeneral/Invariant.h +++ b/Code/RDGeneral/Invariant.h @@ -1,5 +1,5 @@ // -// Copyright (C) 2001-2006 Randal M. Henne and Rational Discovery LLC +// Copyright (C) 2001-2008 Greg Landrum, Randal M. Henne and Rational Discovery LLC // // @@ All Rights Reserved @@ // @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -129,8 +128,9 @@ namespace Invar { BOOST_LOG(rdErrorLog) << "\n\n****\n" << inv << "****\n\n"; throw inv; #define RANGE_CHECK( lo, x, hi ) if ( (lo)>(hi) || (x)<(lo) || (x)>(hi) ) {\ - char expr[80]; sprintf( expr, "%lf <= %lf <= %lf", double(lo), double(x), double( hi ) );\ - Invar::Invariant inv( "Range Error", #x, expr, __FILE__, __LINE__ );\ + std::stringstream errstr;\ + errstr << lo << " <= " << x <<" <= "<