Commit a4e8f4dc authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

gdi32: Assign to structs instead of using memcpy.

parent f7628b69
...@@ -1220,7 +1220,7 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_ ...@@ -1220,7 +1220,7 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
TRACE("pix_h %d charset %d dpi %dx%d pt %d\n", winfnt_header.pixel_height, winfnt_header.charset, TRACE("pix_h %d charset %d dpi %dx%d pt %d\n", winfnt_header.pixel_height, winfnt_header.charset,
winfnt_header.vertical_resolution,winfnt_header.horizontal_resolution, winfnt_header.nominal_point_size); winfnt_header.vertical_resolution,winfnt_header.horizontal_resolution, winfnt_header.nominal_point_size);
if(TranslateCharsetInfo((DWORD*)(UINT_PTR)winfnt_header.charset, &csi, TCI_SRCCHARSET)) if(TranslateCharsetInfo((DWORD*)(UINT_PTR)winfnt_header.charset, &csi, TCI_SRCCHARSET))
memcpy(&fs, &csi.fs, sizeof(csi.fs)); fs = csi.fs;
internal_leading = winfnt_header.internal_leading; internal_leading = winfnt_header.internal_leading;
} }
#endif #endif
...@@ -1278,7 +1278,7 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_ ...@@ -1278,7 +1278,7 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
face->font_version = pHeader ? pHeader->Font_Revision : 0; face->font_version = pHeader ? pHeader->Font_Revision : 0;
face->family = family; face->family = family;
face->external = (flags & ADDFONT_EXTERNAL_FONT) ? TRUE : FALSE; face->external = (flags & ADDFONT_EXTERNAL_FONT) ? TRUE : FALSE;
memcpy(&face->fs, &fs, sizeof(face->fs)); face->fs = fs;
memset(&face->fs_links, 0, sizeof(face->fs_links)); memset(&face->fs_links, 0, sizeof(face->fs_links));
if(FT_IS_SCALABLE(ft_face)) { if(FT_IS_SCALABLE(ft_face)) {
...@@ -1513,7 +1513,7 @@ static BOOL init_system_links(void) ...@@ -1513,7 +1513,7 @@ static BOOL init_system_links(void)
{ {
LIST_FOR_EACH_ENTRY(face, &family->faces, Face, entry) LIST_FOR_EACH_ENTRY(face, &family->faces, Face, entry)
{ {
memcpy(&face->fs_links, &fs, sizeof(fs)); face->fs_links = fs;
} }
} }
list_add_tail(&system_links, &font_link->entry); list_add_tail(&system_links, &font_link->entry);
...@@ -2784,7 +2784,7 @@ static GdiFont *find_in_cache(HFONT hfont, LOGFONTW *plf, XFORM *pxf, BOOL can_u ...@@ -2784,7 +2784,7 @@ static GdiFont *find_in_cache(HFONT hfont, LOGFONTW *plf, XFORM *pxf, BOOL can_u
HFONTLIST *hflist; HFONTLIST *hflist;
struct list *font_elem_ptr, *hfontlist_elem_ptr; struct list *font_elem_ptr, *hfontlist_elem_ptr;
memcpy(&fd.lf, plf, sizeof(LOGFONTW)); fd.lf = *plf;
memcpy(&fd.matrix, pxf, sizeof(FMAT2)); memcpy(&fd.matrix, pxf, sizeof(FMAT2));
fd.can_use_bitmap = can_use_bitmap; fd.can_use_bitmap = can_use_bitmap;
calc_hash(&fd); calc_hash(&fd);
...@@ -3003,7 +3003,7 @@ GdiFont *WineEngCreateFontInstance(DC *dc, HFONT hfont) ...@@ -3003,7 +3003,7 @@ GdiFont *WineEngCreateFontInstance(DC *dc, HFONT hfont)
ret = alloc_font(); ret = alloc_font();
memcpy(&ret->font_desc.matrix, &dc->xformWorld2Vport, sizeof(FMAT2)); memcpy(&ret->font_desc.matrix, &dc->xformWorld2Vport, sizeof(FMAT2));
memcpy(&ret->font_desc.lf, &lf, sizeof(LOGFONTW)); ret->font_desc.lf = lf;
ret->font_desc.can_use_bitmap = can_use_bitmap; ret->font_desc.can_use_bitmap = can_use_bitmap;
calc_hash(&ret->font_desc); calc_hash(&ret->font_desc);
hflist = HeapAlloc(GetProcessHeap(), 0, sizeof(*hflist)); hflist = HeapAlloc(GetProcessHeap(), 0, sizeof(*hflist));
...@@ -3209,7 +3209,7 @@ found: ...@@ -3209,7 +3209,7 @@ found:
ret->fake_italic = (it && !face->Italic); ret->fake_italic = (it && !face->Italic);
ret->fake_bold = (bd && !face->Bold); ret->fake_bold = (bd && !face->Bold);
memcpy(&ret->fs, &face->fs, sizeof(FONTSIGNATURE)); ret->fs = face->fs;
if(csi.fs.fsCsb[0]) { if(csi.fs.fsCsb[0]) {
ret->charset = lf.lfCharSet; ret->charset = lf.lfCharSet;
...@@ -3378,8 +3378,8 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, ...@@ -3378,8 +3378,8 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf,
if (face->cached_enum_data) if (face->cached_enum_data)
{ {
TRACE("Cached\n"); TRACE("Cached\n");
memcpy(pelf, &face->cached_enum_data->elf, sizeof(ENUMLOGFONTEXW)); *pelf = face->cached_enum_data->elf;
memcpy(pntm, &face->cached_enum_data->ntm, sizeof(NEWTEXTMETRICEXW)); *pntm = face->cached_enum_data->ntm;
*ptype = face->cached_enum_data->type; *ptype = face->cached_enum_data->type;
return; return;
} }
...@@ -3434,7 +3434,7 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, ...@@ -3434,7 +3434,7 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf,
pntm->ntmTm.ntmFlags = face->ntmFlags; pntm->ntmTm.ntmFlags = face->ntmFlags;
pntm->ntmTm.ntmCellHeight = pntm->ntmTm.tmHeight; pntm->ntmTm.ntmCellHeight = pntm->ntmTm.tmHeight;
pntm->ntmTm.ntmAvgWidth = pntm->ntmTm.tmAveCharWidth; pntm->ntmTm.ntmAvgWidth = pntm->ntmTm.tmAveCharWidth;
memcpy(&pntm->ntmFontSig, &face->fs, sizeof(FONTSIGNATURE)); pntm->ntmFontSig = face->fs;
pelf->elfScript[0] = '\0'; /* This will get set in WineEngEnumFonts */ pelf->elfScript[0] = '\0'; /* This will get set in WineEngEnumFonts */
...@@ -3463,8 +3463,8 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, ...@@ -3463,8 +3463,8 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf,
face->cached_enum_data = HeapAlloc(GetProcessHeap(), 0, sizeof(*face->cached_enum_data)); face->cached_enum_data = HeapAlloc(GetProcessHeap(), 0, sizeof(*face->cached_enum_data));
if (face->cached_enum_data) if (face->cached_enum_data)
{ {
memcpy(&face->cached_enum_data->elf, pelf, sizeof(ENUMLOGFONTEXW)); face->cached_enum_data->elf = *pelf;
memcpy(&face->cached_enum_data->ntm, pntm, sizeof(NEWTEXTMETRICEXW)); face->cached_enum_data->ntm = *pntm;
face->cached_enum_data->type = *ptype; face->cached_enum_data->type = *ptype;
} }
...@@ -3506,7 +3506,7 @@ DWORD WineEngEnumFonts(LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lparam) ...@@ -3506,7 +3506,7 @@ DWORD WineEngEnumFonts(LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lparam)
if(psub) { if(psub) {
TRACE("substituting %s -> %s\n", debugstr_w(plf->lfFaceName), TRACE("substituting %s -> %s\n", debugstr_w(plf->lfFaceName),
debugstr_w(psub->to.name)); debugstr_w(psub->to.name));
memcpy(&lf, plf, sizeof(lf)); lf = *plf;
strcpyW(lf.lfFaceName, psub->to.name); strcpyW(lf.lfFaceName, psub->to.name);
plf = &lf; plf = &lf;
} }
...@@ -4305,7 +4305,7 @@ BOOL WineEngGetTextMetrics(GdiFont *font, LPTEXTMETRICW ptm) ...@@ -4305,7 +4305,7 @@ BOOL WineEngGetTextMetrics(GdiFont *font, LPTEXTMETRICW ptm)
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
return FALSE; return FALSE;
} }
memcpy(ptm, &font->potm->otmTextMetrics, sizeof(*ptm)); *ptm = font->potm->otmTextMetrics;
scale_font_metrics(font, ptm); scale_font_metrics(font, ptm);
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
return TRUE; return TRUE;
...@@ -4885,7 +4885,7 @@ INT WineEngGetTextFace(GdiFont *font, INT count, LPWSTR str) ...@@ -4885,7 +4885,7 @@ INT WineEngGetTextFace(GdiFont *font, INT count, LPWSTR str)
UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags)
{ {
if (fs) memcpy(fs, &font->fs, sizeof(FONTSIGNATURE)); if (fs) *fs = font->fs;
return font->charset; return font->charset;
} }
......
...@@ -184,7 +184,7 @@ static void newtextmetricex_W_to_16( const NEWTEXTMETRICEXW *ptmW, ...@@ -184,7 +184,7 @@ static void newtextmetricex_W_to_16( const NEWTEXTMETRICEXW *ptmW,
ptm16->ntmTm.ntmSizeEM = ptmW->ntmTm.ntmSizeEM; ptm16->ntmTm.ntmSizeEM = ptmW->ntmTm.ntmSizeEM;
ptm16->ntmTm.ntmCellHeight = ptmW->ntmTm.ntmCellHeight; ptm16->ntmTm.ntmCellHeight = ptmW->ntmTm.ntmCellHeight;
ptm16->ntmTm.ntmAvgWidth = ptmW->ntmTm.ntmAvgWidth; ptm16->ntmTm.ntmAvgWidth = ptmW->ntmTm.ntmAvgWidth;
memcpy(&ptm16->ntmFontSig, &ptmW->ntmFontSig, sizeof(FONTSIGNATURE)); ptm16->ntmFontSig = ptmW->ntmFontSig;
} }
/* /*
......
...@@ -608,7 +608,7 @@ BOOL GDI_Init(void) ...@@ -608,7 +608,7 @@ BOOL GDI_Init(void)
/* For the default gui font, we use the lfHeight member in deffonts as a place-holder /* For the default gui font, we use the lfHeight member in deffonts as a place-holder
for the point size so we must convert this into a true height */ for the point size so we must convert this into a true height */
memcpy(&default_gui_font, &deffonts->DefaultGuiFont, sizeof(default_gui_font)); default_gui_font = deffonts->DefaultGuiFont;
default_gui_font.lfHeight = -MulDiv(default_gui_font.lfHeight, get_dpi(), 72); default_gui_font.lfHeight = -MulDiv(default_gui_font.lfHeight, get_dpi(), 72);
stock_objects[DEFAULT_GUI_FONT] = CreateFontIndirectW( &default_gui_font ); stock_objects[DEFAULT_GUI_FONT] = CreateFontIndirectW( &default_gui_font );
......
...@@ -265,7 +265,7 @@ static INT PEN_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer ) ...@@ -265,7 +265,7 @@ static INT PEN_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer )
count == sizeof(EXTLOGPEN)) count == sizeof(EXTLOGPEN))
{ {
EXTLOGPEN *elp = buffer; EXTLOGPEN *elp = buffer;
memcpy(elp, &pen->logpen, sizeof(EXTLOGPEN)); *elp = pen->logpen;
elp->elpWidth = 0; elp->elpWidth = 0;
return sizeof(EXTLOGPEN); return sizeof(EXTLOGPEN);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment