gdi32: Add a separate helper to load FT_Short values (Coverity)
Nikolay Sivov
nsivov at codeweavers.com
Sun Jun 28 05:03:58 CDT 2015
---
-------------- next part --------------
From 49e16fab808459af18bdf9ac7970036b8351ad98 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun, 28 Jun 2015 13:02:55 +0300
Subject: [PATCH] gdi32: Add a separate helper to load FT_Short values
(Coverity)
---
dlls/gdi32/freetype.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 06b1b1e..07d80a2 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -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,
--
2.1.4
More information about the wine-patches
mailing list