diff --git a/modules/io/src/mol/mmcif_info.cc b/modules/io/src/mol/mmcif_info.cc index e7d47078cc5ae4c9f3c4dabee23dd55c72dd12e1..27934ad09079feee4a2b7e1e031ad6182dc472d9 100644 --- a/modules/io/src/mol/mmcif_info.cc +++ b/modules/io/src/mol/mmcif_info.cc @@ -63,7 +63,8 @@ void MMCifInfo::AddAuthorsToCitation(StringRef id, std::vector<String> list) // find citation std::vector<MMCifInfoCitation>::iterator cit_it; for (cit_it = citations_.begin(); cit_it != citations_.end(); ++cit_it) { - if (id == StringRef(cit_it->GetID().c_str(), cit_it->GetID().length())) { + String cit_id = cit_it->GetID(); // to ensure lifetime of StringRef-pointers + if (id == StringRef(cit_id.c_str(), cit_id.length())) { cit_it->SetAuthorList(list); return; } diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc index 40f81cd8c441801df9412d60f9b562610b18498a..4e62b08563327d0c2b50330dfb3c304bd1fb915b 100644 --- a/modules/io/tests/test_mmcif_reader.cc +++ b/modules/io/tests/test_mmcif_reader.cc @@ -157,8 +157,6 @@ BOOST_AUTO_TEST_CASE(mmcif_convert_seqres) mol::EntityHandle eh=mol::CreateEntity(); TestMMCifReaderProtected tmmcif_p("testfiles/mmcif/atom_site.mmcif", eh); - std::vector<StringRef> columns; - StarLoopDesc tmmcif_h; BOOST_CHECK_EQUAL(tmmcif_p.ConvertSEQRES("A(MSE)Y", compound_lib), "AMY"); BOOST_CHECK_THROW(tmmcif_p.ConvertSEQRES("A(MSEY", compound_lib), IOException); diff --git a/modules/mol/alg/src/filter_clashes.cc b/modules/mol/alg/src/filter_clashes.cc index e2e84fb29136f97f981290543b9b14e57ba70117..690a10aff11a238a45663186ac6b98c3ace29db5 100644 --- a/modules/mol/alg/src/filter_clashes.cc +++ b/modules/mol/alg/src/filter_clashes.cc @@ -207,7 +207,7 @@ StereoChemicalParams FillStereoChemicalParams(const String& header, std::vector< bool found=false; std::vector<String>::const_iterator line_iter=stereo_chemical_props_file.begin(); while (line_iter!=stereo_chemical_props_file.end()) { - if ((*line_iter).length()!=0 && (*line_iter).length()!=1) { + if ((*line_iter).length() > 1) { StringRef line_string_ref(line_iter->data(),(*line_iter).length()); std::vector<StringRef> line_str_vec = line_string_ref.split(); if (line_str_vec[0].str()==header) { @@ -266,8 +266,8 @@ StereoChemicalParams FillStereoChemicalParams(const String& header, std::vector< return StereoChemicalParams(); } table.SetParam(rearranged_item,res,value,stddev); - line_iter++; - } + } + line_iter++; } } } @@ -286,7 +286,7 @@ ClashingDistances FillClashingDistances(std::vector<String>& stereo_chemical_pro bool found=false; std::vector<String>::const_iterator line_iter=stereo_chemical_props_file.begin(); while (line_iter!=stereo_chemical_props_file.end()) { - if ((*line_iter).length()!=0 && (*line_iter).length()!=1) { + if ((*line_iter).length() > 1) { StringRef line_string_ref(line_iter->data(),(*line_iter).length()); std::vector<StringRef> line_str_vec = line_string_ref.split(); if (line_str_vec[0].str()=="Non-bonded") { @@ -329,11 +329,11 @@ ClashingDistances FillClashingDistances(std::vector<String>& stereo_chemical_pro table.SetClashingDistance(ele2,ele1,value,stddev); } else { table.SetClashingDistance(ele1,ele2,value,stddev); - } - line_iter++; - } + } + } + line_iter++; } - } + } } line_iter++; }