summaryrefslogtreecommitdiffstats
path: root/scilab/modules/output_stream
diff options
context:
space:
mode:
authorAllan CORNET <allan.cornet@scilab.org>2010-03-30 15:21:27 +0200
committerAllan CORNET <allan.cornet@scilab.org>2010-03-30 15:21:27 +0200
commit9af46627fddfbfa81a5fecf8170513a20d6051ef (patch)
tree4d0e445a174c4ad2cd8c0dd9475ddeeb667640f4 /scilab/modules/output_stream
parent524268009c88cf819941238ecb91de9186c50706 (diff)
parentbd357c6b354abd25848b2a60738a04431eb7a508 (diff)
downloadscilab-9af46627fddfbfa81a5fecf8170513a20d6051ef.zip
scilab-9af46627fddfbfa81a5fecf8170513a20d6051ef.tar.gz
Merge remote branch 'refs/remotes/origin/5.2'
Diffstat (limited to 'scilab/modules/output_stream')
-rw-r--r--scilab/modules/output_stream/src/c/msgs.c22
-rw-r--r--scilab/modules/output_stream/tests/nonreg_tests/bug_6728.dia.ref37
-rw-r--r--scilab/modules/output_stream/tests/nonreg_tests/bug_6728.tst45
3 files changed, 100 insertions, 4 deletions
diff --git a/scilab/modules/output_stream/src/c/msgs.c b/scilab/modules/output_stream/src/c/msgs.c
index 2c26e1f..0fe261e 100644
--- a/scilab/modules/output_stream/src/c/msgs.c
+++ b/scilab/modules/output_stream/src/c/msgs.c
@@ -622,7 +622,7 @@ static int msg_13(int *n, int *ierr)
622 // Same comment as for msg_12 622 // Same comment as for msg_12
623 char localbuf[16]; 623 char localbuf[16];
624 strncpy(localbuf,BUF,15); 624 strncpy(localbuf,BUF,15);
625 localbuf[15]='\0'; 625 localbuf[15]='\0';
626 sciprint(_("at last iteration f decreases by less than %s.\n"),localbuf); 626 sciprint(_("at last iteration f decreases by less than %s.\n"),localbuf);
627 return 0; 627 return 0;
628} 628}
@@ -679,6 +679,7 @@ static int msg_22(int *n, int *ierr)
679{ 679{
680 char localbuf[5]; 680 char localbuf[5];
681 strncpy(localbuf,BUF,4); 681 strncpy(localbuf,BUF,4);
682 localbuf[4]='\0';
682 sciprint(_("sfact : uncomplete convergence relative precision reached : 10**(%s).\n"),localbuf); 683 sciprint(_("sfact : uncomplete convergence relative precision reached : 10**(%s).\n"),localbuf);
683 return 0; 684 return 0;
684} 685}
@@ -696,6 +697,7 @@ static int msg_24(int *n, int *ierr)
696 { 697 {
697 localbuf=(char*)MALLOC(sizeof(char)*(*ierr +1)); 698 localbuf=(char*)MALLOC(sizeof(char)*(*ierr +1));
698 strncpy(localbuf,BUF,*ierr); 699 strncpy(localbuf,BUF,*ierr);
700 localbuf[*ierr]='\0';
699 sciprint(_("Functions files location : %s.\n"),localbuf); 701 sciprint(_("Functions files location : %s.\n"),localbuf);
700 if (localbuf) {FREE(localbuf);localbuf=NULL;} 702 if (localbuf) {FREE(localbuf);localbuf=NULL;}
701 } 703 }
@@ -707,8 +709,9 @@ static int msg_25(int *n, int *ierr)
707 char *localbuf=NULL; 709 char *localbuf=NULL;
708 if (*ierr >0) 710 if (*ierr >0)
709 { 711 {
710 localbuf=(char*)MALLOC(sizeof(char)*(*ierr +1)); 712 localbuf=(char*)MALLOC(sizeof(char)*(*ierr + 1));
711 strncpy(localbuf,BUF,*ierr); 713 strncpy(localbuf,BUF,*ierr);
714 localbuf[*ierr] = '\0';
712 sciprint(" : %s.\n",localbuf); 715 sciprint(" : %s.\n",localbuf);
713 if (localbuf) {FREE(localbuf);localbuf=NULL;} 716 if (localbuf) {FREE(localbuf);localbuf=NULL;}
714 } 717 }
@@ -724,8 +727,8 @@ static int msg_26(int *n, int *ierr)
724static int msg_27(int *n, int *ierr) 727static int msg_27(int *n, int *ierr)
725{ 728{
726 char localbuf[nlgh+1]; 729 char localbuf[nlgh+1];
727 strncpy(localbuf,BUF,nlgh-1); 730 strncpy(localbuf,BUF,nlgh - 1);
728 localbuf[nlgh-1]='\0'; 731 localbuf[nlgh - 1]='\0';
729 sciprint(_("Breakpoints of function : %s\n"),localbuf); 732 sciprint(_("Breakpoints of function : %s\n"),localbuf);
730 return 0; 733 return 0;
731} 734}
@@ -745,6 +748,7 @@ static int msg_29(int *n, int *ierr)
745{ 748{
746 char localbuf[nlgh+1]; 749 char localbuf[nlgh+1];
747 strncpy(localbuf,BUF,nlgh); 750 strncpy(localbuf,BUF,nlgh);
751 localbuf[nlgh]='\0';
748 sciprint(_("The top %d x %d blocks may not be in generalized Schur form.\n"),localbuf); 752 sciprint(_("The top %d x %d blocks may not be in generalized Schur form.\n"),localbuf);
749 return 0; 753 return 0;
750} 754}
@@ -825,7 +829,9 @@ static int msg_37(int *n, int *ierr)
825 char localbuf2[14]; 829 char localbuf2[14];
826 830
827 strncpy(localbuf1,BUF,3); 831 strncpy(localbuf1,BUF,3);
832 localbuf1[3]='\0';
828 strncpy(localbuf2,&BUF[4],13); 833 strncpy(localbuf2,&BUF[4],13);
834 localbuf2[13]='\0';
829 sciprint(_("Rank deficient : rank = %s - tol = %s .\n"),localbuf1,localbuf2); 835 sciprint(_("Rank deficient : rank = %s - tol = %s .\n"),localbuf1,localbuf2);
830 return 0; 836 return 0;
831} 837}
@@ -842,12 +848,17 @@ static int msg_39(int *n, int *ierr)
842 char localbuf2[10]; 848 char localbuf2[10];
843 849
844 strncpy(localbuf1,BUF,9); 850 strncpy(localbuf1,BUF,9);
851 localbuf1[9]='\0';
845 strncpy(localbuf2,&BUF[10],9); 852 strncpy(localbuf2,&BUF[10],9);
853 localbuf2[9]='\0';
846 854
847 sciprint(_("Using %s elements out of %s.\n"),localbuf1,localbuf2); 855 sciprint(_("Using %s elements out of %s.\n"),localbuf1,localbuf2);
848 856
849 strncpy(localbuf1,&BUF[20],9); 857 strncpy(localbuf1,&BUF[20],9);
858 localbuf1[9]='\0';
859
850 strncpy(localbuf2,&BUF[30],9); 860 strncpy(localbuf2,&BUF[30],9);
861 localbuf2[9]='\0';
851 sciprint(_(" and %s variables out of %s.\n"),localbuf1,localbuf2); 862 sciprint(_(" and %s variables out of %s.\n"),localbuf1,localbuf2);
852 return 0; 863 return 0;
853} 864}
@@ -1078,6 +1089,7 @@ static int msg_70(int *n, int *ierr)
1078{ 1089{
1079 char localbuf[10]; 1090 char localbuf[10];
1080 strncpy(localbuf,BUF,10); 1091 strncpy(localbuf,BUF,10);
1092 localbuf[10]='\0';
1081 sciprint(_("At time: %s. Too many iteration to achieve required precision.\n"),localbuf); 1093 sciprint(_("At time: %s. Too many iteration to achieve required precision.\n"),localbuf);
1082 return 0; 1094 return 0;
1083} 1095}
@@ -1320,6 +1332,7 @@ static int msg_105(int *n, int *ierr)
1320 char *localbuf=NULL; 1332 char *localbuf=NULL;
1321 localbuf=(char*)MALLOC(sizeof(char)*(*ierr +1)); 1333 localbuf=(char*)MALLOC(sizeof(char)*(*ierr +1));
1322 strncpy(localbuf,BUF,*ierr); 1334 strncpy(localbuf,BUF,*ierr);
1335 localbuf[*ierr]='\0';
1323 sciprint(_("Unknown key <%s> ignored.\n"),localbuf); 1336 sciprint(_("Unknown key <%s> ignored.\n"),localbuf);
1324 if (localbuf) {FREE(localbuf);localbuf=NULL;} 1337 if (localbuf) {FREE(localbuf);localbuf=NULL;}
1325 return 0; 1338 return 0;
@@ -1394,6 +1407,7 @@ static int msg_default(int *n, int *ierr)
1394 int i=0; 1407 int i=0;
1395 localbuf=(char*)MALLOC(sizeof(char)*(len+1)); 1408 localbuf=(char*)MALLOC(sizeof(char)*(len+1));
1396 strncpy(localbuf,BUF,len); 1409 strncpy(localbuf,BUF,len);
1410 localbuf[len]='\0';
1397 sciprint(_("Warning:\n")); 1411 sciprint(_("Warning:\n"));
1398 for (i=0;i<len;i++) 1412 for (i=0;i<len;i++)
1399 { 1413 {
diff --git a/scilab/modules/output_stream/tests/nonreg_tests/bug_6728.dia.ref b/scilab/modules/output_stream/tests/nonreg_tests/bug_6728.dia.ref
new file mode 100644
index 0000000..64e9ea9
--- /dev/null
+++ b/scilab/modules/output_stream/tests/nonreg_tests/bug_6728.dia.ref
@@ -0,0 +1,37 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2009 - 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 6728 -->
9//
10// <-- Short Description -->
11// The function lib didn't print the same thing when it was entered several times...
12//
13// <-- Bugzilla URL -->
14// http://bugzilla.scilab.org/show_bug.cgi?id=6728
15//
16cd(TMPDIR);
17mkdir('bug_6728');
18cd('bug_6728');
19fun1 = ['function r = aaaa()';
20'disp(''aaaa'')';
21'endfunction'];
22mputl(fun1,'aaaa.sci');
23fun2 = ['function r = bbbb()';
24'disp(''bbbb'')';
25'endfunction'];
26mputl(fun2,'bbbb.sci');
27genlib('bug_6728lib','.');
28bug_6728lib = lib('.');
29strs = string(bug_6728lib);
30clear bug_6728lib
31for i=1:1000
32 bug_6728lib = lib('.');
33 strbis = string(bug_6728lib);
34 if strs <> strbis then bugmes();quit;end
35 clear bug_6728lib
36 clear strbis
37end
diff --git a/scilab/modules/output_stream/tests/nonreg_tests/bug_6728.tst b/scilab/modules/output_stream/tests/nonreg_tests/bug_6728.tst
new file mode 100644
index 0000000..c1ba908
--- /dev/null
+++ b/scilab/modules/output_stream/tests/nonreg_tests/bug_6728.tst
@@ -0,0 +1,45 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2009 - 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 6728 -->
10//
11// <-- Short Description -->
12// The function lib didn't print the same thing when it was entered several times...
13
14//
15// <-- Bugzilla URL -->
16// http://bugzilla.scilab.org/show_bug.cgi?id=6728
17//
18
19cd(TMPDIR);
20mkdir('bug_6728');
21cd('bug_6728');
22
23fun1 = ['function r = aaaa()';
24'disp(''aaaa'')';
25'endfunction'];
26mputl(fun1,'aaaa.sci');
27
28fun2 = ['function r = bbbb()';
29'disp(''bbbb'')';
30'endfunction'];
31mputl(fun2,'bbbb.sci');
32
33genlib('bug_6728lib','.');
34
35bug_6728lib = lib('.');
36strs = string(bug_6728lib);
37clear bug_6728lib
38
39for i=1:1000
40 bug_6728lib = lib('.');
41 strbis = string(bug_6728lib);
42 if strs <> strbis then pause,end
43 clear bug_6728lib
44 clear strbis
45end