Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor 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
cdo
Commits
f7fdc765
Commit
f7fdc765
authored
1 month ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
cdo_cmpstr: changed parameter type to std::string_view
parent
184fe6e2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!337
cdo_cmpstr: changed parameter type to std::string_view
Pipeline
#98309
failed
1 month ago
Stage: build
Stage: check
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/after_sptrans.cc
+1
-0
1 addition, 0 deletions
src/after_sptrans.cc
src/compare.h
+2
-9
2 additions, 9 deletions
src/compare.h
src/grid_from_name.cc
+5
-5
5 additions, 5 deletions
src/grid_from_name.cc
with
8 additions
and
14 deletions
src/after_sptrans.cc
+
1
−
0
View file @
f7fdc765
...
...
@@ -6,6 +6,7 @@
*/
#include
<cmath>
#include
<cstring>
#include
"cdo_options.h"
#include
"cdo_omp.h"
...
...
This diff is collapsed.
Click to expand it.
src/compare.h
+
2
−
9
View file @
f7fdc765
...
...
@@ -2,8 +2,7 @@
#define COMPARE_H
#include
<cmath>
#include
<cstring>
#include
<string>
#include
<string_view>
// compare
// clang-format off
...
...
@@ -15,13 +14,7 @@ const auto fp_is_equal = [](auto a, auto b) noexcept { return ((std::isnan(
// clang-format on
static
inline
bool
cdo_cmpstr
(
const
char
*
x
,
const
char
*
y
)
{
return
(
strcmp
(
x
,
y
)
==
0
);
}
static
inline
bool
cdo_cmpstr
(
std
::
string_view
lhs
,
const
std
::
string
&
rhs
)
cdo_cmpstr
(
std
::
string_view
lhs
,
std
::
string_view
rhs
)
{
return
(
lhs
.
compare
(
rhs
)
==
0
);
}
...
...
This diff is collapsed.
Click to expand it.
src/grid_from_name.cc
+
5
−
5
View file @
f7fdc765
...
...
@@ -533,15 +533,15 @@ generate_grid_gaussian(GridDesciption &grid, std::string gridname)
if
(
gridname
.
size
())
{
int
intVal
=
0
;
int
intVal
ue
=
0
;
std
::
vector
<
char
>
typeString
(
gridname
.
size
(),
0
);
auto
numVals
=
sscanf
(
gridname
.
c_str
(),
"%d%s"
,
&
intVal
,
typeString
.
data
());
auto
numVal
ue
s
=
sscanf
(
gridname
.
c_str
(),
"%d%s"
,
&
intVal
ue
,
typeString
.
data
());
// printf("%s: %d %d%s\n", gridname.c_str(), numVals, intVal, typeString.data());
if
(
numVals
<=
0
||
numVals
>
2
)
return
;
if
(
intVal
<
0
)
return
;
if
(
numVal
ue
s
<=
0
||
numVal
ue
s
>
2
)
return
;
if
(
intVal
ue
<
0
)
return
;
grid
.
ntr
=
intVal
;
grid
.
ntr
=
intVal
ue
;
// clang-format off
if
(
cdo_cmpstr
(
typeString
.
data
(),
"grid"
))
grid
.
type
=
GRID_GAUSSIAN
;
else
if
(
cdo_cmpstr
(
typeString
.
data
(),
"zon"
))
grid
.
type
=
GRID_GAUSSIAN
;
...
...
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