[sword-svn] r2010 - in trunk/src: keys mgr

dglassey at www.crosswire.org dglassey at www.crosswire.org
Sat Nov 25 14:26:57 MST 2006


Author: dglassey
Date: 2006-11-25 14:26:57 -0700 (Sat, 25 Nov 2006)
New Revision: 2010

Modified:
   trunk/src/keys/listkey.cpp
   trunk/src/keys/versekey.cpp
   trunk/src/mgr/filemgr.cpp
   trunk/src/mgr/ftptrans.cpp
   trunk/src/mgr/installmgr.cpp
Log:
compiler warning fixes in keys/ and mgr/ such as:
signed v unsigned comparison
brackets around assignments advisable in if statements
unused variables
initialising variables
indexes of arrays should be int not char


Modified: trunk/src/keys/listkey.cpp
===================================================================
--- trunk/src/keys/listkey.cpp	2006-11-25 21:24:43 UTC (rev 2009)
+++ trunk/src/keys/listkey.cpp	2006-11-25 21:26:57 UTC (rev 2010)
@@ -293,7 +293,6 @@
 
 void ListKey::setText(const char *ikey) {
 	// at least try to set the current element to this text
-	int pos = arraypos;
 	for (arraypos = 0; arraypos < arraycnt; arraypos++) {
 		SWKey *key = array[arraypos];
 		if (key) {

Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp	2006-11-25 21:24:43 UTC (rev 2009)
+++ trunk/src/keys/versekey.cpp	2006-11-25 21:26:57 UTC (rev 2010)
@@ -329,7 +329,7 @@
 
 int VerseKey::getBookAbbrev(const char *iabbr)
 {
-	int loop, diff, abLen, min, max, target, retVal = -1;
+	int diff, abLen, min, max, target, retVal = -1;
 
 	char *abbr = 0;
 
@@ -426,7 +426,7 @@
 	SWKey tmpDefaultKey = defaultKey;
 	char lastPartial = 0;
 	bool inTerm = true;
-	int notAllDigits;
+	int notAllDigits = 0;
 
 	curkey.AutoNormalize(0);
 	tmpListKey << tmpDefaultKey;
@@ -1539,7 +1539,7 @@
 
 const char *VerseKey::getOSISRef() const {
 	static char buf[5][254];
-	static char loop = 0;
+	static int loop = 0;
 
 	if (loop > 4)
 		loop = 0;
@@ -1550,7 +1550,7 @@
 		sprintf(buf[loop], "%s.%d", osisbooks[Testament()-1][Book()-1], (int)Chapter());
 	else if (Book())
 		sprintf(buf[loop], "%s", osisbooks[Testament()-1][Book()-1]);
-	else	sprintf(buf[loop], "");
+	else	buf[loop][0] = 0;
 	return buf[loop++];
 }
 

Modified: trunk/src/mgr/filemgr.cpp
===================================================================
--- trunk/src/mgr/filemgr.cpp	2006-11-25 21:24:43 UTC (rev 2009)
+++ trunk/src/mgr/filemgr.cpp	2006-11-25 21:26:57 UTC (rev 2010)
@@ -490,7 +490,7 @@
 int FileMgr::copyDir(const char *srcDir, const char *destDir) {
 	DIR *dir;
 	struct dirent *ent;
-	if (dir = opendir(srcDir)) {
+	if ((dir = opendir(srcDir))) {
 		rewinddir(dir);
 		while ((ent = readdir(dir))) {
 			if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {

Modified: trunk/src/mgr/ftptrans.cpp
===================================================================
--- trunk/src/mgr/ftptrans.cpp	2006-11-25 21:24:43 UTC (rev 2009)
+++ trunk/src/mgr/ftptrans.cpp	2006-11-25 21:26:57 UTC (rev 2010)
@@ -86,7 +86,7 @@
 
 
 int FTPTransport::copyDirectory(const char *urlPrefix, const char *dir, const char *dest, const char *suffix) {
-	int i;
+	unsigned int i;
 	int retVal = 0;
 	
 	SWBuf url = SWBuf(urlPrefix) + SWBuf(dir);

Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp	2006-11-25 21:24:43 UTC (rev 2009)
+++ trunk/src/mgr/installmgr.cpp	2006-11-25 21:26:57 UTC (rev 2010)
@@ -145,7 +145,7 @@
 
 			FileMgr::removeDir(modDir.c_str());
 
-			if (dir = opendir(manager->configPath)) {	// find and remove .conf file
+			if ((dir = opendir(manager->configPath))) {	// find and remove .conf file
 				rewinddir(dir);
 				while ((ent = readdir(dir))) {
 					if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
@@ -210,7 +210,6 @@
 
 int InstallMgr::ftpCopy(InstallSource *is, const char *src, const char *dest, bool dirTransfer, const char *suffix) {
 	int retVal = 0;
-	long i;
 	FTPTransport *trans = createFTPTransport(is->source, statusReporter);
 	transport = trans; // set classwide current transport for other thread terminate() call
 	trans->setPassive(passive);
@@ -364,7 +363,7 @@
 		}
 		if (!aborted) {
 			SWBuf confDir = sourceDir + "/mods.d/";
-			if (dir = opendir(confDir.c_str())) {	// find and copy .conf file
+			if ((dir = opendir(confDir.c_str()))) {	// find and copy .conf file
 				rewinddir(dir);
 				while ((ent = readdir(dir))) {
 					if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {




More information about the sword-cvs mailing list