summaryrefslogtreecommitdiffstats
path: root/libs/minikin/FontFamily.cpp
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-12-04 20:44:11 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-12-04 20:44:11 +0000
commitda09490825ce49e103d511ec1b92c79df0923ada (patch)
tree68422bb0bbacc09a2d7336d2bbeba73a20d17f30 /libs/minikin/FontFamily.cpp
parent2d7821158c259a2581140c580f444c0368da6a47 (diff)
parent919fbb99f1d5d0c95bf165cec9b7b178b42908ec (diff)
downloadandroid_frameworks_minikin-da09490825ce49e103d511ec1b92c79df0923ada.tar.gz
android_frameworks_minikin-da09490825ce49e103d511ec1b92c79df0923ada.tar.bz2
android_frameworks_minikin-da09490825ce49e103d511ec1b92c79df0923ada.zip
am 919fbb99: am cb20a2f0: Minikin: Remove unused variables, fix init order
* commit '919fbb99f1d5d0c95bf165cec9b7b178b42908ec': Minikin: Remove unused variables, fix init order
Diffstat (limited to 'libs/minikin/FontFamily.cpp')
-rw-r--r--libs/minikin/FontFamily.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/minikin/FontFamily.cpp b/libs/minikin/FontFamily.cpp
index d2e5867..da7320b 100644
--- a/libs/minikin/FontFamily.cpp
+++ b/libs/minikin/FontFamily.cpp
@@ -191,10 +191,18 @@ const SparseBitSet* FontFamily::getCoverage() {
MinikinFont* typeface = getClosestMatch(defaultStyle).font;
const uint32_t cmapTag = MinikinFont::MakeTag('c', 'm', 'a', 'p');
size_t cmapSize = 0;
- bool ok = typeface->GetTable(cmapTag, NULL, &cmapSize);
+ if (!typeface->GetTable(cmapTag, NULL, &cmapSize)) {
+ ALOGE("Could not get cmap table size!\n");
+ // Note: This means we will retry on the next call to getCoverage, as we can't store
+ // the failure. This is fine, as we assume this doesn't really happen in practice.
+ return nullptr;
+ }
UniquePtr<uint8_t[]> cmapData(new uint8_t[cmapSize]);
- ok = typeface->GetTable(cmapTag, cmapData.get(), &cmapSize);
- CmapCoverage::getCoverage(mCoverage, cmapData.get(), cmapSize);
+ if (!typeface->GetTable(cmapTag, cmapData.get(), &cmapSize)) {
+ ALOGE("Unexpected failure to read cmap table!\n");
+ return nullptr;
+ }
+ CmapCoverage::getCoverage(mCoverage, cmapData.get(), cmapSize); // TODO: Error check?
#ifdef VERBOSE_DEBUG
ALOGD("font coverage length=%d, first ch=%x\n", mCoverage->length(),
mCoverage->nextSetBit(0));