Hi, I have submitted a patch for review:
https://gerrit.libreoffice.org/3740 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/40/3740/1 fdo#63154: Remove _CL and _LF from solar.h And use RTL_CHAR_{CR,LF} from rtl/string.h Change-Id: I05b0325006845e48eb5483485a9042aa7b0cd22a --- M include/rtl/string.h M include/tools/solar.h M sc/source/core/tool/formularesult.cxx M sc/source/filter/html/htmlexp.cxx M sc/source/ui/docshell/docsh.cxx M sc/source/ui/docshell/impex.cxx M svl/source/items/slstitm.cxx M svtools/source/svhtml/parhtml.cxx M sw/source/filter/html/htmlform.cxx M sw/source/filter/html/swhtml.cxx M sw/source/ui/misc/redlndlg.cxx M tools/source/generic/config.cxx M tools/source/stream/stream.cxx M vcl/source/app/dbggui.cxx M vcl/source/control/edit.cxx M vcl/source/gdi/outdev3.cxx M vcl/source/gdi/pdfwriter_impl.cxx M vcl/source/window/status.cxx 18 files changed, 65 insertions(+), 66 deletions(-) diff --git a/include/rtl/string.h b/include/rtl/string.h index 93cffa1..e9825d4 100644 --- a/include/rtl/string.h +++ b/include/rtl/string.h @@ -31,6 +31,9 @@ extern "C" { #endif +#define RTL_CHAR_CR ('\x0D') +#define RTL_CHAR_LF ('\x0A') + /* ======================================================================= */ /** Return the length of a string. diff --git a/include/tools/solar.h b/include/tools/solar.h index 7ef683f..0645a61 100644 --- a/include/tools/solar.h +++ b/include/tools/solar.h @@ -107,9 +107,6 @@ #endif #endif -#define _LF ((char)0x0A) -#define _CR ((char)0x0D) - // pragmas #if defined _MSC_VER diff --git a/sc/source/core/tool/formularesult.cxx b/sc/source/core/tool/formularesult.cxx index c044ec1..01d00c7 100644 --- a/sc/source/core/tool/formularesult.cxx +++ b/sc/source/core/tool/formularesult.cxx @@ -261,7 +261,7 @@ if (meMultiline == MULTILINE_UNKNOWN) { const String& rStr = GetString(); - if (rStr.Len() && rStr.Search( _LF ) != STRING_NOTFOUND) + if (rStr.Len() && rStr.Search( RTL_CHAR_LF ) != STRING_NOTFOUND) const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_TRUE; else const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_FALSE; diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 1517c81..9b988be 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1159,7 +1159,7 @@ else { String aStr = aStrOut; - xub_StrLen nPos = aStr.Search( _LF ); + xub_StrLen nPos = aStr.Search( RTL_CHAR_LF ); if ( nPos == STRING_NOTFOUND ) { OUT_STR( aStrOut ); @@ -1174,7 +1174,7 @@ TAG_ON( OOO_STRING_SVTOOLS_HTML_linebreak ); nStartPos = nPos + 1; } - while( ( nPos = aStr.Search( _LF, nStartPos ) ) != STRING_NOTFOUND ); + while( ( nPos = aStr.Search( RTL_CHAR_LF, nStartPos ) ) != STRING_NOTFOUND ); String aSingleLine( aStr, nStartPos, aStr.Len() - nStartPos ); OUT_STR( aSingleLine ); } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c99ca76..5e20522 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1759,7 +1759,7 @@ sal_Int32 nPos = rStr.indexOf(rTextSep); rNeedQuotes = rAsciiOpt.bQuoteAllText || (nPos >= 0) || (rStr.indexOf(rFieldSep) >= 0) || - (rStr.indexOf(sal_Unicode(_LF)) >= 0); + (rStr.indexOf(sal_Unicode(RTL_CHAR_LF)) >= 0); return nPos; } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index b6c4869..8dc1b90 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -528,13 +528,13 @@ switch ( rStrm.GetLineDelimiter() ) { case LINEEND_CR : - rStrm << sal_Unicode(_CR); + rStrm << sal_Unicode(RTL_CHAR_CR); break; case LINEEND_LF : - rStrm << sal_Unicode(_LF); + rStrm << sal_Unicode(RTL_CHAR_LF); break; default: - rStrm << sal_Unicode(_CR) << sal_Unicode(_LF); + rStrm << sal_Unicode(RTL_CHAR_CR) << sal_Unicode(RTL_CHAR_LF); } } else @@ -727,7 +727,7 @@ else rString.SearchAndReplaceAll( OUString(DOUBLE_DOUBLEQUOTE), OUString('"') ); - rString.SearchAndReplaceAll( OUString(SYLK_LF), OUString(_LF) ); + rString.SearchAndReplaceAll( OUString(SYLK_LF), OUString(RTL_CHAR_LF) ); } static const sal_Unicode* lcl_ScanSylkString( const sal_Unicode* p, @@ -1196,7 +1196,7 @@ } // Standard or date not determined -> SetString / EditCell - if( rStr.Search( _LF ) == STRING_NOTFOUND ) + if( rStr.Search( RTL_CHAR_LF ) == STRING_NOTFOUND ) { ScSetStringParam aParam; aParam.mpNumFormatter = pFormatter; @@ -1571,8 +1571,8 @@ switch (c) { - case _LF: - case _CR: + case RTL_CHAR_LF: + case RTL_CHAR_CR: // line break found. return true; default: @@ -1626,11 +1626,11 @@ { aCell = pDoc->GetString(nCol, nRow, nStartTab); - bool bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND ); + bool bMultiLineText = ( aCell.Search( RTL_CHAR_LF ) != STRING_NOTFOUND ); if( bMultiLineText ) { if( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSpace ) - aCell.SearchAndReplaceAll( _LF, ' ' ); + aCell.SearchAndReplaceAll( RTL_CHAR_LF, ' ' ); else if ( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSystem && bConvertLF ) aCell = convertLineEnd(aCell, GetSystemLineEnd()); } @@ -1658,11 +1658,11 @@ { aCell = pDoc->GetString(nCol, nRow, nStartTab); - bool bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND ); + bool bMultiLineText = ( aCell.Search( RTL_CHAR_LF ) != STRING_NOTFOUND ); if( bMultiLineText ) { if( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSpace ) - aCell.SearchAndReplaceAll( _LF, ' ' ); + aCell.SearchAndReplaceAll( RTL_CHAR_LF, ' ' ); else if ( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSystem && bConvertLF ) aCell = convertLineEnd(aCell, GetSystemLineEnd()); } @@ -2003,7 +2003,7 @@ case CELLTYPE_EDIT: hasstring: aCellStr = pDoc->GetString(nCol, nRow, aRange.aStart.Tab()); - aCellStr.SearchAndReplaceAll( OUString(_LF), OUString(SYLK_LF) ); + aCellStr.SearchAndReplaceAll( OUString(RTL_CHAR_LF), OUString(SYLK_LF) ); aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "C;X" )); aBufStr += OUString::number( c ); @@ -2397,7 +2397,7 @@ nLastOffset = aStr.getLength(); OUString aNext; rStream.ReadUniOrByteStringLine(aNext, rStream.GetStreamCharSet(), nArbitraryLineLengthLimit); - aStr += OUString( sal_Unicode(_LF)); + aStr += OUString( sal_Unicode(RTL_CHAR_LF)); aStr += aNext; } } diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx index 7e7ab2e..4f8ac80 100644 --- a/svl/source/items/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -227,7 +227,7 @@ XubString aStr(convertLineEnd(rStr, LINEEND_CR)); do { - nDelimPos = aStr.Search( _CR, nStart ); + nDelimPos = aStr.Search( RTL_CHAR_CR, nStart ); xub_StrLen nLen; if ( nDelimPos == STRING_NOTFOUND ) nLen = 0xffff; diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index d8d5080..afe8bc6 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2107,8 +2107,8 @@ if ( bHTTPEquiv || HTML_META_DESCRIPTION != nAction ) { // if it is not a Description, remove CRs and LFs from CONTENT - aContent = comphelper::string::remove(aContent, _CR); - aContent = comphelper::string::remove(aContent, _LF); + aContent = comphelper::string::remove(aContent, RTL_CHAR_CR); + aContent = comphelper::string::remove(aContent, RTL_CHAR_LF); } else { diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 093d58b..5c722d1 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -1680,8 +1680,8 @@ // geloescht werden. if( !bKeepCRLFInValue ) { - sText = comphelper::string::remove(sText, _CR); - sText = comphelper::string::remove(sText, _LF); + sText = comphelper::string::remove(sText, RTL_CHAR_CR); + sText = comphelper::string::remove(sText, RTL_CHAR_LF); } const uno::Reference< XMultiServiceFactory > & rServiceFactory = diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index dc08ad5..b114a9a 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5422,8 +5422,8 @@ aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_script_type ) ) return; - aContent = comphelper::string::remove(aContent, _CR); - aContent = comphelper::string::remove(aContent, _LF); + aContent = comphelper::string::remove(aContent, RTL_CHAR_CR); + aContent = comphelper::string::remove(aContent, RTL_CHAR_LF); if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_sdendnote ) ) { diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx index cf9ff24..cbbbab7 100644 --- a/sw/source/ui/misc/redlndlg.cxx +++ b/sw/source/ui/misc/redlndlg.cxx @@ -434,7 +434,7 @@ { // update only comment String sComment(rRedln.GetComment()); - sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' '); + sComment.SearchAndReplaceAll((sal_Unicode)RTL_CHAR_LF,(sal_Unicode)' '); pTable->SetEntryText(sComment, pParent->pTLBParent, 3); } pParent->sComment = rRedln.GetComment(); @@ -721,7 +721,7 @@ pRedlineParent->pData = pRedlineData; pRedlineParent->pNext = 0; String sComment(rRedln.GetComment()); - sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' '); + sComment.SearchAndReplaceAll((sal_Unicode)RTL_CHAR_LF,(sal_Unicode)' '); pRedlineParent->sComment = sComment; aRedlineParents.insert(aRedlineParents.begin() + i, pRedlineParent); @@ -1108,7 +1108,7 @@ // insert / change comment pSh->SetRedlineComment(sMsg); - sMsg.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' '); + sMsg.SearchAndReplaceAll((sal_Unicode)RTL_CHAR_LF,(sal_Unicode)' '); pTable->SetEntryText(sMsg, pEntry, 3); } diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index 854136e..725878f 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.cxx @@ -376,18 +376,18 @@ if ( pData->meLineEnd == LINEEND_CR ) { - aLineEndBuf[0] = _CR; + aLineEndBuf[0] = RTL_CHAR_CR; nLineEndLen = 1; } else if ( pData->meLineEnd == LINEEND_LF ) { - aLineEndBuf[0] = _LF; + aLineEndBuf[0] = RTL_CHAR_LF; nLineEndLen = 1; } else { - aLineEndBuf[0] = _CR; - aLineEndBuf[1] = _LF; + aLineEndBuf[0] = RTL_CHAR_CR; + aLineEndBuf[1] = RTL_CHAR_LF; nLineEndLen = 2; } diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 6d58253..2668a50 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -28,7 +28,6 @@ #include "boost/static_assert.hpp" -#include <tools/solar.h> #include <osl/endian.h> #include <comphelper/string.hxx> @@ -1641,11 +1640,11 @@ { LineEnd eDelim = rStr.GetLineDelimiter(); if ( eDelim == LINEEND_CR ) - rStr << _CR; + rStr << RTL_CHAR_CR; else if( eDelim == LINEEND_LF ) - rStr << _LF; + rStr << RTL_CHAR_LF; else - rStr << _CR << _LF; + rStr << RTL_CHAR_CR << RTL_CHAR_LF; return rStr; } @@ -1654,13 +1653,13 @@ switch ( rStrm.GetLineDelimiter() ) { case LINEEND_CR : - rStrm << sal_Unicode(_CR); + rStrm << sal_Unicode(RTL_CHAR_CR); break; case LINEEND_LF : - rStrm << sal_Unicode(_LF); + rStrm << sal_Unicode(RTL_CHAR_LF); break; default: - rStrm << sal_Unicode(_CR) << sal_Unicode(_LF); + rStrm << sal_Unicode(RTL_CHAR_CR) << sal_Unicode(RTL_CHAR_LF); } return rStrm; } @@ -2035,7 +2034,7 @@ while (i < nStrLen) { // \r or \n causes linebreak - if ( (rIn[i] == _CR) || (rIn[i] == _LF) ) + if ( (rIn[i] == RTL_CHAR_CR) || (rIn[i] == RTL_CHAR_LF) ) { nLen = nLen + nLineEndLen; @@ -2043,17 +2042,17 @@ if ( !bConvert ) { // Muessen wir Konvertieren - if ( ((eLineEnd != LINEEND_LF) && (rIn[i] == _LF)) || - ((eLineEnd == LINEEND_CRLF) && (rIn[i+1] != _LF)) || + if ( ((eLineEnd != LINEEND_LF) && (rIn[i] == RTL_CHAR_LF)) || + ((eLineEnd == LINEEND_CRLF) && (rIn[i+1] != RTL_CHAR_LF)) || ((eLineEnd == LINEEND_LF) && - ((rIn[i] == _CR) || (rIn[i+1] == _CR))) || + ((rIn[i] == RTL_CHAR_CR) || (rIn[i+1] == RTL_CHAR_CR))) || ((eLineEnd == LINEEND_CR) && - ((rIn[i] == _LF) || (rIn[i+1] == _LF))) ) + ((rIn[i] == RTL_CHAR_LF) || (rIn[i+1] == RTL_CHAR_LF))) ) bConvert = true; } // skip char if \r\n oder \n\r - if ( ((rIn[i+1] == _CR) || (rIn[i+1] == _LF)) && + if ( ((rIn[i+1] == RTL_CHAR_CR) || (rIn[i+1] == RTL_CHAR_LF)) && (rIn[i] != rIn[i+1]) ) ++i; } @@ -2071,22 +2070,22 @@ while (i < nStrLen) { // \r or \n causes linebreak - if ( (rIn[i] == _CR) || (rIn[i] == _LF) ) + if ( (rIn[i] == RTL_CHAR_CR) || (rIn[i] == RTL_CHAR_LF) ) { if ( eLineEnd == LINEEND_CRLF ) { - aNewData.append(_CR); - aNewData.append(_LF); + aNewData.append(RTL_CHAR_CR); + aNewData.append(RTL_CHAR_LF); } else { if ( eLineEnd == LINEEND_CR ) - aNewData.append(_CR); + aNewData.append(RTL_CHAR_CR); else - aNewData.append(_LF); + aNewData.append(RTL_CHAR_LF); } - if ( ((rIn[i+1] == _CR) || (rIn[i+1] == _LF)) && + if ( ((rIn[i+1] == RTL_CHAR_CR) || (rIn[i+1] == RTL_CHAR_LF)) && (rIn[i] != rIn[i+1]) ) ++i; } diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index 00e3d03..28b2f14 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -618,7 +618,7 @@ void DbgWindow::InsertLine( const OUString& rLine ) { OUString aStr = convertLineEnd(rLine, LINEEND_LF); - sal_Int32 nPos = aStr.indexOf( _LF ); + sal_Int32 nPos = aStr.indexOf( RTL_CHAR_LF ); sal_Bool bFirstEntry = sal_True; while ( nPos != -1 ) { @@ -631,7 +631,7 @@ bFirstEntry = sal_False; aStr = aStr.replaceAt( 0, nPos+1, "" ); - nPos = aStr.indexOf( _LF ); + nPos = aStr.indexOf( RTL_CHAR_LF ); } if ( maLstBox.GetEntryCount() >= DBGWIN_MAXLINES ) maLstBox.RemoveEntry( 0 ); @@ -1144,7 +1144,7 @@ sal_Int32 nFoundIndex; do { - nFoundIndex = aStr.indexOf( _LF, nStrIndex ); + nFoundIndex = aStr.indexOf( RTL_CHAR_LF, nStrIndex ); OUString aTextParagraph = aStr.copy( nStrIndex, nFoundIndex-nStrIndex ); if ( mbHelpText ) { diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index db44060..d5465c2 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -809,8 +809,8 @@ OUString Edit::ImplGetValidString( const OUString& rString ) const { OUString aValidString( rString ); - aValidString = comphelper::string::remove(aValidString, _LF); - aValidString = comphelper::string::remove(aValidString, _CR); + aValidString = comphelper::string::remove(aValidString, RTL_CHAR_LF); + aValidString = comphelper::string::remove(aValidString, RTL_CHAR_CR); aValidString = aValidString.replace('\t', ' '); return aValidString; } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index c1ee2f0..d8bf825 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -4710,7 +4710,7 @@ { sal_Int32 nBreakPos = nPos; - while ( ( nBreakPos < nLen ) && ( rStr[ nBreakPos ] != _CR ) && ( rStr[ nBreakPos ] != _LF ) ) + while ( ( nBreakPos < nLen ) && ( rStr[ nBreakPos ] != RTL_CHAR_CR ) && ( rStr[ nBreakPos ] != RTL_CHAR_LF ) ) nBreakPos++; long nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); @@ -4859,11 +4859,11 @@ nBreakPos++; nPos = nBreakPos; - if ( ( rStr[ nPos ] == _CR ) || ( rStr[ nPos ] == _LF ) ) + if ( ( rStr[ nPos ] == RTL_CHAR_CR ) || ( rStr[ nPos ] == RTL_CHAR_LF ) ) { nPos++; // CR/LF? - if ( ( nPos < nLen ) && ( rStr[ nPos ] == _LF ) && ( rStr[ nPos-1 ] == _CR ) ) + if ( ( nPos < nLen ) && ( rStr[ nPos ] == RTL_CHAR_LF ) && ( rStr[ nPos-1 ] == RTL_CHAR_CR ) ) nPos++; } } @@ -4873,8 +4873,8 @@ { ImplTextLineInfo* pLine = rLineInfo.GetLine( nL ); String aLine( rStr, pLine->GetIndex(), pLine->GetLen() ); - DBG_ASSERT( aLine.Search( _CR ) == STRING_NOTFOUND, "ImplGetTextLines - Found CR!" ); - DBG_ASSERT( aLine.Search( _LF ) == STRING_NOTFOUND, "ImplGetTextLines - Found LF!" ); + DBG_ASSERT( aLine.Search( RTL_CHAR_CR ) == STRING_NOTFOUND, "ImplGetTextLines - Found CR!" ); + DBG_ASSERT( aLine.Search( RTL_CHAR_LF ) == STRING_NOTFOUND, "ImplGetTextLines - Found LF!" ); } #endif @@ -6253,7 +6253,7 @@ xub_StrLen nLastLineLen = aLastLine.Len(); for ( i = 0; i < nLastLineLen; i++ ) { - if ( aLastLine.GetChar( i ) == _LF ) + if ( aLastLine.GetChar( i ) == RTL_CHAR_LF ) aLastLine.SetChar( i, ' ' ); } aLastLine = ImplGetEllipsisString( rTargetDevice, aLastLine, nWidth, nStyle, _rLayout ); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6eefa3c..dcd9af9 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -8134,7 +8134,7 @@ pLineInfo = aMultiLineInfo.GetLine( nFormatLines ); aLastLine = convertLineEnd(aStr.Copy(pLineInfo->GetIndex()), LINEEND_LF); // replace line feed by space - aLastLine = aLastLine.replace(_LF, ' '); + aLastLine = aLastLine.replace(RTL_CHAR_LF, ' '); aLastLine = m_pReferenceDevice->GetEllipsisString( aLastLine, nWidth, nStyle ); nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM); nStyle |= TEXT_DRAW_TOP; diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index cb82af6..e900d96 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -364,7 +364,7 @@ { // Position ermitteln XubString aStr = GetText(); - sal_uInt16 nPos = aStr.Search( _LF ); + sal_uInt16 nPos = aStr.Search( RTL_CHAR_LF ); if ( nPos != STRING_NOTFOUND ) aStr.Erase( nPos ); -- To view, visit https://gerrit.libreoffice.org/3740 To unsubscribe, visit https://gerrit.libreoffice.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I05b0325006845e48eb5483485a9042aa7b0cd22a Gerrit-PatchSet: 1 Gerrit-Project: core Gerrit-Branch: master Gerrit-Owner: Marcos Souza <marcos.souza....@gmail.com> _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice