Skip to content

Commit

Permalink
Merge pull request OpenChemistry#1284 from berquist/fix-compiled-warn…
Browse files Browse the repository at this point in the history
…ings

Fix some compiler warnings not related to Qt
  • Loading branch information
ghutchis authored May 1, 2023
2 parents 0d49467 + 6c197bb commit bba600a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
5 changes: 0 additions & 5 deletions avogadro/core/ringperceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ DistanceMatrix::~DistanceMatrix()
delete[] m_values;
}

size_t DistanceMatrix::operator()(size_t i, size_t j) const
{
return m_values[i * m_size + j];
}

size_t& DistanceMatrix::operator()(size_t i, size_t j)
{
return m_values[i * m_size + j];
Expand Down
6 changes: 3 additions & 3 deletions avogadro/qtplugins/cp2kinput/cp2kinputdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,13 @@ void Cp2kInputDialog::updatePreviewText()
file += "&END FORCE_EVAL\n";

if (m_molecule) {
std::vector<int> atomList;
std::vector<unsigned int> atomList;
bool inlist = true;

for (size_t i = 0; i < m_molecule->atomCount(); ++i) {
Core::Atom atom = m_molecule->atom(i);
for (int i : atomList) {
if (i == atom.atomicNumber()) {
for (unsigned iat : atomList) {
if (iat == atom.atomicNumber()) {
inlist = false;
break;
} else {
Expand Down
8 changes: 4 additions & 4 deletions avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ void ScriptChargeModel::processElementString(const QString& str)
str2.replace(',', ' ');
// then split on whitespace
QStringList strList = str2.split(QRegExp("\\s+"), QString::SkipEmptyParts);
foreach (QString str, strList) {
foreach (QString sstr, strList) {
// these should be numbers or ranges (e.g., 1-84)
if (str.contains('-')) {
if (sstr.contains('-')) {
// range, so split on the dash
QStringList strList2 = str.split('-');
QStringList strList2 = sstr.split('-');
if (strList2.size() != 2)
return;

Expand All @@ -379,7 +379,7 @@ void ScriptChargeModel::processElementString(const QString& str)
}

bool ok;
int i = str.toInt(&ok);
int i = sstr.toInt(&ok);
if (!ok || i < 1 || i > 119)
return;

Expand Down
5 changes: 2 additions & 3 deletions avogadro/qtplugins/symmetry/symmetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,14 @@ void Symmetry::detectSymmetry()
// interface with libmsym
msym_error_t ret = MSYM_SUCCESS;
msym_element_t* elements = nullptr;
const char* error = nullptr;
char point_group[6];
double cm[3], radius = 0.0, symerr = 0.0;
double cm[3], radius = 0.0;

/* Do not free these variables */
const msym_symmetry_operation_t* msops = nullptr;
const msym_subgroup_t* msg = nullptr;
const msym_equivalence_set_t* mes = nullptr;
int mesl = 0, msgl = 0, msopsl = 0, mlength = 0;
int mesl = 0, msgl = 0, msopsl = 0;

// initialize the c-style array of atom names and coordinates
msym_element_t* a;
Expand Down
6 changes: 3 additions & 3 deletions avogadro/qtplugins/symmetry/symmetrywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ void SymmetryWidget::equivalenceSelectionChanged(
if (a == nullptr)
return;

unsigned int length = m_molecule->atomCount();
Index length = m_molecule->atomCount();
// unselect all the atoms
for (Index i = 0; i < length; ++i) {
m_molecule->setAtomSelected(i, false);
for (Index iat = 0; iat < length; ++iat) {
m_molecule->setAtomSelected(iat, false);
}
// this is yucky, but libmsym uses <void*> for id
auto selectedAtom = reinterpret_cast<Index>(a->id);
Expand Down
4 changes: 2 additions & 2 deletions utilities/resdata/resdataparse.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int main(int argc, char* argv[])
output << "ResidueData " << currResidue << "Data(\"" << currResidue
<< "\",\n"
<< "// Atoms\n{";
int i = 0;
size_t i = 0;
for (i = 0; i < atoms.size(); ++i) {
output << "\"" << atoms[i] << "\"";
if (i != atoms.size() - 1)
Expand Down Expand Up @@ -178,7 +178,7 @@ int main(int argc, char* argv[])
}

output << "std::map<std::string, ResidueData> residueDict = {\n";
for (int j = 0; j < residueClassNames.size(); ++j) {
for (size_t j = 0; j < residueClassNames.size(); ++j) {
output << "{\"" << residueClassNames[j] << "\", " << residueClassNames[j]
<< "Data}";
if (j != residueClassNames.size() - 1)
Expand Down

0 comments on commit bba600a

Please sign in to comment.