Skip to content
Snippets Groups Projects
Commit 5b040b85 authored by Chao Peng's avatar Chao Peng
Browse files

fix some warnings

parent 21bd1b26
Branches
No related tags found
No related merge requests found
......@@ -34,7 +34,7 @@ struct WFData {
// calculate mean and standard deviation of an array
template<typename T>
inline void _calc_mean_err(double &mean, double &err, T *source, size_t npts)
inline void _calc_mean_err(double &mean, double &err, const T *source, size_t npts)
{
if (npts == 0) { return; }
......@@ -53,7 +53,7 @@ inline void _calc_mean_err(double &mean, double &err, T *source, size_t npts)
}
template<typename T>
inline void _linear_regr(double &p0, double &p1, double &err, T *x, T *y, size_t npts)
inline void _linear_regr(double &p0, double &p1, double &err, const T *x, const T *y, size_t npts)
{
// no data points
if (npts == 0) {
......@@ -96,7 +96,7 @@ public:
: thres(threshold), res(resolution) {}
~Analyzer() {}
WFData Analyze(uint32_t *samples, size_t nsamples)
WFData Analyze(const uint32_t *samples, size_t nsamples)
{
WFData data;
if (!nsamples) { return data; }
......@@ -142,7 +142,7 @@ public:
return false;
};
int nped = 0;
size_t nped = 0;
auto ybuf = buffer;
for (size_t i = res + 1; i < nsamples - res - 1; ++i) {
if (!in_peaks(candidates, i)) {
......@@ -221,7 +221,7 @@ private:
public:
// static methods
template<typename T>
static std::vector<double> SmoothSpectrum(T *samples, size_t nsamples, size_t res)
static std::vector<double> SmoothSpectrum(const T *samples, size_t nsamples, size_t res)
{
std::vector<double> buffer(nsamples);
for (size_t i = 0; i < nsamples; ++i) {
......@@ -245,7 +245,7 @@ public:
_calc_mean_err(res.mean, res.err, ybuf, npts);
// interatively fit
while (max_iters-- > 0) {
int count = 0;
size_t count = 0;
for (size_t i = 0; i < npts; ++i) {
if (std::abs(ybuf[i] - res.mean) < res.err*thres) {
ybuf[count] = ybuf[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment