xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eric...@apache.org
Subject cvs commit: xml-xmlbeans/v2/test/src/erictest EricTest.java
Date Fri, 02 Apr 2004 16:27:53 GMT
ericvas     2004/04/02 08:27:53

  Modified:    v2/src/newstore2/org/apache/xmlbeans/impl/newstore2
                        CharUtil.java Cur.java Public2.java
               v2/test/src/erictest EricTest.java
  Log:
  Fix off by one error in cchRight
  
  Revision  Changes    Path
  1.7       +11 -3     xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/CharUtil.java
  
  Index: CharUtil.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/CharUtil.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CharUtil.java	26 Mar 2004 23:37:27 -0000	1.6
  +++ CharUtil.java	2 Apr 2004 16:27:53 -0000	1.7
  @@ -124,10 +124,16 @@
           {
               _cchSrc = cch;
               _offSrc = off;
  -            
               return src;
           }
   
  +        if (cch == 0)
  +        {
  +            _cchSrc = cchInsert;
  +            _offSrc = offInsert;
  +            return srcInsert;
  +        }
  +
           _cchSrc = cch + cchInsert;
   
           Object newSrc;
  @@ -148,7 +154,7 @@
           else
           {
               _offSrc = 0;
  -            
  +
               if (posInsert == 0)
                   newSrc = new CharJoin( srcInsert, offInsert, cchInsert, src, off, cch );
               else if (posInsert == cch)
  @@ -343,8 +349,10 @@
   
       public static void dumpChars ( PrintStream p, Object src, int off, int cch )
       {
  +        p.print( "cch=" + cch + ", off=" + off + ": " );
  +        
           if (src == null)
  -            p.print( "<null>" );
  +            p.print( "<null-src>" );
           else if (src instanceof String)
           {
               String s = (String) src;
  
  
  
  1.29      +1 -1      xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cur.java
  
  Index: Cur.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cur.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Cur.java	30 Mar 2004 21:29:26 -0000	1.28
  +++ Cur.java	2 Apr 2004 16:27:53 -0000	1.29
  @@ -1955,7 +1955,7 @@
               assert isNormal( p );
               if (p <= 0) return 0;
               int pa = posAfter();
  -            return p < pa ? pa - p : posMax() - p;
  +            return p < pa ? pa - p - 1 : posMax() - p;
           }
   
           final boolean isNormal ( int p )
  
  
  
  1.13      +10 -18    xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Public2.java
  
  Index: Public2.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Public2.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Public2.java	31 Mar 2004 00:09:37 -0000	1.12
  +++ Public2.java	2 Apr 2004 16:27:53 -0000	1.13
  @@ -257,26 +257,18 @@
   
       public static void test ( Node n )
       {
  -        Dom d = (Dom) n;
  -        
  -        Cur c = d.locale().permCur();
  -        c.moveToDom( d );
  -
  -        c.dump();
  +        CharUtil cu = CharUtil.getThreadLocalCharUtil();
   
  -        c.next();
  -        c.next();
  -        c.nextWithAttrs();
  +        Object src = null;
  +        int off = 0;
  +        int cch = 0;
  +
  +        src = cu.insertChars( 0, src, off, cch, "1234567890123456789012345678901234567890",
0, 40 );
  +        off = cu._offSrc;
  +        cch = cu._cchSrc;
           
  +        CharUtil.dumpChars( System.out, src, cu._offSrc, cu._cchSrc );
   
  -//        c.setType( XmlObject.type );
  -
  -//        TypeStore store = c.getTypeStore();
  -
  -//        store.invalidate_text();
  -
  -        c.dump();
  -        
  -        c.release();
  +        cu.getChars( new char [ 100 ], 0, src, cu._offSrc, cu._cchSrc );
       }
   }
  
  
  
  1.44      +1 -27     xml-xmlbeans/v2/test/src/erictest/EricTest.java
  
  Index: EricTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/src/erictest/EricTest.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- EricTest.java	30 Mar 2004 21:29:27 -0000	1.43
  +++ EricTest.java	2 Apr 2004 16:27:53 -0000	1.44
  @@ -111,33 +111,7 @@
   {
       public static void main ( String[] args ) throws Exception
       {
  -        XmlCursor c = Public2.newStore();
  -
  -        c.toNextToken();
  -        c.insertAttribute( "moo" );
  -        c.toPrevToken();
  -
  -        Node n = c.getDomNode();
  -
  -        n.appendChild( n.getOwnerDocument().createTextNode( "a" ) );
  -        n.appendChild( n.getOwnerDocument().createTextNode( "b" ) );
  -
  -//        Public2.test( n );
  -
  -        Public2.dump( n );
  -        
  -        n.normalize();
  -
  -        Public2.dump( n );
  -        
  -//        XmlCursor c = Public2.newStore();
  -//
  -//        c.toNextToken();
  -//
  -//        c.beginElement( "foo" );
  -//        c.toStartDoc();
  -//
  -//        Public2.test( c.getDomNode() );
  +        Public2.test( null );
       }
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message