2004-05-03 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* libc/stdio/vfprintf.c (_VFPRINTF_R): Set error flag when
        multibyte functions return failure for %C, %S, %lc, and %ls
        format specifiers.
			
			
This commit is contained in:
		| @@ -1,3 +1,9 @@ | |||||||
|  | 2004-05-03  Artem B. Bityuckiy  <abitytsky@softminecorp.com> | ||||||
|  |  | ||||||
|  | 	* libc/stdio/vfprintf.c (_VFPRINTF_R): Set error flag when | ||||||
|  | 	multibyte functions return failure for %C, %S, %lc, and %ls | ||||||
|  | 	format specifiers. | ||||||
|  |  | ||||||
| 2004-05-03  Artem B. Bityuckiy  <abitytsky@softminecorp.com> | 2004-05-03  Artem B. Bityuckiy  <abitytsky@softminecorp.com> | ||||||
|  |  | ||||||
| 	* testsuite/include/check.h (CHECK): Add flush of stdout. | 	* testsuite/include/check.h (CHECK): Add flush of stdout. | ||||||
|   | |||||||
| @@ -762,9 +762,11 @@ reswitch:	switch (ch) { | |||||||
| 				memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); | 				memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); | ||||||
| 				if ((size = (int)_wcrtomb_r (data, cp,  | 				if ((size = (int)_wcrtomb_r (data, cp,  | ||||||
| 				    	       (wchar_t)GET_ARG (N, ap, wint_t),  | 				    	       (wchar_t)GET_ARG (N, ap, wint_t),  | ||||||
| 					        &ps)) == -1) | 					        &ps)) == -1) { | ||||||
|  | 					fp->_flags |= __SERR; | ||||||
| 					goto error;  | 					goto error;  | ||||||
| 				} | 				} | ||||||
|  | 			} | ||||||
| 			else { | 			else { | ||||||
| 				*cp = GET_ARG (N, ap, int); | 				*cp = GET_ARG (N, ap, int); | ||||||
| 				size = 1; | 				size = 1; | ||||||
| @@ -942,8 +944,10 @@ reswitch:	switch (ch) { | |||||||
| 						if (wcp[m] == L'\0') | 						if (wcp[m] == L'\0') | ||||||
| 							break; | 							break; | ||||||
| 						if ((n = (int)_wcrtomb_r (data,  | 						if ((n = (int)_wcrtomb_r (data,  | ||||||
|                                                      buf, wcp[m], &ps)) == -1) |                                                      buf, wcp[m], &ps)) == -1) { | ||||||
|  | 							fp->_flags |= __SERR; | ||||||
| 							goto error; | 							goto error; | ||||||
|  | 						} | ||||||
| 						if (n + size > prec) | 						if (n + size > prec) | ||||||
| 							break; | 							break; | ||||||
| 						m += 1; | 						m += 1; | ||||||
| @@ -954,8 +958,10 @@ reswitch:	switch (ch) { | |||||||
| 				} | 				} | ||||||
| 				else { | 				else { | ||||||
| 					if ((size = (int)_wcsrtombs_r (data,  | 					if ((size = (int)_wcsrtombs_r (data,  | ||||||
|                                                    NULL, &wcp, 0, &ps)) == -1) |                                                    NULL, &wcp, 0, &ps)) == -1) { | ||||||
|  | 						fp->_flags |= __SERR; | ||||||
| 						goto error; | 						goto error; | ||||||
|  | 					} | ||||||
| 					wcp = (_CONST wchar_t *)cp; | 					wcp = (_CONST wchar_t *)cp; | ||||||
| 				} | 				} | ||||||
|   |   | ||||||
| @@ -963,14 +969,18 @@ reswitch:	switch (ch) { | |||||||
| 					break; | 					break; | ||||||
|   |   | ||||||
| 				if ((malloc_buf =  | 				if ((malloc_buf =  | ||||||
| 				    (char *)_malloc_r (data, size + 1)) == NULL) | 				    (char *)_malloc_r (data, size + 1)) == NULL) { | ||||||
|  | 					fp->_flags |= __SERR; | ||||||
| 					goto error; | 					goto error; | ||||||
|  | 				} | ||||||
|                               |                               | ||||||
| 				/* Convert widechar string to multibyte string. */ | 				/* Convert widechar string to multibyte string. */ | ||||||
| 				memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); | 				memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); | ||||||
| 				if (_wcsrtombs_r (data, malloc_buf,  | 				if (_wcsrtombs_r (data, malloc_buf,  | ||||||
|                                                  &wcp, size, &ps) != size) |                                                  &wcp, size, &ps) != size) { | ||||||
|  | 					fp->_flags |= __SERR; | ||||||
| 					goto error; | 					goto error; | ||||||
|  | 				} | ||||||
| 				cp = malloc_buf; | 				cp = malloc_buf; | ||||||
| 				cp[size] = '\0'; | 				cp[size] = '\0'; | ||||||
| 			} | 			} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user