Skip to content

Commit

Permalink
Fixed several issues reported by PVS Studio static analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
sadko4u committed Sep 3, 2023
1 parent e88ca6e commit 15050d7
Show file tree
Hide file tree
Showing 42 changed files with 287 additions and 380 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*******************************************************************************

=== 1.0.14 ===
* Fixed several issues reported by PVS Studio static analyzer.
* Fixed band characteristics report for FFTCrossover.

=== 1.0.13 ===
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,22 @@ Set of modules provided:
* Spectrum analyzer


Supported platforms
======
## Supported platforms

The build and correct unit test execution has been confirmed for following platforms:
* FreeBSD
* GNU/Linux
* Windows 32-bit
* Windows 64-bit

Requirements
======
## Requirements

The following packages need to be installed for building:

* gcc >= 4.9
* GNU make >= 4.0

Building
======
## Building

To build the library, perform the following commands:

Expand Down Expand Up @@ -114,8 +111,7 @@ To build source code archive with all possible dependencies, run:
make distsrc
```

Usage
======
## Usage

Here's the code snippet of how the library can be initialized and used in C++:

Expand Down Expand Up @@ -200,3 +196,7 @@ int main(int argc, const char **argv)
return res;
}
```
## SAST Tools
* [PVS-Studio](https://pvs-studio.com/en/pvs-studio/?utm_source=website&utm_medium=github&utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code.
22 changes: 10 additions & 12 deletions include/lsp-plug.in/dsp-units/3d/RayTrace3D.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2021 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2021 Vladimir Sadovnikov <[email protected]>
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <[email protected]>
*
* This file is part of lsp-dsp-units
* Created on: 10 авг. 2021 г.
Expand Down Expand Up @@ -90,10 +90,10 @@ namespace lsp
private:
RayTrace3D *trace;
stats_t stats;
ssize_t heavy_state;
lltl::parray<rt::context_t> tasks;
lltl::parray<rt_binding_t> bindings; // Bindings
lltl::parray<rt_object_t> objects;
ssize_t heavy_state;

protected:
status_t main_loop();
Expand Down Expand Up @@ -173,16 +173,14 @@ namespace lsp
status_t do_process(size_t threads, float initial);

public:
/** Default constructor
*
*/
explicit RayTrace3D();

/** Destructor
*
*/
RayTrace3D(const RayTrace3D &) = delete;
RayTrace3D(RayTrace3D &&) = delete;
~RayTrace3D();

RayTrace3D & operator = (const RayTrace3D &) = delete;
RayTrace3D & operator = (RayTrace3D &&) = delete;

public:
/**
* Initialize raytrace object
Expand Down Expand Up @@ -320,8 +318,8 @@ namespace lsp
status_t process(size_t threads, float initial);
};

} // namespace dspu
} // namespace lsp
} /* namespace dspu */
} /* namespace lsp */



Expand Down
17 changes: 9 additions & 8 deletions include/lsp-plug.in/dsp-units/filters/SpectralTilt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2021 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2021 Stefano Tronci <[email protected]>
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Stefano Tronci <[email protected]>
*
* This file is part of lsp-dsp-units
* Created on: 15 Sept 2021
Expand Down Expand Up @@ -66,10 +66,6 @@ namespace lsp

class LSP_DSP_UNITS_PUBLIC SpectralTilt
{
private:
SpectralTilt & operator = (const SpectralTilt &);
SpectralTilt(const SpectralTilt &);

protected:

typedef struct bilinear_spec_t
Expand Down Expand Up @@ -101,8 +97,13 @@ namespace lsp

public:
explicit SpectralTilt();
SpectralTilt(const SpectralTilt &) = delete;
SpectralTilt(SpectralTilt &&) = delete;
~SpectralTilt();

SpectralTilt & operator = (const SpectralTilt &) = delete;
SpectralTilt & operator = (SpectralTilt &&) = delete;

void construct();
void destroy();

Expand Down Expand Up @@ -209,7 +210,7 @@ namespace lsp
void dump(IStateDumper *v) const;
};

}
}
} /* namespace dspu */
} /* namespace lsp */

#endif /* LSP_PLUG_IN_DSP_UNITS_FILTERS_SPECTRALTILT_H_ */
5 changes: 2 additions & 3 deletions include/lsp-plug.in/dsp-units/noise/Generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ namespace lsp
{
NG_GEN_MLS,
NG_GEN_LCG,
NG_GEN_VELVET,
NG_GEN_MAX
NG_GEN_VELVET
};

enum ng_color_t
Expand All @@ -48,7 +47,7 @@ namespace lsp
NG_COLOR_BLUE,
NG_COLOR_VIOLET,
NG_COLOR_ARBITRARY,
NG_COLOR_MAX,

NG_COLOR_BROWN = NG_COLOR_RED,
NG_COLOR_BROWNIAN = NG_COLOR_RED
};
Expand Down
23 changes: 10 additions & 13 deletions include/lsp-plug.in/dsp-units/noise/LCG.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2021 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2021 Stefano Tronci <[email protected]>
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Stefano Tronci <[email protected]>
*
* This file is part of lsp-dsp-units
* Created on: 13 Jun 2021
Expand Down Expand Up @@ -34,8 +34,7 @@ namespace lsp
LCG_UNIFORM, // Uniform over [-1, 1), X fAmplitude + fOffset
LCG_EXPONENTIAL, // Double sided exponential over [-1, 1], X fAmplitude + fOffset
LCG_TRIANGULAR, // Triangular over [-1, 1], X fAmplitude + fOffset
LCG_GAUSSIAN, // Gaussian of mean 0 and standard deviation 1, X fAmplitude + fOffset
LCG_MAX
LCG_GAUSSIAN // Gaussian of mean 0 and standard deviation 1, X fAmplitude + fOffset
};

