From 253d27b5513f1c750f143c940ae71c41730f2040 Mon Sep 17 00:00:00 2001 From: Stephan Vedder Date: Sat, 23 May 2015 14:06:54 +0200 Subject: directwrite: fix error handling in font scanning Fix that a single broken font could mess up the entire font scanning. --- libass/ass_directwrite.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libass/ass_directwrite.cpp b/libass/ass_directwrite.cpp index 16ac8d7..743b065 100644 --- a/libass/ass_directwrite.cpp +++ b/libass/ass_directwrite.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Stephan Vedder + * Copyright (C) 2015 Stephan Vedder * * This file is part of libass. * @@ -189,7 +189,7 @@ static void scan_fonts(IDWriteFactory *factory, ASS_FontProvider *provider) { hr = fontFamily->GetFont(j, &font); if (FAILED(hr)) - return; + continue; meta.weight = font->GetWeight(); meta.width = map_width(font->GetStretch()); @@ -201,13 +201,13 @@ static void scan_fonts(IDWriteFactory *factory, ASS_FontProvider *provider) hr = font->GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME, &psNames, &exists); if (FAILED(hr)) - return; + continue; if (exists) { hr = psNames->GetString(0, localeName, LOCALE_NAME_MAX_LENGTH + 1); if (FAILED(hr)) - return; + continue; size_needed = WideCharToMultiByte(CP_UTF8, 0, localeName, -1, NULL, 0, NULL, NULL); psName = (char*)malloc(size_needed); @@ -216,7 +216,7 @@ static void scan_fonts(IDWriteFactory *factory, ASS_FontProvider *provider) hr = font->GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_FULL_NAME, &fontNames, &exists); if (FAILED(hr)) - return; + continue; meta.n_fullname = fontNames->GetCount(); meta.fullnames = (char **)calloc(meta.n_fullname, sizeof(char *)); @@ -224,7 +224,7 @@ static void scan_fonts(IDWriteFactory *factory, ASS_FontProvider *provider) { hr = fontNames->GetString(k,localeName, LOCALE_NAME_MAX_LENGTH + 1); if (FAILED(hr)) - return; + continue; size_needed = WideCharToMultiByte(CP_UTF8, 0, localeName, -1, NULL, 0, NULL, NULL); char* mbName = (char *)malloc(size_needed); @@ -234,7 +234,7 @@ static void scan_fonts(IDWriteFactory *factory, ASS_FontProvider *provider) hr = fontFamily->GetFamilyNames(&familyNames); if (FAILED(hr)) - return; + continue; meta.n_family = familyNames->GetCount(); meta.families = (char **)calloc(meta.n_family, sizeof(char *)); @@ -242,7 +242,7 @@ static void scan_fonts(IDWriteFactory *factory, ASS_FontProvider *provider) { hr = familyNames->GetString(k, localeName, LOCALE_NAME_MAX_LENGTH + 1); if (FAILED(hr)) - return; + continue; size_needed = WideCharToMultiByte(CP_UTF8, 0, localeName, -1, NULL, 0, NULL, NULL); char* mbName = (char *)malloc(size_needed); -- cgit v1.2.3