Huw Davies : gdi32: Use alloc_gdi_path() to create the path.

Alexandre Julliard julliard at winehq.org
Fri Jul 15 09:07:05 CDT 2016


Module: wine
Branch: master
Commit: 23751e0ac23eefb032fc0ac71d4dbdb78bacb6f3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=23751e0ac23eefb032fc0ac71d4dbdb78bacb6f3

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Jul 14 14:28:12 2016 +0100

gdi32: Use alloc_gdi_path() to create the path.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/path.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index 34d717f..86c1699 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -136,24 +136,13 @@ static struct gdi_path *alloc_gdi_path( int count )
 
 static struct gdi_path *copy_gdi_path( const struct gdi_path *src_path )
 {
-    struct gdi_path *path = HeapAlloc( GetProcessHeap(), 0, sizeof(*path) );
+    struct gdi_path *path = alloc_gdi_path( src_path->count );
 
-    if (!path)
-    {
-        SetLastError( ERROR_NOT_ENOUGH_MEMORY );
-        return NULL;
-    }
-    path->count = path->allocated = src_path->count;
+    if (!path) return NULL;
+
+    path->count = src_path->count;
     path->newStroke = src_path->newStroke;
     path->pos = src_path->pos;
-    path->points = HeapAlloc( GetProcessHeap(), 0, path->count * sizeof(*path->points) );
-    path->flags = HeapAlloc( GetProcessHeap(), 0, path->count * sizeof(*path->flags) );
-    if (!path->points || !path->flags)
-    {
-        free_gdi_path( path );
-        SetLastError( ERROR_NOT_ENOUGH_MEMORY );
-        return NULL;
-    }
     memcpy( path->points, src_path->points, path->count * sizeof(*path->points) );
     memcpy( path->flags, src_path->flags, path->count * sizeof(*path->flags) );
     return path;




More information about the wine-cvs mailing list