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
1a130ddd
Commit
1a130ddd
authored
Nov 13, 2014
by
Thomas Jahns
🤸
Browse files
Refactor cdfDefHistory-related functions.
parent
ad42d491
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/stream_cdf.c
View file @
1a130ddd
...
...
@@ -8271,15 +8271,13 @@ static void cdfDefLocalAtts(stream_t *streamptr)
#endif
void
cdfDefHistory
(
stream_t
*
streamptr
,
int
size
,
char
*
history
)
{
#if defined (HAVE_LIBNETCDF)
int
ncid
;
ncid
=
streamptr
->
fileID
;
void
cdfDefHistory
(
stream_t
*
streamptr
,
int
size
,
const
char
*
history
)
{
int
ncid
=
streamptr
->
fileID
;
cdf_put_att_text
(
ncid
,
NC_GLOBAL
,
"history"
,
(
size_t
)
size
,
history
);
#endif
}
#endif
int
cdfInqHistorySize
(
stream_t
*
streamptr
)
...
...
src/stream_cdf.h
View file @
1a130ddd
...
...
@@ -5,7 +5,7 @@ void cdfDefVars(stream_t *streamptr);
void
cdfDefTimestep
(
stream_t
*
streamptr
,
int
tsID
);
int
cdfInqTimestep
(
stream_t
*
streamptr
,
int
tsID
);
int
cdfInqContents
(
stream_t
*
streamptr
);
void
cdfDefHistory
(
stream_t
*
streamptr
,
int
size
,
char
*
history
);
void
cdfDefHistory
(
stream_t
*
streamptr
,
int
size
,
const
char
*
history
);
int
cdfInqHistorySize
(
stream_t
*
streamptr
);
void
cdfInqHistoryString
(
stream_t
*
streamptr
,
char
*
history
);
...
...
src/stream_history.c
View file @
1a130ddd
...
...
@@ -10,9 +10,8 @@
void
streamDefHistory
(
int
streamID
,
int
length
,
const
char
*
history
)
{
stream_t
*
streamptr
;
streamptr
=
stream_to_pointer
(
streamID
);
#ifdef HAVE_LIBNETCDF
stream_t
*
streamptr
=
stream_to_pointer
(
streamID
);
if
(
streamptr
->
filetype
==
FILETYPE_NC
||
streamptr
->
filetype
==
FILETYPE_NC2
||
...
...
@@ -26,12 +25,17 @@ void streamDefHistory(int streamID, int length, const char *history)
len
=
strlen
(
history
);
if
(
len
)
{
/* FIXME: what's the point of strdupx? Why not use
* history argument directly? */
histstring
=
strdupx
(
history
);
cdfDefHistory
(
streamptr
,
length
,
histstring
);
free
(
histstring
);
}
}
}
#else
(
void
)
streamID
;
(
void
)
length
;
(
void
)
history
;
#endif
}
...
...
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