Hi

I'm sorting a database with 23732 records separated in tree categories,
20126 to cat1, 3599 to cat2 and only 7 to cat3). I'm using the DmQuickSort
function to sort cat1 and cat2 and datamgr.c fires this error: Index out of
range in line 9573. 

Comparison function cat1 :

        UInt8   catInfo1 = 0, catInfo2 = 0;
        //Get Category info 1
        catInfo1 = info1->attributes << 4;
        catInfo1 = catInfo1 >> 4;
        //Get Category info 2
        catInfo2 = info2->attributes << 4;
        catInfo2 = catInfo2 >> 4;

        //Check category
        if( catInfo1 == cat1 && catInfo2 == cat1 )
        {
                //Check de primary key
              if( r1->Cod_Product > r2->Cod_Product )
                  return 1;
                else 
                  if( r1->Cod_Product < r2->Cod_Product )
                    return -1;
              else
                return 0;
        }
        else {
         //Sort by category
         if( cat1 < cat2 )      ret= 1;
                else if( cat1 > cat2 )  ret= -1;
                 else return -1;
     }
}

Comparison function cat2 only differs in primary key sorting.  

Thanks in advance
German 

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

Reply via email to