1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-02 00:49:33 +02:00

Fix warnings reported by the pvs-studio team, all inconsequential

This commit is contained in:
Paul Licameli 2018-01-26 10:15:26 -05:00
commit b878b011ce
11 changed files with 36 additions and 23 deletions

View File

@ -306,8 +306,15 @@ sampleCount VoiceKey::OnBackward (
//Initialize these trend markers atrend and ztrend. They keep track of the
//up/down trends at the start and end of the evaluation window.
int atrend = sgn(buffer[remaining - 2]-buffer[remaining - 1]);
int ztrend = sgn(buffer[remaining - WindowSizeInt - 2] -
buffer[remaining - WindowSizeInt - 2]);
buffer[remaining - WindowSizeInt
// PVS-Studio detected a probable error here
// when it read - 2.
// is - 1 correct?
// This code is unused. I didn't study further.
- 1
]);
double erg=0;
double sc = 0;

View File

@ -369,8 +369,11 @@ bool EffectEqualization::ValidateUI()
{
// If editing a batch chain, we don't want to be using the unnamed curve so
// we offer to save it.
while (mDisallowCustom && mCurveName.IsSameAs(wxT("unnamed")))
if (mDisallowCustom && mCurveName.IsSameAs(wxT("unnamed")))
{
// PRL: This is unreachable. mDisallowCustom is always false.
Effect::MessageBox(_("To use this EQ curve in a batch chain, please choose a new name for it.\nChoose the 'Save/Manage Curves...' button and rename the 'unnamed' curve, then use that one."),
wxOK | wxCENTRE,
_("EQ Curve needs a different name"));

View File

@ -166,7 +166,7 @@ wxArrayString VampEffectsModule::FindPluginPaths(PluginManagerInterface & WXUNUS
if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
!j->hasFixedBinCount ||
(j->hasFixedBinCount && j->binCount > 1))
j->binCount > 1)
{
// All of these qualities disqualify (see notes above)
@ -299,7 +299,7 @@ std::unique_ptr<Vamp::Plugin> VampEffectsModule::FindPlugin(const wxString & pat
if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
!j->hasFixedBinCount ||
(j->hasFixedBinCount && j->binCount > 1))
j->binCount > 1)
{
// All of these qualities disqualify (see notes above)

View File

@ -227,7 +227,7 @@ ExportFFmpeg::ExportFFmpeg()
SetDescription(ExportFFmpegOptions::fmts[newfmt].Description(), fmtindex);
int canmeta = ExportFFmpegOptions::fmts[newfmt].canmetadata;
if (canmeta && (canmeta == AV_VERSION_INT(-1,-1,-1) || canmeta <= avfver))
if (canmeta && (canmeta == AV_CANMETA || canmeta <= avfver))
{
SetCanMetaData(true,fmtindex);
}

View File

@ -1218,11 +1218,11 @@ static wxString iAACProfileNames(int index)
/// List of export types
ExposedFormat ExportFFmpegOptions::fmts[] =
{
{FMT_M4A, wxT("M4A"), wxT("m4a"), wxT("ipod"), 48, AV_VERSION_INT(-1,-1,-1), true, XO("M4A (AAC) Files (FFmpeg)"), AV_CODEC_ID_AAC, true},
{FMT_M4A, wxT("M4A"), wxT("m4a"), wxT("ipod"), 48, AV_CANMETA, true, XO("M4A (AAC) Files (FFmpeg)"), AV_CODEC_ID_AAC, true},
{FMT_AC3, wxT("AC3"), wxT("ac3"), wxT("ac3"), 7, AV_VERSION_INT(0,0,0), false, XO("AC3 Files (FFmpeg)"), AV_CODEC_ID_AC3, true},
{FMT_AMRNB, wxT("AMRNB"), wxT("amr"), wxT("amr"), 1, AV_VERSION_INT(0,0,0), false, XO("AMR (narrow band) Files (FFmpeg)"), AV_CODEC_ID_AMR_NB, true},
{FMT_WMA2, wxT("WMA"), wxT("wma"), wxT("asf"), 2, AV_VERSION_INT(52,53,0), false, XO("WMA (version 2) Files (FFmpeg)"), AV_CODEC_ID_WMAV2, true},
{FMT_OTHER, wxT("FFMPEG"), wxT(""), wxT(""), 255, AV_VERSION_INT(-1,-1,-1), true, XO("Custom FFmpeg Export"), AV_CODEC_ID_NONE, true}
{FMT_OTHER, wxT("FFMPEG"), wxT(""), wxT(""), 255, AV_CANMETA, true, XO("Custom FFmpeg Export"), AV_CODEC_ID_NONE, true}
};
wxString ExposedFormat::Description() const

View File

@ -38,6 +38,8 @@ enum FFmpegExposedFormat
FMT_LAST
};
#define AV_CANMETA (AV_VERSION_INT(255, 255, 255))
/// Describes export type
struct ExposedFormat
{
@ -46,7 +48,7 @@ struct ExposedFormat
const wxChar *extension; //!< default extension for this format. More extensions may be added later via AddExtension.
const wxChar *shortname; //!< used to guess the format
unsigned maxchannels; //!< how many channels this format could handle
int canmetadata; //!< !=0 if format supports metadata, -1 any avformat version, otherwise version support added
const int canmetadata; //!< !=0 if format supports metadata, AV_CANMETA any avformat version, otherwise version support added
bool canutf8; //!< true if format supports metadata in UTF-8, false otherwise
const wxChar *description_; //!< format description (will be shown in export dialog) (untranslated!)
AVCodecID codecid; //!< codec ID (see libavcodec/avcodec.h)

View File

@ -602,7 +602,8 @@ void ExtImportPrefs::OnDelRule(wxCommandEvent& WXUNUSED(event))
int msgres = AudacityMessageBox (_("Do you really want to delete selected rule?"),
_("Rule deletion confirmation"), wxYES_NO, RuleTable);
if (msgres == wxNO || msgres != wxYES)
// Yes or no, there is no third!
if (msgres != wxYES)
return;
RuleTable->DeleteRows (last_selected);

View File

@ -299,12 +299,12 @@ AButton::AButtonState AButton::GetState()
}
}
else {
if (mToggle) {
//if (mToggle) {
state = mButtonIsDown ? AButtonDown : AButtonUp;
}
else {
state = mButtonIsDown ? AButtonDown : AButtonUp;
}
//}
//else {
//state = mButtonIsDown ? AButtonDown : AButtonUp;
//}
}
return state;

