]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Backported StreamingTransferableGraphFileReader 69d8f2b1 changes 33/2033/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sun, 26 Aug 2018 13:03:47 +0000 (16:03 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sun, 26 Aug 2018 13:03:47 +0000 (16:03 +0300)
These changes add support for reading identities in TG files that have
names longer than 127 characters.

This was first fixed in release/1.34.0 and this backports the changes to
release/1.32.0.2.

gitlab #33

Change-Id: Ie78804976457e1bff86842a09d5d76c727df514a

bundles/org.simantics.graph.db/src/org/simantics/graph/db/StreamingTransferableGraphFileReader.java

index 86c3d2fcbb18c51bae4e8bfefbdcd7928de57611..f8fbb021e0f99bd72f62721d3afb74b955fe3f96 100644 (file)
@@ -229,7 +229,7 @@ final public class StreamingTransferableGraphFileReader extends ByteFileReader {
                                if(type == 1) {
                                        
                                        int parent = safeInt();
-                                       int nameLen = bytes[byteIndex++]&0xff;
+                                       int nameLen = getDynamicUInt32();
                                        
                                        if(byteIndex+nameLen < SIZE) {
                                                procedure.execute(new Identity(rid, new External(parent, utf(bytes, byteIndex, byteIndex + nameLen))));
@@ -243,7 +243,7 @@ final public class StreamingTransferableGraphFileReader extends ByteFileReader {
                                else if(type == 3) {
                                        
                                        int parent = safeInt();
-                                       int nameLen = bytes[byteIndex++]&0xff;
+                                       int nameLen = getDynamicUInt32();
                                        if(byteIndex+nameLen < SIZE) {
                                                procedure.execute(new Identity(rid, new Internal(parent, utf(bytes, byteIndex, byteIndex + nameLen))));
                                                byteIndex += nameLen;
@@ -255,9 +255,9 @@ final public class StreamingTransferableGraphFileReader extends ByteFileReader {
                                // Root
                                else if(type == 0) {
                                        
-                                       int nameLen = bytes[byteIndex++]&0xff;
+                                       int nameLen = getDynamicUInt32();
                                        String name = utf(safeBytes(nameLen), 0, nameLen);
-                                       int nameLen2 = bytes[byteIndex++]&0xff;
+                                       int nameLen2 = getDynamicUInt32();
                                        String rType = utf(safeBytes(nameLen2), 0, nameLen2);
                                        procedure.execute(new Identity(rid, new Root(name, rType)));