Re: hdf_copy() doesnt copy default value..
Brandon Long <[email protected]> Tue, 20 May 2008 21:22:42 -0700
| Newsgroups | gmane.text.clearsilver.general |
|---|---|
| Organization | Fiction L Networks |
| Message-ID | <20080521042242.GB27062@bl1> |
Although I can't remember at the moment why I made that choice, it seems
pretty clear that I intentionally didn't copy the source node, and
changing it now might have bad consequences for existing users.
Brandon
On 05/08/08 Mario Gliewe uttered the following other thing:
> 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...
>
--
"You know your god is man-made when he hates all the same people you do."
-- M. Surber, 8/18/1996
http://www.fiction.net/blong/