From a1ed7804986d95a0591dabc9650e314c4e5b4323 Mon Sep 17 00:00:00 2001
From: Christoph Sprunk <sprunkc@informatik.uni-freiburg.de>
Date: Thu, 8 Aug 2013 14:59:41 +0200
Subject: [PATCH] fixed some warnings

---
 src/csm/math_utils_gsl.cpp |  2 +-
 src/egsl/egsl.cpp          | 11 +++++------
 src/egsl/egsl_ops.cpp      |  6 +++---
 src/gpc/gpc_utils.cpp      |  4 ++--
 src/gpc/gpc_utils.h        |  2 +-
 5 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/csm/math_utils_gsl.cpp b/src/csm/math_utils_gsl.cpp
index 665f987..baa3817 100644
--- a/src/csm/math_utils_gsl.cpp
+++ b/src/csm/math_utils_gsl.cpp
@@ -34,7 +34,7 @@ gsl_vector * vector_from_array(unsigned int n, double *x) {
 //}
 
 void vector_to_array(const gsl_vector*v, double*x){
-	size_t i;
+	int i;
 	for(i=0;i<v->size();i++)
 		x[i] = gvg(v,i);
 }
diff --git a/src/egsl/egsl.cpp b/src/egsl/egsl.cpp
index 0b5efe5..6ab5c09 100644
--- a/src/egsl/egsl.cpp
+++ b/src/egsl/egsl.cpp
@@ -171,7 +171,7 @@ val egsl_alloc(size_t rows, size_t columns) {
 	int index = c->nvars;
 	if(index<c->nallocated) {
 		gsl_matrix*m = c->vars[index].gsl_m;
-		if(m->rows() == rows && m->cols() == columns) {
+		if((size_t) m->rows() == rows && (size_t) m->cols() == columns) {
 			egsl_cache_hits++;
 			c->nvars++;
 			return assemble_val(cid,index,c->vars[index].gsl_m);
@@ -204,7 +204,7 @@ val egsl_alloc_in_context(int context, size_t rows, size_t columns) {
     int index = c->nvars;
     if(index<c->nallocated) {
         gsl_matrix*m = c->vars[index].gsl_m;
-        if(m->rows() == rows && m->cols() == columns) {
+        if((size_t) m->rows() == rows && (size_t) m->cols() == columns) {
             egsl_cache_hits++;
             c->nvars++;
             return assemble_val(context,index,c->vars[index].gsl_m);
@@ -256,7 +256,7 @@ val egsl_promote(val v) {
 void egsl_expect_size(val v, size_t rows, size_t cols) {
 	gsl_matrix * m = egsl_gslm(v);
 
-	int bad = (rows && (m->rows()!=rows)) || (cols && (m->cols()!=cols));
+	int bad = (rows && ((size_t) m->rows()!=rows)) || (cols && ((size_t) m->cols()!=cols));
 	if(bad) {
 		fprintf(stderr, "Matrix size is %d,%d while I expect %d,%d",
 			(int)m->rows(),(int)m->cols(),(int)rows,(int)cols);
@@ -268,7 +268,7 @@ void egsl_expect_size(val v, size_t rows, size_t cols) {
 
 void egsl_print(const char*str, val v) {
 	gsl_matrix * m = egsl_gslm(v);
-	size_t i,j;
+	int i,j;
 	int context = its_context(v);
 	int var_index = its_var_index(v);
 	fprintf(stderr, "%s =  (%d x %d)  context=%d index=%d\n",
@@ -300,7 +300,7 @@ double* egsl_atmp(val v, size_t i, size_t j) {
 double egsl_norm(val v1){
 	egsl_expect_size(v1, 0, 1);
 	double n=0;
-	size_t i;
+	int i;
 	gsl_matrix * m = egsl_gslm(v1);
 	for(i=0;i<m->rows();i++) {
 		double v = gsl_matrix_get(m,i,0);
@@ -320,7 +320,6 @@ double egsl_atv(val v1,  size_t i){
 
 void egsl_free_unused_memory(){
   int c;
-  int freecounter = 0;
   for(c=0;c<=max_cid;c++) {
     for(int i=egsl_contexts[c].nvars; i<egsl_contexts[c].nallocated; i++){
       gsl_matrix_free(egsl_contexts[c].vars[i].gsl_m);
diff --git a/src/egsl/egsl_ops.cpp b/src/egsl/egsl_ops.cpp
index 1a5e661..3a7746b 100644
--- a/src/egsl/egsl_ops.cpp
+++ b/src/egsl/egsl_ops.cpp
@@ -17,7 +17,7 @@ val egsl_compose_col(val v1, val v2){
 	egsl_expect_size(v2, 0, m1->cols());
 	val v3 = egsl_alloc(m1->rows()+m2->rows(),m1->cols());
 	gsl_matrix *m3 = egsl_gslm(v3);
-	size_t i,j;
+	int i,j;
 	for(j=0;j<m1->cols();j++) {
 		for(i=0;i<m1->rows();i++)
 			gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
@@ -34,7 +34,7 @@ val egsl_compose_row(val v1, val v2){
 	egsl_expect_size(v2, m1->rows(), 0);
 	val v3 = egsl_alloc(m1->rows(), m1->cols() + m2->cols());
 	gsl_matrix *m3 = egsl_gslm(v3);
-	size_t i,j;
+	int i,j;
 	for(i=0;i<m1->rows();i++) {
 		for(j=0;j<m1->cols();j++)
 			gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
@@ -59,7 +59,7 @@ void egsl_add_to_col(val v1, size_t j, val v2) {
 
 /*	printf("m1 size = %d,%d j = %d\n",m1->rows(),m1->cols(),j); */
 	egsl_expect_size(v2, m1->rows(), 1);
-	size_t i;
+	int i;
 	for(i=0;i<m1->rows();i++) {
 		*gsl_matrix_ptr(m1, i, j) += gsl_matrix_get(m2,i,0);
 	}
diff --git a/src/gpc/gpc_utils.cpp b/src/gpc/gpc_utils.cpp
index 5051fe0..b13b7af 100644
--- a/src/gpc/gpc_utils.cpp
+++ b/src/gpc/gpc_utils.cpp
@@ -84,7 +84,7 @@ double m_dot(const gsl_matrix*A,const gsl_matrix*B) {
 //}
 
 
-int poly_greatest_real_root(unsigned int n, const double*a, double *root) {
+int poly_greatest_real_root(int n, const double*a, double *root) {
 //	unsigned int i;
 //
 //	double z[(n-1)*2];
@@ -115,7 +115,7 @@ int poly_greatest_real_root(unsigned int n, const double*a, double *root) {
 //	}
 
     Eigen::VectorXd poly_coeffs(n);
-    for(unsigned int i=0; i<n; i++){
+    for(int i=0; i<n; i++){
       poly_coeffs(i) = a[i];
     }
     if(n!=5){
diff --git a/src/gpc/gpc_utils.h b/src/gpc/gpc_utils.h
index f08139e..7352418 100644
--- a/src/gpc/gpc_utils.h
+++ b/src/gpc/gpc_utils.h
@@ -26,7 +26,7 @@ double m_det(const gsl_matrix*A);
 /* Returns the real part of the roots in roots */
 //int poly_real_roots(unsigned int n, const double*a, double *roots);
 
-int poly_greatest_real_root(unsigned int n, const double*a, double *root);
+int poly_greatest_real_root(int n, const double*a, double *root);
 
 void m_display(const char*str, gsl_matrix*m);
 
-- 
GitLab