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
3f5875bc
Commit
3f5875bc
authored
Aug 09, 2018
by
Uwe Schulzweida
Browse files
Removed MSC error add warnings.
parent
bb517459
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/cdi_util.c
View file @
3f5875bc
#if defined (HAVE_CONFIG_H)
# include "config.h"
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
#ifdef HAVE_UNISTD_H
#include
<unistd.h>
#endif
#include
<limits.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<unistd.h>
#include
"cdi.h"
#include
"cdi_int.h"
...
...
src/config.h.in
View file @
3f5875bc
...
...
@@ -188,6 +188,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
...
...
src/file.c
View file @
3f5875bc
...
...
@@ -2,6 +2,10 @@
#include
"config.h"
#endif
#ifdef HAVE_UNISTD_H
#include
<unistd.h>
#endif
#include
<assert.h>
#include
<ctype.h>
#include
<errno.h>
...
...
@@ -12,10 +16,12 @@
#include
<stdlib.h>
#include
<stdbool.h>
#include
<string.h>
#include
<unistd.h>
#include
<sys/types.h>
#include
<sys/stat.h>
#ifdef HAVE_SYS_TIME_H
#include
<sys/time.h>
// gettimeofday()
#endif
#include
"dmemory.h"
#include
"error.h"
...
...
@@ -346,10 +352,14 @@ int pagesize(void)
static
double
file_time
()
{
#ifdef HAVE_SYS_TIME_H
struct
timeval
mytime
;
gettimeofday
(
&
mytime
,
NULL
);
double
tseconds
=
(
double
)
mytime
.
tv_sec
+
(
double
)
mytime
.
tv_usec
*
1.0e-6
;
return
tseconds
;
#else
return
0
;
#endif
}
void
fileDebug
(
int
debug
)
...
...
src/grid.c
View file @
3f5875bc
...
...
@@ -94,7 +94,7 @@ bool cdiInqAttConvertedToFloat(int gridID, int atttype, const char *attname, int
if
(
atttype
==
CDI_DATATYPE_INT32
)
{
int
attint
[
attlen
];
int
attint
[
64
];
cdiInqAttInt
(
gridID
,
CDI_GLOBAL
,
attname
,
attlen
,
attint
);
for
(
int
i
=
0
;
i
<
attlen
;
++
i
)
attflt
[
i
]
=
(
double
)
attint
[
i
];
}
...
...
@@ -2370,6 +2370,7 @@ bool gridCompare(int gridID, const grid_t *grid, bool coord_compare)
gridID
,
grid
->
scanningMode
,
gridInqScanningMode
(
gridID
),
grid
->
uvRelativeToGrid
,
gridInqUvRelativeToGrid
(
gridID
)
);
#endif // HIRLAM_EXTENSIONS
}
return
differ
;
}
...
...
@@ -3981,7 +3982,7 @@ The function @func{gridDefNumber} defines the reference number for an unstructur
@EndFunction
*/
void
gridDefNumber
(
int
gridID
,
const
int
number
)
void
gridDefNumber
(
int
gridID
,
int
number
)
{
grid_t
*
gridptr
=
grid_to_pointer
(
gridID
);
...
...
src/make_cdilib
View file @
3f5875bc
...
...
@@ -32,18 +32,29 @@ cat > ${PROG} << EOR
/* CDILIB_VERSION=
${
CDILIBVERSION
}
*/
#if defined(_WIN32) || defined(_WIN64)
#define restrict
#define ssize_t long
#else
#define HAVE_UNISTD_H
#endif
#ifdef _ARCH_PWR6
#pragma options nostrict
#endif
#if
def
ined (
HAVE_CONFIG_H
)
#
include "config.h"
#ifdef
HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
...
...
@@ -56,35 +67,31 @@ cat > ${PROG} << EOR
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#ifndef _SX
#include <aio.h>
#endif
#include <stdbool.h>
#include <assert.h>
#if
def
ined (
HAVE_LIBGRIB_API
)
#
include <grib_api.h>
#ifdef
HAVE_LIBGRIB_API
#include <grib_api.h>
#endif
#if
def
ined (
HAVE_MMAP
)
#
include <sys/mman.h> /* mmap() is defined in this header */
#ifdef
HAVE_MMAP
#include <sys/mman.h> /* mmap() is defined in this header */
#endif
#if
def
ined (
HAVE_LIBPTHREAD
)
#
include <pthread.h>
#ifdef
HAVE_LIBPTHREAD
#include <pthread.h>
#endif
#if
def
ined (
HAVE_LIBSZ
)
#
include <szlib.h>
#ifdef
HAVE_LIBSZ
#include <szlib.h>
#endif
#if
! defined (
HAVE_CONFIG_H
)
#
define HAVE_LIBGRIB 1
#
define HAVE_LIBCGRIBEX 1
#
define HAVE_LIBSERVICE 1
#
define HAVE_LIBEXTRA 1
#
define HAVE_LIBIEG 1
#if
ndef
HAVE_CONFIG_H
#define HAVE_LIBGRIB 1
#define HAVE_LIBCGRIBEX 1
#define HAVE_LIBSERVICE 1
#define HAVE_LIBEXTRA 1
#define HAVE_LIBIEG 1
#endif
EOR
...
...
src/make_cdilib_nc
View file @
3f5875bc
...
...
@@ -36,18 +36,29 @@ cat > ${PROG} << EOR
#define HAVE_LIBNETCDF
#if defined(_WIN32) || defined(_WIN64)
#define restrict
#define ssize_t long
#else
#define HAVE_UNISTD_H
#endif
#ifdef _ARCH_PWR6
#pragma options nostrict
#endif
#if
def
ined
(
HAVE_CONFIG_H
)
#
include "config.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
...
...
@@ -60,27 +71,23 @@ cat > ${PROG} << EOR
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#ifndef _SX
#include <aio.h>
#endif
#include <stdbool.h>
#include <assert.h>
#if
def
ined (
HAVE_LIBGRIB_API
)
#
include <grib_api.h>
#ifdef
HAVE_LIBGRIB_API
#include <grib_api.h>
#endif
#if
def
ined (
HAVE_MMAP
)
#
include <sys/mman.h> /* mmap() is defined in this header */
#ifdef
HAVE_MMAP
#include <sys/mman.h> /* mmap() is defined in this header */
#endif
#if
def
ined (
HAVE_LIBPTHREAD
)
#
include <pthread.h>
#ifdef
HAVE_LIBPTHREAD
#include <pthread.h>
#endif
#if
def
ined (
HAVE_LIBSZ
)
#
include <szlib.h>
#ifdef
HAVE_LIBSZ
#include <szlib.h>
#endif
static void tableDefault(void) {}
...
...
src/stream_cdf_i.c
View file @
3f5875bc
...
...
@@ -842,7 +842,8 @@ bool isHybridSigmaPressureCoordinate(int ncid, int ncvarid, ncvar_t *ncvars, con
if
(
p0varid1
!=
-
1
&&
p0varid1
==
p0varid2
)
cdf_get_var_double
(
ncid
,
p0varid2
,
&
px
);
double
abuf
[
dimlen
*
2
],
bbuf
[
dimlen
*
2
];
double
*
abuf
=
(
double
*
)
Malloc
(
dimlen
*
2
*
sizeof
(
double
));
double
*
bbuf
=
(
double
*
)
Malloc
(
dimlen
*
2
*
sizeof
(
double
));
cdf_get_var_double
(
ncid
,
avarid2
,
abuf
);
cdf_get_var_double
(
ncid
,
bvarid2
,
bbuf
);
...
...
@@ -867,6 +868,9 @@ bool isHybridSigmaPressureCoordinate(int ncid, int ncvarid, ncvar_t *ncvars, con
}
}
Free
(
abuf
);
Free
(
bbuf
);
if
(
p0varid1
!=
-
1
&&
IS_NOT_EQUAL
(
px
,
1
)
)
for
(
size_t
i
=
0
;
i
<
dimlen
+
1
;
++
i
)
vct
[
i
]
*=
px
;
...
...
@@ -892,7 +896,7 @@ void cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID)
cdf_inq_atttype
(
ncid
,
ncvarid
,
attname
,
&
atttype
);
if
(
xtypeIsInt
(
atttype
)
)
{
int
attint
[
attlen
]
;
int
*
attint
=
(
int
*
)
Malloc
(
attlen
*
sizeof
(
int
))
;
cdfGetAttInt
(
ncid
,
ncvarid
,
attname
,
attlen
,
attint
);
int
datatype
=
(
atttype
==
NC_SHORT
)
?
CDI_DATATYPE_INT16
:
(
atttype
==
NC_BYTE
)
?
CDI_DATATYPE_INT8
:
...
...
@@ -903,13 +907,15 @@ void cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID)
#endif
CDI_DATATYPE_INT32
;
cdiDefAttInt
(
cdiID
,
varID
,
attname
,
datatype
,
(
int
)
attlen
,
attint
);
Free
(
attint
);
}
else
if
(
xtypeIsFloat
(
atttype
)
)
{
double
attflt
[
attlen
]
;
double
*
attflt
=
(
double
*
)
Malloc
(
attlen
*
sizeof
(
double
))
;
cdfGetAttDouble
(
ncid
,
ncvarid
,
attname
,
attlen
,
attflt
);
int
datatype
=
(
atttype
==
NC_FLOAT
)
?
CDI_DATATYPE_FLT32
:
CDI_DATATYPE_FLT64
;
cdiDefAttFlt
(
cdiID
,
varID
,
attname
,
datatype
,
(
int
)
attlen
,
attflt
);
Free
(
attflt
);
}
else
if
(
xtypeIsText
(
atttype
)
)
{
...
...
src/util.c
View file @
3f5875bc
#if
def
ined (
HAVE_CONFIG_H
)
#
include "config.h"
#ifdef
HAVE_CONFIG_H
#include
"config.h"
#endif
#define _XOPEN_SOURCE 600
...
...
@@ -10,7 +10,6 @@
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<sys/types.h>
#include
"cdi.h"
#include
"cdi_int.h"
...
...
@@ -109,8 +108,10 @@ char* cdiUnescapeSpaces(const char* string, const char** outStringEnd)
return
result
;
}
#if defined (HAVE_DECL_UUID_GENERATE) && defined (HAVE_UUID_UUID_H)
#if defined(HAVE_DECL_UUID_GENERATE) && defined(HAVE_UUID_UUID_H)
#ifdef HAVE_SYS_TIME_H
#include
<sys/time.h>
#endif
#include
<uuid/uuid.h>
void
cdiCreateUUID
(
unsigned
char
*
uuid
)
{
...
...
@@ -194,7 +195,9 @@ void cdiCreateUUID(unsigned char *uuid)
}
# endif
#else
#ifdef HAVE_SYS_TIME_H
#include
<sys/time.h>
#endif
void
cdiCreateUUID
(
unsigned
char
*
uuid
)
{
static
int
uuid_seeded
=
0
;
...
...
@@ -205,6 +208,7 @@ void cdiCreateUUID(unsigned char *uuid)
caller_rand_state
=
setstate
(
uuid_rand_state
);
else
{
#ifdef HAVE_SYS_TIME_H
struct
timeval
tv
;
int
status
=
gettimeofday
(
&
tv
,
NULL
);
if
(
status
!=
0
)
...
...
@@ -213,6 +217,9 @@ void cdiCreateUUID(unsigned char *uuid)
exit
(
1
);
}
unsigned
seed
=
tv
.
tv_sec
^
tv
.
tv_usec
;
#else
unsigned
seed
=
0
;
#endif
caller_rand_state
=
initstate
(
seed
,
uuid_rand_state
,
sizeof
(
uuid_rand_state
));
uuid_seeded
=
1
;
...
...
@@ -225,6 +232,7 @@ void cdiCreateUUID(unsigned char *uuid)
static
unsigned
short
our_rand_state
[
3
];
if
(
!
uuid_seeded
)
{
#ifdef HAVE_SYS_TIME_H
struct
timeval
tv
;
int
status
=
gettimeofday
(
&
tv
,
NULL
);
if
(
status
!=
0
)
...
...
@@ -233,6 +241,9 @@ void cdiCreateUUID(unsigned char *uuid)
exit
(
1
);
}
unsigned
seed
=
tv
.
tv_sec
^
tv
.
tv_usec
;
#else
unsigned
seed
=
0
;
#endif
our_rand_state
[
0
]
=
0x330E
;
our_rand_state
[
1
]
=
(
unsigned
short
)(
seed
&
0xFFFFU
);
our_rand_state
[
2
]
=
(
unsigned
short
)((
seed
>>
16
)
&
0xFFFFU
);
...
...
src/zaxis.c
View file @
3f5875bc
...
...
@@ -832,7 +832,7 @@ void zaxisDefLevel(int zaxisID, int levelID, double level)
}
void
zaxisDefNlevRef
(
int
zaxisID
,
const
int
nhlev
)
void
zaxisDefNlevRef
(
int
zaxisID
,
int
nhlev
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
if
(
zaxisptr
->
nhlev
!=
nhlev
)
...
...
@@ -853,7 +853,7 @@ int zaxisInqNlevRef(int zaxisID)
@Function zaxisDefNumber
@Title Define the reference number for a generalized Z-axis
@Prototype void zaxisDefNumber(int zaxisID,
const
int number)
@Prototype void zaxisDefNumber(int zaxisID, int number)
@Parameter
@Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}.
@Item number Reference number for a generalized Z-axis.
...
...
@@ -863,7 +863,7 @@ The function @func{zaxisDefNumber} defines the reference number for a generalize
@EndFunction
*/
void
zaxisDefNumber
(
int
zaxisID
,
const
int
number
)
void
zaxisDefNumber
(
int
zaxisID
,
int
number
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
if
(
zaxisptr
->
number
!=
number
)
...
...
Write
Preview
Supports
Markdown
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