Index: src/libictranslate/cfg_ini.cpp =================================================================== diff -u -N -rb26ced3298e3e7e51d91f3ac70b56746786da83b -r9ddf8fdd5f641491dd30c49eb90f8f740314b6af --- src/libictranslate/cfg_ini.cpp (.../cfg_ini.cpp) (revision b26ced3298e3e7e51d91f3ac70b56746786da83b) +++ src/libictranslate/cfg_ini.cpp (.../cfg_ini.cpp) (revision 9ddf8fdd5f641491dd30c49eb90f8f740314b6af) @@ -260,38 +260,36 @@ return pHandle; } - else - { - // parse the path - std::wstring strSection; - std::wstring strAttr; - if(!parse_property_name(pszName, strSection, strAttr)) - return nullptr; - ini_storage::iterator iterSection = m_pMainNode->find(strSection); - if(iterSection == m_pMainNode->end()) - return nullptr; + // parse the path + std::wstring strSection; + std::wstring strAttr; + if(!parse_property_name(pszName, strSection, strAttr)) + return nullptr; - std::pair pairRange; - if(strAttr == _T("*")) - { - pairRange.first = (*iterSection).second.begin(); - pairRange.second = (*iterSection).second.end(); - } - else - pairRange = (*iterSection).second.equal_range(strAttr); - if(pairRange.first != (*iterSection).second.end() && pairRange.first != pairRange.second) - { - INIFINDHANDLE* pHandle = new INIFINDHANDLE; - pHandle->bSection = false; - pHandle->bOnlyAttributes = true; - pHandle->itAttr = pairRange.first; - pHandle->itAttrEnd = pairRange.second; + ini_storage::iterator iterSection = m_pMainNode->find(strSection); + if(iterSection == m_pMainNode->end()) + return nullptr; - return pHandle; - } + std::pair pairRange; + if(strAttr == _T("*")) + { + pairRange.first = (*iterSection).second.begin(); + pairRange.second = (*iterSection).second.end(); } + else + pairRange = (*iterSection).second.equal_range(strAttr); + if(pairRange.first != (*iterSection).second.end() && pairRange.first != pairRange.second) + { + INIFINDHANDLE* pHandle = new INIFINDHANDLE; + pHandle->bSection = false; + pHandle->bOnlyAttributes = true; + pHandle->itAttr = pairRange.first; + pHandle->itAttrEnd = pairRange.second; + return pHandle; + } + return nullptr; } @@ -318,47 +316,41 @@ ++pfh->itAttr; return true; } - else - return false; + + return false; } - else + + if(pfh->bSection) { - if(pfh->bSection) - { - if(pfh->itSection == pfh->itSectionEnd) - return false; - pfh->bSection = false; - pfh->itAttr = (*pfh->itSection).second.begin(); - pfh->itAttrEnd = (*pfh->itSection).second.end(); + if(pfh->itSection == pfh->itSectionEnd) + return false; + pfh->bSection = false; + pfh->itAttr = (*pfh->itSection).second.begin(); + pfh->itAttrEnd = (*pfh->itSection).second.end(); - // section name - pi.bGroup = true; - pi.pszName = (*pfh->itSection++).first.c_str(); - pi.pszValue = nullptr; - return true; - } - else - { - if(pfh->itAttr != pfh->itAttrEnd) - { - pi.bGroup = false; - pi.pszName = (*pfh->itAttr).first.c_str(); - pi.pszValue = (*pfh->itAttr).second.c_str(); + // section name + pi.bGroup = true; + pi.pszName = (*pfh->itSection++).first.c_str(); + pi.pszValue = nullptr; + return true; + } - ++pfh->itAttr; - if(pfh->itAttr == pfh->itAttrEnd) - pfh->bSection = true; - return true; + if(pfh->itAttr != pfh->itAttrEnd) + { + pi.bGroup = false; + pi.pszName = (*pfh->itAttr).first.c_str(); + pi.pszValue = (*pfh->itAttr).second.c_str(); - } - else - { - // should not happen - assert(false); - return false; - } - } + ++pfh->itAttr; + if(pfh->itAttr == pfh->itAttrEnd) + pfh->bSection = true; + return true; + } + + // should not happen + assert(false); + return false; } /** Closes the find handle.