/** LCG stands for Linear Congruential Generator.
Expand All @@ -47,10 +46,6 @@ namespace lsp
*/
class LSP_DSP_UNITS_PUBLIC LCG
{
private:
LCG & operator = (const LCG &);
LCG(const LCG &);

private:
lcg_dist_t enDistribution;

Expand All @@ -61,8 +56,13 @@ namespace lsp

public:
explicit LCG();
LCG(const LCG &) = delete;
LCG(LCG &&) = delete;
~LCG();

LCG & operator = (const LCG &) = delete;
LCG & operator = (LCG &) = delete;

void construct();
void destroy();

Expand All @@ -84,9 +84,6 @@ namespace lsp
*/
inline void set_distribution(lcg_dist_t dist)
{
if ((dist < LCG_UNIFORM) || (dist >= LCG_MAX))
return;

enDistribution = dist;
}

Expand Down Expand Up @@ -150,7 +147,7 @@ namespace lsp
*/
void dump(IStateDumper *v) const;
};
}
}
} /* namespace dspu */
} /* namespace lsp */

#endif /* LSP_PLUG_IN_DSP_UNITS_NOISE_LCG_H_ */
14 changes: 6 additions & 8 deletions include/lsp-plug.in/dsp-units/noise/Velvet.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2021 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2021 Stefano Tronci <[email protected]>
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Stefano Tronci <[email protected]>
*
* This file is part of lsp-dsp-units
* Created on: 27 Jun 2021
Expand Down Expand Up @@ -33,17 +33,15 @@ namespace lsp
enum vn_core_t
{
VN_CORE_MLS, // Only compatible with OVN, OVNA and ARN (not crushed)
VN_CORE_LCG,
VN_CORE_MAX
VN_CORE_LCG
};

enum vn_velvet_type_t
{
VN_VELVET_OVN,
VN_VELVET_OVNA,
VN_VELVET_ARN,
VN_VELVET_TRN,
VN_VELVET_MAX
VN_VELVET_TRN
};

/** As in GENERALIZATIONS OF VELVET NOISE AND THEIR USE IN 1-BIT MUSIC by Kurt James Werner
Expand Down Expand Up @@ -199,7 +197,7 @@ namespace lsp
*/
void dump(IStateDumper *v) const;
};
}
}
} /* namespace dspu */
} /* namespace lsp */

#endif /* LSP_PLUG_IN_DSP_UNITS_NOISE_VELVET_H_ */
10 changes: 5 additions & 5 deletions include/lsp-plug.in/dsp-units/sampling/Playback.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2022 Vladimir Sadovnikov <[email protected]>
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <[email protected]>
*
* This file is part of lsp-dsp-units
* Created on: 18 нояб. 2022 г.
Expand Down Expand Up @@ -52,12 +52,12 @@ namespace lsp
Playback(Playback &&src);
~Playback();

Playback & operator = (const Playback & src);
Playback & operator = (Playback && src);

void construct();
void destroy();

public:
Playback & operator = (const Playback & src);

public:
/**
* Check that playback is still valid. Should be called before reading playback parameters
Expand Down
13 changes: 7 additions & 6 deletions include/lsp-plug.in/dsp-units/sampling/SamplePlayer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2020 Vladimir Sadovnikov <[email protected]>
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <[email protected]>
*
* This file is part of lsp-dsp-units
* Created on: 13 марта 2016 г.
Expand Down Expand Up @@ -35,10 +35,6 @@ namespace lsp
{
class LSP_DSP_UNITS_PUBLIC SamplePlayer
{
private:
SamplePlayer & operator = (const SamplePlayer &);
SamplePlayer(const SamplePlayer &);

protected:
typedef struct play_item_t: public playback::playback_t
{
Expand Down Expand Up @@ -81,8 +77,13 @@ namespace lsp

public:
explicit SamplePlayer();
SamplePlayer(const SamplePlayer &) = delete;
SamplePlayer(SamplePlayer &&) = delete;
~SamplePlayer();

SamplePlayer & operator = (const SamplePlayer &) = delete;
SamplePlayer & operator = (SamplePlayer &&) = delete;

/**
* Construct sample player
*/
Expand Down
16 changes: 9 additions & 7 deletions include/lsp-plug.in/dsp-units/util/Convolver.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2020 Vladimir Sadovnikov <[email protected]>
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <[email protected]>
*
* This file is part of lsp-dsp-units
* Created on: 29 янв. 2016 г.
Expand Down Expand Up @@ -34,10 +34,6 @@ namespace lsp
{
class LSP_DSP_UNITS_PUBLIC Convolver
{
private:
Convolver & operator = (const Convolver &);
Convolver(const Convolver &);

private:
float *vDataBuffer; // Buffer for storing convolution tail data
float *vFrame; // Pointer to the beginning of the input data frame
Expand All @@ -62,8 +58,13 @@ namespace lsp

public:
explicit Convolver();
Convolver(const Convolver &) = delete;
Convolver(Convolver &&) = delete;
~Convolver();

Convolver & operator = (const Convolver &) = delete;
Convolver & operator = (Convolver &&) = delete;

/** Construct the convolver
*
*/
Expand Down Expand Up @@ -111,7 +112,8 @@ namespace lsp
*/
void dump(IStateDumper *v) const;
};
}

} /* namespace dspu */
} /* namespace lsp */

#endif /* LSP_PLUG_IN_DSP_UNITS_UTIL_CONVOLVER_H_ */
Loading

0 comments on commit 15050d7

Please sign in to comment.