hdf_copy() doesnt copy default value..
Mario Gliewe <[email protected]> Thu, 08 May 2008 14:32:46 +0200
| Newsgroups | gmane.text.clearsilver.general |
|---|---|
| Message-ID | <[email protected]> |
hello,
while working on my own little c++ wrapper for clearsilver
i came across a small inconsistence in hdf_copy();
it doesn't copy the source default value and attributes
as one would expect...
the small patch attached solves this problem, although this
could lead to misbehaviour in existing applications which
depend on the default value beeing preserved on hdf_copy...
greetz
maG
*** neo_hdf.c.old Fri May 2 08:41:19 2008
--- neo_hdf.c Thu May 8 14:17:51 2008
*************** NEOERR* hdf_copy (HDF *dest, const char
*** 1078,1090 ****
{
NEOERR *err;
HDF *node;
if (_walk_hdf(dest, name, &node) == -1)
{
err = _set_value (dest, name, NULL, 0, 0, 0, NULL, &node);
if (err) return nerr_pass (err);
}
! return nerr_pass (_copy_nodes (node, src));
}
/* BUG: currently, this only prints something if there is a value...
--- 1079,1102 ----
{
NEOERR *err;
HDF *node;
+ HDF_ATTR *attr_copy;
if (_walk_hdf(dest, name, &node) == -1)
{
err = _set_value (dest, name, NULL, 0, 0, 0, NULL, &node);
if (err) return nerr_pass (err);
}
! err = _copy_nodes (node, src);
! if (err) return nerr_pass(err);
!
! err = _copy_attr(&attr_copy, src->attr);
! if (err) return nerr_pass(err);
! err = _set_value(node, NULL, src->value, 1, 1, 0, attr_copy, 0);
! if (err) {
! _dealloc_hdf_attr(&attr_copy);
! return nerr_pass(err);
! }
! return STATUS_OK;
}
/* BUG: currently, this only prints something if there is a value...
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ClearSilver/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ClearSilver/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/