Skip to content
GitLab
Menu
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
1386c731
Commit
1386c731
authored
May 31, 2017
by
Uwe Schulzweida
Browse files
Change data type of zsize to size_t.
parent
31b8b25a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/stream_cdf_i.c
View file @
1386c731
...
...
@@ -2821,7 +2821,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
bool
with_bounds
=
false
;
int
zdimid
=
CDI_UNDEFID
;
int
zvarid
=
CDI_UNDEFID
;
in
t
zsize
=
1
;
size_
t
zsize
=
1
;
int
psvarid
=
-
1
;
int
p0varid
=
-
1
;
...
...
@@ -2845,11 +2845,11 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
{
// zvarid = ncdims[zdimid].ncvarid;
zvarid
=
(
ncvar
->
zvarid
!=
CDI_UNDEFID
)
?
ncvar
->
zvarid
:
ncdims
[
zdimid
].
ncvarid
;
zsize
=
(
int
)
ncdims
[
zdimid
].
len
;
zsize
=
ncdims
[
zdimid
].
len
;
}
}
if
(
CDI_Debug
)
Message
(
"nlevs = %
d
"
,
zsize
);
if
(
CDI_Debug
)
Message
(
"nlevs = %
zu
"
,
zsize
);
double
*
zvar
=
NULL
;
char
**
zcvals
=
NULL
;
...
...
@@ -2882,7 +2882,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
{
zprec
=
CDI_DATATYPE_UINT8
;
zclength
=
(
size_t
)
ncdims
[
ncvars
[
zvarid
].
dimids
[
1
]].
len
;
cdf_load_cvals
(
zsize
*
zclength
,
zvarid
,
ncvar
,
&
zcvals
,
(
size_t
)
zsize
);
cdf_load_cvals
(
zsize
*
zclength
,
zvarid
,
ncvar
,
&
zcvals
,
zsize
);
}
}
...
...
@@ -2897,7 +2897,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
if
(
zaxisType
!=
ZAXIS_CHAR
)
{
zvar
=
(
double
*
)
Malloc
(
(
size_t
)
zsize
*
sizeof
(
double
));
zvar
=
(
double
*
)
Malloc
(
zsize
*
sizeof
(
double
));
cdf_get_var_double
(
ncvars
[
zvarid
].
ncid
,
zvarid
,
zvar
);
}
...
...
@@ -2906,16 +2906,16 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
int
nbdims
=
ncvars
[
ncvars
[
zvarid
].
bounds
].
ndims
;
if
(
nbdims
==
2
||
is_scalar
)
{
in
t
nlevel
=
is_scalar
?
1
:
(
int
)
ncdims
[
ncvars
[
ncvars
[
zvarid
].
bounds
].
dimids
[
0
]].
len
;
size_
t
nlevel
=
is_scalar
?
1
:
(
int
)
ncdims
[
ncvars
[
ncvars
[
zvarid
].
bounds
].
dimids
[
0
]].
len
;
int
nvertex
=
(
int
)
ncdims
[
ncvars
[
ncvars
[
zvarid
].
bounds
].
dimids
[
1
-
is_scalar
]].
len
;
if
(
nlevel
==
zsize
&&
nvertex
==
2
)
{
with_bounds
=
true
;
lbounds
=
(
double
*
)
Malloc
(
4
*
(
size_t
)
nlevel
*
sizeof
(
double
));
lbounds
=
(
double
*
)
Malloc
(
4
*
nlevel
*
sizeof
(
double
));
ubounds
=
lbounds
+
nlevel
;
double
*
restrict
zbounds
=
lbounds
+
2
*
nlevel
;
cdf_get_var_double
(
ncvars
[
zvarid
].
ncid
,
ncvars
[
zvarid
].
bounds
,
zbounds
);
for
(
in
t
i
=
0
;
i
<
nlevel
;
++
i
)
for
(
size_
t
i
=
0
;
i
<
nlevel
;
++
i
)
{
lbounds
[
i
]
=
zbounds
[
i
*
2
];
ubounds
[
i
]
=
zbounds
[
i
*
2
+
1
];
...
...
@@ -2980,7 +2980,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
cdiZaxisDefKeyStr(zaxisID, CDI_KEY_VDIMNAME, strlen(ncdims[vdimid].name)+1, ncdims[vdimid].name);
*/
if
(
zvar
)
Free
(
zvar
);
if
(
zcvals
)
if
(
zcvals
)
{
for
(
size_t
i
=
0
;
i
<
zsize
;
i
++
)
Free
(
zcvals
[
i
]);
...
...
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