[Liblas-commits] hg-main-tree: fix leak, fix warning
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Mar 22 18:55:43 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/0edb01aaa087
changeset: 389:0edb01aaa087
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Mar 22 14:49:51 2011 -0700
description:
fix leak, fix warning
Subject: hg-main-tree: fix leak in iterators
details: http://hg.libpc.orghg-main-tree/rev/358d34a12a9e
changeset: 390:358d34a12a9e
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Mar 22 15:36:54 2011 -0700
description:
fix leak in iterators
Subject: hg-main-tree: fix test name
details: http://hg.libpc.orghg-main-tree/rev/b2ef951f24cb
changeset: 391:b2ef951f24cb
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Mar 22 15:46:37 2011 -0700
description:
fix test name
Subject: hg-main-tree: fix test name
details: http://hg.libpc.orghg-main-tree/rev/969ec57a1b9c
changeset: 392:969ec57a1b9c
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Mar 22 15:51:28 2011 -0700
description:
fix test name
Subject: hg-main-tree: fix leak
details: http://hg.libpc.orghg-main-tree/rev/b19b24391fd1
changeset: 393:b19b24391fd1
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Mar 22 15:55:30 2011 -0700
description:
fix leak
diffstat:
include/libpc/FilterIterator.hpp | 1 +
include/libpc/Iterator.hpp | 1 +
include/libpc/Utils.hpp | 3 +++
include/libpc/filters/MosaicFilterIterator.hpp | 1 +
src/FilterIterator.cpp | 6 ++++++
src/Iterator.cpp | 6 ++++++
src/Utils.cpp | 17 +++++++++++++++++
src/drivers/oci/Writer.cpp | 7 +++----
src/filters/MosaicFilterIterator.cpp | 10 ++++++++++
test/unit/ColorFilterTest.cpp | 2 +-
test/unit/SchemaLayoutTest.cpp | 2 +-
11 files changed, 50 insertions(+), 6 deletions(-)
diffs (173 lines):
diff -r 15770dc2c858 -r b19b24391fd1 include/libpc/FilterIterator.hpp
--- a/include/libpc/FilterIterator.hpp Tue Mar 22 12:58:50 2011 -0500
+++ b/include/libpc/FilterIterator.hpp Tue Mar 22 15:55:30 2011 -0700
@@ -45,6 +45,7 @@
{
public:
FilterIterator(const Filter&);
+ virtual ~FilterIterator();
protected:
Iterator& getPrevIterator();
diff -r 15770dc2c858 -r b19b24391fd1 include/libpc/Iterator.hpp
--- a/include/libpc/Iterator.hpp Tue Mar 22 12:58:50 2011 -0500
+++ b/include/libpc/Iterator.hpp Tue Mar 22 15:55:30 2011 -0700
@@ -46,6 +46,7 @@
{
public:
Iterator(const Stage& stage);
+ virtual ~Iterator();
const Stage& getStage() const;
diff -r 15770dc2c858 -r b19b24391fd1 include/libpc/Utils.hpp
--- a/include/libpc/Utils.hpp Tue Mar 22 12:58:50 2011 -0500
+++ b/include/libpc/Utils.hpp Tue Mar 22 15:55:30 2011 -0700
@@ -142,6 +142,9 @@
return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
}
+ static char* getenv(const char* env);
+ static int putenv(const char* env);
+
private:
template<typename T>
static inline char* as_buffer(T& data)
diff -r 15770dc2c858 -r b19b24391fd1 include/libpc/filters/MosaicFilterIterator.hpp
--- a/include/libpc/filters/MosaicFilterIterator.hpp Tue Mar 22 12:58:50 2011 -0500
+++ b/include/libpc/filters/MosaicFilterIterator.hpp Tue Mar 22 15:55:30 2011 -0700
@@ -48,6 +48,7 @@
{
public:
MosaicFilterIterator(const MosaicFilter& filter);
+ ~MosaicFilterIterator();
const std::vector<Iterator*>& getPrevIterators() const;
diff -r 15770dc2c858 -r b19b24391fd1 src/FilterIterator.cpp
--- a/src/FilterIterator.cpp Tue Mar 22 12:58:50 2011 -0500
+++ b/src/FilterIterator.cpp Tue Mar 22 15:55:30 2011 -0700
@@ -50,6 +50,12 @@
}
+FilterIterator::~FilterIterator()
+{
+ delete m_prevIterator;
+}
+
+
Iterator& FilterIterator::getPrevIterator()
{
return *m_prevIterator;
diff -r 15770dc2c858 -r b19b24391fd1 src/Iterator.cpp
--- a/src/Iterator.cpp Tue Mar 22 12:58:50 2011 -0500
+++ b/src/Iterator.cpp Tue Mar 22 15:55:30 2011 -0700
@@ -48,6 +48,12 @@
}
+Iterator::~Iterator()
+{
+ return;
+}
+
+
const Stage& Iterator::getStage() const
{
return m_stage;
diff -r 15770dc2c858 -r b19b24391fd1 src/Utils.cpp
--- a/src/Utils.cpp Tue Mar 22 12:58:50 2011 -0500
+++ b/src/Utils.cpp Tue Mar 22 15:55:30 2011 -0700
@@ -161,4 +161,21 @@
return boost::filesystem::file_size(file);
}
+
+char* Utils::getenv(const char* env)
+{
+ return ::getenv(env);
+}
+
+
+int Utils::putenv(const char* env)
+{
+#ifdef WIN32
+ return ::_putenv(env);
+#else
+ return ::putenv(env);
+#endif
+}
+
+
} // namespace libpc
diff -r 15770dc2c858 -r b19b24391fd1 src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp Tue Mar 22 12:58:50 2011 -0500
+++ b/src/drivers/oci/Writer.cpp Tue Mar 22 15:55:30 2011 -0700
@@ -41,6 +41,7 @@
#include <libpc/drivers/oci/Header.hpp>
#include <libpc/exceptions.hpp>
+#include <libpc/Utils.hpp>
#include <cstdlib>
#include <iostream>
@@ -1100,12 +1101,10 @@
if (debug)
{
- const char* gdal_debug = getenv("CPL_DEBUG");
+ const char* gdal_debug = Utils::getenv("CPL_DEBUG");
if (gdal_debug == 0)
{
- // FIXME: this leaks
- const std::string* d = new std::string("CPL_DEBUG=ON");
- putenv(const_cast<char*>(d->c_str()));
+ Utils::putenv("CPL_DEBUG=ON");
}
const char* gdal_debug2 = getenv("CPL_DEBUG");
diff -r 15770dc2c858 -r b19b24391fd1 src/filters/MosaicFilterIterator.cpp
--- a/src/filters/MosaicFilterIterator.cpp Tue Mar 22 12:58:50 2011 -0500
+++ b/src/filters/MosaicFilterIterator.cpp Tue Mar 22 15:55:30 2011 -0700
@@ -54,6 +54,16 @@
}
+MosaicFilterIterator::~MosaicFilterIterator()
+{
+ for (size_t i=0; i<m_prevIterators.size(); ++i)
+ {
+ Iterator* iter = m_prevIterators[i];
+ delete iter;
+ }
+}
+
+
const std::vector<Iterator*>& MosaicFilterIterator::getPrevIterators() const
{
return m_prevIterators;
diff -r 15770dc2c858 -r b19b24391fd1 test/unit/ColorFilterTest.cpp
--- a/test/unit/ColorFilterTest.cpp Tue Mar 22 12:58:50 2011 -0500
+++ b/test/unit/ColorFilterTest.cpp Tue Mar 22 15:55:30 2011 -0700
@@ -41,7 +41,7 @@
using namespace libpc;
-BOOST_AUTO_TEST_SUITE(ColorFilter)
+BOOST_AUTO_TEST_SUITE(ColorFilterTest)
BOOST_AUTO_TEST_CASE(test1)
{
diff -r 15770dc2c858 -r b19b24391fd1 test/unit/SchemaLayoutTest.cpp
--- a/test/unit/SchemaLayoutTest.cpp Tue Mar 22 12:58:50 2011 -0500
+++ b/test/unit/SchemaLayoutTest.cpp Tue Mar 22 15:55:30 2011 -0700
@@ -39,7 +39,7 @@
using namespace libpc;
-BOOST_AUTO_TEST_SUITE(SchemaTest)
+BOOST_AUTO_TEST_SUITE(SchemaLayoutTest)
BOOST_AUTO_TEST_CASE(test_layout)
{
More information about the Liblas-commits
mailing list