ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [20/20] ignite git commit: IGNITE-1651: Fixed CPP.
Date Wed, 21 Oct 2015 14:50:12 GMT
IGNITE-1651: Fixed CPP.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4f823644
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4f823644
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4f823644

Branch: refs/heads/ignite-1651
Commit: 4f823644053e372485296276e4bb34de7ac369a6
Parents: 5069a21
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Oct 21 17:49:59 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Oct 21 17:49:59 2015 +0300

----------------------------------------------------------------------
 .../src/portable_reader_writer_test.cpp         | 119 ++++++++++---------
 .../ignite/impl/portable/portable_common.h      |  11 +-
 .../ignite/impl/portable/portable_reader_impl.h |  36 ++++--
 .../ignite/impl/portable/portable_writer_impl.h |   5 +-
 4 files changed, 97 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4f823644/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp b/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp
index aff929b..7f7f779 100644
--- a/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp
+++ b/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp
@@ -41,7 +41,7 @@ void CheckPrimitive(T val)
     InteropUnpooledMemory mem(1024);
 
     InteropOutputStream out(&mem);
-    out.Position(18);
+    out.Position(19);
 
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
@@ -63,7 +63,7 @@ void CheckPrimitive(T val)
 
     InteropInputStream in(&mem);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
100, 100);
     PortableReader reader(&readerImpl);
@@ -101,7 +101,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
100, 100);
     PortableReader reader(&readerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     try
     {
@@ -125,17 +125,17 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
     out.Synchronize();
     in.Synchronize();
     
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 0) == -1);
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 2) == -1);
 
     T arr1[2];
     arr1[0] = dflt;
     arr1[1] = dflt;
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 1) == -1);
 
     BOOST_REQUIRE(arr1[0] == dflt);
@@ -146,68 +146,68 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
     arr2[0] = val1;
     arr2[1] = val2;
 
-    out.Position(18);
+    out.Position(19);
     
     WriteArray<T>(writer, fieldName, arr2, 0);
 
     out.Synchronize();
     in.Synchronize();
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 0) == 0);
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 2) == 0);
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 0) == 0);
     BOOST_REQUIRE(arr1[0] == dflt);
     BOOST_REQUIRE(arr1[1] == dflt);
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 2) == 0);
     BOOST_REQUIRE(arr1[0] == dflt);
     BOOST_REQUIRE(arr1[1] == dflt);
 
     // 3. Partial array write.
-    out.Position(18);
+    out.Position(19);
     
     WriteArray<T>(writer, fieldName, arr2, 1);
 
     out.Synchronize();
     in.Synchronize();
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 0) == 1);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 2) == 1);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 0) == 1);
     BOOST_REQUIRE(arr1[0] == dflt);
     BOOST_REQUIRE(arr1[1] == dflt);
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 1) == 1);
     BOOST_REQUIRE(arr1[0] == val1);
     BOOST_REQUIRE(arr1[1] == dflt);
     arr1[0] = dflt;
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 2) == 1);
     BOOST_REQUIRE(arr1[0] == val1);
     BOOST_REQUIRE(arr1[1] == dflt);
     arr1[0] = dflt;
 
     // 4. Full array write.
-    out.Position(18);
+    out.Position(19);
     
     WriteArray<T>(writer, fieldName, arr2, 2);
 
     out.Synchronize();
     in.Synchronize();
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 0) == 2);
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 2) == 2);
 
     try
@@ -410,7 +410,7 @@ void CheckCollectionEmpty(CollectionType* colType)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     PortableCollectionWriter<PortableInner> colWriter = colType ?
         writer.WriteCollection<PortableInner>("field1", *colType) : writer.WriteCollection<PortableInner>("field1");
@@ -449,7 +449,7 @@ void CheckCollectionEmpty(CollectionType* colType)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableCollectionReader<PortableInner> colReader = reader.ReadCollection<PortableInner>("field1");
 
@@ -490,7 +490,7 @@ void CheckCollection(CollectionType* colType)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     PortableCollectionWriter<PortableInner> colWriter = colType ?
         writer.WriteCollection<PortableInner>("field1", *colType) : writer.WriteCollection<PortableInner>("field1");
