[Libreoffice-commits] core.git: include/vcl
include/vcl/graphicfilter.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6155e69aba4769cac01454bc43270ae3069ef48e Author: Matteo Casalin AuthorDate: Wed Mar 4 18:08:26 2020 +0100 Commit: Matteo Casalin CommitDate: Sat Mar 7 22:31:00 2020 +0100 Fix typed flags mask after commit 2876a0f79f94cdd139cc8fa40669acde9674bf8c Change-Id: Ibf27d74d73b0e8624efaffdc252b27e366245e38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90165 Tested-by: Jenkins Reviewed-by: Matteo Casalin diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index 8a59d2461a2a..20b8abc935de 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -62,7 +62,7 @@ enum class GraphicFilterImportFlags }; namespace o3tl { -template<> struct typed_flags : is_typed_flags {}; +template<> struct typed_flags : is_typed_flags {}; } #define IMP_BMP "SVBMP" ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/source
sw/source/core/tox/tox.cxx | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) New commits: commit c6ac6b53bcefadb5a62ab6a7e94e9e996f50ba71 Author: Matteo Casalin AuthorDate: Sun Jan 14 19:12:30 2018 +0100 Commit: Thorsten Behrens CommitDate: Sat Sep 21 03:15:35 2019 +0200 Return correct length for Authority token Regression from f4fd558ac9d61fe06aa0f56d829916ef9e5ee7b9 Take the chance to calculate token prefix just once. Change-Id: I19ce5cb037198cb918e79c760a92b285f9b725f1 (cherry picked from commit 34b98af8e5a4e568d8316700bea1ce604d825ce8) Reviewed-on: https://gerrit.libreoffice.org/52621 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit c6e8460a5b47fa6fa971dde2a89e80662b6e97ae) Reviewed-on: https://gerrit.libreoffice.org/52626 Reviewed-by: Noel Grandin (cherry picked from commit df041d902eafb1e273eb360103252994bbd2cde2) Reviewed-on: https://gerrit.libreoffice.org/79276 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index ee0617d95114..5b56216b1215 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -661,30 +661,29 @@ static FormTokenType lcl_GetTokenType(const OUString & sToken, { static struct { -OUString sNm; -sal_uInt16 nOffset; -FormTokenType eToken; +OUString sTokenStart; +sal_Int16 nTokenLength; +FormTokenType eTokenType; } const aTokenArr[] = { -{ SwForm::GetFormTab(), 1, TOKEN_TAB_STOP }, -{ SwForm::GetFormPageNums(),1, TOKEN_PAGE_NUMS }, -{ SwForm::GetFormLinkStt(), 1, TOKEN_LINK_START }, -{ SwForm::GetFormLinkEnd(), 1, TOKEN_LINK_END }, -{ SwForm::GetFormEntryNum(),1, TOKEN_ENTRY_NO }, -{ SwForm::GetFormEntryText(),1, TOKEN_ENTRY_TEXT }, -{ SwForm::GetFormChapterMark(), 1, TOKEN_CHAPTER_INFO }, -{ SwForm::GetFormText(),1, TOKEN_TEXT }, -{ SwForm::GetFormEntry(), 1, TOKEN_ENTRY }, -{ SwForm::GetFormAuth(),3, TOKEN_AUTHORITY } +{ SwForm::GetFormTab().copy(0, 2), 3, TOKEN_TAB_STOP }, +{ SwForm::GetFormPageNums().copy(0, 2),3, TOKEN_PAGE_NUMS }, +{ SwForm::GetFormLinkStt().copy(0, 3), 4, TOKEN_LINK_START }, +{ SwForm::GetFormLinkEnd().copy(0, 3), 4, TOKEN_LINK_END }, +{ SwForm::GetFormEntryNum().copy(0, 3),4, TOKEN_ENTRY_NO }, +{ SwForm::GetFormEntryText().copy(0, 3), 4, TOKEN_ENTRY_TEXT }, +{ SwForm::GetFormChapterMark().copy(0, 2), 3, TOKEN_CHAPTER_INFO }, +{ SwForm::GetFormText().copy(0, 2),3, TOKEN_TEXT }, +{ SwForm::GetFormEntry().copy(0, 2), 3, TOKEN_ENTRY }, +{ SwForm::GetFormAuth().copy(0, 2),5, TOKEN_AUTHORITY } }; for(const auto & i : aTokenArr) { -const sal_Int32 nLen(i.sNm.getLength()); -if( sToken.startsWith( i.sNm.copy(0, nLen - i.nOffset) )) +if( sToken.startsWith( i.sTokenStart ) ) { if (pTokenLen) -*pTokenLen = nLen; -return i.eToken; +*pTokenLen = i.nTokenLength; +return i.eTokenType; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: framework/source
framework/source/layoutmanager/helpers.cxx | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) New commits: commit 63497d3a60dfb045cafd6db9ce89c4bff0dc8507 Author: Matteo Casalin AuthorDate: Wed Feb 27 08:08:53 2019 +0100 Commit: Matteo Casalin CommitDate: Sat Apr 6 23:43:41 2019 +0200 Simplify: avoid OUString copy() and get just needed tokens Change-Id: I708f222e408223cfaeaac56f87d68375f1d0503f Reviewed-on: https://gerrit.libreoffice.org/69237 Tested-by: Jenkins Reviewed-by: Matteo Casalin diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index a5e4762f2e8b..7659be20cf04 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -197,11 +197,8 @@ OUString getElementTypeFromResourceURL( const OUString& aResourceURL ) OUString aUIResourceURL( UIRESOURCE_URL ); if ( aResourceURL.startsWith( aUIResourceURL ) ) { -sal_Int32 nIndex = 0; -OUString aPathPart = aResourceURL.copy( aUIResourceURL.getLength() ); -aPathPart.getToken( 0, '/', nIndex ); - -return aPathPart.getToken( 0, '/', nIndex ); +sal_Int32 nIndex{ aUIResourceURL.getLength() }; +return aResourceURL.getToken( 1, '/', nIndex ); } return OUString(); @@ -212,12 +209,9 @@ void parseResourceURL( const OUString& aResourceURL, OUString& aElementType, OUS OUString aUIResourceURL( UIRESOURCE_URL ); if ( aResourceURL.startsWith( aUIResourceURL ) ) { -sal_Int32 nIndex = 0; -OUString aPathPart = aResourceURL.copy( aUIResourceURL.getLength() ); -aPathPart.getToken( 0, '/', nIndex ); - -aElementType = aPathPart.getToken( 0, '/', nIndex ); -aElementName = aPathPart.getToken( 0, '/', nIndex ); +sal_Int32 nIndex{ aUIResourceURL.getLength() }; +aElementType = aResourceURL.getToken( 1, '/', nIndex ); +aElementName = aResourceURL.getToken( 0, '/', nIndex ); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: forms/source
forms/source/xforms/xpathlib/xpathlib.cxx | 24 1 file changed, 12 insertions(+), 12 deletions(-) New commits: commit 83f1068ff62f644bc38e54211c48c87362276012 Author: Matteo Casalin AuthorDate: Mon Mar 4 16:29:53 2019 +0100 Commit: Matteo Casalin CommitDate: Sat Apr 6 23:42:36 2019 +0200 Use char version of OString/OStringBuffer methods Change-Id: I0222e6675f63797f870746fd34a29702ad190311 Reviewed-on: https://gerrit.libreoffice.org/69240 Tested-by: Jenkins Reviewed-by: Matteo Casalin diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx index ac73ec7990df..6fd72e923bf0 100644 --- a/forms/source/xforms/xpathlib/xpathlib.cxx +++ b/forms/source/xforms/xpathlib/xpathlib.cxx @@ -234,22 +234,22 @@ static OString makeDateTimeString (const DateTime& aDateTime) { OStringBuffer aDateTimeString; aDateTimeString.append(static_cast(aDateTime.GetYear())); -aDateTimeString.append("-"); -if (aDateTime.GetMonth()<10) aDateTimeString.append("0"); +aDateTimeString.append('-'); +if (aDateTime.GetMonth()<10) aDateTimeString.append('0'); aDateTimeString.append(static_cast(aDateTime.GetMonth())); -aDateTimeString.append("-"); -if (aDateTime.GetDay()<10) aDateTimeString.append("0"); +aDateTimeString.append('-'); +if (aDateTime.GetDay()<10) aDateTimeString.append('0'); aDateTimeString.append(static_cast(aDateTime.GetDay())); -aDateTimeString.append("T"); -if (aDateTime.GetHour()<10) aDateTimeString.append("0"); +aDateTimeString.append('T'); +if (aDateTime.GetHour()<10) aDateTimeString.append('0'); aDateTimeString.append(static_cast(aDateTime.GetHour())); -aDateTimeString.append(":"); -if (aDateTime.GetMin()<10) aDateTimeString.append("0"); +aDateTimeString.append(':'); +if (aDateTime.GetMin()<10) aDateTimeString.append('0'); aDateTimeString.append(static_cast(aDateTime.GetMin())); -aDateTimeString.append(":"); -if (aDateTime.GetSec()<10) aDateTimeString.append("0"); +aDateTimeString.append(':'); +if (aDateTime.GetSec()<10) aDateTimeString.append('0'); aDateTimeString.append(static_cast(aDateTime.GetSec())); -aDateTimeString.append("Z"); +aDateTimeString.append('Z'); return aDateTimeString.makeStringAndClear(); } @@ -305,7 +305,7 @@ static bool parseDateTime(const OUString& aString, DateTime& aDateTime) Date tmpDate(static_cast(nDay), static_cast(nMonth), static_cast(nYear)); tools::Time tmpTime(nHour, nMinute, nSecond); DateTime tmpDateTime(tmpDate, tmpTime); -if (aString.indexOf("Z") < 0) +if (aString.lastIndexOf('Z') < 0) tmpDateTime.ConvertToUTC(); aDateTime = tmpDateTime; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: forms/source
forms/source/component/ListBox.cxx | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) New commits: commit cca2e42926a14ec27c663cd0f495dccb7607d6f9 Author: Matteo Casalin AuthorDate: Mon Mar 4 16:20:50 2019 +0100 Commit: Matteo Casalin CommitDate: Sat Apr 6 23:41:12 2019 +0200 Use getTokenCount and indexed getToken Change-Id: Id57a1771c897c69b05d02a359f22e5fb2b1f5a31 Reviewed-on: https://gerrit.libreoffice.org/69239 Tested-by: Jenkins Reviewed-by: Matteo Casalin diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index d6857dcfdcf8..fcf16abe66b4 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -637,19 +638,12 @@ namespace frm OUString sListSource; _rxInStream >> sListSource; -sal_Int32 nTokens = 1; -const sal_Unicode* pStr = sListSource.getStr(); -while ( *pStr ) -{ -if ( *pStr == ';' ) -nTokens++; -pStr++; -} +const sal_Int32 nTokens{ comphelper::string::getTokenCount(sListSource, ';') }; aListSourceSeq.realloc( nTokens ); +sal_Int32 nIdx{ 0 }; for (sal_Int32 i=0; ihttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/msvbahelper.cxx |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) New commits: commit 736a481af5c6b7e7d4a652048be14ad0ebbd45e4 Author: Matteo Casalin AuthorDate: Wed Mar 13 23:45:42 2019 +0100 Commit: Matteo Casalin CommitDate: Sat Apr 6 23:41:49 2019 +0200 Avoid using index for single getToken() call Change-Id: I76eaf140b153199b62606ac3336d712a64205dcc Reviewed-on: https://gerrit.libreoffice.org/69246 Tested-by: Jenkins Reviewed-by: Matteo Casalin diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index fa258ea7f93c..3a6e0a378706 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -115,9 +115,7 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath ) uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); xProps->getPropertyValue("Title") >>= aName; -sal_Int32 pos = 0; -aName = aName.getToken(0,'-',pos); -aName = aName.trim(); +aName = aName.getToken(0, '-').trim(); if( sMacroURLOrPath.lastIndexOf( aName ) >= 0 ) { pFoundShell = pShell; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: Possible extensions to OUString class
Hi Stephan, On 1/30/19 10:40 PM, Stephan Bergmann wrote: On 30/01/2019 22:17, Matteo Casalin wrote: I'm working on improving code that calls getToken (e.g. using its version with index, or using other OUString functions in its place when possible). One thing that I noticed is that there are a lot of calls in the form getToken().toInt# which require memory management just to obtain a value that could be generated by the original OUString. Similarly (but less frequently), some tokens are extracted just to compare them against a string, which again requires memory management that is really not needed. I was wondering if extending O(U)String with functions like: * getTokenAs[U]Int#(token, sep, index) * matchToken(token, sep, index, string) would be accepted/appreciated or not. At the moment I already submitted to gerrit a patch [1] which adds comphelper::string::matchToken but I think that adding such functionality to OUString directly would be nicer. Also, introducing getTokenAsInt in OUString would likely allow to reuse its toInt code. Sounds a bit too special-purpose to be worth adding, IMO. Would those optimizations really make a measurable difference? I don't have real numbers to provide, but a very rough check on getToken provides the following numbers: git grep -w getToken > getToken.txt grep -wc getToken getToken.txt ==> 1646 grep -wc toInt32 getToken.txt ==> 218 grep -wc toInt64 getToken.txt ==> 8 grep -wc toUInt32 getToken.txt ==> 0 grep -wc toUInt64 getToken.txt ==> 8 The number of getToken occurrences is higher that real OUString::getToken calls (comments, header files, definitions and also not OUString getToken), and I am missing places in which conversion to integer is done in a following line. As a result we have that this pattern is > 14.2% of all getToken occurrences. I cannot say if this is frequently called code or not. About matchToken, this seems to be a very less frequent pattern and at the moment the comphelper approach can provide a viable approach, so I woulg go this way (and will take care of reviewing some older getToken optimizations that I implemented). Also, a better approach overall would probably be some string_view-based getToken functionality (converting from an OUString to a string_view is cheap), and then string_view-based toInt etc. functions. At the moment I plan to just go through all of getToken uses and do some minor local optimizations, then I might have a look at the string_view approach (unless previous numbers make the OUString one look not too specialised). Many thanks for your comments Kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Possible extensions to OUString class
Dear all, I'm working on improving code that calls getToken (e.g. using its version with index, or using other OUString functions in its place when possible). One thing that I noticed is that there are a lot of calls in the form getToken().toInt# which require memory management just to obtain a value that could be generated by the original OUString. Similarly (but less frequently), some tokens are extracted just to compare them against a string, which again requires memory management that is really not needed. I was wondering if extending O(U)String with functions like: * getTokenAs[U]Int#(token, sep, index) * matchToken(token, sep, index, string) would be accepted/appreciated or not. At the moment I already submitted to gerrit a patch [1] which adds comphelper::string::matchToken but I think that adding such functionality to OUString directly would be nicer. Also, introducing getTokenAsInt in OUString would likely allow to reuse its toInt code. looking forward to your feedback. Matteo [1] https://gerrit.libreoffice.org/#/c/66935/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Any clue if this could be a typo?
Dear all, I stumbled upon this code: https://opengrok.libreoffice.org/xref/core/sw/source/ui/fldui/fldpage.cxx?r=1a33947a#143 and think that at line 152 token #2 should be obtained instead of token #1 (which was just obtained a couple of lines before). I don't know what this code is used for, does anybody have a clue on whether this is a typo or not? If it is, I can proceed with fixing it. Thanks and kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: How to re-trigger a single build job in gerrit?
Thanks Miklos. Kind regards Matteo On 1/14/19 9:15 AM, Miklos Vajna wrote: Hi Matteo, On Sun, Jan 13, 2019 at 11:18:55AM +0100, Matteo Casalin wrote: executing all of the jobs (gerrit_linux*, gerrit_macos, gerrit_windows)? Up to know I just rebased the patch, but this looks to me as quite inefficient. Register at ci.libreoffice.org, then talk to the infra guys at #tdf-infra (freenode IRC), once you get the right to "resume a build", you would see an extra button on the Jenkins UI to do exactly this: just try the failing builds once more, without rebuilding already successful platforms. Regards, Miklos ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
How to re-trigger a single build job in gerrit?
Dear list, it happens sometimes that gerrit builds fail because of a single job (e.g. gerrit_windows) failing, with error messages that looks completely unrelated to the patch being verified. In this case it seems legitimate to think of a random failure which would likely disappear by rebuilding. Is there a way to re-trigger just a build on the failing job, without executing all of the jobs (gerrit_linux*, gerrit_macos, gerrit_windows)? Up to know I just rebased the patch, but this looks to me as quite inefficient. Many thanks in advance for any feedback/hint. Kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: 17 commits - sfx2/source svtools/source svx/source sw/source
sfx2/source/appl/newhelp.cxx | 28 ++-- svtools/source/config/printoptions.cxx|6 - svtools/source/misc/imap2.cxx |6 + svx/source/form/fmshimp.cxx |5 +--- svx/source/gallery2/galbrws2.cxx |3 -- svx/source/gallery2/gallery1.cxx | 20 ++--- svx/source/gallery2/galmisc.cxx |2 - svx/source/xml/xmlgrhlp.cxx | 30 ++ sw/source/core/unocore/unochart.cxx | 17 +- sw/source/core/unocore/unofield.cxx |3 -- sw/source/filter/html/htmlforw.cxx| 19 +--- sw/source/filter/ww8/docxattributeoutput.cxx |9 +++ sw/source/ui/dbui/createaddresslistdialog.cxx | 13 --- 13 files changed, 79 insertions(+), 82 deletions(-) New commits: commit 6050f9cf7b39e4d7073e1e54109e436b43dfa519 Author: Matteo Casalin Date: Sat Jun 30 17:03:25 2018 +0200 Reduce number of operations on OUString Change-Id: I5d65dd36981e6d75f0e3c0e3f00e1964d1249887 diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 0ac8ef38b41b..2d3c73a8d493 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -954,24 +954,19 @@ SearchTabPage_Impl::~SearchTabPage_Impl() void SearchTabPage_Impl::dispose() { SvtViewOptions aViewOpt( EViewType::TabPage, CONFIGNAME_SEARCHPAGE ); -sal_Int32 nChecked = m_pFullWordsCB->IsChecked() ? 1 : 0; -OUString aUserData = OUString::number( nChecked ); -aUserData += ";"; -nChecked = m_pScopeCB->IsChecked() ? 1 : 0; -aUserData += OUString::number( nChecked ); -aUserData += ";"; +OUString aUserData = +OUString::number( m_pFullWordsCB->IsChecked() ? 1 : 0 ) + ";" + +OUString::number( m_pScopeCB->IsChecked() ? 1 : 0 ); sal_Int32 nCount = std::min( m_pSearchED->GetEntryCount(), sal_Int32(10) ); // save only 10 entries for ( sal_Int32 i = 0; i < nCount; ++i ) { -OUString aText = m_pSearchED->GetEntry(i); -aUserData += INetURLObject::encode( -aText, INetURLObject::PART_UNO_PARAM_VALUE, +aUserData += ";" + INetURLObject::encode( +m_pSearchED->GetEntry(i), +INetURLObject::PART_UNO_PARAM_VALUE, INetURLObject::EncodeMechanism::All ); -aUserData += ";"; } -aUserData = comphelper::string::stripEnd(aUserData, ';'); Any aUserItem = makeAny( aUserData ); aViewOpt.SetUserItem( USERITEM_NAME, aUserItem ); commit fbd787dc9bf048bfc1be8eebf5920a69e34b6b75 Author: Matteo Casalin Date: Sat Jun 30 16:39:46 2018 +0200 Use indexed getToken() and avoid getTokenCount() Change-Id: I8807f8e7fd0fb76723bc4d46fa35cc346777051e diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index a8234eaa99bf..0ac8ef38b41b 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -928,16 +928,17 @@ SearchTabPage_Impl::SearchTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_ Any aUserItem = aViewOpt.GetUserItem( USERITEM_NAME ); if ( aUserItem >>= aUserData ) { -bool bChecked = aUserData.getToken(0, ';').toInt32() == 1; +sal_Int32 nIdx {0}; +bool bChecked = aUserData.getToken(0, ';', nIdx).toInt32() == 1; m_pFullWordsCB->Check( bChecked ); -bChecked = aUserData.getToken(1, ';').toInt32() == 1; +bChecked = aUserData.getToken(0, ';', nIdx).toInt32() == 1; m_pScopeCB->Check( bChecked ); -for ( sal_Int32 i = 2; i < comphelper::string::getTokenCount(aUserData, ';'); ++i ) +while ( nIdx > 0 ) { -OUString aToken = aUserData.getToken(i, ';'); m_pSearchED->InsertEntry( INetURLObject::decode( -aToken, INetURLObject::DecodeMechanism::WithCharset ) ); +aUserData.getToken(0, ';', nIdx), +INetURLObject::DecodeMechanism::WithCharset ) ); } } } commit d253ee7c8b04d19e415a4fdeefdc450bdee824e2 Author: Matteo Casalin Date: Sat Jun 30 12:21:22 2018 +0200 Avoid using getTokenCount() to get last token in a string Change-Id: I8e26d07c67fe10a55717a238563dd036b94fd381 diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index f5d3c178f471..af1101acd8cd 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -30,7 +30,6 @@ #include #include -#include #include "itemholder2.hxx" @@ -129,10 +128,7 @@ SvtPrintOptions_Impl::SvtPrintOptions_Impl(const OUString& rConfigRoot) if (m_xCfg.is()) { -
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - 2 commits - vcl/source vcl/unx
vcl/source/filter/graphicfilter.cxx |7 +++--- vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 33 +++ 2 files changed, 25 insertions(+), 15 deletions(-) New commits: commit b44167edcbdb94b471da5d6ef390edfa1bf4fe36 Author: Matteo Casalin Date: Wed May 30 20:37:20 2018 +0200 Try harder to find a matching file extension Potential regression from 2a39163aef4211c9d19cb1faee7f55d3718355b6 Change-Id: I67f1f11bd52a1dbf0f77a35df7ad556437ccd39b (cherry picked from commit 3c78a19ed66b44ebb2db7b160fa92a010a3c42aa) Reviewed-on: https://gerrit.libreoffice.org/55889 Tested-by: Jenkins Reviewed-by: Matteo Casalin diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index a222d603270c..e4f5ac395b8d 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -705,23 +705,32 @@ namespace bool lcl_matchFilter( const rtl::OUString& rFilter, const rtl::OUString& rExt ) { -const sal_Int32 nBegin = rFilter.indexOf(rExt); +const sal_Unicode cSep {';'}; +sal_Int32 nIdx {0}; -if (nBegin<0) // not found -return false; +for (;;) +{ +const sal_Int32 nBegin = rFilter.indexOf(rExt, nIdx); -const sal_Unicode cSep{';'}; +if (nBegin<0) // not found +break; -// Check if the found occurrence is an exact match: left side -if (nBegin>0 && rFilter[nBegin-1]!=cSep) -return false; +// Let nIdx point to end of matched string, useful in order to +// check string boundaries and also for a possible next iteration +nIdx = nBegin + rExt.getLength(); -// Check if the found occurrence is an exact match: right side -const sal_Int32 nEnd = nBegin + rExt.getLength(); -if (nEnd0 && rFilter[nBegin-1]!=cSep) +continue; + +return true; +} + +return false; } } commit 133a56d75d77275fd9a0dcc08e759be14adc523f Author: Matteo Casalin Date: Wed May 30 20:49:22 2018 +0200 Improve 1a2ee0ecd5b0cff52922c1d261f7d03a57a52ca0 Change-Id: I50f369f28c3b97ba7fed494cb238b7756920abc6 (cherry picked from commit 91b5e86d5ef1318bd894b1fc3b537fb4615673da) Reviewed-on: https://gerrit.libreoffice.org/55890 Tested-by: Jenkins Reviewed-by: Matteo Casalin diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 6e37dd6d3ff1..870c5586ea82 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -2439,8 +2439,9 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r } else { -sal_Int32 nIdx{0}; -do { +sal_Int32 nIdx {aFilterPath.isEmpty() ? -1 : 0}; +while (nIdx>=0) +{ #ifndef DISABLE_DYNLOADING OUString aPhysicalName( ImpCreateFullFilterPath( aFilterPath.getToken(0, ';', nIdx), aFilterName ) ); osl::Module aLibrary( aPhysicalName ); @@ -2471,7 +2472,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r } else nStatus = ERRCODE_GRFILTER_FILTERERROR; -} while (nIdx>=0); +} } } if( nStatus != ERRCODE_NONE ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/source
vcl/source/filter/FilterConfigItem.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 43df64affb71e9cd17cfaf936d142dad95b280f7 Author: Matteo Casalin Date: Wed May 16 23:26:44 2018 +0200 Fix tdf#117410 - UI: Settings in PDF Options not remembered... for next export Change-Id: I6f066c81d96595a4560f5bb9e148001b004b38f0 (cherry picked from commit 85613aa81a885488f99ed038f2254ddb0c8a1037) Reviewed-on: https://gerrit.libreoffice.org/55647 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx index 170e4b956046..0eedb63b408d 100644 --- a/vcl/source/filter/FilterConfigItem.cxx +++ b/vcl/source/filter/FilterConfigItem.cxx @@ -68,7 +68,8 @@ static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory > const & rXCfgP } if ( xReadAccess.is() ) { -while (bAvailable && nIdx>=0 ) +const sal_Int32 nEnd {rTree.getLength()}; +while (bAvailable && nIdx>=0 && nIdx xHierarchicalNameAccess ( xReadAccess, UNO_QUERY ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Can someone kindly backport a patch to 6.1?
Dear all, I recently pushed to master a patch [1] for an issue I introduced in LO 6.1.0.0.alpha0+ [2]. This patch will be integrated in 6.2, can someone kindly backport it to 6.1? It seems that I have no push rights to such branch. Kind regards Matteo [1] https://cgit.freedesktop.org/libreoffice/core/commit/?id=85613aa81a885488f99ed038f2254ddb0c8a1037 [2] https://bugs.documentfoundation.org/show_bug.cgi?id=117410 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: 9 commits - sw/source vcl/source vcl/unx
sw/source/ui/vba/vbaselection.cxx| 10 sw/source/uibase/dochdl/swdtflvr.cxx | 36 ++- vcl/source/edit/texteng.cxx |2 - vcl/source/filter/FilterConfigItem.cxx |3 +- vcl/source/filter/graphicfilter.cxx |7 +++--- vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 33 ++-- 6 files changed, 45 insertions(+), 46 deletions(-) New commits: commit 565340d457f41197474a75ba1b036bdc3d569041 Author: Matteo Casalin Date: Sat Jun 2 23:55:42 2018 +0200 Fix tdf#100937: LO Freezed when I insert a very long text in... ... the Description box The issue was triggered by ImpVclMEdit::Resize initially calling TextEngine::SetMaxTextWidth() with a negative width (due to an initial empty area, further "reduced" to take into account a vertical scroll bar) and then with positive values in following iterations. I preferred to consider such negative widths a no-op instead of extending them to the "maximum" possible width. Change-Id: I756652a30c23ebe6674e481e7d8d6e0d8ba45e75 diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 3beff673c1be..90f40a0f939d 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -219,7 +219,7 @@ void TextEngine::SetMaxTextLen( sal_Int32 nLen ) void TextEngine::SetMaxTextWidth( long nMaxWidth ) { -if ( nMaxWidth != mnMaxTextWidth ) +if ( nMaxWidth>=0 && nMaxWidth != mnMaxTextWidth ) { mnMaxTextWidth = nMaxWidth; FormatFullDoc(); commit 91b5e86d5ef1318bd894b1fc3b537fb4615673da Author: Matteo Casalin Date: Wed May 30 20:49:22 2018 +0200 Improve 1a2ee0ecd5b0cff52922c1d261f7d03a57a52ca0 Change-Id: I50f369f28c3b97ba7fed494cb238b7756920abc6 diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 9f5d6caeb0eb..1ba3d1d776ec 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -2439,8 +2439,9 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r } else { -sal_Int32 nIdx{0}; -do { +sal_Int32 nIdx {aFilterPath.isEmpty() ? -1 : 0}; +while (nIdx>=0) +{ #ifndef DISABLE_DYNLOADING OUString aPhysicalName( ImpCreateFullFilterPath( aFilterPath.getToken(0, ';', nIdx), aFilterName ) ); osl::Module aLibrary( aPhysicalName ); @@ -2471,7 +2472,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r } else nStatus = ERRCODE_GRFILTER_FILTERERROR; -} while (nIdx>=0); +} } } if( nStatus != ERRCODE_NONE ) commit 3c78a19ed66b44ebb2db7b160fa92a010a3c42aa Author: Matteo Casalin Date: Wed May 30 20:37:20 2018 +0200 Try harder to find a matching file extension Potential regression from 2a39163aef4211c9d19cb1faee7f55d3718355b6 Change-Id: I67f1f11bd52a1dbf0f77a35df7ad556437ccd39b diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index a222d603270c..e4f5ac395b8d 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -705,23 +705,32 @@ namespace bool lcl_matchFilter( const rtl::OUString& rFilter, const rtl::OUString& rExt ) { -const sal_Int32 nBegin = rFilter.indexOf(rExt); +const sal_Unicode cSep {';'}; +sal_Int32 nIdx {0}; -if (nBegin<0) // not found -return false; +for (;;) +{ +const sal_Int32 nBegin = rFilter.indexOf(rExt, nIdx); -const sal_Unicode cSep{';'}; +if (nBegin<0) // not found +break; -// Check if the found occurrence is an exact match: left side -if (nBegin>0 && rFilter[nBegin-1]!=cSep) -return false; +// Let nIdx point to end of matched string, useful in order to +// check string boundaries and also for a possible next iteration +nIdx = nBegin + rExt.getLength(); -// Check if the found occurrence is an exact match: right side -const sal_Int32 nEnd = nBegin + rExt.getLength(); -if (nEnd0 && rFilter[nBegin-1]!=cSep) +continue; + +return true; +} + + return false; } } commit 85613aa81a885488f99ed038f2254ddb0c8a1037 Author: Matteo Casalin Date: Wed May 16 23:26:44 2018 +0200 Fix tdf#117410 - UI: Settings in PDF Options not remembered... for next export Change-Id: I6f066c81d96595a4560f5bb9e148001b004b38f0 diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx index 170e4b956046..0eedb63b408d 100644 --- a/vcl/source/filter/FilterConfigItem.cxx +++ b/vcl/source/filter/FilterConfigItem.cxx @@ -
[Libreoffice-commits] core.git: vcl/source
vcl/source/filter/graphicfilter.cxx | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) New commits: commit b3c43f257404f1b9037898825e86806b5b0b0fc7 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon Apr 30 09:33:10 2018 +0200 Avoid getTokenCount (fix 1a2ee0ecd5b0cff52922c1d261f7d03a57a52ca0) Change-Id: I2def3a427585fd281fb0b25e90060b2a2037212b diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 0a95499c84c9..6c10f95e7094 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -75,8 +74,6 @@ #define PMGCHUNG_msOG 0x6d734f47 // Microsoft Office Animated GIF -using comphelper::string::getTokenCount; - typedef ::std::vector< GraphicFilter* > FilterList_impl; static FilterList_impl* pFilterHdlList = nullptr; @@ -2011,11 +2008,16 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, { ImpFilterLibCacheEntry* pFilter = nullptr; -// find first filter in filter paths -sal_Int32 i, nTokenCount = getTokenCount(aFilterPath, ';'); -ImpFilterLibCache = Cache::get(); -for( i = 0; ( i < nTokenCount ) && ( pFilter == nullptr ); i++ ) -pFilter = rCache.GetFilter(aFilterPath.getToken(i, ';'), aFilterName, aExternalFilterName); +if (!aFilterPath.isEmpty()) +{ +// find first filter in filter paths +ImpFilterLibCache = Cache::get(); +sal_Int32 nIdx{0}; +do { +pFilter = rCache.GetFilter(aFilterPath.getToken(0, ';', nIdx), aFilterName, aExternalFilterName); +} while (nIdx>=0 && pFilter==nullptr); +} + if( !pFilter ) nStatus = ERRCODE_GRFILTER_FILTERERROR; else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 16 commits - basic/source cui/source dbaccess/source sw/source vcl/source vcl/unx
basic/source/basmgr/basmgr.cxx | 36 --- cui/source/dialogs/cuifmsearch.cxx | 23 +-- cui/source/options/optjava.cxx |4 +-- cui/source/tabpages/numpages.cxx |9 +-- dbaccess/source/core/misc/dsntypes.cxx | 23 +++ dbaccess/source/ui/misc/TokenWriter.cxx | 18 --- sw/source/core/unocore/unoidx.cxx| 28 +--- sw/source/ui/index/cntex.cxx |5 ++-- sw/source/ui/index/cnttab.cxx| 15 ++-- sw/source/uibase/envelp/envimg.cxx | 12 +- sw/source/uibase/envelp/labelcfg.cxx | 10 vcl/source/control/combobox.cxx | 13 ++- vcl/source/filter/FilterConfigItem.cxx | 17 -- vcl/source/filter/graphicfilter.cxx | 27 --- vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 24 15 files changed, 140 insertions(+), 124 deletions(-) New commits: commit 3922602fc3aff254ba1df3e2f193a7f569b8963f Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Apr 29 22:42:33 2018 +0200 Avoid getTokenCount Change-Id: Iad8a623a219b1e6158a1ec447bdc7853817d2086 diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx index c09159802628..199b8fcda74a 100644 --- a/sw/source/uibase/envelp/envimg.cxx +++ b/sw/source/uibase/envelp/envimg.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include #include @@ -50,13 +49,14 @@ OUString MakeSender() { SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions(); +const OUString sSenderToken(SwResId(STR_SENDER_TOKENS)); +if (sSenderToken.isEmpty()) +return OUString(); + OUString sRet; -OUString sSenderToken(SwResId(STR_SENDER_TOKENS)); -sal_Int32 nTokenCount = comphelper::string::getTokenCount(sSenderToken, ';'); sal_Int32 nSttPos = 0; bool bLastLength = true; -for( sal_Int32 i = 0; i < nTokenCount; i++ ) -{ +do { OUString sToken = sSenderToken.getToken( 0, ';', nSttPos ); if (sToken == "COMPANY") { @@ -86,7 +86,7 @@ OUString MakeSender() sRet += rUserOpt.GetState(); else if (!sToken.isEmpty()) //spaces sRet += sToken; -} +} while (nSttPos>=0); return sRet; } commit 5f07b58b0904f2d00ea4c1b49296ec0abfbe397c Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Apr 29 22:24:45 2018 +0200 Avoid getTokenCount Change-Id: Idf94fa126580623c879023b04a2d9cbe54679b21 diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx index 808b250a3470..6c6ec6127efc 100644 --- a/sw/source/uibase/envelp/labelcfg.cxx +++ b/sw/source/uibase/envelp/labelcfg.cxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -183,12 +182,13 @@ static std::unique_ptr lcl_CreateSwLabRec(const OUString& rType, const pNewRec->m_aType = rType; //all values are contained as colon-separated 1/100 mm values //except for the continuous flag ('C'/'S') and nCols, nRows (sal_Int32) -sal_uInt16 nTokenCount = comphelper::string::getTokenCount(rMeasure, ';'); -for(sal_uInt16 i = 0; i < nTokenCount; i++) +sal_Int32 nTok{0}; +sal_Int32 nIdx{rMeasure.isEmpty() ? -1 : 0}; +while (nIdx>=0) { -OUString sToken(rMeasure.getToken(i, ';' )); +const OUString sToken(rMeasure.getToken(0, ';', nIdx)); int nVal = sToken.toInt32(); -switch(i) +switch(nTok++) { case 0 : pNewRec->m_bCont = sToken[0] == 'C'; break; case 1 : pNewRec->m_nHDist= convertMm100ToTwip(nVal); break; commit e7747a338bb3951448a0be2cda1e9ae5eb6cc117 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Apr 29 21:34:26 2018 +0200 Avoid getTokenCount Previous implementation looped backward from last token, but just a match seems to be required in order to insert the associated ComboBox position in a std::set (which does not care for insertion order). Change-Id: If92b28a9364e59fca46e728164be41e0755d0977 diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 9f8bd524e0e1..d54c628df8a3 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -89,14 +89,15 @@ struct ComboBox::Impl static void lcl_GetSelectedEntries( ::std::set< sal_Int32 >& rSelectedPos, const OUString& rText, sal_Unicode cTokenSep, const ImplEntryList* pEntryList ) { -for (sal_Int32 n = comphelper::string::getTokenCount(rText, cTokenSep); n;) -{ -OUString aToken = rText.getToken( --n, cTokenSep ); -aToken = comphelper::string::strip(aToken, ' '); -sal_Int32 nPos = pEntryList->FindEntry( aToken );
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/source
sw/source/core/tox/tox.cxx | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) New commits: commit df041d902eafb1e273eb360103252994bbd2cde2 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Jan 14 19:12:30 2018 +0100 Return correct length for Authority token Regression from f4fd558ac9d61fe06aa0f56d829916ef9e5ee7b9 Take the chance to calculate token prefix just once. Change-Id: I19ce5cb037198cb918e79c760a92b285f9b725f1 (cherry picked from commit 34b98af8e5a4e568d8316700bea1ce604d825ce8) Reviewed-on: https://gerrit.libreoffice.org/52621 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit c6e8460a5b47fa6fa971dde2a89e80662b6e97ae) Reviewed-on: https://gerrit.libreoffice.org/52626 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index b6baa1366d96..c0bbd8f4228c 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -659,30 +659,29 @@ static FormTokenType lcl_GetTokenType(const OUString & sToken, { static struct { -OUString sNm; -sal_uInt16 nOffset; -FormTokenType eToken; +OUString sTokenStart; +sal_Int16 nTokenLength; +FormTokenType eTokenType; } const aTokenArr[] = { -{ SwForm::GetFormTab(), 1, TOKEN_TAB_STOP }, -{ SwForm::GetFormPageNums(),1, TOKEN_PAGE_NUMS }, -{ SwForm::GetFormLinkStt(), 1, TOKEN_LINK_START }, -{ SwForm::GetFormLinkEnd(), 1, TOKEN_LINK_END }, -{ SwForm::GetFormEntryNum(),1, TOKEN_ENTRY_NO }, -{ SwForm::GetFormEntryText(),1, TOKEN_ENTRY_TEXT }, -{ SwForm::GetFormChapterMark(), 1, TOKEN_CHAPTER_INFO }, -{ SwForm::GetFormText(),1, TOKEN_TEXT }, -{ SwForm::GetFormEntry(), 1, TOKEN_ENTRY }, -{ SwForm::GetFormAuth(),3, TOKEN_AUTHORITY } +{ SwForm::GetFormTab().copy(0, 2), 3, TOKEN_TAB_STOP }, +{ SwForm::GetFormPageNums().copy(0, 2),3, TOKEN_PAGE_NUMS }, +{ SwForm::GetFormLinkStt().copy(0, 3), 4, TOKEN_LINK_START }, +{ SwForm::GetFormLinkEnd().copy(0, 3), 4, TOKEN_LINK_END }, +{ SwForm::GetFormEntryNum().copy(0, 3),4, TOKEN_ENTRY_NO }, +{ SwForm::GetFormEntryText().copy(0, 3), 4, TOKEN_ENTRY_TEXT }, +{ SwForm::GetFormChapterMark().copy(0, 2), 3, TOKEN_CHAPTER_INFO }, +{ SwForm::GetFormText().copy(0, 2),3, TOKEN_TEXT }, +{ SwForm::GetFormEntry().copy(0, 2), 3, TOKEN_ENTRY }, +{ SwForm::GetFormAuth().copy(0, 2),5, TOKEN_AUTHORITY } }; for(const auto & i : aTokenArr) { -const sal_Int32 nLen(i.sNm.getLength()); -if( sToken.startsWith( i.sNm.copy(0, nLen - i.nOffset) )) +if( sToken.startsWith( i.sTokenStart ) ) { if (pTokenLen) -*pTokenLen = nLen; -return i.eToken; +*pTokenLen = i.nTokenLength; +return i.eTokenType; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source
sw/source/core/tox/tox.cxx | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) New commits: commit c6e8460a5b47fa6fa971dde2a89e80662b6e97ae Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Jan 14 19:12:30 2018 +0100 Return correct length for Authority token Regression from f4fd558ac9d61fe06aa0f56d829916ef9e5ee7b9 Take the chance to calculate token prefix just once. Change-Id: I19ce5cb037198cb918e79c760a92b285f9b725f1 (cherry picked from commit 34b98af8e5a4e568d8316700bea1ce604d825ce8) Reviewed-on: https://gerrit.libreoffice.org/52621 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index ed4716579063..c86b4c9efc50 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -745,30 +745,29 @@ static FormTokenType lcl_GetTokenType(const OUString & sToken, { static struct { -OUString sNm; -sal_uInt16 nOffset; -FormTokenType eToken; +OUString sTokenStart; +sal_Int16 nTokenLength; +FormTokenType eTokenType; } const aTokenArr[] = { -{ SwForm::GetFormTab(), 1, TOKEN_TAB_STOP }, -{ SwForm::GetFormPageNums(),1, TOKEN_PAGE_NUMS }, -{ SwForm::GetFormLinkStt(), 1, TOKEN_LINK_START }, -{ SwForm::GetFormLinkEnd(), 1, TOKEN_LINK_END }, -{ SwForm::GetFormEntryNum(),1, TOKEN_ENTRY_NO }, -{ SwForm::GetFormEntryText(),1, TOKEN_ENTRY_TEXT }, -{ SwForm::GetFormChapterMark(), 1, TOKEN_CHAPTER_INFO }, -{ SwForm::GetFormText(),1, TOKEN_TEXT }, -{ SwForm::GetFormEntry(), 1, TOKEN_ENTRY }, -{ SwForm::GetFormAuth(),3, TOKEN_AUTHORITY } +{ SwForm::GetFormTab().copy(0, 2), 3, TOKEN_TAB_STOP }, +{ SwForm::GetFormPageNums().copy(0, 2),3, TOKEN_PAGE_NUMS }, +{ SwForm::GetFormLinkStt().copy(0, 3), 4, TOKEN_LINK_START }, +{ SwForm::GetFormLinkEnd().copy(0, 3), 4, TOKEN_LINK_END }, +{ SwForm::GetFormEntryNum().copy(0, 3),4, TOKEN_ENTRY_NO }, +{ SwForm::GetFormEntryText().copy(0, 3), 4, TOKEN_ENTRY_TEXT }, +{ SwForm::GetFormChapterMark().copy(0, 2), 3, TOKEN_CHAPTER_INFO }, +{ SwForm::GetFormText().copy(0, 2),3, TOKEN_TEXT }, +{ SwForm::GetFormEntry().copy(0, 2), 3, TOKEN_ENTRY }, +{ SwForm::GetFormAuth().copy(0, 2),5, TOKEN_AUTHORITY } }; for(const auto & i : aTokenArr) { -const sal_Int32 nLen(i.sNm.getLength()); -if( sToken.startsWith( i.sNm.copy(0, nLen - i.nOffset) )) +if( sToken.startsWith( i.sTokenStart ) ) { if (pTokenLen) -*pTokenLen = nLen; -return i.eToken; +*pTokenLen = i.nTokenLength; +return i.eTokenType; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 8 commits - include/svx svx/source sw/source
include/svx/ipolypolygoneditorcontroller.hxx |1 include/svx/svdmodel.hxx |8 - include/svx/svdmrkv.hxx |6 - svx/source/svdraw/svddrgmt.cxx | 65 +- svx/source/svdraw/svdedtv1.cxx | 71 --- svx/source/svdraw/svdedxv.cxx|8 - svx/source/svdraw/svdmodel.cxx | 122 +-- svx/source/svdraw/svdmrkv.cxx| 18 +-- svx/source/svdraw/svdobj.cxx | 17 +-- svx/source/svdraw/svdomeas.cxx | 10 +- svx/source/svdraw/svdopath.cxx | 77 + svx/source/svdraw/svdview.cxx|6 - sw/source/core/doc/doctxm.cxx|2 sw/source/core/tox/tox.cxx | 43 - 14 files changed, 186 insertions(+), 268 deletions(-) New commits: commit 20a646aeda7e940340b0ab11f243c0f09887e1b3 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Jan 14 19:52:47 2018 +0100 Pointer is always non-null ==> use reference Change-Id: I9ea6a8233a2f046d2ca56c08b3a2e922cbba2f3b diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index c86b4c9efc50..d93174cf58af 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -733,15 +733,12 @@ OUString SwFormToken::GetString() const Returns the type of a token. @param sToken the string representation of the token - @param pTokenLen return parameter the length of the head of the token - - If pTokenLen is non-NULL the length of the token's head is - written to *pTokenLen + @param rTokenLen return parameter the length of the head of the token @return the type of the token */ static FormTokenType lcl_GetTokenType(const OUString & sToken, - sal_Int32 *const pTokenLen) + sal_Int32 & rTokenLen) { static struct { @@ -765,8 +762,7 @@ static FormTokenType lcl_GetTokenType(const OUString & sToken, { if( sToken.startsWith( i.sTokenStart ) ) { -if (pTokenLen) -*pTokenLen = i.nTokenLength; +rTokenLen = i.nTokenLength; return i.eTokenType; } } @@ -827,7 +823,7 @@ lcl_BuildToken(const OUString & sPattern, sal_Int32 & nCurPatternPos) OUString sToken( lcl_SearchNextToken(sPattern, nCurPatternPos) ); nCurPatternPos += sToken.getLength(); sal_Int32 nTokenLen = 0; -FormTokenType const eTokenType = lcl_GetTokenType(sToken, ); +FormTokenType const eTokenType = lcl_GetTokenType(sToken, nTokenLen); if (TOKEN_END == eTokenType) // invalid input? skip it { nCurPatternPos = sPattern.getLength(); commit 34b98af8e5a4e568d8316700bea1ce604d825ce8 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Jan 14 19:12:30 2018 +0100 Return correct length for Authority token Regression from f4fd558ac9d61fe06aa0f56d829916ef9e5ee7b9 Take the chance to calculate token prefix just once. Change-Id: I19ce5cb037198cb918e79c760a92b285f9b725f1 diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index ed4716579063..c86b4c9efc50 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -745,30 +745,29 @@ static FormTokenType lcl_GetTokenType(const OUString & sToken, { static struct { -OUString sNm; -sal_uInt16 nOffset; -FormTokenType eToken; +OUString sTokenStart; +sal_Int16 nTokenLength; +FormTokenType eTokenType; } const aTokenArr[] = { -{ SwForm::GetFormTab(), 1, TOKEN_TAB_STOP }, -{ SwForm::GetFormPageNums(),1, TOKEN_PAGE_NUMS }, -{ SwForm::GetFormLinkStt(), 1, TOKEN_LINK_START }, -{ SwForm::GetFormLinkEnd(), 1, TOKEN_LINK_END }, -{ SwForm::GetFormEntryNum(),1, TOKEN_ENTRY_NO }, -{ SwForm::GetFormEntryText(),1, TOKEN_ENTRY_TEXT }, -{ SwForm::GetFormChapterMark(), 1, TOKEN_CHAPTER_INFO }, -{ SwForm::GetFormText(),1, TOKEN_TEXT }, -{ SwForm::GetFormEntry(), 1, TOKEN_ENTRY }, -{ SwForm::GetFormAuth(),3, TOKEN_AUTHORITY } +{ SwForm::GetFormTab().copy(0, 2), 3, TOKEN_TAB_STOP }, +{ SwForm::GetFormPageNums().copy(0, 2),3, TOKEN_PAGE_NUMS }, +{ SwForm::GetFormLinkStt().copy(0, 3), 4, TOKEN_LINK_START }, +{ SwForm::GetFormLinkEnd().copy(0, 3), 4, TOKEN_LINK_END }, +{ SwForm::GetFormEntryNum().copy(0, 3),4, TOKEN_ENTRY_NO }, +{ SwForm::GetFormEntryText().copy(0, 3), 4, TOKEN_ENTRY_TEXT }, +{ SwForm::GetFormChapterMark().copy(0, 2), 3, TOKEN_CHAPTER_INFO }, +{ SwForm::GetFormText().copy(0, 2),3, TOKEN_TEXT }, +{ SwForm::GetFormEntry().copy(0, 2), 3, TOKEN_
[Libreoffice-commits] core.git: 8 commits - include/svx svx/source
include/svx/svddrag.hxx |8 +-- include/svx/svdmrkv.hxx |5 + svx/source/svdraw/svddrag.cxx | 28 -- svx/source/svdraw/svdmrkv.cxx | 112 -- 4 files changed, 63 insertions(+), 90 deletions(-) New commits: commit 7cccb79f541404f6d317da49cee431294b9121c6 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Dec 27 13:23:49 2017 +0100 Remove leading _ from some variable names Change-Id: I640bf41ad073fcf1d5b8fcc55c63558f208db73d diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 7b990127cd52..0ca03c2dca26 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1986,20 +1986,20 @@ void SdrMarkView::UnmarkAllObj(SdrPageView const * pPV) } } -void SdrMarkView::MarkAllObj(SdrPageView* _pPV) +void SdrMarkView::MarkAllObj(SdrPageView* pPV) { BrkAction(); -if(!_pPV) +if(!pPV) { -_pPV = GetSdrPageView(); +pPV = GetSdrPageView(); } -// #i69171# _pPV may still be NULL if there is no SDrPageView (!), e.g. when inserting +// #i69171# pPV may still be NULL if there is no SDrPageView (!), e.g. when inserting // other files -if(_pPV) +if(pPV) { -const bool bMarkChg(GetMarkedObjectListWriteAccess().InsertPageView(*_pPV)); +const bool bMarkChg(GetMarkedObjectListWriteAccess().InsertPageView(*pPV)); if(bMarkChg) { @@ -2154,14 +2154,14 @@ void SdrMarkView::SetMoveOutside(bool bOn) maHdlList.SetMoveOutside(bOn); } -void SdrMarkView::SetDesignMode( bool _bOn ) +void SdrMarkView::SetDesignMode( bool bOn ) { -if ( mbDesignMode != _bOn ) +if ( mbDesignMode != bOn ) { -mbDesignMode = _bOn; +mbDesignMode = bOn; SdrPageView* pPageView = GetSdrPageView(); if ( pPageView ) -pPageView->SetDesignMode( _bOn ); +pPageView->SetDesignMode( bOn ); } } commit 03caa2f611265efce1d379df55a5f27c70d9a46c Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Dec 27 13:04:57 2017 +0100 Make some bool const Change-Id: Icede71af1edfc0671f5b0bc0dbfd3cfc6af79fcd diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index cb5f4fe0f972..7b990127cd52 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1909,8 +1909,8 @@ SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpP bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions) const { SortMarkedObjects(); -bool bBoundCheckOn2ndPass(nOptions & SdrSearchOptions::PASS2BOUND); -bool bCheckNearestOn3rdPass(nOptions & SdrSearchOptions::PASS3NEAREST); +const bool bBoundCheckOn2ndPass(nOptions & SdrSearchOptions::PASS2BOUND); +const bool bCheckNearestOn3rdPass(nOptions & SdrSearchOptions::PASS3NEAREST); rpObj=nullptr; rpPV=nullptr; const size_t nMarkCount=GetMarkedObjectCount(); commit fed40ef827f2ee8db583a13bcb439fe625c7527f Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Dec 27 13:00:39 2017 +0100 Return early Change-Id: I2b420141b5986b1d23460d5432c1b7051b11663e diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index f0043d4aa824..cb5f4fe0f972 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1913,24 +1913,23 @@ bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageVie bool bCheckNearestOn3rdPass(nOptions & SdrSearchOptions::PASS3NEAREST); rpObj=nullptr; rpPV=nullptr; -bool bFnd=false; const size_t nMarkCount=GetMarkedObjectCount(); -for (size_t nMarkNum=nMarkCount; nMarkNum>0 && !bFnd;) { +for (size_t nMarkNum=nMarkCount; nMarkNum>0;) { --nMarkNum; SdrMark* pM=GetSdrMarkByIndex(nMarkNum); SdrPageView* pPV=pM->GetPageView(); SdrObject* pObj=pM->GetMarkedSdrObj(); -bFnd = nullptr != CheckSingleSdrObjectHit(rPnt,mnHitTolLog,pObj,pPV,SdrSearchOptions::TESTMARKABLE,nullptr); -if (bFnd) { +if (CheckSingleSdrObjectHit(rPnt,mnHitTolLog,pObj,pPV,SdrSearchOptions::TESTMARKABLE,nullptr)) { rpObj=pObj; rpPV=pPV; +return true; } } -if ((bBoundCheckOn2ndPass || bCheckNearestOn3rdPass) && !bFnd) { +if (bBoundCheckOn2ndPass || bCheckNearestOn3rdPass) { SdrObject* pBestObj=nullptr; SdrPageView* pBestPV=nullptr; sal_uIntPtr nBestDist=ULONG_MAX; -for (size_t nMarkNum=nMarkCount; nMarkNum>0 && !bFnd;) { +for (size_t nMarkNum=nMarkCount; nMarkNum>0;) { --nMarkNum; SdrMark* pM=GetSdrMarkByIndex(nMarkNum); SdrPageView* pP
[Libreoffice-commits] core.git: sw/source
sw/source/core/layout/calcmove.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 60fc08111d6453ca79603b4c5c85be05e45c35e7 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Nov 1 11:16:42 2017 +0100 Fix a likely copypasta All dimensions set to 0 seems to be a correct setting for an empty page. Change-Id: Idf8a587ab405ecd07b44a7c80d5d2eaf98e1c146 diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 3a770bcb6a2b..de694019e1bd 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -777,10 +777,10 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext) { SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this); aFrm.Width( 0 ); -aFrm.Width( 0 ); +aFrm.Height( 0 ); SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this); -aPrt.Height( 0 ); +aPrt.Width( 0 ); aPrt.Height( 0 ); aPrt.Left( 0 ); aPrt.Top( 0 ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sc/source sw/source
sc/source/ui/docshell/docsh5.cxx| 20 ++-- sw/source/core/txtnode/fmtatr2.cxx | 13 - sw/source/core/txtnode/fntcache.cxx | 10 +++--- sw/source/core/txtnode/fntcap.cxx | 10 +++--- sw/source/core/txtnode/swfont.cxx | 15 +++ 5 files changed, 23 insertions(+), 45 deletions(-) New commits: commit 7ca48ce45d8c941587e296f34cba98509e35a5b5 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Nov 1 11:06:28 2017 +0100 OUString: avoid temporaries, constify Change-Id: I595b90b16c2c2a60a61811878ad06ae729a8943c diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index e0a46bff1e22..86e0053b6b31 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -138,8 +138,7 @@ SfxPoolItem* SwFormatAutoFormat::Clone( SfxItemPool* ) const bool SwFormatAutoFormat::QueryValue( uno::Any& rVal, sal_uInt8 ) const { -OUString sCharFormatName = StylePool::nameOf( mpHandle ); -rVal <<= sCharFormatName; +rVal <<= StylePool::nameOf( mpHandle ); return true; } @@ -479,13 +478,9 @@ bool SwFormatRuby::PutValue( const uno::Any& rVal, switch( nMemberId ) { case MID_RUBY_TEXT: -{ -OUString sTmp; -bRet = rVal >>= sTmp; -m_sRubyText = sTmp; -} -break; - case MID_RUBY_ADJUST: +bRet = rVal >>= m_sRubyText; +break; +case MID_RUBY_ADJUST: { sal_Int16 nSet = 0; rVal >>= nSet; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 4bba114b9522..6bca3c4c8a52 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -81,9 +81,7 @@ long EvalGridWidthAdd( const SwTextGridItem *const pGrid, const SwDrawTextInfo & SwDocShell* pDocShell = rInf.GetShell()->GetDoc()->GetDocShell(); SfxStyleSheetBasePool* pBasePool = pDocShell->GetStyleSheetPool(); -OUString sString(SwResId(STR_POOLCOLL_STANDARD)); - -SfxStyleSheetBase* pStyle = pBasePool->Find(sString, SfxStyleFamily::Para); +SfxStyleSheetBase* pStyle = pBasePool->Find(SwResId(STR_POOLCOLL_STANDARD), SfxStyleFamily::Para); SfxItemSet& aTmpSet = pStyle->GetItemSet(); const SvxFontHeightItem = static_cast(aTmpSet.Get(RES_CHRATR_CJK_FONTSIZE)); @@ -625,10 +623,8 @@ static sal_uInt8 lcl_WhichPunctuation( sal_Unicode cChar ) static bool lcl_IsMonoSpaceFont( const vcl::RenderContext& rOut ) { -const OUString aStr1( u'\x3008' ); -const OUString aStr2( u'\x307C' ); -const long nWidth1 = rOut.GetTextWidth( aStr1 ); -const long nWidth2 = rOut.GetTextWidth( aStr2 ); +const long nWidth1 = rOut.GetTextWidth( OUString( u'\x3008' ) ); +const long nWidth2 = rOut.GetTextWidth( OUString( u'\x307C' ) ); return nWidth1 == nWidth2; } diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx index 2965b496e2d2..ebf7a3086f02 100644 --- a/sw/source/core/txtnode/fntcap.cxx +++ b/sw/source/core/txtnode/fntcap.cxx @@ -478,7 +478,6 @@ void SwSubFont::DoOnCapitals( SwDoCapitals ) // Look if the length of the original text and the ToUpper-converted // text is different. If yes, do special handling. -OUString aNewText; SwCapitalInfo aCapInf(oldText); bool bCaseMapLengthDiffers(aText.getLength() != oldText.getLength()); if ( bCaseMapLengthDiffers ) @@ -576,8 +575,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals ) // Build an own 'changed' string for the given part of the // source string and use it. That new string may differ in length // from the source string. -const OUString aSnippet(oldText.copy(nOldPos, nPos - nOldPos)); -aNewText = CalcCaseMap( aSnippet ); +const OUString aNewText = CalcCaseMap( oldText.copy(nOldPos, nPos-nOldPos) ); aCapInf.nIdx = nOldPos; aCapInf.nLen = nPos - nOldPos; rDo.GetInf().SetIdx( 0 ); @@ -643,8 +641,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals ) // Build an own 'changed' string for the given part of the // source string and use it. That new string may differ in length // from the source string. -const OUString aSnippet(oldText.copy(nOldPos, nTmp - nOldPos)); -aNewText = CalcCaseMap( aSnippet ); +const OUString aNewText = CalcCaseMap( oldText.copy(nOldPos, nTmp-nOldPos) ); aCapInf.nIdx = nOldPos; aCapInf.nLen = nTmp - nOldPos; rDo.GetInf().SetIdx( 0 ); @@ -684,8 +681,7 @@ void SwSubFo
[Libreoffice-commits] core.git: 7 commits - editeng/source sfx2/source svx/source sw/source
editeng/source/editeng/impedit2.cxx | 33 +++ sfx2/source/doc/sfxbasemodel.cxx| 53 +--- svx/source/xoutdev/xattr.cxx| 157 +++- sw/source/core/txtnode/atrfld.cxx |4 sw/source/core/txtnode/ndtxt.cxx|8 - sw/source/uibase/utlui/numfmtlb.cxx | 57 +++-- 6 files changed, 124 insertions(+), 188 deletions(-) New commits: commit b312834555658064dd9491484695f84959e0b059 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Aug 15 22:08:24 2017 +0200 OUString: constify, avoid unnecessary assignments Change-Id: I697e19196b7d3ab9febafc05b07eb8c2aa218248 diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 4beca6d098c6..3aa9a961a784 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -401,8 +401,8 @@ void SwTextField::ExpandTextField(const bool bForceNotify) const } } } - -m_aExpand = aNewExpand; +else +m_aExpand = aNewExpand; const_cast<SwTextField*>(this)->NotifyContentChange( const_cast<SwFormatField&>(GetFormatField()) ); } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 5d0e74955bc0..8391a652df2f 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3023,7 +3023,7 @@ OUString SwTextNode::GetExpandText( const sal_Int32 nIdx, eMode |= ExpandMode::ExpandFootnote; ModelToViewHelper aConversionMap(*this, eMode); -OUString aExpandText = aConversionMap.getViewText(); +const OUString aExpandText = aConversionMap.getViewText(); const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nIdx ); sal_Int32 nEnd = nLen == -1 ? GetText().getLength() : nIdx + nLen; const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nEnd ); @@ -3991,11 +3991,9 @@ void SwTextNode::SetListId(OUString const& rListId) OUString SwTextNode::GetListId() const { -OUString sListId; - const SfxStringItem& rListIdItem = dynamic_cast(GetAttr( RES_PARATR_LIST_ID )); -sListId = rListIdItem.GetValue(); +const OUString sListId {rListIdItem.GetValue()}; // As long as no explicit list id attribute is set, use the list id of // the list, which has been created for the applied list style. @@ -4004,7 +4002,7 @@ OUString SwTextNode::GetListId() const SwNumRule* pRule = GetNumRule(); if ( pRule ) { -sListId = pRule->GetDefaultListId(); +return pRule->GetDefaultListId(); } } commit 9786bc48e3fa0500306aa5eeb3e7ffdf6630c904 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Aug 15 19:52:14 2017 +0200 OUString: reduce temporaries and constify Change-Id: Ic4d5e26b16414625dfb507ecf37d87efe171ceab diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index b31066b8e660..adf436e894b7 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -279,11 +279,8 @@ EditPaM ImpEditEngine::DeleteSelected(const EditSelection& rSel) OUString ImpEditEngine::GetSelected( const EditSelection& rSel ) const { -OUString aText; if ( !rSel.HasRange() ) -return aText; - -OUString aSep = EditDoc::GetSepStr( LINEEND_LF ); +return OUString(); EditSelection aSel( rSel ); aSel.Adjust( aEditDoc ); @@ -295,6 +292,9 @@ OUString ImpEditEngine::GetSelected( const EditSelection& rSel ) const OSL_ENSURE( nStartNode <= nEndNode, "Selection not sorted ?" ); +OUString aText; +const OUString aSep = EditDoc::GetSepStr( LINEEND_LF ); + // iterate over the paragraphs ... for ( sal_Int32 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { @@ -1570,8 +1570,7 @@ EditSelection ImpEditEngine::SelectSentence( const EditSelection& rCurSel ) const EditPaM& rPaM = rCurSel.Min(); const ContentNode* pNode = rPaM.GetNode(); // #i50710# line breaks are marked with 0x01 - the break iterator prefers 0x0a for that -OUString sParagraph = pNode->GetString(); -sParagraph = sParagraph.replaceAll("\x01", "\x0a"); +const OUString sParagraph = pNode->GetString().replaceAll("\x01", "\x0a"); //return Null if search starts at the beginning of the string sal_Int32 nStart = rPaM.GetIndex() ? _xBI->beginOfSentence( sParagraph, rPaM.GetIndex(), GetLocale( rPaM ) ) : 0; @@ -1639,7 +1638,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) const EditCharAttrib* pField = pNode->GetCharAttribs().FindNextAttrib( EE_FEATURE_FIELD, 0 ); while ( pField ) { -OUString aFldText = static_cast(pField)->GetFieldValue(); +const OUString aFldText = stati
[Libreoffice-commits] core.git: 4 commits - sfx2/source svx/inc svx/source
sfx2/source/doc/iframe.cxx |4 - sfx2/source/doc/objcont.cxx|7 +-- sfx2/source/doc/objmisc.cxx| 20 - sfx2/source/doc/objserv.cxx| 16 +-- sfx2/source/doc/objstor.cxx| 59 ++--- svx/inc/sdr/properties/itemsettools.hxx| 18 +++- svx/source/sdr/properties/itemsettools.cxx | 34 +--- 7 files changed, 59 insertions(+), 99 deletions(-) New commits: commit 1d1eb99f7a5ac0c10fb6cb7349e82ca069f432a5 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon May 1 22:03:25 2017 +0200 OUStrings: constify, reduce temporaries and scope Change-Id: I8b5fdf6c36908704dfc90cd77d4f258373354042 diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 660a7da9d932..d7a36c7aac37 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -354,9 +354,7 @@ void SfxObjectShell::CheckIn( ) ScopedVclPtrInstance< SfxCheckinDialog > checkinDlg(( )->GetWindow( )); if ( checkinDlg->Execute( ) == RET_OK ) { -OUString sComment = checkinDlg->GetComment( ); -bool bMajor = checkinDlg->IsMajor( ); -xCmisDoc->checkIn( bMajor, sComment ); +xCmisDoc->checkIn( checkinDlg->IsMajor(), checkinDlg->GetComment() ); uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY ); if ( xModifiable.is( ) ) xModifiable->setModified( false ); @@ -1069,22 +1067,16 @@ void SfxObjectShell::ExecProps_Impl(SfxRequest ) break; case SID_DOCINFO_AUTHOR : -{ -OUString aStr = static_cast(rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); -getDocProperties()->setAuthor( aStr ); +getDocProperties()->setAuthor( static_cast(rReq.GetArgs()->Get(rReq.GetSlot())).GetValue() ); break; -} case SID_DOCINFO_COMMENTS : -{ -OUString aStr = static_cast(rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); -getDocProperties()->setDescription( aStr ); +getDocProperties()->setDescription( static_cast(rReq.GetArgs()->Get(rReq.GetSlot())).GetValue() ); break; -} case SID_DOCINFO_KEYWORDS : { -OUString aStr = static_cast(rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); +const OUString aStr = static_cast(rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); getDocProperties()->setKeywords( ::comphelper::string::convertCommaSeparated(aStr) ); break; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index c93c593e3126..56fdf502076f 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -196,8 +196,7 @@ bool GetEncryptionData_Impl( const SfxItemSet* pSet, uno::Sequence< beans::Named const SfxStringItem* pPasswordItem = SfxItemSet::GetItem(pSet, SID_PASSWORD, false); if ( pPasswordItem ) { -OUString aPassword = pPasswordItem->GetValue(); -o_rEncryptionData = ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPassword ); +o_rEncryptionData = ::comphelper::OStorageHelper::CreatePackageEncryptionData( pPasswordItem->GetValue() ); bResult = true; } } @@ -335,12 +334,14 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto if ( xProps.is() ) { -SvGlobalName aName; -OUString aFullTypeName, aShortTypeName, aAppName; SotClipboardFormatId nClipFormat = SotClipboardFormatId::NONE; if(!bChart) +{ +SvGlobalName aName; +OUString aFullTypeName, aShortTypeName, aAppName; FillClass( , , , , , nVersion, bTemplate ); +} else nClipFormat = GetChartVersion(nVersion, bTemplate); @@ -532,7 +533,7 @@ bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) sal_Int32 nLength = aArgs.getLength(); aArgs.realloc( nLength + 1 ); aArgs[nLength].Name = "Title"; -aArgs[nLength].Value <<= OUString( GetTitle( SFX_TITLE_DETECT ) ); +aArgs[nLength].Value <<= GetTitle( SFX_TITLE_DETECT ); xModel->attachResource( OUString(), aArgs ); if (!utl::ConfigManager::IsAvoidConfig()) impl_addToModelCollection(xModel); @@ -644,8 +645,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) { if ( pSalvageItem ) { -OUString aName( pMed->GetPhysicalName() ); -osl::FileBase::getFileURLFromSystemPath( aName, aBaseURL ); +osl::FileBase::getFileURLFromSys
[Libreoffice-commits] core.git: 8 commits - sfx2/inc sfx2/source svx/source
sfx2/inc/guisaveas.hxx |1 sfx2/source/doc/DocumentMetadataAccess.cxx | 23 -- sfx2/source/doc/graphhelp.cxx |3 sfx2/source/doc/guisaveas.cxx | 229 ++--- sfx2/source/doc/objserv.cxx|1 sfx2/source/view/ipclient.cxx |1 svx/source/sdr/properties/properties.cxx | 11 - svx/source/svdraw/svdundo.cxx | 22 -- 8 files changed, 97 insertions(+), 194 deletions(-) New commits: commit 653e455e1bd5bab87dbc6a20853c8a9ca0af6175 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon Apr 24 13:23:51 2017 +0200 Do not pass a suggested name to GUIStoreModel: it is always overwritten Change-Id: Iac60c012f05916c5324e1ea8bae142ab329aa4e0 diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx index ee044218caad..cc8a091a3bfc 100644 --- a/sfx2/inc/guisaveas.hxx +++ b/sfx2/inc/guisaveas.hxx @@ -62,7 +62,6 @@ public: const OUString& aSlotName, css::uno::Sequence< css::beans::PropertyValue >& aArgsSequence, bool bPreselectPassword, -const OUString& aUserSelectedName, SignatureState nDocumentSignatureState ); static bool CheckFilterOptionsAppearance( diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 02f6a11747dc..573a84ded23c 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1254,10 +1254,8 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo const OUString& aSlotName, uno::Sequence< beans::PropertyValue >& aArgsSequence, bool bPreselectPassword, -const OUString& _aSuggestedName, SignatureState nDocumentSignatureState ) { -OUString aSuggestedName = _aSuggestedName; ModelData_Impl aModelData( *this, xModel, aArgsSequence ); bool bDialogUsed = false; @@ -1454,7 +1452,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo aSuggestedDir = aModelData.GetDocProps().getUnpackedValueOrDefault("SuggestedSaveAsDir", OUString() ); } -aSuggestedName = aModelData.GetMediaDescr().getUnpackedValueOrDefault("SuggestedSaveAsName", OUString() ); +OUString aSuggestedName = aModelData.GetMediaDescr().getUnpackedValueOrDefault("SuggestedSaveAsName", OUString() ); if ( aSuggestedName.isEmpty() ) aSuggestedName = aModelData.GetDocProps().getUnpackedValueOrDefault("SuggestedSaveAsName", OUString() ); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 48903d1346ae..660a7da9d932 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -631,7 +631,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest ) OUString::createFromAscii( pSlot->GetUnoName() ), aDispatchArgs, bPreselectPassword, - GetSharedFileURL(), GetDocumentSignatureState() ); } else diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index b3fa11e945af..a60a84c822b9 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -844,7 +844,6 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) "SaveAs", aDispatchArgs, false, -"", SignatureState::NOSIGNATURES ); } catch( const task::ErrorCodeIOException& aErrorEx ) commit 92b8b8b04cdceedcdc4e58041d9d4d1c7dee21b8 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon Apr 24 13:12:35 2017 +0200 OUStrings: constify and avoid temporaries some more Change-Id: I965ea920880bb631e108bd963ac1ab2158ef diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 36a4fe8492f7..02f6a11747dc 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -482,9 +482,7 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceDefaultFilter { uno::Sequence< beans::PropertyValue > aProps; -OUString aFilt
[Libreoffice-commits] core.git: 3 commits - sfx2/source
sfx2/source/doc/doctemplateslocal.cxx | 53 +- sfx2/source/doc/doctemplateslocal.hxx |6 --- 2 files changed, 27 insertions(+), 32 deletions(-) New commits: commit 91081c56b0732a3b378d331ac3bd299a369788f7 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Apr 22 19:12:34 2017 +0200 Use automatic integer type, with minor simplifications Change-Id: I08b8370311b11d45ab744875f7ad6b885f318a74 diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx index 30ca595a7fec..cccfb2fa9fc7 100644 --- a/sfx2/source/doc/doctemplateslocal.cxx +++ b/sfx2/source/doc/doctemplateslocal.cxx @@ -159,8 +159,8 @@ void SAL_CALL DocTemplLocaleHelper::startElement( const OUString& aName, const u m_aElementsSeq.push_back( aName ); -sal_Int32 nNewEntryNum = m_aResultSeq.size() + 1; -m_aResultSeq.resize( nNewEntryNum ); +const auto nNewEntryNum = m_aResultSeq.size(); +m_aResultSeq.resize( nNewEntryNum+1 ); const OUString aNameValue = xAttribs->getValueByName( g_sNameAttr ); if ( aNameValue.isEmpty() ) @@ -170,8 +170,8 @@ void SAL_CALL DocTemplLocaleHelper::startElement( const OUString& aName, const u if ( aUINameValue.isEmpty() ) throw xml::sax::SAXException(); // TODO: the ID value must present -m_aResultSeq[nNewEntryNum-1].First = aNameValue; -m_aResultSeq[nNewEntryNum-1].Second = aUINameValue; +m_aResultSeq[nNewEntryNum].First = aNameValue; +m_aResultSeq[nNewEntryNum].Second = aUINameValue; } else { commit 7c6345c5e9be7c377c11c0bd30b6739286075b2a Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Apr 22 19:04:22 2017 +0200 OUStrings: avoid temporaries and constify Change-Id: Id6b4b26df09ddb750f3e5430636b41c89e4d9e8e diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx index 0e850095fff4..30ca595a7fec 100644 --- a/sfx2/source/doc/doctemplateslocal.cxx +++ b/sfx2/source/doc/doctemplateslocal.cxx @@ -46,8 +46,7 @@ const OUStringLiteral g_sUINameAttr("groupuinames:default-ui-name"); std::vector< beans::StringPair > DocTemplLocaleHelper::ReadGroupLocalizationSequence( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< uno::XComponentContext >& xContext ) { -OUString aStringID = "groupuinames.xml"; -return ReadLocalizationSequence_Impl( xInStream, aStringID, xContext ); +return ReadLocalizationSequence_Impl( xInStream, "groupuinames.xml", xContext ); } @@ -61,8 +60,8 @@ void SAL_CALL DocTemplLocaleHelper::WriteGroupLocalizationSequence( const uno::R xWriterHandler->setOutputStream( xOutStream ); -OUString aCDATAString( "CDATA" ); -OUString aWhiteSpace( " " ); +const OUString aCDATAString( "CDATA" ); +const OUString aWhiteSpace( " " ); // write the namespace ::comphelper::AttributeList* pRootAttrList = new ::comphelper::AttributeList; @@ -163,11 +162,11 @@ void SAL_CALL DocTemplLocaleHelper::startElement( const OUString& aName, const u sal_Int32 nNewEntryNum = m_aResultSeq.size() + 1; m_aResultSeq.resize( nNewEntryNum ); -OUString aNameValue = xAttribs->getValueByName( g_sNameAttr ); +const OUString aNameValue = xAttribs->getValueByName( g_sNameAttr ); if ( aNameValue.isEmpty() ) throw xml::sax::SAXException(); // TODO: the ID value must present -OUString aUINameValue = xAttribs->getValueByName( g_sUINameAttr ); +const OUString aUINameValue = xAttribs->getValueByName( g_sUINameAttr ); if ( aUINameValue.isEmpty() ) throw xml::sax::SAXException(); // TODO: the ID value must present commit 1e3261a2eac642c762a1b667a3653a470894446e Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Apr 22 18:57:46 2017 +0200 These data members can be file scope consts, and reused Change-Id: I977d523d6aefeb2475044783ba30744b950d3708 diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx index 21d5bb277e7c..0e850095fff4 100644 --- a/sfx2/source/doc/doctemplateslocal.cxx +++ b/sfx2/source/doc/doctemplateslocal.cxx @@ -33,6 +33,16 @@ using namespace ::com::sun::star; +namespace +{ + +// Relations info related strings +const OUStringLiteral g_sGroupListElement("groupuinames:template-group-list"); +const OUStringLiteral g_sGroupElement("groupuinames:template-group"); +const OUStringLiteral g_sNameAttr("groupuinames:name"); +const OUStringLiteral g_sUINameAttr("groupuinames:default-ui-name"); + +} std::vector< beans::StringPair > DocTemplLocaleHelper::ReadGroupLocalizationSequence( const uno::Reference< i
[Libreoffice-commits] core.git: 13 commits - sfx2/source
sfx2/source/doc/docfac.cxx | 44 +++ sfx2/source/doc/docinf.cxx |4 sfx2/source/doc/docinsert.cxx|6 - sfx2/source/doc/docmacromode.cxx | 10 - sfx2/source/doc/doctempl.cxx | 141 +--- sfx2/source/doc/doctemplates.cxx | 221 ++- sfx2/source/doc/objmisc.cxx | 36 ++ sfx2/source/view/viewfrm.cxx | 24 +--- 8 files changed, 186 insertions(+), 300 deletions(-) New commits: commit 0191f643a2a79af94630d08abbb3e422c05020e7 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon Apr 17 23:09:44 2017 +0200 Clarify intended behaviour Change-Id: Ib1edda4886940223bd32c8a78d3aa4241f57ec84 diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 167c5337ecb9..ad1e5627efd7 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1294,7 +1294,8 @@ void SfxDocTplService_Impl::RemoveUINamesForTemplateDir_Impl( const OUString& aU aNewUINames.resize( nNewLen ); -!bChanged || WriteUINamesForTemplateDir_Impl( aUserPath, aNewUINames ); +if (bChanged) +WriteUINamesForTemplateDir_Impl( aUserPath, aNewUINames ); } commit 1d40b59db5eaf548392b8373994e9d793563731d Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon Apr 17 23:00:23 2017 +0200 Avoid 'else' after a return Change-Id: Ia530aa2fdaa5f6d77180da3139a47407adf9f519 diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index cd7e93a03753..167c5337ecb9 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -932,8 +932,7 @@ bool SfxDocTplService_Impl::removeContent( const OUString& rContentURL ) if ( Content::create( rContentURL, maCmdEnv, comphelper::getProcessComponentContext(), aContent ) ) return removeContent( aContent ); -else -return false; +return false; } @@ -2212,8 +2211,7 @@ uno::Reference< ucb::XContent > SAL_CALL SfxDocTplService::getContent() { if ( pImp->init() ) return pImp->getContent().get(); -else -return nullptr; +return nullptr; } @@ -2221,10 +2219,7 @@ sal_Bool SAL_CALL SfxDocTplService::storeTemplate( const OUString& GroupName, const OUString& TemplateName, const uno::Reference< frame::XStorable >& Storable ) { -if ( pImp->init() ) -return pImp->storeTemplate( GroupName, TemplateName, Storable ); -else -return false; +return pImp->init() && pImp->storeTemplate( GroupName, TemplateName, Storable ); } @@ -2232,20 +2227,14 @@ sal_Bool SAL_CALL SfxDocTplService::addTemplate( const OUString& rGroupName, const OUString& rTemplateName, const OUString& rSourceURL ) { -if ( pImp->init() ) -return pImp->addTemplate( rGroupName, rTemplateName, rSourceURL ); -else -return false; +return pImp->init() && pImp->addTemplate( rGroupName, rTemplateName, rSourceURL ); } sal_Bool SAL_CALL SfxDocTplService::removeTemplate( const OUString& rGroupName, const OUString& rTemplateName ) { -if ( pImp->init() ) -return pImp->removeTemplate( rGroupName, rTemplateName ); -else -return false; +return pImp->init() && pImp->removeTemplate( rGroupName, rTemplateName ); } @@ -2256,28 +2245,19 @@ sal_Bool SAL_CALL SfxDocTplService::renameTemplate( const OUString& rGroupName, if ( rOldName == rNewName ) return true; -if ( pImp->init() ) -return pImp->renameTemplate( rGroupName, rOldName, rNewName ); -else -return false; +return pImp->init() && pImp->renameTemplate( rGroupName, rOldName, rNewName ); } sal_Bool SAL_CALL SfxDocTplService::addGroup( const OUString& rGroupName ) { -if ( pImp->init() ) -return pImp->addGroup( rGroupName ); -else -return false; +return pImp->init() && pImp->addGroup( rGroupName ); } sal_Bool SAL_CALL SfxDocTplService::removeGroup( const OUString& rGroupName ) { -if ( pImp->init() ) -return pImp->removeGroup( rGroupName ); -else -return false; +return pImp->init() && pImp->removeGroup( rGroupName ); } @@ -2287,10 +2267,7 @@ sal_Bool SAL_CALL SfxDocTplService::renameGroup( const OUString& rOldName, if ( rOldName == rNewName ) return true; -if ( pImp->init() ) -return pImp->renameGroup( rOldName, rNewName ); -else -return false; +return pImp->
[Libreoffice-commits] core.git: include/sfx2 sc/source sfx2/inc sfx2/source starmath/source sw/source
include/sfx2/docinsert.hxx |9 +++-- include/sfx2/filedlghelper.hxx |6 -- sc/source/ui/docshell/docsh4.cxx |5 - sfx2/inc/filedlghelper.hrc |2 ++ sfx2/source/dialog/filedlghelper.cxx | 17 +++-- sfx2/source/dialog/filedlghelper.src | 10 ++ sfx2/source/doc/docinsert.cxx| 32 starmath/source/view.cxx |2 +- sw/source/uibase/inc/uivwimp.hxx |6 +- sw/source/uibase/uiview/uivwimp.cxx | 21 +++-- sw/source/uibase/uiview/view2.cxx|3 ++- sw/source/uibase/utlui/glbltree.cxx |2 +- 12 files changed, 98 insertions(+), 17 deletions(-) New commits: commit e2d3e936ab03274696f235c9d74e247380070f6f Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Thu Mar 16 18:09:20 2017 +0100 tdf#95992 "Edit" > "Compare Document..." opens dialog that is... misnamed "Insert" Issue is that the caption of the dialog is handled by generic code, which was not designed with comparison in mind. This fix extends the captions that can be used by such generic codes, without modifying the underlaying architecture. Letting callers directly provide caption text might be more versatile, though. The fix is extended to: * Writer Merge functionality * Calc Compare/Merge functionalities which use the same dialog (and thus were also displaying "Insert"). Change-Id: I452b37bf7d0024924c87316cd47572c09b373b65 Reviewed-on: https://gerrit.libreoffice.org/35285 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> diff --git a/include/sfx2/docinsert.hxx b/include/sfx2/docinsert.hxx index 4f47a79bd896..13f210de5b7f 100644 --- a/include/sfx2/docinsert.hxx +++ b/include/sfx2/docinsert.hxx @@ -53,8 +53,13 @@ private: DECL_LINK(DialogClosedHdl, sfx2::FileDialogHelper*, void); public: -DocumentInserter(const OUString& rFactory, - bool const bEnableMultiSelection = false); +enum class Mode { +Insert, +InsertMulti, +Compare, +Merge +}; +DocumentInserter(const OUString& rFactory, const Mode mode = Mode::Insert); ~DocumentInserter(); voidStartExecuteModal( const Link<sfx2::FileDialogHelper*,void>& _rDialogClosedLink ); diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx index 28159ec0cb45..f2f8ed6356d3 100644 --- a/include/sfx2/filedlghelper.hxx +++ b/include/sfx2/filedlghelper.hxx @@ -67,10 +67,12 @@ enum class FileDialogFlags { MultiSelection= 0x08, Graphic = 0x10,// register graphic formats /// Sign existing PDF. -SignPDF = 0x20 +SignPDF = 0x20, +InsertCompare = 0x40,/// Special insertion ("Compare" caption) +InsertMerge = 0x80,/// Special insertion ("Merge" caption) }; namespace o3tl { -template<> struct typed_flags : is_typed_flags<FileDialogFlags, 0x3f> {}; +template<> struct typed_flags : is_typed_flags<FileDialogFlags, 0xFF> {}; } #define FILEDIALOG_FILTER_ALL "*.*" diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 5e986635b820..135034c784e7 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -722,13 +722,16 @@ void ScDocShell::Execute( SfxRequest& rReq ) } else { +const sfx2::DocumentInserter::Mode mode { nSlot==SID_DOCUMENT_COMPARE +? sfx2::DocumentInserter::Mode::Compare +: sfx2::DocumentInserter::Mode::Merge}; // start file dialog asynchronous pImpl->bIgnoreLostRedliningWarning = true; delete pImpl->pRequest; pImpl->pRequest = new SfxRequest( rReq ); delete pImpl->pDocInserter; pImpl->pDocInserter = new ::sfx2::DocumentInserter( -ScDocShell::Factory().GetFactoryName(), false ); +ScDocShell::Factory().GetFactoryName(), mode ); pImpl->pDocInserter->StartExecuteModal( LINK( this, ScDocShell, DialogClosedHdl ) ); return ; } diff --git a/sfx2/inc/filedlghelper.hrc b/sfx2/inc/filedlghelper.hrc index e63c9955b282..86cf4d56eecd 100644 --- a/sfx2/inc/filedlghelper.hrc +++ b/sfx2/inc/filedlghelper.hrc @@ -23,6 +23,8 @@ #include #define STR_PB_SAVEACOPY(RID_SFX_EXPLORER_START + 65) +#define STR_PB_COMPAREDOC (RID_SFX_EXPLORER_START + 66) +#define STR_PB_MERGEDOC (RID_SFX_EXPLORER_START + 67) #endi
Re: Unuseful SfxObjectFactory::GetFactoryURL() in SfxViewFrame::LoadViewIntoFrame_Impl, any clue?
On 2017-03-20 14:44, Caolán McNamara wrote: On Fri, 2017-03-17 at 17:39 +0100, Matteo Casalin wrote: 3. Commit https://cgit.freedesktop.org/libreoffice/core/commit/?id=a8f1ad65612c 0e54969cabc541b183062ae3d905 My guess is that the "if" in the code under consideration can be removed. Yeah, its clearly meaningless so might as well remove it. No idea what the original intent there was, but its all quite a long time ago now so safest is to just remove the code that does nothing. Great, I will remove that lines. Thanks for the feedback! Kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: 4 commits - include/sfx2 sfx2/source
include/sfx2/docfac.hxx |2 sfx2/source/view/viewfrm.cxx | 88 -- sfx2/source/view/viewfrm2.cxx | 12 + 3 files changed, 32 insertions(+), 70 deletions(-) New commits: commit 7a2f07c4bd5d26657593044dd441ba5fd168e5de Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Mar 19 17:05:49 2017 +0100 Use just geParameter instead of hasParameter + getParameter getParameter returns and empty string if the key is not found, so we can just avoid searching twice for the same key. Change-Id: Ic48debce05fe94d8e087b64bde5a589e54bfb616 diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index bd29aaf003f3..a16fda352944 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2416,9 +2416,7 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const OUString& sMacro ) aMacroName = aName.getToken( 0, cTok, nIndex ); // get location -OUString aLocKey("location"); -if ( xUrl->hasParameter( aLocKey ) ) -aLocation = xUrl->getParameter( aLocKey ); +aLocation = xUrl->getParameter( "location" ); } BasicManager* pBasMgr = nullptr; commit e256519a629e88c624c52916f1c38f774cfd445c Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Mar 19 12:06:20 2017 +0100 OUString-related simplifications Change-Id: I2f4099410bcdb9e04583cd37bf63ef86ce81f7e5 diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 384af9dfe478..bd29aaf003f3 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -239,7 +239,7 @@ static bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHa else { // the binary format -bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), OUString( "com.sun.star.text.TextDocument" ).equals( pFilter->GetServiceName() ) ) == nPasswordHash ); +bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), pFilter->GetServiceName()=="com.sun.star.text.TextDocument" ) == nPasswordHash ); } } else @@ -718,7 +718,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { SfxAllItemSet aSet( pApp->GetPool() ); aSet.Put( SfxStringItem( SID_FILE_NAME, pMedium->GetName() ) ); -aSet.Put( SfxStringItem( SID_TARGETNAME, OUString("_blank") ) ); +aSet.Put( SfxStringItem( SID_TARGETNAME, "_blank" ) ); if ( pSavedOptions ) aSet.Put( *pSavedOptions ); if ( pSavedReferer ) @@ -924,30 +924,18 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet ) rSet.DisableItem( SID_CLEARHISTORY ); if ( pShUndoMgr && pShUndoMgr->GetUndoActionCount() ) -{ -OUString aTmp(SvtResId(STR_UNDO).toString()); -aTmp+= pShUndoMgr->GetUndoActionComment(); -rSet.Put( SfxStringItem( SID_UNDO, aTmp ) ); -} +rSet.Put( SfxStringItem( SID_UNDO, SvtResId(STR_UNDO).toString()+pShUndoMgr->GetUndoActionComment() ) ); else rSet.DisableItem( SID_UNDO ); if ( pShUndoMgr && pShUndoMgr->GetRedoActionCount() ) -{ -OUString aTmp(SvtResId(STR_REDO).toString()); -aTmp += pShUndoMgr->GetRedoActionComment(); -rSet.Put( SfxStringItem( SID_REDO, aTmp ) ); -} +rSet.Put( SfxStringItem( SID_REDO, SvtResId(STR_REDO).toString()+pShUndoMgr->GetRedoActionComment() ) ); else rSet.DisableItem( SID_REDO ); + SfxRepeatTarget *pTarget = pSh->GetRepeatTarget(); -if ( pShUndoMgr && pTarget && pShUndoMgr->GetRepeatActionCount() && - pShUndoMgr->CanRepeat(*pTarget) ) -{ -OUString aTmp(SvtResId(STR_REPEAT).toString()); -aTmp += pShUndoMgr->GetRepeatActionComment(*pTarget); -rSet.Put( SfxStringItem( SID_REPEAT, aTmp ) ); -} +if ( pShUndoMgr && pTarget && pShUndoMgr->GetRepeatActionCount() && pShUndoMgr->CanRepeat(*pTarget) ) +rSet.Put( SfxStringItem( SID_REPEAT, SvtResId(STR_REPEAT).toString()+pShUndoMgr->GetRepeatActionComment(*pTarget) ) ); else rSet.DisableItem( SID_REPEAT ); } @@ -1171,7 +1159,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) SignatureState nSignatureState = GetObjectShell()->GetDocumentSignatureState(); InfoBarType aInfoBarTy
[Libreoffice-commits] core.git: include/sfx2 sfx2/source
include/sfx2/docfac.hxx|6 +++--- sfx2/source/doc/docfac.cxx | 16 ++-- 2 files changed, 9 insertions(+), 13 deletions(-) New commits: commit 2cdca5d32e0b2d1efb9241e4e03e15b20f28363b Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Fri Mar 17 15:13:41 2017 +0100 SfxObjectFactory: directly store factory name as OUString Change-Id: I0779be1e4b344124514115c6645394d26ac09c36 Reviewed-on: https://gerrit.libreoffice.org/35375 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/include/sfx2/docfac.hxx b/include/sfx2/docfac.hxx index 2658eaa07e6c..f1b73f424281 100644 --- a/include/sfx2/docfac.hxx +++ b/include/sfx2/docfac.hxx @@ -43,18 +43,18 @@ typedef void (*SfxVoidFunc)(); class SFX2_DLLPUBLIC SfxObjectFactory { private: -const char* pShortName; +const OUString m_sFactoryName; std::unique_ptr pImpl; // Additional Data SfxObjectShellFlags nFlags; public: -SfxObjectFactory( const SvGlobalName , SfxObjectShellFlags nFlags, const char* pShortName ); +SfxObjectFactory( const SvGlobalName , SfxObjectShellFlags nFlags, const OUString& sFactoryName ); ~SfxObjectFactory(); const SvGlobalName& GetClassId() const; SfxObjectShellFlags GetFlags() { return nFlags; } OUStringGetFactoryURL() const; // shortcut for "private:factory/GetShortName()" -OUStringGetFactoryName() const { return OUString::createFromAscii(pShortName); } +OUStringGetFactoryName() const { return m_sFactoryName; } OUStringGetModuleName() const; SfxFilterContainer *GetFilterContainer() const; diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 20ebfbcfc0fa..cfe4e5fdac7b 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -85,15 +85,14 @@ SfxObjectFactory::SfxObjectFactory ( const SvGlobalName& rName, SfxObjectShellFlags nFlagsP, -const char* pName -) :pShortName( pName ), +const OUString& sName +) :m_sFactoryName( sName ), pImpl( new SfxObjectFactory_Impl ), nFlags( nFlagsP ) { -pImpl->pFilterContainer = new SfxFilterContainer( OUString::createFromAscii( pName ) ); +pImpl->pFilterContainer = new SfxFilterContainer( m_sFactoryName ); -OUString aShortName( OUString::createFromAscii( pShortName ) ); -aShortName = aShortName.toAsciiLowerCase(); +const OUString aShortName( m_sFactoryName.toAsciiLowerCase() ); pImpl->aClassName = rName; if ( aShortName == "swriter" ) pImpl->pNameResId = new SfxResId( STR_DOCTYPENAME_SW ); @@ -307,7 +306,7 @@ OUString SfxObjectFactory::GetStandardTemplate( const OUString& rServiceName ) std::shared_ptr SfxObjectFactory::GetTemplateFilter() const { sal_uInt16 nVersion=0; -SfxFilterMatcher aMatcher ( OUString::createFromAscii( pShortName ) ); +SfxFilterMatcher aMatcher ( m_sFactoryName ); SfxFilterMatcherIter aIter( aMatcher ); std::shared_ptr pFilter; std::shared_ptr pTemp = aIter.First(); @@ -342,10 +341,7 @@ const SvGlobalName& SfxObjectFactory::GetClassId() const OUString SfxObjectFactory::GetFactoryURL() const { -OUStringBuffer aURLComposer; -aURLComposer.append("private:factory/"); -aURLComposer.appendAscii(pShortName); -return aURLComposer.makeStringAndClear(); +return "private:factory/" + m_sFactoryName; } OUString SfxObjectFactory::GetModuleName() const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/sfx2 sfx2/source
include/sfx2/docfac.hxx |1 - sfx2/source/doc/docfac.cxx |2 +- sfx2/source/view/viewfrm.cxx |8 3 files changed, 5 insertions(+), 6 deletions(-) New commits: commit b165f0f9cc358e6127f69227fc3e4f6428fe50c7 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Fri Mar 17 11:54:00 2017 +0100 Remove SfxObjectFactory::GetShortName() Used in just two places, where GetFactoryName can also work. Change-Id: I8d498345c41aef520ef776a3deb6744cc64756f5 Reviewed-on: https://gerrit.libreoffice.org/35374 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/include/sfx2/docfac.hxx b/include/sfx2/docfac.hxx index 547ad584b19a..2658eaa07e6c 100644 --- a/include/sfx2/docfac.hxx +++ b/include/sfx2/docfac.hxx @@ -53,7 +53,6 @@ public: const SvGlobalName& GetClassId() const; SfxObjectShellFlags GetFlags() { return nFlags; } -const char* GetShortName() const { return pShortName; } OUStringGetFactoryURL() const; // shortcut for "private:factory/GetShortName()" OUStringGetFactoryName() const { return OUString::createFromAscii(pShortName); } OUStringGetModuleName() const; diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index dbeeb746c893..20ebfbcfc0fa 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -344,7 +344,7 @@ OUString SfxObjectFactory::GetFactoryURL() const { OUStringBuffer aURLComposer; aURLComposer.append("private:factory/"); -aURLComposer.appendAscii(GetShortName()); +aURLComposer.appendAscii(pShortName); return aURLComposer.makeStringAndClear(); } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 1e9ec49cebf4..70494e9de94a 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2782,9 +2782,9 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet ) case SID_RECORDMACRO : { SvtMiscOptions aMiscOptions; -const char* pName = GetObjectShell()->GetFactory().GetShortName(); +const OUString sName{GetObjectShell()->GetFactory().GetFactoryName()}; if ( !aMiscOptions.IsMacroRecorderMode() || - ( strcmp(pName,"swriter") && strcmp(pName,"scalc") ) ) + ( sName!="swriter" && sName!="scalc" ) ) { rSet.DisableItem( nWhich ); rSet.Put(SfxVisibilityItem(nWhich, false)); @@ -2808,9 +2808,9 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet ) case SID_STOP_RECORDING : { SvtMiscOptions aMiscOptions; -const char* pName = GetObjectShell()->GetFactory().GetShortName(); +const OUString sName{GetObjectShell()->GetFactory().GetFactoryName()}; if ( !aMiscOptions.IsMacroRecorderMode() || - ( strcmp(pName,"swriter") && strcmp(pName,"scalc") ) ) + ( sName!="swriter" && sName!="scalc" ) ) { rSet.DisableItem( nWhich ); break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/objstor.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit ba66f477a3db8afdc8d76283747d30e80d437a8f Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Thu Mar 16 22:54:34 2017 +0100 Use SfxObjectFactory::GetFactoryName, again Change-Id: I653fdaa2564a97716e400b509eb7408ffe6050a3 Reviewed-on: https://gerrit.libreoffice.org/35373 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 420cb6ecd35c..3266f5d4ac95 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -3506,8 +3506,9 @@ bool SfxObjectShell::WriteThumbnail(bool bEncrypted, bool bIsTemplate, const uno xSet->setPropertyValue("MediaType", uno::makeAny(OUString("image/png"))); if (bEncrypted) { -OUString sFactoryName = OUString::createFromAscii(GetFactory().GetShortName()); -sal_uInt16 nResID = GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl(sFactoryName, bIsTemplate); +const sal_uInt16 nResID = GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl( +GetFactory().GetFactoryName(), +bIsTemplate); if (nResID) bResult = GraphicHelper::getThumbnailReplacement_Impl(nResID, xStream); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/objserv.cxx | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) New commits: commit b2c58d86127c802555b933d5c11e80bc308f54e6 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Thu Mar 16 21:43:49 2017 +0100 Simplify same assignment in both branches of a conditional aTitle was assigned GetTitle() in both branches since initial commit (2007) Remove the (used just once) temporary, while at it. Change-Id: I0c6cb0ef8f720fea7f4105edf8233a2c64377e4f Reviewed-on: https://gerrit.libreoffice.org/35372 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index f354797da5a1..e357c82533c6 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -448,18 +448,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest ) // e.g. if a readonly document is saved elsewhere and user asks for editing DocInfo before bReadOnly = pROItem->GetValue(); -// collect data for dialog -OUString aURL, aTitle; -if ( HasName() ) -{ -aURL = GetMedium()->GetName(); -aTitle = GetTitle(); -} -else -{ -aURL = GetFactory().GetFactoryURL(); -aTitle = GetTitle(); -} +// URL for dialog +const OUString aURL( HasName() ? GetMedium()->GetName() : GetFactory().GetFactoryURL() ); Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY ); uno::Sequence< document::CmisProperty> aCmisProperties = xCmisDoc->getCmisProperties(); @@ -475,7 +465,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest ) 0L ); aSet.Put( aDocInfoItem ); aSet.Put( SfxBoolItem( SID_DOC_READONLY, bReadOnly ) ); -aSet.Put( SfxStringItem( SID_EXPLORER_PROPS_START, aTitle ) ); +aSet.Put( SfxStringItem( SID_EXPLORER_PROPS_START, GetTitle() ) ); aSet.Put( SfxStringItem( SID_BASEURL, GetMedium()->GetBaseURL() ) ); // creating dialog is done via virtual method; application will ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/source sfx2/source sw/source
sc/source/ui/docshell/docsh4.cxx |2 +- sc/source/ui/miscdlgs/instbdlg.cxx|3 +-- sc/source/ui/miscdlgs/linkarea.cxx|3 +-- sfx2/source/doc/objserv.cxx |5 ++--- sfx2/source/doc/objstor.cxx |2 +- sfx2/source/view/viewfrm2.cxx |2 +- sw/source/ui/dbui/mmdocselectpage.cxx |2 +- sw/source/ui/misc/glossary.cxx|2 +- sw/source/uibase/app/docsh2.cxx | 12 +--- sw/source/uibase/dbui/mailmergehelper.cxx |2 +- sw/source/uibase/uiview/view2.cxx |6 -- 11 files changed, 19 insertions(+), 22 deletions(-) New commits: commit b93a015f9bbed007a8800ef040ec2b6211d33858 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Thu Mar 16 21:21:25 2017 +0100 Use SfxObjectFactory::GetFactoryName/URL instead of OUString::createFromAscii( GetShortName() ), in one case manually added to factory URL prefix. Change-Id: I762fc1bcd6dcf7246531816faad2682caf9133fb Reviewed-on: https://gerrit.libreoffice.org/35371 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 53b88a7a7fb0..1ee2f8bfa646 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -729,7 +729,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) pImpl->pRequest = new SfxRequest( rReq ); delete pImpl->pDocInserter; pImpl->pDocInserter = new ::sfx2::DocumentInserter( -OUString::createFromAscii( ScDocShell::Factory().GetShortName() ), false ); +ScDocShell::Factory().GetFactoryName(), false ); pImpl->pDocInserter->StartExecuteModal( LINK( this, ScDocShell, DialogClosedHdl ) ); return ; } diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index 241b370ac4d9..27e6ff5f56dc 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -274,8 +274,7 @@ IMPL_LINK_NOARG(ScInsertTableDlg, ChoiceHdl_Impl, Button*, void) IMPL_LINK_NOARG(ScInsertTableDlg, BrowseHdl_Impl, Button*, void) { delete pDocInserter; -pDocInserter = new ::sfx2::DocumentInserter( -OUString::createFromAscii( ScDocShell::Factory().GetShortName() ) ); +pDocInserter = new ::sfx2::DocumentInserter(ScDocShell::Factory().GetFactoryName()); pDocInserter->StartExecuteModal( LINK( this, ScInsertTableDlg, DialogClosedHdl ) ); } diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 94fc4e677dff..180e089f305e 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -84,8 +84,7 @@ void ScLinkedAreaDlg::dispose() IMPL_LINK_NOARG(ScLinkedAreaDlg, BrowseHdl, Button*, void) { if ( !pDocInserter ) -pDocInserter = new sfx2::DocumentInserter( -OUString::createFromAscii( ScDocShell::Factory().GetShortName() ) ); +pDocInserter = new sfx2::DocumentInserter(ScDocShell::Factory().GetFactoryName()); pDocInserter->StartExecuteModal( LINK( this, ScLinkedAreaDlg, DialogClosedHdl ) ); } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 95048d118856..f354797da5a1 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -275,7 +275,7 @@ bool SfxObjectShell::APISaveAs_Impl(const OUString& aFileName, SfxItemSet& rItem const SfxStringItem* pContentTypeItem = rItemSet.GetItem(SID_CONTENTTYPE, false); if ( pContentTypeItem ) { -std::shared_ptr pFilter = SfxFilterMatcher( OUString::createFromAscii(GetFactory().GetShortName()) ).GetFilter4Mime( pContentTypeItem->GetValue(), SfxFilterFlags::EXPORT ); +std::shared_ptr pFilter = SfxFilterMatcher( GetFactory().GetFactoryName() ).GetFilter4Mime( pContentTypeItem->GetValue(), SfxFilterFlags::EXPORT ); if ( pFilter ) aFilterName = pFilter->GetName(); } @@ -457,8 +457,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest ) } else { -aURL = "private:factory/" + OUString::createFromAscii( GetFactory().GetShortName() ); - +aURL = GetFactory().GetFactoryURL(); aTitle = GetTitle(); } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 4f70a1db4068..420cb6ecd35c 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2588,7 +2588,7 @@ bool SfxObjectShell::Save_Impl( const SfxItemSet* pSet ) OUString aFilterName; std::shared_ptr pFilte
Unuseful SfxObjectFactory::GetFactoryURL() in SfxViewFrame::LoadViewIntoFrame_Impl, any clue?
Hi all, I stumbled in the following code snippet in SfxViewFrame::LoadViewIntoFrame_Impl: OUString sURL( "private:object" ); if ( sURL.isEmpty() ) sURL = i_rDoc.GetFactory().GetFactoryURL(); in which the "if" test is obviously always false. I looked at how code evolved during development and, apart for some OUString reworking, the main changes are: 1. Commit https://cgit.freedesktop.org/libreoffice/core/commit/?id=9fb19fd9f062adc0bb778258c5e65d57ff794e09 introduced GetFactoryURL() and simplified the original code into: ::rtl::OUString sURL( xDocument->getURL() ); if ( !sURL.getLength() ) sURL = i_rDoc.GetFactory().GetFactoryURL(); also adding a similar flow in SfxFrame::Create (sfx2/source/view/frame2.cxx) 2. Commit https://cgit.freedesktop.org/libreoffice/core/commit/?id=c44ba0727fecc1a1a70f525e72b0854527ab3e22 replaced (and this is the whole commit) all of the 3 lines with just: ::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "private:object" ) ); 3. Commit https://cgit.freedesktop.org/libreoffice/core/commit/?id=a8f1ad65612c0e54969cabc541b183062ae3d905 added back the "if": ::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "private:object" ) ); if ( sURL.isEmpty() ) sURL = i_rDoc.GetFactory().GetFactoryURL(); and strangely replaced the similar code in SfxFrame::Create with the same "fix" used in commit 2 (might it be a mis-merge?). My guess is that the "if" in the code under consideration can be removed since such code was untouched for so long but I have no idea about what this code is menat to do. Does anybody have a clue on what this code is supposed to do and on how to proceed? Many thanks and kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/dialog/filedlghelper.cxx |6 ++ sfx2/source/dialog/filedlgimpl.hxx |2 -- 2 files changed, 2 insertions(+), 6 deletions(-) New commits: commit 0ff696769088c2da896130dc722662b39a4416e4 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Mar 5 21:39:06 2017 +0100 No need to keep these booleans as data members Change-Id: Id56cb074a3b62423769afc3c4a3ab2f7a312f1be Reviewed-on: https://gerrit.libreoffice.org/35284 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index b6ff97b0a99d..9a90ade8693a 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -886,12 +886,10 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( mbHasVersions = false; mbHasPreview= false; mbShowPreview = false; -mbAddGraphicFilter = bool(nFlags & FileDialogFlags::Graphic); mbDeleteMatcher = false; mbInsert= bool(nFlags & FileDialogFlags::Insert); mbExport= bool(nFlags & FileDialogFlags::Export); mbIsSaveDlg = false; -mbIsSaveACopyDlg= bool(nFlags & FileDialogFlags::SaveACopy); mbPwdCheckBoxState = false; mbSelection = false; mbSelectionEnabled = true; @@ -1083,7 +1081,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( if ( nFlags & FileDialogFlags::MultiSelection ) mxFileDlg->setMultiSelectionMode( true ); -if (mbAddGraphicFilter) // generate graphic filter only on demand +if ( nFlags & FileDialogFlags::Graphic ) // generate graphic filter only on demand { addGraphicFilter(); } @@ -1100,7 +1098,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( } // Save a copy dialog -if ( mbIsSaveACopyDlg ) +if ( nFlags & FileDialogFlags::SaveACopy ) { mxFileDlg->setTitle( SfxResId( STR_PB_SAVEACOPY ).toString() ); } diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index db6782a94f41..1ea707989463 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -81,11 +81,9 @@ namespace sfx2 boolm_bHaveFilterOptions: 1; boolmbHasVersions : 1; boolmbHasAutoExt: 1; -boolmbAddGraphicFilter : 1; boolmbHasPreview: 1; boolmbShowPreview : 1; boolmbIsSaveDlg : 1; -boolmbIsSaveACopyDlg: 1; boolmbExport: 1; boolmbDeleteMatcher : 1; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: cui/source sc/source sfx2/source toolkit/source vcl/inc vcl/osx vcl/source vcl/unx vcl/win
cui/source/tabpages/page.cxx|2 +- sc/source/ui/unoobj/styleuno.cxx|2 +- sfx2/source/doc/printhelper.cxx |2 +- toolkit/source/awt/vclxprinter.cxx |2 +- vcl/inc/osx/salprn.h|4 ++-- vcl/inc/salprn.hxx |4 ++-- vcl/inc/unx/genprn.h|4 ++-- vcl/inc/win/salprn.h|4 ++-- vcl/osx/salprn.cxx |4 ++-- vcl/source/gdi/print.cxx|2 +- vcl/source/gdi/print3.cxx |2 +- vcl/unx/generic/print/genprnpsp.cxx |6 +++--- vcl/win/gdi/salprn.cxx |4 ++-- 13 files changed, 21 insertions(+), 21 deletions(-) New commits: commit c6f32df907983092cdb9f40c7c7ad0552caf41c3 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Feb 5 21:43:59 2017 +0100 sal_uIntPtr to sal_uInt16 Change-Id: If463ae457f53a0a8b12cc0748afbc654f54ae3c3 diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 95125e2..fd4065f 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -928,7 +928,7 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, Control&, void) m_pPaperTrayBox->SetEntryData( nEntryPos, reinterpret_cast<void*>((sal_uLong)PAPERBIN_PRINTER_SETTINGS) ); OUString aPaperBin( EditResId( RID_SVXSTR_PAPERBIN ) ); -sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount(); +const sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount(); for ( sal_uInt16 i = 0; i < nBinCount; ++i ) { diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 1b27d6f..a7a28f5 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -1655,7 +1655,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx Printer* pPrinter = pDocShell->GetPrinter(); if (pPrinter) { -sal_uInt16 nCount = pPrinter->GetPaperBinCount(); +const sal_uInt16 nCount = pPrinter->GetPaperBinCount(); for (sal_uInt16 i=0; i<nCount; i++) if ( aName == pPrinter->GetPaperBinName(i) ) { diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 4af6b2e..c9dbf27e 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -416,7 +416,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > OUString aTmp; if ( !( rProp.Value >>= aTmp ) ) throw css::lang::IllegalArgumentException(); -sal_uInt16 nCount = pPrinter->GetPaperBinCount(); +const sal_uInt16 nCount = pPrinter->GetPaperBinCount(); for (sal_uInt16 nBin=0; nBin<nCount; nBin++) { OUString aName( pPrinter->GetPaperBinName(nBin) ); diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx index e3e95bf..d89c32d 100644 --- a/toolkit/source/awt/vclxprinter.cxx +++ b/toolkit/source/awt/vclxprinter.cxx @@ -211,7 +211,7 @@ css::uno::Sequence< OUString > VCLXPrinterPropertySet::getFormDescriptions( ) { ::osl::MutexGuard aGuard( Mutex ); -sal_uInt16 nPaperBinCount = GetPrinter()->GetPaperBinCount(); +const sal_uInt16 nPaperBinCount = GetPrinter()->GetPaperBinCount(); css::uno::Sequence< OUString > aDescriptions( nPaperBinCount ); for ( sal_uInt16 n = 0; n < nPaperBinCount; n++ ) { diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h index f47a32b..78afec3 100644 --- a/vcl/inc/osx/salprn.h +++ b/vcl/inc/osx/salprn.h @@ -76,8 +76,8 @@ class AquaSalInfoPrinter : public SalInfoPrinter long& o_rPageOffX, long& o_rPageOffY, long& o_rPageWidth, long& o_rPageHeight ) override; virtual sal_uInt32 GetCapabilities( const ImplJobSetup* i_pSetupData, PrinterCapType i_nType ) override; -virtual sal_uLong GetPaperBinCount( const ImplJobSetup* i_pSetupData ) override; -virtual OUStringGetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uLong i_nPaperBin ) override; +virtual sal_uInt16 GetPaperBinCount( const ImplJobSetup* i_pSetupData ) override; +virtual OUStringGetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uInt16 i_nPaperBin ) override; virtual voidInitPaperFormats( const ImplJobSetup* i_pSetupData ) override; virtual int GetLandscap
[Libreoffice-commits] core.git: 2 commits - include/tools tools/source
include/tools/inetstrm.hxx |2 -- tools/source/inet/inetmsg.cxx |1 - tools/source/inet/inetstrm.cxx | 12 +--- 3 files changed, 9 insertions(+), 6 deletions(-) New commits: commit 7b2966dbf283b168fa0cc1eadf989387ab6e25b9 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Jun 4 16:19:23 2016 +0200 nBufSiz can be a non-class local constant Change-Id: I2a7d32eabd01622261a1163781ac2a8b64bdee3f diff --git a/include/tools/inetstrm.hxx b/include/tools/inetstrm.hxx index e7a0a99..8d6353b 100644 --- a/include/tools/inetstrm.hxx +++ b/include/tools/inetstrm.hxx @@ -31,7 +31,6 @@ class TOOLS_DLLPUBLIC INetMIMEMessageStream INetMIMEMessage *pSourceMsg; boolbHeaderGenerated; -sal_uIntPtr nBufSiz; sal_Char *pBuffer; sal_Char *pRead; sal_Char *pWrite; diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index f1082a1f..99716a1 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -222,11 +222,17 @@ int INetMIMEMessageStream::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) } } +namespace +{ + +const int BUFFER_SIZE = 2048; + +} + INetMIMEMessageStream::INetMIMEMessageStream( INetMIMEMessage *pMsg, bool headerGenerated): pSourceMsg(pMsg), bHeaderGenerated(headerGenerated), -nBufSiz(2048), pMsgStrm(nullptr), pMsgBuffer(new SvMemoryStream), pMsgRead(nullptr), @@ -237,7 +243,7 @@ INetMIMEMessageStream::INetMIMEMessageStream( { assert(pMsg != nullptr); pMsgBuffer->SetStreamCharSet(RTL_TEXTENCODING_ASCII_US); -pBuffer = new sal_Char[nBufSiz]; +pBuffer = new sal_Char[BUFFER_SIZE]; pRead = pWrite = pBuffer; } @@ -271,7 +277,7 @@ int INetMIMEMessageStream::Read(sal_Char* pData, sal_uIntPtr nSize) pRead = pWrite = pBuffer; // Read next message line. -int nRead = GetMsgLine(pBuffer, nBufSiz); +int nRead = GetMsgLine(pBuffer, BUFFER_SIZE); if (nRead > 0) { // Set read pointer. commit 30d722a8f91b667cf56cab2ab6e2f5b2ed18408c Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Jun 4 13:23:31 2016 +0200 Reduce #include dependencies Change-Id: I5c6c379717869028102ab2a1ae7929dfbc447904 diff --git a/include/tools/inetstrm.hxx b/include/tools/inetstrm.hxx index 834df85..e7a0a99 100644 --- a/include/tools/inetstrm.hxx +++ b/include/tools/inetstrm.hxx @@ -21,7 +21,6 @@ #include #include -#include class INetMIMEMessage; class SvMemoryStream; diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 19eed71..b488ff9 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 10 commits - dbaccess/source include/vcl ucb/source vcl/source
dbaccess/source/ui/misc/WCPage.cxx | 20 -- dbaccess/source/ui/tabledesign/TEditControl.cxx | 25 +- dbaccess/source/ui/tabledesign/TableRow.cxx | 13 - include/vcl/texteng.hxx |2 ucb/source/ucp/ftp/ftpdirp.hxx |2 vcl/source/control/edit.cxx | 41 ++-- vcl/source/edit/texteng.cxx | 207 +++- 7 files changed, 139 insertions(+), 171 deletions(-) New commits: commit 4266caadbbe67fa23de0df3b84f4d923cfd57201 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed May 4 22:20:42 2016 +0200 Assign 0 explicitly, avoiding intermediate downcasts Change-Id: I43a9adeaf7078551a3447032fbf65affab817b15 diff --git a/ucb/source/ucp/ftp/ftpdirp.hxx b/ucb/source/ucp/ftp/ftpdirp.hxx index 441d6a4..6527569 100644 --- a/ucb/source/ucp/ftp/ftpdirp.hxx +++ b/ucb/source/ucp/ftp/ftpdirp.hxx @@ -47,7 +47,7 @@ namespace ftp { void SetMonth(sal_uInt16 month) { Month = month; } void SetDay(sal_uInt16 day) { Day = day; } // Only zero allowed and used for time-argument -void SetTime(sal_uInt16) { Hours = Minutes = Seconds = NanoSeconds = 0; } +void SetTime(sal_uInt16) { Hours = 0; Minutes = 0; Seconds = 0; NanoSeconds = 0; } void SetHour(sal_uInt16 hours) { Hours = hours; } void SetMin(sal_uInt16 minutes) { Minutes = minutes; } void SetSec(sal_uInt16 seconds) { Seconds = seconds; } commit 92849803822407301c79db98245711d054f8fe9b Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon May 2 22:16:31 2016 +0200 Constify some temporaries Change-Id: I4d88975c4c4639ff933dc155bd258f1617c2198f diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 4ccb2f0..5455cc4 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -440,7 +440,7 @@ void TextEngine::SetText( const OUString& rText ) { ImpRemoveText(); -bool bUndoCurrentlyEnabled = IsUndoEnabled(); +const bool bUndoCurrentlyEnabled = IsUndoEnabled(); // the manually inserted text cannot be reversed by the user EnableUndo( false ); @@ -701,8 +701,8 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel, xISC->correctInputSequence( aNewText, nTmpPos - 1, c, nCheckMode ); // find position of first character that has changed -sal_Int32 nOldLen = aOldText.getLength(); -sal_Int32 nNewLen = aNewText.getLength(); +const sal_Int32 nOldLen = aOldText.getLength(); +const sal_Int32 nNewLen = aNewText.getLength(); const sal_Unicode *pOldTxt = aOldText.getStr(); const sal_Unicode *pNewTxt = aNewText.getStr(); sal_Int32 nChgPos = 0; @@ -1470,8 +1470,8 @@ void TextEngine::UpdateViews( TextView* pCurView ) pView->HideCursor(); Rectangle aClipRect( maInvalidRect ); -Size aOutSz = pView->GetWindow()->GetOutputSizePixel(); -Rectangle aVisArea( pView->GetStartDocPos(), aOutSz ); +const Size aOutSz = pView->GetWindow()->GetOutputSizePixel(); +const Rectangle aVisArea( pView->GetStartDocPos(), aOutSz ); aClipRect.Intersection( aVisArea ); if ( !aClipRect.IsEmpty() ) { @@ -1508,7 +1508,7 @@ void TextEngine::FormatFullDoc() for ( sal_uInt32 nPortion = 0; nPortion < mpTEParaPortions->Count(); ++nPortion ) { TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPortion ); -sal_Int32 nLen = pTEParaPortion->GetNode()->GetText().getLength(); +const sal_Int32 nLen = pTEParaPortion->GetNode()->GetText().getLength(); pTEParaPortion->MarkSelectionInvalid( 0, nLen ); } mbFormatted = false; @@ -1546,7 +1546,7 @@ void TextEngine::FormatDoc() const long nWidth = mnMaxTextWidth ? mnMaxTextWidth : std::numeric_limits::max(); -Range aInvRange( GetInvalidYOffsets( nPara ) ); +const Range aInvRange( GetInvalidYOffsets( nPara ) ); maInvalidRect = Rectangle( Point( 0, nY+aInvRange.Min() ), Size( nWidth, aInvRange.Len() ) ); } @@ -1576,7 +1576,7 @@ void TextEngine::FormatDoc() if ( !maInvalidRect.IsEmpty() ) { const long nNewHeight = CalcTextHeight(); -long nDiff = nNewHeight - mnCurTextHeight; +const long nDiff = nNewHeight - mnCurTextHeight; if ( nNewHeight < mnCurTextHeight ) { maInvalidRect.Bottom() = std::max( nNewHeight, mnCurTextHeight ); @@ -1628,7 +1628,7 @@ void TextEngine::CreateAndInsertEmptyLine( sal_uInt32 nPara ) if ( bLineBreak ) { // -2: The new one is already inserted. -sal_u
Re: Fix for Bug 98940
Thanks Michael! On Fri, 6 May 2016 23:36:58 +0200 Michael Stahl <mst...@redhat.com> wrote: > On 04.05.2016 14:33, Matteo Casalin wrote: > > Hi Michael, > > thanks for the details. > > I tried the "gerrit cherry-pick to libreoffice-5-1" method, and it seems > > [1] that the same one-line patch is enough. I agree that the fix is > > trivial, so I would prefer not testing it since my machine is quite slow - > > but if required I can give it a try. > > great, looks like it was reviewed in the mean time :) > > > Just to be sure: 5.1.4 will be branched from 5.1, not from 5.1.3, right? > > yes, there is only one micro release from each libreoffice-x-y-z branch, > and the next libreoffice-x-y-z+1 is branched from libreoffice-x-y again. > > ___ > LibreOffice mailing list > LibreOffice@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/libreoffice ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - vcl/source
vcl/source/edit/texteng.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c927b6692257e427d622add6324fc1c55fce9aa3 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Apr 20 21:42:28 2016 +0200 Resolves: tdf#98940 (-1 not mapping to maximum string length anymore) Change-Id: I58e4a63bce17b880a97c7ccfb4d42dfb930e54c5 Reviewed-on: https://gerrit.libreoffice.org/24268 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit eca3455190ed9a2c4796e7954f2533dc71cd1ab6) Reviewed-on: https://gerrit.libreoffice.org/24654 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: David Tardon <dtar...@redhat.com> diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 6763664..fec262f 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -218,7 +218,7 @@ void TextEngine::SetFont( const vcl::Font& rFont ) void TextEngine::SetMaxTextLen( sal_Int32 nLen ) { -mnMaxTextLen = nLen; +mnMaxTextLen = nLen>=0 ? nLen : EDIT_NOLIMIT; } void TextEngine::SetMaxTextWidth( long nMaxWidth ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: Fix for Bug 98940
Hi Michael, thanks for the details. I tried the "gerrit cherry-pick to libreoffice-5-1" method, and it seems [1] that the same one-line patch is enough. I agree that the fix is trivial, so I would prefer not testing it since my machine is quite slow - but if required I can give it a try. Just to be sure: 5.1.4 will be branched from 5.1, not from 5.1.3, right? Thanks again and kind regards matteo [1] https://gerrit.libreoffice.org/#/c/24654/ On Wed, 4 May 2016 13:58:57 +0200 Michael Stahl <mst...@redhat.com> wrote: > On 01.05.2016 18:37, Matteo Casalin wrote: > > On 05/01/2016 12:23 PM, Christian Lohmaier wrote: > >> On Fri, Apr 29, 2016 at 6:52 PM, Matteo Casalin > >> <matteo.casa...@yahoo.com> wrote: > > >>> The aforementioned bug, however, affects the 5.1 branch and should be > >>> evaluated for backporting: what is the best approach to be followed for > >>> this? > >> > >> Cherry pick to gerrit and amend with any fixup necessary, so it ends > >> up in 5.1 as one single commit. > > > > I'm not familiar with this flow, is this equivalent to: > > * Switch my local copy to 5.1 branch > > * Implement the same fix, plus any other modification needed to compile > > you can just use "git cherry-pick -x " to apply the > patch to the release branch (and resolve merge conflicts if there are any). > > > * Submit to gerrit, specifying 5.1 branch > > that works - an alternative that may be easier is to go to your master > change in gerrit web ui and click the "cherry-pick" button and specify > "libreoffice-5-1" branch - that will only work if there are no merge > conflicts, and if you want to test it locally it's not actually easier, > but this fix looks rather trivial. > ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: vcl/source
vcl/source/edit/texteng.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit eca3455190ed9a2c4796e7954f2533dc71cd1ab6 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Apr 20 21:42:28 2016 +0200 Resolves: tdf#98940 (-1 not mapping to maximum string length anymore) Change-Id: I58e4a63bce17b880a97c7ccfb4d42dfb930e54c5 Reviewed-on: https://gerrit.libreoffice.org/24268 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index af3425b..d24ff15 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -218,7 +218,7 @@ void TextEngine::SetFont( const vcl::Font& rFont ) void TextEngine::SetMaxTextLen( sal_Int32 nLen ) { -mnMaxTextLen = nLen; +mnMaxTextLen = nLen>=0 ? nLen : EDIT_NOLIMIT; } void TextEngine::SetMaxTextWidth( long nMaxWidth ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: Fix for Bug 98940
On 04/29/2016 06:52 PM, Matteo Casalin wrote: Hi everybody, I submitted to gerrit a one-line fix for bug 98940, a regression introduced by a previous commit of mine. I think it's quite safe to push it to master, and I will do that in a few days unless someone reviews/pushes it in the meantime. The aforementioned bug, however, affects the 5.1 branch and should be evaluated for backporting: what is the best approach to be followed for this? Thanks in advance and kind regards Matteo As an addition, the bug reporter originally asked for two fixes: 1. allow again -1 as a valid value, that should be fixed by my patch at: https://gerrit.libreoffice.org/#/c/24268/ 2. allow a maximum "maximum length" positive value higher than 32767. I see two issues with this: * that value is set by VCLXMultilineEdit::setProperty, that uses a sal_Int16: http://opengrok.libreoffice.org/xref/core/svtools/source/uno/unoiface.cxx#443 and I have no idea if this can be changed or if it is stable api * The control widget can takes values higher than the aforementioned 32767, and this besides being misleading can also be a source of undesired behavior (is the chosen value truncated, saturated or what?). Any comment is much appreciated. Kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: Fix for Bug 98940
Hi Christian On 05/01/2016 12:23 PM, Christian Lohmaier wrote: Hi Matteo, On Fri, Apr 29, 2016 at 6:52 PM, Matteo Casalin <matteo.casa...@yahoo.com> wrote: using yahoo address with mailing lists is unfortunate, as yahoo uses DMARC policy that make receiving mail providers flag the mail as spam or reject them "Why is this message in Spam? It has a from address in yahoo.com but has failed yahoo.com's required tests for authentication." Thanks for reporting - I will ask for a libreoffice.org one, hoping that it will work fine. It would be great to have a list of account providers that are known to work fine with LO online services, besides reducing the number of required accounts themselves: I already had to switch both openid and e-mail provider for a similar reason, finally choosing yahoo as a all-in-one solution. I honestly would prefer not to have to change again due to a new poor choice. Hi everybody, I submitted to gerrit a one-line fix for bug 98940, a regression introduced by a previous commit of mine. then it would help greatly to also include the appropriate link to gerrit Sorry, that was my idea but clearly missed it. Here it is: https://gerrit.libreoffice.org/24268 The aforementioned bug, however, affects the 5.1 branch and should be evaluated for backporting: what is the best approach to be followed for this? Cherry pick to gerrit and amend with any fixup necessary, so it ends up in 5.1 as one single commit. I'm not familiar with this flow, is this equivalent to: * Switch my local copy to 5.1 branch * Implement the same fix, plus any other modification needed to compile * Submit to gerrit, specifying 5.1 branch Thanks and kind regards Matteo ciao Christian ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Fix for Bug 98940
Hi everybody, I submitted to gerrit a one-line fix for bug 98940, a regression introduced by a previous commit of mine. I think it's quite safe to push it to master, and I will do that in a few days unless someone reviews/pushes it in the meantime. The aforementioned bug, however, affects the 5.1 branch and should be evaluated for backporting: what is the best approach to be followed for this? Thanks in advance and kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: tools/source
tools/source/memtools/unqidx.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit 96be131c5ef00bfae3c0c83231989fdfe9f7f5bb Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Mar 5 18:58:30 2016 +0100 Minor optimization, and improved comments Change-Id: I6732725ef48d69f4c01762a117a60447e313aea0 Reviewed-on: https://gerrit.libreoffice.org/22936 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index b53895f..7c57c1b 100644 --- a/tools/source/memtools/unqidx.cxx +++ b/tools/source/memtools/unqidx.cxx @@ -25,13 +25,13 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p ) if ( !p ) return IndexNotFound; -// Search next unused index, may be needed after -// a removal followed by multiple insertions -while ( maMap.find( nUniqIndex ) != maMap.end() ) +// Insert the pointer, starting from the current nUniqIndex "hint" +// and increasing it until a free one is found (this may happen +// after removals followed by multiple insertions). +while ( !maMap.emplace(nUniqIndex, p).second ) ++nUniqIndex; -maMap[ nUniqIndex ] = p; - +// Take care of updating hint key for next insertion return nUniqIndex++; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/tools tools/source
include/tools/unqidx.hxx |6 ++ tools/source/memtools/unqidx.cxx | 39 +++ 2 files changed, 17 insertions(+), 28 deletions(-) New commits: commit 078188793b2753bf607bb629464935ccefd28136 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Mar 5 14:59:11 2016 +0100 Remove unuseful nStartIndex data member (and fix indexing) The methods that modify nUinqIndex already maintain class invariants: * Insert() never decrease its value * Remove() can replace its value with that of the removed item, which was no lower than the one specified in constructor call. Besides, boundary checks against nStartIndex are not really needed since the various methods rely on map::find. Finally, FirstIndex/NextIndex/LastIndex/GetIndexOf did not adjust with nStartIndex the index value retrieved from tha map, thus provifing wrong values. Since the map now stores the real indexes, consistency is granted. Change-Id: I5e47cd2672677805304d4c4860826fe272812abf Reviewed-on: https://gerrit.libreoffice.org/22935 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> diff --git a/include/tools/unqidx.hxx b/include/tools/unqidx.hxx index b6d65b4..99c5655 100644 --- a/include/tools/unqidx.hxx +++ b/include/tools/unqidx.hxx @@ -31,13 +31,11 @@ public: private: std::map<Index, void*> maMap; -const Index nStartIndex; Index nUniqIndex; public: -UniqueIndexImpl( Index _nStartIndex = 0 ) -: maMap(), - nStartIndex(_nStartIndex), nUniqIndex(_nStartIndex) {} +UniqueIndexImpl( Index nStartIndex = 0 ) +: maMap(), nUniqIndex(nStartIndex) {} Index Insert( void* p ); // insert value with key, replacing existing entry if necessary diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index 56a9f0a..b53895f 100644 --- a/tools/source/memtools/unqidx.cxx +++ b/tools/source/memtools/unqidx.cxx @@ -32,42 +32,33 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p ) maMap[ nUniqIndex ] = p; -nUniqIndex++; -return ( nUniqIndex + nStartIndex - 1 ); +return nUniqIndex++; } void* UniqueIndexImpl::Remove( Index nIndex ) { -// Check for valid index -if ( nIndex >= nStartIndex ) +std::map<Index, void*>::iterator it = maMap.find( nIndex ); +if ( it != maMap.end() ) { -std::map<Index, void*>::iterator it = maMap.find( nIndex - nStartIndex ); -if( it != maMap.end() ) -{ -// Allow to recycle freed indexes, as was done by -// original implementation based on a vector -// This is not really needed when using a map, and -// really unique indexes might be better/safer? -if ( nIndex < nUniqIndex ) -nUniqIndex = nIndex; +// Allow to recycle freed indexes, as was done by +// original implementation based on a vector +// This is not really needed when using a map, and +// really unique indexes might be better/safer? +if ( nIndex < nUniqIndex ) +nUniqIndex = nIndex; -void* p = it->second; -maMap.erase( it ); -return p; -} +void* p = it->second; +maMap.erase( it ); +return p; } return nullptr; } void* UniqueIndexImpl::Get( Index nIndex ) const { -// check for valid index -if ( nIndex >= nStartIndex ) -{ -std::map<Index, void*>::const_iterator it = maMap.find( nIndex - nStartIndex ); -if( it != maMap.end() ) -return it->second; -} +std::map<Index, void*>::const_iterator it = maMap.find( nIndex ); +if ( it != maMap.end() ) +return it->second; return nullptr; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: tools/source
tools/source/memtools/unqidx.cxx | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) New commits: commit bc2e74f3c3093819c499921cf62615e9a8d7301c Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Mar 5 14:35:25 2016 +0100 Simplify recycling/search of freed UniqueIndex-es Change-Id: Icb8b375a95718a72abdd6650dda49fb9f43026a4 Reviewed-on: https://gerrit.libreoffice.org/22934 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index ecc6232..56a9f0a 100644 --- a/tools/source/memtools/unqidx.cxx +++ b/tools/source/memtools/unqidx.cxx @@ -25,14 +25,10 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p ) if ( !p ) return IndexNotFound; -const Index nTmp = static_cast(maMap.size()) + 1; - -// Avoid overflow of UniqIndex upon deletion -nUniqIndex = nUniqIndex % nTmp; - -// Search next empty index +// Search next unused index, may be needed after +// a removal followed by multiple insertions while ( maMap.find( nUniqIndex ) != maMap.end() ) -nUniqIndex = (nUniqIndex+1) % nTmp; +++nUniqIndex; maMap[ nUniqIndex ] = p; @@ -48,6 +44,13 @@ void* UniqueIndexImpl::Remove( Index nIndex ) std::map<Index, void*>::iterator it = maMap.find( nIndex - nStartIndex ); if( it != maMap.end() ) { +// Allow to recycle freed indexes, as was done by +// original implementation based on a vector +// This is not really needed when using a map, and +// really unique indexes might be better/safer? +if ( nIndex < nUniqIndex ) +nUniqIndex = nIndex; + void* p = it->second; maMap.erase( it ); return p; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 4 commits - include/tools tools/source
include/tools/unqidx.hxx |3 +-- tools/source/memtools/unqidx.cxx | 20 +--- 2 files changed, 6 insertions(+), 17 deletions(-) New commits: commit f04999cc84152ef9fc216d339da4b5fc2c52e256 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Mar 5 10:05:50 2016 +0100 Delete obsolete/unuseful comments Change-Id: Iadec409743e144a97c4468052dc0a04b91ca9619 diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index 7d7ac85..ecc6232 100644 --- a/tools/source/memtools/unqidx.cxx +++ b/tools/source/memtools/unqidx.cxx @@ -25,7 +25,6 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p ) if ( !p ) return IndexNotFound; - // Expend array if full const Index nTmp = static_cast(maMap.size()) + 1; // Avoid overflow of UniqIndex upon deletion @@ -35,7 +34,6 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p ) while ( maMap.find( nUniqIndex ) != maMap.end() ) nUniqIndex = (nUniqIndex+1) % nTmp; -// Insert object to array maMap[ nUniqIndex ] = p; nUniqIndex++; @@ -47,8 +45,6 @@ void* UniqueIndexImpl::Remove( Index nIndex ) // Check for valid index if ( nIndex >= nStartIndex ) { -// insert index as empty entry, and reduce indexcount, -// if this entry was used std::map<Index, void*>::iterator it = maMap.find( nIndex - nStartIndex ); if( it != maMap.end() ) { commit ae35981823114d51376bf86bf1db665db62482c3 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Mar 5 09:48:11 2016 +0100 Do not duplicate count of items Change-Id: I373b39f36fee7c37f2c10cc748f309412d68b688 diff --git a/include/tools/unqidx.hxx b/include/tools/unqidx.hxx index 190b8e1..b6d65b4 100644 --- a/include/tools/unqidx.hxx +++ b/include/tools/unqidx.hxx @@ -33,12 +33,11 @@ private: std::map<Index, void*> maMap; const Index nStartIndex; Index nUniqIndex; -Index nCount; public: UniqueIndexImpl( Index _nStartIndex = 0 ) : maMap(), - nStartIndex(_nStartIndex), nUniqIndex(_nStartIndex), nCount(0) {} + nStartIndex(_nStartIndex), nUniqIndex(_nStartIndex) {} Index Insert( void* p ); // insert value with key, replacing existing entry if necessary diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index ea3b773..7d7ac85 100644 --- a/tools/source/memtools/unqidx.cxx +++ b/tools/source/memtools/unqidx.cxx @@ -26,9 +26,7 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p ) return IndexNotFound; // Expend array if full -Index nTmp = static_cast(maMap.size()); -if( nTmp == nCount ) -nTmp++; +const Index nTmp = static_cast(maMap.size()) + 1; // Avoid overflow of UniqIndex upon deletion nUniqIndex = nUniqIndex % nTmp; @@ -40,7 +38,6 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p ) // Insert object to array maMap[ nUniqIndex ] = p; -nCount++; nUniqIndex++; return ( nUniqIndex + nStartIndex - 1 ); } @@ -57,7 +54,6 @@ void* UniqueIndexImpl::Remove( Index nIndex ) { void* p = it->second; maMap.erase( it ); -nCount--; return p; } } commit 9f7f577df3bc056c77d63aafa26e4d21c53af0aa Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Fri Mar 4 23:19:09 2016 +0100 Let find fail, instead of using a dubious upper bound check Change-Id: I874ef402d241aa4de02057ca9dc747ae0497b1e0 diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index 3d60fb8..ea3b773 100644 --- a/tools/source/memtools/unqidx.cxx +++ b/tools/source/memtools/unqidx.cxx @@ -48,8 +48,7 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p ) void* UniqueIndexImpl::Remove( Index nIndex ) { // Check for valid index -if ( (nIndex >= nStartIndex) && - (nIndex < (maMap.size() + nStartIndex)) ) +if ( nIndex >= nStartIndex ) { // insert index as empty entry, and reduce indexcount, // if this entry was used @@ -68,8 +67,7 @@ void* UniqueIndexImpl::Remove( Index nIndex ) void* UniqueIndexImpl::Get( Index nIndex ) const { // check for valid index -if ( (nIndex >= nStartIndex) && - (nIndex < (maMap.size() + nStartIndex)) ) +if ( nIndex >= nStartIndex ) { std::map<Index, void*>::const_iterator it = maMap.find( nIndex - nStartIndex ); if( it != maMap.end() ) commit 1d4914e9e5cad4f443a742a34862620143176dbc Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Fri Mar 4 23:10:50 2016 +0100 Use Index consistently Change-Id: I20b7c1bd2e21967c4edab37a94c971aa8a8d diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx index 4bd05bb..3d60fb8 100644 --- a/tool
[Libreoffice-commits] core.git: include/tools
include/tools/unqidx.hxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit ad0aec407d09711f58acbacbf6296ca53b760725 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Mar 2 08:30:10 2016 +0100 Fix error C2057: expected constant expression Change-Id: Ie345ede60c1204c38a1c157c6335e3ded81fc26f diff --git a/include/tools/unqidx.hxx b/include/tools/unqidx.hxx index dd66c300..8e979bf 100644 --- a/include/tools/unqidx.hxx +++ b/include/tools/unqidx.hxx @@ -19,8 +19,8 @@ #ifndef INCLUDED_TOOLS_UNQIDX_HXX #define INCLUDED_TOOLS_UNQIDX_HXX +#include #include -#include #include class SAL_WARN_UNUSED TOOLS_DLLPUBLIC UniqueIndexImpl @@ -28,7 +28,7 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC UniqueIndexImpl public: typedef sal_uInt32 Index; enum { -IndexNotFound = std::numeric_limits::max() +IndexNotFound = SAL_MAX_UINT32 }; private: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 3 commits - include/tools rsc/inc rsc/source tools/source
include/tools/pstm.hxx | 16 +++- include/tools/unqidx.hxx | 49 +-- rsc/inc/rscdb.hxx|6 ++-- rsc/inc/rscdef.hxx | 27 +++-- rsc/source/parser/rscdb.cxx | 24 +-- rsc/source/parser/rsclex.cxx |2 - rsc/source/parser/rscyacc.y |1 rsc/source/rsc/rsc.cxx | 26 ++-- rsc/source/tools/rscdef.cxx | 49 ++- tools/source/memtools/unqidx.cxx | 36 ++-- tools/source/ref/pstm.cxx| 14 +-- 11 files changed, 130 insertions(+), 120 deletions(-) New commits: commit 0d34f4ac9b17348d7956285c6cefb28bea2537b6 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Mar 1 23:37:07 2016 +0100 Data member nStartIndex can be const Change-Id: I94a3bdd01186061fbd95b62494c24a50f0c4866d diff --git a/include/tools/unqidx.hxx b/include/tools/unqidx.hxx index c783151..dd66c300 100644 --- a/include/tools/unqidx.hxx +++ b/include/tools/unqidx.hxx @@ -33,7 +33,7 @@ public: private: std::map<Index, void*> maMap; -Index nStartIndex; +const Index nStartIndex; Index nUniqIndex; Index nCount; commit f00967cf38ed0c2c197284391fc521825bb3c2ac Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Mar 1 23:21:02 2016 +0100 sal_uIntPtr/sal_uLong to Index (aka sal_uInt32) in UniqueIndex Change-Id: I212cb3bb9d920741629fc4564bbd28b393e8fe00 diff --git a/include/tools/pstm.hxx b/include/tools/pstm.hxx index 92b5349..ab75416 100644 --- a/include/tools/pstm.hxx +++ b/include/tools/pstm.hxx @@ -91,8 +91,6 @@ public: SvPersistBase *& rpObj ); }; -typedef std::map<SvPersistBase*, sal_uIntPtr> PersistBaseMap; - class SvStream; /** Persistent Stream @@ -130,12 +128,18 @@ class SvStream; */ class TOOLS_DLLPUBLIC SvPersistStream : public SvStream { +public: +typedef UniqueIndex::Index Index; + +private: +typedef std::map<SvPersistBase*, Index> PersistBaseMap; + SvClassManager &rClassMgr; SvStream * pStm; PersistBaseMap aPTable; // reversed pointer and key UniqueIndex aPUIdx; -sal_uIntPtr nStartIdx; +Index nStartIdx; const SvPersistStream * pRefStm; virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ) override; @@ -151,13 +155,13 @@ public: virtual voidResetError() override; SvPersistStream( SvClassManager &, SvStream * pStream, - sal_uInt32 nStartIdx = 1 ); + Index nStartIdx = 1 ); virtual ~SvPersistStream(); voidSetStream( SvStream * pStream ); -SvPersistBase * GetObject( sal_uIntPtr nIdx ) const; -sal_uIntPtr GetIndex( SvPersistBase * ) const; +SvPersistBase * GetObject( Index nIdx ) const; +Index GetIndex( SvPersistBase * ) const; static void WriteCompressed( SvStream & rStm, sal_uInt32 nVal ); static sal_uInt32 ReadCompressed( SvStream & rStm ); diff --git a/include/tools/unqidx.hxx b/include/tools/unqidx.hxx index 03a30c6..c783151 100644 --- a/include/tools/unqidx.hxx +++ b/include/tools/unqidx.hxx @@ -20,45 +20,52 @@ #define INCLUDED_TOOLS_UNQIDX_HXX #include -#include +#include #include -#define UNIQUEINDEX_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND - class SAL_WARN_UNUSED TOOLS_DLLPUBLIC UniqueIndexImpl { +public: +typedef sal_uInt32 Index; +enum { +IndexNotFound = std::numeric_limits::max() +}; + private: -std::map<sal_uInt32, void*> maMap; -sal_uIntPtr nStartIndex; -sal_uIntPtr nUniqIndex; -sal_uIntPtr nCount; +std::map<Index, void*> maMap; +Index nStartIndex; +Index nUniqIndex; +Index nCount; public: -UniqueIndexImpl( sal_uIntPtr _nStartIndex = 0 ) +UniqueIndexImpl( Index _nStartIndex = 0 ) : maMap(), nStartIndex(_nStartIndex), nUniqIndex(_nStartIndex), nCount(0) {} -sal_uIntPtr Insert( void* p ); +Index Insert( void* p ); // insert value with key, replacing existing entry if necessary -void* Remove( sal_uIntPtr aIndex ); -void* Get( sal_uIntPtr aIndex ) const; +void* Remove( Index aIndex ); +void* Get( Index aIndex ) const; -sal_uIntPtr GetIndexOf( void* p ) const; -sal_uIntPtr FirstIndex() const; -sal_uIntPtr LastIndex() const; -sal_uIntPtr NextIndex( sal_uIntPtr aCurrIndex ) const; +Index GetIndexOf( void* p ) const; +Index FirstIndex() const; +Index LastIndex() const; +Index NextIndex( Index aCurrIndex ) const; }; template class Uniq
[Libreoffice-commits] core.git: 5 commits - include/vcl vcl/inc vcl/osx vcl/source vcl/unx vcl/win
include/vcl/print.hxx |2 - vcl/inc/osx/salprn.h|4 +- vcl/inc/salprn.hxx |8 +++- vcl/inc/salptype.hxx| 33 +--- vcl/inc/unx/genprn.h| 14 vcl/inc/unx/gtk/gtkprn.hxx |2 - vcl/inc/win/salprn.h|4 +- vcl/osx/salprn.cxx | 12 +++ vcl/source/gdi/print.cxx| 12 +++ vcl/source/gdi/print3.cxx | 11 ++ vcl/unx/generic/print/genprnpsp.cxx | 30 +- vcl/unx/gtk/salprn-gtk.cxx |2 - vcl/win/gdi/salprn.cxx | 58 +--- 13 files changed, 99 insertions(+), 93 deletions(-) New commits: commit bddca7fbcc64814860f331b464b61727f5569709 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Jan 10 16:09:41 2016 +0100 sal_uLong to DWORD/sal_Size in vcl/win/gdi/salprn.cxx Change-Id: I11c5547966a3b97562ecbbc91f32724fc190e5a7 diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index ef624c2..dbe8533 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -370,7 +370,6 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS LONGnRet; HWNDhWnd = 0; DWORD nMode = DM_OUT_BUFFER; -sal_uLong nDriverDataLen = 0; SalDriverData* pOutBuffer = NULL; BYTE* pInBuffer = NULL; @@ -384,7 +383,7 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } // make Outputbuffer -nDriverDataLen = sizeof(SalDriverData) + nSysJobSize-1; +const sal_Size nDriverDataLen = sizeof(SalDriverData) + nSysJobSize-1; pOutBuffer = (SalDriverData*)rtl_allocateZeroMemory( nDriverDataLen ); pOutBuffer->mnSysSignature = SAL_DRIVERDATA_SYSSIGN; // calculate driver data offset including structure padding @@ -476,7 +475,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS // PaperBin if ( nFlags & JobSetFlags::PAPERBIN ) { -sal_uLong nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); +const DWORD nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); if ( nCount && (nCount != GDI_ERROR) ) { @@ -485,7 +484,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS pSetupData->mnPaperBin = 0; // search the right bin and assign index to mnPaperBin -for( sal_uLong i = 0; i < nCount; i++ ) +for( DWORD i = 0; i < nCount; ++i ) { if( CHOOSE_DEVMODE(dmDefaultSource) == pBins[ i ] ) { @@ -508,9 +507,9 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } else { -sal_uLong nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); +const DWORD nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); WORD* pPapers = NULL; -sal_uLong nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); +const DWORD nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); POINT* pPaperSizes = NULL; if ( nPaperCount && (nPaperCount != GDI_ERROR) ) { @@ -524,7 +523,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } if( nPaperSizeCount == nPaperCount && pPaperSizes && pPapers ) { -for( sal_uLong i = 0; i < nPaperCount; i++ ) +for( DWORD i = 0; i < nPaperCount; ++i ) { if( pPapers[ i ] == CHOOSE_DEVMODE(dmPaperSize) ) { @@ -743,7 +742,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS // PaperBin if ( nFlags & JobSetFlags::PAPERBIN ) { -sal_uLong nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); +const DWORD nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); if ( nCount && (nCount != GDI_ERROR) ) { @@ -921,9 +920,9 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS default: { short nPaper = 0; -sal_uLong nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); +const DWORD nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); WORD* pPapers = NULL; -sal_uLong nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); +const DWORD nPa
[Libreoffice-commits] core.git: vcl/inc vcl/osx
vcl/inc/osx/salprn.h |2 +- vcl/osx/salprn.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit fc388c1ff4ba005bbf784a083825f2070e66325e Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Jan 26 22:13:40 2016 +0100 Blind fix for OSX Change-Id: Ieafe8df5d67299615e279151b29744ddd180 diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h index afb0cb7..94340f3 100644 --- a/vcl/inc/osx/salprn.h +++ b/vcl/inc/osx/salprn.h @@ -125,7 +125,7 @@ class AquaSalPrinter : public SalPrinter virtual boolStartJob( const OUString* i_pFileName, const OUString& i_rJobName, const OUString& i_rAppName, - sal_uLong i_nCopies, + sal_uInt32 i_nCopies, bool i_bCollate, bool i_bDirect, ImplJobSetup* i_pSetupData ) override; diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index ca9bec2..54e3e8f 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -590,7 +590,7 @@ bool AquaSalPrinter::StartJob( const OUString* i_pFileName, bool AquaSalPrinter::StartJob( const OUString* /*i_pFileName*/, const OUString& /*i_rJobName*/, const OUString& /*i_rAppName*/, - sal_uLong /*i_nCopies*/, + sal_uInt32 /*i_nCopies*/, bool /*i_bCollate*/, bool /*i_bDirect*/, ImplJobSetup* ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/win
vcl/win/gdi/salprn.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ccd681dabd75b14feaf410640cddc20862316cb3 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Jan 26 22:23:51 2016 +0100 Blind fix for Windows Change-Id: Icd28c3126eb764187788f3726bfa3a5db54ba7e6 diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index dbe8533..ae2d923 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -722,7 +722,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } } -static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, sal_uLong nFlags ) +static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, JobSetFlags nFlags ) { if ( !pSetupData || !pSetupData->mpDriverData ) return; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 15 commits - basctl/source basic/source desktop/source editeng/source include/vcl sc/inc sc/source sd/source sfx2/source svx/source sw/source vcl/generic vcl/headless v
basctl/source/basicide/basidesh.cxx|2 basic/source/classes/sb.cxx|2 basic/source/classes/sbxmod.cxx|6 basic/source/runtime/methods1.cxx |2 basic/source/runtime/stdobj.cxx|2 basic/source/sbx/sbxcoll.cxx |2 basic/source/sbx/sbxobj.cxx|2 desktop/source/deployment/gui/license_dialog.cxx |2 editeng/source/editeng/impedit5.cxx|2 include/vcl/jobdata.hxx|4 sc/inc/brdcst.hxx |2 sc/inc/column.hxx |2 sc/inc/document.hxx|4 sc/inc/global.hxx |3 sc/inc/zforauto.hxx| 20 +- sc/source/core/data/bcaslot.cxx|6 sc/source/core/data/column3.cxx|2 sc/source/core/data/documen7.cxx |4 sc/source/core/data/dputil.cxx |2 sc/source/core/data/formulacell.cxx|8 - sc/source/core/data/global.cxx |8 - sc/source/core/inc/bcaslot.hxx |6 sc/source/core/tool/brdcst.cxx |2 sc/source/core/tool/dbdata.cxx |3 sc/source/core/tool/zforauto.cxx | 36 ++-- sc/source/filter/lotus/tool.cxx|2 sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx |2 sc/source/ui/Accessibility/AccessiblePreviewTable.cxx |4 sc/source/ui/Accessibility/AccessibleText.cxx | 104 - sc/source/ui/app/inputwin.cxx |2 sc/source/ui/app/scmod.cxx | 10 - sc/source/ui/docshell/docsh.cxx|3 sc/source/ui/docshell/servobj.cxx |3 sc/source/ui/miscdlgs/autofmt.cxx |2 sc/source/ui/navipi/navipi.cxx |2 sc/source/ui/unoobj/cellsuno.cxx | 10 - sc/source/ui/unoobj/chart2uno.cxx |2 sc/source/ui/unoobj/datauno.cxx|8 - sc/source/ui/unoobj/docuno.cxx |2 sc/source/ui/unoobj/editsrc.cxx|2 sc/source/ui/unoobj/textuno.cxx|2 sc/source/ui/view/prevwsh2.cxx |3 sc/source/ui/view/tabvwsh5.cxx |2 sd/source/core/stlsheet.cxx|5 sd/source/ui/tools/PreviewRenderer.cxx |5 sd/source/ui/view/DocumentRenderer.cxx |7 sfx2/source/dialog/templdlg.cxx|2 svx/source/svdraw/svdoedge.cxx |2 sw/source/core/layout/frmtool.cxx |2 sw/source/core/unocore/unostyle.cxx|3 sw/source/filter/html/htmlfld.cxx |2 sw/source/filter/ww8/ww8par5.cxx |2 sw/source/uibase/app/apphdl.cxx| 19 +- sw/source/uibase/docvw/srcedtw.cxx | 26 +-- sw/source/uibase/shells/textsh1.cxx|2 sw/source/uibase/utlui/numfmtlb.cxx| 21 +- vcl/generic/print/genprnpsp.cxx|4 vcl/headless/svpprn.cxx|2 vcl/inc/jobset.h |2 vcl/source/edit/vclmedit.cxx | 41 ++--- vcl/source/fontsubset/gsub.cxx | 11 - vcl/unx/generic/printer/jobdata.cxx|9 - 62 files changed, 216 insertions(+), 250 deletions(-) New commits: commit e7d920da4465fd8de8b8a9f87a3589054eac73de Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Dec 22 22:57:02 2015 +0100 sal_uLong to sal_uInt32, ScHint related Change-Id: I84402bf4b8d69ae350f6449cf4d1fd7c5c325f3c diff --git a/sc/inc/brdcst.hxx b/sc/inc/brdcst.hxx index 5dfdb8f..606541b 100644 --- a/sc/inc/brdcst.hxx +++ b/sc/inc/brdcst.hxx @@ -31,7 +31,7 @@ class ScHint : public SfxSimpleHint ScAddress aAddress; public: -ScHint( sal_uLong n, const ScAddress& a ); +ScHint( sal_uInt32 n, const ScAddress& a ); const ScAddress&GetAddress() const { return aAddress; } ScAddr
[Libreoffice-commits] core.git: 3 commits - include/svx reportdesign/source sd/source sfx2/source svx/source
include/svx/xdash.hxx | 22 ++--- reportdesign/source/ui/report/ReportController.cxx |1 sd/source/core/drawdoc4.cxx|1 sfx2/source/dialog/styfitem.cxx| 15 ++ svx/source/xoutdev/xattr.cxx |6 ++--- 5 files changed, 21 insertions(+), 24 deletions(-) New commits: commit 86043a2f57a9f50cabe689dd5e9f8db0dbd16f80 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Nov 8 19:45:45 2015 +0100 Remove unused XDash variables Change-Id: Ibc40a0f8b422aebeeb1df5a6701dee4be134862b diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 6126c03..3235aa6 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -2403,7 +2403,6 @@ void OReportController::openPageDialog(const uno::Reference& _ const Graphic aNullGraphic; const ::Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color const ::Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color -const XDash aNullDash; const XGradient aNullGrad(RGB_Color(COL_BLACK), RGB_Color(COL_WHITE)); const XHatch aNullHatch(aNullLineCol); diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index a18ad19..0007165 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -552,7 +552,6 @@ void SdDrawDocument::CreateDefaultCellStyles() ColoraNullCol(RGB_Color(COL_BLACK)); -XDash aNullDash; XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE)); aNullGrad.SetStartIntens( 100 ); aNullGrad.SetEndIntens( 100 ); commit a847127fc32c2c611a7c2cc281e1ce7b27bb7754 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Nov 8 19:41:42 2015 +0100 XDash: salu_uIntPtr to sal_uInt32 Unsigned integer was used tp be consistent with previous integral type, but both unsigned and signed integers are used by callers. Change-Id: I3f902e00fbff690a72a7ca0f1c818976d3d2bebe diff --git a/include/svx/xdash.hxx b/include/svx/xdash.hxx index 4b0ef84..f7e20e9 100644 --- a/include/svx/xdash.hxx +++ b/include/svx/xdash.hxx @@ -35,31 +35,31 @@ class SVX_DLLPUBLIC XDash protected: css::drawing::DashStyle eDash; sal_uInt16 nDots; -sal_uIntPtr nDotLen; +sal_uInt32 nDotLen; sal_uInt16 nDashes; -sal_uIntPtr nDashLen; -sal_uIntPtr nDistance; +sal_uInt32 nDashLen; +sal_uInt32 nDistance; public: XDash(css::drawing::DashStyle eDash = css::drawing::DashStyle_RECT, -sal_uInt16 nDots = 1, sal_uIntPtr nDotLen = 20, -sal_uInt16 nDashes = 1, sal_uIntPtr nDashLen = 20, sal_uIntPtr nDistance = 20); +sal_uInt16 nDots = 1, sal_uInt32 nDotLen = 20, +sal_uInt16 nDashes = 1, sal_uInt32 nDashLen = 20, sal_uInt32 nDistance = 20); bool operator==(const XDash& rDash) const; void SetDashStyle(css::drawing::DashStyle eNewStyle) { eDash = eNewStyle; } void SetDots(sal_uInt16 nNewDots){ nDots = nNewDots; } -void SetDotLen(sal_uIntPtr nNewDotLen) { nDotLen = nNewDotLen; } +void SetDotLen(sal_uInt32 nNewDotLen){ nDotLen = nNewDotLen; } void SetDashes(sal_uInt16 nNewDashes){ nDashes = nNewDashes; } -void SetDashLen(sal_uIntPtr nNewDashLen) { nDashLen = nNewDashLen; } -void SetDistance(sal_uIntPtr nNewDistance) { nDistance = nNewDistance; } +void SetDashLen(sal_uInt32 nNewDashLen) { nDashLen = nNewDashLen; } +void SetDistance(sal_uInt32 nNewDistance){ nDistance = nNewDistance; } css::drawing::DashStyle GetDashStyle() const{ return eDash; } sal_uInt16 GetDots() const { return nDots; } -sal_uIntPtr GetDotLen() const { return nDotLen; } +sal_uInt32 GetDotLen() const { return nDotLen; } sal_uInt16 GetDashes() const { return nDashes; } -sal_uIntPtr GetDashLen() const { return nDashLen; } -sal_uIntPtr GetDistance() const { return nDistance; } +sal_uInt32 GetDashLen() const { return nDashLen; } +sal_uInt32 GetDistance() const { return nDistance; } // XDash is translated into an array of doubles which describe the lengths of the // dashes, dots and empty passages. It returns the complete length of the full DashDot diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 5d0
[Libreoffice-commits] core.git: 8 commits - chart2/source cppcanvas/source drawinglayer/source filter/source include/drawinglayer include/oox include/svx include/tools svx/inc svx/source tools/inc too
chart2/source/inc/CommonConverters.hxx|1 cppcanvas/source/mtfrenderer/textaction.hxx |1 drawinglayer/source/primitive2d/textlayoutdevice.cxx |1 filter/source/flash/swfwriter.hxx |7 + include/drawinglayer/primitive2d/textlayoutdevice.hxx |2 include/oox/export/drawingml.hxx |5 - include/svx/sdggaitm.hxx |2 include/tools/poly.hxx| 31 ++- svx/inc/svdibrow.hxx | 10 +- svx/source/svdraw/svdibrow.cxx| 77 -- tools/inc/poly.h |4 tools/source/generic/poly.cxx | 51 +-- tools/source/generic/poly2.cxx| 31 +++ vcl/inc/openglgdiimpl.hxx |7 + vcl/inc/regband.hxx |2 vcl/source/gdi/impvect.hxx|3 vcl/source/gdi/region.cxx |1 17 files changed, 114 insertions(+), 122 deletions(-) New commits: commit 13d927267535c0dca3139a50ebf8d5bcfc0df484 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Thu Nov 5 18:58:49 2015 +0100 (Poly)Polygons: sal_uIntPtr to sal_uInt32/sdt::size_t/enum Change-Id: I167d656f419ddbeb72960b8510fb8084605d4d5c diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index 33cfb5d..0471a68 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -89,7 +89,7 @@ public: const sal_uInt8* pFlagAry = NULL ); Polygon( const Rectangle& rRect ); Polygon( const Rectangle& rRect, - sal_uIntPtr nHorzRound, sal_uIntPtr nVertRound ); + sal_uInt32 nHorzRound, sal_uInt32 nVertRound ); Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoints = 0 ); @@ -190,7 +190,13 @@ class TOOLS_DLLPUBLIC SAL_WARN_UNUSED PolyPolygon private: ImplPolyPolygon*mpImplPolyPolygon; -TOOLS_DLLPRIVATE void ImplDoOperation( const tools::PolyPolygon& rPolyPoly, tools::PolyPolygon& rResult, sal_uIntPtr nOperation ) const; +enum class PolyClipOp { +INTERSECT, +UNION, +DIFF, +XOR +}; +TOOLS_DLLPRIVATE void ImplDoOperation( const tools::PolyPolygon& rPolyPoly, tools::PolyPolygon& rResult, PolyClipOp nOperation ) const; public: PolyPolygon( sal_uInt16 nInitSize = 16, sal_uInt16 nResize = 16 ); diff --git a/tools/inc/poly.h b/tools/inc/poly.h index 7805873..f15f01f 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -29,7 +29,7 @@ public: Point* mpPointAry; sal_uInt8* mpFlagAry; sal_uInt16 mnPoints; -sal_uIntPtr mnRefCount; +sal_uInt32 mnRefCount; }; class SAL_WARN_UNUSED ImplPolygon : public ImplPolygonData @@ -55,7 +55,7 @@ class SAL_WARN_UNUSED ImplPolyPolygon { public: tools::Polygon** mpPolyAry; -sal_uIntPtr mnRefCount; +sal_uInt32 mnRefCount; sal_uInt16 mnCount; sal_uInt16 mnSize; sal_uInt16 mnResize; diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 539178c..0788894 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -62,8 +62,9 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, bool bFlags ) { if ( nInitSize ) { -mpPointAry = reinterpret_cast<Point*>(new char[(sal_uIntPtr)nInitSize*sizeof(Point)]); -memset( mpPointAry, 0, (sal_uIntPtr)nInitSize*sizeof(Point) ); +const std::size_t nSz(static_cast(nInitSize)*sizeof(Point)); +mpPointAry = reinterpret_cast<Point*>(new char[nSz]); +memset( mpPointAry, 0, nSz ); } else mpPointAry = NULL; @@ -84,8 +85,9 @@ ImplPolygon::ImplPolygon( const ImplPolygon& rImpPoly ) { if ( rImpPoly.mnPoints ) { -mpPointAry = reinterpret_cast<Point*>(new char[(sal_uIntPtr)rImpPoly.mnPoints*sizeof(Point)]); -memcpy( mpPointAry, rImpPoly.mpPointAry, (sal_uIntPtr)rImpPoly.mnPoints*sizeof(Point) ); +const std::size_t nSz(static_cast(rImpPoly.mnPoints)*sizeof(Point)); +mpPointAry = reinterpret_cast<Point*>(new char[nSz]); +memcpy( mpPointAry, rImpPoly.mpPointAry, nSz ); if( rImpPoly.mpFlagAry ) { @@ -109,8 +111,9 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, const Point* pInitAry, const sal { if ( nInitSize ) { -mpPointAry = reinterpret_cast<Point*>(new char[(sal_uIntPtr)nInitSize*sizeof(Point)]); -
[Libreoffice-commits] core.git: 5 commits - include/tools tools/source
include/tools/date.hxx |6 - tools/source/datetime/datetime.cxx | 10 +- tools/source/datetime/tdate.cxx| 158 +++-- 3 files changed, 57 insertions(+), 117 deletions(-) New commits: commit b75bc4b5de529f27fe56beb2d86f907411fa1e17 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Oct 28 12:33:53 2015 +0100 Date: avoid temporary conversions to sal_uIntPtr Change-Id: Ib52c5d1a55d17c572fd5be9a3ce36c6de7965220 diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index c27f1d0..808ac48 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -133,7 +133,7 @@ static Date lcl_DaysToDate( long nDays ) while ( bCalc ); sal_uInt16 nMonth = 1; -while ( (sal_uIntPtr)nTempDays > ImplDaysInMonth( nMonth, nYear ) ) +while ( nTempDays > static_cast(ImplDaysInMonth( nMonth, nYear )) ) { nTempDays -= ImplDaysInMonth( nMonth, nYear ); nMonth++; @@ -191,7 +191,7 @@ void Date::SetYear( sal_uInt16 nNewYear ) DayOfWeek Date::GetDayOfWeek() const { -return (DayOfWeek)((sal_uIntPtr)(GetAsNormalizedDays()-1) % 7); +return static_cast((GetAsNormalizedDays()-1) % 7); } sal_uInt16 Date::GetDayOfYear() const @@ -467,10 +467,7 @@ Date operator -( const Date& rDate, long nDays ) long operator -( const Date& rDate1, const Date& rDate2 ) { -sal_uIntPtr nTempDays1 = rDate1.GetAsNormalizedDays(); -sal_uIntPtr nTempDays2 = rDate2.GetAsNormalizedDays(); - -return nTempDays1 - nTempDays2; +return rDate1.GetAsNormalizedDays() - rDate2.GetAsNormalizedDays(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 1d927b23dfeef3cdc270c6c94e81e08180dabe76 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Oct 28 12:23:23 2015 +0100 Date: group common code Change-Id: I4d1bf6591d54621c33dc2ff0be0ecb59f1839581 diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 811a0fd..c27f1d0 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -95,18 +95,23 @@ long Date::DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear ) return nDays; } -static void DaysToDate( long nDays, -sal_uInt16& rDay, sal_uInt16& rMonth, sal_uInt16& rYear ) +static Date lcl_DaysToDate( long nDays ) { +if ( nDays >= MAX_DAYS ) +return Date( 31, 12, ); + +if ( nDays <= 0 ) +return Date( 1, 0, 0 ); + longnTempDays; longi = 0; boolbCalc; +sal_uInt16 nYear; do { -nTempDays = (long)nDays; -rYear = (sal_uInt16)((nTempDays / 365) - i); -nTempDays -= ImpYearToDays(rYear); +nYear = (sal_uInt16)((nDays / 365) - i); +nTempDays = nDays - ImpYearToDays(nYear); bCalc = false; if ( nTempDays < 1 ) { @@ -117,7 +122,7 @@ static void DaysToDate( long nDays, { if ( nTempDays > 365 ) { -if ( (nTempDays != 366) || !ImpIsLeapYear( rYear ) ) +if ( (nTempDays != 366) || !ImpIsLeapYear( nYear ) ) { i--; bCalc = true; @@ -127,13 +132,14 @@ static void DaysToDate( long nDays, } while ( bCalc ); -rMonth = 1; -while ( (sal_uIntPtr)nTempDays > ImplDaysInMonth( rMonth, rYear ) ) +sal_uInt16 nMonth = 1; +while ( (sal_uIntPtr)nTempDays > ImplDaysInMonth( nMonth, nYear ) ) { -nTempDays -= ImplDaysInMonth( rMonth, rYear ); -rMonth++; +nTempDays -= ImplDaysInMonth( nMonth, nYear ); +nMonth++; } -rDay = (sal_uInt16)nTempDays; + +return Date( static_cast(nTempDays), nMonth, nYear ); } Date::Date( DateInitSystem ) @@ -278,11 +284,7 @@ sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay, long nTempDays = GetAsNormalizedDays(); nTempDays += 6 - (GetDayOfWeek()+(7-(short)eStartDay)) % 7; -sal_uInt16 nDay; -sal_uInt16 nMonth; -sal_uInt16 nYear; -DaysToDate( nTempDays, nDay, nMonth, nYear ); -nWeek = Date( nDay, nMonth, nYear ).GetWeekOfYear( eStartDay, nMinimumNumberOfDaysInWeek ); +nWeek = lcl_DaysToDate( nTempDays ).GetWeekOfYear( eStartDay, nMinimumNumberOfDaysInWeek ); } } } @@ -409,84 +411,29 @@ bool Date::Normalize( sal_uInt16 & rDay, sal_uInt16 & rMonth, sal_uInt16 & rYear Date& Date::operator +=( long nDays ) { -sal_uInt16 nDay; -sal_uInt16 nMonth; -sal_uInt16 nYear; - -if (nDays == 0) -return *this; - -long nTempDays = GetAsNormalizedDays(); - -nTempDays += nDays; -if ( nTempDays > MAX_DAYS ) -setDateFromDMY( 31, 12, );
[Libreoffice-commits] core.git: 12 commits - connectivity/source dbaccess/source extensions/source filter/source framework/inc idl/inc idl/source include/editeng include/filter include/framework inclu
|1 sot/source/sdstor/stg.cxx | 16 +-- sot/source/sdstor/stgcache.cxx|2 sot/source/sdstor/stgcache.hxx|6 - sot/source/sdstor/stgio.cxx |6 - sot/source/sdstor/stgstrms.hxx|6 - sot/source/sdstor/storage.cxx |2 sot/source/sdstor/ucbstorage.cxx | 16 +-- svl/source/inc/strmadpt.hxx |1 svl/source/items/lckbitem.cxx |1 svtools/source/svhtml/HtmlWriter.cxx |1 svx/source/gallery2/galtheme.cxx |4 svx/source/tbxctrls/Palette.cxx |1 svx/source/xoutdev/xexch.cxx |1 sw/source/core/edit/edglss.cxx|5 - sw/source/core/inc/swfont.hxx |1 sw/source/core/unocore/unoobj.cxx | 22 ++-- sw/source/filter/html/htmlplug.cxx|3 sw/source/filter/html/wrthtml.hxx |1 sw/source/filter/ww8/WW8Sttbf.cxx |1 sw/source/filter/ww8/WW8Sttbf.hxx |3 sw/source/filter/ww8/ww8scan.cxx |2 sw/source/filter/ww8/ww8scan.hxx |3 test/source/xmlwriter.cxx |1 tools/qa/cppunit/test_urlobj.cxx | 12 +- tools/source/stream/stream.cxx|2 vcl/source/filter/graphicfilter.cxx |3 vcl/source/gdi/gfxlink.cxx|1 vcl/source/gdi/graphictools.cxx |1 vcl/source/gdi/pdfwriter_impl.hxx |3 vcl/source/gdi/pdfwriter_impl2.cxx|1 109 files changed, 275 insertions(+), 206 deletions(-) New commits: commit 20635ed90b2f684757c480b3cff70547a0e06363 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Oct 11 18:21:11 2015 +0200 Reduce scope of #include Change-Id: I0752cbb0cb2e0f89607d81d9eda7ce7091449fd6 diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index edbbf5c..da67032 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -22,6 +22,7 @@ #include #include "dbase/DIndex.hxx" #include +#include #include #include diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx index e4bc122..17e713e 100644 --- a/connectivity/source/inc/dbase/dindexnode.hxx +++ b/connectivity/source/inc/dbase/dindexnode.hxx @@ -23,12 +23,13 @@ #include "file/FTable.hxx" #include #include -#include #include #define NODE_NOTFOUND 0x #define DINDEX_PAGE_SIZE 512 +class SvStream; + namespace connectivity { namespace dbase diff --git a/dbaccess/source/ui/inc/HtmlReader.hxx b/dbaccess/source/ui/inc/HtmlReader.hxx index 78368ce..9c5ca32 100644 --- a/dbaccess/source/ui/inc/HtmlReader.hxx +++ b/dbaccess/source/ui/inc/HtmlReader.hxx @@ -22,10 +22,11 @@ #include "DExport.hxx" #include #include -#include #include #include +class SvStream; + namespace dbaui { class OHTMLReader : public HTMLParser, public ODatabaseExport diff --git a/dbaccess/source/ui/inc/RtfReader.hxx b/dbaccess/source/ui/inc/RtfReader.hxx index f0da719..fe8a02e 100644 --- a/dbaccess/source/ui/inc/RtfReader.hxx +++ b/dbaccess/source/ui/inc/RtfReader.hxx @@ -22,7 +22,8 @@ #include #include #include "DExport.hxx" -#include + +class SvStream; namespace dbaui { diff --git a/dbaccess/source/ui/inc/TableRow.hxx b/dbaccess/source/ui/inc/TableRow.hxx index 9d18818..fa57cf0 100644 --- a/dbaccess/source/ui/inc/TableRow.hxx +++ b/dbaccess/source/ui/inc/TableRow.hxx @@ -19,10 +19,10 @@ #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROW_HXX #define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROW_HXX -#include #include #include "TypeInfo.hxx" +class SvStream; namespace dbaui { diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx index 91fc0c8..da97dfa 100644 --- a/dbaccess/source/ui/inc/TokenWriter.hxx +++ b/dbaccess/source/ui/inc/TokenWriter.hxx @@ -35,7 +35,6 @@ #include #include -#include #include namespace com { namespace sun { namespace star { @@ -44,6 +43,8 @@ namespace com { namespace sun { namespace star { } }}} +class SvStream; + namespace dbaui { // ODatabaseImportExport base class for import/export diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx index 4cc93a2..7d11395 100644 --- a/dbaccess/source/ui/misc/HtmlReader.cxx +++ b/dbaccess/source/ui/misc/HtmlReader.cxx @@ -
[Libreoffice-commits] core.git: sot/source
sot/source/sdstor/stgstrms.cxx | 22 ++ sot/source/sdstor/stgstrms.hxx |2 +- 2 files changed, 11 insertions(+), 13 deletions(-) New commits: commit 51bc0594f2d65630cf167a107f3be3f79993e6d9 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Oct 27 18:25:07 2015 +0100 sal_uLong to sal_uInt64/sal_Size Change-Id: I4032b08225f1b530a43f1a8c09c5fc3515f45ced diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index f21bc25..4367fc7 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -,7 +,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n ) #define THRESHOLD 32768L -StgTmpStrm::StgTmpStrm( sal_uLong nInitSize ) +StgTmpStrm::StgTmpStrm( sal_uInt64 nInitSize ) : SvMemoryStream( nInitSize > THRESHOLD ? 16 : ( nInitSize ? nInitSize : 16 ), 4096 ) @@ -1125,8 +1125,8 @@ StgTmpStrm::StgTmpStrm( sal_uLong nInitSize ) bool StgTmpStrm::Copy( StgTmpStrm& rSrc ) { -sal_uLong n= rSrc.GetSize(); -sal_uLong nCur = rSrc.Tell(); +sal_uInt64 n = rSrc.GetSize(); +const sal_uInt64 nCur = rSrc.Tell(); SetSize( n ); if( GetError() == SVSTREAM_OK ) { @@ -1135,9 +1135,7 @@ bool StgTmpStrm::Copy( StgTmpStrm& rSrc ) Seek( 0L ); while( n ) { -sal_uLong nn = n; -if( nn > 4096 ) -nn = 4096; +const sal_uInt64 nn = std::min(n, 4096); if( rSrc.Read( p.get(), nn ) != nn ) break; if( Write( p.get(), nn ) != nn ) @@ -1187,15 +1185,15 @@ void StgTmpStrm::SetSize(sal_uInt64 n) { m_aName = utl::TempFile(0, false).GetURL(); SvFileStream* s = new SvFileStream( m_aName, STREAM_READWRITE ); -sal_uLong nCur = Tell(); -sal_uLong i = nEndOfData; +const sal_uInt64 nCur = Tell(); +sal_uInt64 i = nEndOfData; std::unique_ptr<sal_uInt8[]> p(new sal_uInt8[ 4096 ]); if( i ) { Seek( 0L ); while( i ) { -sal_uLong nb = ( i > 4096 ) ? 4096 : i; +const sal_uInt64 nb = std::min(i, 4096); if( Read( p.get(), nb ) == nb && s->Write( p.get(), nb ) == nb ) i -= nb; @@ -1213,7 +1211,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n) i = n - nEndOfData; while (i) { -sal_uLong const nb = (i > 4096) ? 4096 : i; +const sal_uInt64 nb = std::min(i, 4096); if (s->Write(p.get(), nb) == nb) i -= nb; else @@ -1247,7 +1245,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n) } } -sal_uLong StgTmpStrm::GetData( void* pData, sal_uLong n ) +sal_Size StgTmpStrm::GetData( void* pData, sal_Size n ) { if( m_pStrm ) { @@ -1259,7 +1257,7 @@ sal_uLong StgTmpStrm::GetData( void* pData, sal_uLong n ) return SvMemoryStream::GetData( pData, n ); } -sal_uLong StgTmpStrm::PutData( const void* pData, sal_uLong n ) +sal_Size StgTmpStrm::PutData( const void* pData, sal_Size n ) { sal_uInt32 nCur = Tell(); sal_uInt32 nNew = nCur + n; diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx index 94f3049..2ce3ff3 100644 --- a/sot/source/sdstor/stgstrms.hxx +++ b/sot/source/sdstor/stgstrms.hxx @@ -151,7 +151,7 @@ class StgTmpStrm : public SvMemoryStream virtual void FlushData() override; public: -explicit StgTmpStrm( sal_uLong=16 ); +explicit StgTmpStrm( sal_uInt64=16 ); virtual ~StgTmpStrm(); bool Copy( StgTmpStrm& ); virtual void SetSize( sal_uInt64 ) override; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 23 commits - cui/source editeng/source sd/source starmath/source sw/source
cui/source/options/optpath.cxx| 106 +- cui/source/tabpages/macroass.cxx |2 editeng/source/editeng/editdbg.cxx|7 - sd/source/filter/ppt/pptin.cxx| 20 +++-- starmath/source/view.cxx | 55 +++ sw/source/ui/dbui/mmoutputtypepage.cxx| 15 +--- sw/source/uibase/dbui/mailmergehelper.cxx | 21 ++--- 7 files changed, 117 insertions(+), 109 deletions(-) New commits: commit 8be829eebf92f5af32e370e8c00b9b1e28ff95c7 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon Sep 14 22:34:35 2015 +0200 sal_uInt16 to sal_Int32 Change-Id: I7010e7daefd1710c41b526c085c892ac13f54cd0 diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index a4cbb28..5e65479 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -349,8 +349,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox ) fprintf( fp, "\nCharacter attribute:" ); bool bZeroAttr = false; -sal_uInt16 z; -for ( z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); z++ ) +for ( sal_Int32 z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); ++z ) { const EditCharAttrib& rAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs()[z]; OStringBuffer aCharAttribs; @@ -372,7 +371,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox ) if ( bZeroAttr ) fprintf( fp, "\nNULL-Attribute!" ); -sal_uInt16 nTextPortions = pPPortion->GetTextPortions().Count(); +const sal_Int32 nTextPortions = pPPortion->GetTextPortions().Count(); OStringBuffer aPortionStr("\nText portions: #"); aPortionStr.append(static_cast(nTextPortions)); aPortionStr.append(" \nA"); @@ -383,7 +382,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox ) aPortionStr.append(static_cast(nPortion)); aPortionStr.append(": "); sal_Int32 n = 0; -for ( z = 0; z < nTextPortions; z++ ) +for ( sal_Int32 z = 0; z < nTextPortions; ++z ) { TextPortion& rPortion = pPPortion->GetTextPortions()[z]; aPortionStr.append(' '); commit 552e68a15a41e01b2e9f5ef75b32f5acdf7b41ce Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Sep 13 17:58:24 2015 +0200 Avoid getTokenCount in SmViewShell::DrawText Change-Id: I1a4ee666900c3c412777ea2e8c01a4f38dc58b3a diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 803c30a..a84ea4f 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1081,13 +1081,16 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const OUString& rText, sal_uInt16 MaxWidth) { -sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n'); +if (rText.isEmpty()) +return; + Point aPoint(rPosition); Size aSize; -for (sal_uInt16 i = 0; i < nLines; i++) +sal_Int32 nPos = 0; +do { -OUString aLine = rText.getToken(i, '\n'); +OUString aLine = rText.getToken(0, '\n', nPos); aLine = comphelper::string::remove(aLine, '\r'); aSize = GetTextLineSize(rDevice, aLine); if (aSize.Width() > MaxWidth) @@ -1135,6 +1138,7 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const aPoint.Y() += aSize.Height(); } } +while ( nPos >= 0 ); } void SmViewShell::Impl_Print(OutputDevice , const SmPrintUIOptions , Rectangle aOutRect, Point aZeroPoint ) commit 809a4ef445ef0290a4d05babac2f585d1e6ed56f Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Sep 13 17:54:17 2015 +0200 Avoid getTokenCount in SmViewShell::DrawTextLine Change-Id: If2c059b1284257c73e64f30ffe845ee4d1ccc84d diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 7bfe1df..803c30a 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1058,23 +1058,21 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const OUString& rText, long void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, const OUString& rLine) { Point aPoint(rPosition); - -sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t'); -long nTabPos = 0; -if (nTabs > 0) -nTabPos = rDevice.approximate_char_width() * 8; +const long nTabPos = rLine.isEmpty() ? 0 : rDevice.approximate_char_width() * 8; if (nTabPos) { -for (sal_uInt16 i = 0; i < nTabs; ++i) +sal_Int32 nPos = 0; +do
[Libreoffice-commits] core.git: 5 commits - cui/source fpicker/source sc/source sd/source
cui/source/dialogs/multipat.cxx | 56 --- fpicker/source/office/iodlg.cxx | 33 ++ sc/source/core/tool/rangelst.cxx | 19 +++--- sc/source/ui/view/viewfun2.cxx |8 ++-- sd/source/core/CustomAnimationPreset.cxx | 30 5 files changed, 69 insertions(+), 77 deletions(-) New commits: commit 22547d056c5fc36aff666b68b03a2d9471022ac2 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Sep 13 11:04:21 2015 +0200 Avoid getTokenCount in CustomAnimationPreset::getProperties/hasProperty Change-Id: Ic5b9c152ef2faf8333ad797232e26b817668e965 diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx index e014280..f1a8005 100644 --- a/sd/source/core/CustomAnimationPreset.cxx +++ b/sd/source/core/CustomAnimationPreset.cxx @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -199,28 +198,31 @@ Reference< XAnimationNode > CustomAnimationPreset::create( const OUString& rstrS UStringList CustomAnimationPreset::getProperties() const { -OUString aProperties( maProperty ); -sal_uInt16 nTokens = comphelper::string::getTokenCount(aProperties, ';'); -sal_uInt16 nToken; UStringList aPropertyList; -for( nToken = 0; nToken < nTokens; nToken++ ) -aPropertyList.push_back( aProperties.getToken( nToken, ';' ) ); - +if (!maProperty.isEmpty()) +{ +sal_Int32 nPos = 0; +do +{ +aPropertyList.push_back(maProperty.getToken(0, ';', nPos)); +} +while (nPos >= 0); +} return aPropertyList; - } bool CustomAnimationPreset::hasProperty( const OUString& rProperty )const { -OUString aProperties( maProperty ); -OUString aProperty( rProperty ); -sal_uInt16 nTokens = comphelper::string::getTokenCount(aProperties, ';'); -sal_uInt16 nToken; -for( nToken = 0; nToken < nTokens; nToken++ ) +if (maProperty.isEmpty()) +return false; + +sal_Int32 nPos = 0; +do { -if( aProperties.getToken( nToken, ';' ) == aProperty ) +if (maProperty.getToken(0, ';', nPos) == rProperty) return true; } +while (nPos >= 0); return false; } commit 77ca5fec1ff78508f892afe25953f8c31da202df Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Sep 13 10:58:53 2015 +0200 Avoid getTokenCount in ScViewFunc::SetPrintRanges Change-Id: I1eba76ba0fdfc79de7e8f78f9bb5b0e932d343f4 diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index c085289..8aa822e 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -18,7 +18,6 @@ */ #include "scitems.hxx" -#include #include #include @@ -923,13 +922,14 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, if ( !pPrint->isEmpty() ) { const sal_Unicode sep = ScCompiler::GetNativeSymbolChar(ocSep); -sal_uInt16 nTCount = comphelper::string::getTokenCount(*pPrint, sep); -for (sal_uInt16 i=0; i<nTCount; i++) +sal_Int32 nPos = 0; +do { -OUString aToken = pPrint->getToken(i, sep); +const OUString aToken = pPrint->getToken(0, sep, nPos); if ( aRange.ParseAny( aToken, , aDetails ) & SCA_VALID ) rDoc.AddPrintRange( nTab, aRange ); } +while (nPos >= 0); } } else// NULL = use selection (print range is always set), use empty string to delete all ranges commit 865c9fbbfd683dc212e94513ffe3e3b86d231828 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Sep 13 10:52:11 2015 +0200 Avoid getTokenCount in ScRangeList::Parse Change-Id: I2c9628e5064ea03c878d6e45118755596a060d5a diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 9243a34..5a0882e 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include @@ -170,18 +169,12 @@ sal_uInt16 ScRangeList::Parse( const OUString& rStr, ScDocument* pDoc, sal_uInt1 nMask |= SCA_VALID; // falls das jemand vergessen sollte sal_uInt16 nResult = (sal_uInt16)~0;// alle Bits setzen ScRange aRange; -OUString aOne; -SCTAB nTab = 0; -if ( pDoc ) -{ -nTab = nDefaultTab; -} -else -nTab = 0; -sal_uInt16 nTCount = comphelper::string::getTokenCount(rStr, cDelimiter); -for ( sal_uInt16 i=0; i<nTCount; i++ ) +const SCTAB nTab = pDoc ? nDefaultTab : 0; + +sal_Int32 n
[Libreoffice-commits] core.git: cui/source
cui/source/dialogs/multipat.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit af433b6fff17e4e835043797063061055643b614 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Sep 13 12:20:38 2015 +0200 Fix precedence error Change-Id: I2720279f1e03e5a84da455cfd9074de157907e0b diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index 2b91b89..d04fd57 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -315,7 +315,7 @@ void SvxMultiPathDialog::SetPath( const OUString& rPath ) bool bIsSystemPath = osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None; -const OUString sEntry( "\t" + bIsSystemPath ? sSystemPath : sPath); +const OUString sEntry( "\t" + (bIsSystemPath ? sSystemPath : sPath)); SvTreeListEntry* pEntry = m_pRadioLB->InsertEntry( sEntry ); OUString* pURL = new OUString( sPath ); pEntry->SetUserData( pURL ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: bridges/source
bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f290e30e958319860af1febd01bb322f5f08b20a Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Sep 13 11:09:49 2015 +0200 Fix typo Change-Id: I81e897153281a70756ffd442f9384751c025c016 diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx index 106c20a..3a43ea3 100644 --- a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx +++ b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx @@ -696,7 +696,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw () assert(etMem + etMemOffset == pCode + totalSize); // remove array -delete[] excecptionTypeSizeArray; +delete[] exceptionTypeSizeArray; } RaiseInfo::~RaiseInfo() throw () ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: dbaccess/source
dbaccess/source/ui/misc/WTypeSelect.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 1a78f0965d854f461a7a55ae93842ac06446e41d Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Sep 12 19:13:16 2015 +0200 Restore correct boolean return value Fix commit f4c300eae4e9aaaec9e5d1f478ad35161ede2761 Change-Id: I660ca80b9df47160a24c2d32b1b03a814285a9a8 diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index bc20e96..99be537 100644 --- a/dbaccess/source/ui/misc/WTypeSelect.cxx +++ b/dbaccess/source/ui/misc/WTypeSelect.cxx @@ -377,9 +377,9 @@ bool OWizTypeSelectList::IsPrimaryKeyAllowed() const { OFieldDescription* pField = static_cast<OFieldDescription*>(GetEntryData(GetSelectEntryPos(j))); if(!pField || pField->getTypeInfo()->nSearchType == ColumnSearch::NONE) -return true; +return false; } -return false; +return true; } void OWizTypeSelectList::setPrimaryKey(OFieldDescription* _pFieldDescr, sal_uInt16 _nPos, bool _bSet) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 19 commits - accessibility/inc accessibility/source basctl/source chart2/source cui/source dbaccess/source extensions/source fpicker/source include/svtools include/svx
- sc/source/ui/view/tabvwshf.cxx |4 sd/source/filter/html/pubdlg.cxx|6 - sd/source/ui/animations/CustomAnimationPane.cxx |7 - sd/source/ui/dlg/PhotoAlbumDialog.cxx |6 - sd/source/ui/dlg/dlgass.cxx | 16 +-- sd/source/ui/dlg/dlgctrls.cxx |4 sd/source/ui/dlg/headerfooterdlg.cxx|2 sfx2/source/appl/newhelp.cxx| 22 ++-- sfx2/source/dialog/templdlg.cxx |2 starmath/source/dialog.cxx |2 starmath/source/utility.cxx |3 svl/source/numbers/zforscan.cxx |3 svl/source/numbers/zforscan.hxx |1 svtools/source/contnr/DocumentInfoPreview.cxx |1 svtools/source/dialogs/PlaceEditDialog.cxx |2 svtools/source/dialogs/ServerDetailsControls.cxx|4 svtools/source/edit/svmedit2.cxx|2 svx/source/dialog/docrecovery.cxx |2 svx/source/dialog/rubydialog.cxx|4 svx/source/engine3d/float3d.cxx |5 - svx/source/fmcomp/gridcell.cxx | 16 +-- svx/source/gallery2/galbrws1.cxx|8 - svx/source/gengal/gengal.cxx|2 svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx |6 - svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx |4 svx/source/sidebar/text/TextCharacterSpacingControl.cxx |2 svx/source/tbxctrls/fillctrl.cxx|2 svx/source/tbxctrls/lboxctrl.cxx|4 svx/source/tbxctrls/tbcontrl.cxx| 10 +- svx/source/tbxctrls/tbunosearchcontrollers.cxx |8 - sw/source/ui/fldui/fldvar.cxx |2 sw/source/uibase/dbui/dbmgr.cxx |4 toolkit/source/awt/vclxwindows.cxx | 40 vcl/inc/outfont.hxx |2 vcl/workben/mtfdemo.cxx |2 vcl/workben/vcldemo.cxx |2 103 files changed, 417 insertions(+), 475 deletions(-) New commits: commit 3342993a437df435f4640468fd650dfb45d43045 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Sep 12 14:13:50 2015 +0200 Avoid getTokenCount in favor of getToken Order of token extraction is inverted, but since elements are inserted in a set their final order won't be affected. Change-Id: I7f22a518e3d6a9a53951aa89159a36b398af5f46 diff --git a/cui/source/dialogs/plfilter.cxx b/cui/source/dialogs/plfilter.cxx index 67e35e6..cdb606f 100644 --- a/cui/source/dialogs/plfilter.cxx +++ b/cui/source/dialogs/plfilter.cxx @@ -20,7 +20,6 @@ #include #include #include -#include #include @@ -64,16 +63,22 @@ void fillNetscapePluginFilters( Sequence< OUString >& rPluginNames, Sequence< OU { const PluginDescription & rDescr = pDescriptions[nPos]; +// consistency check for the do {} while loop below +if (rDescr.Extension.isEmpty()) +continue; + StrSet& rTypes = aMap[ rDescr.Description ]; OUString aExtension( rDescr.Extension ); -for ( sal_uInt16 nCnt = comphelper::string::getTokenCount(aExtension, ';'); nCnt--; ) +sal_Int32 nIndex = 0; +do { // no default plugins anymore -OUString aExt( aExtension.getToken( nCnt, ';' ) ); +const OUString aExt( aExtension.getToken( 0, ';', nIndex ) ); if ( aExt != "*.*" ) rTypes.insert( aExt ); } +while ( nIndex >= 0 ); } rPluginNames = Sequence< OUString >( aMap.size() ); commit d76b979dbdbeefc522f39ef39034cef72f27cfca Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Sep 9 09:00:00 2015 +0200 Fix regression from ea2c80bdcd862f91dd7429184aea29d9a77f9774 Change-Id: I7aa236fbfed74dec67ff423d51d7313e7d235e1e diff --git a/cui/source/dialogs/plfilter.cxx b/cui/source/dialogs/plfilter.cxx index 386ff69..67e35e6 100644 --- a/cui/source/dialogs/plfilter.cxx +++ b/cui/source/dialogs/plfilter.cxx @@ -71,7 +71,7 @@ void fillNetscapePluginFilters( Sequence< OUString >& rPluginNames, Sequence< OU { // no default plugins anymore OUString
[Libreoffice-commits] core.git: 7 commits - editeng/source filter/source include/editeng include/svx include/vcl sc/source sot/source store/source svx/source sw/qa sw/source unotools/source vcl/inc vc
editeng/source/uno/unoedhlp.cxx |4 filter/source/flash/swfwriter1.cxx |2 filter/source/svg/svgexport.cxx | 13 filter/source/svg/svgwriter.cxx |8 filter/source/svg/svgwriter.hxx |2 include/editeng/unoedhlp.hxx|4 include/svx/xoutbmp.hxx |2 include/vcl/alpha.hxx |2 include/vcl/animate.hxx |4 include/vcl/bitmap.hxx |2 include/vcl/bitmapex.hxx|2 include/vcl/gdimtf.hxx |2 include/vcl/graph.hxx |2 sc/source/filter/starcalc/scflt.cxx | 779 ++-- sot/source/sdstor/ucbstorage.cxx| 42 - store/source/storbase.hxx |4 store/source/storbios.cxx |4 store/source/stordata.hxx |8 svx/source/xoutdev/_xoutbmp.cxx |6 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|2 sw/source/core/edit/editsh.cxx |3 sw/source/filter/html/css1atr.cxx |3 sw/source/filter/html/htmlflywriter.cxx |6 sw/source/filter/html/wrthtml.cxx |3 unotools/source/config/syslocaleoptions.cxx |4 vcl/inc/impbmp.hxx |6 vcl/inc/impgraph.hxx|2 vcl/source/gdi/animate.cxx |4 vcl/source/gdi/bitmap.cxx |8 vcl/source/gdi/bitmapex.cxx |2 vcl/source/gdi/gdimtf.cxx |4 vcl/source/gdi/graph.cxx|2 vcl/source/gdi/impgraph.cxx |4 33 files changed, 473 insertions(+), 472 deletions(-) New commits: commit d00ca13f880bbfe0fc987ef47184737dc74551d8 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sat Aug 29 16:49:46 2015 +0200 XOutBitmap::GraphicToBase64 can return bool instead of a sal_uLong error code, which no call place cares about Change-Id: I0d0dd16859e2f9678f47f484edf933e165b1ca48 diff --git a/include/svx/xoutbmp.hxx b/include/svx/xoutbmp.hxx index 34e03c3..37fe77d 100644 --- a/include/svx/xoutbmp.hxx +++ b/include/svx/xoutbmp.hxx @@ -56,7 +56,7 @@ public: static sal_uInt16 WriteGraphic( const Graphic rGraphic, OUString rFileName, const OUString rFilterName, const sal_uIntPtr nFlags = 0L, const Size* pMtfSize_100TH_MM = NULL ); -static sal_uLongGraphicToBase64(const Graphic rGraphic,OUString rOUString); +static bool GraphicToBase64(const Graphic rGraphic, OUString rOUString); static sal_uInt16 ExportGraphic( const Graphic rGraphic, const INetURLObject rURL, GraphicFilter rFilter, const sal_uInt16 nFormat, diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index c6a71ae..3993018 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -327,7 +327,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic rGraphic, OUString rFileNam } } -sal_uLong XOutBitmap::GraphicToBase64(const Graphic rGraphic, OUString rOUString) +bool XOutBitmap::GraphicToBase64(const Graphic rGraphic, OUString rOUString) { SvMemoryStream aOStm; OUString aMimeType; @@ -357,14 +357,14 @@ sal_uLong XOutBitmap::GraphicToBase64(const Graphic rGraphic, OUString rOUStri if ( nErr ) { SAL_WARN(svx, XOutBitmap::GraphicToBase64() invalid Graphic? error: nErr ); -return nErr; +return false; } aOStm.Seek(STREAM_SEEK_TO_END); css::uno::Sequencesal_Int8 aOStmSeq( static_castsal_Int8 const *(aOStm.GetData()),aOStm.Tell() ); OUStringBuffer aStrBuffer; ::sax::Converter::encodeBase64(aStrBuffer,aOStmSeq); rOUString = aMimeType + ;base64, + aStrBuffer.makeStringAndClear(); -return 0; +return true; } sal_uInt16 XOutBitmap::ExportGraphic( const Graphic rGraphic, const INetURLObject rURL, diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 02881ce..c630a76 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -3235,8 +3235,7 @@ static Writer OutCSS1_SvxBrush( Writer rWrt, const SfxPoolItem rHt, const Graphic* pGrf = static_castconst SvxBrushItem (rHt).GetGraphic(); if( pGrf ) { -sal_uLong nErr = XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64); -if( nErr ) +if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) ) { rHTMLWrt.nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; } diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 9e24f9a..e21b492 100644 --- a/sw/source/filter/html/htmlflywriter.cxx
Re: [Libreoffice-commits] core.git: Silence some conversion warnings
Hi On Mon, 24 Aug 2015 10:37:38 +0200 Stephan Bergmann sberg...@redhat.com wrote: On 08/21/2015 10:30 PM, Matteo Casalin wrote: commit eb4cbea657b9038c488f1b1bcf5107cc226a6681 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun Aug 16 16:32:13 2015 +0200 Silence some conversion warnings Change-Id: I676ed010576f3a24b193ffc6c28a319bcc5ac968 [...] diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index 395870f..78a51a1 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -512,9 +512,9 @@ struct PageData void guard (sal_uInt32 nAddr) { sal_uInt32 nCRC32 = 0; -nCRC32 = rtl_crc32 (nCRC32, m_aGuard.m_nMagic, sizeof(sal_uInt32)); +nCRC32 = rtl_crc32 (nCRC32, m_aGuard.m_nMagic, static_castsal_uInt32(sizeof(sal_uInt32))); What compiler/switch is it that warns there? It does not look like that particular compiler/switch is very useful. sizeof(sal_uInt32) is a known, small integer at compile time. It should be apparent to both the compiler and humans that it fits into the sal_uInt32 argument to rtl_crc32 without needing the static_cast noise. That's GCC -Wconversion, which I'm using to chase harmful downcasts (e.g. sal_Int32 to sal_uInt16 for OUString length, there are still some of them here and there). The point is that some of these downcasts, although safe in themselves, introduce a lot of noise in the logs and make the real issues difficult to detect. If I remember correctly in this case the warning was probably only in the result of theSize - sizeof(G) some lines below, I just casted both call places for simmetry. If that's undesired I'll revert the cast for the sizeof(sal_uInt32) calls. Kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: 9 commits - filter/source include/vcl registry/source store/source unoidl/source vcl/inc vcl/source
filter/source/msfilter/util.cxx|4 include/vcl/salbtype.hxx | 160 +++-- registry/source/reflcnst.hxx | 76 - store/source/lockbyte.cxx |4 store/source/storbase.hxx |8 - store/source/storbios.cxx |8 - store/source/storcach.cxx |2 store/source/stordata.hxx | 22 ++--- store/source/stordir.cxx |2 store/source/stortree.hxx |4 unoidl/source/legacyprovider.cxx |8 - vcl/inc/canvasbitmap.hxx |2 vcl/source/helper/canvasbitmap.cxx | 20 ++-- 13 files changed, 163 insertions(+), 157 deletions(-) New commits: commit 6257ea7d925080c930748b5c1120971f3aabc44d Author: Matteo Casalin matteo.casa...@yahoo.com Date: Fri Aug 21 22:14:03 2015 +0200 sal_uLong to size_t Change-Id: Ie1774045329f543c05316ba2acfa332e3b323c7c diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx index ee3b0f2..2ad04bc 100644 --- a/include/vcl/salbtype.hxx +++ b/include/vcl/salbtype.hxx @@ -419,7 +419,7 @@ inline BitmapPalette::BitmapPalette( const BitmapPalette rBitmapPalette ) : { if( mnCount ) { -const sal_uLong nSize = mnCount * sizeof( BitmapColor ); +const size_t nSize = mnCount * sizeof( BitmapColor ); mpBitmapColor = reinterpret_castBitmapColor*(new sal_uInt8[ nSize ]); memcpy( mpBitmapColor, rBitmapPalette.mpBitmapColor, nSize ); } @@ -432,7 +432,7 @@ inline BitmapPalette::BitmapPalette( sal_uInt16 nCount ) : { if( mnCount ) { -const sal_uLong nSize = mnCount * sizeof( BitmapColor ); +const size_t nSize = mnCount * sizeof( BitmapColor ); mpBitmapColor = reinterpret_castBitmapColor*(new sal_uInt8[ nSize ]); memset( mpBitmapColor, 0, nSize ); } @@ -452,7 +452,7 @@ inline BitmapPalette BitmapPalette::operator=( const BitmapPalette rBitmapPale if( mnCount ) { -const sal_uLong nSize = mnCount * sizeof( BitmapColor ); +const size_t nSize = mnCount * sizeof( BitmapColor ); mpBitmapColor = reinterpret_castBitmapColor*(new sal_uInt8[ nSize ]); memcpy( mpBitmapColor, rBitmapPalette.mpBitmapColor, nSize ); } @@ -508,8 +508,8 @@ inline void BitmapPalette::SetEntryCount( sal_uInt16 nCount ) } else if( nCount != mnCount ) { -const sal_uLong nNewSize = nCount * sizeof( BitmapColor ); -const sal_uLong nMinSize = std::min( mnCount, nCount ) * sizeof( BitmapColor ); +const size_t nNewSize = nCount * sizeof( BitmapColor ); +const size_t nMinSize = std::min( mnCount, nCount ) * sizeof( BitmapColor ); sal_uInt8* pNewColor = new sal_uInt8[ nNewSize ]; if ( nMinSize mpBitmapColor ) commit adc5e7d554fb3ad1afc4fdd15021fb84be297147 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Wed Aug 19 22:47:51 2015 +0200 ColorMask: sal_uLong to better types, minor code rework Change-Id: I426fa847038e7a6f788761242cb43e38cb355a36 diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx index dfbc59d..ee3b0f2 100644 --- a/include/vcl/salbtype.hxx +++ b/include/vcl/salbtype.hxx @@ -68,9 +68,9 @@ typedef const sal_uInt8* ConstScanline; #define MASK_TO_COLOR( d_nVal, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_Col ) \ -sal_uLong _def_cR = (sal_uInt8) ( d_RS 0L ? ( (d_nVal) d_RM ) -d_RS : ( (d_nVal) d_RM ) d_RS ); \ -sal_uLong _def_cG = (sal_uInt8) ( d_GS 0L ? ( (d_nVal) d_GM ) -d_GS : ( (d_nVal) d_GM ) d_GS ); \ -sal_uLong _def_cB = (sal_uInt8) ( d_BS 0L ? ( (d_nVal) d_BM ) -d_BS : ( (d_nVal) d_BM ) d_BS ); \ +const sal_uInt8 _def_cR = static_castsal_uInt8( d_RS 0 ? ( (d_nVal) d_RM ) -d_RS : ( (d_nVal) d_RM ) d_RS ); \ +const sal_uInt8 _def_cG = static_castsal_uInt8( d_GS 0 ? ( (d_nVal) d_GM ) -d_GS : ( (d_nVal) d_GM ) d_GS ); \ +const sal_uInt8 _def_cB = static_castsal_uInt8( d_BS 0 ? ( (d_nVal) d_BM ) -d_BS : ( (d_nVal) d_BM ) d_BS ); \ d_Col = BitmapColor( (sal_uInt8) ( _def_cR | ( ( _def_cR mnROr ) mnROrShift ) ), \ (sal_uInt8) ( _def_cG | ( ( _def_cG mnGOr ) mnGOrShift ) ), \ (sal_uInt8) ( _def_cB | ( ( _def_cB mnBOr ) mnBOrShift ) ) ); @@ -184,33 +184,33 @@ public: // - ColorMask - class VCL_DLLPUBLIC ColorMask { -sal_uLong mnRMask; -sal_uLong mnGMask; -sal_uLong mnBMask; -longmnRShift; -longmnGShift; -longmnBShift; -sal_uLong mnROrShift; -sal_uLong mnGOrShift; -sal_uLong mnBOrShift; -sal_uLong mnROr; -sal_uLong mnGOr; -sal_uLong mnBOr; -sal_uLong mnAlphaChannel; - -SAL_DLLPRIVATE inline long
[Libreoffice-commits] core.git: 24 commits - accessibility/source basctl/source cui/source desktop/source include/svtools include/vcl sfx2/source svtools/source sw/source vcl/source
accessibility/source/extended/textwindowaccessibility.cxx | 40 - basctl/source/basicide/baside2.cxx| 33 - basctl/source/basicide/baside2b.cxx | 24 basctl/source/basicide/linenumberwindow.cxx | 10 cui/source/dialogs/SpellDialog.cxx|4 desktop/source/deployment/gui/license_dialog.cxx |4 include/svtools/svmedit2.hxx |2 include/vcl/textdata.hxx | 15 include/vcl/texteng.hxx | 106 ++-- include/vcl/throbber.hxx |1 sfx2/source/control/thumbnailviewitem.cxx |4 svtools/source/edit/editsyntaxhighlighter.cxx | 11 svtools/source/edit/svmedit2.cxx |2 sw/source/ui/dbui/mmaddressblockpage.cxx | 18 sw/source/uibase/docvw/srcedtw.cxx|2 sw/source/uibase/uiview/srcview.cxx |8 vcl/source/control/combobox.cxx |6 vcl/source/control/field2.cxx | 12 vcl/source/control/ilstbox.cxx| 30 - vcl/source/control/longcurr.cxx |4 vcl/source/control/throbber.cxx | 10 vcl/source/edit/textdat2.hxx | 125 ++-- vcl/source/edit/textdata.cxx | 33 - vcl/source/edit/textdoc.cxx | 44 - vcl/source/edit/textdoc.hxx | 14 vcl/source/edit/texteng.cxx | 369 ++ vcl/source/edit/textund2.hxx | 16 vcl/source/edit/textundo.cxx | 10 vcl/source/edit/textview.cxx | 55 -- vcl/source/edit/vclmedit.cxx | 31 - vcl/source/edit/xtextedt.cxx | 16 31 files changed, 517 insertions(+), 542 deletions(-) New commits: commit 98244c3cb47824babc746ebc14a199977e9768d1 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sat Aug 15 19:35:32 2015 +0200 sal_uLong to sal_Int32/long Change-Id: Ia4ae190da37351b8c2b7ee9fc953508c5b1ab062 diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 65b6bf4..1aa1aa6 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -743,11 +743,11 @@ void ModulWindow::EditMacro( const OUString rMacroName ) TextView * pView = GetEditView(); // scroll if applicable so that first line is at the top long nVisHeight = GetOutputSizePixel().Height(); -if ( (long)pView-GetTextEngine()-GetTextHeight() nVisHeight ) +if ( pView-GetTextEngine()-GetTextHeight() nVisHeight ) { -long nMaxY = (long)pView-GetTextEngine()-GetTextHeight() - nVisHeight; +long nMaxY = pView-GetTextEngine()-GetTextHeight() - nVisHeight; long nOldStartY = pView-GetStartDocPos().Y(); -long nNewStartY = (long)nStart * (long)pView-GetTextEngine()-GetCharHeight(); +long nNewStartY = (long)nStart * pView-GetTextEngine()-GetCharHeight(); nNewStartY = std::min( nNewStartY, nMaxY ); pView-Scroll( 0, -(nNewStartY-nOldStartY) ); pView-ShowCursor( false ); diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 106e923..d1a29ae 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1107,11 +1107,11 @@ void EditorWindow::Notify( SfxBroadcaster /*rBC*/, const SfxHint rHint ) { if ( rModulWindow.GetHScrollBar() ) { -sal_uLong nWidth = pEditEngine-CalcTextWidth(); -if ( (long)nWidth != nCurTextWidth ) +const long nWidth = pEditEngine-CalcTextWidth(); +if ( nWidth != nCurTextWidth ) { nCurTextWidth = nWidth; -rModulWindow.GetHScrollBar()-SetRange( Range( 0, (long)nCurTextWidth-1) ); +rModulWindow.GetHScrollBar()-SetRange( Range( 0, nCurTextWidth-1) ); rModulWindow.GetHScrollBar()-SetThumbPos( pEditView-GetStartDocPos().X() ); } } diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index f37082e..cc1621a 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -161,11 +161,11 @@ bool LicenseView::IsEndReached() const ExtTextView
[Libreoffice-commits] core.git: 7 commits - accessibility/source basctl/source cui/source include/vcl sw/source vcl/source
accessibility/source/extended/textwindowaccessibility.cxx | 26 +--- basctl/source/basicide/baside2.cxx|3 basctl/source/basicide/baside2b.cxx | 12 +- cui/source/dialogs/SpellDialog.cxx| 24 ++-- include/vcl/textdata.hxx | 10 - include/vcl/texteng.hxx | 10 - include/vcl/txtattr.hxx | 50 sw/source/ui/dbui/mmaddressblockpage.cxx | 21 +-- vcl/source/control/edit.cxx | 12 -- vcl/source/edit/textdoc.cxx | 20 +-- vcl/source/edit/textdoc.hxx | 12 +- vcl/source/edit/texteng.cxx | 79 ++ vcl/source/edit/textundo.cxx |8 - vcl/source/edit/textview.cxx | 71 +--- vcl/source/edit/xtextedt.cxx | 16 +- 15 files changed, 175 insertions(+), 199 deletions(-) New commits: commit 44cd9ef88bfc14b4520de8a73a692f0d59c40946 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sat Aug 1 19:31:34 2015 +0200 sal_uInt16 to sal_Int32, constify, minor optimizations Change-Id: Icc41bbe09e495454ca27e9281eca6f4731a135c8 diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index be6a976..2224fec 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -882,13 +882,11 @@ void Document::retrieveParagraphSelection(Paragraph const * pParagraph, if ( nNumber = aMinPaM.GetPara() nNumber = aMaxPaM.GetPara() ) { -*pBegin = nNumber aMinPaM.GetPara() -? 0 -: static_cast ::sal_Int32 ( aMinPaM.GetIndex() ); +*pBegin = nNumber aMinPaM.GetPara() ? 0 : aMinPaM.GetIndex(); // XXX numeric overflow *pEnd = nNumber aMaxPaM.GetPara() -? static_cast ::sal_Int32 ( m_rEngine.GetText(static_cast ::sal_uLong (nNumber)).getLength() ) -: static_cast ::sal_Int32 ( aMaxPaM.GetIndex() ); +? m_rEngine.GetText(static_cast ::sal_uLong (nNumber)).getLength() +: aMaxPaM.GetIndex(); // XXX numeric overflow (3x) if ( aStartPaM aEndPaM ) @@ -909,8 +907,7 @@ void Document::retrieveParagraphSelection(Paragraph const * pParagraph, Paragraphs::size_type nNumber = pParagraph-getNumber(); TextPaM aEndPaM( rSelection.GetEnd() ); -return aEndPaM.GetPara() == nNumber -? static_cast ::sal_Int32 (aEndPaM.GetIndex()) : -1; +return aEndPaM.GetPara() == nNumber ? aEndPaM.GetIndex() : -1; } css::awt::Rectangle @@ -974,8 +971,7 @@ Document::retrieveCharacterBounds(Paragraph const * pParagraph, ::TextPaM aPaM(m_rEngine.GetPaM(::Point(static_cast long (rPoint.X), static_cast long (rPoint.Y; // XXX numeric overflow (2x) -return aPaM.GetPara() == nNumber -? static_cast ::sal_Int32 (aPaM.GetIndex()) : -1; +return aPaM.GetPara() == nNumber ? aPaM.GetIndex() : -1; // XXX numeric overflow } @@ -2248,13 +2244,11 @@ void Document::handleSelectionChangeNotification() bad TEXT_HINT_VIEWSELECTIONCHANGED event); ::sal_Int32 nNewFirstPara = static_cast ::sal_Int32 (rSelection.GetStart().GetPara()); -::sal_Int32 nNewFirstPos - = static_cast ::sal_Int32 (rSelection.GetStart().GetIndex()); +::sal_Int32 nNewFirstPos = rSelection.GetStart().GetIndex(); // XXX numeric overflow ::sal_Int32 nNewLastPara = static_cast ::sal_Int32 (rSelection.GetEnd().GetPara()); -::sal_Int32 nNewLastPos - = static_cast ::sal_Int32 (rSelection.GetEnd().GetIndex()); +::sal_Int32 nNewLastPos = rSelection.GetEnd().GetIndex(); // XXX numeric overflow // Lose focus: diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 9512e40..0a4277f 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -598,7 +598,7 @@ void EditorWindow::HandleAutoCorrect() { TextSelection aSel = GetEditView()-GetSelection(); sal_uLong nLine = aSel.GetStart().GetPara(); -sal_uInt16 nIndex = aSel.GetStart().GetIndex(); +const sal_Int32 nIndex = aSel.GetStart().GetIndex(); OUString aLine( pEditEngine-GetText( nLine ) ); // the line being modified const OUString sActSubName = GetActualSubName( nLine ); // the actual procedure @@ -609,7 +609,7 @@ void EditorWindow::HandleAutoCorrect() return; HighlightPortion r = aPortions.back(); -if( nIndex != aPortions.size()-1 ) +if( static_castsize_t(nIndex) != aPortions.size
[Libreoffice-commits] core.git: include/tools
include/tools/errcode.hxx | 193 +++--- 1 file changed, 98 insertions(+), 95 deletions(-) New commits: commit 5e6ec5bb145a7223281efd46c659a10fc5a59b58 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Tue Jul 21 22:57:43 2015 +0200 errcode.hxx: avoid some Wconversion warnings Change-Id: I48bb49c7eb472fa493fca71736acc358151e87ac Reviewed-on: https://gerrit.libreoffice.org/17308 Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com diff --git a/include/tools/errcode.hxx b/include/tools/errcode.hxx index 9914960..0df5e30 100644 --- a/include/tools/errcode.hxx +++ b/include/tools/errcode.hxx @@ -22,6 +22,9 @@ #ifndef __RSC #include tools/solar.h +#define CAST_TO_UINT32(a) ((sal_uInt32)(a)) +#else +#define CAST_TO_UINT32(a) (a) #endif /* @@ -70,11 +73,11 @@ Warning || || | #define ERRCODE_AREA_SHIFT13 #define ERRCODE_DYNAMIC_SHIFT 26 -#define ERRCODE_CLASS_MASK(31UL ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_MASKCAST_TO_UINT32(31UL ERRCODE_CLASS_SHIFT) -#define ERRCODE_DYNAMIC_START (1UL ERRCODE_DYNAMIC_SHIFT) +#define ERRCODE_DYNAMIC_START CAST_TO_UINT32(1UL ERRCODE_DYNAMIC_SHIFT) #define ERRCODE_DYNAMIC_COUNT 31UL -#define ERRCODE_DYNAMIC_MASK (31UL ERRCODE_DYNAMIC_SHIFT) +#define ERRCODE_DYNAMIC_MASK CAST_TO_UINT32(31UL ERRCODE_DYNAMIC_SHIFT) #ifdef __RSC @@ -84,50 +87,50 @@ Warning || || | #else -typedef sal_uIntPtr ErrCode; +typedef sal_uInt32 ErrCode; -inline sal_uIntPtr ERRCODE_TOERRID( sal_uIntPtr x ) +inline sal_uInt32 ERRCODE_TOERRID( ErrCode x ) { return x ~ERRCODE_DYNAMIC_MASK; } -inline sal_uIntPtr ERRCODE_TOERROR( sal_uIntPtr x ) +inline sal_uInt32 ERRCODE_TOERROR( ErrCode x ) { return ((x ERRCODE_WARNING_MASK) ? 0 : (x ERRCODE_ERROR_MASK)); } #endif -#define ERRCODE_AREA_TOOLS (0ULERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SV (1ULERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SFX (2ULERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_INET(3ULERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_TOOLS CAST_TO_UINT32(0UL ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SV CAST_TO_UINT32(1UL ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SFX CAST_TO_UINT32(2UL ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_INETCAST_TO_UINT32(3UL ERRCODE_AREA_SHIFT) #define ERRCODE_AREA_IO ERRCODE_AREA_TOOLS -#define ERRCODE_AREA_LIB1(8ULERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_LIB1CAST_TO_UINT32(8UL ERRCODE_AREA_SHIFT) #define ERRCODE_AREA_SVX ERRCODE_AREA_LIB1 #define ERRCODE_AREA_SVX_END (ERRCODE_AREA_SO-1) -#define ERRCODE_AREA_SO (9ULERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SO CAST_TO_UINT32(9UL ERRCODE_AREA_SHIFT) #define ERRCODE_AREA_SO_END (ERRCODE_AREA_SBX-1) -#define ERRCODE_AREA_SBX (10ULERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SBX_END ((11UL ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_DB (11ULERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_DB_END ((12UL ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_JAVA(12UL ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_JAVA_END((13UL ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_UUI (13UL ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_UUI_END ((14UL ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_LIB2(14UL ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_LIB2_END((15UL ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_CHAOS (15UL ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_CHAOS_END ((16UL ERRCODE_AREA_SHIFT) - 1) - -#define ERRCODE_AREA_APP1(32UL ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP2(40UL ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP3(48UL ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP4(56UL ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP5(64UL ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP6(72UL ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SBX CAST_TO_UINT32(10UL ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SBX_END CAST_TO_UINT32((11UL ERRCODE_AREA_SHIFT) - 1) +#define ERRCODE_AREA_DB CAST_TO_UINT32(11UL ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_DB_END CAST_TO_UINT32((12UL ERRCODE_AREA_SHIFT) - 1) +#define ERRCODE_AREA_JAVACAST_TO_UINT32(12UL ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_JAVA_ENDCAST_TO_UINT32((13UL
[Libreoffice-commits] core.git: include/tools
include/tools/solar.h | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) New commits: commit 029fa6477bfed71881c3287799f5bdffd3285f92 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Wed Jul 22 23:22:56 2015 +0200 solar.h: avoid some Wconversion warnings Change-Id: Id41bd4e759dea72b37db5f329e29ff5c18c75a66 Reviewed-on: https://gerrit.libreoffice.org/17306 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com diff --git a/include/tools/solar.h b/include/tools/solar.h index c8d83ac..717ad78 100644 --- a/include/tools/solar.h +++ b/include/tools/solar.h @@ -47,12 +47,14 @@ typedef sal_uInt8 SVBT64[8]; #ifdef __cplusplus -inline sal_uInt16 SVBT16ToShort( const SVBT16 p ) { return (sal_uInt16)p[0] - + ((sal_uInt16)p[1] 8); } -inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return (sal_uInt32)p[0] +inline sal_uInt16 SVBT16ToShort( const SVBT16 p ) { return static_castsal_uInt16 + ((sal_uInt16)p[0] + + ((sal_uInt16)p[1] 8)); } +inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return static_castsal_uInt32 + ((sal_uInt32)p[0] + ((sal_uInt32)p[1] 8) + ((sal_uInt32)p[2] 16) - + ((sal_uInt32)p[3] 24); } + + ((sal_uInt32)p[3] 24)); } #if defined OSL_LITENDIAN inline double SVBT64ToDouble( const SVBT64 p ) { double n; reinterpret_castsal_uInt8*(n)[0] = p[0]; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/osl
include/osl/endian.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6484b2fda3b4fa0059526e81cd1e26cca46cb705 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Tue Jul 21 22:56:56 2015 +0200 endian.h: avoid some Wconversion warnings Change-Id: Ic77bd0dd6ac2355eaf3e11811fba7604c782d9d6 Reviewed-on: https://gerrit.libreoffice.org/17307 Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com diff --git a/include/osl/endian.h b/include/osl/endian.h index 0819dee..5305493 100644 --- a/include/osl/endian.h +++ b/include/osl/endian.h @@ -161,7 +161,7 @@ extern C { #endif #ifndef OSL_MAKEWORD -# define OSL_MAKEWORD(bl, bh)((sal_uInt16)((bl) 0xFF) | (((sal_uInt16)(bh) 0xFF) 8)) +# define OSL_MAKEWORD(bl, bh)((sal_uInt16)((sal_uInt16)((bl) 0xFF) | (((sal_uInt16)(bh) 0xFF) 8))) #endif #ifndef OSL_LOBYTE # define OSL_LOBYTE(w) ((sal_uInt8)((sal_uInt16)(w) 0xFF)) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 10 commits - basic/source editeng/source include/basic include/vcl svtools/source vcl/source
basic/source/classes/sbxmod.cxx |2 - basic/source/runtime/methods.cxx| 10 +++--- basic/source/runtime/stdobj.cxx | 16 - basic/source/runtime/stdobj1.cxx|6 +-- basic/source/sbx/sbxvalue.cxx |8 ++-- basic/source/sbx/sbxvar.cxx | 13 +++- editeng/source/editeng/edtspell.cxx |6 +-- editeng/source/editeng/edtspell.hxx |6 +-- include/basic/sbmeth.hxx|2 - include/basic/sbx.hxx |4 +- include/basic/sbxvar.hxx| 10 +++--- include/vcl/syswin.hxx | 58 svtools/source/control/inettbc.cxx |3 - vcl/source/filter/wmf/wmfwr.cxx | 28 +++-- vcl/source/filter/wmf/wmfwr.hxx |6 +-- vcl/source/window/dockwin.cxx |2 - vcl/source/window/syswin.cxx| 18 +-- 17 files changed, 100 insertions(+), 98 deletions(-) New commits: commit c5ca63a0bb23bcc06b1ae70f169d965476bc251b Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun Jul 19 17:09:48 2015 +0200 sal_uInt16 to sal_Int32/size_t Change-Id: Icb8765339412bedf1e424a766bc99274ab96ceab diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 90d8cf4..4ba31d7 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -284,7 +284,7 @@ void WrongList::TextDeleted( size_t nPos, size_t nLength ) size_t nEndPos = nPos + nLength; if (IsValid()) { -sal_uInt16 nNewInvalidStart = nPos ? nPos - 1 : 0; +const size_t nNewInvalidStart = nPos ? nPos - 1 : 0; mnInvalidStart = nNewInvalidStart; mnInvalidEnd = nNewInvalidStart + 1; } @@ -546,7 +546,7 @@ bool WrongList::DbgIsBuggy() const EdtAutoCorrDoc::EdtAutoCorrDoc( -EditEngine* pE, ContentNode* pN, sal_uInt16 nCrsr, sal_Unicode cIns) : +EditEngine* pE, ContentNode* pN, sal_Int32 nCrsr, sal_Unicode cIns) : mpEditEngine(pE), pCurNode(pN), nCursor(nCrsr), @@ -593,7 +593,7 @@ bool EdtAutoCorrDoc::Replace(sal_Int32 nPos, const OUString rTxt) bool EdtAutoCorrDoc::ReplaceRange(sal_Int32 nPos, sal_Int32 nSourceLength, const OUString rTxt) { // Actually a Replace introduce = corresponds to UNDO -sal_uInt16 nEnd = nPos+nSourceLength; +sal_Int32 nEnd = nPos+nSourceLength; if ( nEnd pCurNode-Len() ) nEnd = pCurNode-Len(); diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index 4048e97..c669431 100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -123,7 +123,7 @@ class EdtAutoCorrDoc : public SvxAutoCorrDoc { EditEngine* mpEditEngine; ContentNode*pCurNode; -sal_uInt16 nCursor; +sal_Int32 nCursor; boolbAllowUndoAction; boolbUndoAction; @@ -132,7 +132,7 @@ protected: voidImplStartUndoAction(); public: -EdtAutoCorrDoc(EditEngine* pE, ContentNode* pCurNode, sal_uInt16 nCrsr, sal_Unicode cIns); +EdtAutoCorrDoc(EditEngine* pE, ContentNode* pCurNode, sal_Int32 nCrsr, sal_Unicode cIns); virtual ~EdtAutoCorrDoc(); virtual boolDelete( sal_Int32 nStt, sal_Int32 nEnd ) SAL_OVERRIDE; @@ -150,7 +150,7 @@ public: virtual LanguageType GetLanguage( sal_Int32 nPos, bool bPrevPara = false ) const SAL_OVERRIDE; -sal_uInt16 GetCursor() const { return nCursor; } +sal_Int32 GetCursor() const { return nCursor; } }; commit 40c34e62624f89b6e994e5e202c3bcf250544d86 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun Jul 19 12:24:28 2015 +0200 Fix indentation Change-Id: I5cff1cda3c6882e751b88a4a4d1aacbec8942578 diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx index e19168c..b8deec8 100644 --- a/basic/source/runtime/stdobj.cxx +++ b/basic/source/runtime/stdobj.cxx @@ -714,12 +714,12 @@ SbiStdObject::SbiStdObject( const OUString r, StarBASIC* pb ) : SbxObject( r ) // do we have to initialize the hashcodes? Methods* p = aMethods; if( !p-nHash ) - while( p-nArgs != -1 ) -{ -OUString aName_ = OUString::createFromAscii( p-pName ); -p-nHash = SbxVariable::MakeHashCode( aName_ ); -p += ( p-nArgs _ARGSMASK ) + 1; -} +while( p-nArgs != -1 ) +{ +OUString aName_ = OUString::createFromAscii( p-pName ); +p-nHash = SbxVariable::MakeHashCode( aName_ ); +p += ( p-nArgs _ARGSMASK ) + 1; +} // #i92642: Remove default properties Remove( OUString(Name), SbxCLASS_DONTCARE ); commit f7a2795c881c2eba95aa09f21881f842281ae819 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sat Jul 18 08:49:43 2015 +0200 sal_uIntPtr to sal_uInt32, for consistency Change-Id: Ib78dce61e8fb8c8e3bf8c7a2b02966100a4db0e8 diff --git a/basic/source/classes/sbxmod.cxx
[Libreoffice-commits] core.git: 3 commits - sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 41 +-- sw/source/filter/ww8/docxattributeoutput.hxx |4 +- sw/source/filter/ww8/rtfattributeoutput.cxx | 13 +--- sw/source/filter/ww8/rtfattributeoutput.hxx |2 - 4 files changed, 45 insertions(+), 15 deletions(-) New commits: commit 96b264edf2765e9d1893757d1f1f7c718b1df36d Author: Matteo Casalin matteo.casa...@yahoo.com Date: Thu Jul 9 09:19:44 2015 +0200 These functions and data can be local Change-Id: Ife2351bc8f0a3ee261b525aeb4e8e254174a42a0 diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 9a17f98..ddad776 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -890,6 +890,9 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties() } } +namespace +{ + /// Outputs an item set, that contains the formatting of the paragraph marker. void lcl_writeParagraphMarkerProperties(DocxAttributeOutput rAttributeOutput, const SfxItemSet rParagraphMarkerProperties) { @@ -921,6 +924,8 @@ void lcl_writeParagraphMarkerProperties(DocxAttributeOutput rAttributeOutput, c } } +} + void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet rParagraphMarkerProperties, const SwRedlineData* pRedlineData, const SwRedlineData* pRedlineParagraphMarkerDeleted, const SwRedlineData* pRedlineParagraphMarkerInserted) { // Call the 'Redline' function. This will add redline (change-tracking) information that regards to paragraph properties. @@ -3086,6 +3091,9 @@ void DocxAttributeOutput::TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t /* { } +namespace +{ + /// Does the same as comphelper::string::padToLength(), but extends the start, not the end. OString lcl_padStartToLength(OString const aString, sal_Int32 nLen, sal_Char cFill) { @@ -3101,6 +3109,8 @@ OString lcl_padStartToLength(OString const aString, sal_Int32 nLen, sal_Char c return aString; } +} + void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT; @@ -3715,6 +3725,9 @@ sal_Int32 DocxStringGetToken(DocxStringTokenMap const * pMap, const OUString rN return 0; } +namespace +{ + DocxStringTokenMap const aDefaultTokens[] = { {defQFormat, XML_defQFormat}, {defUnhideWhenUsed, XML_defUnhideWhenUsed}, @@ -3735,6 +3748,8 @@ DocxStringTokenMap const aExceptionTokens[] = { {0, 0} }; +} + void DocxAttributeOutput::LatentStyles() { // Do we have latent styles available? @@ -3787,6 +3802,9 @@ void DocxAttributeOutput::LatentStyles() m_pSerializer-endElementNS(XML_w, XML_latentStyles); } +namespace +{ + /// Should the font size we have written out as a default one? bool lcl_isDefaultFontSize(const SvxFontHeightItem rFontHeight, SwDoc* pDoc) { @@ -3802,6 +3820,8 @@ bool lcl_isDefaultFontSize(const SvxFontHeightItem rFontHeight, SwDoc* pDoc) return bRet; } +} + void DocxAttributeOutput::OutputDefaultItem(const SfxPoolItem rHt) { bool bMustWrite = true; @@ -5319,6 +5339,9 @@ void DocxAttributeOutput::EndStyleProperties( bool bParProp ) } } +namespace +{ + void lcl_OutlineLevel(sax_fastparser::FSHelperPtr pSerializer, sal_uInt16 nLevel) { if (nLevel = WW8ListManager::nMaxLevel) @@ -5329,6 +5352,8 @@ void lcl_OutlineLevel(sax_fastparser::FSHelperPtr pSerializer, sal_uInt16 nLevel FSEND); } +} + void DocxAttributeOutput::OutlineNumbering(sal_uInt8 const nLvl) { lcl_OutlineLevel(m_pSerializer, nLvl); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9d164f8..7ba1699 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1547,6 +1547,9 @@ void RtfAttributeOutput::WriteHeaderFooter_Impl(const SwFrameFormat rFormat, bo m_aRun = aRun; } +namespace +{ + void lcl_TextFrameShadow(std::vector std::pairOString, OString rFlyProperties, const SwFrameFormat rFrameFormat) { SvxShadowItem aShadowItem = rFrameFormat.GetShadow(); @@ -1630,6 +1633,8 @@ void lcl_TextFrameRelativeSize(std::vector std::pairOString, OString rFlyP } } +} + void RtfAttributeOutput::writeTextFrame(const sw::Frame rFrame, bool bTextBox) { RtfStringBuffer aRunText; commit 75d0b1ecd914ee06f51621983671da70d0e183fa Author: Matteo Casalin matteo.casa...@yahoo.com Date: Thu Jul 9 08:46:42 2015 +0200 Do not downcast opened bookmarks, neither (and just in case) Change-Id: I603940c64a1580a73c4f5c59b403caecd0ac75a5 diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5b022d8..9a17f98 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8
[Libreoffice-commits] core.git: sw/source
sw/source/filter/html/swhtml.cxx | 62 ++- 1 file changed, 30 insertions(+), 32 deletions(-) New commits: commit 707ef3171a096787b2f7a4c221e60962f05e7d01 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Mon Jun 8 23:32:14 2015 +0200 Just continue to next iteration Change-Id: I4040dff95dd1718df4cb555c155f7eea723bd2e3 Reviewed-on: https://gerrit.libreoffice.org/16170 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: Michael Stahl mst...@redhat.com Tested-by: Michael Stahl mst...@redhat.com diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 1f92ffc..9d338a7 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2292,7 +2292,7 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum ) { SwTextAttr *pHt = rHints.GetTextHint( i ); sal_uInt16 nWhich = pHt-Which(); -sal_Int16 nIdx = -1; +sal_Int16 nIdx = 0; bool bFont = false; switch( nWhich ) { @@ -2345,45 +2345,43 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum ) nIdx = 14; break; default: -break; +// Skip to next attribute +continue; } -if( nIdx != -1 ) +const sal_Int32 nStt = pHt-GetStart(); +if( nStt = aEndPos[nIdx] ) { -sal_Int32 nStt = pHt-GetStart(); -if( nStt = aEndPos[nIdx] ) +const SfxPoolItem rItem = +static_castconst SwContentNode *(pTextNd)-GetAttr( nWhich ); +if( bFont ? swhtml_css1atr_equalFontItems(rItem,pHt-GetAttr()) +: rItem == pHt-GetAttr() ) { -const SfxPoolItem rItem = -static_castconst SwContentNode *(pTextNd)-GetAttr( nWhich ); -if( bFont ? swhtml_css1atr_equalFontItems(rItem,pHt-GetAttr()) - : rItem == pHt-GetAttr() ) -{ -// The hint is the same as set in the paragraph and -// therefore, it can be deleted -// CAUTION!!! This WILL delete the hint and it MAY -// also delete the SwpHints!!! To avoid any trouble -// we leave the loop immediately if this is the last -// hint. -pTextNd-DeleteAttribute( pHt ); -if( 1 == nCntAttr ) -break; -i--; -nCntAttr--; -} -else -{ -// The hint is different. Therefore all hints within that -// hint have to be ignored. -aEndPos[nIdx] = pHt-GetEnd() ? *pHt-GetEnd() : nStt; -} +// The hint is the same as set in the paragraph and +// therefore, it can be deleted +// CAUTION!!! This WILL delete the hint and it MAY +// also delete the SwpHints!!! To avoid any trouble +// we leave the loop immediately if this is the last +// hint. +pTextNd-DeleteAttribute( pHt ); +if( 1 == nCntAttr ) +break; +i--; +nCntAttr--; } else { -// The hint starts before another one ends. -// The hint in this case is not deleted -OSL_ENSURE( pHt-GetEnd() *pHt-GetEnd() = aEndPos[nIdx], -hints aren't nested properly! ); +// The hint is different. Therefore all hints within that +// hint have to be ignored. +aEndPos[nIdx] = pHt-GetEnd() ? *pHt-GetEnd() : nStt; } } +else +{ +// The hint starts before another one ends. +// The hint in this case is not deleted +OSL_ENSURE( pHt-GetEnd() *pHt-GetEnd() = aEndPos[nIdx], +hints aren't nested properly! ); +} } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - include/rtl
include/rtl/character.hxx |4 ++-- include/rtl/strbuf.hxx|9 + include/rtl/string.hxx|9 + include/rtl/ustrbuf.hxx |9 + include/rtl/ustring.hxx |9 + 5 files changed, 22 insertions(+), 18 deletions(-) New commits: commit 1b60c3d62deef02788d31c7d60ea1ab12323c150 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun Jun 21 12:47:13 2015 +0200 Avoid conversion warnings in rtl::get[High|Low]Surrogate Change-Id: I5eec1f7505e27eedd39081669011f7af42b8a26f Signed-off-by: Stephan Bergmann sberg...@redhat.com diff --git a/include/rtl/character.hxx b/include/rtl/character.hxx index 52151e8..a3d09b9 100644 --- a/include/rtl/character.hxx +++ b/include/rtl/character.hxx @@ -261,7 +261,7 @@ inline bool isLowSurrogate(sal_uInt32 code) { inline sal_Unicode getHighSurrogate(sal_uInt32 code) { assert(code = 0x10); assert(code = 0x1); -return ((code - 0x1) 10) | detail::surrogatesHighFirst; +return static_castsal_Unicode(((code - 0x1) 10) | detail::surrogatesHighFirst); } /** Get low surrogate half of a non-BMP Unicode code point. @@ -275,7 +275,7 @@ inline sal_Unicode getHighSurrogate(sal_uInt32 code) { inline sal_Unicode getLowSurrogate(sal_uInt32 code) { assert(code = 0x10); assert(code = 0x1); -return ((code - 0x1) 0x3FF) | detail::surrogatesLowFirst; +return static_castsal_Unicode(((code - 0x1) 0x3FF) | detail::surrogatesLowFirst); } /** Combine surrogates to form a code point. commit cbe3b2fe0b9d745e22a2bf436ce55141b15f9502 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sat Jun 20 15:37:35 2015 +0200 Avoid conversion warning in O[U]String[Buffer] constructors Signed-off-by: Stephan Bergmann sberg...@redhat.com, modifying the patch to carefully keep the undefined behavior in the already existing additions that may potentially overflow, instead of making the static_castsal_Int32 introduction look like end - pData-buffer will be guaranteed to fit into sal_Int32 (which it is not). Change-Id: Id2fb64dc4585dae34257be6968a8905254a3b42d diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx index 52d29ca..81773b4 100644 --- a/include/rtl/strbuf.hxx +++ b/include/rtl/strbuf.hxx @@ -211,7 +211,7 @@ public: pData = rtl_string_alloc( nCapacity ); char* end = c.addData( pData-buffer ); *end = '\0'; -pData-length = end - pData-buffer; +pData-length = l; } #endif @@ -486,13 +486,14 @@ public: template typename T1, typename T2 OStringBuffer append( const OStringConcat T1, T2 c ) { -const int l = c.length(); +sal_Int32 l = c.length(); if( l == 0 ) return *this; -rtl_stringbuffer_ensureCapacity( pData, nCapacity, pData-length + l ); +l += pData-length; +rtl_stringbuffer_ensureCapacity( pData, nCapacity, l ); char* end = c.addData( pData-buffer + pData-length ); *end = '\0'; -pData-length = end - pData-buffer; +pData-length = l; return *this; } #endif diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index 94dad50..56cbf93 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -244,7 +244,7 @@ public: if (l != 0) { char* end = c.addData( pData-buffer ); -pData-length = end - pData-buffer; +pData-length = l; *end = '\0'; } } @@ -305,13 +305,14 @@ public: template typename T1, typename T2 OString operator+=( const OStringConcat T1, T2 c ) { -const int l = c.length(); +sal_Int32 l = c.length(); if( l == 0 ) return *this; -rtl_string_ensureCapacity( pData, pData-length + l ); +l += pData-length; +rtl_string_ensureCapacity( pData, l ); char* end = c.addData( pData-buffer + pData-length ); *end = '\0'; -pData-length = end - pData-buffer; +pData-length = l; return *this; } #endif diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx index abb85a0..04ac8a6 100644 --- a/include/rtl/ustrbuf.hxx +++ b/include/rtl/ustrbuf.hxx @@ -181,7 +181,7 @@ public: pData = rtl_uString_alloc( nCapacity ); sal_Unicode* end = c.addData( pData-buffer ); *end = '\0'; -pData-length = end - pData-buffer; +pData-length = l; // TODO realloc in case pData-length is noticeably smaller than l ? } #endif @@ -484,13 +484,14 @@ public: template typename T1, typename T2 OUStringBuffer append( const OUStringConcat T1, T2 c ) { -const int l = c.length(); +sal_Int32 l = c.length(); if( l == 0 ) return *this; -rtl_uStringbuffer_ensureCapacity( pData, nCapacity, pData-length + l ); +l += pData-length
[Libreoffice-commits] core.git: sw/source
sw/source/filter/html/swhtml.cxx | 97 --- 1 file changed, 52 insertions(+), 45 deletions(-) New commits: commit 492ff21d6543d800b0cd424eafbcd409bc19f695 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Mon Jun 8 23:17:50 2015 +0200 sw: HTML import: Do not mix normal, CTL or CJK attributes The original code used 15 elements for positions, the 'repaired' one lost 10 of them. Also, do not try to be too smart and be verbose, letting the compiler perform optimizations (regression from 1b0f7ee1e04d7b0fe81f7458ae2116615e0f6889) Change-Id: I0a1bc22d1abab083292de17b091c8be872fcee24 Reviewed-on: https://gerrit.libreoffice.org/16169 Reviewed-by: Michael Stahl mst...@redhat.com Tested-by: Michael Stahl mst...@redhat.com diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 9d7b928..1f92ffc 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2293,58 +2293,65 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum ) SwTextAttr *pHt = rHints.GetTextHint( i ); sal_uInt16 nWhich = pHt-Which(); sal_Int16 nIdx = -1; -//In 'hintids.hxx', the following five attributes don't follow -//each other in the Latin attributes as they do among CJK and -//CTL attributes, so the old code just made a mess, IMHO. -//E.g. 29-22=7, which should be LANGUAGE, but it's FONT. -//Moreover, it should occur between 0 and 4. -//Since it would be too risky to change the attribute codes, -//I repaired the following source code the 'brute force' way. - -//Old code: -/* -if( RES_CHRATR_CJK_FONT = nWhich -nWhich = RES_CHRATR_CTL_WEIGHT ) +bool bFont = false; +switch( nWhich ) { -nIdx = static_cast sal_uInt16 (nWhich - RES_CHRATR_CJK_FONT + 5); -} -else switch... -*/ - -if( RES_CHRATR_CJK_FONT == nWhich || RES_CHRATR_CTL_FONT == nWhich ) -{ -nIdx = 0; -} -else if( RES_CHRATR_CJK_FONTSIZE == nWhich || RES_CHRATR_CTL_FONTSIZE == nWhich ) -{ -nIdx = 1; -} -else if( RES_CHRATR_CJK_LANGUAGE == nWhich || RES_CHRATR_CTL_LANGUAGE == nWhich ) -{ -nIdx = 2; -} -else if( RES_CHRATR_CJK_POSTURE == nWhich || RES_CHRATR_CTL_POSTURE == nWhich ) -{ -nIdx = 3; -} -else if( RES_CHRATR_CJK_WEIGHT == nWhich || RES_CHRATR_CTL_WEIGHT == nWhich ) -{ -nIdx = 4; -} -else switch( nWhich ) -{ -case RES_CHRATR_FONT: nIdx = 0; break; -case RES_CHRATR_FONTSIZE: nIdx = 1; break; -case RES_CHRATR_LANGUAGE: nIdx = 2; break; -case RES_CHRATR_POSTURE:nIdx = 3; break; -case RES_CHRATR_WEIGHT: nIdx = 4; break; +case RES_CHRATR_FONT: +nIdx = 0; +bFont = true; +break; +case RES_CHRATR_FONTSIZE: +nIdx = 1; +break; +case RES_CHRATR_LANGUAGE: +nIdx = 2; +break; +case RES_CHRATR_POSTURE: +nIdx = 3; +break; +case RES_CHRATR_WEIGHT: +nIdx = 4; +break; +case RES_CHRATR_CJK_FONT: +nIdx = 5; +bFont = true; +break; +case RES_CHRATR_CJK_FONTSIZE: +nIdx = 6; +break; +case RES_CHRATR_CJK_LANGUAGE: +nIdx = 7; +break; +case RES_CHRATR_CJK_POSTURE: +nIdx = 8; +break; +case RES_CHRATR_CJK_WEIGHT: +nIdx = 9; +break; +case RES_CHRATR_CTL_FONT: +nIdx = 10; +bFont = true; +break; +case RES_CHRATR_CTL_FONTSIZE: +nIdx = 11; +break; +case RES_CHRATR_CTL_LANGUAGE: +nIdx = 12; +break; +case RES_CHRATR_CTL_POSTURE: +nIdx = 13; +break; +case RES_CHRATR_CTL_WEIGHT: +nIdx = 14; +break; +default: +break; } if( nIdx != -1
[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/source
sw/source/filter/html/swhtml.cxx | 97 --- 1 file changed, 52 insertions(+), 45 deletions(-) New commits: commit 5e5025a3c76e8a27ec3541c6c160e3b0fd2b8474 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Mon Jun 8 23:17:50 2015 +0200 sw: HTML import: Do not mix normal, CTL or CJK attributes The original code used 15 elements for positions, the 'repaired' one lost 10 of them. Also, do not try to be too smart and be verbose, letting the compiler perform optimizations (regression from 1b0f7ee1e04d7b0fe81f7458ae2116615e0f6889) Reviewed-on: https://gerrit.libreoffice.org/16169 Reviewed-by: Michael Stahl mst...@redhat.com Tested-by: Michael Stahl mst...@redhat.com (cherry picked from commit 492ff21d6543d800b0cd424eafbcd409bc19f695) Signed-off-by: Michael Stahl mst...@redhat.com Conflicts: sw/source/filter/html/swhtml.cxx Change-Id: I0a1bc22d1abab083292de17b091c8be872fcee24 diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 4ab6dee..2ef6256 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2294,58 +2294,65 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum ) SwTextAttr *pHt = rHints.GetTextHint( i ); sal_uInt16 nWhich = pHt-Which(); sal_Int16 nIdx = -1; -//In 'hintids.hxx', the following five attributes don't follow -//each other in the Latin attributes as they do among CJK and -//CTL attributes, so the old code just made a mess, IMHO. -//E.g. 29-22=7, which should be LANGUAGE, but it's FONT. -//Moreover, it should occur between 0 and 4. -//Since it would be too risky to change the attribute codes, -//I repaired the following source code the 'brute force' way. - -//Old code: -/* -if( RES_CHRATR_CJK_FONT = nWhich -nWhich = RES_CHRATR_CTL_WEIGHT ) +bool bFont = false; +switch( nWhich ) { -nIdx = static_cast sal_uInt16 (nWhich - RES_CHRATR_CJK_FONT + 5); -} -else switch... -*/ - -if( RES_CHRATR_CJK_FONT == nWhich || RES_CHRATR_CTL_FONT == nWhich ) -{ -nIdx = static_cast sal_uInt16 (0); -} -else if( RES_CHRATR_CJK_FONTSIZE == nWhich || RES_CHRATR_CTL_FONTSIZE == nWhich ) -{ -nIdx = static_cast sal_uInt16 (1); -} -else if( RES_CHRATR_CJK_LANGUAGE == nWhich || RES_CHRATR_CTL_LANGUAGE == nWhich ) -{ -nIdx = static_cast sal_uInt16 (2); -} -else if( RES_CHRATR_CJK_POSTURE == nWhich || RES_CHRATR_CTL_POSTURE == nWhich ) -{ -nIdx = static_cast sal_uInt16 (3); -} -else if( RES_CHRATR_CJK_WEIGHT == nWhich || RES_CHRATR_CTL_WEIGHT == nWhich ) -{ -nIdx = static_cast sal_uInt16 (4); -} -else switch( nWhich ) -{ -case RES_CHRATR_FONT: nIdx = 0; break; -case RES_CHRATR_FONTSIZE: nIdx = 1; break; -case RES_CHRATR_LANGUAGE: nIdx = 2; break; -case RES_CHRATR_POSTURE:nIdx = 3; break; -case RES_CHRATR_WEIGHT: nIdx = 4; break; +case RES_CHRATR_FONT: +nIdx = 0; +bFont = true; +break; +case RES_CHRATR_FONTSIZE: +nIdx = 1; +break; +case RES_CHRATR_LANGUAGE: +nIdx = 2; +break; +case RES_CHRATR_POSTURE: +nIdx = 3; +break; +case RES_CHRATR_WEIGHT: +nIdx = 4; +break; +case RES_CHRATR_CJK_FONT: +nIdx = 5; +bFont = true; +break; +case RES_CHRATR_CJK_FONTSIZE: +nIdx = 6; +break; +case RES_CHRATR_CJK_LANGUAGE: +nIdx = 7; +break; +case RES_CHRATR_CJK_POSTURE: +nIdx = 8; +break; +case RES_CHRATR_CJK_WEIGHT: +nIdx = 9; +break; +case RES_CHRATR_CTL_FONT: +nIdx = 10; +bFont = true; +break; +case RES_CHRATR_CTL_FONTSIZE: +nIdx = 11; +break; +case RES_CHRATR_CTL_LANGUAGE: +nIdx = 12; +break; +case
[Libreoffice-commits] core.git: 3 commits - sw/source
sw/source/filter/ww8/rtfexport.cxx | 37 + 1 file changed, 17 insertions(+), 20 deletions(-) New commits: commit 8cd2a372e3867f99b397b9ec089d6e1f7efd1088 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun Jun 21 10:48:09 2015 +0200 Use more proper integer types Change-Id: I33bbe7bf21a0758b9f59d78c8e2a32936f845eac diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index ac6f2f6..8fec63d 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1113,7 +1113,7 @@ sal_uInt16 RtfExport::GetRedline(const OUString rAuthor) if (i != m_aRedlineTable.end()) return i-second; -int nId = m_aRedlineTable.size(); +const sal_uInt16 nId = static_castsal_uInt16(m_aRedlineTable.size()); m_aRedlineTable.insert(std::pairOUString,sal_uInt16(rAuthor,nId)); return nId; } commit 61609a62a975e105345fcfbe64c7edff551ee1b3 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun Jun 21 10:44:34 2015 +0200 Remove else after return Change-Id: I95ed091165e3e60d1b162ec6ddca9dda43f8c439 diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 7a2849d..ac6f2f6 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -835,8 +835,8 @@ SvStream RtfExport::Strm() { if (m_pStream) return *m_pStream; -else -return m_pWriter-Strm(); + +return m_pWriter-Strm(); } void RtfExport::setStream() @@ -911,10 +911,12 @@ void RtfExport::InsColor(const Color rCol) sal_uInt16 n; bool bAutoColorInTable = false; for (RtfColorTable::iterator it=m_aColTable.begin() ; it != m_aColTable.end(); ++it) +{ if ((*it).second == rCol) return; // Already in the table -else if ((*it).second == COL_AUTO) +if ((*it).second == COL_AUTO) bAutoColorInTable = true; +} if (rCol.GetColor() == COL_AUTO) // COL_AUTO gets value 0 n = 0; @@ -1110,12 +1112,10 @@ sal_uInt16 RtfExport::GetRedline(const OUString rAuthor) std::mapOUString,sal_uInt16::iterator i = m_aRedlineTable.find(rAuthor); if (i != m_aRedlineTable.end()) return i-second; -else -{ -int nId = m_aRedlineTable.size(); -m_aRedlineTable.insert(std::pairOUString,sal_uInt16(rAuthor,nId)); -return nId; -} + +int nId = m_aRedlineTable.size(); +m_aRedlineTable.insert(std::pairOUString,sal_uInt16(rAuthor,nId)); +return nId; } const OUString* RtfExport::GetRedline(sal_uInt16 nId) commit 11d19a5e35891409da7b9c65c56f26f7d5ae5ad0 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun Jun 21 09:54:14 2015 +0200 Handle special case outside of for loop Change-Id: I40abac65c4d015157bf0fbc58e78fd16a4adc764 diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 45dc232..7a2849d 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -204,18 +204,15 @@ void RtfExport::BuildNumbering() { const SwNumRuleTable rListTable = m_pDoc-GetNumRuleTable(); -for (sal_uInt16 n = rListTable.size()+1; n;) +SwNumRule* pOutlineRule = m_pDoc-GetOutlineNumRule(); +if (IsExportNumRule(*pOutlineRule)) +GetId(*pOutlineRule); + +for (auto n = rListTable.size(); n;) { -SwNumRule* pRule; ---n; -if (n == rListTable.size()) -pRule = m_pDoc-GetOutlineNumRule(); -else -{ -pRule = rListTable[ n ]; -if (!SwDoc::IsUsed(*pRule)) -continue; -} +SwNumRule* pRule = rListTable[ --n ]; +if (!SwDoc::IsUsed(*pRule)) +continue; if (IsExportNumRule(*pRule)) GetId(*pRule); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/source
sw/source/filter/html/wrthtml.cxx| 10 sw/source/filter/writer/wrtswtbl.cxx | 42 +++ 2 files changed, 24 insertions(+), 28 deletions(-) New commits: commit ee472a7ffe2e5fdc70dcd84f4434f66713229b7e Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sat Jun 20 12:12:35 2015 +0200 Use more proper integer types and range-based for loops Change-Id: I61c8def25055f5621b4e239e24f8c5c09c2336b3 diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index 9bc6304..1b2ca2f 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -115,11 +115,8 @@ long SwWriteTable::GetLineHeight( const SwTableLine *pLine ) } const SwTableBoxes rBoxes = pLine-GetTabBoxes(); -sal_uInt16 nBoxes = rBoxes.size(); - -for( sal_uInt16 nBox=0; nBoxnBoxes; nBox++ ) +for( auto pBox : rBoxes ) { -const SwTableBox* pBox = rBoxes[nBox]; if( pBox-GetSttNd() ) { if( nHeight ROW_DFLT_HEIGHT ) @@ -203,7 +200,7 @@ void SwWriteTable::MergeBorders( const SvxBorderLine* pBorderLine, if( !bCollectBorderWidth ) return; -sal_uInt16 nOutWidth = pBorderLine-GetOutWidth(); +const sal_uInt16 nOutWidth = pBorderLine-GetOutWidth(); if( bTable ) { if( nOutWidth (!nBorder || nOutWidth nBorder) ) @@ -215,7 +212,7 @@ void SwWriteTable::MergeBorders( const SvxBorderLine* pBorderLine, nInnerBorder = nOutWidth; } -sal_uInt16 nDist = pBorderLine-GetInWidth() ? pBorderLine-GetDistance() +const sal_uInt16 nDist = pBorderLine-GetInWidth() ? pBorderLine-GetDistance() : 0; if( nDist (!nCellSpacing || nDist nCellSpacing) ) nCellSpacing = nDist; @@ -405,14 +402,14 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, sal_uInt16 nDepth ) { bool bSubExpanded = false; -sal_uInt16 nLines = rLines.size(); +const SwTableLines::size_type nLines = rLines.size(); #if OSL_DEBUG_LEVEL 0 sal_uInt32 nEndCPos = 0; #endif long nRPos = nStartRPos; -for( sal_uInt16 nLine = 0; nLine nLines; nLine++ ) +for( SwTableLines::size_type nLine = 0; nLine nLines; ++nLine ) { /*const*/ SwTableLine *pLine = rLines[nLine]; @@ -457,10 +454,10 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, // If necessary insert a column for all boxes of the row const SwTableBoxes rBoxes = pLine-GetTabBoxes(); -sal_uInt16 nBoxes = rBoxes.size(); +const SwTableBoxes::size_type nBoxes = rBoxes.size(); sal_uInt32 nCPos = nStartCPos; -for( sal_uInt16 nBox=0; nBoxnBoxes; nBox++ ) +for( SwTableBoxes::size_type nBox=0; nBoxnBoxes; ++nBox ) { const SwTableBox *pBox = rBoxes[nBox]; @@ -530,14 +527,14 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow, sal_uInt16 nDepth, sal_uInt16 nNumOfHeaderRows ) { -sal_uInt16 nLines = rLines.size(); +const SwTableLines::size_type nLines = rLines.size(); bool bSubExpanded = false; // Specifying the border long nRPos = nStartRPos; sal_uInt16 nRow = nStartRow; -for( sal_uInt16 nLine = 0; nLine nLines; nLine++ ) +for( SwTableLines::size_type nLine = 0; nLine nLines; ++nLine ) { const SwTableLine *pLine = rLines[nLine]; @@ -621,11 +618,11 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow, pBrushItem = 0; } -sal_uInt16 nBoxes = rBoxes.size(); +const SwTableBoxes::size_type nBoxes = rBoxes.size(); sal_uInt32 nCPos = nStartCPos; sal_uInt16 nCol = nStartCol; -for( sal_uInt16 nBox=0; nBoxnBoxes; nBox++ ) +for( SwTableBoxes::size_type nBox=0; nBoxnBoxes; ++nBox ) { const SwTableBox *pBox = rBoxes[nBox]; @@ -779,12 +776,11 @@ SwWriteTable::SwWriteTable(const SwTable* pTable, const SwHTMLTableLayout *pLayo nCellSpacing = pLayoutInfo-GetCellSpacing(); } -sal_uInt16 nRow, nCol; -sal_uInt16 nCols = pLayoutInfo-GetColCount(); -sal_uInt16 nRows = pLayoutInfo-GetRowCount(); +const sal_uInt16 nCols = pLayoutInfo-GetColCount(); +const sal_uInt16 nRows = pLayoutInfo-GetRowCount(); // First set the table structure. -for( nCol=0; nColnCols; nCol++ ) +for( sal_uInt16 nCol=0; nColnCols; ++nCol ) { SwWriteTableCol *pCol = new SwWriteTableCol( (nCol+1)*COL_DFLT_WIDTH ); @@ -800,7 +796,7 @@ SwWriteTable::SwWriteTable(const SwTable* pTable, const SwHTMLTableLayout *pLayo aCols.insert( pCol ); } -for( nRow=0; nRownRows; nRow++ ) +for( sal_uInt16 nRow=0; nRownRows; ++nRow
Submitted patch for SwHTMLParser::AppendTextNode
Hi everybody, in SwHTMLParser::AppendTextNode I noticed some code that claimed to repair an improper handling of script-dependent hints, but was suspiciously mixing end positions of plain, CTL and CJK attributes. I submitted a patch: https://gerrit.libreoffice.org/16169 that restores (in a more verbose and explicit way) the original behaviour. It was verified by Jenkins but I have no clue on how to test it. I would appreciate if somebody with a deeper knoweledge of that code could have a look at it and provide some feedback. Thanks in advance and kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: sw/source
sw/source/filter/html/swhtml.cxx | 32 +++- 1 file changed, 15 insertions(+), 17 deletions(-) New commits: commit a9ff587f5ab82b2b8567e5474dd9f5852680c2da Author: Matteo Casalin matteo.casa...@yahoo.com Date: Fri Jun 5 23:59:19 2015 +0200 Use auto, avoid temporaries and unneeded casts Change-Id: I66e69de20e45509de10bc6fe72d0a81bd4805647 Reviewed-on: https://gerrit.libreoffice.org/16168 Reviewed-by: Matteo Casalin matteo.casa...@yahoo.com Tested-by: Matteo Casalin matteo.casa...@yahoo.com diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 0fe96dd..6895714 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2046,8 +2046,7 @@ static void lcl_swhtml_getItemInfo( const _HTMLAttr rAttr, bool rScriptDependent, bool rFont, sal_uInt16 rScriptType ) { -sal_uInt16 nWhich = rAttr.GetItem().Which(); -switch( nWhich ) +switch( rAttr.GetItem().Which() ) { case RES_CHRATR_FONT: rFont = true; @@ -2143,7 +2142,7 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum ) const SwPosition rPos = *pPam-GetPoint(); _HTMLAttr** pHTMLAttributes = reinterpret_cast_HTMLAttr**(aAttrTab); -for (sal_uInt16 nCnt = sizeof(_HTMLAttrTable) / sizeof(_HTMLAttr*); nCnt--; ++pHTMLAttributes) +for (auto nCnt = sizeof(_HTMLAttrTable) / sizeof(_HTMLAttr*); nCnt--; ++pHTMLAttributes) { _HTMLAttr *pAttr = *pHTMLAttributes; if( pAttr pAttr-GetItem().Which() RES_PARATR_BEGIN ) @@ -2314,23 +2313,23 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum ) if( RES_CHRATR_CJK_FONT == nWhich || RES_CHRATR_CTL_FONT == nWhich ) { -nIdx = static_cast sal_uInt16 (0); +nIdx = 0; } else if( RES_CHRATR_CJK_FONTSIZE == nWhich || RES_CHRATR_CTL_FONTSIZE == nWhich ) { -nIdx = static_cast sal_uInt16 (1); +nIdx = 1; } else if( RES_CHRATR_CJK_LANGUAGE == nWhich || RES_CHRATR_CTL_LANGUAGE == nWhich ) { -nIdx = static_cast sal_uInt16 (2); +nIdx = 2; } else if( RES_CHRATR_CJK_POSTURE == nWhich || RES_CHRATR_CTL_POSTURE == nWhich ) { -nIdx = static_cast sal_uInt16 (3); +nIdx = 3; } else if( RES_CHRATR_CJK_WEIGHT == nWhich || RES_CHRATR_CTL_WEIGHT == nWhich ) { -nIdx = static_cast sal_uInt16 (4); +nIdx = 4; } else switch( nWhich ) { @@ -2649,11 +2648,10 @@ void SwHTMLParser::_SetAttr( bool bChkEnd, bool bBeforeTable, const sal_Int32 nEndCnt = pPam-GetPoint()-nContent.GetIndex(); _HTMLAttr* pAttr; SwContentNode* pCNd; -sal_uInt16 n; _HTMLAttrs aFields; -for( n = aSetAttrTab.size(); n; ) +for( auto n = aSetAttrTab.size(); n; ) { pAttr = aSetAttrTab[ --n ]; sal_uInt16 nWhich = pAttr-pItem-Which(); @@ -2891,7 +2889,7 @@ void SwHTMLParser::_SetAttr( bool bChkEnd, bool bBeforeTable, } } -for( n = aMoveFlyFrms.size(); n; ) +for( auto n = aMoveFlyFrms.size(); n; ) { SwFrameFormat *pFrameFormat = aMoveFlyFrms[ --n ]; @@ -3231,7 +3229,7 @@ void SwHTMLParser::SaveAttrTab( _HTMLAttrTable rNewAttrTab ) _HTMLAttr** pHTMLAttributes = reinterpret_cast_HTMLAttr**(aAttrTab); _HTMLAttr** pSaveAttributes = reinterpret_cast_HTMLAttr**(rNewAttrTab); -for (sal_uInt16 nCnt = sizeof(_HTMLAttrTable) / sizeof(_HTMLAttr*); nCnt--; (++pHTMLAttributes, ++pSaveAttributes)) +for (auto nCnt = sizeof(_HTMLAttrTable) / sizeof(_HTMLAttr*); nCnt--; ++pHTMLAttributes, ++pSaveAttributes) { *pSaveAttributes = *pHTMLAttributes; @@ -3284,7 +3282,7 @@ void SwHTMLParser::SplitAttrTab( _HTMLAttrTable rNewAttrTab, nEndCnt = (bSetAttr ? pCNd-Len() : 0); } -for (sal_uInt16 nCnt = sizeof(_HTMLAttrTable) / sizeof(_HTMLAttr*); nCnt--; (++pHTMLAttributes, ++pSaveAttributes)) +for (auto nCnt = sizeof(_HTMLAttrTable) / sizeof(_HTMLAttr*); nCnt--; (++pHTMLAttributes, ++pSaveAttributes)) { _HTMLAttr *pAttr = *pHTMLAttributes; *pSaveAttributes = 0; @@ -3365,7 +3363,7 @@ void SwHTMLParser::RestoreAttrTab( _HTMLAttrTable rNewAttrTab, _HTMLAttr** pHTMLAttributes = reinterpret_cast_HTMLAttr**(aAttrTab); _HTMLAttr** pSaveAttributes = reinterpret_cast_HTMLAttr**(rNewAttrTab); -for (sal_uInt16 nCnt = sizeof(_HTMLAttrTable) / sizeof(_HTMLAttr*); nCnt--; (++pHTMLAttributes, ++pSaveAttributes)) +for (auto nCnt = sizeof(_HTMLAttrTable) / sizeof(_HTMLAttr*); nCnt--; ++pHTMLAttributes, ++pSaveAttributes
[Libreoffice-commits] core.git: 6 commits - cui/source sw/source
cui/source/dialogs/hyphen.cxx | 18 +++-- cui/source/inc/hyphen.hxx |4 +-- sw/source/filter/html/htmlgrin.cxx | 27 ++ sw/source/filter/html/htmlsect.cxx |4 +-- sw/source/filter/html/htmltabw.cxx | 38 - sw/source/filter/html/svxcss1.cxx | 23 ++ 6 files changed, 51 insertions(+), 63 deletions(-) New commits: commit 038a6835d10c2f45d3aaa6df45ef331265a44c57 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Tue Jun 2 00:46:52 2015 +0200 Use more proper integer types Change-Id: I66223e76ba886219f4e458f53a3c9db81a43ddb2 diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 3f5ec0c..6576adf 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -342,7 +342,7 @@ void SvxCSS1BorderInfo::SetBorderLine( SvxBoxItemLine nLine, SvxBoxItem rBoxIte SvxCSS1PropertyInfo::SvxCSS1PropertyInfo() { -for( sal_uInt16 i=0; i4; i++ ) +for( size_t i=0; iSAL_N_ELEMENTS(aBorderInfos); ++i ) aBorderInfos[i] = 0; Clear(); @@ -378,7 +378,7 @@ SvxCSS1PropertyInfo::SvxCSS1PropertyInfo( const SvxCSS1PropertyInfo rProp ) : ePageBreakAfter( rProp.ePageBreakAfter ) // /Feature: PrintExt { -for( sal_uInt16 i=0; i4; i++ ) +for( size_t i=0; iSAL_N_ELEMENTS(aBorderInfos); ++i ) aBorderInfos[i] = rProp.aBorderInfos[i] ? new SvxCSS1BorderInfo( *rProp.aBorderInfos[i] ) : 0; @@ -391,7 +391,7 @@ SvxCSS1PropertyInfo::~SvxCSS1PropertyInfo() void SvxCSS1PropertyInfo::DestroyBorderInfos() { -for( sal_uInt16 i=0; i4; i++ ) +for( size_t i=0; iSAL_N_ELEMENTS(aBorderInfos); ++i ) { delete aBorderInfos[i]; aBorderInfos[i] = 0; @@ -443,7 +443,7 @@ void SvxCSS1PropertyInfo::Merge( const SvxCSS1PropertyInfo rProp ) if( rProp.bTextIndent ) bTextIndent = true; -for( sal_uInt16 i=0; i4; i++ ) +for( size_t i=0; iSAL_N_ELEMENTS(aBorderInfos); ++i ) { if( rProp.aBorderInfos[i] ) { @@ -572,9 +572,8 @@ void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet rItemSet, nBottomBorderDistance != USHRT_MAX || nLeftBorderDistance != USHRT_MAX || nRightBorderDistance != USHRT_MAX; -sal_uInt16 i; -for( i = 0; !bChg i 4; i++ ) +for( size_t i=0; !bChg iSAL_N_ELEMENTS(aBorderInfos); ++i ) bChg = aBorderInfos[i]!=0; if( !bChg ) @@ -600,7 +599,7 @@ void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet rItemSet, if( pInfo ) pInfo-SetBorderLine( SvxBoxItemLine::RIGHT, aBoxItem ); -for( i=0; i4; i++ ) +for( size_t i=0; iSAL_N_ELEMENTS(aBorderInfos); ++i ) { SvxBoxItemLine nLine = SvxBoxItemLine::TOP; sal_uInt16 nDist = 0; @@ -1211,7 +1210,7 @@ static void ParseCSS1_font_style( const CSS1Expression *pExpr, // (wobei nor noch normal | italic und oblique zulaessig sind // der Wert kann zwei Werte enthalten! -for( sal_uInt16 i=0; pExpr i2; i++ ) +for( int i=0; pExpr i2; ++i ) { // Auch hier hinterlaesst MS-IEs Parser seine Spuren if( (CSS1_IDENT==pExpr-GetType() || CSS1_STRING==pExpr-GetType()) @@ -2254,7 +2253,7 @@ static void ParseCSS1_margin( const CSS1Expression *pExpr, long nMargins[4] = { 0, 0, 0, 0 }; bool bSetMargins[4] = { false, false, false, false }; -for( sal_uInt16 i=0; pExpr i4 !pExpr-GetOp(); i++ ) +for( int i=0; pExpr i4 !pExpr-GetOp(); ++i ) { bool bSetThis = false; long nMargin = 0; @@ -2481,7 +2480,7 @@ static void ParseCSS1_padding( const CSS1Expression *pExpr, SvxCSS1PropertyInfo rPropInfo, const SvxCSS1Parser rParser ) { -sal_uInt16 n=0; +int n=0; while( n4 pExpr !pExpr-GetOp() ) { SvxBoxItemLine nLine = n==0 || n==2 ? SvxBoxItemLine::BOTTOM : SvxBoxItemLine::LEFT; @@ -2574,7 +2573,7 @@ static void ParseCSS1_border_xxx( const CSS1Expression *pExpr, pExpr = pExpr-GetNext(); } -for( sal_uInt16 i=0; i4; i++ ) +for( int i=0; i4; ++i ) { SvxBoxItemLine nLine = SvxBoxItemLine::TOP; switch( i ) @@ -2897,7 +2896,7 @@ static void ParseCSS1_size( const CSS1Expression *pExpr, SvxCSS1PropertyInfo rPropInfo, const SvxCSS1Parser /*rParser*/ ) { -sal_uInt16 n=0; +int n=0; while( n2 pExpr !pExpr-GetOp() ) { switch( pExpr-GetType() ) commit 029b2d512752893f96114c6b2318339d8c581f33 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Tue Jun 2 00:31:40 2015 +0200 Use more proper integer types and range-based for loops Change-Id: I48555d58af6c2cc814f9ac1cc39e221b31cce2f2 diff --git a/sw/source/filter/html/htmlsect.cxx b/sw
[Libreoffice-commits] core.git: 3 commits - cui/source editeng/source include/editeng sw/source
cui/source/dialogs/hyphen.cxx | 23 +++ cui/source/inc/hyphen.hxx |4 ++-- editeng/source/misc/splwrap.cxx |2 +- include/editeng/splwrap.hxx |2 +- sw/source/filter/html/htmlftn.cxx |2 +- sw/source/uibase/inc/hyp.hxx |2 +- sw/source/uibase/lingu/hyp.cxx|4 ++-- 7 files changed, 19 insertions(+), 20 deletions(-) New commits: commit 89fbad85dc98d67f5d3a7794c41e573613f5428f Author: Matteo Casalin matteo.casa...@yahoo.com Date: Mon Jun 1 11:11:31 2015 +0200 Fix typos in comments Change-Id: I2b8c08ee1a1e45347158f77ff25bee6adbaace94 diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index 6030089..c725f7d 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -105,7 +105,7 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl( { // returns a String showing only those hyphen positions which will result // in a line break if hyphenation is done there -// 1) we will need to discard all hyphenation positions at th end that +// 1) we will need to discard all hyphenation positions at the end that // will not result in a line break where the text to the left still fits // on the line. // 2) since as from OOo 3.2 '-' are part of a word an thus text like @@ -115,11 +115,11 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl( // Example: // If the possible hyphenation position in 'multi-line-editor' are to be marked -// by '=' then the text will look like this 'mul=ti-line-ed=it=or'. +// by '=' then the text will look like this: 'mul=ti-line-ed=it=or'. // If now the first line is only large enough for 'multi-line-edi' we need to discard -// the last possible hyphnation point because of 1). The right most valid +// the last possible hyphenation point because of 1). The right most valid // hyphenation position is ed=itor. The first '-' left of this position is -// line-ed, thus because of 2) we now need to discard all possible hyphneation +// line-ed, thus because of 2) we now need to discard all possible hyphenation // positions to the left of that as well. Thus in the end leaving us with just // 'multi-line-ed=itor' as return value for this function. (Just one valid hyphenation // position for the user too choose from. However ALL the '-' characters in the word @@ -156,7 +156,7 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl( break; else { -// find corresponding hyphen pos in string +// find corresponding hyphen positions in string nPos = aTxt.indexOf( sal_Unicode( HYPH_POS_CHAR ), nStart ); if (nPos == -1) @@ -238,7 +238,7 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_Int32 nInsPos ) nIdxPos++; } // take the possible hyphenation positions that got removed from the -// start of the wor dinot account: +// start of the word into account: nIdxPos += nHyphenationPositionsOffset; uno::Sequence sal_Int16 aSeq = xPossHyph-getHyphenationPositions(); commit 69a8d81b488aaf3014a508cb518f2de3a32076f6 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Mon Jun 1 01:24:23 2015 +0200 sal_uInt16 to sal_Int32, and use -1 as a special case Change-Id: Iaf90f96665781d3aa43f1f71802538f54409bd4a diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index a4e08f8..6030089 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -31,7 +31,6 @@ #include vcl/builderfactory.hxx #define HYPH_POS_CHAR '=' -#define CONTINUE_HYPH USHRT_MAX #define CUR_HYPH_POS_CHAR '-' @@ -223,16 +222,16 @@ void SvxHyphenWordDialog::InitControls_Impl() } -void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) +void SvxHyphenWordDialog::ContinueHyph_Impl( sal_Int32 nInsPos ) { -if ( nInsPos != CONTINUE_HYPHxPossHyph.is()) +if ( nInsPos = 0 xPossHyph.is() ) { if (nInsPos) { OUString aTmp( aEditWord ); DBG_ASSERT(nInsPos = aTmp.getLength() - 2, wrong hyphen position); -sal_Int16 nIdxPos = -1; +sal_Int32 nIdxPos = -1; for (sal_Int32 i = 0; i = nInsPos; ++i) { if (HYPH_POS_CHAR == aTmp[ i ]) @@ -385,7 +384,7 @@ IMPL_LINK_NOARG(SvxHyphenWordDialog, DeleteHdl_Impl) if( !bBusy ) { bBusy = true; -ContinueHyph_Impl(); +ContinueHyph_Impl( 0 ); bBusy = false; } return 0; @@ -397,7 +396,7 @@ IMPL_LINK_NOARG(SvxHyphenWordDialog, ContinueHdl_Impl) if( !bBusy ) { bBusy = true; -ContinueHyph_Impl( CONTINUE_HYPH ); +ContinueHyph_Impl(); bBusy
[Libreoffice-commits] core.git: 4 commits - cui/source
cui/source/dialogs/hyphen.cxx | 183 +++--- cui/source/inc/hyphen.hxx | 25 ++--- 2 files changed, 99 insertions(+), 109 deletions(-) New commits: commit b265ddb9232f1c76e8c0aa5db9f117525bd4d4a7 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Mon Jun 1 15:48:07 2015 +0200 Avoid temporary OUStrings Change-Id: If82d849f15e4218d8848a6fcdd507f0ef50d3edc diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index edb9513..2634fcb 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -71,26 +71,25 @@ void HyphenEdit::KeyInput( const KeyEvent rKEvt ) void SvxHyphenWordDialog::EnableLRBtn_Impl() { -OUString aTxt( m_aEditWord ); -sal_Int32 nLen = aTxt.getLength(); +const sal_Int32 nLen = m_aEditWord.getLength(); m_pRightBtn-Disable(); for ( sal_Int32 i = m_nOldPos + 2; i nLen; ++i ) { -if ( aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR ) ) +if ( m_aEditWord[ i ] == sal_Unicode( HYPH_POS_CHAR ) ) { m_pRightBtn-Enable(); break; } } -DBG_ASSERT(m_nOldPos aTxt.getLength(), nOldPos out of range); -if (m_nOldPos = aTxt.getLength()) -m_nOldPos = aTxt.getLength() - 1; +DBG_ASSERT(m_nOldPos nLen, nOldPos out of range); +if (m_nOldPos = nLen) +m_nOldPos = nLen - 1; m_pLeftBtn-Disable(); for ( sal_Int32 i = m_nOldPos; i-- 0; ) { -if ( aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR ) ) +if ( m_aEditWord[ i ] == sal_Unicode( HYPH_POS_CHAR ) ) { m_pLeftBtn-Enable(); break; @@ -228,13 +227,12 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_Int32 nInsPos ) { if (nInsPos) { -OUString aTmp( m_aEditWord ); -DBG_ASSERT(nInsPos = aTmp.getLength() - 2, wrong hyphen position); +DBG_ASSERT(nInsPos = m_aEditWord.getLength() - 2, wrong hyphen position); sal_Int32 nIdxPos = -1; for (sal_Int32 i = 0; i = nInsPos; ++i) { -if (HYPH_POS_CHAR == aTmp[ i ]) +if (HYPH_POS_CHAR == m_aEditWord[ i ]) nIdxPos++; } // take the possible hyphenation positions that got removed from the @@ -280,7 +278,7 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_Int32 nInsPos ) sal_uInt16 SvxHyphenWordDialog::GetHyphIndex_Impl() { sal_uInt16 nPos = 0; -OUString aTxt( m_pWordEdit-GetText() ); +const OUString aTxt( m_pWordEdit-GetText() ); for ( sal_Int32 i=0; i aTxt.getLength(); ++i ) { @@ -528,12 +526,7 @@ void SvxHyphenWordDialog::dispose() void SvxHyphenWordDialog::SetWindowTitle( LanguageType nLang ) { -OUString aLangStr( SvtLanguageTable::GetLanguageString( nLang ) ); -OUString aTmp( m_aLabel ); -aTmp += (; -aTmp += aLangStr; -aTmp += ); -SetText( aTmp ); +SetText( m_aLabel + ( + SvtLanguageTable::GetLanguageString( nLang ) + ) ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 43e8a85e36a731bb46e7d9a9e7663f287f3ad330 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Mon Jun 1 15:23:37 2015 +0200 Prefix data members Change-Id: I8b0fa3e95a5e3ed357bd5daa290e2309e86272e6 diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index 1febb60..edb9513 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -71,11 +71,11 @@ void HyphenEdit::KeyInput( const KeyEvent rKEvt ) void SvxHyphenWordDialog::EnableLRBtn_Impl() { -OUString aTxt( aEditWord ); +OUString aTxt( m_aEditWord ); sal_Int32 nLen = aTxt.getLength(); m_pRightBtn-Disable(); -for ( sal_Int32 i = nOldPos + 2; i nLen; ++i ) +for ( sal_Int32 i = m_nOldPos + 2; i nLen; ++i ) { if ( aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR ) ) { @@ -84,11 +84,11 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl() } } -DBG_ASSERT(nOldPos aTxt.getLength(), nOldPos out of range); -if (nOldPos = aTxt.getLength()) -nOldPos = aTxt.getLength() - 1; +DBG_ASSERT(m_nOldPos aTxt.getLength(), nOldPos out of range); +if (m_nOldPos = aTxt.getLength()) +m_nOldPos = aTxt.getLength() - 1; m_pLeftBtn-Disable(); -for ( sal_Int32 i = nOldPos; i-- 0; ) +for ( sal_Int32 i = m_nOldPos; i-- 0; ) { if ( aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR ) ) { @@ -134,11 +134,11 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl( DBG_ASSERT(rxPossHyph.is(), missing possible hyphens); if (rxPossHyph.is()) { -DBG_ASSERT( aActWord == rxPossHyph-getWord(), word mismatch ); +DBG_ASSERT( m_aActWord == rxPossHyph-getWord(), word mismatch ); aTxt = rxPossHyph-getPossibleHyphens(); -nHyphenationPositionsOffset = 0
Re: About Linguistic2::getHyphenationPositions()
Thanks Michael and Stephan, today I had the chance to look more carefully at that code and understood that those positions are indeed word (and not paragraph) related. Sorry for the noise. Kind regards Matteo On 06/01/2015 06:20 PM, Michael Stahl wrote: On 01.06.2015 09:45, Stephan Bergmann wrote: On 06/01/2015 01:38 AM, Matteo Casalin wrote: while converting some sal_uInt16 to sal_Int32 in cui/source/dialogs/hyphen.cxx, I noticed that getHyphenationPositions() returns a sequence of short/sal_Int16. The surrounding code suggests that sal_Int32 would be more appropriate, but I see that this function is listed in some .idl files and I can't say if changing it would break some published API. Looking at cui/source/dialogs/hyphen.cxx, you probably mean method getHyphenationPositions of UNO interface css.linguistic2.XPossibleHyphens. Which is indeed published, so cannot be changed, for backwards compatibility. So if there is really convincing reason to change this to e.g. sequencelong, either introduce a css.linguistic2.XPossibleHyphens2 etc. or discuss what the implications would be of incompatibly changing css.linguistic.XPossibleHyphens. Otherwise, best document that getHyphenationPositions unfortunately has a poor return type for historic reasons, and ensure that its implementations do reasonable things (e.g., do not include too large positions in the returned sequence but emit a SAL_WARN instead). i don't see much need to change this; ideally it should use long but the interface is for hyphenation of a single *word* - those are usually quite short. so the interface doesn't have to work for a 64k word, it's enough if it doesn't crash. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: 14 commits - sw/source
sw/source/filter/html/css1atr.cxx| 46 + sw/source/filter/html/htmlatr.cxx| 158 +-- sw/source/filter/html/htmlcss1.cxx | 47 - sw/source/filter/html/htmlctxt.cxx | 24 ++-- sw/source/filter/html/htmldrawreader.cxx |8 - sw/source/filter/html/htmldrawwriter.cxx |4 sw/source/filter/html/htmlfld.cxx|4 sw/source/filter/html/htmlfldw.cxx |4 sw/source/filter/html/htmlflywriter.cxx | 11 -- sw/source/filter/html/htmlform.cxx | 29 ++--- sw/source/filter/html/htmlftn.cxx| 21 +--- sw/source/filter/html/htmlgrin.cxx |2 sw/source/filter/html/htmlnumreader.cxx |2 sw/source/filter/html/htmlsect.cxx |6 - sw/source/filter/html/htmltab.cxx| 24 ++-- sw/source/filter/html/swhtml.cxx | 15 +- sw/source/filter/html/swhtml.hxx |4 17 files changed, 195 insertions(+), 214 deletions(-) New commits: commit 778d5508f5be8d9e31e1634110137f8afdf0065e Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun May 31 23:32:19 2015 +0200 Use more proper integer types and range-based for loops Change-Id: Ie91ab1fad1b2f16380071b8c8fbb928151f85d4b diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index e71d537..e0145c3 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -89,7 +89,7 @@ sal_Int32 lcl_html_getEndNoteInfo( SwEndNoteInfo rInfo, bool bEndNote ) { sal_Int32 nStrPos = 0; -for( sal_uInt16 nPart = 0; nPart 4; nPart++ ) +for( int nPart = 0; nPart 4; ++nPart ) { OUString aPart; if( -1 != nStrPos ) @@ -134,7 +134,7 @@ void SwHTMLParser::FillFootNoteInfo( const OUString rContent ) sal_Int32 nStrPos = lcl_html_getEndNoteInfo( aInfo, rContent, false ); -for( sal_uInt16 nPart = 4; nPart 8; nPart++ ) +for( int nPart = 4; nPart 8; ++nPart ) { OUString aPart; if( -1 != nStrPos ) @@ -271,7 +271,7 @@ Writer OutHTML_SwFormatFootnote( Writer rWrt, const SfxPoolItem rHt ) return rWrt; OUString sFootnoteName, sClass; -sal_uInt16 nPos; +size_t nPos; if( rFormatFootnote.IsEndNote() ) { nPos = rHTMLWrt.pFootEndNotes ? rHTMLWrt.pFootEndNotes-size() : 0; @@ -330,9 +330,8 @@ void SwHTMLWriter::OutFootEndNotes() #endif nFootNote = 0, nEndNote = 0; -for( sal_uInt16 i=0; ipFootEndNotes-size(); i++ ) +for( auto *pTextFootnote : *pFootEndNotes ) { -SwTextFootnote *pTextFootnote = (*pFootEndNotes)[i]; pFormatFootnote = pTextFootnote-GetFootnote(); OUString sFootnoteName, sClass; @@ -478,11 +477,11 @@ void SwHTMLWriter::OutFootEndNoteSym( const SwFormatFootnote rFormatFootnote, HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_anchor, false ); } -static sal_uInt16 lcl_html_fillEndNoteInfo( const SwEndNoteInfo rInfo, +static int lcl_html_fillEndNoteInfo( const SwEndNoteInfo rInfo, OUString *pParts, bool bEndNote ) { -sal_uInt16 nParts = 0; +int nParts = 0; sal_Int16 eFormat = rInfo.aFormat.GetNumberingType(); if( (bEndNote ? SVX_NUM_ROMAN_LOWER : SVX_NUM_ARABIC) != eFormat ) { @@ -513,12 +512,12 @@ static sal_uInt16 lcl_html_fillEndNoteInfo( const SwEndNoteInfo rInfo, } static void lcl_html_outFootEndNoteInfo( Writer rWrt, OUString *pParts, - sal_uInt16 nParts, const sal_Char *pName ) + int nParts, const sal_Char *pName ) { SwHTMLWriter rHTMLWrt = static_castSwHTMLWriter(rWrt); OUString aContent; -for( sal_uInt16 i=0; inParts; i++ ) +for( int i=0; inParts; ++i ) { OUString aTmp( pParts[i] ); aTmp = aTmp.replaceAll( \\, ); @@ -552,7 +551,7 @@ void SwHTMLWriter::OutFootEndNoteInfo() { const SwFootnoteInfo rInfo = pDoc-GetFootnoteInfo(); OUString aParts[8]; -sal_uInt16 nParts = lcl_html_fillEndNoteInfo( rInfo, aParts, false ); +int nParts = lcl_html_fillEndNoteInfo( rInfo, aParts, false ); if( rInfo.eNum != FTNNUM_DOC ) { aParts[4] = rInfo.eNum == FTNNUM_CHAPTER ? OUString( C ) : OUString( P ); @@ -581,7 +580,7 @@ void SwHTMLWriter::OutFootEndNoteInfo() { const SwEndNoteInfo rInfo = pDoc-GetEndNoteInfo(); OUString aParts[4]; -sal_uInt16 nParts = lcl_html_fillEndNoteInfo( rInfo, aParts, true ); +const int nParts = lcl_html_fillEndNoteInfo( rInfo, aParts, true ); if( nParts 0 ) lcl_html_outFootEndNoteInfo( *this, aParts, nParts, OOO_STRING_SVTOOLS_HTML_META_sdendnote ); commit c8eb473ff1895ad01fe01e82b0a422f6cf5c351e Author: Matteo Casalin matteo.casa...@yahoo.com Date
[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source
sw/qa/core/uwriter.cxx |2 +- sw/source/filter/html/htmlftn.cxx |2 +- sw/source/filter/xml/swxml.cxx |2 +- sw/source/uibase/config/barcfg.cxx |2 +- sw/source/uibase/docvw/AnnotationMenuButton.cxx |3 +-- sw/source/uibase/lingu/sdrhhcwrap.cxx |2 +- 6 files changed, 6 insertions(+), 7 deletions(-) New commits: commit e61fcfea5c2a306e44a053976e921160e78917ac Author: Matteo Casalin matteo.casa...@yahoo.com Date: Mon Jun 1 01:14:07 2015 +0200 WaE - Fix C4389: ´==´ : signed/unsigned mismatch Change-Id: I049ca27a0b69887d7ab82312dd30311ddb2bed63 diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index e0145c3..b8eaa26 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -275,7 +275,7 @@ Writer OutHTML_SwFormatFootnote( Writer rWrt, const SfxPoolItem rHt ) if( rFormatFootnote.IsEndNote() ) { nPos = rHTMLWrt.pFootEndNotes ? rHTMLWrt.pFootEndNotes-size() : 0; -OSL_ENSURE( nPos == rHTMLWrt.nFootNote + rHTMLWrt.nEndNote, +OSL_ENSURE( nPos == static_castsize_t(rHTMLWrt.nFootNote + rHTMLWrt.nEndNote), OutHTML_SwFormatFootnote: Position falsch ); sClass = OOO_STRING_SVTOOLS_HTML_sdendnote_anc; sFootnoteName = OOO_STRING_SVTOOLS_HTML_sdendnote + OUString::number( (sal_Int32)(++rHTMLWrt.nEndNote) ); commit 8b55fe96cf64c64e4877d0ffa8ea694dc7dc8d17 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Mon Jun 1 00:11:35 2015 +0200 Use auto or more proper integer types, avoid temporaries Change-Id: Iae81c30d23aa61e92b8dfd79c326c554b4164987 diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 61d400b..d1e7460 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1054,7 +1054,7 @@ void SwDocTest::randomTest() Jim, Bob, JimBobina, Helga, Gertrude, Spagna, Hurtleweed }; -for( sal_uInt16 rlm = 0; rlm SAL_N_ELEMENTS(modes); rlm++ ) +for( size_t rlm = 0; rlm SAL_N_ELEMENTS(modes); rlm++ ) { m_pDoc-ClearDoc(); diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index db7c64711..a14b839 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -383,7 +383,7 @@ static void lcl_AdjustOutlineStylesForOOo(SwDoc _rDoc) for ( sal_uInt8 i = 0; i MAXLEVEL; ++i ) { sStyleName = -SwStyleNameMapper::GetProgName( static_cast sal_uInt16 (RES_POOLCOLL_HEADLINE1 + i), +SwStyleNameMapper::GetProgName( RES_POOLCOLL_HEADLINE1 + i, sStyleName ); aDefOutlStyleNames[i] = sStyleName; } diff --git a/sw/source/uibase/config/barcfg.cxx b/sw/source/uibase/config/barcfg.cxx index 88cef25..3534285 100644 --- a/sw/source/uibase/config/barcfg.cxx +++ b/sw/source/uibase/config/barcfg.cxx @@ -38,7 +38,7 @@ SwToolbarConfigItem::SwToolbarConfigItem( bool bWeb ) : ConfigItem(bWeb ? OUString(Office.WriterWeb/ObjectBar) : OUString(Office.Writer/ObjectBar), ConfigItemMode::DelayedUpdate|ConfigItemMode::ReleaseTree) { -for(sal_uInt16 i = 0; i = SEL_TYPE_GRAPHIC; i++ ) +for(int i = 0; i = SEL_TYPE_GRAPHIC; ++i) aTbxIdArray[i] = -1; SequenceOUString aNames = GetPropertyNames(); diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx index b2ff368..2df32e5 100644 --- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx +++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx @@ -189,8 +189,7 @@ void AnnotationMenuButton::Paint(vcl::RenderContext rRenderContext, const Recta void AnnotationMenuButton::KeyInput(const KeyEvent rKeyEvt) { const vcl::KeyCode rKeyCode = rKeyEvt.GetKeyCode(); -const sal_uInt16 nKey = rKeyCode.GetCode(); -if (nKey == KEY_TAB) +if (rKeyCode.GetCode() == KEY_TAB) { mrSidebarWin.ActivatePostIt(); mrSidebarWin.GrabFocus(); diff --git a/sw/source/uibase/lingu/sdrhhcwrap.cxx b/sw/source/uibase/lingu/sdrhhcwrap.cxx index e899234..5d8e364 100644 --- a/sw/source/uibase/lingu/sdrhhcwrap.cxx +++ b/sw/source/uibase/lingu/sdrhhcwrap.cxx @@ -122,7 +122,7 @@ bool SdrHHCWrapper::ConvertNextDocument() pTextObj = NULL; } -sal_uInt16 n = nDocIndex; +const auto n = nDocIndex; std::listSdrTextObj* aTextObjs; SwDrawContact::GetTextObjectsFromFormat( aTextObjs, pView-GetDocShell()-GetDoc() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
About Linguistic2::getHyphenationPositions()
Hi all, while converting some sal_uInt16 to sal_Int32 in cui/source/dialogs/hyphen.cxx, I noticed that getHyphenationPositions() returns a sequence of short/sal_Int16. The surrounding code suggests that sal_Int32 would be more appropriate, but I see that this function is listed in some .idl files and I can't say if changing it would break some published API. Any suggestion on how to cope with this? Thanks and kind regards Matteo ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: 4 commits - sw/source
sw/source/uibase/inc/content.hxx |6 sw/source/uibase/utlui/content.cxx | 230 + 2 files changed, 112 insertions(+), 124 deletions(-) New commits: commit 4618d15cb73d0f0c15e0f4d2a6ce9cdbe6eeef24 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sat May 30 23:25:51 2015 +0200 Simplify Change-Id: Iafeed40abb3228c00c5490692c9f2f4d526c1dee diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index c13e95c..5e3ca2b 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1480,14 +1480,13 @@ bool SwContentTree::Expand( SvTreeListEntry* pParent ) bool SwContentTree::Collapse( SvTreeListEntry* pParent ) { -bool bRet(false); if(!bIsRoot || (static_castSwContentType*(pParent-GetUserData())-GetType() == CONTENT_TYPE_OUTLINE) || (nRootType == CONTENT_TYPE_OUTLINE)) { if(lcl_IsContentType(pParent)) { if(bIsRoot) -return bRet = false; +return false; SwContentType* pCntType = static_castSwContentType*(pParent-GetUserData()); const sal_Int32 nAnd = ~(1 pCntType-GetType()); if(bIsActive || bIsConstant) @@ -1505,11 +1504,9 @@ bool SwContentTree::Collapse( SvTreeListEntry* pParent ) void* key = (void*)pShell-getIDocumentOutlineNodesAccess()-getOutlineNode( nPos ); mOutLineNodeMap[key] = false; } -bRet = SvTreeListBox::Collapse(pParent); } -else -bRet = SvTreeListBox::Collapse(pParent); -return bRet; + +return SvTreeListBox::Collapse(pParent); } // Also on double click will be initially opened only. commit 824cda403206b61af20ed86aead59cfaddb6ac83 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sat May 30 23:19:48 2015 +0200 Fix indentation Change-Id: I5a2d05d476b81ad610ddf470b4e9a176f41a8c82 diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 1c7d45a..c13e95c 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1259,11 +1259,11 @@ PopupMenu* SwContentTree::CreateContextMenu() SwContentType* pType = static_castSwContentType*(pEntry-GetUserData()); if ( (pType-GetType() == CONTENT_TYPE_POSTIT) (!pActiveShell-GetView().GetDocShell()-IsReadOnly()) ( pType-GetMemberCount() 0) ) { -pSubPop4-InsertItem(600, sPostItShow ); -pSubPop4-InsertItem(601, sPostItHide ); -pSubPop4-InsertItem(602, sPostItDelete ); -pPop-InsertItem(4, pType-GetSingleName()); -pPop-SetPopupMenu(4, pSubPop4); +pSubPop4-InsertItem(600, sPostItShow ); +pSubPop4-InsertItem(601, sPostItHide ); +pSubPop4-InsertItem(602, sPostItDelete ); +pPop-InsertItem(4, pType-GetSingleName()); +pPop-SetPopupMenu(4, pSubPop4); } } @@ -1308,50 +1308,48 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent ) SwContentType* pCntType = static_castSwContentType*(pParent-GetUserData()); const size_t nCount = pCntType-GetMemberCount(); - // Add for outline plus/minus - if(pCntType-GetType() == CONTENT_TYPE_OUTLINE) - { - SvTreeListEntry* pChild = 0; - for(size_t i = 0; i nCount; ++i) - { - const SwContent* pCnt = pCntType-GetMember(i); - if(pCnt) - { - const auto nLevel = static_castconst SwOutlineContent*(pCnt)-GetOutlineLevel(); - OUString sEntry = pCnt-GetName(); - if(sEntry.isEmpty()) - sEntry = sSpace; - if(!pChild || (nLevel == 0)) - pChild = InsertEntry(sEntry, pParent, - false, TREELIST_APPEND,(void*)pCnt); - else - { - //back search parent. - if(static_castconst SwOutlineContent*(pCntType-GetMember(i-1))-GetOutlineLevel() nLevel) - pChild = InsertEntry(sEntry, pChild, - false, TREELIST_APPEND, (void*)pCnt); - else - { - pChild = Prev(pChild); - while(pChild - lcl_IsContent(pChild) - !(static_castSwOutlineContent*(pChild-GetUserData())-GetOutlineLevel() nLevel) - ) - { - pChild = Prev(pChild
[Libreoffice-commits] core.git: 4 commits - sw/inc sw/source
sw/inc/editsh.hxx|6 +- sw/source/core/doc/DocumentFieldsManager.cxx | 69 + sw/source/core/edit/edfld.cxx| 16 +++--- sw/source/core/unocore/unofield.cxx |2 sw/source/ui/config/optload.cxx |6 +- sw/source/ui/fldui/fldref.cxx|6 +- sw/source/ui/fldui/fldvar.cxx| 17 +++--- sw/source/ui/frmdlg/cption.cxx |6 +- sw/source/ui/index/cnttab.cxx|4 - sw/source/uibase/dochdl/swdtflvr.cxx | 72 --- sw/source/uibase/fldui/fldmgr.cxx| 10 +-- sw/source/uibase/inc/fldmgr.hxx |4 - sw/source/uibase/uiview/viewdlg2.cxx |5 + 13 files changed, 111 insertions(+), 112 deletions(-) New commits: commit 7dfe9f14d77f216f43ce22efd6addea6f53aad58 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Tue May 12 23:52:18 2015 +0200 Simplify loop Change-Id: I9c61e8b1d8552be25c3c78757b280b388cb98694 diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 2f64b0a..0c9b091 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -2111,7 +2111,7 @@ bool SwTransferable::_PasteDDE( TransferableDataHelper rData, size_t i = 1; size_t j; OUString aName; -bool bAlreadyThere = false, bDoublePaste = false; +bool bDoublePaste = false; const size_t nSize = rWrtShell.GetFieldTypeCount(); const ::utl::TransliterationWrapper rColl = ::GetAppCmpStrIgnore(); @@ -2136,14 +2136,10 @@ bool SwTransferable::_PasteDDE( TransferableDataHelper rData, } } if( j == nSize ) -bAlreadyThere = false; -else -{ -bAlreadyThere = true; -i++; -} +break; +++i; } -while( bAlreadyThere !bDoublePaste ); +while( !bDoublePaste ); if( !bDoublePaste ) { commit 7deb5886e4559ee5551ab3de43efa3e9be5e21f5 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Tue May 12 23:37:41 2015 +0200 Fix whitespaces/indentation Change-Id: I84a9e136b9c463ae794f5ddcbb211707672f170d diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 7c00160..2f64b0a 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -226,7 +226,7 @@ SwTransferable::SwTransferable( SwWrtShell rSh ) aObjDesc.maDisplayName = URIHelper::removePassword( rURLObj.GetMainURL( INetURLObject::NO_DECODE ), INetURLObject::WAS_ENCODED, - INetURLObject::DECODE_UNAMBIGUOUS ); +INetURLObject::DECODE_UNAMBIGUOUS ); } PrepareOLE( aObjDesc ); @@ -486,7 +486,7 @@ bool SwTransferable::GetData( const DataFlavor rFlavor, const OUString rDestDo } } -boolbOK = false; +bool bOK = false; if( TRNSFR_OLE == eBufferType ) { //TODO/MBA: testing - is this the single OLE object case?! @@ -518,8 +518,7 @@ bool SwTransferable::GetData( const DataFlavor rFlavor, const OUString rDestDo { case SotClipboardFormatId::LINK: if( refDdeLink.Is() ) -bOK = SetObject( refDdeLink, -SWTRANSFER_OBJECTTYPE_DDE, rFlavor ); +bOK = SetObject( refDdeLink, SWTRANSFER_OBJECTTYPE_DDE, rFlavor ); break; case SotClipboardFormatId::OBJECTDESCRIPTOR: @@ -957,11 +956,11 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) if( pWrtShell-GetURLFromButton( sURL, sDesc ) ) { AddFormat( SotClipboardFormatId::STRING ); - AddFormat( SotClipboardFormatId::SOLK ); - AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ); - AddFormat( SotClipboardFormatId::FILECONTENT ); - AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ); - AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ); +AddFormat( SotClipboardFormatId::SOLK ); +AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ); +AddFormat( SotClipboardFormatId::FILECONTENT ); +AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ); +AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ); eBufferType = (TransferBufferType)( TRNSFR_INETFLD | eBufferType ); nRet = 1; } @@ -1041,8 +1040,7 @@ int SwTransferable::CalculateAndCopy() return 1; } -int SwTransferable::CopyGlossary( SwTextBlocks rGlossary, -const OUString rStr ) +int SwTransferable::CopyGlossary( SwTextBlocks rGlossary, const OUString rStr
[Libreoffice-commits] core.git: Changes to 'private/bubli/sw_16bit'
New branch 'private/bubli/sw_16bit' available with the following commits: commit a98ef8adcc10bec409e8132ace3de1e6606e6c8f Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun Apr 26 13:12:37 2015 +0200 Use auto and range-based for loops Change-Id: I400bce4479eb0ab8105384f88a379c3ea90b9f66 commit 76c34865f595e0f79775d0f3e22e8ff62844867a Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun May 3 19:04:23 2015 +0200 Use range-based for loops Change-Id: I02dbe522c61804e5868b350e99ab02f691f36b0b commit 5b737ca478f70d652ea36338b005425eec8c8f18 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun May 3 19:22:22 2015 +0200 Use auto and range-based for loops Change-Id: I5fecd9cfb64fee9d18e4491e6219c1b90e64ea7c commit b271abe87672881ed0ae94c5f287ac2f93e81815 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun May 3 22:28:13 2015 +0200 Use range-based for loops, better integer types and avoid some casts Change-Id: Ife8bb0bb1d20655c0526aad1d4921713c961eb7a commit bde8062181295d832ace1c0f2bc8a54d17da8c0c Author: Katarina Behrens katarina.behr...@cib.de Date: Sun May 3 23:25:52 2015 +0200 tdf#89783: Adjust to new GetPos retval (size_t vs. sal_uInt16) Some of the usages of GetPos were just misusing it to find out whether a vector contains given element -- use Contains() in those cases This patch is partially based on work of Christoph Lutz Conflicts: sw/source/filter/ww8/wrtw8esh.cxx sw/source/filter/ww8/wrtw8num.cxx Change-Id: I40bedba905e7577ba23f69acee178e0ea7cc1521 commit 4925372f705239aebe8424e55df6a2a9718d1174 Author: Vasily Melenchuk vasily.melenc...@cib.de Date: Mon Apr 6 12:23:09 2015 +0300 tdf#89783: sal_uInt16 replacement by size_t: sections These replacements allow LO to load, save and mail merge documents having more than 65536 sections in total. Change-Id: I0e70889b1edc6e472a39f1f2638ac3c70a0d7058 Signed-off-by: Katarina Behrens katarina.behr...@cib.de commit 447de7e569739aa05f9a0dbd1128306c65c457ce Author: Katarina Behrens katarina.behr...@cib.de Date: Wed Apr 29 10:16:19 2015 +0200 tdf#89783: avoid endless loop with 65k style names Change-Id: I09be0ade1cd66253f420c2158ef6c093758ca493 commit ca0579f2bbf0b8bce8b3d3a79931758ebf4bd90e Author: Katarina Behrens katarina.behr...@cib.de Date: Wed Apr 29 10:13:18 2015 +0200 tdf#89783: fix another potential endless loop the same pattern as in 4de83e2c322509c0fb1b989f7e4898728fc4a Change-Id: I38d48b9c1302f23a0d2537f8e5eced2ee64ddf4e commit f3ddeb1d66de742648556fe569ab6638851c8bc2 Author: Christoph Lutz christoph.lutz...@cib.de Date: Tue Apr 28 17:55:11 2015 +0200 tdf#89783: MM fixes potential endless loops with dbgutil build Change-Id: I0eeb0decab588d89881a24983eb89727c3d9151b Reviewed-on: https://gerrit.libreoffice.org/15561 Reviewed-by: Katarina Behrens katarina.behr...@cib.de Tested-by: Katarina Behrens katarina.behr...@cib.de ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 4 commits - sw/source
sw/source/core/unocore/unostyle.cxx | 23 +++-- sw/source/core/unocore/unotbl.cxx | 38 ++-- sw/source/core/view/viewsh.cxx |6 ++--- sw/source/core/view/vprint.cxx |2 - sw/source/filter/basflt/fltini.cxx |6 ++--- sw/source/filter/basflt/shellio.cxx |4 +-- 6 files changed, 40 insertions(+), 39 deletions(-) New commits: commit 1848430d614e0f2f52e288363d0367c9207b0802 Author: Matteo Casalin matteo.casa...@yahoo.com Date: Tue May 5 22:45:29 2015 +0200 Use more proper integer types Change-Id: If1515df57cd90451f2c912bf5c268fec8688c063 diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 4911902..cde2dcf 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -438,14 +438,15 @@ static bool lcl_GetHeaderFooterItem( } static sal_Int32 lcl_GetCountOrName(const SwDoc rDoc, -SfxStyleFamily eFamily, OUString *pString, sal_uInt16 nIndex = USHRT_MAX) +SfxStyleFamily eFamily, OUString *pString, sal_Int32 nIndex = SAL_MAX_INT32) { sal_Int32 nCount = 0; switch( eFamily ) { case SFX_STYLE_FAMILY_CHAR: { -sal_uInt16 nBaseCount = RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN + +const sal_Int32 nBaseCount = + RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN + RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN; nIndex = nIndex - nBaseCount; const size_t nArrLen = rDoc.GetCharFmts()-size(); @@ -474,7 +475,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc rDoc, break; case SFX_STYLE_FAMILY_PARA: { -sal_uInt16 nBaseCount = RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN + +const sal_Int32 nBaseCount = +RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN + RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN + RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN + RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN + @@ -502,7 +504,7 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc rDoc, break; case SFX_STYLE_FAMILY_FRAME: { -sal_uInt16 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN; +const sal_Int32 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN; nIndex = nIndex - nBaseCount; const size_t nArrLen = rDoc.GetFrmFmts()-size(); for( size_t i = 0; i nArrLen; ++i ) @@ -525,7 +527,7 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc rDoc, break; case SFX_STYLE_FAMILY_PAGE: { -sal_uInt16 nBaseCount = RES_POOLPAGE_END - RES_POOLPAGE_BEGIN; +const sal_Int32 nBaseCount = RES_POOLPAGE_END - RES_POOLPAGE_BEGIN; nIndex = nIndex - nBaseCount; const sal_uInt16 nArrLen = rDoc.GetPageDescCnt(); for(sal_uInt16 i = 0; i nArrLen; ++i) @@ -547,7 +549,7 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc rDoc, break; case SFX_STYLE_FAMILY_PSEUDO: { -sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN; +const sal_Int32 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN; nIndex = nIndex - nBaseCount; const SwNumRuleTbl rNumTbl = rDoc.GetNumRuleTbl(); for(size_t i = 0; i rNumTbl.size(); ++i) @@ -581,14 +583,13 @@ sal_Int32 SwXStyleFamily::getCount() throw( uno::RuntimeException, std::exceptio return lcl_GetCountOrName ( *pDocShell-GetDoc(), eFamily, NULL ); } -uno::Any SwXStyleFamily::getByIndex(sal_Int32 nTempIndex) +uno::Any SwXStyleFamily::getByIndex(sal_Int32 nIndex) throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; uno::Any aRet; -if ( nTempIndex = 0 nTempIndex USHRT_MAX ) +if ( nIndex = 0 ) { -sal_uInt16 nIndex = static_cast sal_uInt16 ( nTempIndex ); if(pBasePool) { OUString sStyleName; @@ -1065,7 +1066,7 @@ SwStyleProperties_Impl::~SwStyleProperties_Impl() bool SwStyleProperties_Impl::SetProperty(const OUString rName, const uno::Any rVal) { -sal_uInt16 nPos = 0; +sal_uInt32 nPos = 0; bool bRet = false; PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); while( aIt != aPropertyEntries.end() ) @@ -2250,7 +2251,7 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl( throw uno::RuntimeException(); } -for(sal_Int16 nProp = 0; nProp rPropertyNames.getLength(); nProp++) +for(sal_Int32 nProp = 0; nProp rPropertyNames.getLength(); ++nProp) { const
[Libreoffice-commits] core.git: 16 commits - sw/inc sw/source
sw/inc/docufld.hxx |2 sw/inc/edimp.hxx |7 - sw/source/core/edit/edattr.cxx |2 sw/source/core/edit/ednumber.cxx | 22 ++-- sw/source/core/edit/edsect.cxx | 11 -- sw/source/core/edit/edtox.cxx| 10 - sw/source/core/fields/authfld.cxx| 161 --- sw/source/core/fields/cellfml.cxx|2 sw/source/core/fields/dbfld.cxx |2 sw/source/core/fields/docufld.cxx| 16 +-- sw/source/core/fields/expfld.cxx | 26 ++--- sw/source/core/fields/reffld.cxx | 13 -- sw/source/core/frmedt/fecopy.cxx | 37 +++ sw/source/core/frmedt/fefly1.cxx | 18 +-- sw/source/core/frmedt/feshview.cxx | 18 +-- sw/source/core/frmedt/tblsel.cxx | 41 --- sw/source/core/unocore/unocrsrhelper.cxx |4 sw/source/core/unocore/unoobj.cxx|2 18 files changed, 179 insertions(+), 215 deletions(-) New commits: commit c4a8c34812e3b47ed96395ea0328b658949466fe Author: Matteo Casalin matteo.casa...@yahoo.com Date: Sun May 3 22:28:13 2015 +0200 Use range-based for loops, better integer types and avoid some casts Change-Id: Ife8bb0bb1d20655c0526aad1d4921713c961eb7a diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 472be01..95fe266a 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -86,6 +86,7 @@ struct _CmpLPt typedef o3tl::sorted_vector_CmpLPt _MergePos; + struct _Sort_CellFrm { const SwCellFrm* pFrm; @@ -206,7 +207,7 @@ void GetTblSel( const SwCursor rCrsr, SwSelBoxes rBoxes, for( ; nSttPos = nEndPos; ++nSttPos ) { pLine = rLines[ nSttPos ]; -for( sal_uInt16 n = pLine-GetTabBoxes().size(); n ; ) +for( auto n = pLine-GetTabBoxes().size(); n ; ) { SwTableBox* pBox = pLine-GetTabBoxes()[ --n ]; // check for cell protection?? @@ -466,10 +467,12 @@ bool ChkChartSel( const SwNode rSttNd, const SwNode rEndNd ) ::MakeSelUnions( aUnions, pStart, pEnd, nsSwTblSearchType::TBLSEARCH_NO_UNION_CORRECT ); // find boxes for each entry and emit -for( i = 0; i aUnions.size() bTblIsValid -bValidChartSel; ++i ) +for( auto rSelUnion : aUnions ) { -SwSelUnion *pUnion = aUnions[i]; +if (!bTblIsValid || !bValidChartSel) +break; + +SwSelUnion *pUnion = rSelUnion; const SwTabFrm *pTable = pUnion-GetTable(); SWRECTFN( pTable ) @@ -879,9 +882,9 @@ bool IsEmptyBox( const SwTableBox rBox, SwPaM rPam ) nEndIdx = rBox.GetSttNd()-EndOfSectionIndex(), nIdx; -for( sal_uInt16 n = 0; n rFmts.size(); ++n ) +for( auto pFmt : rFmts ) { -const SwFmtAnchor rAnchor = rFmts[n]-GetAnchor(); +const SwFmtAnchor rAnchor = pFmt-GetAnchor(); const SwPosition* pAPos = rAnchor.GetCntntAnchor(); if (pAPos ((FLY_AT_PARA == rAnchor.GetAnchorId()) || @@ -934,11 +937,11 @@ void GetMergeSel( const SwPaM rPam, SwSelBoxes rBoxes, SWRECTFN( pStart-GetUpper() ) -for ( sal_uInt16 i = 0; i aUnions.size(); ++i ) +for ( auto rSelUnion : aUnions ) { -const SwTabFrm *pTabFrm = aUnions[i].GetTable(); +const SwTabFrm *pTabFrm = rSelUnion.GetTable(); -SwRect rUnion = aUnions[i].GetUnion(); +SwRect rUnion = rSelUnion.GetUnion(); // Skip any repeated headlines in the follow: const SwLayoutFrm* pRow = pTabFrm-IsFollow() ? @@ -1272,7 +1275,7 @@ void GetMergeSel( const SwPaM rPam, SwSelBoxes rBoxes, aPosArr[ 0 ].Y() ) : 0; -for( sal_uInt16 n = 0; n aPosArr.size(); ++n ) +for( _MergePos::size_type n = 0; n aPosArr.size(); ++n ) { const _CmpLPt rPt = aPosArr[ n ]; if( bCalcWidth ) @@ -1329,9 +1332,8 @@ void GetMergeSel( const SwPaM rPam, SwSelBoxes rBoxes, SwPaM aPam( aInsPos ); -for( sal_uInt16 n = 0; n aPosArr.size(); ++n ) +for( const auto rPt : aPosArr ) { -const _CmpLPt rPt = aPosArr[ n ]; aPam.GetPoint()-nNode.Assign( *rPt.pSelBox-GetSttNd()- EndOfSectionNode(), -1 ); SwCntntNode* pCNd = aPam.GetCntntNode(); @@ -1537,7 +1539,7 @@ static void lcl_FindStartEndRow( const SwLayoutFrm *rpStart, aEndArr.push_front( pTmp ); } -for( sal_uInt16 n = 0; n aEndArr.size() n aSttArr.size(); ++n ) +for( std::dequeconst SwLayoutFrm *::size_type n = 0; n aEndArr.size() n aSttArr.size(); ++n ) if( aSttArr[ n ] != aEndArr[ n