Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /KDTree.c [26cac0] .. [8bd197] Maximize Restore

  Switch to side-by-side view

--- a/KDTree.c
+++ b/KDTree.c
@@ -53,7 +53,7 @@
 	SortedLimitedList* self = SortedLimitedList_new0();
 	ArrayList_init((ArrayList*)self, deletefn);
 	self->max = maxElements;
-	self->deletefn = deletefn;
+	self->deletefn = (void (*)(void *)) deletefn;
 	return self;
 }
 
@@ -524,7 +524,7 @@
 	ArrayList_AddItem(hrl, hr);
 
 	SortedLimitedList* best = SortedLimitedList_new (q, KDTreeBestEntry_delete);
-	best->comparator.compareTo = (void*)KDTreeBestEntry_CompareTo;
+	best->comparator.compareTo = (int ( *)(IComparator *,const void *,const void *))KDTreeBestEntry_CompareTo;
 
 	/*IKDTreeDomain* nearest = */KDTree_NearestNeighbourListI (self, best, q, target, hr,
 							       Double_PositiveInfinity, resDist, hrl);
@@ -532,7 +532,7 @@
 
 	int i;
 	for(i=0; i<SortedLimitedList_Count(best); i++) {
-		KDTreeBestEntry* be = SortedLimitedList_GetItem(best, i);
+		KDTreeBestEntry* be = (KDTreeBestEntry*) SortedLimitedList_GetItem(best, i);
 		be->distance = sqrt (be->distance);
 	}
        
@@ -662,9 +662,9 @@
 	ArrayList_AddItem(hrl, hr);
 
 	SortedLimitedList* best = SortedLimitedList_new (q, KDTreeBestEntry_delete);
-	best->comparator.compareTo = (void*)KDTreeBestEntry_CompareTo;
+	best->comparator.compareTo = (int ( *)(IComparator *,const void *,const void *)) KDTreeBestEntry_CompareTo;
 	SortedLimitedList* searchHr = SortedLimitedList_new (searchSteps, KDTreeHREntry_delete);
-	searchHr->comparator.compareTo = (void*)KDTreeHREntry_CompareTo;
+	searchHr->comparator.compareTo = (int ( *)(IComparator *,const void *,const void *))KDTreeHREntry_CompareTo;
 
 	int dummyDist;
 	/*IKDTreeDomain* nearest = */KDTree_NearestNeighbourListBBFI (self, best, q, target, hr,
@@ -675,8 +675,8 @@
 
 	int i;
 	for(i=0; i<SortedLimitedList_Count(best); i++) {
-		KDTreeBestEntry* be = SortedLimitedList_GetItem(best, i);
-		be->distance = sqrt (be->distanceSq);
+		KDTreeBestEntry* be = (KDTreeBestEntry*) SortedLimitedList_GetItem(best, i);
+		be->distance = sqrt ((double)be->distanceSq);
 	}
 
 	ArrayList_delete(hrl);
@@ -748,7 +748,7 @@
 		maxDistSq = INT_MAX;
 
 	if (SortedLimitedList_Count(searchHr) > 0) {
-		KDTreeHREntry* hre = SortedLimitedList_GetItem(searchHr, 0);
+		KDTreeHREntry* hre = (KDTreeHREntry*) SortedLimitedList_GetItem(searchHr, 0);
 		SortedLimitedList_RemoveAt (searchHr, 0);
 
 		furtherHr = hre->rect;
@@ -760,7 +760,7 @@
 	// step 10
 	*searchSteps -= 1;
 	if (*searchSteps > 0 &&
-	    HyperRectangle_IsInReach (furtherHr, target, sqrt (maxDistSq)))
+	    HyperRectangle_IsInReach (furtherHr, target, sqrt ((double)maxDistSq)))
 	{
 		int ptDistSq = KDTree_DistanceSq (pivot, target);
 		if (ptDistSq < distSq) {
@@ -810,7 +810,7 @@
 
 IKDTreeDomain* KDTree_GoodCandidate (ArrayList* exset, int* splitDim)
 {
-	IKDTreeDomain* first = ArrayList_GetItem(exset, 0);
+	IKDTreeDomain* first = (IKDTreeDomain*) ArrayList_GetItem(exset, 0);
 	if (first == NULL) {
 		FatalError ("Not of type IKDTreeDomain (TODO: custom exception)");
 	}
@@ -828,7 +828,7 @@
 
 	int j;
 	for(j=0; j<ArrayList_Count(exset); j++) {
-		IKDTreeDomain* dom = ArrayList_GetItem(exset, j);
+		IKDTreeDomain* dom = (IKDTreeDomain*) ArrayList_GetItem(exset, j);
 		int k;
 		for (k = 0 ; k < dim ; ++k) {
 			double dimE = IKDTreeDomain_GetDimensionElement (dom, k);
@@ -866,7 +866,7 @@
 
 	int l;
 	for(l=0; l<ArrayList_Count(exset); l++) {
-		IKDTreeDomain* dom = ArrayList_GetItem(exset, l);
+		IKDTreeDomain* dom = (IKDTreeDomain*) ArrayList_GetItem(exset, l);
 		double curDiff = abs (IKDTreeDomain_GetDimensionElement (dom, maxDiffDim) - middle);
 		if (curDiff < exemMinDiff) {
 			exemMinDiff = curDiff;
@@ -900,7 +900,7 @@
 	double bound = IKDTreeDomain_GetDimensionElement (cur->dr, cur->splitDim);
 	int i;
 	for(i=0; i<ArrayList_Count(exset); i++) {
-		IKDTreeDomain* dom = ArrayList_GetItem(exset, i);
+		IKDTreeDomain* dom = (IKDTreeDomain*) ArrayList_GetItem(exset, i);
 		// ignore the current element
 		if (dom == cur->dr)
 			continue;