Message72057
| Author |
henry.precheur |
| Recipients |
amaury.forgeotdarc, henry.precheur, pitrou |
| Date |
2008年08月28日.02:36:17 |
| SpamBayes Score |
2.1160851e-13 |
| Marked as misclassified |
No |
| Message-id |
<1219890981.89.0.468528483065.issue3696@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I removed my previous patch. It was not dealing with all broken mbstowcs
cases and yours is much better.
Some comments on the other patch:
I don't think the macro HAVE_BROKEN_MBSTOWCS alone is a perfect idea. It
won't fix the problem in the long run:
Most contributors won't be aware of this problem and might be using
mbstowcs without putting the #ifdef's. Then the problem will come back
and bite us again.
I would rather do something like this:
#ifdef HAVE_BROKEN_MBSTOWCS
size_t __non_broken_mbstowcs(wchar_t* pwcs, const char* s, size_t n)
{
if (pwcs == NULL)
return strlen(s);
else
return mbstowcs(pwcs, s, n);
}
#define mbstowcs __non_broken_mbstowcs
#endif
It would fix the problem everywhere, and people won't have to worry
about putting #ifdef everywhere in the future.
I attached a test program, run it on cygwin to make sure this approach
works on your side.
Another small remark; #ifdef is better then #ifndef when doing
#ifdef ...
...
#else
...
#endif
Simply because it easier to get "Be positive" than "Don't be negative".
The negative form is generally harder to get whether your are
programming, writing or talking. Use the positive form and you will have
more impact and will make things clearer. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2008年08月28日 02:36:22 | henry.precheur | set | recipients:
+ henry.precheur, amaury.forgeotdarc, pitrou |
| 2008年08月28日 02:36:21 | henry.precheur | set | messageid: <1219890981.89.0.468528483065.issue3696@psf.upfronthosting.co.za> |
| 2008年08月28日 02:36:19 | henry.precheur | link | issue3696 messages |
| 2008年08月28日 02:36:18 | henry.precheur | create |
|