Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
c2e37cba
Commit
c2e37cba
authored
2 years ago
by
Raphael Schlarb
Committed by
Uwe Schulzweida
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Pass arguments by const pointer instead of value
parent
2c101f72
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!42
Develop
,
!39
M214003/develop
Pipeline
#31767
failed
2 years ago
Stage: external
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/stream_gribapi.c
+18
-18
18 additions, 18 deletions
src/stream_gribapi.c
with
18 additions
and
18 deletions
src/stream_gribapi.c
+
18
−
18
View file @
c2e37cba
...
...
@@ -870,31 +870,31 @@ gribapiVarSet(int param, int level1, int level2, int leveltype, int tsteptype, s
}
static
int
gribapiVarCompare
(
compvar2_t
compVar
,
record_t
record
,
int
flag
)
gribapiVarCompare
(
const
compvar2_t
*
compVar
,
const
record_t
*
record
,
int
flag
)
{
compvar2_t
compVar0
;
memset
(
&
compVar0
,
0
,
sizeof
(
compvar2_t
));
compVar0
.
param
=
record
.
param
;
compVar0
.
level1
=
record
.
ilevel
;
compVar0
.
level2
=
record
.
ilevel2
;
compVar0
.
ltype
=
record
.
ltype
;
compVar0
.
tsteptype
=
record
.
tsteptype
;
compVar0
.
gridsize
=
record
.
gridsize
;
memcpy
(
compVar0
.
name
,
record
.
varname
,
sizeof
(
compVar
.
name
));
compVar0
.
param
=
record
->
param
;
compVar0
.
level1
=
record
->
ilevel
;
compVar0
.
level2
=
record
->
ilevel2
;
compVar0
.
ltype
=
record
->
ltype
;
compVar0
.
tsteptype
=
record
->
tsteptype
;
compVar0
.
gridsize
=
record
->
gridsize
;
memcpy
(
compVar0
.
name
,
record
->
varname
,
sizeof
(
compVar
->
name
));
if
(
flag
==
0
)
{
if
(
compVar0
.
tsteptype
==
TSTEP_INSTANT
&&
compVar
.
tsteptype
==
TSTEP_INSTANT3
)
compVar0
.
tsteptype
=
TSTEP_INSTANT3
;
if
(
compVar0
.
tsteptype
==
TSTEP_INSTANT3
&&
compVar
.
tsteptype
==
TSTEP_INSTANT
)
compVar0
.
tsteptype
=
TSTEP_INSTANT
;
if
(
compVar0
.
tsteptype
==
TSTEP_INSTANT
&&
compVar
->
tsteptype
==
TSTEP_INSTANT3
)
compVar0
.
tsteptype
=
TSTEP_INSTANT3
;
if
(
compVar0
.
tsteptype
==
TSTEP_INSTANT3
&&
compVar
->
tsteptype
==
TSTEP_INSTANT
)
compVar0
.
tsteptype
=
TSTEP_INSTANT
;
}
compVar0
.
scanKeys
=
record
.
scanKeys
;
compVar0
.
tiles
=
record
.
tiles
;
compVar0
.
scanKeys
=
record
->
scanKeys
;
compVar0
.
tiles
=
record
->
tiles
;
// printf("var1: level1=%d level2=%d\n", compVar.level1, compVar.level2);
// printf("var2: level1=%d level2=%d\n", compVar0.level1, compVar0.level2);
return
memcmp
(
&
compVar0
,
&
compVar
,
sizeof
(
compvar2_t
));
return
memcmp
(
&
compVar0
,
compVar
,
sizeof
(
compvar2_t
));
}
static
grib_handle
*
...
...
@@ -958,7 +958,7 @@ checkTime(stream_t *streamptr, compvar2_t compVar, CdiDateTime verificationTime,
int
recID
=
0
;
for
(;
recID
<
streamptr
->
nrecs
;
recID
++
)
{
if
(
gribapiVarCompare
(
compVar
,
streamptr
->
tsteps
[
0
].
records
[
recID
],
1
)
==
0
)
break
;
if
(
gribapiVarCompare
(
&
compVar
,
&
streamptr
->
tsteps
[
0
].
records
[
recID
],
1
)
==
0
)
break
;
}
bool
recordExists
=
(
recID
<
streamptr
->
nrecs
);
...
...
@@ -1420,7 +1420,7 @@ gribapiScanTimestep2(stream_t *streamptr)
compvar2_t
compVar
=
gribapiVarSet
(
param
,
level1
,
level2
,
leveltype1
,
tsteptype
,
gridsize
,
varname
,
scanKeys
,
tiles
);
for
(
recID
=
0
;
recID
<
nrecords
;
recID
++
)
if
(
gribapiVarCompare
(
compVar
,
records
[
recID
],
0
)
==
0
)
break
;
if
(
gribapiVarCompare
(
&
compVar
,
&
records
[
recID
],
0
)
==
0
)
break
;
if
(
recID
==
nrecords
)
{
...
...
@@ -1460,7 +1460,7 @@ gribapiScanTimestep2(stream_t *streamptr)
paramstr
,
leveltype1
,
level1
,
level2
,
CdiDateTime_string
(
vDateTime
));
}
if
(
gribapiVarCompare
(
compVar
,
records
[
recID
],
0
)
!=
0
)
if
(
gribapiVarCompare
(
&
compVar
,
&
records
[
recID
],
0
)
!=
0
)
{
Message
(
"tsID = %d recID = %d param = %3d new %3d level = %3d new %3d"
,
tsID
,
recID
,
records
[
recID
].
param
,
param
,
records
[
recID
].
ilevel
,
level1
);
...
...
@@ -1602,7 +1602,7 @@ gribapiScanTimestep(stream_t *streamptr)
for
(
vrecID
=
0
;
vrecID
<
nrecs
;
vrecID
++
)
{
recID
=
streamptr
->
tsteps
[
1
].
recIDs
[
vrecID
];
if
(
gribapiVarCompare
(
compVar
,
records
[
recID
],
0
)
==
0
)
break
;
if
(
gribapiVarCompare
(
&
compVar
,
&
records
[
recID
],
0
)
==
0
)
break
;
}
if
(
vrecID
==
nrecs
)
...
...
@@ -1639,7 +1639,7 @@ gribapiScanTimestep(stream_t *streamptr)
if
(
CDI_Debug
)
Message
(
"%4d %8lld %4d %8d %8s"
,
rindex
+
1
,
(
long
long
)
recpos
,
param
,
level1
,
CdiDateTime_string
(
vDateTime
));
if
(
gribapiVarCompare
(
compVar
,
records
[
recID
],
0
)
!=
0
)
if
(
gribapiVarCompare
(
&
compVar
,
&
records
[
recID
],
0
)
!=
0
)
{
Message
(
"tsID = %d recID = %d param = %3d new %3d level = %3d new %3d"
,
tsID
,
recID
,
records
[
recID
].
param
,
param
,
records
[
recID
].
ilevel
,
level1
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment