You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/11/09 12:48:34 UTC
[02/18] ignite git commit: IGNITE-1862: Removed "convertString" flag
and fixed string serialization in CPP.
IGNITE-1862: Removed "convertString" flag and fixed string serialization in CPP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/80be22b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/80be22b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/80be22b5
Branch: refs/heads/ignite-1803-final
Commit: 80be22b52daab79216e90d3b7e88a8d2b56d3e0b
Parents: 1a01ad8
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Nov 9 12:31:00 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Nov 9 12:31:00 2015 +0300
----------------------------------------------------------------------
.../internal/portable/BinaryObjectImpl.java | 14 ++--------
.../portable/BinaryObjectOffheapImpl.java | 16 +++--------
.../internal/portable/BinaryReaderExImpl.java | 18 +++++--------
.../internal/portable/BinaryWriterExImpl.java | 19 +++----------
.../internal/portable/PortableContext.java | 11 --------
.../portable/builder/PortableBuilderReader.java | 20 +++-----------
.../marshaller/portable/PortableMarshaller.java | 25 -----------------
.../portable/BinaryFieldsAbstractSelfTest.java | 19 ++-----------
...idBinaryObjectBuilderAdditionalSelfTest.java | 9 -------
.../GridBinaryObjectBuilderSelfTest.java | 9 -------
...tBuilderStringAsCharsAdditionalSelfTest.java | 28 --------------------
...inaryObjectBuilderStringAsCharsSelfTest.java | 28 --------------------
.../IgnitePortableObjectsTestSuite.java | 4 ---
.../ignite/impl/portable/portable_reader_impl.h | 13 ++-------
.../src/impl/portable/portable_reader_impl.cpp | 19 +++----------
.../core/src/impl/portable/portable_utils.cpp | 5 +---
.../src/impl/portable/portable_writer_impl.cpp | 7 +----
.../Impl/Portable/PortableUtils.cs | 13 ++-------
18 files changed, 29 insertions(+), 248 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
index 6412b7f..800ca40 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
@@ -337,19 +337,9 @@ public final class BinaryObjectImpl extends BinaryObjectEx implements Externaliz
break;
case STRING: {
- boolean utf = PortablePrimitives.readBoolean(arr, fieldPos + 1);
+ int dataLen = PortablePrimitives.readInt(arr, fieldPos + 1);
- if (utf) {
- int dataLen = PortablePrimitives.readInt(arr, fieldPos + 2);
-
- val = new String(arr, fieldPos + 6, dataLen, UTF_8);
- }
- else {
- int dataLen = PortablePrimitives.readInt(arr, fieldPos + 2);
- char[] data = PortablePrimitives.readCharArray(arr, fieldPos + 6, dataLen);
-
- val = String.valueOf(data);
- }
+ val = new String(arr, fieldPos + 5, dataLen, UTF_8);
break;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
index e53e9fb..9b6735f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
@@ -269,20 +269,10 @@ public class BinaryObjectOffheapImpl extends BinaryObjectEx implements Externali
break;
case STRING: {
- boolean utf = PortablePrimitives.readBoolean(ptr, fieldPos + 1);
+ int dataLen = PortablePrimitives.readInt(ptr, fieldPos + 1);
+ byte[] data = PortablePrimitives.readByteArray(ptr, fieldPos + 5, dataLen);
- if (utf) {
- int dataLen = PortablePrimitives.readInt(ptr, fieldPos + 2);
- byte[] data = PortablePrimitives.readByteArray(ptr, fieldPos + 6, dataLen);
-
- val = new String(data, UTF_8);
- }
- else {
- int dataLen = PortablePrimitives.readInt(ptr, fieldPos + 2);
- char[] data = PortablePrimitives.readCharArray(ptr, fieldPos + 6, dataLen);
-
- val = String.valueOf(data);
- }
+ val = new String(data, UTF_8);
break;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
index 5ec981b..00eb3e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
@@ -1658,21 +1658,17 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Obje
* @return Value.
*/
private String doReadString() {
- if (in.readBoolean()) {
- if (!in.hasArray())
- return new String(doReadByteArray(), UTF_8);
+ if (!in.hasArray())
+ return new String(doReadByteArray(), UTF_8);
- int strLen = in.readInt();
- int strOff = in.position();
+ int strLen = in.readInt();
+ int strOff = in.position();
- String res = new String(in.array(), strOff, strLen, UTF_8);
+ String res = new String(in.array(), strOff, strLen, UTF_8);
- in.position(in.position() + strLen);
+ in.position(in.position() + strLen);
- return res;
- }
- else
- return String.valueOf(doReadCharArray());
+ return res;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
index ef3ef2f..6b4d0b5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
@@ -500,24 +500,11 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
else {
doWriteByte(STRING);
- if (ctx.isConvertString()) {
- doWriteBoolean(true);
+ byte[] strArr = val.getBytes(UTF_8);
- byte[] strArr = val.getBytes(UTF_8);
+ doWriteInt(strArr.length);
- doWriteInt(strArr.length);
-
- out.writeByteArray(strArr);
- }
- else {
- doWriteBoolean(false);
-
- char[] strArr = val.toCharArray();
-
- doWriteInt(strArr.length);
-
- out.writeCharArray(strArr);
- }
+ out.writeByteArray(strArr);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index 8c42624..54a180b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -149,9 +149,6 @@ public class PortableContext implements Externalizable {
private final OptimizedMarshaller optmMarsh = new OptimizedMarshaller();
/** */
- private boolean convertStrings;
-
- /** */
private boolean keepDeserialized;
/** Object schemas. */
@@ -253,7 +250,6 @@ public class PortableContext implements Externalizable {
if (marsh == null)
return;
- convertStrings = marsh.isConvertStringToBytes();
keepDeserialized = marsh.isKeepDeserialized();
marshCtx = marsh.getContext();
@@ -836,13 +832,6 @@ public class PortableContext implements Externalizable {
}
/**
- * @return Whether to convert string to UTF8 bytes.
- */
- public boolean isConvertString() {
- return convertStrings;
- }
-
- /**
* Get schema registry for type ID.
*
* @param typeId Type ID.
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
index d2a3ac2..5c6a131 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
@@ -151,11 +151,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
* @return String length.
*/
public int readStringLength() {
- boolean utf = PortablePrimitives.readBoolean(arr, pos);
-
- int arrLen = PortablePrimitives.readInt(arr, pos + 1);
-
- return 1 + (utf ? arrLen : arrLen << 1);
+ return PortablePrimitives.readInt(arr, pos);
}
/**
@@ -172,21 +168,11 @@ public class PortableBuilderReader implements PortablePositionReadable {
if (flag != STRING)
throw new BinaryObjectException("Failed to deserialize String.");
- boolean convert = readBoolean();
int len = readInt();
- String str;
-
- if (convert) {
- str = new String(arr, pos, len, UTF_8);
+ String str = new String(arr, pos, len, UTF_8);
- pos += len;
- }
- else {
- str = String.valueOf(PortablePrimitives.readCharArray(arr, pos, len));
-
- pos += len << 1;
- }
+ pos += len;
return str;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
index 4a1b0ad..2bbf9f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
@@ -87,9 +87,6 @@ public class PortableMarshaller extends AbstractMarshaller {
/** Types. */
private Collection<BinaryTypeConfiguration> typeCfgs;
- /** Whether to convert string to bytes using UTF-8 encoding. */
- private boolean convertString = true;
-
/** Keep deserialized flag. */
private boolean keepDeserialized = true;
@@ -172,28 +169,6 @@ public class PortableMarshaller extends AbstractMarshaller {
}
/**
- * Gets strings must be converted to or from bytes using UTF-8 encoding.
- * <p>
- * Default value is {@code true}.
- *
- * @return Flag indicating whether string must be converted to byte array using UTF-8 encoding.
- */
- public boolean isConvertStringToBytes() {
- return convertString;
- }
-
- /**
- * Sets strings must be converted to or from bytes using UTF-8 encoding.
- * <p>
- * Default value is {@code true}.
- *
- * @param convertString Flag indicating whether string must be converted to byte array using UTF-8 encoding.
- */
- public void setConvertStringToBytes(boolean convertString) {
- this.convertString = convertString;
- }
-
- /**
* If {@code true}, {@link org.apache.ignite.binary.BinaryObject} will cache deserialized instance after
* {@link org.apache.ignite.binary.BinaryObject#deserialize()} is called. All consequent calls of this
* method on the same instance of {@link org.apache.ignite.binary.BinaryObject} will return that cached
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
index 1db3f0b..4fa80b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
@@ -55,17 +55,14 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes
/**
* Create marshaller.
*
- * @param stringAsBytes Whether to marshal strings as bytes (UTF8).
* @return Portable marshaller.
* @throws Exception If failed.
*/
- protected static PortableMarshaller createMarshaller(boolean stringAsBytes) throws Exception {
+ protected static PortableMarshaller createMarshaller() throws Exception {
PortableContext ctx = new PortableContext(META_HND, new IgniteConfiguration());
PortableMarshaller marsh = new PortableMarshaller();
- marsh.setConvertStringToBytes(stringAsBytes);
-
marsh.setTypeConfigurations(Arrays.asList(
new BinaryTypeConfiguration(TestObject.class.getName()),
new BinaryTypeConfiguration(TestOuterObject.class.getName()),
@@ -95,7 +92,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes
@Override protected void beforeTest() throws Exception {
super.beforeTest();
- dfltMarsh = createMarshaller(true);
+ dfltMarsh = createMarshaller();
}
/**
@@ -252,18 +249,6 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes
}
/**
- * Test string field.
- *
- * @throws Exception If failed.
- */
- public void testStringAsChars() throws Exception {
- PortableMarshaller marsh = createMarshaller(false);
-
- checkNormal(marsh, "fString", true);
- checkNested(marsh, "fString", true);
- }
-
- /**
* Test string array field.
*
* @throws Exception If failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java
index 039ae3d..e62d12e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderAdditionalSelfTest.java
@@ -82,8 +82,6 @@ public class GridBinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstrac
marsh.setClassNames(Arrays.asList("org.apache.ignite.internal.portable.mutabletest.*"));
- marsh.setConvertStringToBytes(useUtf8());
-
cfg.setMarshaller(marsh);
return cfg;
@@ -105,13 +103,6 @@ public class GridBinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstrac
}
/**
- * @return Whether to use UTF8 strings.
- */
- protected boolean useUtf8() {
- return true;
- }
-
- /**
* @return Portables API.
*/
protected IgniteBinary portables() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java
index 925a61c..459a7ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderSelfTest.java
@@ -83,8 +83,6 @@ public class GridBinaryObjectBuilderSelfTest extends GridCommonAbstractTest {
marsh.setTypeConfigurations(Collections.singleton(customIdMapper));
- marsh.setConvertStringToBytes(useUtf8());
-
cfg.setMarshaller(marsh);
return cfg;
@@ -101,13 +99,6 @@ public class GridBinaryObjectBuilderSelfTest extends GridCommonAbstractTest {
}
/**
- * @return Whether to use UTF8 strings.
- */
- protected boolean useUtf8() {
- return true;
- }
-
- /**
*
*/
public void testAllFieldsSerialization() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderStringAsCharsAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderStringAsCharsAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderStringAsCharsAdditionalSelfTest.java
deleted file mode 100644
index e9eb92c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderStringAsCharsAdditionalSelfTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-/**
- *
- */
-public class GridBinaryObjectBuilderStringAsCharsAdditionalSelfTest extends GridBinaryObjectBuilderAdditionalSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean useUtf8() {
- return false;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderStringAsCharsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderStringAsCharsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderStringAsCharsSelfTest.java
deleted file mode 100644
index 050dc66..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridBinaryObjectBuilderStringAsCharsSelfTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-/**
- * Portable builder test.
- */
-public class GridBinaryObjectBuilderStringAsCharsSelfTest extends GridBinaryObjectBuilderSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean useUtf8() {
- return false;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
index 1231ef9..4fe8633 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
@@ -21,8 +21,6 @@ import junit.framework.TestSuite;
import org.apache.ignite.internal.portable.GridPortableAffinityKeySelfTest;
import org.apache.ignite.internal.portable.GridBinaryObjectBuilderAdditionalSelfTest;
import org.apache.ignite.internal.portable.GridBinaryObjectBuilderSelfTest;
-import org.apache.ignite.internal.portable.GridBinaryObjectBuilderStringAsCharsAdditionalSelfTest;
-import org.apache.ignite.internal.portable.GridBinaryObjectBuilderStringAsCharsSelfTest;
import org.apache.ignite.internal.portable.GridPortableMarshallerCtxDisabledSelfTest;
import org.apache.ignite.internal.portable.GridPortableMarshallerSelfTest;
import org.apache.ignite.internal.portable.GridPortableMetaDataSelfTest;
@@ -62,9 +60,7 @@ public class IgnitePortableObjectsTestSuite extends TestSuite {
suite.addTestSuite(GridPortableMarshallerSelfTest.class);
suite.addTestSuite(GridPortableMarshallerCtxDisabledSelfTest.class);
suite.addTestSuite(GridBinaryObjectBuilderSelfTest.class);
- suite.addTestSuite(GridBinaryObjectBuilderStringAsCharsSelfTest.class);
suite.addTestSuite(GridBinaryObjectBuilderAdditionalSelfTest.class);
- suite.addTestSuite(GridBinaryObjectBuilderStringAsCharsAdditionalSelfTest.class);
suite.addTestSuite(BinaryFieldsHeapSelfTest.class);
suite.addTestSuite(BinaryFieldsOffheapSelfTest.class);
suite.addTestSuite(PortableCompactOffsetsHeapSelfTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/platforms/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_reader_impl.h b/modules/platforms/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
index 4762fff..ec1c003 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
@@ -1284,21 +1284,12 @@ namespace ignite
if (typeId == IGNITE_TYPE_STRING)
{
- bool utf8Mode = stream->ReadBool();
int32_t realLen = stream->ReadInt32();
ignite::impl::utils::SafeArray<char> arr(realLen + 1);
- if (utf8Mode)
- {
- for (int i = 0; i < realLen; i++)
- *(arr.target + i) = static_cast<char>(stream->ReadInt8());
- }
- else
- {
- for (int i = 0; i < realLen; i++)
- *(arr.target + i) = static_cast<char>(stream->ReadUInt16());
- }
+ for (int i = 0; i < realLen; i++)
+ *(arr.target + i) = static_cast<char>(stream->ReadInt8());
*(arr.target + realLen) = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/platforms/cpp/core/src/impl/portable/portable_reader_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/portable/portable_reader_impl.cpp b/modules/platforms/cpp/core/src/impl/portable/portable_reader_impl.cpp
index fd2cc18..37e8a22 100644
--- a/modules/platforms/cpp/core/src/impl/portable/portable_reader_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/portable/portable_reader_impl.cpp
@@ -249,8 +249,6 @@ namespace ignite
CheckRawMode(false);
CheckSingleMode(true);
- int32_t pos = stream->Position();
-
int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
int32_t fieldPos = FindField(fieldId);
@@ -283,8 +281,6 @@ namespace ignite
CheckRawMode(false);
CheckSingleMode(true);
- int32_t pos = stream->Position();
-
int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
int32_t fieldPos = FindField(fieldId);
@@ -347,26 +343,17 @@ namespace ignite
int8_t hdr = stream->ReadInt8();
if (hdr == IGNITE_TYPE_STRING) {
- bool utf8Mode = stream->ReadBool();
int32_t realLen = stream->ReadInt32();
if (res && len >= realLen) {
- if (utf8Mode)
- {
- for (int i = 0; i < realLen; i++)
- *(res + i) = static_cast<char>(stream->ReadInt8());
- }
- else
- {
- for (int i = 0; i < realLen; i++)
- *(res + i) = static_cast<char>(stream->ReadUInt16());
- }
+ for (int i = 0; i < realLen; i++)
+ *(res + i) = static_cast<char>(stream->ReadInt8());
if (len > realLen)
*(res + realLen) = 0; // Set NULL terminator if possible.
}
else
- stream->Position(stream->Position() - 6);
+ stream->Position(stream->Position() - 4 - 1);
return realLen;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/platforms/cpp/core/src/impl/portable/portable_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/portable/portable_utils.cpp b/modules/platforms/cpp/core/src/impl/portable/portable_utils.cpp
index 2f9c259..f65abd0 100644
--- a/modules/platforms/cpp/core/src/impl/portable/portable_utils.cpp
+++ b/modules/platforms/cpp/core/src/impl/portable/portable_utils.cpp
@@ -203,11 +203,8 @@ namespace ignite
void PortableUtils::WriteString(interop::InteropOutputStream* stream, const char* val, const int32_t len)
{
- stream->WriteBool(false);
stream->WriteInt32(len);
-
- for (int i = 0; i < len; i++)
- stream->WriteUInt16(*(val + i));
+ stream->WriteInt8Array(reinterpret_cast<const int8_t*>(val), len);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/platforms/cpp/core/src/impl/portable/portable_writer_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/portable/portable_writer_impl.cpp b/modules/platforms/cpp/core/src/impl/portable/portable_writer_impl.cpp
index 2dac125..f398f04 100644
--- a/modules/platforms/cpp/core/src/impl/portable/portable_writer_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/portable/portable_writer_impl.cpp
@@ -298,16 +298,11 @@ namespace ignite
if (val)
{
stream->WriteInt8(IGNITE_TYPE_STRING);
- stream->WriteBool(false);
- stream->WriteInt32(len);
- for (int i = 0; i < len; i++)
- stream->WriteUInt16(*(val + i));
+ PortableUtils::WriteString(stream, val, len);
}
else
- {
stream->WriteInt8(IGNITE_HDR_NULL);
- }
}
int32_t PortableWriterImpl::WriteStringArray()
http://git-wip-us.apache.org/repos/asf/ignite/blob/80be22b5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
index 1255ae3..773ec23 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
@@ -650,8 +650,6 @@ namespace Apache.Ignite.Core.Impl.Portable
*/
public static unsafe void WriteString(string val, IPortableStream stream)
{
- stream.WriteBool(true);
-
int charCnt = val.Length;
fixed (char* chars = val)
@@ -671,16 +669,9 @@ namespace Apache.Ignite.Core.Impl.Portable
*/
public static string ReadString(IPortableStream stream)
{
- if (stream.ReadBool())
- {
- byte[] bytes = ReadByteArray(stream);
-
- return bytes != null ? Utf8.GetString(bytes) : null;
- }
-
- char[] chars = ReadCharArray(stream);
+ byte[] bytes = ReadByteArray(stream);
- return new string(chars);
+ return bytes != null ? Utf8.GetString(bytes) : null;
}
/**