IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 20 years ago

#503 closed defect (fixed)

psMetadataRemove and PS_LIST_UNKNOWN

Reported by: Paul Price Owned by: Paul Price
Priority: low Milestone:
Component: types Version: unspecified
Severity: trivial Keywords:
Cc: rhl@…

Description

PS_LIST_UNKNOWN is supposed to be required for psMetadataRemove --- to remove by
key instead of by position. The current implementation simply looks at whether
the key is defined. Should we define separate functions,
psMetadataRemoveByIndex/psMetadataRemoveByKey?

From psList.h:

/ Special values of index into list

*

  • This list of possible list position values should be contiguous non-positive

values ending with

  • PS_LIST_UNKNOWN. Any value less-than-or-equal-to PS_LIST_UNKNOWN is

considered a undefined position.

*
*/

enum {

PS_LIST_HEAD = 0, /< at head
PS_LIST_TAIL = -1,
/< at tail

};

Change History (7)

comment:1 by robert.desonia@…, 21 years ago

Cc: rhl@… added

comment:2 by robert.desonia@…, 21 years ago

* Bug 477 has been marked as a duplicate of this bug. *

comment:3 by robert.desonia@…, 21 years ago

Owner: changed from robert.desonia@… to Paul Price

PS_LIST_UNKNOWN was removed because of the changes made to psList. It probably would be good to
mirror the change made in psList for psMetadata, i.e., define the function psMetadataRemoveData that
is analogous to psListRemoveData. that would then remove any PS_LIST_UNKNOWN requirement.

comment:4 by Paul Price, 21 years ago

That sounds like a vote for splitting psMetadataRemove into two functions:

bool psMetadataRemoveIndex(psMetadata *md, int location);
bool psMetadataRemoveKey(psMetadata *md, const char *key);

comment:5 by Paul Price, 21 years ago

Resolution: fixed
Status: newclosed

Since there are no objections, I have updated the SDRS to specify two remove
functions.

Items may be removed from the metadata by specifying a key or a
location in the list. For \code{psMetadataRemoveKey}, if the key
matches a metadata item, the item is removed from the metadata and
\code{true} is returned; otherwise, \code{false} is returned. If the
key is not unique, then \emph{all} items corresponding to the key are
removed, and \code{true} is returned. For
\code{psMetadataRemoveIndex}, the metadata item at the specified
\code{location} is removed, if valid, and \code{true} is returned;
otherwise the function returns \code{false}.
%
\begin{prototype}
bool psMetadataRemoveKey(psMetadata *md, const char *key);
bool psMetadataRemoveIndex(psMetadata *md, int location);
\end{prototype}

comment:6 by Paul Price, 20 years ago

Keywords: VERIFIED added

Bug has been resolved.... closing.

comment:7 by Paul Price, 20 years ago

Keywords: VERIFIED removed

Bugs have been fixed... closing.

Note: See TracTickets for help on using tickets.