tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel L. Rall" <...@finemaltcoding.com>
Subject [PATCH] Cast error
Date Sat, 12 Feb 2000 21:58:51 GMT
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)

Mime
View raw message