summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Delamarre <cedric.delamarre@scilab-enterprises.com>2016-10-21 17:47:58 +0200
committerAntoine ELIAS <antoine.elias@scilab-enterprises.com>2016-11-04 15:10:36 +0100
commitb6b336a96976e87a6e79dd2e292ef6e7336197b0 (patch)
treec462b63ae5902cbf2f9fea419c75fbc2c89245f4
parent24209523b46350cd9b9f0b37b63a97a47d1d9d27 (diff)
downloadscilab-b6b336a96976e87a6e79dd2e292ef6e7336197b0.zip
scilab-b6b336a96976e87a6e79dd2e292ef6e7336197b0.tar.gz
[bug_14775] bad error management in load function
test_run hdf5 bug_14775 Change-Id: Ibdeec0665823c583a55c17850bb7ec8fdc6d19ab
-rw-r--r--scilab/CHANGES.md3
-rw-r--r--scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_load.cpp8
-rw-r--r--scilab/modules/hdf5/tests/nonreg_tests/bug_14775.dia.ref21
-rw-r--r--scilab/modules/hdf5/tests/nonreg_tests/bug_14775.tst23
4 files changed, 50 insertions, 5 deletions
diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md
index 243ffb8..39973f7 100644
--- a/scilab/CHANGES.md
+++ b/scilab/CHANGES.md
@@ -309,7 +309,6 @@ the [development mailing list](dev@lists.scilab.org) for a particular toolbox.
309Bug Fixes 309Bug Fixes
310--------- 310---------
311 311
312<<<<<<< HEAD
313### Bugs fixed in 6.0.0: 312### Bugs fixed in 6.0.0:
314* [#2919](http://bugzilla.scilab.org/show_bug.cgi?id=2919): The `fchamp` example and demo were unclear and badly rendered 313* [#2919](http://bugzilla.scilab.org/show_bug.cgi?id=2919): The `fchamp` example and demo were unclear and badly rendered
315* [#4327](http://bugzilla.scilab.org/show_bug.cgi?id=4327): Overloading did not support custom types names longer than 8 characters 314* [#4327](http://bugzilla.scilab.org/show_bug.cgi?id=4327): Overloading did not support custom types names longer than 8 characters
@@ -380,6 +379,8 @@ Bug Fixes
380* [#14714](http://bugzilla.scilab.org/show_bug.cgi?id=14714): Crash/Leak when deleting datatip 379* [#14714](http://bugzilla.scilab.org/show_bug.cgi?id=14714): Crash/Leak when deleting datatip
381* [#14784](http://bugzilla.scilab.org/show_bug.cgi?id=14784): Setting field of graphics handle using children($) failed. 380* [#14784](http://bugzilla.scilab.org/show_bug.cgi?id=14784): Setting field of graphics handle using children($) failed.
382* [#14796](http://bugzilla.scilab.org/show_bug.cgi?id=14796): `ind2sub(dims, [])` returns [] in version 6. Warnings due to a `[]+1` operation have been removed. 381* [#14796](http://bugzilla.scilab.org/show_bug.cgi?id=14796): `ind2sub(dims, [])` returns [] in version 6. Warnings due to a `[]+1` operation have been removed.
382* [#14775](http://bugzilla.scilab.org/show_bug.cgi?id=14775): load empty (0 bytes) .sod File crashes scilab
383* [#14808](http://bugzilla.scilab.org/show_bug.cgi?id=14808): E=[ 'A' 'B' 'C' 'D' 'E'] , E(0:0) Crash Scilab Console
383* [#14821](http://bugzilla.scilab.org/show_bug.cgi?id=14821): `getio`function has been added. An error on the diary file opened has been corrected. 384* [#14821](http://bugzilla.scilab.org/show_bug.cgi?id=14821): `getio`function has been added. An error on the diary file opened has been corrected.
384 385
385### Bugs fixed in 6.0.0 beta-2 and earlier 6.0.0 pre-releases: 386### Bugs fixed in 6.0.0 beta-2 and earlier 6.0.0 pre-releases:
diff --git a/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_load.cpp b/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_load.cpp
index 282f3db..925ddc7 100644
--- a/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_load.cpp
+++ b/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_load.cpp
@@ -72,14 +72,14 @@ types::Function::ReturnValue sci_hdf5_load(types::typed_list &in, int _iRetCount
72 72
73 switch (err) 73 switch (err)
74 { 74 {
75 case 1: 75 case 0:
76 Scierror(999, _("%s: %s is not a valid lib file.\n"), fname.data(), filename.data()); 76 break;
77 return types::Function::Error;
78 case 2: 77 case 2:
79 Scierror(999, "%s: %s", fname.data(), _("Redefining permanent variable.\n")); 78 Scierror(999, "%s: %s", fname.data(), _("Redefining permanent variable.\n"));
80 return types::Function::Error; 79 return types::Function::Error;
81 default: 80 default:
82 break; 81 Scierror(999, _("%s: %s is not a valid lib file.\n"), fname.data(), filename.data());
82 return types::Function::Error;
83 } 83 }
84 84
85 lib->killMe(); 85 lib->killMe();
diff --git a/scilab/modules/hdf5/tests/nonreg_tests/bug_14775.dia.ref b/scilab/modules/hdf5/tests/nonreg_tests/bug_14775.dia.ref
new file mode 100644
index 0000000..66d3aa2
--- /dev/null
+++ b/scilab/modules/hdf5/tests/nonreg_tests/bug_14775.dia.ref
@@ -0,0 +1,21 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2016 - Scilab Enterprises - Cedric Delamarre
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7//
8// <-- Non-regression test for bug 14775 -->
9//
10// <-- CLI SHELL MODE -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/14775
14//
15// <-- Short Description -->
16//
17// load empty (0 bytes) .sod File crashes scilab
18f = TMPDIR + filesep() + "empty.sod";
19mputl("",f);
20refMsg = msprintf(_("%s: %s is not a valid lib file.\n"), "load", f);
21assert_checkerror("load(f)", refMsg);
diff --git a/scilab/modules/hdf5/tests/nonreg_tests/bug_14775.tst b/scilab/modules/hdf5/tests/nonreg_tests/bug_14775.tst
new file mode 100644
index 0000000..995129c
--- /dev/null
+++ b/scilab/modules/hdf5/tests/nonreg_tests/bug_14775.tst
@@ -0,0 +1,23 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2016 - Scilab Enterprises - Cedric Delamarre
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7//
8// <-- Non-regression test for bug 14775 -->
9//
10// <-- CLI SHELL MODE -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/14775
14//
15// <-- Short Description -->
16//
17// load empty (0 bytes) .sod File crashes scilab
18
19
20f = TMPDIR + filesep() + "empty.sod";
21mputl("",f);
22refMsg = msprintf(_("%s: %s is not a valid lib file.\n"), "load", f);
23assert_checkerror("load(f)", refMsg);