You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Daniel L. Rall" <dl...@finemaltcoding.com> on 2000/02/12 22:58:51 UTC

[PATCH] Cast error

Error assigning char data to a byte (Blackdown JDK 1.2.2).  Fixed by
casting the char to a byte.  Possible lost of data?  Please review and
commit if okay (I am not a committer).


dlr@drac:taskdefs$ diff -u FixCRLF.java-ORIG FixCRLF.java
--- FixCRLF.java-ORIG	Sat Feb 12 13:45:19 2000
+++ FixCRLF.java	Sat Feb 12 13:54:18 2000
@@ -309,8 +309,8 @@
 
                     case '\n':
                         // start a new line (optional CR followed by
LF)
-                        if (addcr == +1) outdata[o++]='\r';
-                        outdata[o++]='\n';
+                        if (addcr == +1) outdata[o++]=(byte)'\r';
+                        outdata[o++]=(byte)'\n';
                         line=o;
                         col=0;
                         break;
@@ -324,14 +324,14 @@
                             // add tabs until this column would be
passed
                             // note: the start of line is adjusted to
match
                             while ((diff|7)<col) {
-                                outdata[o++]='\t';
+                                outdata[o++]=(byte)'\t';
                                 line-=7-(diff&7);
                                 diff=o-line;
                             };
                         };
 
                         // space out to desired column
-                        while (o<line+col) outdata[o++]=' ';
+                        while (o<line+col) outdata[o++]=(byte)' ';
 
                         // append desired character
                         outdata[o++]=indata[k];
-- 

Daniel Rall (dlr@finemaltcoding.com)