summaryrefslogtreecommitdiffstats
path: root/scilab/modules/output_stream
diff options
context:
space:
mode:
authorAllan CORNET <allan.cornet@scilab.org>2010-02-26 11:07:57 +0100
committerAllan CORNET <allan.cornet@scilab.org>2010-02-26 11:07:57 +0100
commitef60fc91b0aa2ba3a412d1950c8f7b7b0e3da251 (patch)
treec0cfff4062814c0a96223d9db386b88ded6ca08f /scilab/modules/output_stream
parentd2bb99e0caf40618c2b97f7dbd4cbadc9480d981 (diff)
downloadscilab-ef60fc91b0aa2ba3a412d1950c8f7b7b0e3da251.zip
scilab-ef60fc91b0aa2ba3a412d1950c8f7b7b0e3da251.tar.gz
bug 6682
Diffstat (limited to 'scilab/modules/output_stream')
-rw-r--r--scilab/modules/output_stream/src/c/do_xxprintf.c15
-rw-r--r--scilab/modules/output_stream/tests/nonreg_tests/bug_6682.dia.ref27
-rw-r--r--scilab/modules/output_stream/tests/nonreg_tests/bug_6682.tst30
3 files changed, 70 insertions, 2 deletions
diff --git a/scilab/modules/output_stream/src/c/do_xxprintf.c b/scilab/modules/output_stream/src/c/do_xxprintf.c
index 1094e76..398d26d 100644
--- a/scilab/modules/output_stream/src/c/do_xxprintf.c
+++ b/scilab/modules/output_stream/src/c/do_xxprintf.c
@@ -446,8 +446,19 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
446 break; 446 break;
447 447
448 case 'o': 448 case 'o':
449 Scierror(998,_("%s: An error occurred: %s\n"),fname,_("'o' format not allowed.")); 449 {
450 return RET_BUG; 450 rval = GetScalarDouble(fname, &prev, &arg_count, nargs, &ccount, lcount, &dval);
451 if (rval <= 0)
452 {
453 if (rval== NOT_ENOUGH_ARGS)
454 {
455 error_on_rval(xxprintf, flush, target);
456 return RET_BUG;
457 }
458 return rval;
459 }
460 conversion_type = PF_D;
461 }
451 break; 462 break;
452 463
453 default: 464 default:
diff --git a/scilab/modules/output_stream/tests/nonreg_tests/bug_6682.dia.ref b/scilab/modules/output_stream/tests/nonreg_tests/bug_6682.dia.ref
new file mode 100644
index 0000000..9314b05
--- /dev/null
+++ b/scilab/modules/output_stream/tests/nonreg_tests/bug_6682.dia.ref
@@ -0,0 +1,27 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Allan CORNET
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- JVM NOT MANDATORY -->
8// <-- Non-regression test for bug 6682 -->
9//
10// <-- Short Description -->
11// printf functions do not manage octal %o format
12//
13// <-- Bugzilla URL -->
14// http://bugzilla.scilab.org/show_bug.cgi?id=6682
15//
16printf('%o',8);
1710mprintf('%o',8);
1810fprintf(6,'%o',8);
1910
20r = msprintf('%o',8);
21if r <> dec2oct(8) then bugmes();quit;end
22r = msprintf('%10o',80);
23if r <> ' 120' then bugmes();quit;end
24for i = 1:1000
25 r = msprintf('%o',i);
26 if r <> dec2oct(i) then bugmes();quit;end
27end
diff --git a/scilab/modules/output_stream/tests/nonreg_tests/bug_6682.tst b/scilab/modules/output_stream/tests/nonreg_tests/bug_6682.tst
new file mode 100644
index 0000000..e753111
--- /dev/null
+++ b/scilab/modules/output_stream/tests/nonreg_tests/bug_6682.tst
@@ -0,0 +1,30 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Allan CORNET
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- JVM NOT MANDATORY -->
8
9// <-- Non-regression test for bug 6682 -->
10//
11// <-- Short Description -->
12// printf functions do not manage octal %o format
13//
14// <-- Bugzilla URL -->
15// http://bugzilla.scilab.org/show_bug.cgi?id=6682
16//
17
18printf('%o',8);
19mprintf('%o',8);
20fprintf(6,'%o',8);
21r = msprintf('%o',8);
22if r <> dec2oct(8) then pause,end
23
24r = msprintf('%10o',80);
25if r <> ' 120' then pause,end
26
27for i = 1:1000
28 r = msprintf('%o',i);
29 if r <> dec2oct(i) then pause,end
30end