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
mpim-sw
libcdi
Commits
2c5411c5
Commit
2c5411c5
authored
Mar 21, 2019
by
Uwe Schulzweida
Browse files
zaxisDefLevels: check number of levels.
parent
4f669581
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
2c5411c5
...
...
@@ -2,6 +2,10 @@
* Version 1.9.7 released
2019-03-21 Uwe Schulzweida
* zaxisDefLevels: check number of levels
2019-03-15 Uwe Schulzweida
* gridInqParamLCC: set gridtype to GRID_PROJECTION
...
...
src/zaxis.c
View file @
2c5411c5
...
...
@@ -256,6 +256,7 @@ int zaxisCreate(int zaxistype, int size)
{
if
(
CDI_Debug
)
Message
(
"zaxistype: %d size: %d "
,
zaxistype
,
size
);
xassert
(
size
);
zaxisInit
();
return
zaxisCreate_
(
zaxistype
,
size
,
CDI_UNDEFID
);
...
...
@@ -760,12 +761,13 @@ The function @func{zaxisDefLevels} defines the levels of a Z-axis.
*/
void
zaxisDefLevels
(
int
zaxisID
,
const
double
*
levels
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
size_t
size
=
(
size_t
)
zaxisptr
->
size
;
if
(
levels
)
{
if
(
zaxisptr
->
vals
==
NULL
)
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
const
size_t
size
=
(
size_t
)
zaxisptr
->
size
;
xassert
(
size
);
if
(
zaxisptr
->
vals
==
NULL
&&
size
)
zaxisptr
->
vals
=
(
double
*
)
Malloc
(
size
*
sizeof
(
double
));
double
*
vals
=
zaxisptr
->
vals
;
...
...
@@ -780,18 +782,19 @@ void zaxisDefLevels(int zaxisID, const double *levels)
void
zaxisDefCvals
(
int
zaxisID
,
const
char
**
cvals
,
int
clen
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
int
size
=
zaxisptr
->
size
;
if
(
cvals
&&
clen
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
const
size_t
size
=
zaxisptr
->
size
;
xassert
(
size
);
zaxisptr
->
clength
=
clen
;
zaxisptr
->
cvals
=
(
char
**
)
Malloc
(
(
size_t
)
size
*
sizeof
(
char
*
));
if
(
size
)
zaxisptr
->
cvals
=
(
char
**
)
Malloc
(
size
*
sizeof
(
char
*
));
for
(
in
t
ilev
=
0
;
ilev
<
size
;
++
ilev
)
for
(
size_
t
ilev
=
0
;
ilev
<
size
;
++
ilev
)
{
zaxisptr
->
cvals
[
ilev
]
=
(
char
*
)
Malloc
(
(
size_t
)
clen
*
sizeof
(
char
));
memcpy
(
zaxisptr
->
cvals
[
ilev
],
cvals
[
ilev
],
(
size_t
)
clen
*
sizeof
(
char
));
zaxisptr
->
cvals
[
ilev
]
=
(
char
*
)
Malloc
(
clen
*
sizeof
(
char
));
memcpy
(
zaxisptr
->
cvals
[
ilev
],
cvals
[
ilev
],
clen
*
sizeof
(
char
));
}
reshSetStatus
(
zaxisID
,
&
zaxisOps
,
RESH_DESYNC_IN_USE
);
}
...
...
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