On 05/25/2011 07:21 AM, David Haslam wrote:

> Error reading ulBuffNum
> 
> These are sent to stdout, rather than stderr, ...

> Is anyone actually doing something about this?
> 
> (a) to ensure that these error messages are propelrly sent to stderr
> (b) to fix the utils so that this particular error message is rarely sent

Here's a trivial 5 minute patch for (a).  It compiles.  I don't have a
sample input file that makes it generate the error, so I didn't test that :)

Is there a bug in the official SWORD bug tracker for this?  If it is
really as common as you suggest, I'd hope someone bothered to report it
before now? :)

Jonathan
--- src.orig/modules/common/zverse.cpp	2009-03-29 07:09:43.000000000 -0700
+++ src/modules/common/zverse.cpp	2011-05-28 18:45:23.000000000 -0700
@@ -168,7 +168,7 @@
 	long newOffset = compfp[testmt-1]->seek(idxoff, SEEK_SET);
 	if (newOffset == idxoff) {
 		if (compfp[testmt-1]->read(&ulBuffNum, 4) != 4) {
-			printf ("Error reading ulBuffNum\n");
+			fprintf (stderr, "Error reading ulBuffNum\n");
 			return;
 		}
 	}
@@ -176,12 +176,12 @@
 	
 	if (compfp[testmt-1]->read(&ulVerseStart, 4) < 2)
 	{
-		printf ("Error reading ulVerseStart\n");
+		fprintf (stderr, "Error reading ulVerseStart\n");
 		return;
 	}
 	if (compfp[testmt-1]->read(&usVerseSize, 2) < 2)
 	{
-		printf ("Error reading usVerseSize\n");
+		fprintf (stderr, "Error reading usVerseSize\n");
 		return;
 	}
 
@@ -221,22 +221,22 @@
 
 		if (idxfp[testmt-1]->seek(ulBuffNum*12, SEEK_SET)!=(long) ulBuffNum*12)
 		{
-			printf ("Error seeking compressed file index\n");
+			fprintf (stderr, "Error seeking compressed file index\n");
 			return;
 		}
 		if (idxfp[testmt-1]->read(&ulCompOffset, 4)<4)
 		{
-			printf ("Error reading ulCompOffset\n");
+			fprintf (stderr, "Error reading ulCompOffset\n");
 			return;
 		}
 		if (idxfp[testmt-1]->read(&ulCompSize, 4)<4)
 		{
-			printf ("Error reading ulCompSize\n");
+			fprintf (stderr, "Error reading ulCompSize\n");
 			return;
 		}
 		if (idxfp[testmt-1]->read(&ulUnCompSize, 4)<4)
 		{
-			printf ("Error reading ulUnCompSize\n");
+			fprintf (stderr, "Error reading ulUnCompSize\n");
 			return;
 		}
 
@@ -246,14 +246,14 @@
 
 		if (textfp[testmt-1]->seek(ulCompOffset, SEEK_SET)!=(long)ulCompOffset)
 		{
-			printf ("Error: could not seek to right place in compressed text\n");
+			fprintf (stderr, "Error: could not seek to right place in compressed text\n");
 			return;
 		}
 		SWBuf pcCompText;
 		pcCompText.setSize(ulCompSize+5);
 
 		if (textfp[testmt-1]->read(pcCompText.getRawData(), ulCompSize)<(long)ulCompSize) {
-			printf ("Error reading compressed text\n");
+			fprintf (stderr, "Error reading compressed text\n");
 			return;
 		}
 		pcCompText.setSize(ulCompSize);
_______________________________________________
sword-devel mailing list: [email protected]
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to