On Wed, May 25, 2005 at 12:30:35AM -0700, Nate Eldredge wrote: > UInt16 record_id; > > for(record_id=0;record_id<DmNumRecords(ref);record_id++) { > rec_h = DmQueryRecord(ref, record_id); > ... > if(...) { > DmRemoveRecord(ref, record_id); > } > } > > This looks highly suspicious to me. I can't believe that the record id's > are guaranteed to be sequential.
DmQueryRecord takes a record index (numbered from zero) as its second parameter. So while the record_id is sequential, the variable is mis-named; it should be named record_ndx. However, the code is suspicious because deleting records will cause the index of subsequent records to be shifted. It should really loop from DmNumRecords()-1 down to zero. -- Dave Carrigan Seattle, WA, USA [EMAIL PROTECTED] | http://www.rudedog.org/ | ICQ:161669680 UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/