* mingwex/wcrtomb.c (wcrtomb_cp): Test (wc > 255) only if C locale.
Use supplied codepage as arg to WideCharToMultiByte.
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | 2006-05-17  Danny Smith  <dannysmith@users.sourceforge.net> | ||||||
|  |  | ||||||
|  | 	* mingwex/wcrtomb.c (wcrtomb_cp): Test (wc > 255) only if C locale. | ||||||
|  | 	Use supplied codepage as arg to WideCharToMultiByte.  | ||||||
|  |  | ||||||
| 2006-02-13  Earnie Boyd  <earnie@users.sf.net> | 2006-02-13  Earnie Boyd  <earnie@users.sf.net> | ||||||
|  |  | ||||||
| 	* Makefile.in (libmsvcr80.a): Add import lib. | 	* Makefile.in (libmsvcr80.a): Add import lib. | ||||||
|   | |||||||
| @@ -10,15 +10,14 @@ | |||||||
| static int __MINGW_ATTRIB_NONNULL(1) | static int __MINGW_ATTRIB_NONNULL(1) | ||||||
|  __wcrtomb_cp (char *dst, wchar_t wc, const unsigned int cp, |  __wcrtomb_cp (char *dst, wchar_t wc, const unsigned int cp, | ||||||
| 	       const unsigned int mb_max) | 	       const unsigned int mb_max) | ||||||
|  | {        | ||||||
|  |   if (cp == 0) | ||||||
|     { |     { | ||||||
|       if (wc > 255) |       if (wc > 255) | ||||||
| 	{ | 	{ | ||||||
| 	  errno = EILSEQ; | 	  errno = EILSEQ; | ||||||
| 	  return -1; | 	  return -1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   if (cp == 0) |  | ||||||
|     { |  | ||||||
|       *dst = (char) wc; |       *dst = (char) wc; | ||||||
|       return 1; |       return 1; | ||||||
|     } |     } | ||||||
| @@ -26,8 +25,7 @@ static int __MINGW_ATTRIB_NONNULL(1) | |||||||
|     { |     { | ||||||
|       int invalid_char = 0; |       int invalid_char = 0; | ||||||
|     |     | ||||||
|       int size = WideCharToMultiByte(get_cp_from_locale(), |       int size = WideCharToMultiByte (cp, 0 /* Is this correct flag? */, | ||||||
| 				     0 /* Is this correct flag? */, |  | ||||||
| 				      &wc, 1, dst, mb_max, | 				      &wc, 1, dst, mb_max, | ||||||
| 				      NULL, &invalid_char); | 				      NULL, &invalid_char); | ||||||
|       if (size == 0 || invalid_char)   |       if (size == 0 || invalid_char)   | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user