[Liblas-commits] r1328 - branches/1.2/src/detail

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Jul 31 21:42:08 EDT 2009


Author: hobu
Date: Fri Jul 31 21:42:08 2009
New Revision: 1328
URL: http://liblas.org/changeset/1328

Log:
fix writers to ensure they actually add header buffer when there isn't room

Modified:
   branches/1.2/src/detail/writer10.cpp
   branches/1.2/src/detail/writer11.cpp
   branches/1.2/src/detail/writer12.cpp

Modified: branches/1.2/src/detail/writer10.cpp
==============================================================================
--- branches/1.2/src/detail/writer10.cpp	(original)
+++ branches/1.2/src/detail/writer10.cpp	Fri Jul 31 21:42:08 2009
@@ -213,7 +213,7 @@
     
     int32_t difference = WriteVLR(header);
     if (difference < 0) {
-        header.SetDataOffset(header.GetDataOffset() + difference );
+        header.SetDataOffset(header.GetDataOffset() + abs(difference) );
         WriteVLR(header);
     }
     

Modified: branches/1.2/src/detail/writer11.cpp
==============================================================================
--- branches/1.2/src/detail/writer11.cpp	(original)
+++ branches/1.2/src/detail/writer11.cpp	Fri Jul 31 21:42:08 2009
@@ -213,8 +213,8 @@
     // it returns is the number of bytes we must increase the header
     // by in order for it to contain the VLRs.
     int32_t difference = WriteVLR(header);
-    if (difference != 0) {
-        header.SetDataOffset(header.GetDataOffset() + difference);
+    if (difference < 0) {
+        header.SetDataOffset(header.GetDataOffset() + abs(difference) );
         WriteVLR(header);
     }
 

Modified: branches/1.2/src/detail/writer12.cpp
==============================================================================
--- branches/1.2/src/detail/writer12.cpp	(original)
+++ branches/1.2/src/detail/writer12.cpp	Fri Jul 31 21:42:08 2009
@@ -215,8 +215,8 @@
     // it returns is the number of bytes we must increase the header
     // by in order for it to contain the VLRs.
     int32_t difference = WriteVLR(header);
-    if (difference != 0) {
-        header.SetDataOffset(header.GetDataOffset() + difference);
+    if (difference < 0) {
+        header.SetDataOffset(header.GetDataOffset() + abs(difference) );
         WriteVLR(header);
     }
 


More information about the Liblas-commits mailing list