From 28d9983e2c561528c27c0dd40c2c0ea5b46a270f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 16 Dec 2014 21:54:25 +0100 Subject: indent try-block, remove obsolete comment indent block one level deeper than block in which it is contained Change-Id: Ibefd1a87c25100001f842f42f053d9e68feba8a6 Reviewed-on: https://gerrit.libreoffice.org/13498 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- helpcompiler/source/HelpLinker.cxx | 271 ++++++++++++++++++------------------- 1 file changed, 135 insertions(+), 136 deletions(-) (limited to 'helpcompiler') diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx index fccd2d3533c6..b28529342953 100644 --- a/helpcompiler/source/HelpLinker.cxx +++ b/helpcompiler/source/HelpLinker.cxx @@ -337,176 +337,175 @@ void HelpLinker::link() throw(HelpProcessingException, BasicCodeTagger::TaggerEx // catch HelpProcessingException to avoid locking data bases try { + // lastly, initialize the indexBuilder + if ( (!bExtensionMode || bIndexForExtension) && !helpFiles.empty()) + initIndexerPreProcessor(); - // lastly, initialize the indexBuilder - if ( (!bExtensionMode || bIndexForExtension) && !helpFiles.empty()) - initIndexerPreProcessor(); - - // here we start our loop over the hzip files. - HashSet::iterator end = helpFiles.end(); - for (HashSet::iterator iter = helpFiles.begin(); iter != end; ++iter) - { - // process one file - // streamTable contains the streams in the hzip file - StreamTable streamTable; - const std::string &xhpFileName = *iter; - - if (!bExtensionMode && xhpFileName.rfind(".xhp") != xhpFileName.length()-4) + // here we start our loop over the hzip files. + HashSet::iterator end = helpFiles.end(); + for (HashSet::iterator iter = helpFiles.begin(); iter != end; ++iter) { - // only work on .xhp - files - SAL_WARN("helpcompiler", - "ERROR: input list entry '" - << xhpFileName - << "' has the wrong extension (only files with extension .xhp are accepted)"); + // process one file + // streamTable contains the streams in the hzip file + StreamTable streamTable; + const std::string &xhpFileName = *iter; - continue; - } + if (!bExtensionMode && xhpFileName.rfind(".xhp") != xhpFileName.length()-4) + { + // only work on .xhp - files + SAL_WARN("helpcompiler", + "ERROR: input list entry '" + << xhpFileName + << "' has the wrong extension (only files with extension .xhp are accepted)"); - fs::path langsourceRoot(sourceRoot); - fs::path xhpFile; + continue; + } - if( bExtensionMode ) - { - // langsourceRoot == sourceRoot for extensions - std::string xhpFileNameComplete( extensionPath ); - xhpFileNameComplete.append( '/' + xhpFileName ); - xhpFile = fs::path( xhpFileNameComplete ); - } - else - { - langsourceRoot.append( "/" ); - if ( m_bUseLangRoot ) - langsourceRoot.append( lang + '/' ); - xhpFile = fs::path(xhpFileName, fs::native); - } + fs::path langsourceRoot(sourceRoot); + fs::path xhpFile; - HelpCompiler hc( streamTable, xhpFile, langsourceRoot, zipdir, - compactStylesheet, embeddStylesheet, module, lang, bExtensionMode ); + if( bExtensionMode ) + { + // langsourceRoot == sourceRoot for extensions + std::string xhpFileNameComplete( extensionPath ); + xhpFileNameComplete.append( '/' + xhpFileName ); + xhpFile = fs::path( xhpFileNameComplete ); + } + else + { + langsourceRoot.append( "/" ); + if ( m_bUseLangRoot ) + langsourceRoot.append( lang + '/' ); + xhpFile = fs::path(xhpFileName, fs::native); + } - HCDBG(std::cerr << "before compile of " << xhpFileName << std::endl); - bool success = hc.compile(); - HCDBG(std::cerr << "after compile of " << xhpFileName << std::endl); + HelpCompiler hc( streamTable, xhpFile, langsourceRoot, zipdir, + compactStylesheet, embeddStylesheet, module, lang, bExtensionMode ); - if (!success && !bExtensionMode) - { - std::stringstream aStrStream; - aStrStream << - "\nERROR: compiling help particle '" - << xhpFileName - << "' for language '" - << lang - << "' failed!"; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); - } + HCDBG(std::cerr << "before compile of " << xhpFileName << std::endl); + bool success = hc.compile(); + HCDBG(std::cerr << "after compile of " << xhpFileName << std::endl); + + if (!success && !bExtensionMode) + { + std::stringstream aStrStream; + aStrStream << + "\nERROR: compiling help particle '" + << xhpFileName + << "' for language '" + << lang + << "' failed!"; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } - if (!m_bCreateIndex) - continue; + if (!m_bCreateIndex) + continue; - std::string documentPath = streamTable.document_path; - if (documentPath.find("/") == 0) - documentPath = documentPath.substr(1); + std::string documentPath = streamTable.document_path; + if (documentPath.find("/") == 0) + documentPath = documentPath.substr(1); - std::string documentJarfile = streamTable.document_module + ".jar"; + std::string documentJarfile = streamTable.document_module + ".jar"; - std::string documentTitle = streamTable.document_title; - if (documentTitle.empty()) - documentTitle = ""; + std::string documentTitle = streamTable.document_title; + if (documentTitle.empty()) + documentTitle = ""; - const std::string& fileB = documentPath; - const std::string& jarfileB = documentJarfile; - std::string& titleB = documentTitle; + const std::string& fileB = documentPath; + const std::string& jarfileB = documentJarfile; + std::string& titleB = documentTitle; - // add once this as its own id. - addBookmark( pFileDbBase_DBHelp, documentPath, fileB, std::string(), jarfileB, titleB); + // add once this as its own id. + addBookmark( pFileDbBase_DBHelp, documentPath, fileB, std::string(), jarfileB, titleB); - const HashSet *hidlist = streamTable.appl_hidlist; - if (!hidlist) - hidlist = streamTable.default_hidlist; - if (hidlist && !hidlist->empty()) - { - // now iterate over all elements of the hidlist - HashSet::const_iterator aEnd = hidlist->end(); - for (HashSet::const_iterator hidListIter = hidlist->begin(); - hidListIter != aEnd; ++hidListIter) + const HashSet *hidlist = streamTable.appl_hidlist; + if (!hidlist) + hidlist = streamTable.default_hidlist; + if (hidlist && !hidlist->empty()) { - std::string thishid = *hidListIter; - - std::string anchorB; - size_t index = thishid.rfind('#'); - if (index != std::string::npos) + // now iterate over all elements of the hidlist + HashSet::const_iterator aEnd = hidlist->end(); + for (HashSet::const_iterator hidListIter = hidlist->begin(); + hidListIter != aEnd; ++hidListIter) { - anchorB = thishid.substr(1 + index); - thishid = thishid.substr(0, index); + std::string thishid = *hidListIter; + + std::string anchorB; + size_t index = thishid.rfind('#'); + if (index != std::string::npos) + { + anchorB = thishid.substr(1 + index); + thishid = thishid.substr(0, index); + } + addBookmark( pFileDbBase_DBHelp, thishid, fileB, anchorB, jarfileB, titleB); } - addBookmark( pFileDbBase_DBHelp, thishid, fileB, anchorB, jarfileB, titleB); } - } - // now the keywords - const Hashtable *anchorToLL = streamTable.appl_keywords; - if (!anchorToLL) - anchorToLL = streamTable.default_keywords; - if (anchorToLL && !anchorToLL->empty()) - { - std::string fakedHid = URLEncoder::encode(documentPath); - Hashtable::const_iterator aEnd = anchorToLL->end(); - for (Hashtable::const_iterator enumer = anchorToLL->begin(); - enumer != aEnd; ++enumer) + // now the keywords + const Hashtable *anchorToLL = streamTable.appl_keywords; + if (!anchorToLL) + anchorToLL = streamTable.default_keywords; + if (anchorToLL && !anchorToLL->empty()) { - const std::string &anchor = enumer->first; - addBookmark(pFileDbBase_DBHelp, documentPath, fileB, - anchor, jarfileB, titleB); - std::string totalId = fakedHid + "#" + anchor; - // std::cerr << hzipFileName << std::endl; - const LinkedList& ll = enumer->second; - LinkedList::const_iterator aOtherEnd = ll.end(); - for (LinkedList::const_iterator llIter = ll.begin(); - llIter != aOtherEnd; ++llIter) + std::string fakedHid = URLEncoder::encode(documentPath); + Hashtable::const_iterator aEnd = anchorToLL->end(); + for (Hashtable::const_iterator enumer = anchorToLL->begin(); + enumer != aEnd; ++enumer) { - helpKeyword.insert(*llIter, totalId); + const std::string &anchor = enumer->first; + addBookmark(pFileDbBase_DBHelp, documentPath, fileB, + anchor, jarfileB, titleB); + std::string totalId = fakedHid + "#" + anchor; + // std::cerr << hzipFileName << std::endl; + const LinkedList& ll = enumer->second; + LinkedList::const_iterator aOtherEnd = ll.end(); + for (LinkedList::const_iterator llIter = ll.begin(); + llIter != aOtherEnd; ++llIter) + { + helpKeyword.insert(*llIter, totalId); + } } - } - } + } - // and last the helptexts - const Stringtable *helpTextHash = streamTable.appl_helptexts; - if (!helpTextHash) - helpTextHash = streamTable.default_helptexts; - if (helpTextHash && !helpTextHash->empty()) - { - Stringtable::const_iterator aEnd = helpTextHash->end(); - for (Stringtable::const_iterator helpTextIter = helpTextHash->begin(); - helpTextIter != aEnd; ++helpTextIter) + // and last the helptexts + const Stringtable *helpTextHash = streamTable.appl_helptexts; + if (!helpTextHash) + helpTextHash = streamTable.default_helptexts; + if (helpTextHash && !helpTextHash->empty()) { - std::string helpTextId = helpTextIter->first; - const std::string& helpTextText = helpTextIter->second; + Stringtable::const_iterator aEnd = helpTextHash->end(); + for (Stringtable::const_iterator helpTextIter = helpTextHash->begin(); + helpTextIter != aEnd; ++helpTextIter) + { + std::string helpTextId = helpTextIter->first; + const std::string& helpTextText = helpTextIter->second; - helpTextId = URLEncoder::encode(helpTextId); + helpTextId = URLEncoder::encode(helpTextId); - if( pFileHelpText_DBHelp != NULL ) - writeKeyValue_DBHelp( pFileHelpText_DBHelp, helpTextId, helpTextText ); + if( pFileHelpText_DBHelp != NULL ) + writeKeyValue_DBHelp( pFileHelpText_DBHelp, helpTextId, helpTextText ); + } } - } - //IndexerPreProcessor - if( !bExtensionMode || bIndexForExtension ) - { - // now the indexing - xmlDocPtr document = streamTable.appl_doc; - if (!document) - document = streamTable.default_doc; - if (document) + //IndexerPreProcessor + if( !bExtensionMode || bIndexForExtension ) { - std::string temp = module; - std::transform (temp.begin(), temp.end(), temp.begin(), tocharlower); - m_pIndexerPreProcessor->processDocument(document, URLEncoder::encode(documentPath) ); + // now the indexing + xmlDocPtr document = streamTable.appl_doc; + if (!document) + document = streamTable.default_doc; + if (document) + { + std::string temp = module; + std::transform (temp.begin(), temp.end(), temp.begin(), tocharlower); + m_pIndexerPreProcessor->processDocument(document, URLEncoder::encode(documentPath) ); + } } - } - } // while loop over hzip files ending + } - } // try + } catch( const HelpProcessingException& ) { // catch HelpProcessingException to avoid locking data bases -- cgit