[Phylobase-commits] r715 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 24 03:45:10 CET 2010


Author: edd
Date: 2010-01-24 03:45:08 +0100 (Sun, 24 Jan 2010)
New Revision: 715

Modified:
   pkg/src/NCLInterface.cpp
   pkg/src/phyloXX.c
Log:
some gentle changes to make 'g++ -Wall' happier:
 -- some count variables changed to unsigned int from int
 -- one unused variable commented-out
 -- one variable init'ed to 0 ensure a value
 -- added some explicit parenthesis around a mixed && and || block


Modified: pkg/src/NCLInterface.cpp
===================================================================
--- pkg/src/NCLInterface.cpp	2010-01-24 02:36:55 UTC (rev 714)
+++ pkg/src/NCLInterface.cpp	2010-01-24 02:45:08 UTC (rev 715)
@@ -343,7 +343,7 @@
 						}
 						else {
 							nexuscharacters+='{';
-							for (int k=0;k<characters->GetNumStates(taxon,character);k++) {
+							for (unsigned int k=0;k<characters->GetNumStates(taxon,character);k++) {
 								nexuscharacters+=characters->GetInternalRepresentation(taxon,character,0);
 								if (k+1<characters->GetNumStates(taxon,character)) {
 									nexuscharacters+=',';
@@ -362,7 +362,7 @@
 				nexuscharacters+=')';
 				if (levelsall) {
 					nexuscharacters+=", levels=c(";
-					for (int l=0;l<characters->GetMaxObsNumStates(); l++) {
+					for (unsigned int l=0;l<characters->GetMaxObsNumStates(); l++) {
 						nexuscharacters+=l;
 						if (l+1<characters->GetMaxObsNumStates()) {
 							nexuscharacters+=',';
@@ -374,8 +374,8 @@
 					
 					NxsString levels=", levels=c(";
 					NxsString labels=", labels=c(";
-					int totallabellength=0;
-					for (int l=0;l<characters->GetObsNumStates(character); l++) {
+					unsigned int totallabellength=0;
+					for (unsigned int l=0;l<characters->GetObsNumStates(character); l++) {
 						labels+='"';
 						labels+= characters->GetStateLabel(character,l);
 						totallabellength+=(characters->GetStateLabel(character,l)).length();
@@ -676,7 +676,7 @@
 			data->Report(logf);
 	}
 	*/
-	int ntax = taxa->GetNumTaxonLabels(); 
+        // int ntax = taxa->GetNumTaxonLabels(); 
 
 	if (!trees->IsEmpty())
 	{
@@ -761,7 +761,7 @@
 				distancevector.push_back(distances->GetDistance(row,col));
 			}
 		}
-		for (int i=0;i<distancevector.size();i++) {
+		for (unsigned int i=0;i<distancevector.size();i++) {
 			nexusdistances+=distancevector.at(i);
 			if (i+1<distancevector.size()) {
 				nexusdistances+=',';
@@ -850,7 +850,7 @@
 					}
 					else {
 						outputforR+='{';
-						for (int k=0;k<characters->GetNumStates(taxon,character);k++) {
+						for (unsigned int k=0;k<characters->GetNumStates(taxon,character);k++) {
 							outputforR+=characters->GetInternalRepresentation(taxon,character,0);
 							if (k+1<characters->GetNumStates(taxon,character)) {
 								outputforR+=',';
@@ -869,7 +869,7 @@
 			outputforR+=')';
 			if (levelsall) {
 				outputforR+=", levels=c(";
-				for (int l=0;l<characters->GetMaxObsNumStates(); l++) {
+				for (unsigned int l=0;l<characters->GetMaxObsNumStates(); l++) {
 					outputforR+=l;
 					if (l+1<characters->GetMaxObsNumStates()) {
 						outputforR+=',';
@@ -882,7 +882,7 @@
 				NxsString levels=", levels=c(";
 				NxsString labels=", labels=c(";
 				
-				for (int l=0;l<characters->GetObsNumStates(character); l++) {
+				for (unsigned int l=0;l<characters->GetObsNumStates(character); l++) {
 					labels+= characters->GetStateLabel(character,l);
 					levels+= l;
 					if (l+1<characters->GetObsNumStates(character)) {
@@ -940,7 +940,7 @@
 				distancevector.push_back(distances->GetDistance(row,col));
 			}
 		}
-		for (int i=0;i<distancevector.size();i++) {
+		for (unsigned int i=0;i<distancevector.size();i++) {
 			outputforR+=distancevector.at(i);
 			if (i+1<distancevector.size()) {
 				outputforR+=',';
@@ -1392,7 +1392,7 @@
 	// Remove any whitespace characters from end of string entered by user
 	//
 	unsigned i = len;
-	while (i > 0 && next_command[i-1] == ' ' || next_command[i-1] == '\t' || next_command[i-1] == '\n')
+	while (i > 0 && (next_command[i-1] == ' ' || next_command[i-1] == '\t' || next_command[i-1] == '\n'))
 		i--;
 	
 	// If character at position i - 1 is a semicolon, put '\0' terminator at position i;

Modified: pkg/src/phyloXX.c
===================================================================
--- pkg/src/phyloXX.c	2010-01-24 02:36:55 UTC (rev 714)
+++ pkg/src/phyloXX.c	2010-01-24 02:45:08 UTC (rev 715)
@@ -80,7 +80,7 @@
     int j;
     int i;
     int k;
-    int cur;
+    int cur=0;
     for (i=0; i <*numEdges; i++) {
         for (k=0; k<*numEdges; k++) {
             if(edge2[i] == edge2[k]) {



More information about the Phylobase-commits mailing list