View File

@ -391,10 +391,10 @@ LWSlider::LWSlider(wxWindow *parent,
break;
case DB_SLIDER:
minValue = -36.0f;
if (orientation == wxHORIZONTAL)
//if (orientation == wxHORIZONTAL)
maxValue = 36.0f;
else
maxValue = 36.0f; // for MixerBoard //v Previously was 6dB for MixerBoard, but identical for now.
//else
//maxValue = 36.0f; // for MixerBoard //v Previously was 6dB for MixerBoard, but identical for now.
stepValue = 1.0f;
speed = 0.5;
break;

View File

@ -291,10 +291,10 @@ class ExpandingToolBarEvtHandler final : public wxEvtHandler
bool ProcessEvent(wxEvent& evt) override
{
if (mToolBar->IsCursorInWindow())
mToolBar->TryAutoExpand();
else
// if (mToolBar->IsCursorInWindow())
mToolBar->TryAutoExpand();
// else
// mToolBar->TryAutoExpand();
return mInheritedEvtHandler->ProcessEvent(evt);
}

View File

@ -2427,10 +2427,10 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
// Do this hack so scrubber can detect mouse drags anywhere
evt.ResumePropagation(wxEVENT_PROPAGATE_MAX);
if (scrubber.IsScrubbing())
evt.Skip();
else
//if (scrubber.IsScrubbing())
evt.Skip();
//else
//evt.Skip();
// Don't do this, it slows down drag-scrub on Mac.
// Timer updates of display elsewhere make it unnecessary.