Fix load/save after https://codereview.scilab.org/#/c/15681/. 98/15698/2
Vincent COUVERT [Fri, 12 Dec 2014 15:54:12 +0000 (16:54 +0100)]
Also fix version for auto_ticks reading (introduced in 5.5.0 so to be read in version is higher than 5.4.0.1).

To test: test_run("fileio","bug_4339")

Change-Id: I30621dcedc8ccbf529ed71ee5698f25ca44c36fd

scilab/modules/fileio/macros/%_listvarinfile.sci
scilab/modules/graphics/macros/%h_load.sci
scilab/modules/graphics/macros/%h_save.sci

index 66a8684..d352606 100644 (file)
@@ -447,8 +447,11 @@ function totalSize = getSingleHandleInfo(fd, totalSize)
             end
         end
 
-        if is_higher_than([3 0 0 0]) then
+        if is_higher_than([5 4 0 1]) then
             totalSize = seekBoolMatrix(fd, totalSize); // auto_ticks
+        end
+
+        if is_higher_than([3 0 0 0]) then
 
             //x_ticks
             [totalSize, ticksX] = readShort(fd, totalSize); // ticks count
@@ -513,7 +516,11 @@ function totalSize = getSingleHandleInfo(fd, totalSize)
             totalSize = seekStringCount(fd, 2, totalSize); // log_flags
         end
 
-        totalSize = seekBool(fd, totalSize); // tight_limits
+        if is_higher_than([5 5 0 0]) then // tight_limits
+            totalSize = seekBoolMatrix(fd, totalSize);
+        else
+            totalSize = seekBool(fd, totalSize);
+        end
         [totalSize, bounds] = readBool(fd, totalSize); // data_bounds count
         totalSize = seekDoubleCount(fd, bounds, totalSize); // data_bounds
 
index 7500f5e..97904ab 100644 (file)
@@ -326,9 +326,11 @@ function [h,immediate_drawing] = load_graphichandle(fd)
         end
 
 
+        if is_higher_than([5 4 0 1]) then
+            auto_ticks=toggle(mget(mget(1,characterFormat,fd),characterFormat,fd)); // auto_ticks
+        end
 
         if is_higher_than([3 0 0 0]) then
-            auto_ticks=toggle(mget(mget(1,characterFormat,fd),characterFormat,fd)); // auto_ticks
 
             ticks=["ticks","locations","labels"]
             sz=mget(1,"sl",fd) // x_ticks.locations
@@ -396,8 +398,13 @@ function [h,immediate_drawing] = load_graphichandle(fd)
             log_flags= ascii(mget(2,characterFormat,fd));
         end
 
-
-        set(a,"tight_limits"         , toggle(mget(1,characterFormat,fd))) // tight_limits
+        // tight_limits
+        if is_higher_than([5 5 0 0]) then
+            tight_limits=toggle(mget(mget(1,characterFormat,fd),characterFormat,fd));
+        else
+            tight_limits=toggle(mget(1,characterFormat,fd));
+        end
+        set(a,"tight_limits",tight_limits);
         data_bounds = matrix(mget(mget(1,characterFormat,fd),"dl",fd),2,-1) // data_bounds
 
 
index e909c85..f2cb05b 100644 (file)
@@ -10,7 +10,7 @@
 
 
 function %h_save(h,fd)
-    version=[5 5 0 0]
+    version=[5 5 2 0]
     mput(version,"uc",fd)
 
     // There are issues when saving characters with 'c' format
@@ -216,7 +216,8 @@ function save_graphichandle(h,fd)
         mput(bool2s(h.cube_scaling=="on"),characterFormat,fd) // cube_scaling
         mput(h.rotation_angles,"dl",fd) // rotation_angles
         mput(ascii(h.log_flags),characterFormat,fd) // log_flags
-        mput(bool2s(h.tight_limits=="on"),characterFormat,fd) // tight_limits
+        mput(size(h.tight_limits,"*"),characterFormat,fd); // tight_limits
+        mput(bool2s(h.tight_limits=="on"),characterFormat,fd);
         mput(size(h.data_bounds,"*"),characterFormat,fd); // data_bounds
         mput(h.data_bounds,"dl",fd);
         mput(size(h.zoom_box,"*"),characterFormat,fd);  // zoom_box