Skip to content

Commit

Permalink
PR #10809: Some bug fixes from cppcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Sep 7, 2022
2 parents eb740b9 + 4e90d0a commit 5b6b818
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/reflectivity/reflectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ float reflectivity::get_reflectivity( float raw_noise_estimation,

// STD based analysis
// STD values are at the edges, hard to get data
if( standard_deviation >= 1.5f || standard_deviation <= 10.f )
if( standard_deviation >= 1.5f && standard_deviation <= 10.f )
{
if( standard_deviation > 2.5f )
ref_from_std = 0.5f; // Low confidence data due to low STD values
Expand Down
2 changes: 1 addition & 1 deletion common/viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace rs2
const std::string message;
std::function<void()> custom_command;

bool operator =(const popup& p)
bool operator ==(const popup& p)
{
return p.message == message;
}
Expand Down
2 changes: 1 addition & 1 deletion src/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ namespace librealsense
void context::remove_device(const std::string& file)
{
auto it = _playback_devices.find(file);
if (!it->second.lock() || it == _playback_devices.end())
if(it == _playback_devices.end() || !it->second.lock())
{
//Not found
return;
Expand Down
2 changes: 1 addition & 1 deletion src/l500/l500-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ namespace librealsense

std::lock_guard<std::mutex> lock(_temperature_mutex);

memset(&_temperatures, sizeof(_temperatures), 0);
memset(&_temperatures, 0, sizeof(_temperatures));
if (fw_version_support_nest)
_temperatures = *reinterpret_cast<extended_temperatures const *>(res.data());
else
Expand Down
2 changes: 1 addition & 1 deletion tools/embed/rs-embed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int main(int argc, char** argv) try
auto rawDataSize = (int)data.size();
auto compressBufSize = LZ4_compressBound(rawDataSize);
char* pchCompressed = new char[compressBufSize];
memset(pchCompressed, compressBufSize, 0);
memset(pchCompressed, 0, compressBufSize);
int nCompressedSize = LZ4_compress_default((const char*)data.data(), pchCompressed, rawDataSize, compressBufSize);


Expand Down
5 changes: 5 additions & 0 deletions tools/rs-server/RsSimpleRTPSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ RsSimpleRTPSink ::RsSimpleRTPSink(UsageEnvironment& t_env,
sprintf(m_fFmtpSDPLine, "a=fmtp:%d;%s\r\n", rtpPayloadType(), sdpStr.c_str());
}

RsSimpleRTPSink::~RsSimpleRTPSink()
{
delete[] m_fFmtpSDPLine;
}

char const* RsSimpleRTPSink::auxSDPLine()
{
return m_fFmtpSDPLine;
Expand Down
1 change: 1 addition & 0 deletions tools/rs-server/RsSimpleRTPSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class RsSimpleRTPSink : public SimpleRTPSink
unsigned numChannels = 1,
Boolean allowMultipleFramesPerPacket = True,
Boolean doNormalMBitRule = True);
~RsSimpleRTPSink();

private:
char* m_fFmtpSDPLine;
Expand Down

0 comments on commit 5b6b818

Please sign in to comment.