codemaker/source/javamaker/classfile.cxx |    4 ++--
 codemaker/source/javamaker/classfile.hxx |    2 +-
 codemaker/source/javamaker/javatype.cxx  |   20 ++++++++++----------
 3 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit cecbf4e87f6b9229d87b65d67575861ee61b0cdb
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Sep 5 14:52:30 2019 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Sep 5 16:54:20 2019 +0200

    loplugin:useuniqueptr in ClassFile
    
    Change-Id: I6ca5ae6f700747e726e531231b3a5cd1586c54d7
    Reviewed-on: https://gerrit.libreoffice.org/78652
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/codemaker/source/javamaker/classfile.cxx 
b/codemaker/source/javamaker/classfile.cxx
index bf5a02cd6ef4..67177a718529 100644
--- a/codemaker/source/javamaker/classfile.cxx
+++ b/codemaker/source/javamaker/classfile.cxx
@@ -479,8 +479,8 @@ ClassFile::ClassFile(
 
 ClassFile::~ClassFile() {}
 
-ClassFile::Code * ClassFile::newCode() {
-    return new Code(*this);
+std::unique_ptr<ClassFile::Code> ClassFile::newCode() {
+    return std::unique_ptr<Code>(new Code(*this));
 }
 
 sal_uInt16 ClassFile::addIntegerInfo(sal_Int32 value) {
diff --git a/codemaker/source/javamaker/classfile.hxx 
b/codemaker/source/javamaker/classfile.hxx
index 6f536802b50c..db6388a3e958 100644
--- a/codemaker/source/javamaker/classfile.hxx
+++ b/codemaker/source/javamaker/classfile.hxx
@@ -156,7 +156,7 @@ public:
 
     ~ClassFile();
 
-    Code * newCode();
+    std::unique_ptr<Code> newCode();
 
     sal_uInt16 addIntegerInfo(sal_Int32 value);
     sal_uInt16 addFloatInfo(float value);
diff --git a/codemaker/source/javamaker/javatype.cxx 
b/codemaker/source/javamaker/javatype.cxx
index 3130389e916b..28d6081e8c8b 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -718,7 +718,7 @@ void handleEnumType(
         ClassFile::ACC_PRIVATE,
         "<init>", "(I)V", code.get(),
         std::vector< OString >(), "");
-    code.reset(cf->newCode());
+    code = cf->newCode();
     code->instrGetstatic(
         className,
         codemaker::convertString(entity->getMembers()[0].name),
@@ -730,7 +730,7 @@ void handleEnumType(
             ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC),
         "getDefault", "()" + classDescriptor,
         code.get(), std::vector< OString >(), "");
-    code.reset(cf->newCode());
+    code = cf->newCode();
     code->loadLocalInteger(0);
     std::map< sal_Int32, OString > map;
     sal_Int32 min = SAL_MAX_INT32;
@@ -793,7 +793,7 @@ void handleEnumType(
             ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC),
         "fromInt", "(I)" + classDescriptor, code.get(),
         std::vector< OString >(), "");
-    code.reset(cf->newCode());
+    code = cf->newCode();
     for (const unoidl::EnumTypeEntity::Member& member : entity->getMembers())
     {
         code->instrNew(className);
@@ -1405,7 +1405,7 @@ void handlePlainStructType(
         ClassFile::ACC_PUBLIC, "<init>", "()V", code.get(),
         std::vector< OString >(), "");
     MethodDescriptor desc(manager, dependencies, "void", nullptr, nullptr);
-    code.reset(cf->newCode());
+    code = cf->newCode();
     code->loadLocalReference(0);
     sal_uInt16 index2 = 1;
     if (!entity->getDirectBase().isEmpty()) {
@@ -1495,7 +1495,7 @@ void handlePolyStructType(
         ClassFile::ACC_PUBLIC, "<init>", "()V", code.get(),
         std::vector< OString >(), "");
     MethodDescriptor desc(manager, dependencies, "void", nullptr, nullptr);
-    code.reset(cf->newCode());
+    code = cf->newCode();
     code->loadLocalReference(0);
     sal_uInt16 index2 = 1;
     code->instrInvokespecial(
@@ -1632,7 +1632,7 @@ void handleExceptionType(
 
 
     // create (Throwable Cause) constructor
-    code.reset(cf->newCode());
+    code = cf->newCode();
     code->loadLocalReference(0);
     code->loadLocalReference(1);
     code->instrInvokespecial(superClass, "<init>", "(Ljava/lang/Throwable;)V");
@@ -1663,7 +1663,7 @@ void handleExceptionType(
         std::vector< OString >(), "");
 
     // create (Throwable Cause, String Message) constructor
-    code.reset(cf->newCode());
+    code = cf->newCode();
     code->loadLocalReference(0);
     if (baseException || baseRuntimeException) {
         code->loadLocalReference(2);
@@ -1701,7 +1701,7 @@ void handleExceptionType(
         std::vector< OString >(), "");
 
     // create (String Message) constructor
-    code.reset(cf->newCode());
+    code = cf->newCode();
     code->loadLocalReference(0);
     code->loadLocalReference(1);
     code->instrInvokespecial(superClass, "<init>", "(Ljava/lang/String;)V");
@@ -1734,7 +1734,7 @@ void handleExceptionType(
 
     // create (String Message, Object Context, T1 m1, ..., Tn mn) constructor
     MethodDescriptor desc1(manager, dependencies, "void", nullptr, nullptr);
-    code.reset(cf->newCode());
+    code = cf->newCode();
     code->loadLocalReference(0);
     sal_uInt16 index2 = 1;
     code->loadLocalReference(index2++);
@@ -1774,7 +1774,7 @@ void handleExceptionType(
 
     // create (Throwable Cause, String Message, Object Context, T1 m1, ..., Tn 
mn) constructor
     MethodDescriptor desc2(manager, dependencies, "void", nullptr, nullptr);
-    code.reset(cf->newCode());
+    code = cf->newCode();
     code->loadLocalReference(0);
     sal_uInt16 index3 = 3;
     // Note that we hack in the java.lang.Throwable parameter further down,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to