[Liblas-commits] hg: fix problems with indexing off by one (#189)
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Oct 5 18:48:19 EDT 2010
changeset fb0f410f7183 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=fb0f410f7183
summary: fix problems with indexing off by one (#189)
diffstat:
include/liblas/detail/utility.hpp | 2 +-
src/laspoint.cpp | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diffs (40 lines):
diff -r b1f8f5367a6b -r fb0f410f7183 include/liblas/detail/utility.hpp
--- a/include/liblas/detail/utility.hpp Tue Oct 05 23:01:58 2010 +0100
+++ b/include/liblas/detail/utility.hpp Tue Oct 05 18:47:53 2010 -0400
@@ -380,7 +380,7 @@
#if defined(LIBLAS_BIG_ENDIAN)
for (boost::uint32_t n = 0; n < sizeof( result ); n++)
#else
- for (boost::int32_t n = sizeof( result ); n >= 0; n--)
+ for (boost::int32_t n = sizeof( result )-1; n >= 0; n--)
#endif
result = (result << 8) +data[ n + index ];
return result;
diff -r b1f8f5367a6b -r fb0f410f7183 src/laspoint.cpp
--- a/src/laspoint.cpp Tue Oct 05 23:01:58 2010 +0100
+++ b/src/laspoint.cpp Tue Oct 05 18:47:53 2010 -0400
@@ -704,7 +704,7 @@
std::vector<boost::uint8_t>::size_type pos = GetDimensionPosition("Time");
const boost::uint8_t* x_b = reinterpret_cast<const boost::uint8_t*>(&t);
#if defined(LIBLAS_BIG_ENDIAN)
- for (boost::int32_t n = sizeof( double ); n >= 0; n--)
+ for (boost::int32_t n = sizeof( double )-1; n >= 0; n--)
#else
for (boost::uint32_t n = 0; n < sizeof( double ); n++)
#endif
@@ -721,13 +721,13 @@
#if defined(LIBLAS_BIG_ENDIAN)
for (boost::uint32_t n = 0; n < sizeof( double ); n++)
#else
- for (boost::int32_t n = sizeof( double ); n >= 0; n--)
+ for (boost::int32_t n = sizeof( double )-1; n >= 0; n--)
#endif
data[n] = m_format_data[pos+n];
const double* output = reinterpret_cast<const double*>(data);
double out = *output;
- delete data;
+ delete[] data;
return out;
}
More information about the Liblas-commits
mailing list