gdi32: Add a separate helper to load FT_Short values (Coverity).

This commit is contained in:
Nikolay Sivov 2015-06-28 13:02:55 +03:00 committed by Alexandre Julliard
parent 50a66f28ee
commit 7ebdd58556
1 changed files with 12 additions and 4 deletions

View File

@ -1511,7 +1511,15 @@ static LONG reg_load_dword(HKEY hkey, const WCHAR *value, DWORD *data)
return ERROR_SUCCESS;
}
static LONG reg_load_ftlong(HKEY hkey, const WCHAR *value, FT_Long *data)
static inline LONG reg_load_ftlong(HKEY hkey, const WCHAR *value, FT_Long *data)
{
DWORD dw;
LONG ret = reg_load_dword(hkey, value, &dw);
*data = dw;
return ret;
}
static inline LONG reg_load_ftshort(HKEY hkey, const WCHAR *value, FT_Short *data)
{
DWORD dw;
LONG ret = reg_load_dword(hkey, value, &dw);
@ -1557,7 +1565,7 @@ static void load_face(HKEY hkey_face, WCHAR *face_name, Family *family, void *bu
needed = sizeof(face->fs);
RegQueryValueExW(hkey_face, face_font_sig_value, NULL, NULL, (BYTE*)&face->fs, &needed);
if(reg_load_dword(hkey_face, face_height_value, (DWORD*)&face->size.height) != ERROR_SUCCESS)
if(reg_load_ftshort(hkey_face, face_height_value, &face->size.height) != ERROR_SUCCESS)
{
face->scalable = TRUE;
memset(&face->size, 0, sizeof(face->size));
@ -1565,11 +1573,11 @@ static void load_face(HKEY hkey_face, WCHAR *face_name, Family *family, void *bu
else
{
face->scalable = FALSE;
reg_load_dword(hkey_face, face_width_value, (DWORD*)&face->size.width);
reg_load_ftshort(hkey_face, face_width_value, &face->size.width);
reg_load_ftlong(hkey_face, face_size_value, &face->size.size);
reg_load_ftlong(hkey_face, face_x_ppem_value, &face->size.x_ppem);
reg_load_ftlong(hkey_face, face_y_ppem_value, &face->size.y_ppem);
reg_load_dword(hkey_face, face_internal_leading_value, (DWORD*)&face->size.internal_leading);
reg_load_ftshort(hkey_face, face_internal_leading_value, &face->size.internal_leading);
TRACE("Adding bitmap size h %d w %d size %ld x_ppem %ld y_ppem %ld\n",
face->size.height, face->size.width, face->size.size >> 6,