@@ -533,7 +533,7 @@ void CheckCollection(CollectionType* colType)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableCollectionReader<PortableInner> colReader = reader.ReadCollection<PortableInner>("field1");
 
@@ -582,7 +582,7 @@ void CheckMapEmpty(MapType* mapType)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     PortableMapWriter<int8_t, PortableInner> mapWriter = mapType ?
         writer.WriteMap<int8_t, PortableInner>("field1", *mapType) : writer.WriteMap<int8_t,
PortableInner>("field1");
@@ -621,7 +621,7 @@ void CheckMapEmpty(MapType* mapType)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableMapReader<int8_t, PortableInner> mapReader = reader.ReadMap<int8_t,
PortableInner>("field1");
 
@@ -665,7 +665,7 @@ void CheckMap(MapType* mapType)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     PortableMapWriter<int8_t, PortableInner> mapWriter = mapType ?
         writer.WriteMap<int8_t, PortableInner>("field1", *mapType) : writer.WriteMap<int8_t,
PortableInner>("field1");
@@ -708,7 +708,7 @@ void CheckMap(MapType* mapType)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableMapReader<int8_t, PortableInner> mapReader = reader.ReadMap<int8_t,
PortableInner>("field1");
 
@@ -863,7 +863,7 @@ BOOST_AUTO_TEST_CASE(TestGuidNull)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     try
     {
@@ -884,7 +884,7 @@ BOOST_AUTO_TEST_CASE(TestGuidNull)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
100, 100);
     PortableReader reader(&readerImpl);
     
