Blame SOURCES/0038-Only-use-proper-C-new-and-delete-syntax-for-object-c.patch

055751
From d2c6003ca5b0116fc18505b4fd34b211484e41ca Mon Sep 17 00:00:00 2001
055751
From: Sebastian Kraft <mail@sebastiankraft.net>
055751
Date: Sat, 19 Dec 2015 20:08:24 +0100
055751
Subject: [PATCH 038/113] Only use proper C++ new and delete syntax for object
055751
 creation in tests and lenstool
055751
055751
---
055751
 apps/lenstool/lenstool.cpp               | 16 ++++++++--------
055751
 tests/test_database.cpp                  |  4 ++--
055751
 tests/test_modifier.cpp                  |  8 +++++---
055751
 tests/test_modifier_color.cpp            |  4 ++--
055751
 tests/test_modifier_coord_distortion.cpp |  4 ++--
055751
 tests/test_modifier_coord_geometry.cpp   |  4 ++--
055751
 tests/test_modifier_coord_scale.cpp      |  4 ++--
055751
 tests/test_modifier_subpix.cpp           |  4 ++--
055751
 8 files changed, 25 insertions(+), 23 deletions(-)
055751
055751
diff --git a/apps/lenstool/lenstool.cpp b/apps/lenstool/lenstool.cpp
055751
index 0aab056..399195e 100644
055751
--- a/apps/lenstool/lenstool.cpp
055751
+++ b/apps/lenstool/lenstool.cpp
055751
@@ -360,7 +360,7 @@ int main (int argc, char **argv)
055751
     lfDatabase *ldb = new lfDatabase ();
055751
 
055751
     if (ldb->Load () != LF_NO_ERROR) {
055751
-        ldb->Destroy();
055751
+        delete ldb;
055751
         g_print ("\rERROR: Database could not be loaded\n");
055751
         return -1;
055751
     }
055751
@@ -410,7 +410,7 @@ int main (int argc, char **argv)
055751
 
055751
     // nothing to process, so lets quit here
055751
     if (!opts.Input) {
055751
-        ldb->Destroy();
055751
+        delete ldb;
055751
         return 0;
055751
     }
055751
 
055751
@@ -441,22 +441,22 @@ int main (int argc, char **argv)
055751
     if (!img->Open (opts.Input)) {
055751
         g_print ("\rERROR: failed to open file `%s'\n", opts.Input);
055751
         delete img;
055751
-        ldb->Destroy();
055751
+        delete ldb;
055751
         return -1;
055751
     }
055751
     if (!img->LoadPNG ()) {
055751
         g_print ("\rERROR: failed to parse PNG data from file `%s'\n", opts.Input);
055751
         delete img;
055751
-        ldb->Destroy();
055751
+        delete ldb;
055751
         return -1;
055751
     }
055751
     g_print ("done.\n~ Image size [%ux%u].\n", img->width, img->height);
055751
 
055751
-    lfModifier *mod = lfModifier::Create (lens, opts.Crop, img->width, img->height);
055751
+    lfModifier *mod = new lfModifier (lens, opts.Crop, img->width, img->height);
055751
     if (!mod) {
055751
         g_print ("\rWarning: failed to create modifier\n");
055751
         delete img;
055751
-        ldb->Destroy();
055751
+        delete ldb;
055751
         return -1;
055751
     }
