[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: RESEND: Page Fault With Freetype calls fixed
From:       Rein Klazes <wijn () wanadoo ! nl>
Date:       2005-11-30 16:31:33
Message-ID: 00hro1ts1e0nk1to917926iibl9saq49nd () 4ax ! com
[Download RAW message or body]

On Tue, 29 Nov 2005 17:37:21 +0100, you wrote:

>Rein Klazes <wijn@wanadoo.nl> writes:
>
>> Not included in the new release, no comments. Is there a problem with
>> this one ?
>
>I think it would be cleaner to have WineEngGetFontData do the right
>thing directly, instead of calling it twice.

My idea was that since it is an internal function, and since this is the
only call (out of 7) that is interested in the returned count, not to
modify the function.

Here is a corrected patch.=20

Zach: reversing the old patch and testing this one would be appreciated.

Changelog:
dlls/gdi	: freetype.c
Make WineEngGetFontData always return the used byte count.

Rein.

["getfontdata_2.diff" (text/plain)]

--- wine/dlls/gdi/freetype.c	2005-11-03 09:42:20.000000000 +0100
+++ mywine/dlls/gdi/freetype.c	2005-11-30 17:02:33.000000000 +0100
@@ -3692,9 +3692,15 @@ DWORD WineEngGetFontData(GdiFont font, D
     }
 
     /* If the FT_Load_Sfnt_Table function is there we'll use it */
-    if(pFT_Load_Sfnt_Table)
+    if(pFT_Load_Sfnt_Table) {
+        /* make sure value of len is the value freetype says it needs */ 
+        if( buf && len) {
+            DWORD needed = 0;
+            err = pFT_Load_Sfnt_Table(ft_face, table, offset, NULL, &needed);
+            if( !err && needed < len) len = needed;
+        }
         err = pFT_Load_Sfnt_Table(ft_face, table, offset, buf, &len);
-    else { /* Do it the hard way */
+    } else { /* Do it the hard way */
         TT_Face tt_face = (TT_Face) ft_face;
         SFNT_Interface *sfnt;
         if (FT_Version.major==2 && FT_Version.minor==0)
@@ -3707,6 +3713,12 @@ DWORD WineEngGetFontData(GdiFont font, D
             /* A field was added in the middle of the structure in 2.1.x */
             sfnt = *(SFNT_Interface**)((char*)tt_face + 532);
         }
+        /* make sure value of len is the value freetype says it needs */ 
+        if( buf && len) {
+            DWORD needed = 0;
+            err = sfnt->load_any(tt_face, table, offset, NULL, &needed);
+            if( !err && needed < len) len = needed;
+        }
         err = sfnt->load_any(tt_face, table, offset, buf, &len);
     }
     if(err) {




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic