]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: Cleaned up coding style of test suite
authorTill Kamppeter <till.kamppeter@gmail.com>
Tue, 11 Oct 2022 22:25:06 +0000 (00:25 +0200)
committerTill Kamppeter <till.kamppeter@gmail.com>
Tue, 11 Oct 2022 22:25:06 +0000 (00:25 +0200)
Cleaned up the coding style of the test programs run by "make check".

- Converted comments from "/* ... */" to "// ..."

- Suppressed warnings of unused return values of fgets() and fread(), via
  "fread(...);" -> "if (fread(...));"

cupsfilters/test1284.c
cupsfilters/testcmyk.c
cupsfilters/testdither.c
cupsfilters/testimage.c
cupsfilters/testrgb.c

index 6568f7f23cd4bac10c038e7aefd46b85dbd5d502..4bf2c9ba098a511e0ed98f1171741044dd6a236c 100644 (file)
@@ -1,22 +1,22 @@
-/*
- *   IEEE-1284 support functions test program for OpenPrinting CUPS Filters.
- *
- *   Copyright 2007-2011 by Apple Inc.
- *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
- *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "COPYING"
- *   which should have been included with this file.
- *
- * Contents:
- *
- *   main() - Test the device-ID functions.
- */
+//
+//   IEEE-1284 support functions test program for OpenPrinting CUPS Filters.
+//
+//   Copyright 2007-2011 by Apple Inc.
+//   Copyright 1997-2006 by Easy Software Products, all rights reserved.
+//
+//   These coded instructions, statements, and computer programs are the
+//   property of Apple Inc. and are protected by Federal copyright
+//   law.  Distribution and use rights are outlined in the file "COPYING"
+//   which should have been included with this file.
+//
+// Contents:
+//
+//   main() - Test the device-ID functions.
+//
 
-/*
- * Include necessary headers.
- */
+//
+// Include necessary headers.
+//
 
 #include <config.h>
 #include <string.h>
 #else
 #  include <unistd.h>
 #  include <fcntl.h>
-#endif /* WIN32 */
+#endif // WIN32
 
 #include <cupsfilters/ieee1284.h>
 
 
-/*
- * 'main()' - Test the device-ID functions.
- */
+//
+// 'main()' - Test the device-ID functions.
+//
 
