Robert Schiele wrote:
On Mon, Jan 05, 2004 at 12:51:10AM +0200, Lauri Tischler wrote:
Nice patch, cleans up all cruft, just one warning remains
g++ -O2 -g -Wall -Woverloaded-virtual -c si.c
si.c: In member function `void SI::String::decodeText(char*)':
si.c:222: warning: comparison is always true due to limited range of data
type
You can fix this by doing the following:
--- ./libsi/si.c~ 2004-01-05 01:17:11.000000000 +0100
+++ ./libsi/si.c 2004-01-05 01:12:22.000000000 +0100
@@ -11,6 +11,7 @@
***************************************************************************/
#include <string.h>
+#include <limits.h>
#include "si.h"
#include "descriptor.h"
@@ -219,7 +220,11 @@
break;
if ( ((' ' <= *from) && (*from <= '~'))
|| (*from == '\n')
- || ((0xA0 <= *from) && (*from <= 0xFF))
+ || ((0xA0 <= *from)
+#if (defined CHAR_BIT) && (CHAR_BIT > 8)
+ && (*from <= 0xFF)
+#endif
+ )
)
*to++ = *from;
else if (*from == 0x8A)
Hmmm, I wonder why the check against 0xFF was introduced in the first place?
It wasn't there in the original 'libdvt' code written by Rolf Hakenes,
and I'd say it isn't necessary, anyway, since 'char' is assumed to be 8 bit.
I guess I'll just remove the (*from <= 0xFF) check.
(Sorry, Robert, this is the second fix in a row that you have suggested
but I have done differently - no offense ;-)
This was introduced because of warnings from gcc-3.3.1