Package: sword
Version: 1.7.3+dfsg-7
Followup-For: Bug #811602

Dear Maintainer,

I'm just a passer, but because in our project, we have an
applications that depends on a sword library, I have
prepared a patch that fixes a building using GCC6.
Maybe it could be useful.

Cheers
-- 
Slavek

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.6.0-0.bpo.1-amd64 (SMP w/20 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect
Index: b/include/swobject.h
===================================================================
--- a/include/swobject.h
+++ b/include/swobject.h
@@ -27,7 +27,7 @@
 #include <defs.h>
 
 SWORD_NAMESPACE_START
-#define SWDYNAMIC_CAST(className, object) (className *)((object)?((object->getClass()->isAssignableFrom(#className))?object:0):0)
+#define SWDYNAMIC_CAST(className, object) (className *)((object!=0)?((object->getClass()->isAssignableFrom(#className))?object:0):0)
 
 /**
 * Class used for SWDYNAMIC_CAST to save the inheritance order.
Index: b/src/keys/treekeyidx.cpp
===================================================================
--- a/src/keys/treekeyidx.cpp
+++ b/src/keys/treekeyidx.cpp
@@ -259,14 +259,15 @@
 				getTreeNodeFromIdxOffset(currentNode.parent, &iterator);
 				getTreeNodeFromIdxOffset(iterator.firstChild, &iterator);
 				if (iterator.offset != target) {
-					while ((iterator.next != target) && (iterator.next > -1))
+					while ((iterator.next != target) && (iterator.next > -1)) {
 						getTreeNodeFromIdxOffset(iterator.next, &iterator);
-						if (iterator.next > -1) {
-							TreeNode prev;
-							getTreeNodeFromIdxOffset(iterator.offset, &prev);
-							prev.next = node.next;
-							saveTreeNodeOffsets(&prev);
-							getTreeNodeFromIdxOffset(prev.offset, &currentNode);
+					}
+					if (iterator.next > -1) {
+						TreeNode prev;
+						getTreeNodeFromIdxOffset(iterator.offset, &prev);
+						prev.next = node.next;
+						saveTreeNodeOffsets(&prev);
+						getTreeNodeFromIdxOffset(prev.offset, &currentNode);
 					}
 				}
 			}
Index: b/src/modules/filters/gbfheadings.cpp
===================================================================
--- a/src/modules/filters/gbfheadings.cpp
+++ b/src/modules/filters/gbfheadings.cpp
@@ -93,9 +93,10 @@
 				continue;
 			}
 			if (intoken) {
-				if (tokpos < 2045)
+				if (tokpos < 2045) {
 					token[tokpos++] = *from;
-					token[tokpos+2] = 0;
+				}
+				token[tokpos+2] = 0;
 			}
 			else	{
 				if (!hide) {
Index: b/src/modules/filters/gbfmorph.cpp
===================================================================
--- a/src/modules/filters/gbfmorph.cpp
+++ b/src/modules/filters/gbfmorph.cpp
@@ -84,9 +84,10 @@
 				continue;
 			}
 			if (intoken) {
-				if (tokpos < 2045)
+				if (tokpos < 2045) {
 					token[tokpos++] = *from;
-					token[tokpos+2] = 0;
+				}
+				token[tokpos+2] = 0;
 			}
 			else	{
 				text += *from;
Index: b/src/modules/filters/gbfplain.cpp
===================================================================
--- a/src/modules/filters/gbfplain.cpp
+++ b/src/modules/filters/gbfplain.cpp
@@ -103,9 +103,10 @@
 			continue;
 		}
 		if (intoken) {
-			if (tokpos < 2045)
+			if (tokpos < 2045) {
 				token[tokpos++] = *from;
-				token[tokpos+2] = 0;
+			}
+			token[tokpos+2] = 0;
 		}
 		else	text.append(*from);
 	}
Index: b/src/modules/filters/gbfredletterwords.cpp
===================================================================
--- a/src/modules/filters/gbfredletterwords.cpp
+++ b/src/modules/filters/gbfredletterwords.cpp
@@ -101,9 +101,10 @@
 				continue;
 			}
 			if (intoken) {
-				if (tokpos < 4090)
+				if (tokpos < 4090) {
 					token[tokpos++] = *from;
-					token[tokpos+2] = 0;	// +2 cuz we init token with 2 extra '0' because of switch statement
+				}
+				token[tokpos+2] = 0;	// +2 cuz we init token with 2 extra '0' because of switch statement
 			}
 			else {
 				text += *from;
Index: b/src/modules/filters/gbfrtf.cpp
===================================================================
--- a/src/modules/filters/gbfrtf.cpp
+++ b/src/modules/filters/gbfrtf.cpp
@@ -307,9 +307,10 @@
 			continue;
 		}
 		if (intoken) {
-			if (tokpos < 2045)
+			if (tokpos < 2045) {
 				token[tokpos++] = *from;
-				token[tokpos+2] = 0;
+			}
+			token[tokpos+2] = 0;
 		}
 		else {
 			if (!hideText) {
Index: b/src/modules/filters/gbfstrongs.cpp
===================================================================
--- a/src/modules/filters/gbfstrongs.cpp
+++ b/src/modules/filters/gbfstrongs.cpp
@@ -134,9 +134,10 @@
 			continue;
 		}
 		if (intoken) {
-			if (tokpos < 2045)
+			if (tokpos < 2045) {
 				token[tokpos++] = *from;
-				token[tokpos+2] = 0;
+			}
+			token[tokpos+2] = 0;
 		}
 		else	{
 			text += *from;
Index: b/src/modules/filters/gbfthml.cpp
===================================================================
--- a/src/modules/filters/gbfthml.cpp
+++ b/src/modules/filters/gbfthml.cpp
@@ -210,9 +210,10 @@
 			continue;
 		}
 		if (intoken) {
-			if (tokpos < 2045)
+			if (tokpos < 2045) {
 				token[tokpos++] = *from;
-				token[tokpos+2] = 0;
+			}
+			token[tokpos+2] = 0;
 		}
 		else	text += *from;
 	}
Index: b/src/modules/filters/gbfwordjs.cpp
===================================================================
--- a/src/modules/filters/gbfwordjs.cpp
+++ b/src/modules/filters/gbfwordjs.cpp
@@ -223,9 +223,10 @@
 				continue;
 			}
 			if (intoken) {
-				if (tokpos < 2045)
+				if (tokpos < 2045) {
 					token[tokpos++] = *from;
-					token[tokpos+2] = 0;
+				}
+				token[tokpos+2] = 0;
 			}
 			else	{
 				text += *from;
Index: b/src/modules/filters/osismorph.cpp
===================================================================
--- a/src/modules/filters/osismorph.cpp
+++ b/src/modules/filters/osismorph.cpp
@@ -90,9 +90,10 @@
 				continue;
 			}
 			if (intoken) {
-				if (tokpos < 2045)
+				if (tokpos < 2045) {
 					token[tokpos++] = *from;
-					token[tokpos] = 0;
+				}
+				token[tokpos] = 0;
 			}
 			else	{
 				text.append(*from);
Index: b/src/modules/filters/osiswordjs.cpp
===================================================================
--- a/src/modules/filters/osiswordjs.cpp
+++ b/src/modules/filters/osiswordjs.cpp
@@ -185,9 +185,10 @@
 				continue;
 			}
 			if (intoken) {
-				if (tokpos < 2045)
+				if (tokpos < 2045) {
 					token[tokpos++] = *from;
-					token[tokpos+2] = 0;
+				}
+				token[tokpos+2] = 0;
 			}
 			else	{
 				text.append(*from);
Index: b/src/modules/filters/thmlgbf.cpp
===================================================================
--- a/src/modules/filters/thmlgbf.cpp
+++ b/src/modules/filters/thmlgbf.cpp
@@ -269,9 +269,10 @@
 			continue;
 		}
 		if (intoken) {
-			if (tokpos < 2045)
+			if (tokpos < 2045) {
 				token[tokpos++] = *from;
-				token[tokpos+2] = 0;
+			}
+			token[tokpos+2] = 0;
 		}
 		else	text += *from;
 	}
Index: b/src/modules/filters/thmlplain.cpp
===================================================================
--- a/src/modules/filters/thmlplain.cpp
+++ b/src/modules/filters/thmlplain.cpp
@@ -206,9 +206,10 @@
 			continue;
 		}
 		if (intoken) {
-			if (tokpos < 2045)
+			if (tokpos < 2045) {
 				token[tokpos++] = *from;
-				token[tokpos+2] = 0;
+			}
+			token[tokpos+2] = 0;
 		}
 		else	text += *from;
 	}
Index: b/src/modules/filters/thmlstrongs.cpp
===================================================================
--- a/src/modules/filters/thmlstrongs.cpp
+++ b/src/modules/filters/thmlstrongs.cpp
@@ -154,9 +154,10 @@
 			continue;
 		}
 		if (intoken) {
-			if (tokpos < 2045)
+			if (tokpos < 2045) {
 				token[tokpos++] = *from;
-				token[tokpos+2] = 0;
+			}
+			token[tokpos+2] = 0;
 		}
 		else	{
 			text += *from;
Index: b/src/modules/filters/thmlwordjs.cpp
===================================================================
--- a/src/modules/filters/thmlwordjs.cpp
+++ b/src/modules/filters/thmlwordjs.cpp
@@ -237,9 +237,10 @@
 				continue;
 			}
 			if (intoken) {
-				if (tokpos < 2045)
+				if (tokpos < 2045) {
 					token[tokpos++] = *from;
-					token[tokpos+2] = 0;
+				}
+				token[tokpos+2] = 0;
 			}
 			else	{
 				text += *from;
Index: b/src/utilfuns/utilxml.cpp
===================================================================
--- a/src/utilfuns/utilxml.cpp
+++ b/src/utilfuns/utilxml.cpp
@@ -82,12 +82,13 @@
 				if (buf[i]) {	// we have attribute value
 					start = i;
 					// Skip until matching quote character
-					for (; ((buf[i]) && (buf[i] != quoteChar)); i++);
+					for (; ((buf[i]) && (buf[i] != quoteChar)); i++) {};
 
 					// Allow for empty quotes
 					//if (i-start) {
-						if (value)
+						if (value) {
 							delete [] value;
+						}
 						value = new char [ (i-start) + 1 ];
 						if (i-start) {
 							strncpy(value, buf+start, i-start);
Index: b/utilities/diatheke/thmlcgi.cpp
===================================================================
--- a/utilities/diatheke/thmlcgi.cpp
+++ b/utilities/diatheke/thmlcgi.cpp
@@ -198,9 +198,10 @@
 
 		else {
 			buf += '<';
-			for (i = 0; i < strlen(token); i++)
+			for (i = 0; i < strlen(token); i++) {
 				buf += token[i];
-				buf += '>';
+			}
+			buf += '>';
 			//return false;  // we still didn't handle token
 		}
 	}
Index: b/utilities/emptyvss.cpp
===================================================================
--- a/utilities/emptyvss.cpp
+++ b/utilities/emptyvss.cpp
@@ -72,10 +72,11 @@
 	(*mod) = TOP;
 
 	while (!mod->popError()) {
-	  
-	if (vkey->getVerse())
-		if (!mod->renderText().length())
-			std::cout << *vkey << std::endl;
+		if (vkey->getVerse()) {
+			if (!mod->renderText().length()) {
+				std::cout << *vkey << std::endl;
+			}
+		}
 		(*mod)++;
 	}
 }

Reply via email to