Fix many long to int conversion warnings:

- fix usage of Index (API) versus StorageIndex (when multiple indexes are stored)
 - use StorageIndex(val) when the input has already been check
 - use internal::convert_index<StorageIndex>(val) when val is potentially unsafe (directly comes from user input)
This commit is contained in:
Gael Guennebaud
2015-02-16 13:19:05 +01:00
parent fc202bab39
commit aa6c516ec1
37 changed files with 397 additions and 398 deletions

View File

@@ -66,9 +66,9 @@ class CwiseUnaryOp : public CwiseUnaryOpImpl<UnaryOp, XprType, typename internal
: m_xpr(xpr), m_functor(func) {}
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE StorageIndex rows() const { return m_xpr.rows(); }
EIGEN_STRONG_INLINE Index rows() const { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE StorageIndex cols() const { return m_xpr.cols(); }
EIGEN_STRONG_INLINE Index cols() const { return m_xpr.cols(); }
/** \returns the functor representing the unary operation */
EIGEN_DEVICE_FUNC

View File

@@ -147,7 +147,8 @@ class PermutationBase : public EigenBase<Derived>
/** Sets *this to be the identity permutation matrix */
void setIdentity()
{
for(Index i = 0; i < size(); ++i)
StorageIndex n = StorageIndex(size());
for(StorageIndex i = 0; i < n; ++i)
indices().coeffRef(i) = i;
}