-int                                    /* O - Exit status */
-main(int  argc,                                /* I - Number of command-line args */
-     char *argv[])                     /* I - Command-line arguments */
+int                                    // O - Exit status
+main(int  argc,                                // I - Number of command-line args
+     char *argv[])                     // I - Command-line arguments
 {
-  int  i,                              /* Looping var */
-       fd;                             /* File descriptor */
-  char device_id[1024],                /* 1284 device ID string */
-       make_model[1024],               /* make-and-model string */
-       uri[1024];                      /* URI string */
+  int  i,                              // Looping var
+       fd;                             // File descriptor
+  char device_id[1024],                // 1284 device ID string
+       make_model[1024],               // make-and-model string
+       uri[1024];                      // URI string
 
 
   if (argc < 2)
@@ -64,7 +64,7 @@ main(int  argc,                               /* I - Number of command-line args */
     printf("%s:\n", argv[i]);
 
     cfIEEE1284GetDeviceID(fd, device_id, sizeof(device_id), make_model,
-                       sizeof(make_model), "test", uri, sizeof(uri));
+                         sizeof(make_model), "test", uri, sizeof(uri));
 
     printf("    device_id=\"%s\"\n", device_id);
     printf("    make_model=\"%s\"\n", make_model);
index 93c734c12bb6f8c28ce1c67ac7f612e138e27852..4d7f270d139cd1d121ad4efeb7e27920c811c570 100644 (file)
@@ -1,24 +1,24 @@
-/*
- *   Test the CMYK color separation code for CUPS.
- *
- *   Copyright 2007-2011 by Apple Inc.
- *   Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
- *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "COPYING"
- *   which should have been included with this file.
- *
- * Contents:
- *
- *   test_gray() - Test grayscale separations...
- *   test_rgb()  - Test color separations...
- *   main()      - Do color separation tests.
- */
-
-/*
- * Include necessary headers.
- */
+//
+//   Test the CMYK color separation code for libcupsfilters.
+//
+//   Copyright 2007-2011 by Apple Inc.
+//   Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
+//
+//   These coded instructions, statements, and computer programs are the
+//   property of Apple Inc. and are protected by Federal copyright
+//   law.  Distribution and use rights are outlined in the file "COPYING"
+//   which should have been included with this file.
+//
+// Contents:
+//
+//   test_gray() - Test grayscale separations...
+//   test_rgb()  - Test color separations...
+//   main()      - Do color separation tests.
+
+
+//
+// Include necessary headers.
+
 
 #include <config.h>
 #include <string.h>
 #include "driver.h"
 #include <sys/stat.h>
 
-cf_logfunc_t logfunc = cfCUPSLogFunc;    /* Log function */
-void             *ld = NULL;                /* Log function data */
+cf_logfunc_t logfunc = cfCUPSLogFunc;    // Log function
+void         *ld = NULL;                 // Log function data
 
 void   test_gray(int num_comps, const char *basename);
 void   test_rgb(int num_comps, const char *basename);
 
 
-/*
- * 'main()' - Do color separation tests.
- */
+//
+// 'main()' - Do color separation tests.
+//
 
-int                                            /* O - Exit status */
-main(int  argc,                                        /* I - Number of command-line arguments */
-     char *argv[])                             /* I - Command-line arguments */
+int                            // O - Exit status
+main(int  argc,                        // I - Number of command-line arguments
+     char *argv[])             // I - Command-line arguments
 {
- /*
-  * Make the test directory...
-  */
+  //
+  // Make the test directory...
+  //
 
   mkdir("test", 0755);
 
- /*
-  * Run tests for K, Kk, CMY, CMYK, CcMmYK, and CcMmYKk separations...
-  */
+  //
+  // Run tests for K, Kk, CMY, CMYK, CcMmYK, and CcMmYKk separations...
+  //
 
   test_rgb(1, "test/K-rgb");
   test_rgb(2, "test/Kk-rgb");
@@ -65,41 +65,41 @@ main(int  argc,                                     /* I - Number of command-line arguments */
   test_gray(6, "test/CcMmYK-gray");
   test_gray(7, "test/CcMmYKk-gray");
 
- /*
-  * Return with no errors...
-  */
+  //
+  // Return with no errors...
+  //
 
   return (0);
 }
 
 
-/*
- * 'test_gray()' - Test grayscale separations...
- */
+//
+// 'test_gray()' - Test grayscale separations...
+//
 
 void
-test_gray(int        num_comps,                /* I - Number of components */
-         const char *basename)         /* I - Base filename of output */
+test_gray(int        num_comps,                // I - Number of components
+         const char *basename)         // I - Base filename of output
 {
-  int                  i;              /* Looping var */
-  char                 filename[255];  /* Output filename */
-  char                 line[255];      /* Line from PGM file */
-  int                  width, height;  /* Width and height of test image */
-  int                  x, y;           /* Current coordinate in image */
-  int                  r, g, b;        /* Current RGB color */
-  unsigned char                input[7000];    /* Line to separate */
-  short                        output[48000],  /* Output separation data */
-                       *outptr;        /* Pointer in output */
-  FILE                 *in;            /* Input PPM file */
+  int                  i;              // Looping var
+  char                 filename[255];  // Output filename
+  char                 line[255];      // Line from PGM file
+  int                  width, height;  // Width and height of test image
+  int                  x, y;           // Current coordinate in image
+  int                  r, g, b;        // Current RGB color
+  unsigned char                input[7000];    // Line to separate
+  short                        output[48000],  // Output separation data
+                       *outptr;        // Pointer in output
+  FILE                 *in;            // Input PPM file
   FILE                 *out[CF_MAX_CHAN];
-                                       /* Output PGM files */
-  FILE                 *comp;          /* Composite output */
-  cf_cmyk_t            *cmyk;          /* Color separation */
+                                       // Output PGM files
+  FILE                 *comp;          // Composite output
+  cf_cmyk_t            *cmyk;          // Color separation
 
 
- /*
-  * Open the test image...
-  */
+  //
+  // Open the test image...
+  //
 
   in = fopen("image.pgm", "rb");
   while (fgets(line, sizeof(line), in) != NULL)
@@ -108,17 +108,17 @@ test_gray(int        num_comps,           /* I - Number of components */
 
   sscanf(line, "%d%d", &width, &height);
 
-  fgets(line, sizeof(line), in);
+  if (fgets(line, sizeof(line), in)); // Ignore return value of fgets()
 
- /*
-  * Create the color separation...
-  */
+  //
+  // Create the color separation...
+  //
 
   cmyk = cfCMYKNew(num_comps);
 
   switch (num_comps)
   {
-    case 2 : /* Kk */
+    case 2 : // Kk
         cfCMYKSetLtDk(cmyk, 0, 0.5, 1.0, logfunc, ld);
        break;
 
@@ -127,14 +127,14 @@ test_gray(int        num_comps,           /* I - Number of components */
         cfCMYKSetBlack(cmyk, 0.5, 1.0, logfunc, ld);
        break;
 
-    case 6 : /* CcMmYK */
+    case 6 : // CcMmYK
         cfCMYKSetLtDk(cmyk, 0, 0.5, 1.0, logfunc, ld);
         cfCMYKSetLtDk(cmyk, 2, 0.5, 1.0, logfunc, ld);
        cfCMYKSetGamma(cmyk, 4, 1.0, 0.9, logfunc, ld);
         cfCMYKSetBlack(cmyk, 0.5, 1.0, logfunc, ld);
        break;
 
-    case 7 : /* CcMmYKk */
+    case 7 : // CcMmYKk
         cfCMYKSetLtDk(cmyk, 0, 0.5, 1.0, logfunc, ld);
         cfCMYKSetLtDk(cmyk, 2, 0.5, 1.0, logfunc, ld);
        cfCMYKSetGamma(cmyk, 4, 1.0, 0.9, logfunc, ld);
@@ -142,9 +142,9 @@ test_gray(int        num_comps,             /* I - Number of components */
        break;
   }
 
- /*
-  * Open the color separation files...
-  */
+  //
+  // Open the color separation files...
+  //
 
   for (i = 0; i < num_comps; i ++)
   {
@@ -159,13 +159,13 @@ test_gray(int        num_comps,           /* I - Number of components */
 
   fprintf(comp, "P6\n%d %d 255\n", width, height);
 
- /*
-  * Read the image and do the separations...
-  */
+  //
+  // Read the image and do the separations...
+  //
 
   for (y = 0; y < height; y ++)
   {
-    fread(input, width, 1, in);
+    if (fread(input, width, 1, in)); // Ignore return value of fread()
 
     cfCMYKDoGray(cmyk, input, output, width);
 
@@ -255,33 +255,33 @@ test_gray(int        num_comps,           /* I - Number of components */
 }
 
 
-/*
- * 'test_rgb()' - Test color separations...
- */
+//
+// 'test_rgb()' - Test color separations...
+//
 
 void
-test_rgb(int        num_comps,         /* I - Number of components */
-        const char *basename)          /* I - Base filename of output */
+test_rgb(int        num_comps,         // I - Number of components
+        const char *basename)          // I - Base filename of output
 {
-  int                  i;              /* Looping var */
-  char                 filename[255];  /* Output filename */
-  char                 line[255];      /* Line from PPM file */
-  int                  width, height;  /* Width and height of test image */
-  int                  x, y;           /* Current coordinate in image */
-  int                  r, g, b;        /* Current RGB color */
-  unsigned char                input[7000];    /* Line to separate */
-  short                        output[48000],  /* Output separation data */
-                       *outptr;        /* Pointer in output */
-  FILE                 *in;            /* Input PPM file */
+  int                  i;              // Looping var
+  char                 filename[255];  // Output filename
+  char                 line[255];      // Line from PPM file
+  int                  width, height;  // Width and height of test image
+  int                  x, y;           // Current coordinate in image
+  int                  r, g, b;        // Current RGB color
+  unsigned char                input[7000];    // Line to separate
+  short                        output[48000],  // Output separation data
+                       *outptr;        // Pointer in output
+  FILE                 *in;            // Input PPM file
   FILE                 *out[CF_MAX_CHAN];
-                                       /* Output PGM files */
-  FILE                 *comp;          /* Composite output */
-  cf_cmyk_t            *cmyk;          /* Color separation */
+                                       // Output PGM files
+  FILE                 *comp;          // Composite output
+  cf_cmyk_t            *cmyk;          // Color separation
 
 
- /*
-  * Open the test image...
-  */
+  //
+  // Open the test image...
+  //
 
   in = fopen("image.ppm", "rb");
   while (fgets(line, sizeof(line), in) != NULL)
@@ -290,11 +290,11 @@ test_rgb(int        num_comps,            /* I - Number of components */
 
   sscanf(line, "%d%d", &width, &height);
 
-  fgets(line, sizeof(line), in);
+  if (fgets(line, sizeof(line), in)); // Ignore return value of fgets()
 
- /*
-  * Create the color separation...
-  */
+  //
+  // Create the color separation...
+  //
 
   cmyk = cfCMYKNew(num_comps);
 
@@ -302,16 +302,16 @@ test_rgb(int        num_comps,            /* I - Number of components */
 
   switch (num_comps)
   {
-    case 2 : /* Kk */
+    case 2 : // Kk
         cfCMYKSetLtDk(cmyk, 0, 0.5, 1.0, logfunc, ld);
        break;
-    case 6 : /* CcMmYK */
+    case 6 : // CcMmYK
        cfCMYKSetGamma(cmyk, 0, 1.0, 0.8, logfunc, ld);
         cfCMYKSetLtDk(cmyk, 0, 0.5, 1.0, logfunc, ld);
        cfCMYKSetGamma(cmyk, 2, 1.0, 0.8, logfunc, ld);
         cfCMYKSetLtDk(cmyk, 2, 0.5, 1.0, logfunc, ld);
        break;
-    case 7 : /* CcMmYKk */
+    case 7 : // CcMmYKk
        cfCMYKSetGamma(cmyk, 0, 1.0, 0.8, logfunc, ld);
         cfCMYKSetLtDk(cmyk, 0, 0.5, 1.0, logfunc, ld);
        cfCMYKSetGamma(cmyk, 2, 1.0, 0.8, logfunc, ld);
@@ -320,9 +320,9 @@ test_rgb(int        num_comps,              /* I - Number of components */
        break;
   }
 
- /*
-  * Open the color separation files...
-  */
+  //
+  // Open the color separation files...
+  //
 
   for (i = 0; i < num_comps; i ++)
   {
@@ -337,13 +337,13 @@ test_rgb(int        num_comps,            /* I - Number of components */
 
   fprintf(comp, "P6\n%d %d 255\n", width, height);
 
- /*
-  * Read the image and do the separations...
-  */
+  //
+  // Read the image and do the separations...
+  //
 
   for (y = 0; y < height; y ++)
   {
-    fread(input, width, 3, in);
+    if (fread(input, width, 3, in)); // Ignore return value of fread()
 
     cfCMYKDoRGB(cmyk, input, output, width);
 
@@ -431,4 +431,3 @@ test_rgb(int        num_comps,              /* I - Number of components */
 
   cfCMYKDelete(cmyk);
 }
-
index 6b334795c6f9bda75100c5a54a0b16a7aa92e389..140bc0ad48c0ff093cfea3d68d87559ba886b7a4 100644 (file)
@@ -1,78 +1,78 @@
-/*
- *   Dither test program for CUPS.
- *
- *   Try the following:
- *
- *       testdither 0 255 > filename.ppm
- *       testdither 0 127 255 > filename.ppm
- *       testdither 0 85 170 255 > filename.ppm
- *       testdither 0 63 127 170 198 227 255 > filename.ppm
- *       testdither 0 210 383 > filename.ppm
- *       testdither 0 82 255 > filename.ppm
- *
- *   Copyright 2007-2011 by Apple Inc.
- *   Copyright 1993-2005 by Easy Software Products.
- *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "COPYING"
- *   which should have been included with this file.
- *
- * Contents:
- *
- *   main()  - Test dithering and output a PPM file.
- *   usage() - Show program usage...
- */
-
-/*
- * Include necessary headers.
- */
+//
+//   Dither test program for libcupsfilters.
+//
+//   Try the following:
+//
+//       testdither 0 255 > filename.ppm
+//       testdither 0 127 255 > filename.ppm
+//       testdither 0 85 170 255 > filename.ppm
+//       testdither 0 63 127 170 198 227 255 > filename.ppm
+//       testdither 0 210 383 > filename.ppm
+//       testdither 0 82 255 > filename.ppm
+//
+//   Copyright 2007-2011 by Apple Inc.
+//   Copyright 1993-2005 by Easy Software Products.
+//
+//   These coded instructions, statements, and computer programs are the
+//   property of Apple Inc. and are protected by Federal copyright
+//   law.  Distribution and use rights are outlined in the file "COPYING"
+//   which should have been included with this file.
+//
+// Contents:
+//
+//   main()  - Test dithering and output a PPM file.
+//   usage() - Show program usage...
+//
+
+//
+// Include necessary headers.
+//
 
 #include "driver.h"
 #include <config.h>
 #include <string.h>
 #include <ctype.h>
 
-cf_logfunc_t logfunc = cfCUPSLogFunc;    /* Log function */
-void             *ld = NULL;                /* Log function data */
+cf_logfunc_t logfunc = cfCUPSLogFunc;    // Log function
+void         *ld = NULL;                 // Log function data
 
 
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
 
 void   usage(void);
 
 
-/*
- * 'main()' - Test dithering and output a PPM file.
- */
+//
+// 'main()' - Test dithering and output a PPM file.
+//
 
-int                            /* O - Exit status */
-main(int  argc,                        /* I - Number of command-line arguments */
-     char *argv[])             /* I - Command-line arguments */
+int                            // O - Exit status
+main(int  argc,                        // I - Number of command-line arguments
+     char *argv[])             // I - Command-line arguments
 {
-  int          x, y;           /* Current coordinate in image */
-  short                line[512];      /* Line to dither */
-  unsigned char        pixels[512],    /* Dither pixels */
-               *pixptr;        /* Pointer in line */
-  int          output;         /* Output pixel */
-  cf_lut_t     *lut;           /* Dither lookup table */
-  cf_dither_t  *dither;        /* Dither state */
-  int          nlutvals;       /* Number of lookup values */
-  float                lutvals[16];    /* Lookup values */
-  int          pixvals[16];    /* Pixel values */
-
-
- /*
-  * See if we have lookup table values on the command-line...
-  */
+  int          x, y;           // Current coordinate in image
+  short                line[512];      // Line to dither
+  unsigned char        pixels[512],    // Dither pixels
+               *pixptr;        // Pointer in line
+  int          output;         // Output pixel
+  cf_lut_t     *lut;           // Dither lookup table
+  cf_dither_t  *dither;        // Dither state
+  int          nlutvals;       // Number of lookup values
+  float                lutvals[16];    // Lookup values
+  int          pixvals[16];    // Pixel values
+
+
+  //
+  // See if we have lookup table values on the command-line...
+  //
 
   if (argc > 1)
   {
-   /*
-    * Yes, collect them...
-    */
+    //
+    // Yes, collect them...
+    //
 
     nlutvals = 0;
 
@@ -86,18 +86,18 @@ main(int  argc,                     /* I - Number of command-line arguments */
       else
         usage();
 
-   /*
-    * See if we have at least 2 values...
-    */
+    //
+    // See if we have at least 2 values...
+    //
 
     if (nlutvals < 2)
       usage();
   }
   else
   {
-   /*
-    * Otherwise use the default 2-entry LUT with values of 0 and 255...
-    */
+    //
+    // Otherwise use the default 2-entry LUT with values of 0 and 255...
+    //
 
     nlutvals   = 2;
     lutvals[0] = 0.0;
@@ -106,35 +106,35 @@ main(int  argc,                   /* I - Number of command-line arguments */
     pixvals[1] = 255;
   }
 
- /*
-  * Create the lookup table and dither state...
-  */
+  //
+  // Create the lookup table and dither state...
+  //
 
   lut    = cfLutNew(nlutvals, lutvals, logfunc, ld);
   dither = cfDitherNew(512);
 
- /*
-  * Put out the PGM header for a raw 256x256x8-bit grayscale file...
-  */
+  //
+  // Put out the PGM header for a raw 256x256x8-bit grayscale file...
+  //
 
   puts("P5\n512\n512\n255");
 
- /*
-  * Dither 512 lines, which are written out in 256 image lines...
-  */
+  //
+  // Dither 512 lines, which are written out in 256 image lines...
+  //
 
   for (y = 0; y < 512; y ++)
   {
-   /*
-    * Create the grayscale data for the current line...
-    */
+    //
+    // Create the grayscale data for the current line...
+    //
 
     for (x = 0; x < 512; x ++)
       line[x] = 4095 * ((y / 32) * 16 + x / 32) / 255;
 
-   /*
-    * Dither the line...
-    */
+    //
+    // Dither the line...
+    //
 
     cfDitherLine(dither, lut, line, 1, pixels);
 
@@ -146,9 +146,9 @@ main(int  argc,                     /* I - Number of command-line arguments */
       fputs("\n", stderr);
     }
 
-   /*
-    * Add or set the output pixel values...
-    */
+    //
+    // Add or set the output pixel values...
+    //
 
     for (x = 0, pixptr = pixels; x < 512; x ++, pixptr ++)
     {
@@ -161,24 +161,24 @@ main(int  argc,                   /* I - Number of command-line arguments */
     }
   }
 
- /*
-  * Free the dither state and lookup table...
-  */
+  //
+  // Free the dither state and lookup table...
+  //
 
   cfDitherDelete(dither);
   cfLutDelete(lut);
 
- /*
-  * Return with no errors...
-  */
+  //
+  // Return with no errors...
+  //
 
   return (0);
 }
 
 
-/*
- * 'usage()' - Show program usage...
- */
+//
+// 'usage()' - Show program usage...
+//
 
 void
 usage(void)
@@ -186,4 +186,3 @@ usage(void)
   puts("Usage: testdither [val1 val2 [... val16]] >filename.ppm");
   exit(1);
 }
-
index fef92af7083e20ac704e115f036d4ab2b38b905d..8a378e632d00e26157163e42de23ebe0b60a352b 100644 (file)
@@ -1,42 +1,42 @@
-/*
- *   Image library test program for CUPS.
- *
- *   Copyright 2007-2011 by Apple Inc.
- *   Copyright 1993-2006 by Easy Software Products.
- *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "COPYING"
- *   which should have been included with this file.
- *
- * Contents:
- *
- *   main() - Main entry...
- */
-
-/*
- * Include necessary headers...
- */
+//
+//   Image library test program for libcupsfilters.
+//
+//   Copyright 2007-2011 by Apple Inc.
+//   Copyright 1993-2006 by Easy Software Products.
+//
+//   These coded instructions, statements, and computer programs are the
+//   property of Apple Inc. and are protected by Federal copyright
+//   law.  Distribution and use rights are outlined in the file "COPYING"
+//   which should have been included with this file.
+//
+// Contents:
+//
+//   main() - Main entry...
+//
+
+//
+// Include necessary headers...
+//
 
 #include "image.h"
 
 
-/*
- * 'main()' - Main entry...
- */
+//
+// 'main()' - Main entry...
+//
 
-int                                    /* O - Exit status */
-main(int  argc,                                /* I - Number of command-line arguments */
-     char *argv[])                     /* I - Command-line arguments */
+int                                    // O - Exit status
+main(int  argc,                                // I - Number of command-line arguments
+     char *argv[])                     // I - Command-line arguments
 {
-  cf_image_t           *img;           /* Image to print */
-  cf_icspace_t primary;        /* Primary image colorspace */
-  FILE                 *out;           /* Output PPM/PGM file */
-  cf_ib_t              *line;          /* Line from file */
-  int                  y,              /* Current line */
-                       width,          /* Width of image */
-                       height,         /* Height of image */
-                       depth;          /* Depth of image */
+  cf_image_t           *img;           // Image to print
+  cf_icspace_t         primary;        // Primary image colorspace
+  FILE                 *out;           // Output PPM/PGM file
+  cf_ib_t              *line;          // Line from file
+  int                  y,              // Current line
+                       width,          // Width of image
+                       height,         // Height of image
+                       depth;          // Depth of image
 
 
   if (argc != 3)
@@ -87,4 +87,3 @@ main(int  argc,                               /* I - Number of command-line arguments */
 
   return (0);
 }
-
index 4051ecb9f33ca98586242c0f837a1dd6a20bb3a3..43a64d0b7f554fa04d4b9e987d6db6af718e5079 100644 (file)
@@ -1,24 +1,24 @@
-/*
- *   Test the new RGB color separation code for CUPS.
- *
- *   Copyright 2007-2011 by Apple Inc.
- *   Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
- *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "COPYING"
- *   which should have been included with this file.
- *
- * Contents:
- *
- *   main()       - Do color rgb tests.
- *   test_gray()  - Test grayscale rgbs...
- *   test_rgb()   - Test color rgbs...
- */
-
-/*
- * Include necessary headers.
- */
+//
+//   Test the new RGB color separation code for libcupsfilters.
+//
+//   Copyright 2007-2011 by Apple Inc.
+//   Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
+//
+//   These coded instructions, statements, and computer programs are the
+//   property of Apple Inc. and are protected by Federal copyright
+//   law.  Distribution and use rights are outlined in the file "COPYING"
+//   which should have been included with this file.
+//
+// Contents:
+//
+//   main()       - Do color rgb tests.
+//   test_gray()  - Test grayscale rgbs...
+//   test_rgb()   - Test color rgbs...
+//
+
+//
+// Include necessary headers.
+//
 
 #include <config.h>
 #include <string.h>
@@ -28,7 +28,7 @@
 
 #ifdef USE_LCMS1
 #  include <lcms.h>
-#endif /* USE_LCMS1 */
+#endif // USE_LCMS1
 
 
 void   test_gray(cf_sample_t *samples, int num_samples,
@@ -38,17 +38,17 @@ void        test_rgb(cf_sample_t *samples, int num_samples,
                 const char *basename);
 
 
-/*
- * 'main()' - Do color rgb tests.
- */
+//
+// 'main()' - Do color rgb tests.
+//
 
-int                                            /* O - Exit status */
-main(int  argc,                                        /* I - Number of command-line arguments */
-     char *argv[])                             /* I - Command-line arguments */
+int                                    // O - Exit status
+main(int  argc,                                // I - Number of command-line arguments
+     char *argv[])                     // I - Command-line arguments
 {
-  static cf_sample_t   CMYK[] =                /* Basic 4-color sep */
+  static cf_sample_t   CMYK[] =        // Basic 4-color sep
                        {
-                         /*{ r,   g,   b   }, { C,   M,   Y,   K   }*/
+                         //{ r,   g,   b   }, { C,   M,   Y,   K   }
                          { { 0,   0,   0   }, { 0,   0,   0,   255 } },
                          { { 255, 0,   0   }, { 0,   255, 240, 0   } },
                          { { 0,   255, 0   }, { 200, 0,   200, 0   } },
@@ -60,58 +60,58 @@ main(int  argc,                                     /* I - Number of command-line arguments */
                        };
 
 
- /*
-  * Make the test directory...
-  */
+  //
+  // Make the test directory...
+  //
 
   mkdir("test", 0755);
 
- /*
-  * Run tests for CMYK and CMYK separations...
-  */
+  //
+  // Run tests for CMYK and CMYK separations...
+  //
 
   test_rgb(CMYK, 8, 2, 4, "test/rgb-cmyk");
 
   test_gray(CMYK, 8, 2, 4, "test/gray-cmyk");
 
- /*
-  * Return with no errors...
-  */
+  //
+  // Return with no errors...
+  //
 
   return (0);
 }
 
 
-/*
- * 'test_gray()' - Test grayscale rgbs...
- */
+//
+// 'test_gray()' - Test grayscale rgbs...
+//
 
 void
-test_gray(cf_sample_t *samples,        /* I - Sample values */
-          int           num_samples,   /* I - Number of samples */
-         int           cube_size,      /* I - Cube size */
-          int           num_comps,     /* I - Number of components */
-         const char    *basename)      /* I - Base filename of output */
+test_gray(cf_sample_t   *samples,      // I - Sample values
+          int           num_samples,   // I - Number of samples
+         int           cube_size,      // I - Cube size
+          int           num_comps,     // I - Number of components
+         const char    *basename)      // I - Base filename of output
 {
-  int                  i;              /* Looping var */
-  char                 filename[255];  /* Output filename */
-  char                 line[255];      /* Line from PPM file */
-  int                  width, height;  /* Width and height of test image */
-  int                  x, y;           /* Current coordinate in image */
-  int                  r, g, b;        /* Current RGB color */
-  unsigned char                input[7000];    /* Line to rgbarate */
-  unsigned char                output[48000],  /* Output rgb data */
-                       *outptr;        /* Pointer in output */
-  FILE                 *in;            /* Input PPM file */
+  int                  i;              // Looping var
+  char                 filename[255];  // Output filename
+  char                 line[255];      // Line from PPM file
+  int                  width, height;  // Width and height of test image
+  int                  x, y;           // Current coordinate in image
+  int                  r, g, b;        // Current RGB color
+  unsigned char                input[7000];    // Line to rgbarate
+  unsigned char                output[48000],  // Output rgb data
+                       *outptr;        // Pointer in output
+  FILE                 *in;            // Input PPM file
   FILE                 *out[CF_MAX_CHAN];
-                                       /* Output PGM files */
-  FILE                 *comp;          /* Composite output */
-  cf_rgb_t             *rgb;           /* Color separation */
+                                       // Output PGM files
+  FILE                 *comp;          // Composite output
+  cf_rgb_t             *rgb;           // Color separation
 
 
- /*
-  * Open the test image...
-  */
+  //
+  // Open the test image...
+  //
 
   in = fopen("image.pgm", "rb");
   while (fgets(line, sizeof(line), in) != NULL)
@@ -120,17 +120,17 @@ test_gray(cf_sample_t *samples,   /* I - Sample values */
 
   sscanf(line, "%d%d", &width, &height);
 
-  fgets(line, sizeof(line), in);
+  if (fgets(line, sizeof(line), in)); // Ignore return value of fgets()
 
- /*
-  * Create the color rgb...
-  */
+  //
+  // Create the color rgb...
+  //
 
   rgb = cfRGBNew(num_samples, samples, cube_size, num_comps);
 
- /*
-  * Open the color rgb files...
-  */
+  //
+  // Open the color rgb files...
+  //
 
   for (i = 0; i < num_comps; i ++)
   {
@@ -145,13 +145,13 @@ test_gray(cf_sample_t *samples,   /* I - Sample values */
 
   fprintf(comp, "P6\n%d %d 255\n", width, height);
 
- /*
-  * Read the image and do the rgbs...
-  */
+  //
+  // Read the image and do the rgbs...
+  //
 
   for (y = 0; y < height; y ++)
   {
-    fread(input, width, 1, in);
+    if (fread(input, width, 1, in)); // Ignore return value of fread()
 
     cfRGBDoGray(rgb, input, output, width);
 
@@ -212,36 +212,36 @@ test_gray(cf_sample_t *samples,   /* I - Sample values */
 }
 
 
-/*
- * 'test_rgb()' - Test color rgbs...
- */
+//
+// 'test_rgb()' - Test color rgbs...
+//
 
 void
-test_rgb(cf_sample_t *samples, /* I - Sample values */
-         int           num_samples,    /* I - Number of samples */
-        int           cube_size,       /* I - Cube size */
-         int           num_comps,      /* I - Number of components */
-        const char    *basename)       /* I - Base filename of output */
+test_rgb(cf_sample_t   *samples,       // I - Sample values
+         int           num_samples,    // I - Number of samples
+        int           cube_size,       // I - Cube size
+         int           num_comps,      // I - Number of components
+        const char    *basename)       // I - Base filename of output
 {
-  int                  i;              /* Looping var */
-  char                 filename[255];  /* Output filename */
-  char                 line[255];      /* Line from PPM file */
-  int                  width, height;  /* Width and height of test image */
-  int                  x, y;           /* Current coordinate in image */
-  int                  r, g, b;        /* Current RGB color */
-  unsigned char                input[7000];    /* Line to rgbarate */
-  unsigned char                output[48000],  /* Output rgb data */
-                       *outptr;        /* Pointer in output */
-  FILE                 *in;            /* Input PPM file */
+  int                  i;              // Looping var
+  char                 filename[255];  // Output filename
+  char                 line[255];      // Line from PPM file
+  int                  width, height;  // Width and height of test image
+  int                  x, y;           // Current coordinate in image
+  int                  r, g, b;        // Current RGB color
+  unsigned char                input[7000];    // Line to rgbarate
+  unsigned char                output[48000],  // Output rgb data
+                       *outptr;        // Pointer in output
+  FILE                 *in;            // Input PPM file
   FILE                 *out[CF_MAX_CHAN];
-                                       /* Output PGM files */
-  FILE                 *comp;          /* Composite output */
-  cf_rgb_t             *rgb;           /* Color separation */
+                                       // Output PGM files
+  FILE                 *comp;          // Composite output
+  cf_rgb_t             *rgb;           // Color separation
 
 
- /*
-  * Open the test image...
-  */
+  //
+  // Open the test image...
+  //
 
   in = fopen("image.ppm", "rb");
   while (fgets(line, sizeof(line), in) != NULL)
@@ -250,17 +250,17 @@ test_rgb(cf_sample_t *samples,    /* I - Sample values */
 
   sscanf(line, "%d%d", &width, &height);
 
-  fgets(line, sizeof(line), in);
+  if (fgets(line, sizeof(line), in)); // Ignore return value of fgets()
 
- /*
-  * Create the color rgb...
-  */
+  //
+  // Create the color rgb...
+  //
 
   rgb = cfRGBNew(num_samples, samples, cube_size, num_comps);
 
- /*
-  * Open the color rgb files...
-  */
+  //
+  // Open the color rgb files...
+  //
 
   for (i = 0; i < num_comps; i ++)
   {
@@ -275,13 +275,13 @@ test_rgb(cf_sample_t *samples,    /* I - Sample values */
 
   fprintf(comp, "P6\n%d %d 255\n", width, height);
 
- /*
-  * Read the image and do the rgbs...
-  */
+  //
+  // Read the image and do the rgbs...
+  //
 
   for (y = 0; y < height; y ++)
   {
-    fread(input, width, 3, in);
+    if (fread(input, width, 3, in)); // Ignore return value of fread()
 
     cfRGBDoRGB(rgb, input, output, width);
 
@@ -340,4 +340,3 @@ test_rgb(cf_sample_t *samples,      /* I - Sample values */
 
   cfRGBDelete(rgb);
 }
-