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
6af51d85
Commit
6af51d85
authored
Nov 22, 2015
by
Uwe Schulzweida
Browse files
rename uuid2str() to cdiUUID2Str() and str2uuid() to cdiStr2UUID()
parent
bf1b34af
Changes
16
Hide whitespace changes
Inline
Side-by-side
.gitattributes
View file @
6af51d85
...
...
@@ -226,6 +226,7 @@ src/cdi_int.c -text
src/cdi_int.h -text
src/cdi_limits.h -text
src/cdi_util.c -text
src/cdi_uuid.h -text
src/cdilib.c -text
src/cdipio.h -text
src/cdipio.inc -text
...
...
@@ -237,7 +238,6 @@ src/cgribexlib.c -text
src/cksum.c -text
src/cksum.h -text
src/config.h.in -text
src/create_uuid.h -text
src/datetime.h -text
src/dmemory.c -text
src/dmemory.h -text
...
...
app/cdi.c
View file @
6af51d85
...
...
@@ -12,6 +12,8 @@
#include
<math.h>
#include
<cdi.h>
#include
<cdi_uuid.h>
int
vlistInqVarMissvalUsed
(
int
vlistID
,
int
varID
);
#ifndef DBL_IS_NAN
#if defined (HAVE_DECL_ISNAN)
...
...
app/printinfo.h
View file @
6af51d85
...
...
@@ -3,18 +3,6 @@
#define DATE_FORMAT "%5.4d-%2.2d-%2.2d"
#define TIME_FORMAT "%2.2d:%2.2d:%2.2d"
void
uuid2str
(
const
unsigned
char
uuid
[
CDI_UUID_SIZE
],
char
*
uuidstr
);
static
inline
int
cdiUUIDIsNull
(
const
unsigned
char
uuid
[
CDI_UUID_SIZE
])
{
int
isNull
=
1
;
for
(
size_t
i
=
0
;
i
<
CDI_UUID_SIZE
;
++
i
)
isNull
&=
(
uuid
[
i
]
==
0
);
return
isNull
;
}
void
datetime2str
(
int
date
,
int
time
,
char
*
datetimestr
,
int
maxlen
)
{
int
year
,
month
,
day
;
...
...
@@ -385,7 +373,7 @@ void printGridInfo(int vlistID)
if
(
!
cdiUUIDIsNull
(
uuidOfHGrid
)
)
{
char
uuidOfHGridStr
[
37
];
uuid2s
tr
(
uuidOfHGrid
,
uuidOfHGridStr
);
cdiUUID2S
tr
(
uuidOfHGrid
,
uuidOfHGridStr
);
if
(
uuidOfHGridStr
[
0
]
!=
0
&&
strlen
(
uuidOfHGridStr
)
==
36
)
{
fprintf
(
stdout
,
"%33s : %s
\n
"
,
"uuid"
,
uuidOfHGridStr
);
...
...
@@ -502,7 +490,7 @@ void printZaxisInfo(int vlistID)
if
(
!
cdiUUIDIsNull
(
uuidOfVGrid
)
)
{
char
uuidOfVGridStr
[
37
];
uuid2s
tr
(
uuidOfVGrid
,
uuidOfVGridStr
);
cdiUUID2S
tr
(
uuidOfVGrid
,
uuidOfVGridStr
);
if
(
uuidOfVGridStr
[
0
]
!=
0
&&
strlen
(
uuidOfVGridStr
)
==
36
)
{
fprintf
(
stdout
,
"%33s : "
,
"uuid"
);
...
...
src/Makefile.am
View file @
6af51d85
...
...
@@ -37,7 +37,7 @@ libcdi_la_SOURCES = \
cksum.h
\
cdi_cksum.c
\
cdi_cksum.h
\
c
reate
_uuid.h
\
c
di
_uuid.h
\
dtypes.h
\
error.c
\
error.h
\
...
...
src/Makefile.in
View file @
6af51d85
...
...
@@ -171,26 +171,26 @@ am__libcdi_la_SOURCES_DIST = basetime.c basetime.h binary.c binary.h \
calendar.c calendar.h cdf.c cdf.h cdf_int.c cdf_int.h cdi.h
\
cdi_error.c cdi_limits.h cdi_util.c cgribex.h cgribexlib.c
\
datetime.h dmemory.c dmemory.h cksum.c cksum.h cdi_cksum.c
\
cdi_cksum.h c
reate
_uuid.h dtypes.h error.c error.h exse.h
\
extra.h
extralib.c file.c file.h gaussgrid.c gaussgrid.h
\
gribapi.c
gribapi.h gribapi_utilities.h grid.c grid.h ieg.h
\
ieglib.c
input_file.c input_file.h institution.c institution.h
\
model.c
model.h namespace.c namespace.h serialize.h
\
serialize.c
referenceCounting.c referenceCounting.h
\
resource_handle.c
resource_handle.h service.h servicelib.c
\
stream_cdf.c
stream_cdf.h stream_cgribex.c stream_cgribex.h
\
stream_ext.c
stream_ext.h stream_grb.c stream_grb.h
\
stream_gribapi.
c
stream_
gribapi.h stream_history.c
\
stream_ieg.c stream_ieg.h
stream_fcommon.c stream_fcommon.h
\
cdi_int.c cdi_int.h
stream_record.c stream_srv.c stream_srv.h
\
stream_var.c
grb_write.c grb_read.c cdf_write.c cdf_read.c
\
subtype.c
subtype.h swap.h table.c table.h tablepar.h taxis.c
\
taxis.h
timebase.c timebase.h tsteps.c util.c varscan.c
\
varscan.h
version.c vlist.c vlist.h vlist_att.c vlist_att.h
\
vlist_var.c
vlist_var.h zaxis.c zaxis.h stream.c
\
stream_write.c
stream_read.c swap.c iterator.c iterator.h
\
iterator_fallback.
c
iterator_
fallback.h
iterator_grib.
c
\
iterator_grib.h cfortran.h
cdiFortran.c gribapi_utilities.c
cdi_cksum.h c
di
_uuid.h dtypes.h error.c error.h exse.h
extra.h
\
extralib.c file.c file.h gaussgrid.c gaussgrid.h
gribapi.c
\
gribapi.h gribapi_utilities.h grid.c grid.h ieg.h
ieglib.c
\
input_file.c input_file.h institution.c institution.h
model.c
\
model.h namespace.c namespace.h serialize.h
serialize.c
\
referenceCounting.c referenceCounting.h
resource_handle.c
\
resource_handle.h service.h servicelib.c
stream_cdf.c
\
stream_cdf.h stream_cgribex.c stream_cgribex.h
stream_ext.c
\
stream_ext.h stream_grb.c stream_grb.h
stream_gribapi.c
\
stream_gribapi.
h
stream_
history.c stream_ieg.c stream_ieg.h
\
stream_fcommon.c stream_fcommon.h
cdi_int.c cdi_int.h
\
stream_record.c stream_srv.c stream_srv.h
stream_var.c
\
grb_write.c grb_read.c cdf_write.c cdf_read.c
subtype.c
\
subtype.h swap.h table.c table.h tablepar.h taxis.c
taxis.h
\
timebase.c timebase.h tsteps.c util.c varscan.c
varscan.h
\
version.c vlist.c vlist.h vlist_att.c vlist_att.h
vlist_var.c
\
vlist_var.h zaxis.c zaxis.h stream.c
stream_write.c
\
stream_read.c swap.c iterator.c iterator.h
iterator_fallback.c
\
iterator_fallback.
h
iterator_
grib.c
iterator_grib.
h cfortran.h
\
cdiFortran.c gribapi_utilities.c
am__objects_1
=
cdiFortran.lo
@USE_FC_TRUE@
am__objects_2
=
$(am__objects_1)
am__objects_3
=
gribapi_utilities.lo
...
...
@@ -518,11 +518,11 @@ libcdi_la_SOURCES = basetime.c basetime.h binary.c binary.h calendar.c \
calendar.h cdf.c cdf.h cdf_int.c cdf_int.h cdi.h cdi_error.c
\
cdi_limits.h cdi_util.c cgribex.h cgribexlib.c datetime.h
\
dmemory.c dmemory.h cksum.c cksum.h cdi_cksum.c cdi_cksum.h
\
c
reate
_uuid.h dtypes.h error.c error.h exse.h extra.h
\
extralib.c
file.c file.h gaussgrid.c gaussgrid.h gribapi.c
\
gribapi.h
gribapi_utilities.h grid.c grid.h ieg.h ieglib.c
\
input_file.c
input_file.h institution.c institution.h model.c
\
model.h
namespace.c namespace.h serialize.h serialize.c
\
c
di
_uuid.h dtypes.h error.c error.h exse.h extra.h
extralib.c
\
file.c file.h gaussgrid.c gaussgrid.h gribapi.c
gribapi.h
\
gribapi_utilities.h grid.c grid.h ieg.h ieglib.c
input_file.c
\
input_file.h institution.c institution.h model.c
model.h
\
namespace.c namespace.h serialize.h serialize.c
\
referenceCounting.c referenceCounting.h resource_handle.c
\
resource_handle.h service.h servicelib.c stream_cdf.c
\
stream_cdf.h stream_cgribex.c stream_cgribex.h stream_ext.c
\
...
...
src/cdi_int.h
View file @
6af51d85
...
...
@@ -375,21 +375,8 @@ int getByteswap(int byteorder);
void
cdiStreamGetIndexList
(
unsigned
numIDs
,
int
IDs
[]);
void
cdiInitialize
(
void
);
void
uuid2str
(
const
unsigned
char
uuid
[],
char
uuidstr
[]);
int
str2uuid
(
const
char
*
uuidstr
,
unsigned
char
uuid
[]);
static
inline
int
cdiUUIDIsNull
(
const
unsigned
char
uuid
[])
{
int
isNull
=
1
;
for
(
size_t
i
=
0
;
i
<
CDI_UUID_SIZE
;
++
i
)
isNull
&=
(
uuid
[
i
]
==
0
);
return
isNull
;
}
char
*
cdiEscapeSpaces
(
const
char
*
string
);
char
*
cdiUnescapeSpaces
(
const
char
*
string
,
const
char
**
outStringEnd
);
...
...
src/c
reate
_uuid.h
→
src/c
di
_uuid.h
View file @
6af51d85
#ifndef C
REATE
_UUID_H
#define C
REATE
_UUID_H
#ifndef C
DI
_UUID_H
#define C
DI
_UUID_H
#if defined (HAVE_CONFIG_H)
# include "config.h"
...
...
@@ -7,8 +7,27 @@
#include
"cdi.h"
void
create_uuid
(
unsigned
char
uuid
[
CDI_UUID_SIZE
]);
#ifdef __cplusplus
extern
"C"
{
#endif
static
inline
int
cdiUUIDIsNull
(
const
unsigned
char
uuid
[])
{
int
isNull
=
1
;
for
(
size_t
i
=
0
;
i
<
CDI_UUID_SIZE
;
++
i
)
isNull
&=
(
uuid
[
i
]
==
0
);
return
isNull
;
}
void
cdiCreateUUID
(
unsigned
char
uuid
[
CDI_UUID_SIZE
]);
void
cdiUUID2Str
(
const
unsigned
char
uuid
[],
char
uuidstr
[]);
int
cdiStr2UUID
(
const
char
*
uuidstr
,
unsigned
char
uuid
[]);
#if defined (__cplusplus)
}
#endif
#endif
...
...
src/grid.c
View file @
6af51d85
...
...
@@ -10,6 +10,7 @@
#include
"cdi.h"
#include
"cdi_cksum.h"
#include
"cdi_int.h"
#include
"cdi_uuid.h"
#include
"grid.h"
#include
"gaussgrid.h"
#include
"resource_handle.h"
...
...
@@ -3328,7 +3329,7 @@ static void gridPrintKernel(grid_t * gridptr, int index, int opt, FILE *fp)
if
(
!
cdiUUIDIsNull
(
uuidOfHGrid
)
)
{
char
uuidOfHGridStr
[
37
];
uuid2s
tr
(
uuidOfHGrid
,
uuidOfHGridStr
);
cdiUUID2S
tr
(
uuidOfHGrid
,
uuidOfHGridStr
);
if
(
uuidOfHGridStr
[
0
]
!=
0
&&
strlen
(
uuidOfHGridStr
)
==
36
)
fprintf
(
fp
,
"uuid = %s
\n
"
,
uuidOfHGridStr
);
}
...
...
src/stream_cdf.c
View file @
6af51d85
...
...
@@ -20,6 +20,7 @@
#include
"basetime.h"
#include
"gaussgrid.h"
#include
"cdi_int.h"
#include
"cdi_uuid.h"
#include
"stream_cdf.h"
#include
"cdf.h"
#include
"cdf_int.h"
...
...
@@ -1800,7 +1801,7 @@ void cdfDefGridUUID(stream_t *streamptr, int gridID)
if
(
!
cdiUUIDIsNull
(
uuidOfHGrid
)
)
{
char
uuidOfHGridStr
[
37
];
uuid2s
tr
(
uuidOfHGrid
,
uuidOfHGridStr
);
cdiUUID2S
tr
(
uuidOfHGrid
,
uuidOfHGridStr
);
if
(
uuidOfHGridStr
[
0
]
!=
0
&&
strlen
(
uuidOfHGridStr
)
==
36
)
{
int
fileID
=
streamptr
->
fileID
;
...
...
@@ -1820,7 +1821,7 @@ void cdfDefZaxisUUID(stream_t *streamptr, int zaxisID)
if
(
uuidOfVGrid
[
0
]
!=
0
)
{
char
uuidOfVGridStr
[
37
];
uuid2s
tr
(
uuidOfVGrid
,
uuidOfVGridStr
);
cdiUUID2S
tr
(
uuidOfVGrid
,
uuidOfVGridStr
);
if
(
uuidOfVGridStr
[
0
]
!=
0
&&
strlen
(
uuidOfVGridStr
)
==
36
)
{
int
fileID
=
streamptr
->
fileID
;
...
...
@@ -5664,13 +5665,13 @@ void scan_global_attributes(int fileID, int vlistID, stream_t *streamptr, int ng
else
if
(
strcmp
(
attname
,
"uuidOfHGrid"
)
==
0
&&
attstrlen
==
36
)
{
attstring
[
36
]
=
0
;
str2uuid
(
attstring
,
uuidOfHGrid
);
cdiStr2UUID
(
attstring
,
uuidOfHGrid
);
// printf("uuid: %d %s\n", attlen, attstring);
}
else
if
(
strcmp
(
attname
,
"uuidOfVGrid"
)
==
0
&&
attstrlen
==
36
)
{
attstring
[
36
]
=
0
;
str2uuid
(
attstring
,
uuidOfVGrid
);
cdiStr2UUID
(
attstring
,
uuidOfVGrid
);
}
else
{
...
...
src/util.c
View file @
6af51d85
...
...
@@ -13,7 +13,7 @@
#include
"cdi.h"
#include
"cdi_int.h"
#include
"c
reate
_uuid.h"
#include
"c
di
_uuid.h"
#include
"dmemory.h"
#include
"binary.h"
...
...
@@ -67,7 +67,8 @@ enum {
uuidNumHexChars
=
36
,
};
void
uuid2str
(
const
unsigned
char
*
uuid
,
char
*
uuidstr
)
void
cdiUUID2Str
(
const
unsigned
char
*
uuid
,
char
*
uuidstr
)
{
if
(
uuid
==
NULL
||
uuidstr
==
NULL
)
return
;
...
...
@@ -82,7 +83,7 @@ void uuid2str(const unsigned char *uuid, char *uuidstr)
}
int
str2uuid
(
const
char
*
uuidstr
,
unsigned
char
*
uuid
)
int
cdiStr2UUID
(
const
char
*
uuidstr
,
unsigned
char
*
uuid
)
{
if
(
uuid
==
NULL
||
uuidstr
==
NULL
||
strlen
(
uuidstr
)
!=
uuidNumHexChars
)
return
-
1
;
...
...
@@ -151,8 +152,7 @@ char* cdiUnescapeSpaces(const char* string, const char** outStringEnd)
#ifdef HAVE_DECL_UUID_GENERATE
#include
<sys/time.h>
#include
<uuid/uuid.h>
void
create_uuid
(
unsigned
char
*
uuid
)
void
cdiCreateUUID
(
unsigned
char
*
uuid
)
{
static
int
uuid_seeded
=
0
;
static
char
uuid_rand_state
[
31
*
sizeof
(
long
)];
...
...
@@ -181,8 +181,7 @@ typedef uint8_t u_int8_t;
typedef
uint16_t
u_int16_t
;
typedef
uint32_t
u_int32_t
;
#include
<uuid.h>
void
create_uuid
(
unsigned
char
*
uuid
)
void
cdiCreateUUID
(
unsigned
char
*
uuid
)
{
uint32_t
status
;
uuid_create
((
uuid_t
*
)(
void
*
)
uuid
,
&
status
);
...
...
@@ -194,8 +193,7 @@ create_uuid(unsigned char *uuid)
}
#else
#include
<sys/time.h>
void
create_uuid
(
unsigned
char
*
uuid
)
void
cdiCreateUUID
(
unsigned
char
*
uuid
)
{
static
int
uuid_seeded
=
0
;
static
char
uuid_rand_state
[
31
*
sizeof
(
long
)];
...
...
src/varscan.c
View file @
6af51d85
...
...
@@ -8,6 +8,7 @@
#include
"cdi.h"
#include
"cdi_int.h"
#include
"cdi_uuid.h"
#include
"dmemory.h"
#include
"resource_handle.h"
#include
"varscan.h"
...
...
src/zaxis.c
View file @
6af51d85
...
...
@@ -11,6 +11,7 @@
#include
"cdi.h"
#include
"cdi_cksum.h"
#include
"cdi_int.h"
#include
"cdi_uuid.h"
#include
"resource_handle.h"
#include
"resource_unpack.h"
#include
"varscan.h"
...
...
tests/cksum_write.c
View file @
6af51d85
...
...
@@ -12,6 +12,7 @@
#include
<unistd.h>
#include
"cdi.h"
#include
"cdi_uuid.h"
#include
"cksum.h"
#include
"simple_model_helper.h"
...
...
@@ -226,11 +227,10 @@ main(int argc, char *argv[])
/* add uuids to zaxis and grid */
{
unsigned
char
uuid
[
16
];
int
str2uuid
(
const
char
*
uuidstr
,
unsigned
char
*
uuid
);
static
char
gridUUIDTxt
[]
=
"107d7a5b-348c-4d1a-90a9-d745914f2fb6"
;
str2uuid
(
gridUUIDTxt
,
uuid
);
cdiStr2UUID
(
gridUUIDTxt
,
uuid
);
gridDefUUID
(
gridID
,
uuid
);
static
char
zaxisUUIDTxt
[
2
][
37
]
=
{
...
...
@@ -240,7 +240,7 @@ main(int argc, char *argv[])
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
str2uuid
(
zaxisUUIDTxt
[
i
],
uuid
);
cdiStr2UUID
(
zaxisUUIDTxt
[
i
],
uuid
);
zaxisDefUUID
(
zaxisID
[
i
],
uuid
);
}
}
...
...
tests/deco2d_model.c
View file @
6af51d85
...
...
@@ -31,7 +31,7 @@ typedef int MPI_Comm;
#include
"pio_write.h"
#include
"simple_model_helper.h"
#include
"c
reate
_uuid.h"
#include
"c
di
_uuid.h"
enum
{
ntfiles
=
2
,
...
...
@@ -153,7 +153,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
{
unsigned
char
uuid
[
CDI_UUID_SIZE
];
if
(
rank
==
0
)
create
_uuid
(
uuid
);
c
diC
reate
UUID
(
uuid
);
#if USE_MPI
MPI_Bcast
(
uuid
,
CDI_UUID_SIZE
,
MPI_UNSIGNED_CHAR
,
0
,
comm
);
#endif
...
...
@@ -203,7 +203,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
{
unsigned
char
uuid
[
16
];
if
(
rank
==
0
)
create
_uuid
(
uuid
);
c
diC
reate
UUID
(
uuid
);
#if USE_MPI
MPI_Bcast
(
uuid
,
CDI_UUID_SIZE
,
MPI_UNSIGNED_CHAR
,
0
,
comm
);
#endif
...
...
tests/simple_model.c
View file @
6af51d85
...
...
@@ -29,7 +29,7 @@ typedef int MPI_Comm;
#include
"pio_write.h"
#include
"simple_model_helper.h"
#include
"c
reate
_uuid.h"
#include
"c
di
_uuid.h"
enum
{
ntfiles
=
2
,
...
...
@@ -120,7 +120,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
{
unsigned
char
uuid
[
CDI_UUID_SIZE
];
if
(
rank
==
0
)
create
_uuid
(
uuid
);
c
diC
reate
UUID
(
uuid
);
#if USE_MPI
MPI_Bcast
(
uuid
,
CDI_UUID_SIZE
,
MPI_UNSIGNED_CHAR
,
0
,
comm
);
#endif
...
...
@@ -170,7 +170,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
{
unsigned
char
uuid
[
16
];
if
(
rank
==
0
)
create
_uuid
(
uuid
);
c
diC
reate
UUID
(
uuid
);
#if USE_MPI
MPI_Bcast
(
uuid
,
CDI_UUID_SIZE
,
MPI_UNSIGNED_CHAR
,
0
,
comm
);
#endif
...
...
tests/test_resource_copy.c
View file @
6af51d85
...
...
@@ -6,7 +6,7 @@
#include
<string.h>
#include
"cdi.h"
#include
"c
reate
_uuid.h"
#include
"c
di
_uuid.h"
#include
"dmemory.h"
#include
"error.h"
#include
"resource_handle.h"
...
...
@@ -87,7 +87,7 @@ static int defineGrid (void)
gridDefComplexPacking
(
gridID
,
1
);
{
unsigned
char
uuid
[
CDI_UUID_SIZE
];
create
_uuid
(
uuid
);
c
diC
reate
UUID
(
uuid
);
gridDefUUID
(
gridID
,
uuid
);
}
...
...
@@ -113,7 +113,7 @@ static int defineZaxis (void)
zaxisDefWeights
(
zaxisID
,
&
levs
[
0
]
);
{
unsigned
char
uuid
[
CDI_UUID_SIZE
];
create
_uuid
(
uuid
);
c
diC
reate
UUID
(
uuid
);
zaxisDefUUID
(
zaxisID
,
uuid
);
}
...
...
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