tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerome "Lacoste (Frisurf)" <lacos...@frisurf.no>
Subject Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 InputBuffer.java
Date Mon, 06 Jan 2003 08:37:52 GMT
On Sun, 2003-01-05 at 18:20, remm@apache.org wrote:
> remm        2003/01/05 09:20:41
> 
>   Modified:    coyote/src/java/org/apache/coyote/tomcat5 InputBuffer.java
>   Log:
>   - Fix skip and reset.
>   
>   Revision  Changes    Path
>   1.3       +14 -9     jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/InputBuffer.java
>   
>   Index: InputBuffer.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/InputBuffer.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- InputBuffer.java	5 Jan 2003 13:26:39 -0000	1.2
>   +++ InputBuffer.java	5 Jan 2003 17:20:41 -0000	1.3
>   @@ -413,13 +413,19 @@
>    
>            long nRead = 0;
>            while (nRead < n) {
>   -            if (cb.getLength() > n) {
>   +            if (cb.getLength() >= n) {
>                    cb.setOffset(cb.getStart() + (int) n);
>                    nRead = n;
>                } else {
>                    nRead += cb.getLength();
>                    cb.setOffset(cb.getEnd());
>   -                int nb = realReadChars(cb.getChars(), 0, cb.getEnd());
>   +                int toRead = 0;
>   +                if (cb.getChars().length < (n - nRead)) {
>   +                    toRead = cb.getChars().length;
>   +                } else {
>   +                    toRead = (int) (n - nRead);
>   +                }
>   +                int nb = realReadChars(cb.getChars(), 0, toRead);

what about

int nb = realReadChars(cb.getChars(), 
                       0, 
                       Math.max(cb.getChars().length, (int) (n -
nRead)));

?

Jerome

-- 
Jerome Lacoste (Frisurf) <lacostej@frisurf.no>
CoffeeBreaks


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message