cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [1/2] git commit: ninja: Always make a copy in BBU.getArray()
Date Tue, 01 Jul 2014 19:27:25 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 c70daa8ed -> a4f2a97ad


ninja: Always make a copy in BBU.getArray()


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6aa81a5b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6aa81a5b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6aa81a5b

Branch: refs/heads/cassandra-2.1
Commit: 6aa81a5b378938bcd9d1201af191685dcbf4a96b
Parents: 3958fc4
Author: Jake Luciani <jake@apache.org>
Authored: Tue Jul 1 15:25:13 2014 -0400
Committer: Jake Luciani <jake@apache.org>
Committed: Tue Jul 1 15:25:13 2014 -0400

----------------------------------------------------------------------
 src/java/org/apache/cassandra/utils/ByteBufferUtil.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6aa81a5b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
index 420a776..16dbfb7 100644
--- a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
+++ b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
@@ -158,10 +158,7 @@ public class ByteBufferUtil
         if (buffer.hasArray())
         {
             int boff = buffer.arrayOffset() + buffer.position();
-            if (boff == 0 && length == buffer.array().length)
-                return buffer.array();
-            else
-                return Arrays.copyOfRange(buffer.array(), boff, boff + length);
+            return Arrays.copyOfRange(buffer.array(), boff, boff + length);
         }
         // else, DirectByteBuffer.get() is the fastest route
         byte[] bytes = new byte[length];


Mime
View raw message