The return value of std::count_if is guaranteed to be non-negative
...so use o3tl::make_unsigned when comparing it against an expression of unsigned integer type, instead of casting that expression to a signed type Change-Id: I487fd04eafbf8c56b8b6bfce579b477d8f34a052 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135206 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <eventqueue.hxx>
|
||||
#include "nodetools.hxx"
|
||||
#include <delayevent.hxx>
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <sal/log.hxx>
|
||||
|
||||
#include <functional>
|
||||
@@ -80,10 +81,10 @@ bool BaseContainerNode::init_children()
|
||||
mnFinishedChildren = 0;
|
||||
|
||||
// initialize all children
|
||||
return (std::count_if(
|
||||
return (o3tl::make_unsigned(std::count_if(
|
||||
maChildren.begin(), maChildren.end(),
|
||||
std::mem_fn(&AnimationNode::init) ) ==
|
||||
static_cast<VectorOfNodes::difference_type>(maChildren.size()));
|
||||
std::mem_fn(&AnimationNode::init) )) ==
|
||||
maChildren.size());
|
||||
}
|
||||
|
||||
void BaseContainerNode::deactivate_st( NodeState eDestState )
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include "viewappletshape.hxx"
|
||||
#include <tools.hxx>
|
||||
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -210,12 +211,12 @@ namespace slideshow::internal
|
||||
bool AppletShape::implRender( const ::basegfx::B2DRange& rCurrBounds ) const
|
||||
{
|
||||
// redraw all view shapes, by calling their update() method
|
||||
if( ::std::count_if( maViewAppletShapes.begin(),
|
||||
if( o3tl::make_unsigned(::std::count_if( maViewAppletShapes.begin(),
|
||||
maViewAppletShapes.end(),
|
||||
[&rCurrBounds]
|
||||
( const ViewAppletShapeSharedPtr& pShape )
|
||||
{ return pShape->render( rCurrBounds ); } )
|
||||
!= static_cast<ViewAppletShapeVector::difference_type>(maViewAppletShapes.size()) )
|
||||
{ return pShape->render( rCurrBounds ); } ))
|
||||
!= maViewAppletShapes.size() )
|
||||
{
|
||||
// at least one of the ViewShape::update() calls did return
|
||||
// false - update failed on at least one ViewLayer
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
|
||||
#include <sal/log.hxx>
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -258,11 +259,11 @@ namespace slideshow::internal
|
||||
}
|
||||
|
||||
// redraw all view shapes, by calling their render() method
|
||||
if( ::std::count_if( maViewShapes.begin(),
|
||||
if( o3tl::make_unsigned(::std::count_if( maViewShapes.begin(),
|
||||
maViewShapes.end(),
|
||||
[this]( const ViewBackgroundShapeSharedPtr& pBgShape )
|
||||
{ return pBgShape->render( this->mpMtf ); } )
|
||||
!= static_cast<ViewBackgroundShapeVector::difference_type>(maViewShapes.size()) )
|
||||
{ return pBgShape->render( this->mpMtf ); } ))
|
||||
!= maViewShapes.size() )
|
||||
{
|
||||
// at least one of the ViewBackgroundShape::render() calls did return
|
||||
// false - update failed on at least one ViewLayer
|
||||
|
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <sal/log.hxx>
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <o3tl/safeint.hxx>
|
||||
|
||||
#include <vcl/metaact.hxx>
|
||||
#include <vcl/gdimtf.hxx>
|
||||
@@ -146,15 +147,15 @@ namespace slideshow::internal
|
||||
// redraw all view shapes, by calling their update() method
|
||||
ViewShape::RenderArgs renderArgs( getViewRenderArgs() );
|
||||
bool bVisible = isVisible();
|
||||
if( ::std::count_if( maViewShapes.begin(),
|
||||
if( o3tl::make_unsigned(::std::count_if( maViewShapes.begin(),
|
||||
maViewShapes.end(),
|
||||
[this, &bVisible, &renderArgs, &nUpdateFlags]
|
||||
( const ViewShapeSharedPtr& pShape )
|
||||
{ return pShape->update( this->mpCurrMtf,
|
||||
renderArgs,
|
||||
nUpdateFlags,
|
||||
bVisible ); } )
|
||||
!= static_cast<ViewShapeVector::difference_type>(maViewShapes.size()) )
|
||||
bVisible ); } ))
|
||||
!= maViewShapes.size() )
|
||||
{
|
||||
// at least one of the ViewShape::update() calls did return
|
||||
// false - update failed on at least one ViewLayer
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
|
||||
#include <com/sun/star/drawing/XShape.hpp>
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
#include "mediashape.hxx"
|
||||
@@ -175,12 +176,12 @@ namespace slideshow::internal
|
||||
bool MediaShape::implRender( const ::basegfx::B2DRange& rCurrBounds ) const
|
||||
{
|
||||
// redraw all view shapes, by calling their update() method
|
||||
if( ::std::count_if( maViewMediaShapes.begin(),
|
||||
if( o3tl::make_unsigned(::std::count_if( maViewMediaShapes.begin(),
|
||||
maViewMediaShapes.end(),
|
||||
[&rCurrBounds]
|
||||
( const ViewMediaShapeSharedPtr& pShape )
|
||||
{ return pShape->render( rCurrBounds ); } )
|
||||
!= static_cast<ViewMediaShapeVector::difference_type>(maViewMediaShapes.size()) )
|
||||
{ return pShape->render( rCurrBounds ); } ))
|
||||
!= maViewMediaShapes.size() )
|
||||
{
|
||||
// at least one of the ViewShape::update() calls did return
|
||||
// false - update failed on at least one ViewLayer
|
||||
|
Reference in New Issue
Block a user