I want to sort the records in my PDB. I am trying to get DmInsertionSort to
work for this. I have defined the following Compare function (added lots of
code to make debugging & inspection easier):


Int16 MySort(void* Rec1,void* Rec2,Int16 Other,
  SortRecordInfoPtr Rec1SortInfo,SortRecordInfoPtr Rec2SortInfo,
  MemHandle AppInfo)
{
  TScanDetailStruct* S1;  // A struct defining the record structure of my
PDB
  TScanDetailStruct* S2;
  char* C1 = NULL;
  char* C2 = NULL;

  // Cast the incoming record pointers to my type to be able to inspect the
record members
  S1 = Rec1;
  S2 = Rec2;

 // Get the record char* members
 C1 = S1->ScdPK;
 C2 = S2->ScdPK;

  return StrCompare(C1,C2);
}


I call the InsertionSort as follows:

  Err Error = DmInsertionSort(MyPDBHandle,MySort,0);

When I step into the MySort function, the structures S1,S2 contain garbage.
As far as I am concerned (or according to how I understand the manuals),
they should contain the contents of the 1st & 2nd records the first time.

Any suggestions?

Thanks

L.J. van Alphen
[EMAIL PROTECTED]





-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to