diff options
author | Stephan Vedder <stephan.vedder@gmail.com> | 2015-05-23 14:06:54 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@chown.ath.cx> | 2015-07-10 10:42:41 +0200 |
commit | 253d27b5513f1c750f143c940ae71c41730f2040 (patch) | |
tree | e277007afd2c6a227bfc081960039164b5e57be9 | |
parent | 3ea82cd452b43ae74d11a9af6fa9b55faaa0e576 (diff) | |
download | libass-253d27b5513f1c750f143c940ae71c41730f2040.tar.bz2 libass-253d27b5513f1c750f143c940ae71c41730f2040.tar.xz |
directwrite: fix error handling in font scanning
Fix that a single broken font could mess up the entire font scanning.
-rw-r--r-- | libass/ass_directwrite.cpp | 16 |
1 files 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 <stefano.pigozzi@gmail.com> + * Copyright (C) 2015 Stephan Vedder <stephan.vedder@gmail.com> * * 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); |