gdiplus: Assign to structs instead of using memcpy

Andrew Talbot andrew.talbot at talbotville.com
Fri Feb 29 09:55:06 CST 2008


Changelog:
    gdiplus: Assign to structs instead of using memcpy.

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 7d2e14a..be60843 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -95,7 +95,7 @@ GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics,
     if(!font || !graphics || !lfw)
         return InvalidParameter;
 
-    memcpy(lfw, &font->lfw, sizeof(LOGFONTW));
+    *lfw = font->lfw;
 
     return Ok;
 }
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 123da48..23fcfde 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -1397,7 +1397,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
      * width, angle). */
     SelectObject(graphics->hdc, CreateFontIndirectW(&font->lfw));
     GetTextMetricsW(graphics->hdc, &textmet);
-    memcpy(&lfw, &font->lfw, sizeof(LOGFONTW));
+    lfw = font->lfw;
 
     lfw.lfHeight = roundr(((REAL)lfw.lfHeight) * rel_height);
     lfw.lfWidth = roundr(textmet.tmAveCharWidth * rel_width);
@@ -1782,7 +1782,7 @@ GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix
     if(!graphics || !matrix)
         return InvalidParameter;
 
-    memcpy(matrix, graphics->worldtrans, sizeof(GpMatrix));
+    *matrix = *graphics->worldtrans;
     return Ok;
 }
 
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 2a2d96c..69a9526 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -281,7 +281,7 @@ GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clone)
     *clone = GdipAlloc(sizeof(GpPath));
     if(!*clone) return OutOfMemory;
 
-    memcpy(*clone, path, sizeof(GpPath));
+    **clone = *path;
 
     (*clone)->pathdata.Points = GdipAlloc(path->datalen * sizeof(PointF));
     (*clone)->pathdata.Types = GdipAlloc(path->datalen);
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 0fe7dfe..0e37798 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -441,7 +441,7 @@ GpStatus WINGDIPAPI GdipGetImageBounds(GpImage *image, GpRectF *srcRect,
     if(!image || !srcRect || !srcUnit)
         return InvalidParameter;
     if(image->type == ImageTypeMetafile){
-        memcpy(srcRect, &((GpMetafile*)image)->bounds, sizeof(GpRectF));
+        *srcRect = ((GpMetafile*)image)->bounds;
         *srcUnit = ((GpMetafile*)image)->unit;
     }
     else if(image->type == ImageTypeBitmap){
diff --git a/dlls/gdiplus/matrix.c b/dlls/gdiplus/matrix.c
index e6be418..2ee4458 100644
--- a/dlls/gdiplus/matrix.c
+++ b/dlls/gdiplus/matrix.c
@@ -97,7 +97,7 @@ GpStatus WINGDIPAPI GdipCloneMatrix(GpMatrix *matrix, GpMatrix **clone)
     *clone = GdipAlloc(sizeof(GpMatrix));
     if(!*clone)    return OutOfMemory;
 
-    memcpy(*clone, matrix, sizeof(GpMatrix));
+    **clone = *matrix;
 
     return Ok;
 }
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 97fc99d..7a692e3 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -75,7 +75,7 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
     *clonepen = GdipAlloc(sizeof(GpPen));
     if(!*clonepen)  return OutOfMemory;
 
-    memcpy(*clonepen, pen, sizeof(GpPen));
+    **clonepen = *pen;
 
     GdipCloneCustomLineCap(pen->customstart, &(*clonepen)->customstart);
     GdipCloneCustomLineCap(pen->customend, &(*clonepen)->customend);



More information about the wine-patches mailing list