-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 18.03.2013 02:37, Erik de Castro Lopo wrote: > JonY wrote: >> On 3/17/2013 23:01, LRN wrote: >>>> All those ifdefs will at least be confined rather than spread >>>> out through the code. >>> I did it plibc-style: >>> >>> in compat.h: #if defined(_WIN32) #define FOPEN >>> grabbag__fopen_utf8_wrapper #else #define FOPEN fopen #endif >>> >>> in grabbag: #if defined(_WIN32) <implement >>> grabbag__fopen_utf8_wrapper, which has the same signature as >>> fopen, but does utf8->utf16 conversion internally, then calls >>> wfopen> #endif >>> >>> and replace "fopen" with "FOPEN" everywhere else. >> >> Don't do that, it leaks into the system headers and breaks mingw >> if FLAC_USE_FOPEN_UTF8 is defined. >> >> Call the wrappers directly instead of using a macro. > > +1 > > Yep, I prefer not to have too much #ifdef hackery. > > In my recent replacement of all the sprintf/_snprintf stuff, I > relaced all the calls with a call to flac_snprintf() and localised > #ifdef hackery to the implementation of that function. > > From a patch cleanliness POV, I like to see the new functionality > added in one patch and a separate patch to change all the old > function usage to the new function usage. For example, in commit > 06af237c I added the new flac_snprintf() function and in commit > 3c84f9e8 I replaced all the old calls to sprintf/_snprintf. /me shrugs Sure, that'll work too.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJRRnSAAAoJEOs4Jb6SI2CwPmoIAIM2pFUjl+TNDnPkDCBkLWPy zf58O5s8R+2S1uNfpd8fQrheZKdK8kSitJj9XYGELo+POyn8pJGEBjYvZyqVls88 gAHaE5wWgV5aSYmHcwQD8aXCB2LP9Lkpk01rvt6lZ9grw15nWUyhmiPd3uyQYwOD ZGrqAS661d4XoSP5N0hi86mUf9NcM6xXacDY+leRnSNowIrtbnCR0vhQJoHMpY7U fWB6dM4YEgZmCbj6he9ZHbXemlMiK+rRkoEsPPcAobGCIga6I0il6j/3JxI8bKCl VF+4Iz0APw22/+ck6K+tfde/9JGraZT2HsYm2PNAcPiuZPmvP0oTvQrGLkRJzr0= =GIQw -----END PGP SIGNATURE----- _______________________________________________ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev