Nikolay Sivov : gdi32: Add a separate helper to load FT_Short values ( Coverity).
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 29 08:12:09 CDT 2015
Module: wine
Branch: master
Commit: 7ebdd58556e83644122b0012959fcad2f2609548
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7ebdd58556e83644122b0012959fcad2f2609548
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun Jun 28 13:02:55 2015 +0300
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,
More information about the wine-cvs
mailing list