IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 22 years ago

Closed 21 years ago

Last modified 21 years ago

#159 closed defect (fixed)

psMetadataGetNext() always returns first item on metadata list

Reported by: rhl@… Owned by: calvin.harman@…
Priority: high Milestone:
Component: sys Version: unspecified
Severity: normal Keywords:
Cc:

Description

psMetadataGetNext() (and ...Prev()) always returns first item on metadata list; the
problem is that they call psListSetIterator() which sets the iterator to the start
of the list.

rel2_2

Change History (5)

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

Owner: changed from robert.desonia@… to calvin.harman@…

comment:2 by calvin.harman@…, 22 years ago

I'm not sure this is a problem. I ran the tst_psMetadata_05.c test, which tests
the psMetadataGetNext() function, and it appears to return the expected value
according to the API.

I re-read the SDRS for these two functions, and it looks like their arguments
are set up to force the user to define a starting point, which would eliminate
any persistent iterator. Although these functions do appear to return the next
or previous item based on the inputs, maybe the API should be changed to
separate the functionality in terms of getIndex(), getName(), getNext(), and
getPrevious()?

comment:3 by rhl@…, 22 years ago

My guess is that you are thinking of tests B and C which read:

psMetadataSetIterator(metadata, 2);
item = psMetadataGetNext(metadata, NULL, 2);

Note that the first "2" is a "where" value (and the API needs to include a "which" too), whereas
the second "2" is a "which" value. The intent of the SDRS (and also I think what it says, if you
read the definitions of "where" and "which") is that the psMetadataSetIterator() call would set
the iterator to the place in the list, and psMetadataGetNext() would then step through the list.

In other words,

int which = 123; which iterator; any should work
psMetadataSetIterator(metadata, which, PS_LIST_HEAD);
while ((m = psMetadataGetNext(metadata, NULL, which)) != NULL) {

printf("%s\n", m->name);

}

should go through every item of the list [note that I've added a "which" to the psMetadataSetIterator
API for clarity; this addition is a neccessary change to the SDRS)

comment:4 by calvin.harman@…, 22 years ago

This function was dropped. Please close bug.

comment:5 by Eric.VanAlst@…, 21 years ago

Resolution: fixed
Status: newclosed

Ross notes this function has been dropped, so the bug should be closed.

Note: See TracTickets for help on using tickets.