[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Aug 23 11:29:13 EDT 2010


changeset 51297e464542 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=51297e464542
summary: add Gary's latest

changeset cfa6c4f72c4d in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=cfa6c4f72c4d
summary: start on source cpack config

diffstat:

 CMakeLists.txt                   |  25 ++++++++++++++++++++-----
 src/detail/index/indexcell.cpp   |   4 ----
 src/detail/index/indexoutput.cpp |  36 +++++++++++++++++++++++++-----------
 3 files changed, 45 insertions(+), 20 deletions(-)

diffs (174 lines):

diff -r 7666f34417e4 -r cfa6c4f72c4d CMakeLists.txt
--- a/CMakeLists.txt	Mon Aug 23 10:24:40 2010 -0500
+++ b/CMakeLists.txt	Mon Aug 23 10:29:03 2010 -0500
@@ -8,11 +8,6 @@
 # libLAS general settings
 project(libLAS)
 
-# Version information
-SET(CPACK_PACKAGE_VERSION_MAJOR "1")
-SET(CPACK_PACKAGE_VERSION_MINOR "6")
-SET(CPACK_PACKAGE_VERSION_PATCH "0")
-
 if(WIN32)
     # Name of C++ library
     set(LIBLAS_LIB_NAME liblas)
@@ -298,3 +293,23 @@
     include(BuildOSGeo4W)
 endif(WIN32)
 
+
+
+# Version information
+SET(CPACK_PACKAGE_VERSION_MAJOR "1")
+SET(CPACK_PACKAGE_VERSION_MINOR "6")
+SET(CPACK_PACKAGE_VERSION_PATCH "0")
+
+SET(CPACK_SOURCE_GENERATOR "TGZ;ZIP;TBZ2")
+
+
+set(CPACK_SOURCE_PACKAGE_FILE_NAME
+  "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+
+set(CPACK_SOURCE_IGNORE_FILES
+  "/test/data/;/.hg/;~$;${CPACK_SOURCE_IGNORE_FILES}")
+
+include(CPack)
+
+
+add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
\ No newline at end of file
diff -r 7666f34417e4 -r cfa6c4f72c4d src/detail/index/indexcell.cpp
--- a/src/detail/index/indexcell.cpp	Mon Aug 23 10:24:40 2010 -0500
+++ b/src/detail/index/indexcell.cpp	Mon Aug 23 10:29:03 2010 -0500
@@ -41,13 +41,9 @@
  ****************************************************************************/
 
 #include <liblas/detail/index/indexcell.hpp>
-// boost
-#include <boost/cstdint.hpp>
-// std
 #include <cmath>
 #include <limits>
 
-using namespace boost;
 using namespace std;
 
 namespace liblas { namespace detail {
diff -r 7666f34417e4 -r cfa6c4f72c4d src/detail/index/indexoutput.cpp
--- a/src/detail/index/indexoutput.cpp	Mon Aug 23 10:24:40 2010 -0500
+++ b/src/detail/index/indexoutput.cpp	Mon Aug 23 10:29:03 2010 -0500
@@ -41,12 +41,8 @@
  ****************************************************************************/
 
 #include <liblas/detail/index/indexoutput.hpp>
-// boost
-#include <boost/cstdint.hpp>
-// std
 #include <limits>
 
-using namespace boost;
 using namespace std;
 
 namespace liblas { namespace detail {
@@ -64,7 +60,7 @@
 {
 
 	uint8_t VersionMajor = LIBLAS_INDEX_VERSIONMAJOR, VersionMinor = LIBLAS_INDEX_VERSIONMINOR;
-	char DestStr[512];
+	char DestStr[LIBLAS_INDEX_MAXSTRLEN];
 	uint16_t StringLen;
 	uint16_t WritePos = 0;
 	
@@ -73,23 +69,26 @@
 		m_indexVLRHeaderData.resize(16000);
 		m_indexVLRHeaderRecord.SetUserId("liblas");
 		m_indexVLRHeaderRecord.SetRecordId(42);
-		m_indexVLRHeaderRecord.SetDescription("LASLIB Index Header");
+		m_indexVLRHeaderRecord.SetDescription("LibLAS Index Header");
 		// set the header data into the header data string
 		// Index file version
 		WriteVLRData_n(m_indexVLRHeaderData, VersionMajor, WritePos);
 		WriteVLRData_n(m_indexVLRHeaderData, VersionMinor, WritePos);
 		// creator		
-		strcpy(DestStr, m_index->GetIndexAuthorStr());
+		strncpy(DestStr, m_index->GetIndexAuthorStr(), LIBLAS_INDEX_MAXSTRLEN - 1);
+		DestStr[LIBLAS_INDEX_MAXSTRLEN - 1] = 0;
 		StringLen = static_cast<uint16_t>(strlen(DestStr) + 1);
 		WriteVLRData_n(m_indexVLRHeaderData, StringLen, WritePos);
 		WriteVLRData_str(m_indexVLRHeaderData, DestStr, StringLen, WritePos);
 		// comment
-		strcpy(DestStr, m_index->GetIndexCommentStr());
+		strncpy(DestStr, m_index->GetIndexCommentStr(), LIBLAS_INDEX_MAXSTRLEN - 1);
+		DestStr[LIBLAS_INDEX_MAXSTRLEN - 1] = 0;
 		StringLen = static_cast<uint16_t>(strlen(DestStr) + 1);
 		WriteVLRData_n(m_indexVLRHeaderData, StringLen, WritePos);
 		WriteVLRData_str(m_indexVLRHeaderData, DestStr, StringLen, WritePos);
 		// date	
-		strcpy(DestStr, m_index->GetIndexDateStr());
+		strncpy(DestStr, m_index->GetIndexDateStr(), LIBLAS_INDEX_MAXSTRLEN - 1);
+		DestStr[LIBLAS_INDEX_MAXSTRLEN - 1] = 0;
 		StringLen = static_cast<uint16_t>(strlen(DestStr) + 1);
 		WriteVLRData_n(m_indexVLRHeaderData, StringLen, WritePos);
 		WriteVLRData_str(m_indexVLRHeaderData, DestStr, StringLen, WritePos);
@@ -133,7 +132,7 @@
 		m_FirstCellInVLR = true;
 		m_indexVLRCellRecord.SetUserId("liblas");
 		m_indexVLRCellRecord.SetRecordId(43);
-		m_indexVLRCellRecord.SetDescription("LASLIB Index Data");
+		m_indexVLRCellRecord.SetDescription("LibLAS Index Data");
 		
 		return true;
 	}
@@ -164,7 +163,8 @@
 		// or on the last cell in the index cell block
 		uint32_t SubCellsXY, SubCellsZ, NumPts, PtRecords;
 
-		if (NumPts = CellBlock->GetNumPoints())
+		NumPts = CellBlock->GetNumPoints();
+		if (NumPts)
 		{
 			// current cell, x, y
 			WriteVLRData_n(m_indexVLRTempData, x, m_TempWritePos);
@@ -200,6 +200,7 @@
 						MyPointIt != MyCellIt->second.end(); ++MyPointIt)
 					{
 						uint32_t PointID = MyPointIt->first;
+						assert(PointID < m_index->GetPointRecordsCount());
 						WriteVLRData_n(m_indexVLRTempData, PointID, m_TempWritePos);
 						uint8_t ConsecutivePts = MyPointIt->second;
 						WriteVLRData_n(m_indexVLRTempData, ConsecutivePts, m_TempWritePos);
@@ -221,6 +222,7 @@
 						MyPointIt != MyCellIt->second.end(); ++MyPointIt)
 					{
 						uint32_t PointID = MyPointIt->first;
+						assert(PointID < m_index->GetPointRecordsCount());
 						WriteVLRData_n(m_indexVLRTempData, PointID, m_TempWritePos);
 						uint8_t ConsecutivePts = MyPointIt->second;
 						WriteVLRData_n(m_indexVLRTempData, ConsecutivePts, m_TempWritePos);
@@ -233,6 +235,7 @@
 					MyPointIt != CellBlock->GetEnd(); ++MyPointIt)
 				{
 					uint32_t PointID = MyPointIt->first;
+					assert(PointID < m_index->GetPointRecordsCount());
 					WriteVLRData_n(m_indexVLRTempData, PointID, m_TempWritePos);
 					uint8_t ConsecutivePts = MyPointIt->second;
 					WriteVLRData_n(m_indexVLRTempData, ConsecutivePts, m_TempWritePos);
@@ -360,6 +363,17 @@
 		// if new cell data causes VLR data to exceed limit add VLR to header VLR list and start new VLR
 		if (m_SomeDataReadyToWrite)
 		{
+		#ifdef LIBLAS_INDEX_PADLASTVLR
+			uint32_t PadBytes = m_DataRecordSize % 4;
+			if (PadBytes && (m_DataRecordSize + PadBytes <= numeric_limits<unsigned short>::max()))
+			{
+				m_DataRecordSize += PadBytes;
+				for (uint32_t i = 0; i < PadBytes; ++i)
+				{
+					m_indexVLRCellPointData[m_DataRecordSize - i - 1] = 0;
+				} // for
+			} // if
+		#endif // LIBLAS_INDEX_PADLASTVLR
 			m_indexVLRCellPointData.resize(m_DataRecordSize);
 			m_indexVLRCellRecord.SetRecordLength(static_cast<uint16_t>(m_DataRecordSize));
 			m_indexVLRCellRecord.SetData(m_indexVLRCellPointData);


More information about the Liblas-commits mailing list