Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2022-07-04 10:57:12 +0300
committerDavid Crocker <dcrocker@eschertech.com>2022-07-04 10:57:12 +0300
commit4f6a54a735a993c450656a1180d27323668186cf (patch)
treef5c042a5420126e8c4862cbda0df77dbe7d012de /src/ObjectModel
parentfe0b4766b0c74368f810e79cb7530a74e5b1ff4f (diff)
Fixed memory leaks in expression parser
Diffstat (limited to 'src/ObjectModel')
-rw-r--r--src/ObjectModel/ObjectModel.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/ObjectModel/ObjectModel.h b/src/ObjectModel/ObjectModel.h
index a957aff6..146e8f49 100644
--- a/src/ObjectModel/ObjectModel.h
+++ b/src/ObjectModel/ObjectModel.h
@@ -156,13 +156,13 @@ struct ExpressionValue
void SetType(TypeCode t) noexcept { type = (uint32_t)t; }
bool IsStringType() const noexcept { return type == (uint32_t)TypeCode::CString || type == (uint32_t)TypeCode::HeapString; }
- void Set(bool b) noexcept { Release(); type = (uint32_t)TypeCode::Bool; bVal = b; }
- void Set(char c) noexcept { Release(); type = (uint32_t)TypeCode::Char; cVal = c; }
- void Set(int32_t i) noexcept { Release(); type = (uint32_t)TypeCode::Int32; iVal = i; }
- void Set(float f) noexcept { Release(); type = (uint32_t)TypeCode::Float; fVal = f; param = MaxFloatDigitsDisplayedAfterPoint; }
- void Set(float f, uint32_t digits) noexcept { Release(); type = (uint32_t)TypeCode::Float; fVal = f; param = digits; }
- void Set(const char *_ecv_array s) noexcept { Release(); type = (uint32_t)TypeCode::CString; sVal = s; }
- void Set(DriverId did) noexcept
+ void SetBool(bool b) noexcept { Release(); type = (uint32_t)TypeCode::Bool; bVal = b; }
+ void SetChar(char c) noexcept { Release(); type = (uint32_t)TypeCode::Char; cVal = c; }
+ void SetInt(int32_t i) noexcept { Release(); type = (uint32_t)TypeCode::Int32; iVal = i; }
+ void SetFloat(float f) noexcept { Release(); type = (uint32_t)TypeCode::Float; fVal = f; param = MaxFloatDigitsDisplayedAfterPoint; }
+ void SetFloat(float f, uint32_t digits) noexcept { Release(); type = (uint32_t)TypeCode::Float; fVal = f; param = digits; }
+ void SetCString(const char *_ecv_array s) noexcept { Release(); type = (uint32_t)TypeCode::CString; sVal = s; }
+ void SetDriverId(DriverId did) noexcept
{
Release();
type = (uint32_t)TypeCode::DriverId_tc;
@@ -174,8 +174,9 @@ struct ExpressionValue
uVal = did.localDriver;
}
- void Set(StringHandle sh) noexcept { Release(); type = (uint32_t)TypeCode::HeapString; shVal = sh; }
- void Set(std::nullptr_t dummy) noexcept { Release(); type = (uint32_t)TypeCode::None; }
+ void SetStringHandle(StringHandle sh) noexcept { Release(); type = (uint32_t)TypeCode::HeapString; shVal = sh; }
+ void SetNull(std::nullptr_t dummy) noexcept { Release(); type = (uint32_t)TypeCode::None; }
+ void SetDateTime(time_t t) noexcept { Release(); type = (uint32_t)TypeCode::DateTime_tc; Set56BitValue(t); }
// Store a 56-bit value
void Set56BitValue(uint64_t v) { Release(); param = (uint32_t)(v >> 32) & 0x00FFFFFFu; uVal = (uint32_t)v; }