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
24c809b0
Commit
24c809b0
authored
Nov 17, 2014
by
Thomas Jahns
🤸
Browse files
Add test for NIL-UUID.
* RFC 4122 does not guarantee octet 0 to be non-zero.
parent
9cb26a70
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/cdi.c
View file @
24c809b0
...
...
@@ -33,6 +33,13 @@ int vlistInqVarMissvalUsed(int vlistID, int varID);
#endif
static
inline
int
cdiUUIDIsNull
(
const
unsigned
char
uuid
[
CDI_UUID_SIZE
])
{
static
unsigned
char
uuid_nil
[
CDI_UUID_SIZE
];
return
!
memcmp
(
uuid
,
uuid_nil
,
CDI_UUID_SIZE
);
}
#include
"printinfo.h"
void
cdiDefTableID
(
int
tableID
);
...
...
app/printinfo.h
View file @
24c809b0
...
...
@@ -368,7 +368,7 @@ void printGridInfo(int vlistID)
}
gridInqUUID
(
gridID
,
uuidOfHGrid
);
if
(
uuidOfHGrid
[
0
]
!=
0
)
if
(
!
cdiUUIDIsNull
(
uuidOfHGrid
)
)
{
char
uuidOfHGridStr
[
37
];
uuid2str
(
uuidOfHGrid
,
uuidOfHGridStr
);
...
...
@@ -471,7 +471,7 @@ void printZaxisInfo(int vlistID)
unsigned
char
uuidOfVGrid
[
CDI_UUID_SIZE
];
zaxisInqUUID
(
zaxisID
,
uuidOfVGrid
);
if
(
uuidOfVGrid
[
0
]
!=
0
)
if
(
!
cdiUUIDIsNull
(
uuidOfVGrid
)
)
{
char
uuidOfVGridStr
[
37
];
uuid2str
(
uuidOfVGrid
,
uuidOfVGridStr
);
...
...
src/cdi_int.h
View file @
24c809b0
...
...
@@ -65,6 +65,8 @@ char *strdup(const char *s);
# include "resource_handle.h"
#endif
#include
"cdi.h"
#define check_parg(arg) if ( arg == 0 ) Warning("Argument '" #arg "' not allocated!")
...
...
@@ -342,6 +344,13 @@ 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
[
CDI_UUID_SIZE
])
{
static
unsigned
char
uuid_nil
[
CDI_UUID_SIZE
];
return
!
memcmp
(
uuid
,
uuid_nil
,
CDI_UUID_SIZE
);
}
#define CDI_UNIT_PA 1
#define CDI_UNIT_HPA 2
...
...
src/grid.c
View file @
24c809b0
...
...
@@ -137,7 +137,7 @@ void grid_init(grid_t *gridptr)
gridptr
->
yunits
[
0
]
=
0
;
gridptr
->
xstdname
[
0
]
=
0
;
gridptr
->
ystdname
[
0
]
=
0
;
memset
(
gridptr
->
uuid
,
0
,
16
);
memset
(
gridptr
->
uuid
,
0
,
CDI_UUID_SIZE
);
gridptr
->
name
=
NULL
;
}
...
...
@@ -2491,7 +2491,7 @@ int gridGenerate(grid_t grid)
gridDefNumber
(
gridID
,
number
);
gridDefPosition
(
gridID
,
position
);
}
if
(
grid
.
uuid
[
0
]
!=
0
)
gridDefUUID
(
gridID
,
grid
.
uuid
);
gridDefUUID
(
gridID
,
grid
.
uuid
);
if
(
grid
.
reference
)
gridDefReference
(
gridID
,
grid
.
reference
);
}
...
...
@@ -3326,7 +3326,7 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
}
gridInqUUID
(
gridID
,
uuidOfHGrid
);
if
(
uuidOfHGrid
[
0
]
!=
0
)
if
(
!
cdiUUIDIsNull
(
uuidOfHGrid
)
)
{
char
uuidOfHGridStr
[
37
];
uuid2str
(
uuidOfHGrid
,
uuidOfHGridStr
);
...
...
src/stream_cdf.c
View file @
24c809b0
...
...
@@ -2046,7 +2046,7 @@ void cdfDefGridUUID(stream_t *streamptr, int gridID)
unsigned
char
uuidOfHGrid
[
CDI_UUID_SIZE
];
gridInqUUID
(
gridID
,
uuidOfHGrid
);
if
(
uuidOfHGrid
[
0
]
!=
0
)
if
(
!
cdiUUIDIsNull
(
uuidOfHGrid
)
)
{
char
uuidOfHGridStr
[
37
];
uuid2str
(
uuidOfHGrid
,
uuidOfHGridStr
);
...
...
@@ -7437,10 +7437,10 @@ int cdfInqContents(stream_t *streamptr)
char
fcreftime
[
CDI_MAX_NAME
];
int
number_of_grid_used
=
UNDEFID
;
uuidOfHGrid
[
0
]
=
0
;
uuidOfVGrid
[
0
]
=
0
;
gridfile
[
0
]
=
0
;
fcreftime
[
0
]
=
0
;
memset
(
uuidOfHGrid
,
0
,
CDI_UUID_SIZE
)
;
memset
(
uuidOfVGrid
,
0
,
CDI_UUID_SIZE
)
;
gridfile
[
0
]
=
0
;
fcreftime
[
0
]
=
0
;
vlistID
=
streamptr
->
vlistID
;
fileID
=
streamptr
->
fileID
;
...
...
src/varscan.c
View file @
24c809b0
...
...
@@ -597,7 +597,7 @@ void cdi_generate_vars(stream_t *streamptr)
{
if
(
numberOfVerticalLevels
>
0
)
zaxisDefNlevRef
(
zaxisID
,
numberOfVerticalLevels
);
if
(
numberOfVerticalGrid
>
0
)
zaxisDefNumber
(
zaxisID
,
numberOfVerticalGrid
);
if
(
uuidVGrid
[
0
]
!=
0
)
zaxisDefUUID
(
zaxisID
,
uuidVGrid
);
if
(
!
cdiUUIDIsNull
(
uuidVGrid
)
)
zaxisDefUUID
(
zaxisID
,
uuidVGrid
);
}
if
(
lbounds
)
free
(
dlevels1
);
...
...
src/zaxis.c
View file @
24c809b0
...
...
@@ -128,7 +128,7 @@ void zaxisDefaultValue(zaxis_t *zaxisptr)
zaxisptr
->
vct
=
NULL
;
zaxisptr
->
number
=
0
;
zaxisptr
->
nhlev
=
0
;
zaxisptr
->
uuid
[
0
]
=
0
;
memset
(
zaxisptr
->
uuid
,
0
,
CDI_UUID_SIZE
)
;
}
...
...
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