From a1ffe5d5698b9044578005e53a79cfedbfcbc9d0 Mon Sep 17 00:00:00 2001 From: Mark Brand <mabrand at mabrand.nl> Date: Mon, 11 Jun 2012 12:38:33 +0200 Subject: [PATCH] fix building for WIN32 8c255fb185d5651b57380b0a9443001e8051b29d moved some code out of switch but did not declare ''buffer''. Also, replacing the "break" with "goto bail" neglected the WIN32 specific code. --- src/fcxml.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fcxml.c b/src/fcxml.c index 5201b3c..be1a555 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -1850,6 +1850,9 @@ FcParseDir (FcConfigParse *parse) { const FcChar8 *attr, *data; FcChar8 *prefix = NULL; +#ifdef _WIN32 + FcChar8 buffer[1000]; +#endif attr = FcConfigGetAttribute (parse, "prefix"); if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0) @@ -1886,7 +1889,7 @@ FcParseDir (FcConfigParse *parse) if (!GetModuleFileName (NULL, buffer, sizeof (buffer) - 20)) { FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed"); - break; + goto bail; } /* * Must use the multi-byte aware function to search @@ -1905,7 +1908,7 @@ FcParseDir (FcConfigParse *parse) if (!GetModuleFileName (NULL, buffer, sizeof (buffer) - 20)) { FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed"); - break; + goto bail; } p = _mbsrchr (data, ''\\''); if (p) *p = ''\0''; @@ -1919,7 +1922,7 @@ FcParseDir (FcConfigParse *parse) if (rc == 0 || rc > sizeof (buffer) - 20) { FcConfigMessage (parse, FcSevereError, "GetSystemWindowsDirectory failed"); - break; + goto bail; } if (data [strlen (data) - 1] != ''\\'') strcat (data, "\\"); -- 1.7.10.3
Thanks for catching this up. fixed. On Mon, Jun 11, 2012 at 8:00 PM, Mark Brand <mabrand at mabrand.nl> wrote:> From a1ffe5d5698b9044578005e53a79cfedbfcbc9d0 Mon Sep 17 00:00:00 2001 > From: Mark Brand <mabrand at mabrand.nl> > Date: Mon, 11 Jun 2012 12:38:33 +0200 > Subject: [PATCH] fix building for WIN32 > > 8c255fb185d5651b57380b0a9443001e8051b29d moved some code out of switch > but did not declare ''buffer''. Also, replacing the "break" with > "goto bail" neglected the WIN32 specific code. > --- > ?src/fcxml.c | ? ?9 ++++++--- > ?1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/src/fcxml.c b/src/fcxml.c > index 5201b3c..be1a555 100644 > --- a/src/fcxml.c > +++ b/src/fcxml.c > @@ -1850,6 +1850,9 @@ FcParseDir (FcConfigParse *parse) > ?{ > ? ? const FcChar8 *attr, *data; > ? ? FcChar8 *prefix = NULL; > +#ifdef _WIN32 > + ? ?FcChar8 ? ? ? ? buffer[1000]; > +#endif > > ? ? attr = FcConfigGetAttribute (parse, "prefix"); > ? ? if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0) > @@ -1886,7 +1889,7 @@ FcParseDir (FcConfigParse *parse) > ? ? if (!GetModuleFileName (NULL, buffer, sizeof (buffer) - 20)) > ? ? { > ? ? ? ? FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed"); > - ? ? ? ?break; > + ? ? ? ?goto bail; > ? ? } > ? ? /* > ? ? ?* Must use the multi-byte aware function to search > @@ -1905,7 +1908,7 @@ FcParseDir (FcConfigParse *parse) > ? ? if (!GetModuleFileName (NULL, buffer, sizeof (buffer) - 20)) > ? ? { > ? ? ? ? FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed"); > - ? ? ? ?break; > + ? ? ? ?goto bail; > ? ? } > ? ? p = _mbsrchr (data, ''\\''); > ? ? if (p) *p = ''\0''; > @@ -1919,7 +1922,7 @@ FcParseDir (FcConfigParse *parse) > ? ? if (rc == 0 || rc > sizeof (buffer) - 20) > ? ? { > ? ? ? ? FcConfigMessage (parse, FcSevereError, "GetSystemWindowsDirectory > failed"); > - ? ? ? ?break; > + ? ? ? ?goto bail; > ? ? } > ? ? if (data [strlen (data) - 1] != ''\\'') > ? ? ? ? strcat (data, "\\"); > -- > 1.7.10.3 > > > > _______________________________________________ > Fontconfig mailing list > Fontconfig at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/fontconfig >-- Akira TAGOH
On Mon, 11 Jun 2012, Akira TAGOH wrote:> Thanks for catching this up. fixed.you can test win32 compilation with cross compilation on linux using mingw-w64. You can even compile 32 and 64 bits, and maybe testing with wine. Some scripts can automatize all that. If you want, i can give you my scripts for setting up mingw-w64 Vincent Torri> > On Mon, Jun 11, 2012 at 8:00 PM, Mark Brand <mabrand at mabrand.nl> wrote: >> From a1ffe5d5698b9044578005e53a79cfedbfcbc9d0 Mon Sep 17 00:00:00 2001 >> From: Mark Brand <mabrand at mabrand.nl> >> Date: Mon, 11 Jun 2012 12:38:33 +0200 >> Subject: [PATCH] fix building for WIN32 >> >> 8c255fb185d5651b57380b0a9443001e8051b29d moved some code out of switch >> but did not declare ''buffer''. Also, replacing the "break" with >> "goto bail" neglected the WIN32 specific code. >> --- >> ?src/fcxml.c | ? ?9 ++++++--- >> ?1 file changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/src/fcxml.c b/src/fcxml.c >> index 5201b3c..be1a555 100644 >> --- a/src/fcxml.c >> +++ b/src/fcxml.c >> @@ -1850,6 +1850,9 @@ FcParseDir (FcConfigParse *parse) >> ?{ >> ? ? const FcChar8 *attr, *data; >> ? ? FcChar8 *prefix = NULL; >> +#ifdef _WIN32 >> + ? ?FcChar8 ? ? ? ? buffer[1000]; >> +#endif >> >> ? ? attr = FcConfigGetAttribute (parse, "prefix"); >> ? ? if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0) >> @@ -1886,7 +1889,7 @@ FcParseDir (FcConfigParse *parse) >> ? ? if (!GetModuleFileName (NULL, buffer, sizeof (buffer) - 20)) >> ? ? { >> ? ? ? ? FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed"); >> - ? ? ? ?break; >> + ? ? ? ?goto bail; >> ? ? } >> ? ? /* >> ? ? ?* Must use the multi-byte aware function to search >> @@ -1905,7 +1908,7 @@ FcParseDir (FcConfigParse *parse) >> ? ? if (!GetModuleFileName (NULL, buffer, sizeof (buffer) - 20)) >> ? ? { >> ? ? ? ? FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed"); >> - ? ? ? ?break; >> + ? ? ? ?goto bail; >> ? ? } >> ? ? p = _mbsrchr (data, ''\\''); >> ? ? if (p) *p = ''\0''; >> @@ -1919,7 +1922,7 @@ FcParseDir (FcConfigParse *parse) >> ? ? if (rc == 0 || rc > sizeof (buffer) - 20) >> ? ? { >> ? ? ? ? FcConfigMessage (parse, FcSevereError, "GetSystemWindowsDirectory >> failed"); >> - ? ? ? ?break; >> + ? ? ? ?goto bail; >> ? ? } >> ? ? if (data [strlen (data) - 1] != ''\\'') >> ? ? ? ? strcat (data, "\\"); >> -- >> 1.7.10.3 >> >> >> >> _______________________________________________ >> Fontconfig mailing list >> Fontconfig at lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/fontconfig >> > > > > -- > Akira TAGOH > _______________________________________________ > Fontconfig mailing list > Fontconfig at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/fontconfig > >
On Mon, Jun 11, 2012 at 8:28 PM, Vincent Torri <vtorri at univ-evry.fr> wrote:> > > On Mon, 11 Jun 2012, Akira TAGOH wrote: > >> Thanks for catching this up. fixed. > > > you can test win32 compilation with cross compilation on linux using > mingw-w64. You can even compile 32 and 64 bits, and maybe testing with wine. > Some scripts can automatize all that. If you want, i can give you my scripts > for setting up mingw-w64Sure. though it''s quite difficult to test on all of platforms. I''ll try hard to avoid breakage as much as possible though, any volunteers are always welcome :) -- Akira TAGOH