Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mpim-sw
cdo
Commits
6d75d1c3
Commit
6d75d1c3
authored
Jan 18, 2021
by
Uwe Schulzweida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cppcheck warnings.
parent
3e9f4f34
Pipeline
#5780
passed with stages
in 14 minutes and 50 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
27 deletions
+18
-27
src/array.h
src/array.h
+6
-6
src/cdo.cc
src/cdo.cc
+1
-1
src/cdo_output.cc
src/cdo_output.cc
+1
-1
src/cmortable_parser.cc
src/cmortable_parser.cc
+3
-3
src/kdtreelib/kdtree.h
src/kdtreelib/kdtree.h
+2
-4
src/kdtreelib/kdtree_common.cc
src/kdtreelib/kdtree_common.cc
+5
-12
No files found.
src/array.h
View file @
6d75d1c3
...
...
@@ -38,7 +38,7 @@ CheckVector
size_t
m_count
;
CheckVector
()
:
ptr
(
dummy
),
m_count
(
0
)
{
}
CheckVector
(
size_t
count
)
:
ptr
(
dummy
),
m_count
(
count
)
{
}
explicit
CheckVector
(
size_t
count
)
:
ptr
(
dummy
),
m_count
(
count
)
{
}
CheckVector
(
size_t
count
,
const
T
&
value
)
:
ptr
(
dummy
),
m_count
(
count
)
{
ptr
[
0
]
=
value
;
}
T
*
begin
()
noexcept
{
return
&
ptr
[
0
];
}
...
...
@@ -58,19 +58,19 @@ CheckVector
void
push_back
(
const
T
&
value
)
{
ptr
[
0
]
=
value
;
}
T
*
data
()
noexcept
{
return
ptr
;
}
const
T
*
data
()
const
noexcept
{
return
ptr
;
}
const
T
*
data
()
const
noexcept
{
return
ptr
;
}
T
&
operator
[](
size_t
pos
)
{
(
void
)
pos
;
return
ptr
[
0
];
}
const
T
&
operator
[](
size_t
pos
)
const
{
(
void
)
pos
;
return
ptr
[
0
];
}
CheckVector
&
operator
=
(
const
CheckVector
&
other
)
{
(
void
)
other
;
return
*
this
;
}
CheckVector
&
operator
=
(
CheckVector
&&
other
)
{
(
void
)
other
;
return
*
this
;
}
CheckVector
&
operator
=
(
const
CheckVector
&
other
)
{
(
void
)
other
;
ptr
=
dummy
;
m_count
=
0
;
return
*
this
;
}
CheckVector
&
operator
=
(
CheckVector
&&
other
)
{
(
void
)
other
;
ptr
=
dummy
;
m_count
=
0
;
return
*
this
;
}
// Copy constructor
CheckVector
(
const
CheckVector
&
v2
)
{
ptr
[
0
]
=
v2
.
ptr
[
0
];
}
CheckVector
(
const
CheckVector
&
v2
)
{
m_count
=
0
;
ptr
[
0
]
=
v2
.
ptr
[
0
];
}
bool
operator
==
(
const
CheckVector
&
other
)
{
(
void
)
other
;
return
true
;
}
private:
T
dummy
[
1
];
T
dummy
[
1
]
=
{
0
}
;
};
template
<
typename
T
>
...
...
src/cdo.cc
View file @
6d75d1c3
...
...
@@ -852,7 +852,7 @@ print_system_info()
#ifdef _OPENMP
fprintf
(
stderr
,
"OPENMP VERSION = %d
\n
"
,
_OPENMP
);
#endif
fprintf
(
stderr
,
"__cplusplus = %ld
\n
"
,
__cplusplus
);
fprintf
(
stderr
,
"__cplusplus = %ld
\n
"
,
(
long
)
__cplusplus
);
#ifdef __GNUC__
fprintf
(
stderr
,
"GNUC VERSION = %d
\n
"
,
__GNUC__
);
#endif
...
...
src/cdo_output.cc
View file @
6d75d1c3
...
...
@@ -112,7 +112,7 @@ getNCErrString(int filetype, const char *progname)
:
((
filetype
==
CDI_FILETYPE_NC2
)
?
"2"
:
((
filetype
==
CDI_FILETYPE_NC5
)
?
"5"
:
""
));
#ifdef HAVE_LIBNETCDF
const
char
*
format
=
"%s was build with a NetCDF version which doesn't support NetCDF%s data!"
;
size_t
finalSize
=
snprintf
(
nullptr
,
0
,
format
,
progname
,
ncv
,
ncv
);
size_t
finalSize
=
snprintf
(
nullptr
,
0
,
format
,
progname
,
ncv
);
char
*
errStr
=
(
char
*
)
malloc
(
finalSize
+
1
);
sprintf
(
errStr
,
format
,
progname
,
ncv
);
#else
...
...
src/cmortable_parser.cc
View file @
6d75d1c3
...
...
@@ -319,10 +319,10 @@ parseCmortablebufJson(PMList &pmlist, size_t buffersize, char *buffer, const cha
switch
(
status
)
{
case
JSMN_ERROR_INVAL
:
fprintf
(
stderr
,
"JSON error: Invalid character in %s (line=%
d
character='%c')!
\n
"
,
filename
,
p
->
lineno
,
buffer
[
p
->
pos
]);
fprintf
(
stderr
,
"JSON error: Invalid character in %s (line=%
u
character='%c')!
\n
"
,
filename
,
p
->
lineno
,
buffer
[
p
->
pos
]);
break
;
case
JSMN_ERROR_PART
:
fprintf
(
stderr
,
"JSON error: End of string not found in %s (line=%
d
)!
\n
"
,
filename
,
p
->
lineno
);
break
;
default:
fprintf
(
stderr
,
"JSON error in %s (line=%
d
)
\n
"
,
filename
,
p
->
lineno
);
break
;
case
JSMN_ERROR_PART
:
fprintf
(
stderr
,
"JSON error: End of string not found in %s (line=%
u
)!
\n
"
,
filename
,
p
->
lineno
);
break
;
default:
fprintf
(
stderr
,
"JSON error in %s (line=%
u
)
\n
"
,
filename
,
p
->
lineno
);
break
;
}
}
...
...
src/kdtreelib/kdtree.h
View file @
6d75d1c3
...
...
@@ -152,10 +152,8 @@ void kd_printNode(struct kdNode *node);
void
kd_printTree
(
struct
kdNode
*
node
);
/* Functions for building and destroying trees */
struct
kdNode
*
kd_allocNodeP
(
kdNodePool
*
nodepool
,
struct
kd_point
*
points
,
size_t
pivot
,
kdata_t
*
min
,
kdata_t
*
max
,
int
dim
,
int
axis
);
struct
kdNode
*
kd_allocNode
(
struct
kd_point
*
points
,
size_t
pivot
,
kdata_t
*
min
,
kdata_t
*
max
,
int
dim
,
int
axis
);
struct
kdNode
*
kd_allocNodeP
(
kdNodePool
*
nodepool
,
struct
kd_point
*
points
,
size_t
pivot
,
kdata_t
*
min
,
kdata_t
*
max
,
int
axis
,
int
dim
);
struct
kdNode
*
kd_allocNode
(
struct
kd_point
*
points
,
size_t
pivot
,
kdata_t
*
min
,
kdata_t
*
max
,
int
axis
,
int
dim
);
void
kd_doDestroyTree
(
struct
kdNode
*
node
);
void
kd_destroyTree
(
kdTree_t
*
tree
);
void
kd_initArg
(
struct
kd_thread_data
*
d
,
kdNodePool_t
*
nodepool
,
struct
kd_point
*
points
,
size_t
nPoints
,
...
...
src/kdtreelib/kdtree_common.cc
View file @
6d75d1c3
...
...
@@ -135,8 +135,7 @@ void kd_nodepool_delete(kdNodePool_t *nodepool)
}
struct
kdNode
*
kd_allocNode
(
struct
kd_point
*
points
,
size_t
pivot
,
kdata_t
*
min
,
kdata_t
*
max
,
int
axis
,
int
dim
)
kd_allocNode
(
struct
kd_point
*
points
,
size_t
pivot
,
kdata_t
*
min
,
kdata_t
*
max
,
int
axis
,
int
dim
)
{
struct
kdNode
*
node
;
...
...
@@ -154,8 +153,7 @@ kd_allocNode(struct kd_point *points, size_t pivot,
}
struct
kdNode
*
kd_allocNodeP
(
kdNodePool
*
nodepool
,
struct
kd_point
*
points
,
size_t
pivot
,
kdata_t
*
min
,
kdata_t
*
max
,
int
axis
,
int
dim
)
kd_allocNodeP
(
kdNodePool
*
nodepool
,
struct
kd_point
*
points
,
size_t
pivot
,
kdata_t
*
min
,
kdata_t
*
max
,
int
axis
,
int
dim
)
{
struct
kdNode
*
node
;
...
...
@@ -227,21 +225,16 @@ void *kd_doBuildTree(void *threadarg)
int
sortaxis
=
depth
%
dim
;
if
(
nPoints
==
1
)
{
if
((
node
=
kd_allocNodeP
(
nodepool
,
points
,
0
,
min
,
max
,
sortaxis
,
dim
))
==
NULL
)
return
NULL
;
if
((
node
=
kd_allocNodeP
(
nodepool
,
points
,
0
,
min
,
max
,
sortaxis
,
dim
))
==
NULL
)
return
NULL
;
node
->
index
=
points
[
0
].
index
;
return
node
;
}
/*
* If this iteration is allowed to start more threads, we first
* use them to parallelize the sorting
*/
// If this iteration is allowed to start more threads, we first use them to parallelize the sorting
pmergesort
(
points
,
nPoints
,
sortaxis
,
max_threads
);
size_t
pivot
=
nPoints
/
2
;
if
((
node
=
kd_allocNodeP
(
nodepool
,
points
,
pivot
,
min
,
max
,
sortaxis
,
dim
))
==
NULL
)
return
NULL
;
if
((
node
=
kd_allocNodeP
(
nodepool
,
points
,
pivot
,
min
,
max
,
sortaxis
,
dim
))
==
NULL
)
return
NULL
;
memcpy
(
tmpMaxLeft
,
max
,
dim
*
sizeof
(
kdata_t
));
tmpMaxLeft
[
sortaxis
]
=
node
->
location
[
sortaxis
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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