diff data/model/PowerOfSqrtTwoZoomConstraint.cpp @ 929:59e7fe1b1003 warnfix_no_size_t

Unsigned removals and warning fixes in data/
author Chris Cannam
date Tue, 17 Jun 2014 14:33:42 +0100
parents e802e550a1f2
children cc27f35aa75c
line wrap: on
line diff
--- a/data/model/PowerOfSqrtTwoZoomConstraint.cpp	Tue Jun 17 13:52:07 2014 +0100
+++ b/data/model/PowerOfSqrtTwoZoomConstraint.cpp	Tue Jun 17 14:33:42 2014 +0100
@@ -19,26 +19,26 @@
 #include <cmath>
 
 
-size_t
-PowerOfSqrtTwoZoomConstraint::getNearestBlockSize(size_t blockSize,
+int
+PowerOfSqrtTwoZoomConstraint::getNearestBlockSize(int blockSize,
 						  RoundingDirection dir) const
 {
     int type, power;
-    size_t rv = getNearestBlockSize(blockSize, type, power, dir);
+    int rv = getNearestBlockSize(blockSize, type, power, dir);
     return rv;
 }
 
-size_t
-PowerOfSqrtTwoZoomConstraint::getNearestBlockSize(size_t blockSize,
+int
+PowerOfSqrtTwoZoomConstraint::getNearestBlockSize(int blockSize,
 						  int &type, 
 						  int &power,
 						  RoundingDirection dir) const
 {
 //    cerr << "given " << blockSize << endl;
 
-    size_t minCachePower = getMinCachePower();
+    int minCachePower = getMinCachePower();
 
-    if (blockSize < (1U << minCachePower)) {
+    if (blockSize < (1 << minCachePower)) {
 	type = -1;
 	power = 0;
 	float val = 1.0, prevVal = 1.0;
@@ -46,27 +46,27 @@
 	    prevVal = val;
 	    val *= sqrt(2.f);
 	}
-	size_t rval;
-	if (dir == RoundUp) rval = size_t(val + 0.01);
-	else if (dir == RoundDown) rval = size_t(prevVal + 0.01);
-	else if (val - blockSize < blockSize - prevVal) rval = size_t(val + 0.01);
-	else rval = size_t(prevVal + 0.01);
+	int rval;
+	if (dir == RoundUp) rval = int(val + 0.01);
+	else if (dir == RoundDown) rval = int(prevVal + 0.01);
+	else if (val - blockSize < blockSize - prevVal) rval = int(val + 0.01);
+	else rval = int(prevVal + 0.01);
 //	SVDEBUG << "returning " << rval << endl;
 	return rval;
     }
 
-    unsigned int prevBase = (1 << minCachePower);
-    unsigned int prevPower = minCachePower;
-    unsigned int prevType = 0;
+    int prevBase = (1 << minCachePower);
+    int prevPower = minCachePower;
+    int prevType = 0;
 
-    size_t result = 0;
+    int result = 0;
 
     for (unsigned int i = 0; ; ++i) {
 
 	power = minCachePower + i/2;
 	type = i % 2;
 
-	unsigned int base;
+	int base;
 	if (type == 0) {
 	    base = (1 << power);
 	} else {