Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
d347f7d4
Commit
d347f7d4
authored
Aug 14, 2019
by
LEFEBVREJP email
Browse files
Merge branch 'fortify' into 'master'
Fortify changes See merge request
!80
parents
1ef4f9ff
ad788bbc
Pipeline
#67178
passed with stages
in 18 minutes and 21 seconds
Changes
15
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixcore/stringfunctions.cc
View file @
d347f7d4
...
@@ -134,6 +134,7 @@ struct std::tm utc_to_time(const std::string &time, int &zone, int &daylight)
...
@@ -134,6 +134,7 @@ struct std::tm utc_to_time(const std::string &time, int &zone, int &daylight)
int
year
=
0
,
month
=
0
,
day
=
0
,
hour
=
0
,
minute
=
0
,
second
=
0
;
int
year
=
0
,
month
=
0
,
day
=
0
,
hour
=
0
,
minute
=
0
,
second
=
0
;
int
count
=
sscanf
(
time
.
c_str
(),
"%d-%d-%dT%d:%d:%d-%d:%d"
,
&
year
,
&
month
,
int
count
=
sscanf
(
time
.
c_str
(),
"%d-%d-%dT%d:%d:%d-%d:%d"
,
&
year
,
&
month
,
&
day
,
&
hour
,
&
minute
,
&
second
,
&
zone
,
&
daylight
);
&
day
,
&
hour
,
&
minute
,
&
second
,
&
zone
,
&
daylight
);
(
void
)
sizeof
(
count
);
radix_line
(
"utc_to_time elements: "
<<
count
);
radix_line
(
"utc_to_time elements: "
<<
count
);
struct
std
::
tm
res
;
struct
std
::
tm
res
;
res
.
tm_year
=
year
;
res
.
tm_year
=
year
;
...
...
radixcore/system.cc
View file @
d347f7d4
...
@@ -71,9 +71,10 @@ std::string computer_name()
...
@@ -71,9 +71,10 @@ std::string computer_name()
char
*
hostname
;
char
*
hostname
;
#ifndef _WIN32
#ifndef _WIN32
hostname
=
new
char
[
256
];
hostname
=
new
char
[
256
];
hostname
[
255
]
=
'\0'
;
if
(
gethostname
(
hostname
,
256
)
!=
0
)
if
(
gethostname
(
hostname
,
256
)
!=
0
)
{
{
strcpy
(
hostname
,
"Unknown"
);
str
n
cpy
(
hostname
,
"Unknown"
,
255
);
}
}
std
::
string
result
(
hostname
);
std
::
string
result
(
hostname
);
delete
[]
hostname
;
delete
[]
hostname
;
...
@@ -485,6 +486,7 @@ long get_process_memory()
...
@@ -485,6 +486,7 @@ long get_process_memory()
char
buffer
[
128
];
char
buffer
[
128
];
strncpy
(
buffer
,
line
.
substr
(
6
).
c_str
(),
strncpy
(
buffer
,
line
.
substr
(
6
).
c_str
(),
std
::
min
(
sizeof
(
buffer
),
line
.
size
()
-
6
));
std
::
min
(
sizeof
(
buffer
),
line
.
size
()
-
6
));
buffer
[
127
]
=
'\0'
;
caddr_t
context
=
nullptr
,
token
=
strtok_r
(
buffer
,
"
\t
"
,
&
context
);
caddr_t
context
=
nullptr
,
token
=
strtok_r
(
buffer
,
"
\t
"
,
&
context
);
if
(
token
!=
nullptr
)
result
=
long
(
atoi
(
token
))
*
1024L
;
if
(
token
!=
nullptr
)
result
=
long
(
atoi
(
token
))
*
1024L
;
...
...
radixwidgets/navigationactionmanager.cc
View file @
d347f7d4
...
@@ -19,10 +19,13 @@ class NavigationActionManager::PImpl
...
@@ -19,10 +19,13 @@ class NavigationActionManager::PImpl
NavigationActionManager
::
PImpl
::~
PImpl
()
{}
NavigationActionManager
::
PImpl
::~
PImpl
()
{}
NavigationActionManager
::
NavigationActionManager
(
QObject
*
parent
)
NavigationActionManager
::
NavigationActionManager
(
QObject
*
parent
)
:
p
(
new
PImpl
(),
[](
PImpl
*
impl
)
{
delete
impl
;
})
:
QObject
(
parent
)
,
p
(
new
PImpl
(),
[](
PImpl
*
impl
)
{
delete
impl
;
})
{
{
}
}
void
NavigationActionManager
::
deleter
(
PImpl
*
impl
)
{
delete
impl
;
}
void
NavigationActionManager
::
registerAction
(
NavigationItem
*
item
,
QString
text
,
void
NavigationActionManager
::
registerAction
(
NavigationItem
*
item
,
QString
text
,
std
::
function
<
void
()
>
functor
)
std
::
function
<
void
()
>
functor
)
{
{
...
...
radixwidgets/navigationactionmanager.hh
View file @
d347f7d4
...
@@ -25,6 +25,7 @@ class RADIX_PUBLIC NavigationActionManager : public QObject
...
@@ -25,6 +25,7 @@ class RADIX_PUBLIC NavigationActionManager : public QObject
private:
private:
class
PImpl
;
class
PImpl
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
static
void
deleter
(
PImpl
*
impl
);
};
};
}
// namespace radix
}
// namespace radix
...
...
radixwidgets/navigationitem.cc
View file @
d347f7d4
...
@@ -19,25 +19,27 @@ class NavigationItem::PImpl
...
@@ -19,25 +19,27 @@ class NavigationItem::PImpl
NavigationItem
::
PImpl
::~
PImpl
()
{
qDeleteAll
(
children
);
}
NavigationItem
::
PImpl
::~
PImpl
()
{
qDeleteAll
(
children
);
}
NavigationItem
::
NavigationItem
(
QVariant
data
,
NavigationItem
*
parentItem
)
NavigationItem
::
NavigationItem
(
QVariant
data
,
NavigationItem
*
parentItem
)
:
p
(
new
PImpl
(),
[](
PImpl
*
impl
)
{
delete
impl
;
}
)
:
p
(
new
PImpl
(),
deleter
)
{
{
p
->
parent
=
parentItem
;
p
->
parent
=
parentItem
;
p
->
data
.
append
(
data
);
p
->
data
.
append
(
data
);
}
}
NavigationItem
::
NavigationItem
(
QList
<
QVariant
>
data
,
NavigationItem
*
parentItem
)
NavigationItem
::
NavigationItem
(
QList
<
QVariant
>
data
,
NavigationItem
*
parentItem
)
:
p
(
new
PImpl
(),
[](
PImpl
*
impl
)
{
delete
impl
;
}
)
:
p
(
new
PImpl
(),
deleter
)
{
{
p
->
parent
=
parentItem
;
p
->
parent
=
parentItem
;
p
->
data
=
data
;
p
->
data
=
data
;
}
}
NavigationItem
::
NavigationItem
(
NavigationItem
*
parentItem
)
NavigationItem
::
NavigationItem
(
NavigationItem
*
parentItem
)
:
p
(
new
PImpl
(),
[](
PImpl
*
impl
)
{
delete
impl
;
}
)
:
p
(
new
PImpl
(),
deleter
)
{
{
p
->
parent
=
parentItem
;
p
->
parent
=
parentItem
;
}
}
void
NavigationItem
::
deleter
(
PImpl
*
impl
)
{
delete
impl
;
}
int
NavigationItem
::
type
()
const
{
return
p
->
type
;
}
int
NavigationItem
::
type
()
const
{
return
p
->
type
;
}
void
NavigationItem
::
setType
(
int
type
)
{
p
->
type
=
type
;
}
void
NavigationItem
::
setType
(
int
type
)
{
p
->
type
=
type
;
}
...
...
radixwidgets/navigationitem.hh
View file @
d347f7d4
...
@@ -30,6 +30,7 @@ class RADIX_PUBLIC NavigationItem
...
@@ -30,6 +30,7 @@ class RADIX_PUBLIC NavigationItem
private:
private:
class
PImpl
;
class
PImpl
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
static
void
deleter
(
PImpl
*
impl
);
};
};
}
// namespace radix
}
// namespace radix
...
...
radixwidgets/navigationmodel.cc
View file @
d347f7d4
...
@@ -21,11 +21,13 @@ NavigationModel::PImpl::~PImpl()
...
@@ -21,11 +21,13 @@ NavigationModel::PImpl::~PImpl()
}
}
NavigationModel
::
NavigationModel
(
QObject
*
parent
)
NavigationModel
::
NavigationModel
(
QObject
*
parent
)
:
QAbstractItemModel
(
parent
)
:
QAbstractItemModel
(
parent
)
,
p
(
new
PImpl
(),
[](
PImpl
*
impl
)
{
delete
impl
;
}
)
,
p
(
new
PImpl
(),
deleter
)
{
{
p
->
root
=
new
NavigationItem
();
p
->
root
=
new
NavigationItem
();
}
}
void
NavigationModel
::
deleter
(
PImpl
*
impl
)
{
delete
impl
;
}
QVariant
NavigationModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
QVariant
NavigationModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
{
if
(
!
index
.
isValid
())
return
QVariant
();
if
(
!
index
.
isValid
())
return
QVariant
();
...
...
radixwidgets/navigationmodel.hh
View file @
d347f7d4
...
@@ -38,6 +38,7 @@ class RADIX_PUBLIC NavigationModel : public QAbstractItemModel
...
@@ -38,6 +38,7 @@ class RADIX_PUBLIC NavigationModel : public QAbstractItemModel
private:
private:
class
PImpl
;
class
PImpl
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
static
void
deleter
(
PImpl
*
impl
);
};
};
}
// namespace radix
}
// namespace radix
...
...
radixwidgets/navigationwidget.cc
View file @
d347f7d4
...
@@ -34,10 +34,12 @@ class RADIX_PUBLIC NavigationItemSortFilterProxyModel::PImpl
...
@@ -34,10 +34,12 @@ class RADIX_PUBLIC NavigationItemSortFilterProxyModel::PImpl
NavigationItemSortFilterProxyModel
::
NavigationItemSortFilterProxyModel
(
NavigationItemSortFilterProxyModel
::
NavigationItemSortFilterProxyModel
(
QObject
*
parent
)
QObject
*
parent
)
:
QSortFilterProxyModel
(
parent
)
:
QSortFilterProxyModel
(
parent
)
,
p
(
new
PImpl
(),
[](
PImpl
*
impl
)
{
delete
impl
;
}
)
,
p
(
new
PImpl
(),
deleter
)
{
{
}
}
void
NavigationItemSortFilterProxyModel
::
deleter
(
PImpl
*
impl
)
{
delete
impl
;
}
bool
NavigationItemSortFilterProxyModel
::
accepts
(
const
QModelIndex
&
index
)
const
bool
NavigationItemSortFilterProxyModel
::
accepts
(
const
QModelIndex
&
index
)
const
{
{
const
QString
&
text
=
index
.
data
().
toString
();
const
QString
&
text
=
index
.
data
().
toString
();
...
@@ -85,12 +87,14 @@ class RADIX_PUBLIC NavigationWidget::PImpl
...
@@ -85,12 +87,14 @@ class RADIX_PUBLIC NavigationWidget::PImpl
NavigationWidget
::
NavigationWidget
(
QWidget
*
parent
)
NavigationWidget
::
NavigationWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
:
QWidget
(
parent
)
,
p
(
new
PImpl
(),
[](
PImpl
*
impl
)
{
delete
impl
;
}
)
,
p
(
new
PImpl
(),
deleter
)
{
{
initMembers
();
initMembers
();
initLayout
();
initLayout
();
}
}
void
NavigationWidget
::
deleter
(
PImpl
*
impl
)
{
delete
impl
;
}
NavigationModel
*
NavigationWidget
::
navigationModel
()
{
return
p
->
model
;
}
NavigationModel
*
NavigationWidget
::
navigationModel
()
{
return
p
->
model
;
}
NavigationActionManager
*
NavigationWidget
::
navigationActionManager
()
NavigationActionManager
*
NavigationWidget
::
navigationActionManager
()
...
...
radixwidgets/navigationwidget.hh
View file @
d347f7d4
...
@@ -22,7 +22,8 @@ class NavigationItem;
...
@@ -22,7 +22,8 @@ class NavigationItem;
class
NavigationModel
;
class
NavigationModel
;
class
NavigationActionManager
;
class
NavigationActionManager
;
class
RADIX_PUBLIC
NavigationItemSortFilterProxyModel
:
public
QSortFilterProxyModel
class
RADIX_PUBLIC
NavigationItemSortFilterProxyModel
:
public
QSortFilterProxyModel
{
{
Q_OBJECT
Q_OBJECT
...
@@ -39,6 +40,7 @@ class RADIX_PUBLIC NavigationItemSortFilterProxyModel : public QSortFilterProxyM
...
@@ -39,6 +40,7 @@ class RADIX_PUBLIC NavigationItemSortFilterProxyModel : public QSortFilterProxyM
bool
accepts
(
const
QModelIndex
&
index
)
const
;
bool
accepts
(
const
QModelIndex
&
index
)
const
;
class
PImpl
;
class
PImpl
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
static
void
deleter
(
PImpl
*
impl
);
};
};
class
RADIX_PUBLIC
NavigationWidget
:
public
QWidget
class
RADIX_PUBLIC
NavigationWidget
:
public
QWidget
...
@@ -73,6 +75,7 @@ class RADIX_PUBLIC NavigationWidget : public QWidget
...
@@ -73,6 +75,7 @@ class RADIX_PUBLIC NavigationWidget : public QWidget
class
PImpl
;
class
PImpl
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
static
void
deleter
(
PImpl
*
impl
);
};
};
}
// namespace radix
}
// namespace radix
...
...
radixwidgets/tableview.cc
View file @
d347f7d4
...
@@ -21,18 +21,20 @@ class RADIX_PUBLIC TableView::PImpl
...
@@ -21,18 +21,20 @@ class RADIX_PUBLIC TableView::PImpl
TableView
::
PImpl
::
PImpl
()
TableView
::
PImpl
::
PImpl
()
{
{
allow_paste
=
false
;
allow_paste
=
false
;
copy_vert_header
=
false
;
copy_vert_header
=
false
;
copy_horiz_header
=
false
;
copy_horiz_header
=
false
;
separator
=
'\t'
;
separator
=
'\t'
;
}
}
TableView
::
TableView
(
QWidget
*
parent
)
TableView
::
TableView
(
QWidget
*
parent
)
:
QTableView
(
parent
)
:
QTableView
(
parent
)
,
p
(
new
PImpl
(),
[](
PImpl
*
impl
)
{
delete
impl
;
}
)
,
p
(
new
PImpl
(),
deleter
)
{
{
}
}
void
TableView
::
deleter
(
PImpl
*
impl
)
{
delete
impl
;
}
char
TableView
::
separator
()
const
{
return
p
->
separator
;
}
char
TableView
::
separator
()
const
{
return
p
->
separator
;
}
void
TableView
::
setSeparator
(
char
value
)
{
p
->
separator
=
value
;
}
void
TableView
::
setSeparator
(
char
value
)
{
p
->
separator
=
value
;
}
...
@@ -98,11 +100,11 @@ void TableView::copy()
...
@@ -98,11 +100,11 @@ void TableView::copy()
}
}
if
(
p
->
copy_horiz_header
)
if
(
p
->
copy_horiz_header
)
{
{
for
(
int
i
=
0
;
i
<
cols
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
cols
.
size
();
i
++
)
{
{
if
(
i
>
0
)
data
.
append
(
p
->
separator
);
if
(
i
>
0
)
data
.
append
(
p
->
separator
);
data
.
append
(
chmodel
->
headerData
(
cols
[
i
],
Qt
::
Horizontal
).
toString
());
data
.
append
(
chmodel
->
headerData
(
cols
[
i
],
Qt
::
Horizontal
).
toString
());
}
}
}
}
data
.
append
(
'\n'
);
data
.
append
(
'\n'
);
}
}
...
...
radixwidgets/tableview.hh
View file @
d347f7d4
...
@@ -21,9 +21,10 @@ class RADIX_PUBLIC TableView : public QTableView
...
@@ -21,9 +21,10 @@ class RADIX_PUBLIC TableView : public QTableView
class
PImpl
;
class
PImpl
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
static
void
deleter
(
PImpl
*
impl
);
public:
public:
TableView
(
QWidget
*
parent
=
0
);
TableView
(
QWidget
*
parent
=
nullptr
);
char
separator
()
const
;
char
separator
()
const
;
void
setSeparator
(
char
value
);
void
setSeparator
(
char
value
);
...
...
radixwidgets/tabwidget.cc
View file @
d347f7d4
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
#include
<iostream>
#include
<iostream>
#include
<QLabel>
#include
<QLabel>
#include
<QPushButton>
#include
<QTabBar>
#include
<QTabBar>
#include
<QToolButton>
#include
<QToolButton>
...
@@ -16,15 +15,15 @@ TabWidget::TabWidget(QWidget *parent)
...
@@ -16,15 +15,15 @@ TabWidget::TabWidget(QWidget *parent)
setTabsClosable
(
true
);
setTabsClosable
(
true
);
//
//
// create a 'new tab' button
// create a 'new tab' button
QPushButton
*
n
ewButton
=
new
QPushButton
(
"+"
,
this
);
mN
ewButton
=
new
QPushButton
(
"+"
,
this
);
n
ewButton
->
setObjectName
(
"tabs_new_tab_button"
);
mN
ewButton
->
setObjectName
(
"tabs_new_tab_button"
);
n
ewButton
->
setToolTip
(
"Add new tab"
);
mN
ewButton
->
setToolTip
(
"Add new tab"
);
n
ewButton
->
setMaximumWidth
(
25
);
mN
ewButton
->
setMaximumWidth
(
25
);
addTab
(
new
QLabel
(
""
),
QString
(
""
));
addTab
(
new
QLabel
(
""
),
QString
(
""
));
QWidget
*
newTabWidget
=
widget
(
0
);
QWidget
*
newTabWidget
=
widget
(
0
);
newTabWidget
->
setObjectName
(
"tabwidget_new_tab"
);
newTabWidget
->
setObjectName
(
"tabwidget_new_tab"
);
tabBar
()
->
setTabButton
(
0
,
QTabBar
::
RightSide
,
n
ewButton
);
tabBar
()
->
setTabButton
(
0
,
QTabBar
::
RightSide
,
mN
ewButton
);
// this is require on mac to hide the close button on the first tab
// this is require on mac to hide the close button on the first tab
QWidget
*
temp
=
tabBar
()
->
tabButton
(
0
,
QTabBar
::
LeftSide
);
QWidget
*
temp
=
tabBar
()
->
tabButton
(
0
,
QTabBar
::
LeftSide
);
if
(
temp
)
temp
->
hide
();
if
(
temp
)
temp
->
hide
();
...
@@ -34,7 +33,7 @@ TabWidget::TabWidget(QWidget *parent)
...
@@ -34,7 +33,7 @@ TabWidget::TabWidget(QWidget *parent)
setCurrentIndex
(
-
1
);
setCurrentIndex
(
-
1
);
// forward pushbutton signal
// forward pushbutton signal
connect
(
n
ewButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SIGNAL
(
addTabRequested
()));
connect
(
mN
ewButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SIGNAL
(
addTabRequested
()));
}
}
}
// namespace radix
}
// namespace radix
radixwidgets/tabwidget.hh
View file @
d347f7d4
#ifndef RADIX_RADIXWIDGETS_TABWIDGET_HH_
#ifndef RADIX_RADIXWIDGETS_TABWIDGET_HH_
#define RADIX_RADIXWIDGETS_TABWIDGET_HH_
#define RADIX_RADIXWIDGETS_TABWIDGET_HH_
#include
<QPushButton>
#include
<QTabWidget>
#include
<QTabWidget>
#include
"radixcore/visibility.hh"
#include
"radixcore/visibility.hh"
...
@@ -15,7 +16,10 @@ class RADIX_PUBLIC TabWidget : public QTabWidget
...
@@ -15,7 +16,10 @@ class RADIX_PUBLIC TabWidget : public QTabWidget
Q_OBJECT
Q_OBJECT
public:
public:
TabWidget
(
QWidget
*
parent
=
0
);
TabWidget
(
QWidget
*
parent
=
nullptr
);
private:
QPushButton
*
mNewButton
;
signals:
signals:
void
addTabRequested
();
void
addTabRequested
();
...
...
radixwidgets/vtkPlotPointsErrorBars.cc
View file @
d347f7d4
...
@@ -832,6 +832,7 @@ bool vtkPlotPointsErrorBars::UpdateTableCache(vtkTable *table)
...
@@ -832,6 +832,7 @@ bool vtkPlotPointsErrorBars::UpdateTableCache(vtkTable *table)
}
}
vtkDataArray
*
x
=
array
[
0
];
vtkDataArray
*
x
=
array
[
0
];
vtkDataArray
*
y
=
array
[
1
];
vtkDataArray
*
y
=
array
[
1
];
if
(
x
==
nullptr
||
y
==
nullptr
)
return
false
;
// Now copy the components into their new columns
// Now copy the components into their new columns
if
(
this
->
UseIndexForXSeries
)
if
(
this
->
UseIndexForXSeries
)
...
@@ -868,7 +869,7 @@ bool vtkPlotPointsErrorBars::UpdateTableCache(vtkTable *table)
...
@@ -868,7 +869,7 @@ bool vtkPlotPointsErrorBars::UpdateTableCache(vtkTable *table)
if
(
xErr
)
if
(
xErr
)
{
{
switch
(
xErr
->
GetDataType
())
switch
(
xErr
->
GetDataType
())
{
{
vtkTemplateMacro
(
CopyToXErrors
(
vtkTemplateMacro
(
CopyToXErrors
(
this
->
XErrors
,
static_cast
<
VTK_TT
*>
(
xErr
->
GetVoidPointer
(
0
)),
this
->
XErrors
,
static_cast
<
VTK_TT
*>
(
xErr
->
GetVoidPointer
(
0
)),
int
(
xErr
->
GetNumberOfTuples
()),
this
->
ShiftScale
));
int
(
xErr
->
GetNumberOfTuples
()),
this
->
ShiftScale
));
...
...
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