-    in.Position(18);
+    in.Position(19);
 
     try
     {
@@ -912,7 +912,7 @@ BOOST_AUTO_TEST_CASE(TestString) {
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     const char* writeVal1 = "testtest";
     const char* writeVal2 = "test";
@@ -963,7 +963,7 @@ BOOST_AUTO_TEST_CASE(TestString) {
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     try
     {
@@ -1024,7 +1024,7 @@ BOOST_AUTO_TEST_CASE(TestStringArrayNull)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     writer.WriteNull("field1");
     writer.WriteInt8("field2", 1);
@@ -1035,7 +1035,7 @@ BOOST_AUTO_TEST_CASE(TestStringArrayNull)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableStringArrayReader arrReader = reader.ReadStringArray("field1");
 
@@ -1080,7 +1080,7 @@ BOOST_AUTO_TEST_CASE(TestStringArrayEmpty)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     PortableStringArrayWriter arrWriter = writer.WriteStringArray("field1");
     
@@ -1146,7 +1146,7 @@ BOOST_AUTO_TEST_CASE(TestStringArrayEmpty)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableStringArrayReader arrReader = reader.ReadStringArray("field1");
 
@@ -1195,7 +1195,7 @@ BOOST_AUTO_TEST_CASE(TestStringArray)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     PortableStringArrayWriter arrWriter = writer.WriteStringArray("field1");
 
@@ -1267,7 +1267,7 @@ BOOST_AUTO_TEST_CASE(TestStringArray)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableStringArrayReader arrReader = reader.ReadStringArray("field1");
 
@@ -1363,7 +1363,7 @@ BOOST_AUTO_TEST_CASE(TestObject)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     writer.WriteObject("field1", writeVal1);
     writer.WriteObject("field2", writeVal2);
@@ -1375,7 +1375,7 @@ BOOST_AUTO_TEST_CASE(TestObject)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableInner readVal1 = reader.ReadObject<PortableInner>("field1");
     BOOST_REQUIRE(writeVal1.GetValue() == readVal1.GetValue());
@@ -1400,7 +1400,7 @@ BOOST_AUTO_TEST_CASE(TestNestedObject)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     writer.WriteObject("field1", writeVal1);
     writer.WriteObject("field2", writeVal2);
@@ -1412,7 +1412,7 @@ BOOST_AUTO_TEST_CASE(TestNestedObject)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableOuter readVal1 = reader.ReadObject<PortableOuter>("field1");
     BOOST_REQUIRE(writeVal1.GetValue() == readVal1.GetValue());
@@ -1437,7 +1437,7 @@ BOOST_AUTO_TEST_CASE(TestArrayNull)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     writer.WriteNull("field1");
     writer.WriteInt8("field2", 1);
@@ -1448,7 +1448,7 @@ BOOST_AUTO_TEST_CASE(TestArrayNull)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableArrayReader<PortableInner> arrReader = reader.ReadArray<PortableInner>("field1");
 
@@ -1480,7 +1480,7 @@ BOOST_AUTO_TEST_CASE(TestArrayEmpty)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     PortableArrayWriter<PortableInner> arrWriter = writer.WriteArray<PortableInner>("field1");
 
@@ -1518,7 +1518,7 @@ BOOST_AUTO_TEST_CASE(TestArrayEmpty)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableArrayReader<PortableInner> arrReader = reader.ReadArray<PortableInner>("field1");
 
@@ -1554,7 +1554,7 @@ BOOST_AUTO_TEST_CASE(TestArray)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     PortableArrayWriter<PortableInner> arrWriter = writer.WriteArray<PortableInner>("field1");
 
@@ -1596,7 +1596,7 @@ BOOST_AUTO_TEST_CASE(TestArray)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableArrayReader<PortableInner> arrReader = reader.ReadArray<PortableInner>("field1");
 
@@ -1640,7 +1640,7 @@ BOOST_AUTO_TEST_CASE(TestCollectionNull)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     writer.WriteNull("field1");
     writer.WriteInt8("field2", 1);
@@ -1651,7 +1651,7 @@ BOOST_AUTO_TEST_CASE(TestCollectionNull)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableCollectionReader<PortableInner> colReader = reader.ReadCollection<PortableInner>("field1");
 
@@ -1708,7 +1708,7 @@ BOOST_AUTO_TEST_CASE(TestMapNull)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     writer.WriteNull("field1");
     writer.WriteInt8("field2", 1);
@@ -1719,7 +1719,7 @@ BOOST_AUTO_TEST_CASE(TestMapNull)
     PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 1000);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableMapReader<int8_t, PortableInner> mapReader = reader.ReadMap<int8_t,
PortableInner>("field1");
 
@@ -1779,7 +1779,7 @@ BOOST_AUTO_TEST_CASE(TestRawMode)
     PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
     PortableWriter writer(&writerImpl);
 
-    out.Position(18);
+    out.Position(19);
 
     PortableRawWriter rawWriter = writer.RawWriter();
 
@@ -1801,10 +1801,10 @@ BOOST_AUTO_TEST_CASE(TestRawMode)
     out.Synchronize();
 
     InteropInputStream in(&mem);
-    PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 18);
+    PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0,
1000, 19);
     PortableReader reader(&readerImpl);
 
-    in.Position(18);
+    in.Position(19);
 
     PortableRawReader rawReader = reader.RawReader();
 
@@ -1843,6 +1843,7 @@ BOOST_AUTO_TEST_CASE(TestFieldSeek)
 
     int32_t pos = in.Position();
     in.ReadInt8(); // We do not need a header here.
+    in.ReadInt8(); // We do not need proto ver here.
     bool usrType = in.ReadBool();
     int32_t typeId = in.ReadInt32();
     int32_t hashCode = in.ReadInt32();
@@ -1859,34 +1860,34 @@ BOOST_AUTO_TEST_CASE(TestFieldSeek)
     BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
 
     // 2. Counter closkwise.
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
     BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
     BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
     BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
 
     // 3. Same field twice.
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
     BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
     BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
     
     // 4. Read missing field in between.
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
     BOOST_REQUIRE(reader.ReadInt32("missing") == 0);
     BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
 
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
     BOOST_REQUIRE(reader.ReadInt32("missing") == 0);
     BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
 
     // 5. Invalid field type.
-    in.Position(18);
+    in.Position(19);
     BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
 
     try

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f823644/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h
b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h
index 622cb54..9efaa28 100644
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h
@@ -35,8 +35,17 @@ namespace ignite
             /** Header: fulle form. */
             const int8_t IGNITE_HDR_FULL = 103;
 
+            /** Portable protocol version.  */
+            const int8_t IGNITE_PROTO_VER = 1;
+
             /** Full header length. */
-            const int32_t IGNITE_FULL_HDR_LEN = 18;
+            const int32_t IGNITE_FULL_HDR_LEN = 19;
+
+            /** Header offset: length. */
+            const int32_t IGNITE_OFFSET_LEN = 11;
+
+            /** Header offset: raw offset. */
+            const int32_t IGNITE_OFFSET_RAW = 15;
 
             /** Type: object. */
             const int8_t IGNITE_TYPE_OBJECT = IGNITE_HDR_FULL;

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f823644/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
index 7d82aa2..2d4729f 100644
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
@@ -657,22 +657,34 @@ namespace ignite
                     }
                     else
                     {
-                        bool usrType = stream->ReadBool();
-                        int32_t typeId = stream->ReadInt32();
-                        int32_t hashCode = stream->ReadInt32();
-                        int32_t len = stream->ReadInt32();
-                        int32_t rawOff = stream->ReadInt32();
+                        if (hdr != IGNITE_HDR_FULL) {
+                            IGNITE_ERROR_2(ignite::IgniteError::IGNITE_ERR_PORTABLE, "Unexpected
header during deserialization: ", hdr);
+                        }
+                        else {
+                            int8_t protoVer = stream->ReadInt8();
 
-                        ignite::portable::PortableType<T> type;
-                        TemplatedPortableIdResolver<T> idRslvr(type);
-                        PortableReaderImpl readerImpl(stream, &idRslvr, pos, usrType,
typeId, hashCode, len, rawOff);
-                        ignite::portable::PortableReader reader(&readerImpl);
+                            if (protoVer != IGNITE_PROTO_VER) {
+                                IGNITE_ERROR_2(ignite::IgniteError::IGNITE_ERR_PORTABLE,
"Unsupported portable protocol version: ", protoVer);
+                            }
+                            else {
+                                bool usrType = stream->ReadBool();
+                                int32_t typeId = stream->ReadInt32();
+                                int32_t hashCode = stream->ReadInt32();
+                                int32_t len = stream->ReadInt32();
+                                int32_t rawOff = stream->ReadInt32();
 
-                        T val = type.Read(reader);
+                                ignite::portable::PortableType<T> type;
+                                TemplatedPortableIdResolver<T> idRslvr(type);
+                                PortableReaderImpl readerImpl(stream, &idRslvr, pos,
usrType, typeId, hashCode, len, rawOff);
+                                ignite::portable::PortableReader reader(&readerImpl);
 
-                        stream->Position(pos + len);
+                                T val = type.Read(reader);
 
-                        return val;
+                                stream->Position(pos + len);
+
+                                return val;
+                            }
+                        }
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f823644/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_writer_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_writer_impl.h
b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_writer_impl.h
index b38dc1f..1d80d2e 100644
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_writer_impl.h
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_writer_impl.h
@@ -574,6 +574,7 @@ namespace ignite
                         int32_t pos = stream->Position();
 
                         stream->WriteInt8(IGNITE_HDR_FULL);
+                        stream->WriteInt8(IGNITE_PROTO_VER);
                         stream->WriteBool(true);
                         stream->WriteInt32(idRslvr.GetTypeId());
                         stream->WriteInt32(type.GetHashCode(obj));
@@ -584,8 +585,8 @@ namespace ignite
 
                         int32_t len = stream->Position() - pos;
 
-                        stream->WriteInt32(pos + 10, len);
-                        stream->WriteInt32(pos + 14, writerImpl.GetRawPosition() - pos);
+                        stream->WriteInt32(pos + IGNITE_OFFSET_LEN, len);
+                        stream->WriteInt32(pos + IGNITE_OFFSET_RAW, writerImpl.GetRawPosition()
- pos);
 
                         if (metaMgr)
                             metaMgr->SubmitHandler(type.GetTypeName(), idRslvr.GetTypeId(),
metaHnd.Get());


Mime
View raw message