[Liblas-commits] hg: Made bigtest.c ANSI C program

liblas-commits at liblas.org liblas-commits at liblas.org
Sat Oct 30 15:53:44 EDT 2010


changeset b701def97f83 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=b701def97f83
summary: Made bigtest.c ANSI C program

diffstat:

 apps/bigtest.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r e1c899bc4a6f -r b701def97f83 apps/bigtest.c
--- a/apps/bigtest.c	Sat Oct 30 20:33:49 2010 +0100
+++ b/apps/bigtest.c	Sat Oct 30 20:53:30 2010 +0100
@@ -13,23 +13,26 @@
     LASHeaderH header = NULL;
     LASWriterH writer = NULL;
     LASReaderH reader = NULL;
+    LASPointH pt = NULL;
     LASError err;
     // Limitation about seeking past 4GB output size.  At 20 bytes / record, we
     // can successfully write 204 million records, but not 205.
     const unsigned long nMillionPoints = 205;
     const unsigned long NPOINTS = 1024*1024*nMillionPoints ;
     const char * OutputName = "Issue147.las";
+    unsigned long i = 0;
+    unsigned long npoints = 0;
 
     // Write a LAS file and after the points are in, update the header.
     header = LASHeader_Create();
     writer = LASWriter_Create(OutputName, header, LAS_MODE_WRITE);
-    for (unsigned long i = 0; i < NPOINTS; i++)
+    
+    for (i = 0; i < NPOINTS; i++)
     {
-      double percentDone = ((double)i)/NPOINTS * 100.0;
       if (i % 1000 == 0)
-         printf("\b\b\b\b\b\b\b%6.2f%%", percentDone);
+         printf("\b\b\b\b\b\b\b%6.2f%%", ((double)i)/NPOINTS * 100.0);
       
-      LASPointH pt = LASPoint_Create();
+      pt = LASPoint_Create();
       err = LASPoint_SetX(pt, 0);
       if (err) printf ("For point %lu, failed to set point value X\n", i);
       err = LASPoint_SetY(pt, 0);
@@ -50,6 +53,6 @@
    // Read the file we just wrote and check the header data.
     reader = LASReader_Create(OutputName);
     header = LASReader_GetHeader(reader);
-    unsigned long npoints = LASHeader_GetPointRecordsCount(header);
+    npoints = LASHeader_GetPointRecordsCount(header);
     printf ("\n\nWrote %lu, Read %lu (testing %lu Million (1024 x 1024) Points)\n", NPOINTS, npoints, nMillionPoints);
 }


More information about the Liblas-commits mailing list