From 5fbbb17e1a048d2fea97039358a0269309e5c337 Mon Sep 17 00:00:00 2001 From: Nimish Kapoor Date: Wed, 17 Jan 2018 02:32:39 +0530 Subject: [PATCH] * Bug #15018 fixed - Fileio: mfprintf '\n' not working Change-Id: I9c7d59b590a32191714ff5a9d96539550cc2c349 --- scilab/CHANGES.md | 7 ++--- scilab/modules/fileio/src/cpp/mputl.cpp | 2 +- .../fileio/tests/nonreg_tests/bug_15018.tst | 28 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 scilab/modules/fileio/tests/nonreg_tests/bug_15018.tst diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index ea4685d..605280e 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -433,7 +433,7 @@ the [development mailing list](dev@lists.scilab.org) for a particular toolbox. * [#14376](http://bugzilla.scilab.org/show_bug.cgi?id=14376): `input()` was broken: \n was introduced before prompting; multiple prompts occurred; the output value could be missing; "%" "\n" "\t" were no longer supported in messages... * [#14399](http://bugzilla.scilab.org/show_bug.cgi?id=14399): `whereami`: wrong information (line numbers). * [#14424](http://bugzilla.scilab.org/show_bug.cgi?id=14424): There were some troubles with `input`. -* [#14490](http://bugzilla.scilab.org/show_bug.cgi?id=14490): `plot2d` crashed when leg parameter was a vector. +* [#14490](http://bugzilla.scilab.org/show_bug.cgi?id=14490): `plot2d` crashed when leg parameter was a vector. * [#14531](http://bugzilla.scilab.org/show_bug.cgi?id=14531): It was not possible to specify SCIHOME as a start-up option. * [#14532](http://bugzilla.scilab.org/show_bug.cgi?id=14532): `test_run` failed for toolboxes that are not autoloaded. * [#14544](http://bugzilla.scilab.org/show_bug.cgi?id=14544): `scatter` and `scatter3` canceled any upstream `drawlater` instruction. @@ -463,6 +463,7 @@ the [development mailing list](dev@lists.scilab.org) for a particular toolbox. * [#15010](http://bugzilla.scilab.org/show_bug.cgi?id=15010): Coselica did not simulate on Scilab 6. * [#15015](http://bugzilla.scilab.org/show_bug.cgi?id=15015): Xcos blocks using the `ascii` didn't work * [#15017](http://bugzilla.scilab.org/show_bug.cgi?id=15017): On numbers, `gcd` result was always of `int32` type instead of matching the input type. +* [#15018](http://bugzilla.scilab.org/show_bug.cgi?id=15018): `mfprintf`'\n' not working. * [#15019](http://bugzilla.scilab.org/show_bug.cgi?id=15019): Add 'csci6' in the calling of ilib_build in 'Getting started with API_Scilab' help page. * [#15020](http://bugzilla.scilab.org/show_bug.cgi?id=15020): Examples of ilib_build help page updated. * [#15023](http://bugzilla.scilab.org/show_bug.cgi?id=15023): `clf()` wrongly reset `figure_id`. @@ -870,6 +871,6 @@ the [development mailing list](dev@lists.scilab.org) for a particular toolbox. * [#14524](http://bugzilla.scilab.org/show_bug.cgi?id=14524): Numeric locales were not set to standard "C" by default at scilab startup * [#14540](http://bugzilla.scilab.org/show_bug.cgi?id=14540): Datatips did not clip outside axes bounds * [#14685](http://bugzilla.scilab.org/show_bug.cgi?id=14685): datavec produced an invalid index error. -* [#14980] (http://bugzilla.scilab.org/show_bug.cgi?id=14980): The datatip display of the root locus arcs is broken. -* [#14992] (http://bugzilla.scilab.org/show_bug.cgi?id=14992): `readgateway` has been removed, use `whereis` instead. +* [#14980](http://bugzilla.scilab.org/show_bug.cgi?id=14980): The datatip display of the root locus arcs is broken. +* [#14992](http://bugzilla.scilab.org/show_bug.cgi?id=14992): `readgateway` has been removed, use `whereis` instead. diff --git a/scilab/modules/fileio/src/cpp/mputl.cpp b/scilab/modules/fileio/src/cpp/mputl.cpp index a354745..d2a4bfa 100644 --- a/scilab/modules/fileio/src/cpp/mputl.cpp +++ b/scilab/modules/fileio/src/cpp/mputl.cpp @@ -74,7 +74,7 @@ mputlError mputl(int _iFileId, wchar_t **pstStrings, int _iSizeStrings, BOOL _CR { return MPUTL_ERROR; } - if (_CR) + if ((i != _iSizeStrings-1) || _CR) { iRet = fputs("\n", pF->getFiledesc()); if (iRet == -1) diff --git a/scilab/modules/fileio/tests/nonreg_tests/bug_15018.tst b/scilab/modules/fileio/tests/nonreg_tests/bug_15018.tst new file mode 100644 index 0000000..db5f4dd --- /dev/null +++ b/scilab/modules/fileio/tests/nonreg_tests/bug_15018.tst @@ -0,0 +1,28 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2018 - Nimish Kapoor +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// <-- NO CHECK REF --> +// +// <-- Non-regression test for bug 15018 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=15018 +// +// <-- Short Description --> +// '\n' character did not work in mfprintf + +fich_optim = mopen(TMPDIR+"/suivi_optim.txt","at"); +mfprintf(fich_optim,"\n--- Résultats ---\n\nRMS = \n\nComposants :\t"); +mclose(fich_optim); + +fd = mopen(TMPDIR+"/suivi_optim.txt","r"); +line = mgetl(fd, 1); +assert_checkequal(line, ""); +line = mgetl(fd, 1); +assert_checkequal(line, "--- Résultats ---"); +mclose(fd); -- 1.7.9.5