aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Utils.h
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2019-07-01 14:20:56 +0100
committerMichalis Spyrou <michalis.spyrou@arm.com>2019-07-05 10:49:38 +0000
commit53860dd80fd6e91ce04756032a969d4b37e00a61 (patch)
tree62db9128382bdbc8c169a3664b43c7aa18fa2e9e /arm_compute/core/Utils.h
parent7bb56c6337997281df10fa28ad7924c921b920eb (diff)
downloadComputeLibrary-53860dd80fd6e91ce04756032a969d4b37e00a61.tar.gz
COMPMID-2432 Fix defects reported by Coverity
Change-Id: I887eea57cc0202ad42b76b0ea093724943116a7e Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-on: https://review.mlplatform.org/c/1446 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'arm_compute/core/Utils.h')
-rw-r--r--arm_compute/core/Utils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/arm_compute/core/Utils.h b/arm_compute/core/Utils.h
index a37559d269..b0e26328ed 100644
--- a/arm_compute/core/Utils.h
+++ b/arm_compute/core/Utils.h
@@ -32,6 +32,7 @@
#include <algorithm>
#include <cstdint>
#include <cstdlib>
+#include <iomanip>
#include <numeric>
#include <sstream>
#include <string>
@@ -1150,6 +1151,8 @@ template <typename T>
void print_consecutive_elements_impl(std::ostream &s, const T *ptr, unsigned int n, int stream_width = 0, const std::string &element_delim = " ")
{
using print_type = typename std::conditional<std::is_floating_point<T>::value, T, int>::type;
+ std::ios stream_status(nullptr);
+ stream_status.copyfmt(s);
for(unsigned int i = 0; i < n; ++i)
{
@@ -1169,6 +1172,9 @@ void print_consecutive_elements_impl(std::ostream &s, const T *ptr, unsigned int
s << std::right << static_cast<print_type>(ptr[i]) << element_delim;
}
}
+
+ // Restore output stream flags
+ s.copyfmt(stream_status);
}
/** Identify the maximum width of n consecutive elements.