MacArthur, Ian (SELEX GALILEO, UK) wrote:

> All,
> 
> Following Albrecht testing my patch with winNT yesterday, I pushed the
> revised patch into 1.3.x svn last night.
> 
> However, I've been going around testing it on various different WinXX
> machines here this morning (i.e. not the ones I have at home!) and on
> some compilers (but not all!) the patched file fails to compile.
> 
> It's a very simple error, but I can't push the fix into svn from here
> due to the vagaries of our firewall. If someone else can fix it...
> 
> Here's the details:
> 
> In file fl_font_win32.cxx, at line 234, I have:
> 
>   if(!fl_GetGlyphIndices) goto exit_error; // No GetGlyphIndices
> function, use fallback mechanism instead
> 
>   // now convert the string to WCHAR and measure it
>   unsigned len = fl_utf8toUtf16(c, n, ext_buff, wc_len);
> 
> 
> The problem is line 237, the "unsigned len" declaration is potentially
> crossed by the preceeding goto (line 234) so some compilers don't like
> that (setting aside whether I should be using goto or not anyway...)
> 
> The fix would be to change line 237 to just:
> 
>    len = fl_utf8toUtf16(c, n, ext_buff, wc_len);
> 
> And add a separate defintion of "len" at line 228;
> 
>    unsigned len = 0;
> 
> 
> Sorry... (again!)

I'll apply the following patch shortly (compiled okay on my cygwin box with gcc 
3.4.4).

Index: src/fl_font_win32.cxx
===================================================================
--- src/fl_font_win32.cxx       (revision 6534)
+++ src/fl_font_win32.cxx       (working copy)
@@ -225,6 +225,7 @@
    GLYPHMETRICS metrics;
    int maxw = 0, maxh = 0, dh;
    int minx = 0, miny = -999999;
+  unsigned len = 0;

    // Have we loaded the GetGlyphIndicesW function yet?
    if (have_loaded_GetGlyphIndices == 0) {
@@ -234,7 +235,7 @@
    if(!fl_GetGlyphIndices) goto exit_error; // No GetGlyphIndices function, 
use 
fallback mechanism instead

    // now convert the string to WCHAR and measure it
-  unsigned len = fl_utf8toUtf16(c, n, ext_buff, wc_len);
+  len = fl_utf8toUtf16(c, n, ext_buff, wc_len);
    if(len >= wc_len) {
      if(ext_buff) {delete [] ext_buff;}
      if(gi) {delete [] gi;}

Albrecht
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to