Debugger: Fix compiler warning

Losing precision in case of 64 bit ints is ok in readNumericVectorHelper,
as the result is only used to plot data.

Change-Id: I7f0e4c332ee8302b0bb774a7eca2ff5823c37eac
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
hjk
2015-07-14 12:39:53 +02:00
parent 029b83b8dc
commit 6f38873a3c

View File

@@ -645,7 +645,12 @@ template <class T>
void readNumericVectorHelper(std::vector<double> *v, const QByteArray &ba) void readNumericVectorHelper(std::vector<double> *v, const QByteArray &ba)
{ {
const T *p = (const T *) ba.data(); const T *p = (const T *) ba.data();
std::copy(p, p + ba.size() / sizeof(T), std::back_insert_iterator<std::vector<double> >(*v)); const int n = ba.size() / sizeof(T);
v->resize(n);
// Losing precision in case of 64 bit ints is ok here, as the result
// is only used to plot data.
for (int i = 0; i != n; ++i)
(*v)[i] = static_cast<double>(p[i]);
} }
void readNumericVector(std::vector<double> *v, const QByteArray &rawData, DebuggerEncoding encoding) void readNumericVector(std::vector<double> *v, const QByteArray &rawData, DebuggerEncoding encoding)