JonY
2013-Mar-18 09:35 UTC
[flac-dev] Patch to add Unicode filename support for win32 flac
On 3/18/2013 14:55, Erik de Castro Lopo wrote:> Brian Willoughby wrote: > >> I believe that shell does handle wildcards on all Unix variants, >> including OSX. > > Yes. > >> Since Windows does not handle them, I suggest that the >> main flac code not be littered with code that's not necessary on the >> primary platforms. > > No, the flac code will not be "littered with code that's not necessary > on the primary platforms". > > There will be some windows specific code in a new file, a bunch of > replacements of existing fopen() calls with flac_fopen() (similarly > for chmod and utime) and the main function for the flac and metaflac > executables will have an additional: > > #ifdef _WIN32 > if (!convert_argv_to_utf8(&argc, &argv)) > flac__utils_printf(stderr, 1, "ERROR: yada yada\n"); > #endif > > This is a small un-obtrusive change that I fully support. > > I would however like to see it sooner rather than later so we can get > this damn thing released :-). >Before anyone does anything, see __wgetmainargs <http://msdn.microsoft.com/en-us/library/ff770599.aspx>. It can expand wildcards. Since it already provides argc/argv/env, it is more a less a drop-in replacement for the main() arguments. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 834 bytes Desc: OpenPGP digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20130318/45ccab4e/attachment-0001.pgp
Erik de Castro Lopo
2013-Mar-18 10:25 UTC
[flac-dev] Patch to add Unicode filename support for win32 flac
JonY wrote:> Before anyone does anything, see __wgetmainargs > <http://msdn.microsoft.com/en-us/library/ff770599.aspx>. > > It can expand wildcards. Since it already provides argc/argv/env, it is > more a less a drop-in replacement for the main() arguments.+1 Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Janne Hyvärinen
2013-Mar-18 11:21 UTC
[flac-dev] Patch to add Unicode filename support for win32 flac
On 18.3.2013 11:35, JonY wrote:> Before anyone does anything, see __wgetmainargs > <http://msdn.microsoft.com/en-us/library/ff770599.aspx>. > > It can expand wildcards. Since it already provides argc/argv/env, it is > more a less a drop-in replacement for the main() arguments.MSVC also comes with http://msdn.microsoft.com/en-us/library/8bch7bkk%28v=vs.80%29.aspx. To support unicode with these methods would require somewhat more #ifdef code in main. We'd need to change project files to define Unicode character set and turn main into _wmain and char *argv to wchar_t *argv. Also these are MSVC's internal features, if I'm not mistaken. Other compilers on Windows would then require different solutions. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20130318/1dbded5f/attachment.htm
JonY
2013-Mar-18 11:28 UTC
[flac-dev] Patch to add Unicode filename support for win32 flac
On 3/18/2013 19:21, Janne Hyv?rinen wrote:> On 18.3.2013 11:35, JonY wrote: >> Before anyone does anything, see __wgetmainargs >> <http://msdn.microsoft.com/en-us/library/ff770599.aspx>. >> >> It can expand wildcards. Since it already provides argc/argv/env, it is >> more a less a drop-in replacement for the main() arguments. > > MSVC also comes with > http://msdn.microsoft.com/en-us/library/8bch7bkk%28v=vs.80%29.aspx. To > support unicode with these methods would require somewhat more #ifdef > code in main. We'd need to change project files to define Unicode > character set and turn main into _wmain and char *argv to wchar_t *argv. > Also these are MSVC's internal features, if I'm not mistaken. Other > compilers on Windows would then require different solutions. >For setargv.obj, it is equivalent to doing "int _dowildcard = 1;" in any linked object on mingw. For wmain, regular mingw does not support it, but mingw-w64 does. The issue is that the former is far more common in the wild. I still prefer the __wgetmainargs approach, the exact same code can be used for both mingw and msvc. We don't need to care about 9x, I think. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 834 bytes Desc: OpenPGP digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20130318/78e83b41/attachment.pgp
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 18.03.2013 13:35, JonY wrote:> Before anyone does anything, see __wgetmainargs > <http://msdn.microsoft.com/en-us/library/ff770599.aspx>. > > It can expand wildcards. Since it already provides argc/argv/env, > it is more a less a drop-in replacement for the main() arguments.I can't find its version info. MSDN only documents it as far as VS2010 (normal C functions are documented as far as VS2003), and it's not present in any header file i have. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJRRvvBAAoJEOs4Jb6SI2CwkX8IALcXD6FV5G8Mdg6G0ORajgbj tveYgs7d7FUKZSB8zo9L4GmodfzqacnxYnAbl6G+5+6zMgb5MjBbJPV5Z5LvCFrI OPk067seyK3ZY2YZuv6RFwOn3V0e4y1WnCa4h0eep1gkRuhIO5QXFeqtRVucys4E U5Xcp61JcheAhIJf8dLvUn/C7DkZFTtrdoJnRxyzNSqQoOyGSb+aocIP/LADapFJ QSqjSfXak4s6IGSro9lod9l6Au4/L1LxD6rS6JlNS+Yuy/tzJtsL6ANe4ULSFoVz W8iZ9wMgHAK982GdyGJO76UmCe8p5N4KLUjPnOItLZDYvZxSHN/AkGY0xaK9388=cgor -----END PGP SIGNATURE-----
JonY
2013-Mar-18 13:17 UTC
[flac-dev] Patch to add Unicode filename support for win32 flac
On 3/18/2013 19:34, LRN wrote:> On 18.03.2013 13:35, JonY wrote: >> Before anyone does anything, see __wgetmainargs >> <http://msdn.microsoft.com/en-us/library/ff770599.aspx>. > >> It can expand wildcards. Since it already provides argc/argv/env, >> it is more a less a drop-in replacement for the main() arguments. > I can't find its version info. MSDN only documents it as far as VS2010 > (normal C functions are documented as far as VS2003), and it's not > present in any header file i have.I don't think it is, you probably required to declare it yourself. The symbol is in the MSVCRXX runtime dll, all the way from MSVCRT.dll to MSVC2012 MSVCR110. Suffice to say it is always there. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 834 bytes Desc: OpenPGP digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20130318/0d1aa890/attachment.pgp
Janne Hyvärinen
2013-Mar-19 11:59 UTC
[flac-dev] Patch to add Unicode filename support for win32 flac
On 18.3.2013 12:25, Erik de Castro Lopo wrote:> JonY wrote: > >> Before anyone does anything, see __wgetmainargs >> <http://msdn.microsoft.com/en-us/library/ff770599.aspx>. >> >> It can expand wildcards. Since it already provides argc/argv/env, it is >> more a less a drop-in replacement for the main() arguments. > +1 > > ErikAlright, here's a patch utilizing this function. There's a lot of changes here. Project files have a new configuration called "Release (UTF8)", intended to be used when building the command line tools. This project has the required UTF-8 define in place so all libraries expect things in encoded format. Regular Debug and Release configurations do not use any new tricks so existing projects won't break when compiled with those settings. I'm at work and couldn't do extensive testing, but command line FLAC.exe seems to perform everything right with this. Metaflac probably requires some minor tweaks but I wanted to show some progress so that 1.3 doesn't slip out the door while I'm busy. -------------- next part -------------- A non-text attachment was scrubbed... Name: utf8_io.zip Type: application/x-zip-compressed Size: 16598 bytes Desc: not available Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20130319/b6a01e17/attachment-0001.bin