[Libreoffice-commits] core.git: helpcompiler/source

2023-09-15 Thread Mike Kaganski (via logerrit)
 helpcompiler/source/HelpIndexer.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 0e6f5ac45e46fa9b17a656d2873453373d7d
Author: Mike Kaganski 
AuthorDate: Fri Sep 15 17:17:07 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Sep 15 20:02:09 2023 +0200

Related: tdf#157254 Shorten paths by removing relative parts

E.g., a path like

C:\lo\src\build\instdir\program\..\program\..\user\extensions\bundled\registry\com.sun.star.comp.deployment.help.PackageRegistryBackend\lu149121qyy8a.tmp\da\help.idxl
would become 22 characters shorter:

C:\lo\src\build\instdir\user\extensions\bundled\registry\com.sun.star.comp.deployment.help.PackageRegistryBackend\lu149121qyy8a.tmp\da\help.idxl

Change-Id: Id6d397fdd7a1771225eef2e7e49ddb80802685b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156947
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/helpcompiler/source/HelpIndexer.cxx 
b/helpcompiler/source/HelpIndexer.cxx
index e55f0760400b..44506bddfc31 100644
--- a/helpcompiler/source/HelpIndexer.cxx
+++ b/helpcompiler/source/HelpIndexer.cxx
@@ -35,8 +35,11 @@ HelpIndexer::HelpIndexer(OUString lang, OUString module,
 : d_lang(std::move(lang)), d_module(std::move(module))
 {
 d_indexDir = outDir + OUStringChar('/') + d_module + ".idxl";
+osl_getAbsoluteFileURL(nullptr, d_indexDir.pData, _indexDir.pData);
 d_captionDir = OUString::Concat(srcDir) + "/caption";
+osl_getAbsoluteFileURL(nullptr, d_captionDir.pData, _captionDir.pData);
 d_contentDir = OUString::Concat(srcDir) + "/content";
+osl_getAbsoluteFileURL(nullptr, d_contentDir.pData, _contentDir.pData);
 }
 
 #if defined _WIN32


[Libreoffice-commits] core.git: helpcompiler/source

2023-08-25 Thread Mike Kaganski (via logerrit)
 helpcompiler/source/HelpCompiler.cxx |   21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit e78eee620235817c01a8516e0cb9f1be5d5bf361
Author: Mike Kaganski 
AuthorDate: Fri Aug 25 10:04:57 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Aug 25 14:30:42 2023 +0200

Simplify a bit

Change-Id: Ie3a826430f016f79190a3d74885551cd72a2a1b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156088
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/helpcompiler/source/HelpCompiler.cxx 
b/helpcompiler/source/HelpCompiler.cxx
index b2329c0678f7..120fb702f0d5 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -43,8 +43,7 @@ HelpCompiler::HelpCompiler(StreamTable _streamTable, 
fs::path in_inputFile,
 char* os = getenv("OS");
 if (os)
 {
-gui = (strcmp(os, "WNT") ? "UNIX" : "WIN");
-gui = (strcmp(os, "MACOSX") ? gui : "MAC");
+gui = (strcmp(os, "WNT") == 0 ? "WIN" : (strcmp(os, "MACOSX") == 0 ? 
"MAC" : "UNIX"));
 }
 }
 
@@ -71,7 +70,7 @@ xmlDocPtr HelpCompiler::compactXhpForJar( xmlDocPtr doc )
 
 if (!compact)
 {
-compact = xsltParseStylesheetFile(reinterpret_cast(resCompactStylesheet.native_file_string().c_str()));
+compact = 
xsltParseStylesheetFile(BAD_CAST(resCompactStylesheet.native_file_string().c_str()));
 }
 
 compacted = xsltApplyStylesheet(compact, doc, params);
@@ -129,7 +128,7 @@ xmlDocPtr HelpCompiler::getSourceDocument(const fs::path 
)
 {
 static std::string fsroot('\'' + src.toUTF8() + '\'');
 
-cur = xsltParseStylesheetFile(reinterpret_cast(resEmbStylesheet.native_file_string().c_str()));
+cur = 
xsltParseStylesheetFile(BAD_CAST(resEmbStylesheet.native_file_string().c_str()));
 
 int nbparams = 0;
 params[nbparams++] = "fsroot";
@@ -158,7 +157,7 @@ xmlNodePtr HelpCompiler::clone(xmlNodePtr node, const 
std::string& appl)
 {
 if (strcmp(reinterpret_cast(list->name), 
"switchinline") == 0 || strcmp(reinterpret_cast(list->name), 
"switch") == 0)
 {
-std::string tmp="";
+std::string tmp;
 xmlChar * prop = xmlGetProp(list, reinterpret_cast("select"));
 if (prop != nullptr)
 {
@@ -172,13 +171,13 @@ xmlNodePtr HelpCompiler::clone(xmlNodePtr node, const 
std::string& appl)
 }
 xmlFree(prop);
 }
-if (tmp.compare("") != 0)
+if (!tmp.empty())
 {
 bool isCase=false;
 xmlNodePtr caseList=list->xmlChildrenNode;
 while (caseList)
 {
-xmlChar *select = xmlGetProp(caseList, 
reinterpret_cast("select"));
+xmlChar* select = xmlGetProp(caseList, 
BAD_CAST("select"));
 if (select)
 {
 if (!strcmp(reinterpret_cast(select), 
tmp.c_str()) && !isCase)
@@ -314,14 +313,14 @@ void myparser::traverse( xmlNodePtr parentNode )
 }
 else if (!strcmp(reinterpret_cast(test->name), 
"bookmark"))
 {
-xmlChar *branchxml = xmlGetProp(test, reinterpret_cast("branch"));
+xmlChar* branchxml = xmlGetProp(test, BAD_CAST("branch"));
 if (branchxml == nullptr) {
 throw HelpProcessingException(
 HelpProcessingErrorClass::XmlParsing, "bookmark lacks 
branch attribute");
 }
 std::string branch(reinterpret_cast(branchxml));
 xmlFree (branchxml);
-xmlChar *idxml = xmlGetProp(test, reinterpret_cast("id"));
+xmlChar* idxml = xmlGetProp(test, BAD_CAST("id"));
 if (idxml == nullptr) {
 throw HelpProcessingException(
 HelpProcessingErrorClass::XmlParsing, "bookmark lacks id 
attribute");
@@ -355,7 +354,7 @@ void myparser::traverse( xmlNodePtr parentNode )
 continue;
 
 std::string embedded;
-xmlChar *embeddedxml = xmlGetProp(nd, 
reinterpret_cast("embedded"));
+xmlChar* embeddedxml = xmlGetProp(nd, 
BAD_CAST("embedded"));
 if (embeddedxml)
 {
 embedded = 
std::string(reinterpret_cast(embeddedxml));
@@ -399,7 +398,7 @@ void myparser::traverse( xmlNodePtr parentNode )
 
 //tool-tip target
 std::string hidstr(".");  //. == previous seen hid bookmarks
-xmlChar *hid = xmlGetProp(test, reinterpret_cast("hid"));
+xmlChar* hid = xmlGetProp(test, BAD_CAST("hid"));
 if (hid)
 {
 hidstr = std::string(reinterpret_cast(hid));


[Libreoffice-commits] core.git: helpcompiler/source svx/source

2022-06-24 Thread Noel Grandin (via logerrit)
 helpcompiler/source/HelpLinker.cxx   |2 +-
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2df577b1a89d153da78b6c333e741082cf969086
Author: Noel Grandin 
AuthorDate: Mon Jun 13 18:46:45 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 24 08:22:44 2022 +0200

loplugin:moveit

Change-Id: If1e6428285bdc5631cebc1acfcb850ac0df6d94d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136300
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index f7acc30ecc7d..e95b9168bf17 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -346,7 +346,7 @@ void HelpLinker::link()
 xhpFile = fs::path(xhpFileName, fs::native);
 }
 
-HelpCompiler hc( streamTable, xhpFile, langsourceRoot, zipdir,
+HelpCompiler hc( streamTable, std::move(xhpFile), 
std::move(langsourceRoot), zipdir,
 compactStylesheet, embeddStylesheet, module, lang, 
bExtensionMode );
 
 HCDBG(std::cerr << "before compile of " << xhpFileName << 
std::endl);
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx 
b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index 04b6a16163a4..331fe74b99dc 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -294,7 +294,7 @@ void SlideBackgroundFillPrimitive2D::create2DDecomposition(
 // create MaskPrimitive2D to limit display to PolygonGeometry
 const Primitive2DReference aMasked(
 new MaskPrimitive2D(
-aPolyPolygon,
+std::move(aPolyPolygon),
 std::move(rContainer)));
 
 rContainer = Primitive2DContainer { aMasked };


[Libreoffice-commits] core.git: helpcompiler/source

2022-06-22 Thread Noel Grandin (via logerrit)
 helpcompiler/source/HelpIndexer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1eaf11278a2f2f81fbff774fef73f72a6b1a4efb
Author: Noel Grandin 
AuthorDate: Wed Jun 22 14:16:55 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jun 22 22:21:10 2022 +0200

fix build --with-help

after
commit 966d9757de471f2a5ea1ffa87cef019dcf1e0cb3
Author: Noel Grandin 
Date:   Tue Jun 21 09:05:15 2022 +0200
clang-tidy modernize-pass-by-value in helpcompiler

Change-Id: Ie7c47d950287d96020857589f826b063e0912df2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136281
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/helpcompiler/source/HelpIndexer.cxx 
b/helpcompiler/source/HelpIndexer.cxx
index fc6da05f1d56..e55f0760400b 100644
--- a/helpcompiler/source/HelpIndexer.cxx
+++ b/helpcompiler/source/HelpIndexer.cxx
@@ -34,7 +34,7 @@ HelpIndexer::HelpIndexer(OUString lang, OUString module,
 std::u16string_view srcDir, std::u16string_view outDir)
 : d_lang(std::move(lang)), d_module(std::move(module))
 {
-d_indexDir = outDir + OUStringChar('/') + module + ".idxl";
+d_indexDir = outDir + OUStringChar('/') + d_module + ".idxl";
 d_captionDir = OUString::Concat(srcDir) + "/caption";
 d_contentDir = OUString::Concat(srcDir) + "/content";
 }


[Libreoffice-commits] core.git: helpcompiler/source i18npool/inc i18npool/source i18nutil/source idl/inc idl/IwyuFilter_idl.yaml idl/source io/source javaunohelper/source jvmfwk/inc jvmfwk/plugins jvm

2022-01-27 Thread Gabor Kelemen (via logerrit)
 helpcompiler/source/HelpLinker_main.cxx  |1 
 i18npool/inc/bullet.h|4 +++
 i18npool/inc/characterclassificationImpl.hxx |1 
 i18npool/inc/collatorImpl.hxx|1 
 i18npool/inc/inputsequencechecker.hxx|1 
 i18npool/inc/localedata.hxx  |1 
 i18npool/inc/wtt.h   |2 +
 i18npool/source/nativenumber/data/numberchar.h   |2 +
 i18nutil/source/utility/paper.cxx|1 
 idl/IwyuFilter_idl.yaml  |2 +
 idl/inc/basobj.hxx   |1 
 idl/inc/bastype.hxx  |2 -
 idl/inc/hash.hxx |3 --
 idl/inc/module.hxx   |1 
 idl/inc/object.hxx   |4 ++-
 idl/inc/slot.hxx |3 +-
 idl/inc/types.hxx|1 
 idl/source/cmptools/hash.cxx |5 ---
 idl/source/objects/basobj.cxx|2 -
 idl/source/objects/bastype.cxx   |3 --
 idl/source/objects/module.cxx|2 -
 idl/source/objects/object.cxx|2 -
 idl/source/objects/slot.cxx  |1 
 idl/source/prj/command.cxx   |1 
 idl/source/prj/database.cxx  |3 +-
 idl/source/prj/globals.cxx   |2 -
 idl/source/prj/parser.cxx|1 
 idl/source/prj/svidl.cxx |2 -
 io/source/acceptor/acc_pipe.cxx  |1 
 io/source/acceptor/acc_socket.cxx|1 
 io/source/connector/ctr_socket.cxx   |1 
 javaunohelper/source/vm.cxx  |1 
 jvmfwk/inc/fwkutil.hxx   |1 
 jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx |1 
 jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx |2 -
 jvmfwk/source/framework.cxx  |2 +
 l10ntools/IwyuFilter_l10ntools.yaml  |9 ++
 l10ntools/inc/cfgmerge.hxx   |1 
 l10ntools/inc/common.hxx |1 
 l10ntools/inc/export.hxx |   12 -
 l10ntools/inc/helper.hxx |5 ---
 l10ntools/inc/helpmerge.hxx  |6 ++--
 l10ntools/inc/lngmerge.hxx   |3 --
 l10ntools/inc/treemerge.hxx  |1 
 l10ntools/inc/xmlparse.hxx   |4 ---
 l10ntools/inc/xrmmerge.hxx   |5 +++
 l10ntools/source/cfgmerge.cxx|3 --
 l10ntools/source/common.cxx  |2 +
 l10ntools/source/helper.cxx  |3 ++
 l10ntools/source/helpex.cxx  |1 
 l10ntools/source/helpmerge.cxx   |9 --
 l10ntools/source/lngex.cxx   |2 +
 l10ntools/source/lngmerge.cxx|4 +--
 l10ntools/source/localize.cxx|1 
 l10ntools/source/po.cxx  |1 
 l10ntools/source/propmerge.cxx   |3 +-
 l10ntools/source/treemerge.cxx   |2 -
 l10ntools/source/xmlparse.cxx|6 +---
 l10ntools/source/xrmmerge.cxx|3 --
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx  |1 
 libreofficekit/qa/unit/checkapi.cxx  |5 +--
 libreofficekit/qa/unit/test.h|2 +
 lingucomponent/IwyuFilter_lingucomponent.yaml|   20 +++
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx|5 ---
 lingucomponent/source/languageguessing/guess.cxx |1 
 lingucomponent/source/languageguessing/guesslang.cxx |1 
 lingucomponent/source/languageguessing/simpleguesser.cxx |4 ---
 lingucomponent/source/languageguessing/simpleguesser.hxx |2 -
 lingucomponent/source/lingutil/lingutil.hxx  |2 -
 lingucomponent/source/numbertext/numbertext.cxx  |5 ---
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |7 -
 lingucomponent/source/spellcheck/spell/sspellimp.hxx |9 ++
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx  |6 
 linguistic/IwyuFilter_linguistic.yaml

[Libreoffice-commits] core.git: helpcompiler/source

2021-10-22 Thread Julien Nabet (via logerrit)
 helpcompiler/source/HelpLinker.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 7b11cda2aa1f9bd069d81c30021448674a97ce30
Author: Julien Nabet 
AuthorDate: Fri Oct 22 18:17:59 2021 +0200
Commit: Julien Nabet 
CommitDate: Fri Oct 22 19:30:32 2021 +0200

Revert "Simplify vector initialization in helpcompiler"

since it needs 2 allocations instead of one

This reverts commit cd5ee8c7d3f06fe78e6b3993845a3c2abc7cb72a.

Change-Id: I4958cacf747291c923b74fdfa49679e831d0ef1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124070
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index 0aedf9b42692..f7acc30ecc7d 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -856,13 +856,11 @@ bool compileExtensionHelp
 {
 bool bSuccess = true;
 
-OString aOExtensionName = OUStringToOString( aExtensionName, 
osl_getThreadTextEncoding() );
-std::vector args
-{
-std::string("-mod"),
-std::string(aOExtensionName.getStr())
-};
+std::vector args;
 args.reserve(nXhpFileCount + 2);
+args.push_back(std::string("-mod"));
+OString aOExtensionName = OUStringToOString( aExtensionName, 
osl_getThreadTextEncoding() );
+args.push_back(std::string(aOExtensionName.getStr()));
 
 for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
 {


[Libreoffice-commits] core.git: helpcompiler/source

2021-01-01 Thread Mike Kaganski (via logerrit)
 helpcompiler/source/HelpIndexer.cxx |   63 +---
 1 file changed, 58 insertions(+), 5 deletions(-)

New commits:
commit 83b2ac77332d484ef2c25e58e71e04cb73031b02
Author: Mike Kaganski 
AuthorDate: Tue Dec 29 11:46:12 2020 +0300
Commit: Mike Kaganski 
CommitDate: Sat Jan 2 07:25:45 2021 +0100

Use GetShortPathNameW workaround on Windows for help indexer

Lucene does not accept Unicode paths; it uses thread encoding. On
Windows, that makes it fail for any path that contains characters
not representable in ACP. Using short path name tries to workaround
that when first attempt has failed.

Since Windows 10 build 17134, the UCRT supports using a UTF-8 code
page: see

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale.
This has benefit of using Unicode, but I hesitate using it, since I
am not sure if setting the locale globally to UTF8 is a good idea
(what side effects may it have on other external libraries or our
use of CRT functions, when thread encoding differs from C locale?),
and if only setting it at object creation, it would crash later,
when attempting to access the stored Unicode path with restored old
locale.

Change-Id: I6a3a5a84ba54d8046ec011989289c9c7d5fa5c92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108484
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/helpcompiler/source/HelpIndexer.cxx 
b/helpcompiler/source/HelpIndexer.cxx
index b8889a619ee9..ad8bd9f4e6df 100644
--- a/helpcompiler/source/HelpIndexer.cxx
+++ b/helpcompiler/source/HelpIndexer.cxx
@@ -20,6 +20,12 @@
 #include 
 #include 
 
+#if defined _WIN32
+#include 
+#include 
+#include 
+#endif
+
 using namespace lucene::document;
 
 HelpIndexer::HelpIndexer(OUString const , OUString const ,
@@ -31,6 +37,38 @@ HelpIndexer::HelpIndexer(OUString const , OUString 
const ,
 d_contentDir = OUString::Concat(srcDir) + "/content";
 }
 
+#if defined _WIN32
+namespace
+{
+template 
+auto TryWithUnicodePathWorkaround(const OUString& ustrPath, const Constructor& 
constructor)
+{
+const rtl_TextEncoding eThreadEncoding = osl_getThreadTextEncoding();
+OString sPath = OUStringToOString(ustrPath, eThreadEncoding);
+try
+{
+// First try path in thread encoding (ACP in case of Windows).
+return constructor(sPath);
+}
+catch (const CLuceneError&)
+{
+// Maybe the path contains characters not representable in ACP. 
There's no API in lucene
+// that takes Unicode strings (they take 8-bit strings, and pass them 
to CRT library
+// functions without conversion).
+
+// For a workaround, try short name, which should only contain ASCII 
characters. Would
+// not help (i.e., would return original long name) if short (8.3) 
file name creation is
+// disabled in OS or volume settings.
+wchar_t buf[32767];
+if (GetShortPathNameW(o3tl::toW(ustrPath.getStr()), buf, 
std::size(buf)) == 0)
+throw;
+sPath = OUStringToOString(o3tl::toU(buf), eThreadEncoding);
+return constructor(sPath);
+}
+}
+}
+#endif
+
 bool HelpIndexer::indexDocuments()
 {
 if (!scanForFiles())
@@ -51,25 +89,34 @@ bool HelpIndexer::indexDocuments()
 OUString ustrSystemPath;
 osl::File::getSystemPathFromFileURL(d_indexDir, ustrSystemPath);
 
+#if defined _WIN32
+// Make sure the path exists, or GetShortPathNameW (if attempted) will 
fail.
+osl::Directory::createPath(d_indexDir);
+auto writer = TryWithUnicodePathWorkaround(ustrSystemPath, 
[](const OString& s) {
+return std::make_unique(s.getStr(), 
analyzer.get(), true);
+});
+#else
 OString indexDirStr = OUStringToOString(ustrSystemPath, 
osl_getThreadTextEncoding());
-lucene::index::IndexWriter writer(indexDirStr.getStr(), 
analyzer.get(), true);
+auto writer = 
std::make_unique(indexDirStr.getStr(),
+   
analyzer.get(), true);
+#endif
+
 //Double limit of tokens allowed, otherwise we'll get a too-many-tokens
 //exception for ja help. Could alternative ignore the exception and get
 //truncated results as per java-Lucene apparently
-
writer.setMaxFieldLength(lucene::index::IndexWriter::DEFAULT_MAX_FIELD_LENGTH*2);
+
writer->setMaxFieldLength(lucene::index::IndexWriter::DEFAULT_MAX_FIELD_LENGTH*2);
 
 // Index the identified help files
 Document doc;
 for (auto const& elem : d_files)
 {
 helpDocument(elem, );
-writer.addDocument();
+writer->addDocument();
 doc.clear();
 }
-writer.optimize();
 
 // Optimize the index
-writer.optimize();
+writer->optimize();
 }
 catch (CLuceneError )
 {
@@ -137,8 +184,14 @@ 

[Libreoffice-commits] core.git: helpcompiler/source

2019-12-29 Thread Stephan Bergmann (via logerrit)
 helpcompiler/source/HelpIndexer.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit ba2ef4a37f7e182fa6cecbfc9c47937c8e56e639
Author: Stephan Bergmann 
AuthorDate: Sun Dec 29 23:33:49 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 30 08:32:26 2019 +0100

Avoid -Werror,-Wdeprecated-enum-enum-conversion

...with recent Clang 10 trunk:

> helpcompiler/source/HelpIndexer.cxx:119:71: error: bitwise operation 
between different enumeration types ('lucene::document::Field::Store' and 
'lucene::document::Field::Index') is deprecated 
[-Werror,-Wdeprecated-enum-enum-conversion]
> doc->add(*_CLNEW Field(_T("path"), aPath.data(), Field::STORE_YES | 
Field::INDEX_UNTOKENIZED));
>   ^ 


where the Field constructor in
workdir/UnpackedTarball/clucene/src/core/CLucene/document/Field.h has an 
"int
_config" parameter that is apparently intended to take a mix of Store (bit
values 1, 2, 4) and Index (bit values 16, 32, 64, 128) flags.

Change-Id: Ie080e44bf820cb776bc61ac22cf73f5437d8c5dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85972
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/helpcompiler/source/HelpIndexer.cxx 
b/helpcompiler/source/HelpIndexer.cxx
index 198824d3b92f..dca372ea3700 100644
--- a/helpcompiler/source/HelpIndexer.cxx
+++ b/helpcompiler/source/HelpIndexer.cxx
@@ -116,7 +116,7 @@ void HelpIndexer::helpDocument(OUString const & fileName, 
Document *doc) const {
 
 OUString path = "#HLP#" + d_module + "/" + fileName;
 std::vector aPath(OUStringToTCHARVec(path));
-doc->add(*_CLNEW Field(_T("path"), aPath.data(), Field::STORE_YES | 
Field::INDEX_UNTOKENIZED));
+doc->add(*_CLNEW Field(_T("path"), aPath.data(), int(Field::STORE_YES) | 
int(Field::INDEX_UNTOKENIZED)));
 
 OUString sEscapedFileName =
 rtl::Uri::encode(fileName,
@@ -124,11 +124,11 @@ void HelpIndexer::helpDocument(OUString const & fileName, 
Document *doc) const {
 
 // Add the caption as a field.
 OUString captionPath = d_captionDir + "/" + sEscapedFileName;
-doc->add(*_CLNEW Field(_T("caption"), helpFileReader(captionPath), 
Field::STORE_NO | Field::INDEX_TOKENIZED));
+doc->add(*_CLNEW Field(_T("caption"), helpFileReader(captionPath), 
int(Field::STORE_NO) | int(Field::INDEX_TOKENIZED)));
 
 // Add the content as a field.
 OUString contentPath = d_contentDir + "/" + sEscapedFileName;
-doc->add(*_CLNEW Field(_T("content"), helpFileReader(contentPath), 
Field::STORE_NO | Field::INDEX_TOKENIZED));
+doc->add(*_CLNEW Field(_T("content"), helpFileReader(contentPath), 
int(Field::STORE_NO) | int(Field::INDEX_TOKENIZED)));
 }
 
 lucene::util::Reader *HelpIndexer::helpFileReader(OUString const & path) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcompiler/source

2019-11-22 Thread Caolán McNamara (via logerrit)
 helpcompiler/source/HelpCompiler.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 8baf30424fa47138cf5828d80433c13e3f41edb3
Author: Caolán McNamara 
AuthorDate: Fri Nov 22 11:24:40 2019 +
Commit: Caolán McNamara 
CommitDate: Fri Nov 22 15:30:37 2019 +0100

document HelpCompiler::getSourceDocument behaviour

Change-Id: I03348fc3bce4c879644c6b8d12444c8ec58c0c5e
Reviewed-on: https://gerrit.libreoffice.org/83469
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/helpcompiler/source/HelpCompiler.cxx 
b/helpcompiler/source/HelpCompiler.cxx
index 306d2d518067..4407d12c7c03 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -111,18 +111,20 @@ void HelpCompiler::saveXhpForJar( xmlDocPtr doc, const 
fs::path  )
 xmlFreeDoc(compacted);
 }
 
-
 xmlDocPtr HelpCompiler::getSourceDocument(const fs::path )
 {
-static xsltStylesheetPtr cur = nullptr;
-
 xmlDocPtr res;
-if( bExtensionMode )
+if (bExtensionMode)
 {
+// this is the mode when used within LibreOffice for importing help
+// bundled with an extension
 res = xmlParseFile(filePath.native_file_string().c_str());
 }
 else
 {
+// this is the mode when used at build time to generate LibreOffice
+// help from its xhp source
+static xsltStylesheetPtr cur = nullptr;
 static const char *params[2 + 1];
 if (!cur)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: helpcompiler/source

2019-11-22 Thread Caolán McNamara (via logerrit)
 helpcompiler/source/HelpCompiler.cxx |   24 +++-
 1 file changed, 3 insertions(+), 21 deletions(-)

New commits:
commit b587072aeae0670758b517d26fe0cb1fdda6a3b6
Author: Caolán McNamara 
AuthorDate: Fri Nov 22 11:03:07 2019 +
Commit: Caolán McNamara 
CommitDate: Fri Nov 22 14:24:20 2019 +0100

drop impl_sleep hack

doesn't seem to make any sense, maybe it did in some dmake-era
dependency problem when building our help content ?

Change-Id: Id964ad73249ef33ba0102fb7d2d853b2719e3814
Reviewed-on: https://gerrit.libreoffice.org/83466
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/helpcompiler/source/HelpCompiler.cxx 
b/helpcompiler/source/HelpCompiler.cxx
index 8be6842fd3a1..b8a0af737d89 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -32,10 +32,6 @@
 #include 
 #include 
 
-static void impl_sleep( sal_uInt32 nSec )
-{
-osl::Thread::wait( std::chrono::seconds(nSec) );
-}
 HelpCompiler::HelpCompiler(StreamTable _streamTable, const fs::path 
_inputFile,
 const fs::path _src, const fs::path _zipdir, const fs::path 
_resCompactStylesheet,
 const fs::path _resEmbStylesheet, const std::string _module, const 
std::string _lang,
@@ -124,10 +120,6 @@ xmlDocPtr HelpCompiler::getSourceDocument(const fs::path 
)
 if( bExtensionMode )
 {
 res = xmlParseFile(filePath.native_file_string().c_str());
-if( !res ){
-impl_sleep( 3 );
-res = xmlParseFile(filePath.native_file_string().c_str());
-}
 }
 else
 {
@@ -146,11 +138,6 @@ xmlDocPtr HelpCompiler::getSourceDocument(const fs::path 
)
 params[nbparams] = nullptr;
 }
 xmlDocPtr doc = xmlParseFile(filePath.native_file_string().c_str());
-if( !doc )
-{
-impl_sleep( 3 );
-doc = xmlParseFile(filePath.native_file_string().c_str());
-}
 
 saveXhpForJar( doc, filePath );
 
@@ -454,14 +441,9 @@ void HelpCompiler::compile()
 
 if (!docResolvedOrg)
 {
-impl_sleep( 3 );
-docResolvedOrg = getSourceDocument(inputFile);
-if( !docResolvedOrg )
-{
-std::stringstream aStrStream;
-aStrStream << "ERROR: file not existing: " << 
inputFile.native_file_string().c_str() << std::endl;
-throw HelpProcessingException( HelpProcessingErrorClass::General, 
aStrStream.str() );
-}
+std::stringstream aStrStream;
+aStrStream << "ERROR: file not existing: " << 
inputFile.native_file_string().c_str() << std::endl;
+throw HelpProcessingException( HelpProcessingErrorClass::General, 
aStrStream.str() );
 }
 
 std::string documentId;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: helpcompiler/source

2019-07-18 Thread Caolán McNamara (via logerrit)
 helpcompiler/source/HelpIndexer_main.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fa5c79b4c62e1e1c53b36f79947d2cba7e3db4fa
Author: Caolán McNamara 
AuthorDate: Thu Jul 18 11:08:19 2019 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 19 00:06:11 2019 +0200

cid#1448441 Unchecked return value

Change-Id: I97f6ad2bd0a6d838871cfb9ff54f2e654d6abfd0
Reviewed-on: https://gerrit.libreoffice.org/75893
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/helpcompiler/source/HelpIndexer_main.cxx 
b/helpcompiler/source/HelpIndexer_main.cxx
index 0919e89eb004..3ad47bbf7a28 100644
--- a/helpcompiler/source/HelpIndexer_main.cxx
+++ b/helpcompiler/source/HelpIndexer_main.cxx
@@ -69,7 +69,7 @@ int main(int argc, char **argv)
 OUString cwd;
 osl_getProcessWorkingDir();
 
-osl::File::getAbsoluteFileURL(cwd, sDir, sDir);
+(void)osl::File::getAbsoluteFileURL(cwd, sDir, sDir);
 
 HelpIndexer indexer(
 OUString(lang.c_str(), lang.size(), osl_getThreadTextEncoding()),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: helpcompiler/source

2018-06-13 Thread Stephan Bergmann
 helpcompiler/source/HelpCompiler.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 98db90e2ccd7cefaa5094c2d1d2af8cb10b4a867
Author: Stephan Bergmann 
Date:   Wed Jun 13 10:21:21 2018 +0200

Don't create std::string from nullptr

...which violates the ctor's preconditions, so is UB.  Also, the "XML Help
Document Type Definition" appendix of
 
states
that "branch" and "id" attributes are #REQUIRED for the "bookmark" element.

(There's probably further cases in the surrounding code where a std::string 
is
created from a potentially null argument, which would benefit from similar
fixes.)

Change-Id: I414576d13de784de1290951bcdd5e3ecb51f9cb8
Reviewed-on: https://gerrit.libreoffice.org/55735
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/helpcompiler/source/HelpCompiler.cxx 
b/helpcompiler/source/HelpCompiler.cxx
index 1013c8d8e81a..8cfdcecfa539 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -325,10 +325,18 @@ void myparser::traverse( xmlNodePtr parentNode )
 else if (!strcmp(reinterpret_cast(test->name), 
"bookmark"))
 {
 xmlChar *branchxml = xmlGetProp(test, reinterpret_cast("branch"));
-xmlChar *idxml = xmlGetProp(test, reinterpret_cast("id"));
+if (branchxml == nullptr) {
+throw HelpProcessingException(
+HelpProcessingErrorClass::XmlParsing, "bookmark lacks 
branch attribute");
+}
 std::string branch(reinterpret_cast(branchxml));
-std::string anchor(reinterpret_cast(idxml));
 xmlFree (branchxml);
+xmlChar *idxml = xmlGetProp(test, reinterpret_cast("id"));
+if (idxml == nullptr) {
+throw HelpProcessingException(
+HelpProcessingErrorClass::XmlParsing, "bookmark lacks id 
attribute");
+}
+std::string anchor(reinterpret_cast(idxml));
 xmlFree (idxml);
 
 if (branch.compare(0, 3, "hid") == 0)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcompiler/source sd/inc sd/source sfx2/source stoc/source sw/source ucb/source xmlhelp/source

2018-06-06 Thread Abhyudaya Sharma
 helpcompiler/source/HelpLinker.cxx|1 -
 sd/inc/CustomAnimationPreset.hxx  |5 ++---
 sd/source/core/CustomAnimationPreset.cxx  |   11 ++-
 sd/source/ui/animations/CustomAnimationDialog.cxx |6 +++---
 sd/source/ui/animations/CustomAnimationPane.cxx   |4 ++--
 sfx2/source/dialog/templdlg.cxx   |8 
 sfx2/source/inc/templdgi.hxx  |3 +--
 stoc/source/corereflection/base.hxx   |3 +--
 sw/source/filter/ww8/writerhelper.cxx |3 +--
 ucb/source/ucp/ftp/ftpresultsetbase.hxx   |3 +--
 xmlhelp/source/cxxhelp/provider/resultsetbase.hxx |2 +-
 11 files changed, 22 insertions(+), 27 deletions(-)

New commits:
commit 251cb2a7b8b6c1f3fa6335911f0df38b23765da2
Author: Abhyudaya Sharma 
Date:   Mon Jun 4 11:10:59 2018 +0530

tdf#96099 Remove std::vector typedefs

Change-Id: Ic7e1cecaecadf3f9ebfa183727d61046dd87e473
Reviewed-on: https://gerrit.libreoffice.org/55260
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index b146349200b7..6cce931643d3 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -130,7 +130,6 @@ void IndexerPreProcessor::processDocument
 struct Data
 {
 std::vector _idList;
-typedef std::vector::const_iterator cIter;
 
 void append(const std::string )
 {
diff --git a/sd/inc/CustomAnimationPreset.hxx b/sd/inc/CustomAnimationPreset.hxx
index 2685dd2be4d3..85318c9c4c2a 100644
--- a/sd/inc/CustomAnimationPreset.hxx
+++ b/sd/inc/CustomAnimationPreset.hxx
@@ -34,7 +34,6 @@ namespace sd {
 
 typedef std::unordered_map< OUString, CustomAnimationEffectPtr > 
EffectsSubTypeMap;
 typedef std::unordered_map< OUString, OUString > UStringMap;
-typedef std::vector< OUString > UStringList;
 
 class CustomAnimationPreset
 {
@@ -51,8 +50,8 @@ public:
 const OUString& getLabel() const { return maLabel; }
 double getDuration() const { return mfDuration; }
 
-UStringList getSubTypes();
-UStringList getProperties() const;
+std::vector getSubTypes();
+std::vector getProperties() const;
 
 bool hasProperty( const OUString& rProperty ) const;
 bool isTextOnly() const { return mbIsTextOnly; }
diff --git a/sd/source/core/CustomAnimationPreset.cxx 
b/sd/source/core/CustomAnimationPreset.cxx
index 84c6413e17c7..e420c5885800 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -48,6 +48,7 @@
 #include 
 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -157,9 +158,9 @@ void CustomAnimationPreset::add( const 
CustomAnimationEffectPtr& pEffect )
 maSubTypes[ pEffect->getPresetSubType() ] = pEffect;
 }
 
-UStringList CustomAnimationPreset::getSubTypes()
+std::vector CustomAnimationPreset::getSubTypes()
 {
-UStringList aSubTypes;
+std::vector aSubTypes;
 
 if( maSubTypes.size() > 1 )
 {
@@ -197,9 +198,9 @@ Reference< XAnimationNode > CustomAnimationPreset::create( 
const OUString& rstrS
 return xNode;
 }
 
-UStringList CustomAnimationPreset::getProperties() const
+std::vector CustomAnimationPreset::getProperties() const
 {
-UStringList aPropertyList;
+std::vector aPropertyList;
 if (!maProperty.isEmpty())
 {
 sal_Int32 nPos = 0;
@@ -572,7 +573,7 @@ Reference< XAnimationNode > 
CustomAnimationPresets::getRandomPreset( sal_Int16 n
 CustomAnimationPresetPtr pPreset = 
pCategory->maEffects[nDescriptor];
 if( pPreset.get() )
 {
-UStringList aSubTypes = pPreset->getSubTypes();
+std::vector aSubTypes = pPreset->getSubTypes();
 
 OUString aSubType;
 if( !aSubTypes.empty() )
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx 
b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 523d869ed683..95f23249006f 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -141,9 +141,9 @@ void PresetPropertyBox::setValue( const Any& rValue, const 
OUString& rPresetId )
 OUString aPropertyValue;
 rValue >>= aPropertyValue;
 
-UStringList aSubTypes( pDescriptor->getSubTypes() );
-UStringList::iterator aIter( aSubTypes.begin() );
-const UStringList::iterator aEnd( aSubTypes.end() );
+std::vector aSubTypes( pDescriptor->getSubTypes() );
+std::vector::iterator aIter( aSubTypes.begin() );
+const std::vector::iterator aEnd( aSubTypes.end() );
 
 mpControl->Enable( aIter != aEnd );
 
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx 
b/sd/source/ui/animations/CustomAnimationPane.cxx
index 01c5a1c9283f..e7f8c553d6a2 100644
--- 

[Libreoffice-commits] core.git: helpcompiler/source

2018-03-18 Thread Julien Nabet
 helpcompiler/source/BasCodeTagger.cxx |   11 +++
 helpcompiler/source/HelpCompiler.cxx  |5 +--
 helpcompiler/source/HelpIndexer.cxx   |5 ++-
 helpcompiler/source/HelpLinker.cxx|   51 --
 4 files changed, 29 insertions(+), 43 deletions(-)

New commits:
commit 93f8b703a0f0287354723855afe8e65297ecf716
Author: Julien Nabet 
Date:   Sat Mar 17 22:06:55 2018 +0100

Use for-range loops in helpcompiler

Change-Id: I787a5b43cb09ac308082cac0e66540f975d79ead
Reviewed-on: https://gerrit.libreoffice.org/51473
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/helpcompiler/source/BasCodeTagger.cxx 
b/helpcompiler/source/BasCodeTagger.cxx
index f59c1d268e0d..8af743e1b5f7 100644
--- a/helpcompiler/source/BasCodeTagger.cxx
+++ b/helpcompiler/source/BasCodeTagger.cxx
@@ -82,7 +82,7 @@ void BasicCodeTagger::getBasicCodeContainerNodes()
 }
 while ( !m_pXmlTreeWalker->end() )
 {
-  m_pXmlTreeWalker->nextNode();
+m_pXmlTreeWalker->nextNode();
 if ( !( xmlStrcmp( m_pXmlTreeWalker->currentNode()->name, 
reinterpret_cast("bascode") ) ) )
 { //Found 
 m_BasicCodeContainerTags.push_back( 
m_pXmlTreeWalker->currentNode() ); //it goes to the end of the list
@@ -139,14 +139,13 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
 RTL_TEXTENCODING_UTF8 );
 std::vector portions;
 m_Highlighter.getHighlightPortions( strLine, portions );
-for (std::vector::iterator i(portions.begin());
- i != portions.end(); ++i)
+for (auto const& portion : portions)
 {
-OString sToken(OUStringToOString(strLine.copy(i->nBegin, 
i->nEnd-i->nBegin), RTL_TEXTENCODING_UTF8));
+OString sToken(OUStringToOString(strLine.copy(portion.nBegin, 
portion.nEnd-portion.nBegin), RTL_TEXTENCODING_UTF8));
 xmlNodePtr text = xmlNewText(reinterpret_cast(sToken.getStr()));
-if ( i->tokenType != TokenType::Whitespace )
+if ( portion.tokenType != TokenType::Whitespace )
 {
-xmlChar* typeStr = getTypeString( i->tokenType );
+xmlChar* typeStr = getTypeString( portion.tokenType );
 curNode = xmlNewTextChild( paragraph, nullptr, 
reinterpret_cast("item"), nullptr );
 xmlNewProp( curNode, reinterpret_cast("type"), 
typeStr );
 xmlAddChild( curNode, text );
diff --git a/helpcompiler/source/HelpCompiler.cxx 
b/helpcompiler/source/HelpCompiler.cxx
index 92856d04cf93..cc8c319e58a5 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -418,10 +418,9 @@ void myparser::traverse( xmlNodePtr parentNode )
 //TODO: make these asserts and flush out all our broken help 
ids
 SAL_WARN_IF(hidstr.empty(), "helpcompiler", "hid='' for text:" 
<< text);
 SAL_WARN_IF(!hidstr.empty() && extendedHelpText.empty(), 
"helpcompiler", "hid='.' with no hid bookmark branches in file: " << fileName + 
" for text: " << text);
-HashSet::const_iterator aEnd = extendedHelpText.end();
-for (HashSet::const_iterator iter = extendedHelpText.begin(); 
iter != aEnd; ++iter)
+for (auto const& elem : extendedHelpText)
 {
-std::string name = *iter;
+std::string name = elem;
 (*helptexts)[name] = text;
 }
 }
diff --git a/helpcompiler/source/HelpIndexer.cxx 
b/helpcompiler/source/HelpIndexer.cxx
index 51966f4c71dc..870db09e0faa 100644
--- a/helpcompiler/source/HelpIndexer.cxx
+++ b/helpcompiler/source/HelpIndexer.cxx
@@ -60,8 +60,9 @@ bool HelpIndexer::indexDocuments()
 
 // Index the identified help files
 Document doc;
-for (std::set::iterator i = d_files.begin(); i != 
d_files.end(); ++i) {
-helpDocument(*i, );
+for (auto const& elem : d_files)
+{
+helpDocument(elem, );
 writer.addDocument();
 doc.clear();
 }
diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index 9589da095405..315ce57035ca 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -140,9 +140,8 @@ struct Data
 std::string getString() const
 {
 std::string ret;
-cIter aEnd = _idList.end();
-for (cIter aIter = _idList.begin(); aIter != aEnd; ++aIter)
-ret += *aIter + ";";
+for (auto const& elem : _idList)
+ret += elem + ";";
 return ret;
 }
 };
@@ -190,9 +189,8 @@ public:
 if( pFile == nullptr )
 return;
 
-DataHashtable::const_iterator aEnd = _hash.end();
-for (DataHashtable::const_iterator aIter = _hash.begin(); aIter != 
aEnd; ++aIter)
-writeKeyValue_DBHelp( 

[Libreoffice-commits] core.git: helpcompiler/source

2018-02-01 Thread Mike Kaganski
 helpcompiler/source/LuceneHelper.hxx |9 -
 1 file changed, 9 deletions(-)

New commits:
commit f0f43e0c1ee357a842a62b9a41ddf53fb0eaff03
Author: Mike Kaganski 
Date:   Wed Jan 31 12:59:16 2018 +0300

helpcompiler: MSVC: pragma warning: make more specific, remove obsolete

Change-Id: I56298ee1962a4989bcc5446df2766d7aa30c28cd
Reviewed-on: https://gerrit.libreoffice.org/48980
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/helpcompiler/source/LuceneHelper.hxx 
b/helpcompiler/source/LuceneHelper.hxx
index de7501e65040..dae1f2462f86 100644
--- a/helpcompiler/source/LuceneHelper.hxx
+++ b/helpcompiler/source/LuceneHelper.hxx
@@ -10,11 +10,6 @@
 #ifndef INCLUDED_HELPCOMPILER_SOURCE_LUCENEHELPER_HXX
 #define INCLUDED_HELPCOMPILER_SOURCE_LUCENEHELPER_HXX
 
-#if defined _MSC_VER
-#pragma warning(push)
-#pragma warning(disable : 4068 4263 4264 4266)
-#endif
-
 #if defined(__GNUC__)
 #  pragma GCC visibility push (default)
 #endif
@@ -26,10 +21,6 @@
 #  pragma GCC visibility pop
 #endif
 
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-
 #include 
 #include 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcompiler/source

2017-08-06 Thread Jochen Nitschke
 helpcompiler/source/HelpLinker.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 356debabbacfe15a5d790d690a57ab5f9c0d3384
Author: Jochen Nitschke 
Date:   Sun Aug 6 16:15:32 2017 +0200

cppcheck: unreadVariable

since initial commit d6cf80c14ef6abe02125bb8f66262961193cffd7
 CWS-TOOLING: integrate CWS l10nframework01

Change-Id: I3d9761911c535965795b10b3ae96da3e7b51f23d
Reviewed-on: https://gerrit.libreoffice.org/40808
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index b45dceae3f5c..ae54fadb68a7 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -291,10 +291,6 @@ void HelpLinker::link()
 // do the work here
 // continue with introduction of the overall process thing into the
 // here all hzip files will be worked on
-std::string appl = mod;
-if (appl[0] == 's')
-appl = appl.substr(1);
-
 bool bUse_ = true;
 if( !bExtensionMode )
 bUse_ = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcompiler/source i18npool/qa oox/source rsc/source sc/source svx/source sw/source unotools/source xmloff/source

2017-06-08 Thread Noel Grandin
 helpcompiler/source/HelpIndexer.cxx|3 +--
 i18npool/qa/cppunit/test_breakiterator.cxx |2 +-
 oox/source/core/relations.cxx  |2 +-
 oox/source/core/xmlfilterbase.cxx  |2 +-
 oox/source/dump/dumperbase.cxx |2 +-
 oox/source/export/chartexport.cxx  |2 +-
 oox/source/export/vmlexport.cxx|2 +-
 oox/source/helper/containerhelper.cxx  |2 +-
 oox/source/ole/vbacontrol.cxx  |2 +-
 oox/source/vml/vmlshape.cxx|2 +-
 rsc/source/prj/start.cxx   |3 +--
 sc/source/filter/oox/defnamesbuffer.cxx|2 +-
 sc/source/filter/oox/excelvbaproject.cxx   |2 +-
 sc/source/filter/oox/stylesbuffer.cxx  |4 ++--
 sc/source/filter/oox/workbookhelper.cxx|2 +-
 sc/source/ui/vba/vbasheetobject.cxx|2 +-
 svx/source/form/databaselocationinput.cxx  |2 +-
 sw/source/core/doc/doctxm.cxx  |6 ++
 sw/source/filter/ww8/docxexport.cxx|8 
 sw/source/filter/ww8/ww8par.cxx|2 +-
 unotools/source/config/bootstrap.cxx   |2 +-
 xmloff/source/text/txtparae.cxx|2 +-
 22 files changed, 27 insertions(+), 31 deletions(-)

New commits:
commit 0e2a6e8ea20d74436b544104969a0fdca0003b59
Author: Noel Grandin 
Date:   Wed Jun 7 15:24:38 2017 +0200

remove some unnecessary use of OUStringBuffer

Change-Id: Ia4e02589d2fe79a27b83200a0e7a528a2c806519
Reviewed-on: https://gerrit.libreoffice.org/38508
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/helpcompiler/source/HelpIndexer.cxx 
b/helpcompiler/source/HelpIndexer.cxx
index 0c10da99d0c5..5e016fb0ff6e 100644
--- a/helpcompiler/source/HelpIndexer.cxx
+++ b/helpcompiler/source/HelpIndexer.cxx
@@ -26,8 +26,7 @@ HelpIndexer::HelpIndexer(OUString const , OUString const 
,
 OUString const , OUString const )
 : d_lang(lang), d_module(module)
 {
-d_indexDir = OUStringBuffer(outDir).append('/').
-append(module).append(".idxl").makeStringAndClear();
+d_indexDir = outDir + OUStringLiteral1('/') + module + ".idxl";
 d_captionDir = srcDir + "/caption";
 d_contentDir = srcDir + "/content";
 }
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx 
b/i18npool/qa/cppunit/test_breakiterator.cxx
index d3da7dda4d95..e18efe843029 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -101,7 +101,7 @@ void TestBreakIterator::testLineBreaking()
 {
 const sal_Unicode HEBREW1[] = { 0x05DE, 0x05D9, 0x05DC, 0x05D9, 0x5DD 
};
 OUString aWord(HEBREW1, SAL_N_ELEMENTS(HEBREW1));
-OUString aTest(OUStringBuffer(aWord).append(' 
').append(aWord).makeStringAndClear());
+OUString aTest(aWord + " " + aWord);
 
 aLocale.Language = "he";
 aLocale.Country = "IL";
diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx
index c8d343847f0a..68a4256c0745 100644
--- a/oox/source/core/relations.cxx
+++ b/oox/source/core/relations.cxx
@@ -35,7 +35,7 @@ OUString lclRemoveFileName( const OUString& rPath )
 OUString lclAppendFileName( const OUString& rPath, const OUString& rFileName )
 {
 return rPath.isEmpty() ? rFileName :
-OUStringBuffer( rPath ).append( '/' ).append( rFileName 
).makeStringAndClear();
+rPath + OUStringLiteral1('/') + rFileName;
 }
 
 OUString createOfficeDocRelationTypeTransitional(const OUString& rType)
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 19f06ffcda85..b66dcf9e7301 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -458,7 +458,7 @@ namespace {
 
 OUString lclAddRelation( const Reference< XRelationshipAccess >& rRelations, 
sal_Int32 nId, const OUString& rType, const OUString& rTarget, bool bExternal )
 {
-OUString sId = OUStringBuffer().append( "rId" ).append( nId 
).makeStringAndClear();
+OUString sId = "rId" + OUString::number( nId );
 
 Sequence< StringPair > aEntry( bExternal ? 3 : 2 );
 aEntry[0].First = "Type";
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index a4fca11906a8..36e9bf1a7c3d 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -2373,7 +2373,7 @@ void XmlStreamObject::implDumpText( TextInputStream& 
rTextStrm )
 {
 while( (nPos < aElem.getLength()) && (aElem[ nPos ] >= 32) ) 
++nPos;
 if( nPos < aElem.getLength() )
-aElem = OUStringBuffer( aElem.copy( 0, nPos ) ).append( ' ' 
).append( aElem.copy( nPos ).trim() ).makeStringAndClear();
+aElem = aElem.copy( 0, nPos ) + OUStringLiteral1(' ') + 
aElem.copy( nPos ).trim();
 ++nPos;
 }
 
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx

[Libreoffice-commits] core.git: helpcompiler/source

2017-05-26 Thread Gabor Kelemen
 helpcompiler/source/HelpCompiler.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 59793d67d4c0324730e30d71d94ba5173643d79c
Author: Gabor Kelemen 
Date:   Thu May 25 23:33:03 2017 +0200

Make helpcompiler more verbose on dot ahelps

Currently we get a warning if the ahelp is one dot
and there was no previous bookmark tag.

This warning contains only the text with the problemmatic ahelp.

It would make it easier to hunt down such problems if we would
know the file names.

This patch does that, and now I see 334 problems in 137 files.

Change-Id: I364368f7affb85d5c5d526dd4674757c51956aea
Reviewed-on: https://gerrit.libreoffice.org/38044
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/helpcompiler/source/HelpCompiler.cxx 
b/helpcompiler/source/HelpCompiler.cxx
index 8f0301ca2fe0..eb1c54830ffe 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -417,7 +417,7 @@ void myparser::traverse( xmlNodePtr parentNode )
 {
 //TODO: make these asserts and flush out all our broken help 
ids
 SAL_WARN_IF(hidstr.empty(), "helpcompiler", "hid='' for text:" 
<< text);
-SAL_WARN_IF(!hidstr.empty() && extendedHelpText.empty(), 
"helpcompiler", "hid='.' with no hid bookmark branches for text:" << text);
+SAL_WARN_IF(!hidstr.empty() && extendedHelpText.empty(), 
"helpcompiler", "hid='.' with no hid bookmark branches in file: " << fileName + 
" for text: " << text);
 HashSet::const_iterator aEnd = extendedHelpText.end();
 for (HashSet::const_iterator iter = extendedHelpText.begin(); 
iter != aEnd; ++iter)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcompiler/source

2017-03-22 Thread Stephan Bergmann
 helpcompiler/source/HelpLinker.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit e665ecfc32fc8be96d8b2318c881da288b007c52
Author: Stephan Bergmann 
Date:   Wed Mar 22 21:41:44 2017 +0100

Use rtl::isAscii* instead of ctype.h is* (and fix passing plain char)

Change-Id: If8085dc00db196eb51b6f14b4f4bac7c37dab249

diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index b06295fdf22c..285241ae18c4 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -212,9 +212,11 @@ namespace URLEncoder
 std::string result;
 for (char c : rIn)
 {
-if (isalnum (c) || strchr (good, c))
+if (rtl::isAsciiAlphanumeric (static_cast(c))
+|| strchr (good, c))
+{
 result += c;
-else {
+} else {
 result += '%';
 result += hex[static_cast(c) >> 4];
 result += hex[c & 0xf];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcompiler/source idlc/source linguistic/source oox/source reportdesign/source

2016-11-02 Thread Noel Grandin
 helpcompiler/source/HelpSearch.cxx  |4 ---
 idlc/source/idlccompile.cxx |6 +---
 linguistic/source/dicimp.cxx|4 ---
 linguistic/source/dlistimp.cxx  |7 +
 oox/source/drawingml/texteffectscontext.cxx |4 ---
 oox/source/ole/axcontrol.cxx|7 +
 reportdesign/source/core/api/ReportEngineJFree.cxx  |6 +---
 reportdesign/source/filter/xml/xmlExport.cxx|   15 
 reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx |   12 +++--
 reportdesign/source/filter/xml/xmlFormattedField.cxx|8 +-
 reportdesign/source/filter/xml/xmlGroup.cxx |3 --
 11 files changed, 23 insertions(+), 53 deletions(-)

New commits:
commit a7369d98991eb41e0e6bb008ef0305c17859540e
Author: Noel Grandin 
Date:   Tue Nov 1 14:37:24 2016 +0200

loplugin:oncevar in helpcompiler..reportdesign

Change-Id: I2dc57931fb230953c285aeb18f57c0a41fedafcb
Reviewed-on: https://gerrit.libreoffice.org/30463
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/helpcompiler/source/HelpSearch.cxx 
b/helpcompiler/source/HelpSearch.cxx
index 96f1219..6f0fa2e 100644
--- a/helpcompiler/source/HelpSearch.cxx
+++ b/helpcompiler/source/HelpSearch.cxx
@@ -26,9 +26,7 @@ void HelpSearch::query(OUString const , bool 
captionOnly,
 lucene::index::IndexReader *reader = 
lucene::index::IndexReader::open(d_indexDir.getStr());
 lucene::search::IndexSearcher searcher(reader);
 
-TCHAR captionField[] = L"caption";
-TCHAR contentField[] = L"content";
-TCHAR *field = captionOnly ? captionField : contentField;
+const TCHAR* field = captionOnly ? L"caption" : L"content";
 
 bool isWildcard = queryStr[queryStr.getLength() - 1] == L'*';
 std::vector aQueryStr(OUStringToTCHARVec(queryStr));
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 1cc5fac..1f62871 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -51,8 +51,6 @@ extern int yydebug;
 sal_Int32 lineNumber = 1;
 
 
-static const char TMP[] = "TMP";
-static const char TEMP[] = "TEMP";
 static sal_Char tmpFilePattern[512];
 
 bool isFileUrl(const OString& fileName)
@@ -123,9 +121,9 @@ OString makeTempName(const OString& prefix)
 OUString uTmpPath;
 OString tmpPath;
 
-if ( osl_getEnvironment(OUString(TMP).pData, ) != 
osl_Process_E_None )
+if ( osl_getEnvironment(OUString("TMP").pData, ) != 
osl_Process_E_None )
 {
-if ( osl_getEnvironment(OUString(TEMP).pData, ) != 
osl_Process_E_None )
+if ( osl_getEnvironment(OUString("TEMP").pData, ) != 
osl_Process_E_None )
 {
 #if defined(SAL_W32)
 tmpPath = OString("c:\\temp");
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 3e7ff05..5efe94f 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -1018,9 +1018,7 @@ void DicEntry::splitDicFileWord(const OUString 
,
 {
 MutexGuard  aGuard( GetLinguMutex() );
 
-static const char aDelim[] = "==";
-
-sal_Int32 nDelimPos = rDicFileWord.indexOf( aDelim );
+sal_Int32 nDelimPos = rDicFileWord.indexOf( "==" );
 if (-1 != nDelimPos)
 {
 sal_Int32 nTriplePos = nDelimPos + 2;
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index f4506ee..6b2a43b 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -790,16 +790,13 @@ static void AddInternal(
 if (rDic.is())
 {
 //! TL TODO: word iterator should be used to break up the text
-static const char aDefWordDelim[] =
-"!\"#$%&'()*+,-/:;<=>?[]\\_^`{|}~\t \n";
-OUString aDelim(aDefWordDelim);
+OUString aDelim("!\"#$%&'()*+,-/:;<=>?[]\\_^`{|}~\t \n");
 OSL_ENSURE(aDelim.indexOf(static_cast('.')) == -1,
 "ensure no '.'");
 
 OUString  aToken;
 sal_Int32 nPos = 0;
-while (-1 !=
-(nPos = lcl_GetToken( aToken, rNew, nPos, aDelim )))
+while (-1 != (nPos = lcl_GetToken( aToken, rNew, nPos, aDelim )))
 {
 if( !aToken.isEmpty()  &&  !IsNumeric( aToken ) )
 {
diff --git a/oox/source/drawingml/texteffectscontext.cxx 
b/oox/source/drawingml/texteffectscontext.cxx
index 7b7f32e..52abd95 100644
--- a/oox/source/drawingml/texteffectscontext.cxx
+++ b/oox/source/drawingml/texteffectscontext.cxx
@@ -98,8 +98,6 @@ OUString lclGetGrabBagName(sal_uInt32 aId)
 return aGrabBagNameMap[aId];
 }
 
-const char constAttributesSequenceName[] = "attributes";
-
 }
 
 using namespace oox::core;
@@ -131,7 +129,7 @@ void TextEffectsContext::pushAttributeToGrabBag (sal_Int32 
aAttributeId, const O
 
 void 

[Libreoffice-commits] core.git: helpcompiler/source

2016-08-23 Thread Stephan Bergmann
 helpcompiler/source/HelpCompiler.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 2b4d13f135cd0e0b7000f1de658c35c873f533b3
Author: Stephan Bergmann 
Date:   Tue Aug 23 12:17:35 2016 +0200

Reduce scope of variable

Change-Id: Ib3669c8946b431b845bcb217e7cf4a5f7a89177f

diff --git a/helpcompiler/source/HelpCompiler.cxx 
b/helpcompiler/source/HelpCompiler.cxx
index 4f391b6..67dbfcd 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -330,14 +330,12 @@ void myparser::traverse( xmlNodePtr parentNode )
 xmlFree (branchxml);
 xmlFree (idxml);
 
-std::string hid;
-
 if (branch.compare(0, 3, "hid") == 0)
 {
 size_t index = branch.find('/');
 if (index != std::string::npos)
 {
-hid = branch.substr(1 + index);
+auto hid = branch.substr(1 + index);
 // one shall serve as a documentId
 if (documentId.empty())
 documentId = hid;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcompiler/source

2015-01-22 Thread Andras Timar
 helpcompiler/source/HelpCompiler.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 186508874e2e4e3b478a4b306cdbb5c50c562313
Author: Andras Timar andras.ti...@collabora.com
Date:   Thu Jan 15 08:27:18 2015 +0100

replace '\n' to space in extended help text

Change-Id: Ida354ee41b4158716ab39a92f009fa7c9a2ce21f
Reviewed-on: https://gerrit.libreoffice.org/13919
Tested-by: Andras Timar andras.ti...@collabora.com
Reviewed-by: Andras Timar andras.ti...@collabora.com

diff --git a/helpcompiler/source/HelpCompiler.cxx 
b/helpcompiler/source/HelpCompiler.cxx
index 602acce..80c1bc6 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -399,6 +399,7 @@ void myparser::traverse( xmlNodePtr parentNode )
 else if (!strcmp(reinterpret_castconst char*(test-name), ahelp))
 {
 std::string text = dump(test);
+std::replace(text.begin(), text.end(), '\n', ' ');
 trim(text);
 std::string name;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcompiler/source

2014-12-16 Thread Michael Weghorn
 helpcompiler/source/HelpLinker.cxx |  271 ++---
 1 file changed, 135 insertions(+), 136 deletions(-)

New commits:
commit 28d9983e2c561528c27c0dd40c2c0ea5b46a270f
Author: Michael Weghorn m.wegh...@posteo.de
Date:   Tue Dec 16 21:54:25 2014 +0100

indent try-block, remove obsolete comment

indent block one level deeper than block in
which it is contained

Change-Id: Ibefd1a87c2511f842f42f053d9e68feba8a6
Reviewed-on: https://gerrit.libreoffice.org/13498
Reviewed-by: Noel Grandin noelgran...@gmail.com
Tested-by: Noel Grandin noelgran...@gmail.com

diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index fccd2d3..b285293 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, 

[Libreoffice-commits] core.git: helpcompiler/source i18npool/source

2014-04-16 Thread Takeshi Abe
 helpcompiler/source/HelpLinker.cxx   |   12 -
 helpcompiler/source/HelpLinker_main.cxx  |4 +--
 i18npool/source/nativenumber/nativenumbersupplier.cxx|   19 ++-
 i18npool/source/textconversion/textconversion_ko.cxx |6 ++--
 i18npool/source/textconversion/textconversion_zh.cxx |6 ++--
 i18npool/source/transliteration/transliteration_body.cxx |   12 +
 6 files changed, 29 insertions(+), 30 deletions(-)

New commits:
commit 6a964dcf0fe3b9258d07391ada0f0d245b1f7cec
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Thu Apr 17 10:56:03 2014 +0900

Avoid possible memory leaks in case of exceptions

Change-Id: Ibadadacbe09a93e7d7a7210868c52a8fa582d427

diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index 3e1cfd4..f98c9a2 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -36,6 +36,8 @@
 #include rtl/bootstrap.hxx
 
 #include expat.h
+#include boost/scoped_array.hpp
+#include boost/scoped_ptr.hpp
 
 IndexerPreProcessor::IndexerPreProcessor
 ( const std::string aModuleName, const fs::path fsIndexBaseDir,
@@ -946,9 +948,8 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
 xmlSetStructuredErrorFunc( NULL, 
(xmlStructuredErrorFunc)StructuredXMLErrorFunction );
 try
 {
-HelpLinker* pHelpLinker = new HelpLinker();
+boost::scoped_ptrHelpLinker pHelpLinker(new HelpLinker());
 pHelpLinker-main( args, aStdStrExtensionPath, aStdStrDestination, 
aOfficeHelpPath );
-delete pHelpLinker;
 }
 catch( const HelpProcessingException e )
 {
@@ -980,14 +981,14 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
 aFileStatus.isValid( osl_FileStatus_Mask_FileSize ) )
 {
 sal_uInt64 ret, len = aFileStatus.getFileSize();
-char* s = new char[ int(len) ];  // the buffer to hold the installed 
files
+boost::scoped_arraychar s(new char[ int(len) ]);  // the buffer to 
hold the installed files
 osl::File aFile( aTreeFileURL );
 aFile.open( osl_File_OpenFlag_Read );
-aFile.read( s, len, ret );
+aFile.read( s.get(), len, ret );
 aFile.close();
 
 XML_Parser parser = XML_ParserCreate( 0 );
-XML_Status parsed = XML_Parse( parser, s, int( len ), true );
+XML_Status parsed = XML_Parse( parser, s.get(), int( len ), true );
 
 if (XML_STATUS_ERROR == parsed)
 {
@@ -1000,7 +1001,6 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
 }
 
 XML_ParserFree( parser );
-delete[] s;
 }
 
 return bSuccess;
diff --git a/helpcompiler/source/HelpLinker_main.cxx 
b/helpcompiler/source/HelpLinker_main.cxx
index 8390683..dd22eb9 100644
--- a/helpcompiler/source/HelpLinker_main.cxx
+++ b/helpcompiler/source/HelpLinker_main.cxx
@@ -21,6 +21,7 @@
 #include HelpLinker.hxx
 #include iostream
 #include sal/main.h
+#include boost/scoped_ptr.hpp
 
 SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
 std::vectorstd::string args;
@@ -28,9 +29,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
 args.push_back(std::string(argv[i]));
 try
 {
-HelpLinker* pHelpLinker = new HelpLinker();
+boost::scoped_ptrHelpLinker pHelpLinker(new HelpLinker());
 pHelpLinker-main( args );
-delete pHelpLinker;
 }
 catch( const HelpProcessingException e )
 {
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx 
b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index 3883840..8cb9c16 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -25,6 +25,7 @@
 #include data/numberchar.h
 #include comphelper/string.hxx
 #include cppuhelper/supportsservice.hxx
+#include boost/scoped_array.hpp
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -172,8 +173,8 @@ OUString SAL_CALL AsciiToNative( const OUString inStr, 
sal_Int32 startPos, sal_
 if (nCount  0)
 {
 const sal_Unicode *str = inStr.getStr() + startPos;
-sal_Unicode *newStr = new sal_Unicode[nCount * 2 + 1];
-sal_Unicode *srcStr = new sal_Unicode[nCount + 1]; // for keeping 
number without comma
+boost::scoped_arraysal_Unicode newStr(new sal_Unicode[nCount * 2 + 
1]);
+boost::scoped_arraysal_Unicode srcStr(new sal_Unicode[nCount + 1]); 
// for keeping number without comma
 sal_Int32 i, len = 0, count = 0;
 
 if (useOffset)
@@ -200,7 +201,7 @@ OUString SAL_CALL AsciiToNative( const OUString inStr, 
sal_Int32 startPos, sal_
 end = len; begin = end, end += 
number-multiplierExponent[0]) {
 if (end == 0) continue;
 sal_Int32 _count = count;
-notZero |= AsciiToNative_numberMaker(srcStr, begin, 
end - begin, newStr, count,
+  

[Libreoffice-commits] core.git: helpcompiler/source

2014-02-26 Thread Alexander Wilms
 helpcompiler/source/BasCodeTagger.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a78aa2038d08bea6b24c1ff8d31d202dd4f76d6f
Author: Alexander Wilms f.alexander.wi...@gmail.com
Date:   Tue Feb 25 18:55:38 2014 +0100

Remove visual noise from helpcompiler

Change-Id: Ied20352592de019c3b4735af8cc63947cd7d61a2
Reviewed-on: https://gerrit.libreoffice.org/8266
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/helpcompiler/source/BasCodeTagger.cxx 
b/helpcompiler/source/BasCodeTagger.cxx
index fcbe8e4..c1a94cf 100644
--- a/helpcompiler/source/BasCodeTagger.cxx
+++ b/helpcompiler/source/BasCodeTagger.cxx
@@ -53,7 +53,7 @@ xmlNodePtr LibXmlTreeWalker::currentNode()
 return m_pCurrentNode;
 }
 
-//==
+
 
 BasicCodeTagger::BasicCodeTagger( xmlDocPtr rootDoc ):
 m_Highlighter(HIGHLIGHT_BASIC)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcompiler/source

2013-02-13 Thread Caolán McNamara
 helpcompiler/source/BasCodeTagger.cxx |   10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit 62fb1958f6ac4d238e98cfb6b497f5990615450f
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Feb 13 11:50:35 2013 +

make building help not crash

a) subStr is not ours to delete, belongs to the OString
b) and anyway subStr points to the buffer of the out-of-scope temporary 
OString

Change-Id: I1689c6626c52ae9d94e0cfa5de4235be3c1f3262

diff --git a/helpcompiler/source/BasCodeTagger.cxx 
b/helpcompiler/source/BasCodeTagger.cxx
index 5852912..a984eb7 100644
--- a/helpcompiler/source/BasCodeTagger.cxx
+++ b/helpcompiler/source/BasCodeTagger.cxx
@@ -143,17 +143,14 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
 m_Highlighter.notifyChange ( 0, 0, strLine, 1 );
 HighlightPortions portions;
 m_Highlighter.getHighlightPortions( 0, strLine, portions );
-xmlChar* subStr;
-xmlChar* typeStr;
-xmlNodePtr text;
 for ( size_t i=0; iportions.size(); i++ )
 {
 HighlightPortion r = portions[i];
-subStr = (xmlChar*) OUStringToOString( strLine.copy( r.nBegin, 
r.nEnd-r.nBegin ), RTL_TEXTENCODING_UTF8 ).getStr();
-text = xmlNewText( subStr );
+OString sToken(OUStringToOString(strLine.copy(r.nBegin, 
r.nEnd-r.nBegin), RTL_TEXTENCODING_UTF8));
+xmlNodePtr text = xmlNewText((const xmlChar*)sToken.getStr());
 if ( r.tokenType != TT_WHITESPACE )
 {
-typeStr = getTypeString( r.tokenType );
+xmlChar* typeStr = getTypeString( r.tokenType );
 curNode = xmlNewTextChild( paragraph, 0, (xmlChar*)item, 0 );
 xmlNewProp( curNode, (xmlChar*)type, typeStr );
 xmlAddChild( curNode, text );
@@ -161,7 +158,6 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
 }
 else
 xmlAddChild( paragraph, text );
-xmlFree( subStr );
 }
 xmlFree( codeSnippet );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits