[Liblas-commits] hg: make Cleanup methods save to call multiple times

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Jan 18 11:58:54 EST 2011


details:   http://hg.liblas.orghg/rev/82b078bee898
changeset: 2775:82b078bee898
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Jan 18 10:58:35 2011 -0600
description:
make Cleanup methods save to call multiple times
Subject: hg: use size_type for iteration, not size_t

details:   http://hg.liblas.orghg/rev/77d092db4f1a
changeset: 2776:77d092db4f1a
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Jan 18 10:58:47 2011 -0600
description:
use size_type for iteration, not size_t

diffstat:

 include/liblas/liblas.hpp |  2 ++
 src/c_api.cpp             |  2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diffs (31 lines):

diff -r db7de8b00d68 -r 77d092db4f1a include/liblas/liblas.hpp
--- a/include/liblas/liblas.hpp	Tue Jan 18 10:52:44 2011 -0600
+++ b/include/liblas/liblas.hpp	Tue Jan 18 10:58:47 2011 -0600
@@ -165,6 +165,7 @@
 {
     // An ofstream is closeable and deletable, but 
     // an ostream like &std::cout isn't.
+    if (!ofs) return;
     if (static_cast<std::ofstream&>(*ofs))
     {
         static_cast<std::ofstream&>(*ofs).close();
@@ -176,6 +177,7 @@
 {
     // An ifstream is closeable and deletable, but 
     // an istream like &std::cin isn't.
+    if (!ifs) return;
     if (static_cast<std::ifstream&>(*ifs))
     {
         static_cast<std::ifstream&>(*ifs).close();
diff -r db7de8b00d68 -r 77d092db4f1a src/c_api.cpp
--- a/src/c_api.cpp	Tue Jan 18 10:52:44 2011 -0600
+++ b/src/c_api.cpp	Tue Jan 18 10:58:47 2011 -0600
@@ -169,7 +169,7 @@
 
 LAS_DLL void LASError_Reset(void) {
     if (errors.empty()) return;
-    for (std::size_t i=0;i<errors.size();i++) errors.pop();
+    for (std::stack<liblas::Error >::size_type i=0;i<errors.size();i++) errors.pop();
 }
 
 LAS_DLL void LASError_Pop(void) {


More information about the Liblas-commits mailing list