remm        2004/03/05 05:08:00

  Modified:    util/java/org/apache/tomcat/util/buf CharChunk.java
  Log:
  - Same fix.
  - Make calls to realReads compatible with marking (which is just for cleaness,
    as the parameters are not used in our use case).
  - Make makeSpace compatible with marking, which needs to be supported
    by char chunks.
  
  Revision  Changes    Path
  1.12      +8 -9      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java
  
  Index: CharChunk.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- CharChunk.java    24 Feb 2004 08:50:06 -0000      1.11
  +++ CharChunk.java    5 Mar 2004 13:08:00 -0000       1.12
  @@ -261,6 +261,7 @@
            // makeSpace will grow the buffer to the limit,
            // so we have space
            System.arraycopy( src, off, buff, end, len );
  +            
            end+=len;
            return;
        }
  @@ -368,7 +369,7 @@
           if ((end - start) == 0) {
               if (in == null)
                   return -1;
  -            int n = in.realReadChars(buff, 0, buff.length);
  +            int n = in.realReadChars(buff, end, buff.length - end);
               if (n < 0)
                   return -1;
           }
  @@ -383,7 +384,7 @@
           if ((end - start) == 0) {
               if (in == null)
                   return -1;
  -            int n = in.realReadChars( buff, 0, buff.length );
  +            int n = in.realReadChars( buff, end, buff.length - end);
               if (n < 0)
                   return -1;
           }
  @@ -401,7 +402,7 @@
           if ((end - start) == 0) {
               if (in == null)
                   return -1;
  -            int n = in.realReadChars( buff, 0, buff.length );
  +            int n = in.realReadChars( buff, end, buff.length - end);
               if (n < 0)
                   return -1;
           }
  @@ -441,8 +442,8 @@
   
        // Can't grow above the limit
        if( limit > 0 &&
  -         desiredSize > limit -start  ) {
  -         desiredSize=limit-start;
  +         desiredSize > limit) {
  +         desiredSize=limit;
        }
   
        if( buff==null ) {
  @@ -452,7 +453,7 @@
   
        // limit < buf.length ( the buffer is already big )
        // or we already have space XXX
  -     if( desiredSize <= buff.length ) {
  +     if( desiredSize <= buff.length) {
            return;
        }
        // grow in larger chunks
  @@ -468,11 +469,9 @@
            tmp=new char[newSize];
        }
        
  -     System.arraycopy(buff, start, tmp, 0, end-start);
  +     System.arraycopy(buff, start, tmp, start, end-start);
        buff = tmp;
        tmp = null;
  -     end=end-start;
  -     start=0;
       }
       
       // -------------------- Conversion and getters --------------------
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to