Kaydet (Commit) 8003f869 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in oneToOneMappingWithFlag

Change-Id: I729d6640c105ca43fdd2e3e702f6f62876db75e5
Reviewed-on: https://gerrit.libreoffice.org/62647
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b3c449b7
......@@ -67,11 +67,6 @@ oneToOneMappingWithFlag::oneToOneMappingWithFlag( UnicodePairWithFlag const *rpT
oneToOneMappingWithFlag::~oneToOneMappingWithFlag()
{
if( mbHasIndex )
{
for (UnicodePairWithFlag const ** i : mpIndex)
delete [] i;
}
}
void oneToOneMappingWithFlag::makeIndex()
......@@ -80,9 +75,6 @@ void oneToOneMappingWithFlag::makeIndex()
{
int current = -1;
for (UnicodePairWithFlag const **& i : mpIndex)
i = nullptr;
for( size_t k = 0; k < mnSize; k++ )
{
const int high = (mpTableWF[k].first >> 8) & 0xFF;
......@@ -90,7 +82,7 @@ void oneToOneMappingWithFlag::makeIndex()
if( high != current )
{
current = high;
mpIndex[high] = new UnicodePairWithFlag const *[256];
mpIndex[high].reset(new UnicodePairWithFlag const *[256]);
for (int j = 0; j < 256; ++j)
mpIndex[high][j] = nullptr;
......
......@@ -21,6 +21,7 @@
#include <rtl/ustring.hxx>
#include <i18nutil/i18nutildllapi.h>
#include <memory>
namespace i18nutil {
......@@ -80,7 +81,7 @@ public:
private:
UnicodePairWithFlag const *mpTableWF;
UnicodePairFlag mnFlag;
UnicodePairWithFlag const **mpIndex[256];
std::unique_ptr<UnicodePairWithFlag const *[]> mpIndex[256];
bool mbHasIndex;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment