Commit cf5e25a9 authored by Juha Reunanen's avatar Juha Reunanen Committed by Davis E. King
Browse files

Problem: integer overflow when calculating sizes (may happen e.g. with very large images) (#1148)

* Problem: integer overflow when calculating sizes (may happen e.g. with very large images)
Solution: change some types from (unsigned) long to size_t

# Conflicts:
#	dlib/dnn/tensor.h

* Fix the fact that std::numeric_limits<unsigned long>::max() isn't always the same number

* Revert serialization changes

* Review fix: use long long instead of size_t

* From long to long long all the way

* Change more types to (hopefully) make the compiler happy

* Change many more types to size_t

* Change even more types to size_t

* Minor type changes
parent 1cf6dbf4
...@@ -173,7 +173,7 @@ namespace dlib ...@@ -173,7 +173,7 @@ namespace dlib
- swaps *this with item - swaps *this with item
!*/ !*/
unsigned long size ( size_t size (
) const; ) const;
/*! /*!
ensures ensures
......
...@@ -151,7 +151,7 @@ namespace ...@@ -151,7 +151,7 @@ namespace
} }
} }
inline unsigned long size () const { return feat_image.size(); } inline size_t size () const { return feat_image.size(); }
inline long nr () const { return feat_image.nr(); } inline long nr () const { return feat_image.nr(); }
inline long nc () const { return feat_image.nc(); } inline long nc () const { return feat_image.nc(); }
......
...@@ -127,7 +127,7 @@ namespace dlib ...@@ -127,7 +127,7 @@ namespace dlib
bool move_next ( bool move_next (
) const { return list.move_next(); } ) const { return list.move_next(); }
unsigned long size ( size_t size (
) const { return list.size(); } ) const { return list.size(); }
}; };
......
...@@ -134,7 +134,7 @@ public: ...@@ -134,7 +134,7 @@ public:
} }
} }
inline unsigned long size () const { return feat_image.size(); } inline size_t size () const { return feat_image.size(); }
inline long nr () const { return feat_image.nr(); } inline long nr () const { return feat_image.nr(); }
inline long nc () const { return feat_image.nc(); } inline long nc () const { return feat_image.nc(); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment