Opened 20 years ago
Closed 20 years ago
#836 closed defect (invalid)
psMetadataCopy - partially copied metadata
| Reported by: | Owned by: | Paul Price | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | types | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
In addition to the concerns I've expressed about psMetadataCopy not freeing
"out" and setting it to NULL on error, I also realized that a psMetadata could
be partially copied before erroring and returning NULL. ie, a metadataItem in
"in" with an invalid type will cause NULL to be returned, but will not return
the original-unaltered "out" either.
We're suggesting two things be done to psMetadataCopy. First change it to:
bool psMetadataCopy(psMetadata out, const psMetadata *in);
second, either skip the bad psMetadataItem instead of erroring-out, or keep
track of the number of items added and remove each one to return the original "out".

The fact that the output metadata can be modified if there is an error is
understood. We'd like to stick with the original API, as this is the standard
practise in psLib. The syntax:
psMetadata *copy = NULL;
psMetadataCopy(©, original);
is inconvenient compared to:
psMetadata *copy = psMetadataCopy(NULL, original);
I appreciate your thinking about this, but this is the way we do things.