Use for-range loops in drawinglayer and dtrans

Change-Id: I4d3368e2ffa4d98c04d69b8f5ef485558d812fda
Reviewed-on: https://gerrit.libreoffice.org/51047
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet
2018-03-10 17:00:23 +01:00
parent e917106613
commit 5a341e1267
5 changed files with 17 additions and 24 deletions

View File

@@ -99,9 +99,9 @@ namespace drawinglayer
if(getPositions().size()) if(getPositions().size())
{ {
// get the basic range from the position vector // get the basic range from the position vector
for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()), aEnd(getPositions().end()); aIter != aEnd; ++aIter) for (auto const& pos : getPositions())
{ {
aRetval.expand(*aIter); aRetval.expand(pos);
} }
if(!getMarker().IsEmpty()) if(!getMarker().IsEmpty())

View File

@@ -58,9 +58,9 @@ namespace drawinglayer
basegfx::B2DRange aNewRange; basegfx::B2DRange aNewRange;
// get the basic range from the position vector // get the basic range from the position vector
for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()), aEnd(getPositions().end()); aIter != aEnd; ++aIter) for (auto const& pos : getPositions())
{ {
aNewRange.expand(*aIter); aNewRange.expand(pos);
} }
// assign to buffered value // assign to buffered value

View File

@@ -235,10 +235,9 @@ namespace drawinglayer
const basegfx::B2DVector aPixelVector(maCurrentTransformation * basegfx::B2DVector(1.0, 0.0)); const basegfx::B2DVector aPixelVector(maCurrentTransformation * basegfx::B2DVector(1.0, 0.0));
const double fPixelVectorFactor(aPixelVector.getLength()); const double fPixelVectorFactor(aPixelVector.getLength());
for(std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin()); for (auto const& elem : rTextCandidate.getDXArray())
aStart != rTextCandidate.getDXArray().end(); ++aStart)
{ {
aTransformedDXArray.push_back(basegfx::fround((*aStart) * fPixelVectorFactor)); aTransformedDXArray.push_back(basegfx::fround(elem * fPixelVectorFactor));
} }
} }
@@ -921,9 +920,9 @@ namespace drawinglayer
mpOutputDevice->EnableMapMode(false); mpOutputDevice->EnableMapMode(false);
for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); ++aIter) for (auto const& pos : rPositions)
{ {
const basegfx::B2DPoint aDiscreteTopLeft((maCurrentTransformation * (*aIter)) - aDiscreteHalfSize); const basegfx::B2DPoint aDiscreteTopLeft((maCurrentTransformation * pos) - aDiscreteHalfSize);
const Point aDiscretePoint(basegfx::fround(aDiscreteTopLeft.getX()), basegfx::fround(aDiscreteTopLeft.getY())); const Point aDiscretePoint(basegfx::fround(aDiscreteTopLeft.getX()), basegfx::fround(aDiscreteTopLeft.getY()));
mpOutputDevice->DrawBitmapEx(aDiscretePoint + aOrigin, rMarker); mpOutputDevice->DrawBitmapEx(aDiscretePoint + aOrigin, rMarker);
@@ -941,9 +940,9 @@ namespace drawinglayer
const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rPointArrayCandidate.getRGBColor())); const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rPointArrayCandidate.getRGBColor()));
const Color aVCLColor(aRGBColor); const Color aVCLColor(aRGBColor);
for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); ++aIter) for (auto const& pos : rPositions)
{ {
const basegfx::B2DPoint aViewPosition(maCurrentTransformation * (*aIter)); const basegfx::B2DPoint aViewPosition(maCurrentTransformation * pos);
const Point aPos(basegfx::fround(aViewPosition.getX()), basegfx::fround(aViewPosition.getY())); const Point aPos(basegfx::fround(aViewPosition.getX()), basegfx::fround(aViewPosition.getY()));
mpOutputDevice->DrawPixel(aPos, aVCLColor); mpOutputDevice->DrawPixel(aPos, aVCLColor);

View File

@@ -157,12 +157,9 @@ void SAL_CALL ClipboardManager::dispose()
aGuard2.clear(); aGuard2.clear();
// dispose all clipboards still in list // dispose all clipboards still in list
ClipboardMap::iterator iter = aCopy.begin(); for (auto const& elem : aCopy)
ClipboardMap::iterator imax = aCopy.end();
for (; iter != imax; ++iter)
{ {
Reference< XComponent > xComponent(iter->second, UNO_QUERY); Reference< XComponent > xComponent(elem.second, UNO_QUERY);
if (xComponent.is()) if (xComponent.is())
{ {
try try

View File

@@ -347,10 +347,9 @@ size_t CalcSizeForStringListBuffer(const FileList_t& fileList)
return 0; return 0;
size_t size = 1; // one for the very final '\0' size_t size = 1; // one for the very final '\0'
FileList_t::const_iterator iter_end = fileList.end(); for (auto const& elem : fileList)
for (FileList_t::const_iterator iter = fileList.begin(); iter != iter_end; ++iter)
{ {
size += iter->length() + 1; // length including terminating '\0' size += elem.length() + 1; // length including terminating '\0'
} }
return (size * sizeof(FileList_t::value_type::value_type)); return (size * sizeof(FileList_t::value_type::value_type));
} }
@@ -366,12 +365,10 @@ ByteSequence_t FileListToByteSequence(const FileList_t& fileList)
wchar_t* p = reinterpret_cast<wchar_t*>(bseq.getArray()); wchar_t* p = reinterpret_cast<wchar_t*>(bseq.getArray());
ZeroMemory(p, size); ZeroMemory(p, size);
FileList_t::const_iterator iter; for (auto const& elem : fileList)
FileList_t::const_iterator iter_end = fileList.end();
for (iter = fileList.begin(); iter != iter_end; ++iter)
{ {
wcsncpy(p, iter->c_str(), iter->length()); wcsncpy(p, elem.c_str(), elem.length());
p += (iter->length() + 1); p += (elem.length() + 1);
} }
} }
return bseq; return bseq;