Currently it is required to include share/compat.h before inclusion of share/win_utf8_io.h. That's because of print_console() declaration: its 3rd argument have type 'uint32_t' which is defined in share/compat.h. So share/win_utf8_io.h depends on share/compat.h which in turn includes share/win_utf8_io.h. Not a problem but it's a bit ugly imho. Actually, the 3rd argument of print_console() is always "wcslen(wout)", and return type of wcslen() is size_t. So maybe it's better to change the declaration of print_console() to this -- int print_console(FILE *stream, const wchar_t *text, size_t len); It will also allow to remove #include "share/compat.h" line from win_utf8_io.c.
lvqcl wrote:> Currently it is required to include share/compat.h before inclusion > of share/win_utf8_io.h. That's because of print_console() declaration: > its 3rd argument have type 'uint32_t' which is defined in share/compat.h. > > So share/win_utf8_io.h depends on share/compat.h which in turn > includes share/win_utf8_io.h. Not a problem but it's a bit ugly imho. > > Actually, the 3rd argument of print_console() is always "wcslen(wout)", > and return type of wcslen() is size_t. So maybe it's better to change > the declaration of print_console() to this -- > > int print_console(FILE *stream, const wchar_t *text, size_t len); > > It will also allow to remove > > #include "share/compat.h" > > line from win_utf8_io.c.Comments?.. A patch that slightly simplifies win_utf8_io is attached. -------------- next part -------------- A non-text attachment was scrubbed... Name: win_utf_io.patch Type: application/octet-stream Size: 1491 bytes Desc: not available Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20140920/db5cb989/attachment.obj
Erik de Castro Lopo
2014-Sep-20 21:48 UTC
[flac-dev] [PATCH] win_utf8_io, print_console and uint32_t
lvqcl wrote:> Comments?.. A patch that slightly simplifies win_utf8_io is attached.I like it. Applied. Thanks. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/