]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/hpgl-vector.c
Merge changes from CUPS 1.5svn-r8950.
[thirdparty/cups.git] / filter / hpgl-vector.c
index d285b0c1487b35a3ac77e0656f9b0aca0a5646de..fdf8664a4ca326b2eea22b7b971684d541e98937 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: hpgl-vector.c 4494 2005-02-18 02:18:11Z mike $"
+ * "$Id: hpgl-vector.c 6649 2007-07-11 21:46:42Z mike $"
  *
  *   HP-GL/2 vector routines for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 1993-2005 by Easy Software Products.
+ *   Copyright 2007-2008 by Apple Inc.
+ *   Copyright 1993-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  *   This file is subject to the Apple OS-Developed Software exception.
  *
@@ -402,13 +393,20 @@ PE_polyline_encoded(int     num_params,   /* I - Number of parameters */
           break;
       case ':' :       /* Select pen */
           s ++;
-          PenNumber = (int)decode_number(&s, base_bits, 1.0);
+          temp = (int)decode_number(&s, base_bits, 1.0) - 1;
+         if (temp < 0 || temp >= PenCount)
+         {
+           fprintf(stderr, "DEBUG: Bad pen number %d in PE\n", temp + 1);
+           return;
+         }
+
+          PenNumber = temp;
 
 #ifdef DEBUG
-          fprintf(stderr, "DEBUG:     set pen #%d\n", PenNumber);
+          fprintf(stderr, "DEBUG:     set pen #%d\n", PenNumber + 1);
 #endif /* DEBUG */
 
-          Outputf("%% PE: set pen #%d\n", PenNumber);
+          Outputf("%% PE: set pen #%d\n", PenNumber + 1);
 
          if (PageDirty)
            printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0],
@@ -635,7 +633,7 @@ decode_number(unsigned char **s,    /* IO - String to decode */
       else if (**s < 63)
       {
         if (**s != '\r' && **s != '\n')
-          fprintf(stderr, "ERROR: Bad PE character 0x%02X!\n", **s);
+          fprintf(stderr, "DEBUG: Bad PE character 0x%02X!\n", **s);
 
         continue;
       }
@@ -677,7 +675,7 @@ decode_number(unsigned char **s,    /* IO - String to decode */
       else if (**s < 63)
       {
         if (**s != '\r' && **s != '\n')
-          fprintf(stderr, "ERROR: Bad PE character 0x%02X!\n", **s);
+          fprintf(stderr, "DEBUG: Bad PE character 0x%02X!\n", **s);
 
         continue;
       }
@@ -771,5 +769,5 @@ plot_points(int     num_params,     /* I - Number of parameters */
 
 
 /*
- * End of "$Id: hpgl-vector.c 4494 2005-02-18 02:18:11Z mike $".
+ * End of "$Id: hpgl-vector.c 6649 2007-07-11 21:46:42Z mike $".
  */