055751
     int modflags = mod->Initialize (
055751
@@ -491,13 +491,13 @@ int main (int argc, char **argv)
055751
     clock_t et = clock ();
055751
     g_print ("done (%.3g secs)\n", double (et - st) / CLOCKS_PER_SEC);
055751
 
055751
-    mod->Destroy ();
055751
+    delete mod;
055751
 
055751
     g_print ("~ Save output as `%s'...", opts.Output);
055751
     bool ok = img->SavePNG (opts.Output);
055751
 
055751
     delete img;
055751
-    ldb->Destroy ();
055751
+    delete ldb;
055751
 
055751
     if (ok) {
055751
         g_print (" done\n");
055751
diff --git a/tests/test_database.cpp b/tests/test_database.cpp
055751
index d64984a..45dc38f 100644
055751
--- a/tests/test_database.cpp
055751
+++ b/tests/test_database.cpp
055751
@@ -9,14 +9,14 @@ typedef struct {
055751
 
055751
 void db_setup(lfFixture *lfFix, gconstpointer data)
055751
 {
055751
-    lfFix->db = lf_db_new ();
055751
+    lfFix->db = new lfDatabase ();
055751
     lfFix->db->Load();
055751
 }
055751
 
055751
 
055751
 void db_teardown(lfFixture *lfFix, gconstpointer data)
055751
 {
055751
-    lfFix->db->Destroy();
055751
+    delete lfFix->db;
055751
 }
055751
 
055751
 
055751
diff --git a/tests/test_modifier.cpp b/tests/test_modifier.cpp
055751
index 3d091a4..f794638 100644
055751
--- a/tests/test_modifier.cpp
055751
+++ b/tests/test_modifier.cpp
055751
@@ -31,7 +31,6 @@ void mod_setup(lfFixture *lfFix, gconstpointer data)
055751
 
055751
 void mod_teardown(lfFixture *lfFix, gconstpointer data)
055751
 {
055751
-    lfFix->mod->Destroy();
055751
     delete lfFix->lens;
055751
 }
055751
 
055751
@@ -55,7 +54,7 @@ void test_mod_projection_center(lfFixture* lfFix, gconstpointer data)
055751
             if(g_test_verbose())
055751
                 g_print("  ~ Conversion from %s -> %s \n", geom_names[j], geom_names[i]);
055751
 
055751
-            lfFix->mod = lfModifier::Create (lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
+            lfFix->mod = new lfModifier (lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
             lfFix->mod->Initialize (
055751
                 lfFix->lens, LF_PF_U8, 12.0f,
055751
                 6.7f, 2.0f, 1.0f, geom_types[i],
055751
@@ -68,6 +67,8 @@ void test_mod_projection_center(lfFixture* lfFix, gconstpointer data)
055751
                 g_assert_cmpfloat(in[0],==,res[0]);
055751
                 g_assert_cmpfloat(in[1],==,res[1]);
055751
             }
055751
+
055751
+            delete lfFix->mod;
055751
             i++;
055751
         }
055751
         j++;
055751
@@ -94,7 +95,7 @@ void test_mod_projection_borders(lfFixture* lfFix, gconstpointer data)
055751
             if(g_test_verbose())
055751
                 g_print("  ~ Conversion from %s -> %s \n", geom_names[j], geom_names[i]);
055751
 
055751
-            lfFix->mod = lfModifier::Create (lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
+            lfFix->mod = new lfModifier (lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
             lfFix->mod->Initialize (
055751
                 lfFix->lens, LF_PF_U8, 12.0f,
055751
                 6.7f, 2.0f, 1.0f, geom_types[i],
055751
@@ -115,6 +116,7 @@ void test_mod_projection_borders(lfFixture* lfFix, gconstpointer data)
055751
                 g_assert_false(isnan(res[1]));
055751
             }
055751
 
055751
+            delete lfFix->mod;
055751
             i++;
055751
         }
055751
         j++;
055751
diff --git a/tests/test_modifier_color.cpp b/tests/test_modifier_color.cpp
055751
index 4c5e2dc..6327232 100644
055751
--- a/tests/test_modifier_color.cpp
055751
+++ b/tests/test_modifier_color.cpp
055751
@@ -107,7 +107,7 @@ void mod_setup(lfFixture *lfFix, gconstpointer data)
055751
   lfFix->img_height = 300;
055751
   lfFix->img_width  = 300;
055751
 
055751
-  lfFix->mod = lfModifier::Create(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
+  lfFix->mod = new lfModifier(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
 
055751
   lfFix->mod->Initialize(
055751
     lfFix->lens, cTypeToLfPixelFormat<T>(),
055751
@@ -134,7 +134,7 @@ void mod_teardown(lfFixture *lfFix, gconstpointer data)
055751
   else
055751
     lf_free_align(lfFix->image);
055751
 
055751
-  lfFix->mod->Destroy();
055751
+  delete lfFix->mod;
055751
   delete lfFix->lens;
055751
 }
055751
 
055751
diff --git a/tests/test_modifier_coord_distortion.cpp b/tests/test_modifier_coord_distortion.cpp
055751
index 6fd6773..f463350 100644
055751
--- a/tests/test_modifier_coord_distortion.cpp
055751
+++ b/tests/test_modifier_coord_distortion.cpp
055751
@@ -51,7 +51,7 @@ void mod_setup(lfFixture *lfFix, gconstpointer data)
055751
   lfFix->img_height = 300;
055751
   lfFix->img_width  = 300;
055751
 
055751
-  lfFix->mod = lfModifier::Create(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
+  lfFix->mod = new lfModifier(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
 
055751
   lfFix->mod->Initialize(
055751
     lfFix->lens, LF_PF_F32,
055751
@@ -76,7 +76,7 @@ void mod_teardown(lfFixture *lfFix, gconstpointer data)
055751
   else
055751
     lf_free_align(lfFix->coordBuff);
055751
 
055751
-  lfFix->mod->Destroy();
055751
+  delete lfFix->mod;
055751
   delete lfFix->lens;
055751
 }
055751
 
055751
diff --git a/tests/test_modifier_coord_geometry.cpp b/tests/test_modifier_coord_geometry.cpp
055751
index 6805b7d..d626ba8 100644
055751
--- a/tests/test_modifier_coord_geometry.cpp
055751
+++ b/tests/test_modifier_coord_geometry.cpp
055751
@@ -51,7 +51,7 @@ void mod_setup(lfFixture *lfFix, gconstpointer data)
055751
   lfFix->img_height = 300;
055751
   lfFix->img_width  = 300;
055751
 
055751
-  lfFix->mod = lfModifier::Create(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
+  lfFix->mod = new lfModifier(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
 
055751
   lfFix->mod->Initialize(
055751
     lfFix->lens, LF_PF_F32,
055751
@@ -76,7 +76,7 @@ void mod_teardown(lfFixture *lfFix, gconstpointer data)
055751
   else
055751
     lf_free_align(lfFix->coordBuff);
055751
 
055751
-  lfFix->mod->Destroy();
055751
+  delete lfFix->mod;
055751
   delete lfFix->lens;
055751
 }
055751
 
055751
diff --git a/tests/test_modifier_coord_scale.cpp b/tests/test_modifier_coord_scale.cpp
055751
index c155ff8..84a4286 100644
055751
--- a/tests/test_modifier_coord_scale.cpp
055751
+++ b/tests/test_modifier_coord_scale.cpp
055751
@@ -48,7 +48,7 @@ void mod_setup(lfFixture *lfFix, gconstpointer data)
055751
   lfFix->img_height = 300;
055751
   lfFix->img_width  = 300;
055751
 
055751
-  lfFix->mod = lfModifier::Create(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
+  lfFix->mod = new lfModifier(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
 
055751
   lfFix->mod->Initialize(
055751
     lfFix->lens, LF_PF_F32,
055751
@@ -73,7 +73,7 @@ void mod_teardown(lfFixture *lfFix, gconstpointer data)
055751
   else
055751
     lf_free_align(lfFix->coordBuff);
055751
 
055751
-  lfFix->mod->Destroy();
055751
+  delete lfFix->mod;
055751
   delete lfFix->lens;
055751
 }
055751
 
055751
diff --git a/tests/test_modifier_subpix.cpp b/tests/test_modifier_subpix.cpp
055751
index d04f36d..fa29cf6 100644
055751
--- a/tests/test_modifier_subpix.cpp
055751
+++ b/tests/test_modifier_subpix.cpp
055751
@@ -51,7 +51,7 @@ void mod_setup(lfFixture *lfFix, gconstpointer data)
055751
   lfFix->img_height = 300;
055751
   lfFix->img_width  = 300;
055751
 
055751
-  lfFix->mod = lfModifier::Create(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
+  lfFix->mod = new lfModifier(lfFix->lens, 1.0f, lfFix->img_width, lfFix->img_height);
055751
 
055751
   lfFix->mod->Initialize(
055751
     lfFix->lens, LF_PF_F32,
055751
@@ -76,7 +76,7 @@ void mod_teardown(lfFixture *lfFix, gconstpointer data)
055751
   else
055751
     lf_free_align(lfFix->coordBuff);
055751
 
055751
-  lfFix->mod->Destroy();
055751
+  delete lfFix->mod;
055751
   delete lfFix->lens;
055751
 }
055751
 
055751
-- 
055751
2.7.4
055751