Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: source/tools/toolutil/pkg_icu.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/tools/toolutil/pkg_genc.c ('k') | source/tools/toolutil/pkgitems.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/tools/toolutil/pkg_icu.cpp
diff --git a/source/tools/toolutil/pkg_icu.cpp b/source/tools/toolutil/pkg_icu.cpp
index c2f3904878dc3a4c690de991fe9d3ec5ed754fd7..471b1d45ec1220691c4513f5bea54c817c7761f4 100644
--- a/source/tools/toolutil/pkg_icu.cpp
+++ b/source/tools/toolutil/pkg_icu.cpp
@@ -1,9 +1,10 @@
/******************************************************************************
- * Copyright (C) 2008-2014, International Business Machines
+ * Copyright (C) 2008-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
#include "unicode/utypes.h"
+#include "unicode/localpointer.h"
#include "unicode/putil.h"
#include "cstring.h"
#include "toolutil.h"
@@ -149,33 +150,25 @@ readList(const char *filesPath, const char *listname, UBool readContents, Packag
U_CAPI int U_EXPORT2
writePackageDatFile(const char *outFilename, const char *outComment, const char *sourcePath, const char *addList, Package *pkg, char outType) {
- Package *addListPkg = NULL;
- UBool pkgDelete = FALSE;
+ LocalPointer<Package> ownedPkg;
+ LocalPointer<Package> addListPkg;
if (pkg == NULL) {
- pkg = new Package;
- if(pkg == NULL) {
+ ownedPkg.adoptInstead(new Package);
+ if(ownedPkg.isNull()) {
fprintf(stderr, "icupkg: not enough memory\n");
return U_MEMORY_ALLOCATION_ERROR;
}
+ pkg = ownedPkg.getAlias();
- addListPkg = readList(sourcePath, addList, TRUE, NULL);
- if(addListPkg != NULL) {
+ addListPkg.adoptInstead(readList(sourcePath, addList, TRUE, NULL));
+ if(addListPkg.isValid()) {
pkg->addItems(*addListPkg);
} else {
return U_ILLEGAL_ARGUMENT_ERROR;
}
-
- pkgDelete = TRUE;
}
pkg->writePackage(outFilename, outType, outComment);
-
- if (pkgDelete) {
- delete pkg;
- delete addListPkg;
- }
-
return 0;
}
-
« no previous file with comments | « source/tools/toolutil/pkg_genc.c ('k') | source/tools/toolutil/pkgitems.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698