зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1216644 - part 2 - make gfxFontEntry::mUVSData a UniquePtr; r=jrmuizel
This patch could have been in the last patch, but it felt like modifying ReadCMAPTableFormat14 to accept a UniquePtr<> made the code clearer. This change was therefore separated into its own patch for easier review.
This commit is contained in:
Родитель
634bee4a27
Коммит
3d5a31b8f3
|
@ -211,7 +211,7 @@ nsresult gfxFontEntry::InitializeUVSMap()
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uint8_t* uvsData;
|
||||
UniquePtr<uint8_t[]> uvsData;
|
||||
unsigned int cmapLen;
|
||||
const char* cmapData = hb_blob_get_data(cmapTable, &cmapLen);
|
||||
nsresult rv = gfxFontUtils::ReadCMAPTableFormat14(
|
||||
|
@ -223,7 +223,7 @@ nsresult gfxFontEntry::InitializeUVSMap()
|
|||
return rv;
|
||||
}
|
||||
|
||||
mUVSData = uvsData;
|
||||
mUVSData = Move(uvsData);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -234,7 +234,7 @@ uint16_t gfxFontEntry::GetUVSGlyph(uint32_t aCh, uint32_t aVS)
|
|||
InitializeUVSMap();
|
||||
|
||||
if (mUVSData) {
|
||||
return gfxFontUtils::MapUVSToGlyphFormat14(mUVSData, aCh, aVS);
|
||||
return gfxFontUtils::MapUVSToGlyphFormat14(mUVSData.get(), aCh, aVS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nsDataHashtable.h"
|
||||
#include "harfbuzz/hb.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
typedef struct gr_face gr_face;
|
||||
|
||||
|
@ -429,7 +430,7 @@ public:
|
|||
|
||||
RefPtr<gfxCharacterMap> mCharacterMap;
|
||||
uint32_t mUVSOffset;
|
||||
nsAutoArrayPtr<uint8_t> mUVSData;
|
||||
mozilla::UniquePtr<uint8_t[]> mUVSData;
|
||||
nsAutoPtr<gfxUserFontData> mUserFontData;
|
||||
nsAutoPtr<gfxSVGGlyphs> mSVGGlyphs;
|
||||
// list of gfxFonts that are using SVG glyphs
|
||||
|
|
|
@ -289,7 +289,7 @@ gfxFontUtils::ReadCMAPTableFormat4(const uint8_t *aBuf, uint32_t aLength,
|
|||
|
||||
nsresult
|
||||
gfxFontUtils::ReadCMAPTableFormat14(const uint8_t *aBuf, uint32_t aLength,
|
||||
uint8_t*& aTable)
|
||||
UniquePtr<uint8_t[]>& aTable)
|
||||
{
|
||||
enum {
|
||||
OffsetFormat = 0,
|
||||
|
@ -371,8 +371,8 @@ gfxFontUtils::ReadCMAPTableFormat14(const uint8_t *aBuf, uint32_t aLength,
|
|||
}
|
||||
}
|
||||
|
||||
aTable = new uint8_t[tablelen];
|
||||
memcpy(aTable, aBuf, tablelen);
|
||||
aTable = MakeUnique<uint8_t[]>(tablelen);
|
||||
memcpy(aTable.get(), aBuf, tablelen);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include "zlib.h"
|
||||
#include <algorithm>
|
||||
|
@ -786,7 +787,7 @@ public:
|
|||
|
||||
static nsresult
|
||||
ReadCMAPTableFormat14(const uint8_t *aBuf, uint32_t aLength,
|
||||
uint8_t*& aTable);
|
||||
mozilla::UniquePtr<uint8_t[]>& aTable);
|
||||
|
||||
static uint32_t
|
||||
FindPreferredSubtable(const uint8_t *aBuf, uint32_t aBufLength,
|
||||
|
|
Загрузка…
Ссылка в новой задаче