From 65ea2594be544746ba8998f934df6b38d4a263fc Mon Sep 17 00:00:00 2001 From: Calixte DENIZET Date: Wed, 12 Mar 2014 13:19:14 +0100 Subject: [PATCH] Bug 13271 fixed: plot2d with logscale and %nan value freezed scilab Change-Id: Ie8f8fdd99db920727265355a4380dc458f2fd13e --- scilab/CHANGES_5.5.X | 2 ++ scilab/modules/graphics/src/c/BasicAlgos.c | 15 +++++++++++---- .../graphics/tests/nonreg_tests/bug_13271.dia.ref | 15 +++++++++++++++ .../graphics/tests/nonreg_tests/bug_13271.tst | 18 ++++++++++++++++++ 4 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 scilab/modules/graphics/tests/nonreg_tests/bug_13271.dia.ref create mode 100644 scilab/modules/graphics/tests/nonreg_tests/bug_13271.tst diff --git a/scilab/CHANGES_5.5.X b/scilab/CHANGES_5.5.X index c8be27c..c6fc994 100644 --- a/scilab/CHANGES_5.5.X +++ b/scilab/CHANGES_5.5.X @@ -758,6 +758,8 @@ Scilab Bug Fixes * Bug #13258 fixed - Bad number display in datatips fixed. +* Bug #13271 fixed - plot2d with logarithmic scale and %nan value freezed Scilab. + Xcos Bug Fixes ============== diff --git a/scilab/modules/graphics/src/c/BasicAlgos.c b/scilab/modules/graphics/src/c/BasicAlgos.c index 9d4a5e4..a358e7a 100644 --- a/scilab/modules/graphics/src/c/BasicAlgos.c +++ b/scilab/modules/graphics/src/c/BasicAlgos.c @@ -24,17 +24,24 @@ /*------------------------------------------------------------------------*/ double sciFindStPosMin(const double x[], int n) { - double min = 0.; + double min = -1.0; int i = 0; if (n <= 0) { - return -1.0; + return min; } - min = x[0]; + for (i = 0; i < n; i++) + { + if (x[i] > 0) + { + min = x[i]; + break; + } + } - for (i = 1 ; i < n ; i++) + for (; i < n ; i++) { if (x[i] > 0.0 && x[i] < min) { diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_13271.dia.ref b/scilab/modules/graphics/tests/nonreg_tests/bug_13271.dia.ref new file mode 100644 index 0000000..19d5a68 --- /dev/null +++ b/scilab/modules/graphics/tests/nonreg_tests/bug_13271.dia.ref @@ -0,0 +1,15 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- TEST WITH GRAPHIC --> +// <-- Non-regression test for bug 13213 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13213 +// +// <-- Short Description --> +// plot2d with logscale and %nan value freezed scilab +plot2d("nl", [1:2], [%nan;1]); diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_13271.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_13271.tst new file mode 100644 index 0000000..9051b0f --- /dev/null +++ b/scilab/modules/graphics/tests/nonreg_tests/bug_13271.tst @@ -0,0 +1,18 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- TEST WITH GRAPHIC --> + +// <-- Non-regression test for bug 13213 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13213 +// +// <-- Short Description --> +// plot2d with logscale and %nan value freezed scilab + +plot2d("nl", [1:2], [%nan;1]); \ No newline at end of file -- 1.7.9.5