Index: xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp |
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp |
index aaab954380c4e5452d35733f2796fa6a2e786da1..8332986bae4da40f65c66738457e9ea6ab729a2c 100644 |
--- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp |
+++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp |
@@ -20,6 +20,7 @@ |
* limitations under the License. |
*/ |
+#include "../../../../third_party/base/nonstd_unique_ptr.h" |
#include "../barcode.h" |
#include "../BC_Writer.h" |
#include "../common/BC_CommonBitMatrix.h" |
@@ -129,11 +130,9 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, |
FX_FLOAT geWidth, |
int32_t fontSize, |
FX_FLOAT& charsLen) { |
-#ifdef FXFM_ENCODING_NONE |
- IFX_FontEncodingEx* encoding = FX_CreateFontEncodingEx(cFont); |
-#else |
- IFX_FontEncoding* encoding = FXGE_CreateUnicodeEncoding(cFont); |
-#endif |
+ nonstd::unique_ptr<CFX_UnicodeEncodingEx> encoding( |
+ FX_CreateFontEncodingEx(cFont)); |
+ |
int32_t length = text.GetLength(); |
FX_DWORD* pCharCode = FX_Alloc(FX_DWORD, text.GetLength()); |
FX_FLOAT charWidth = 0; |
@@ -174,8 +173,6 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, |
(FX_FLOAT)(charPos[i].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f; |
} |
FX_Free(pCharCode); |
- delete encoding; |
- encoding = NULL; |
} |
void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device, |
const CFX_Matrix* matrix, |