You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2006/01/18 20:56:37 UTC
svn commit: r370240 - in
/db/derby/code/trunk/java/client/org/apache/derby/client/net: Reply.java
Request.java
Author: davidvc
Date: Wed Jan 18 11:56:27 2006
New Revision: 370240
URL: http://svn.apache.org/viewcvs?rev=370240&view=rev
Log:
DERBY-823: This minor patch changes a few for loops into equivalent uses
of System.arraycopy() and java.util.Arrays.fill().
Contributed by Anders Morken
Modified:
db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java
db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java?rev=370240&r1=370239&r2=370240&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/Reply.java Wed Jan 18 11:56:27 2006
@@ -22,6 +22,7 @@
import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
import org.apache.derby.client.am.SignedBinary;
import org.apache.derby.client.am.SqlException;
@@ -75,9 +76,7 @@
pos_ = 0;
count_ = 0;
topDdmCollectionStack_ = Reply.EMPTY_STACK;
- for (int i = 0; i < Reply.MAX_MARKS_NESTING; i++) {
- ddmCollectionLenStack_[i] = 0;
- }
+ Arrays.fill(ddmCollectionLenStack_, 0);
ddmScalarLen_ = 0;
dssLength_ = 0;
dssIsContinued_ = false;
@@ -300,13 +299,8 @@
bytesToShift = dssLength_;
}
- tempPos -= (shiftSize - 1);
- // perform the compress
- for (int j = 0; j < bytesToShift; j++) {
- buffer_[tempPos + shiftSize] = buffer_[tempPos];
- tempPos--;
- }
- tempPos += (shiftSize + 1);
+ tempPos -= (bytesToShift - 2);
+ System.arraycopy(buffer_, tempPos - shiftSize, buffer_, tempPos , bytesToShift);
}
// reposition the start of the data after the final dss shift.
pos_ = tempPos;
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java?rev=370240&r1=370239&r2=370240&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java Wed Jan 18 11:56:27 2006
@@ -900,10 +900,8 @@
}
// perform the shift
- for (int i = 0; i < dataToShift; i++) {
- bytes_[dataByte + shiftOffset] = bytes_[dataByte];
- dataByte--;
- }
+ dataByte -= dataToShift;
+ System.arraycopy(bytes_, dataByte + 1,bytes_, dataByte + shiftOffset + 1, dataToShift);
// calculate the value the value of the 2 byte continuation dss header which
// includes the length of itself. On the first pass, if the length is 32767