From 33286482722ff26fc632d11eec2d85a9b98268b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Sat, 7 Dec 2013 20:47:54 +0100 Subject: [PATCH] Fix limits of valid values of effect parameters. --- ffbconstanteffect.cpp | 8 ++++---- ffbeffect.cpp | 4 ++-- ffbperiodiceffect.cpp | 12 ++++++------ ffbrampeffect.cpp | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ffbconstanteffect.cpp b/ffbconstanteffect.cpp index c9616b4..879dd11 100644 --- a/ffbconstanteffect.cpp +++ b/ffbconstanteffect.cpp @@ -39,18 +39,18 @@ bool FFBConstantEffect::setParameters(const std::shared_ptrdoSanityChecks) { - if (!checkBoundsInclusive(params->attackLength, 0, 0xFFFF)){ + if (!checkBoundsInclusive(params->attackLength, 0, 0x7FFF)){ reportError("Attack length out of bounds"); return false; } - if (!checkBoundsInclusive(params->attackLevel, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->attackLevel, 0, 0x7FFF)) { reportError("Attack level out of bounds"); return false; - } if (!checkBoundsInclusive(params->fadeLength, 0, 0xFFFF)) { + } if (!checkBoundsInclusive(params->fadeLength, 0, 0x7FFF)) { reportError("Fade length out of bounds"); return false; } - if (!checkBoundsInclusive(params->fadeLevel, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->fadeLevel, 0, 0x7FFF)) { reportError("Fade level out of bounds"); return false; } diff --git a/ffbeffect.cpp b/ffbeffect.cpp index 98a49b8..5e93257 100644 --- a/ffbeffect.cpp +++ b/ffbeffect.cpp @@ -37,12 +37,12 @@ bool FFBEffect::checkGenericParameters(const std::shared_ptrreplayDelay, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->replayDelay, 0, 0x7FFF)) { reportError("Replay delay out of bounds."); return false; } - if (!checkBoundsInclusive(params->replayLength, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->replayLength, 0, 0x7FFF)) { reportError("Replay length out of bounds."); return false; } diff --git a/ffbperiodiceffect.cpp b/ffbperiodiceffect.cpp index c9ff718..b07200a 100644 --- a/ffbperiodiceffect.cpp +++ b/ffbperiodiceffect.cpp @@ -64,22 +64,22 @@ bool FFBPeriodicEffect::setParameters(const std::shared_ptrdoSanityChecks) { - if (!checkBoundsInclusive(params->attackLength, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->attackLength, 0, 0x7FFF)) { reportError("Attack length out of bounds."); return false; } - if (!checkBoundsInclusive(params->attackLevel, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->attackLevel, 0, 0x7FFF)) { reportError("Attack level out of bounds."); return false; } - if (!checkBoundsInclusive(params->fadeLength, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->fadeLength, 0, 0x7FFF)) { reportError("Fade length out of bounds."); return false; } - if (!checkBoundsInclusive(params->fadeLevel, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->fadeLevel, 0, 0x7FFF)) { reportError("Fade level out of bounds."); return false; } @@ -94,12 +94,12 @@ bool FFBPeriodicEffect::setParameters(const std::shared_ptrperiod, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->period, 0, 0x7FFF)) { reportError("Period out of bounds."); return false; } - if (!checkBoundsInclusive(params->phase, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->phase, 0, 0x7FFF)) { reportError("Phase out of bounds."); return false; } diff --git a/ffbrampeffect.cpp b/ffbrampeffect.cpp index 97c3afe..3428b26 100644 --- a/ffbrampeffect.cpp +++ b/ffbrampeffect.cpp @@ -42,22 +42,22 @@ bool FFBRampEffect::setParameters(const std::shared_ptr return false; if (GlobalSettings::GS()->doSanityChecks) { - if (!checkBoundsInclusive(params->attackLength, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->attackLength, 0, 0x7FFF)) { reportError("Attack length out of bounds."); return false; } - if (!checkBoundsInclusive(params->attackLevel, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->attackLevel, 0, 0x7FFF)) { reportError("Attack level out of bounds."); return false; } - if (!checkBoundsInclusive(params->fadeLength, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->fadeLength, 0, 0x7FFF)) { reportError("Fade length out of bounds."); return false; } - if (!checkBoundsInclusive(params->fadeLevel, 0, 0xFFFF)) { + if (!checkBoundsInclusive(params->fadeLevel, 0, 0x7FFF)) { reportError("Fade level out of bounds."); return false; } -- 2.43.5