Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LimaGroup
Lima
Commits
9314af23
Commit
9314af23
authored
Oct 08, 2020
by
Samuel Debionne
Browse files
Fixes some artihmetic overflows, uninitialized variables and throws where code should be noexcept
parent
173e0870
Pipeline
#34918
passed with stages
in 32 minutes and 28 seconds
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
common/include/lima/MemUtils.h
View file @
9314af23
...
...
@@ -41,6 +41,8 @@ void LIMACORE_API ClearBuffer(void *ptr, int nb_concat_frames, const FrameDim& f
struct
LIMACORE_API
Allocator
{
DEB_STRUCT_NAMESPC
(
DebModCommon
,
"MemUtils"
,
"Allocator"
);
struct
Data
{
virtual
~
Data
()
=
default
;
};
...
...
@@ -54,9 +56,10 @@ struct LIMACORE_API Allocator
Allocator
(
Allocator
&&
o
)
:
m_ref_count
(
0
)
{
DEB_MEMBER_FUNCT
();
if
(
o
.
m_ref_count
!=
0
)
throw
LIMA_COM_EXC
(
InvalidValue
,
"Moved-from Allocator is not empty"
);
DEB_ERROR
()
<<
"Moved-from Allocator is not empty"
;
}
// Allocate a buffer of a given size and eventually return
...
...
@@ -102,9 +105,10 @@ struct LIMACORE_API Allocator
virtual
~
Allocator
()
{
DEB_MEMBER_FUNCT
();
if
(
m_ref_count
!=
0
)
std
::
cerr
<<
"Error: destroying non-empty Allocator"
<<
std
::
endl
;
DEB_ERROR
()
<<
"Error: destroying non-empty Allocator"
;
}
// The real resource management counter, triggered by Ref
...
...
common/include/lima/VideoUtils.h
View file @
9314af23
...
...
@@ -5,6 +5,7 @@
#include
<iostream>
#include
"lima/Constants.h"
#include
"lima/Exceptions.h"
#include
"processlib/Data.h"
...
...
@@ -35,7 +36,14 @@ namespace lima
inline
void
alloc
(
int
size
)
{
if
(
!
buffer
||
double
(
size
)
>
this
->
size
())
buffer
=
(
char
*
)
realloc
(
buffer
,
size
);
{
char
*
tmp
=
(
char
*
)
realloc
(
buffer
,
size
);
if
(
tmp
==
NULL
)
throw
LIMA_COM_EXC
(
Error
,
"Error in realloc: "
)
<<
"NULL pointer returned"
;
else
buffer
=
tmp
;
}
}
inline
void
setParams
(
int
fNumber
,
int
w
,
int
h
,
VideoMode
m
)
{
...
...
common/src/MemUtils.cpp
View file @
9314af23
...
...
@@ -103,7 +103,7 @@ int lima::GetDefMaxNbBuffers(const FrameDim& frame_dim)
void
lima
::
ClearBuffer
(
void
*
ptr
,
int
nb_concat_frames
,
const
FrameDim
&
frame_dim
)
{
memset
(
ptr
,
0
,
nb_concat_frames
*
frame_dim
.
getMemSize
());
memset
(
ptr
,
0
,
nb_concat_frames
*
size_t
(
frame_dim
.
getMemSize
())
)
;
}
Allocator
*
Allocator
::
defaultAllocator
()
...
...
common/src/ThreadUtils.cpp
View file @
9314af23
...
...
@@ -184,7 +184,7 @@ bool Cond::wait(double timeout)
struct
timeval
now
;
struct
timespec
waitTimeout
;
gettimeofday
(
&
now
,
NULL
);
waitTimeout
.
tv_sec
=
now
.
tv_sec
+
long
(
timeout
);
waitTimeout
.
tv_sec
=
now
.
tv_sec
+
time_t
(
timeout
);
waitTimeout
.
tv_nsec
=
(
now
.
tv_usec
*
1000
)
+
long
((
timeout
-
long
(
timeout
))
*
1e9
);
if
(
waitTimeout
.
tv_nsec
>=
1000000000L
)
// Carry
...
...
@@ -241,10 +241,8 @@ Thread::ExceptionCleanUp::~ExceptionCleanUp()
m_thread
.
m_exception_handled
=
true
;
}
Thread
::
Thread
()
Thread
::
Thread
()
:
m_thread
(
NULL
),
m_started
(
false
),
m_finished
(
false
),
m_exception_handled
(
false
),
m_tid
(
0
)
{
m_started
=
m_finished
=
m_exception_handled
=
false
;
m_tid
=
0
;
pthread_attr_init
(
&
m_thread_attr
);
}
...
...
control/include/lima/CtAccumulation.h
View file @
9314af23
...
...
@@ -70,7 +70,7 @@ namespace lima
"Control"
);
friend
class
CtAccumulation
;
public:
ThresholdCallback
()
{};
ThresholdCallback
()
:
m_max
(
0
)
{};
virtual
~
ThresholdCallback
()
{};
int
m_max
;
...
...
control/include/lima/CtConfig.h
View file @
9314af23
...
...
@@ -103,7 +103,7 @@ namespace lima
private:
typedef
std
::
map
<
std
::
string
,
ModuleTypeCallback
*>
ModuleMap
;
CtConfig
(
const
CtConfig
&
other
)
:
m_ctrl
(
other
.
m_ctrl
)
{}
CtConfig
(
const
CtConfig
&
other
)
:
m_ctrl
(
other
.
m_ctrl
)
,
m_config
(
NULL
)
{}
CtControl
&
m_ctrl
;
libconfig
::
Config
*
m_config
;
...
...
control/include/lima/CtSaving.h
View file @
9314af23
...
...
@@ -267,10 +267,10 @@ public:
typedef
std
::
map
<
long
,
FrameParameters
>
Frame2Params
;
struct
Handler
{
Handler
()
:
m_handler
(
NULL
)
{}
Handler
()
:
m_handler
(
NULL
)
,
m_nb_frames
(
0
)
{}
void
*
m_handler
;
int
m_nb_frames
;
int
m_nb_frames
;
};
struct
cmpParameters
{
...
...
control/include/lima/CtSaving_Compression.h
View file @
9314af23
...
...
@@ -92,7 +92,7 @@ static const LZ4F_preferences_t lz4_preferences = {
int
framesPerFile
,
const
CtSaving
::
HeaderMap
&
header
);
~
FileLz4Compression
();
virtual
void
process
(
Data
&
aData
);
void
_compression
(
const
char
*
src
,
in
t
size
,
ZBufferList
&
return_buffers
);
void
_compression
(
const
char
*
src
,
size_
t
size
,
ZBufferList
&
return_buffers
);
};
#endif // WITH_LZ4_COMPRESSION
...
...
control/software_operation/src/SoftOpId.cpp
View file @
9314af23
...
...
@@ -864,7 +864,7 @@ void SoftOpPeakFinder::setComputingMode(ComputingMode aComputingMode)
void
SoftOpPeakFinder
::
getComputingMode
(
ComputingMode
&
aComputingMode
)
const
{
Tasks
::
PeakFinderTask
::
ComputingMode
aMode
;
Tasks
::
PeakFinderTask
::
ComputingMode
aMode
=
Tasks
::
PeakFinderTask
::
MAXIMUM
;
for
(
NameMapConstIterator
i
=
m_task_manager
.
begin
();
i
!=
m_task_manager
.
end
();
++
i
)
{
i
->
second
.
second
->
getComputingMode
(
aMode
);
}
...
...
control/src/CtControl.cpp
View file @
9314af23
...
...
@@ -172,6 +172,8 @@ protected:
private:
struct
ChangeEvent
{
ChangeEvent
()
:
force
(
false
),
finished
(
NULL
)
{}
ImageStatus
status
;
bool
force
;
bool
*
finished
;
...
...
control/src/CtSaving_Compression.cpp
View file @
9314af23
...
...
@@ -158,24 +158,24 @@ void FileLz4Compression::process(Data &aData)
m_container
.
_setBuffer
(
aData
.
frameNumber
,
std
::
move
(
aBufferListPt
));
}
void
FileLz4Compression
::
_compression
(
const
char
*
src
,
in
t
size
,
void
FileLz4Compression
::
_compression
(
const
char
*
src
,
size_
t
size
,
ZBufferList
&
return_buffers
)
{
DEB_MEMBER_FUNCT
();
in
t
buffer_size
=
LZ4F_compressFrameBound
(
size
,
&
lz4_preferences
);
size_
t
buffer_size
=
LZ4F_compressFrameBound
(
size
,
&
lz4_preferences
);
buffer_size
+=
LZ4_HEADER_SIZE
+
LZ4_FOOTER_SIZE
;
return_buffers
.
emplace_back
(
buffer_size
);
ZBuffer
&
newBuffer
=
return_buffers
.
back
();
char
*
buffer
=
(
char
*
)
newBuffer
.
ptr
();
in
t
offset
=
LZ4F_compressBegin
(
m_ctx
,
buffer
,
size_
t
offset
=
LZ4F_compressBegin
(
m_ctx
,
buffer
,
buffer_size
,
&
lz4_preferences
);
if
(
LZ4F_isError
(
offset
))
THROW_CTL_ERROR
(
Error
)
<<
"Failed to start compression: "
<<
DEB_VAR1
(
offset
);
in
t
error_code
=
LZ4F_compressUpdate
(
m_ctx
,
buffer
+
offset
,
buffer_size
-
offset
,
size_
t
error_code
=
LZ4F_compressUpdate
(
m_ctx
,
buffer
+
offset
,
buffer_size
-
offset
,
src
,
size
,
NULL
);
if
(
LZ4F_isError
(
error_code
))
THROW_CTL_ERROR
(
Error
)
<<
"Compression Failed: "
...
...
control/src/CtSaving_Hdf5.cpp
View file @
9314af23
...
...
@@ -43,6 +43,7 @@ struct SaveContainerHdf5::_File
m_in_append
(
false
),
m_dataset_extended
(
false
),
m_entry_index
(
0
),
m_nb_frames
(
0
),
m_frame_cnt
(
0
)
{}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment