Update build.
[asdcplib.git] / src / kmfilegen.cpp
index 38387a8c739864152b184707068e4af57d51601d..487f67ac0132ec25b36e41e01030741d94f346a6 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2006, John Hurst
+Copyright (c) 2005-2008, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 using namespace Kumu;
 
 // constants
-static const char* PACKAGE = "kmfilegen";  // program name for messages
+static const char* PROGRAM_NAME = "kmfilegen";  // program name for messages
 const ui32_t RNG_KEY_SIZE = 16;
 const ui32_t RNG_KEY_SIZE_BITS = 128;
 const ui32_t RNG_BLOCK_SIZE = 16;
@@ -69,12 +69,12 @@ banner(FILE* stream = stdout)
 {
   fprintf(stream, "\n\
 %s (asdcplib %s)\n\n\
-Copyright (c) 2005-2006 John Hurst\n\
+Copyright (c) 2005-2008 John Hurst\n\
 %s is part of the asdcplib DCP tools package.\n\
 asdcplib may be copied only under the terms of the license found at\n\
 the top of every file in the asdcplib distribution kit.\n\n\
 Specify the -h (help) option for further information about %s\n\n",
-         PACKAGE, ASDCP::Version(), PACKAGE, PACKAGE);
+         PROGRAM_NAME, ASDCP::Version(), PROGRAM_NAME, PROGRAM_NAME);
 }
 
 
@@ -102,7 +102,7 @@ USAGE: %s [-c <file-size>] [-v] <output-file>\n\
 \n\
   NOTES: o There is no option grouping, all options must be distinct arguments.\n\
          o All option arguments must be separated from the option by whitespace.\n\
-\n", PACKAGE, PACKAGE, PACKAGE, PACKAGE);
+\n", PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME);
 }
 
 enum MajorMode_t {
@@ -299,7 +299,7 @@ CreateLargeFile(CommandOptions& Options)
   FB.Capacity(Megabyte);
   assert(FB.Capacity() == Megabyte);
 
-  fprintf(stderr, "Writing %lu chunks:\n", Options.chunk_count);
+  fprintf(stderr, "Writing %u chunks:\n", Options.chunk_count);
   s_Nonce = Options.chunk_count;
   Result_t result = Writer.OpenWrite(Options.filename);
 
@@ -312,7 +312,7 @@ CreateLargeFile(CommandOptions& Options)
          CTR.FillRandom(FB.Data() + CTR.WriteSize(), Megabyte - CTR.WriteSize());
          result = Writer.Write(FB.RoData(), Megabyte, &write_count);
          assert(write_count == Megabyte);
-         fprintf(stderr, "\r%8lu ", ++write_total);
+         fprintf(stderr, "\r%8u ", ++write_total);
        }
     }
   
@@ -411,7 +411,7 @@ ReadValidateWriteLargeFile(CommandOptions& Options)
        {
          if ( read_count < Megabyte )
            {
-             fprintf(stderr, "Read() returned short buffer: %lu\n", read_count);
+             fprintf(stderr, "Read() returned short buffer: %u\n", read_count);
              result = RESULT_FAIL;
            }
 
@@ -421,7 +421,7 @@ ReadValidateWriteLargeFile(CommandOptions& Options)
            {
              result = Writer.Write(FB.RoData(), Megabyte, &write_count);
              assert(write_count == Megabyte);
-             fprintf(stderr, "\r%8lu ", ++write_total);
+             fprintf(stderr, "\r%8u ", ++write_total);
            }
        }
       else if ( result == RESULT_ENDOFFILE )
@@ -461,7 +461,7 @@ ValidateLargeFile(CommandOptions& Options)
 
       if ( read_count < Megabyte )
        {
-         fprintf(stderr, "Read() returned short buffer: %lu\n", read_count);
+         fprintf(stderr, "Read() returned short buffer: %u\n", read_count);
          result = RESULT_FAIL;
        }
       else if ( KM_SUCCESS(result) )
@@ -469,7 +469,7 @@ ValidateLargeFile(CommandOptions& Options)
 
       if ( KM_SUCCESS(result) )
        {
-         fprintf(stderr, "Validating %lu chunk%s in %s order:\n",
+         fprintf(stderr, "Validating %u chunk%s in %s order:\n",
                  check_total, (check_total == 1 ? "" : "s"), Options.order);
          assert(read_list == 0);
          read_list = (read_list_t*)malloc(check_total * sizeof(read_list_t));
@@ -510,7 +510,7 @@ ValidateLargeFile(CommandOptions& Options)
            read_list_i < check_total && KM_SUCCESS(result);
            read_list_i++ )
        {
-         fprintf(stderr, "\r%8lu [%8lu] ", read_list_i+1, read_list[read_list_i]);
+         fprintf(stderr, "\r%8u [%8u] ", read_list_i+1, read_list[read_list_i].nonce);
          result = Reader.Seek(read_list[read_list_i].position);
 
          if ( KM_SUCCESS(result) )
@@ -521,7 +521,7 @@ ValidateLargeFile(CommandOptions& Options)
 
          else if ( read_count < Megabyte )
            {
-             fprintf(stderr, "Read() returned short buffer: %lu\n", read_count);
+             fprintf(stderr, "Read() returned short buffer: %u\n", read_count);
              result = RESULT_FAIL;
            }
          else if ( KM_SUCCESS(result) )
@@ -530,7 +530,7 @@ ValidateLargeFile(CommandOptions& Options)
              
              if ( nonce != read_list[read_list_i].nonce )
                {
-                 fprintf(stderr, "Nonce mismatch: expecting %lu, got %lu\n",
+                 fprintf(stderr, "Nonce mismatch: expecting %u, got %u\n",
                          nonce, read_list[read_list_i].nonce);
 
                  return RESULT_FAIL;
@@ -547,7 +547,7 @@ ValidateLargeFile(CommandOptions& Options)
        result = RESULT_OK;
       else
        {
-         fprintf(stderr, "Unexpected chunk count, got %lu, wanted %lu\n",
+         fprintf(stderr, "Unexpected chunk count, got %u, wanted %u\n",
                  read_list_i, check_total);
          result = RESULT_FAIL;
        }
@@ -574,7 +574,7 @@ main(int argc, const char **argv)
 
   if ( Options.error_flag )
     {
-      fprintf(stderr, "There was a problem. Type %s -h for help.\n", PACKAGE);
+      fprintf(stderr, "There was a problem. Type %s -h for help.\n", PROGRAM_NAME);
       return 3;
     }