summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-31 14:46:38 +0200
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-11-28 00:12:51 -0500
commite540ccfb5eb43bd4a3d6920074dce8436720ba8e (patch)
treefb8b1d7a30ab8de2cf34e42f62e00112d7d62301 /i18npool
parentbf8fe9eaa36a9f8fc407ddbb2e7b561e5f9594c5 (diff)
loplugin:useuniqueptr extend to check local vars
just the simple and obvious case for now, of a local var being allocated and deleted inside a single local block, and the delete happening at the end of the block Reviewed-on: https://gerrit.libreoffice.org/33749 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 2489000d3fd66319a8355fd4e37cfdfda47296d0) Change-Id: I3a7a094da543debdcd2374737c2ecff91d644625
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx17
1 files changed, 6 insertions, 11 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 26f0e69663f1..7b80da245399 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -22,6 +22,7 @@
#include <string.h>
#include <algorithm>
#include <iostream>
+#include <memory>
#include <set>
#include <vector>
@@ -1597,11 +1598,11 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
}
sal_Int16 nbOfCalendars = sal::static_int_cast<sal_Int16>( getNumberOfChildren() );
OUString str;
- sal_Int16 * nbOfDays = new sal_Int16[nbOfCalendars];
- sal_Int16 * nbOfMonths = new sal_Int16[nbOfCalendars];
- sal_Int16 * nbOfGenitiveMonths = new sal_Int16[nbOfCalendars];
- sal_Int16 * nbOfPartitiveMonths = new sal_Int16[nbOfCalendars];
- sal_Int16 * nbOfEras = new sal_Int16[nbOfCalendars];
+ std::unique_ptr<sal_Int16[]> nbOfDays( new sal_Int16[nbOfCalendars] );
+ std::unique_ptr<sal_Int16[]> nbOfMonths( new sal_Int16[nbOfCalendars] );
+ std::unique_ptr<sal_Int16[]> nbOfGenitiveMonths( new sal_Int16[nbOfCalendars] );
+ std::unique_ptr<sal_Int16[]> nbOfPartitiveMonths( new sal_Int16[nbOfCalendars] );
+ std::unique_ptr<sal_Int16[]> nbOfEras( new sal_Int16[nbOfCalendars] );
sal_Int16 j;
sal_Int16 i;
bool bHasGregorian = false;
@@ -1890,12 +1891,6 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
of.writeAsciiString("};\n\n");
of.writeFunction("getAllCalendars_", "calendarsCount", "calendars");
-
- delete []nbOfDays;
- delete []nbOfMonths;
- delete []nbOfGenitiveMonths;
- delete []nbOfPartitiveMonths;
- delete []nbOfEras;
}
bool isIso4217( const OUString& rStr )