From 3089ea327fcc54509d087925369c7dd7b3afc0f4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Jun 2012 16:46:58 +0000 Subject: compatibility with the old options git-svn-id: http://svn.miranda-ng.org/main/trunk@636 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/fonts/services.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index e0b145a350..09ac106fb5 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h" #include "FontService.h" +#define FontID_OLDSIZE (offsetof(FontID, backgroundGroup)) +#define FontIDW_OLDSIZE (offsetof(FontIDW, backgroundGroup)) + COLORREF GetColorFromDefault(COLORREF cl); void ConvertFontSettings(FontSettings* fs, FontSettingsW* fsw) @@ -38,7 +41,7 @@ void ConvertFontSettings(FontSettings* fs, FontSettingsW* fsw) bool ConvertFontID(FontID *fid, FontIDW* fidw) { - if (fid->cbSize != sizeof(FontID)) + if (fid->cbSize != sizeof(FontID) && fid->cbSize != FontID_OLDSIZE) return false; memset(fidw, 0, sizeof(FontIDW)); @@ -51,8 +54,11 @@ bool ConvertFontID(FontID *fid, FontIDW* fidw) MultiByteToWideChar(code_page, 0, fid->group, -1, fidw->group, 64); MultiByteToWideChar(code_page, 0, fid->name, -1, fidw->name, 64); - MultiByteToWideChar(code_page, 0, fid->backgroundGroup, -1, fidw->backgroundGroup, 64); - MultiByteToWideChar(code_page, 0, fid->backgroundName, -1, fidw->backgroundName, 64); + + if (fid->cbSize > FontID_OLDSIZE) { + MultiByteToWideChar(code_page, 0, fid->backgroundGroup, -1, fidw->backgroundGroup, 64); + MultiByteToWideChar(code_page, 0, fid->backgroundName, -1, fidw->backgroundName, 64); + } return true; } @@ -279,7 +285,7 @@ COLORREF GetColorFromDefault(COLORREF cl) static int sttRegisterFontWorker(FontIDW* font_id, int hLangpack) { - if (font_id->cbSize != sizeof(FontIDW)) + if (font_id->cbSize != sizeof(FontIDW) && font_id->cbSize != FontIDW_OLDSIZE) return -1; for (int i = 0; i < font_id_list.getCount(); i++) { -- cgit v1.2.3