[Pkg-cups-devel] r395 - in cupsys/branches/cups-1.2-ubuntu/debian: . patches

Martin Pitt mpitt at costa.debian.org
Thu Oct 5 08:33:23 UTC 2006


Author: mpitt
Date: Thu Oct  5 08:33:22 2006
New Revision: 395

Added:
   cupsys/branches/cups-1.2-ubuntu/debian/patches/00_dsc-comment-encoding.dpatch   (contents, props changed)
Modified:
   cupsys/branches/cups-1.2-ubuntu/debian/changelog
   cupsys/branches/cups-1.2-ubuntu/debian/patches/00list

Log:
* Add debian/patches/00_dsc-comment-encoding.dpatch:
  - Fix printing of jobs with invalid/misinterpreted characters in the name.
  - Patch taken from upstream SVN, thanks to Till Kamppeter for porting it
    to 1.2.4. (STR#1988)
  - Closes: LP#57445

Modified: cupsys/branches/cups-1.2-ubuntu/debian/changelog
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/changelog	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/changelog	Thu Oct  5 08:33:22 2006
@@ -2,8 +2,13 @@
 
   * debian/rules: Do not install http/ipp backend with 0700 permissions
     (regression from 1.2.4-2). Closes: LP#63707
+  * Add debian/patches/00_dsc-comment-encoding.dpatch:
+    - Fix printing of jobs with invalid/misinterpreted characters in the name.
+    - Patch taken from upstream SVN, thanks to Till Kamppeter for porting it
+      to 1.2.4. (STR#1988)
+    - Closes: LP#57445
 
- -- Martin Pitt <martin.pitt at ubuntu.com>  Thu,  5 Oct 2006 10:29:01 +0200
+ -- Martin Pitt <martin.pitt at ubuntu.com>  Thu,  5 Oct 2006 10:30:24 +0200
 
 cupsys (1.2.4-2ubuntu1) edgy; urgency=low
 

Added: cupsys/branches/cups-1.2-ubuntu/debian/patches/00_dsc-comment-encoding.dpatch
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2-ubuntu/debian/patches/00_dsc-comment-encoding.dpatch	Thu Oct  5 08:33:22 2006
@@ -0,0 +1,242 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 00_dsc-comment-encoding.dpatch by  <martin.pitt at ubuntu.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad cups-1.2-ubuntu~/filter/common.c cups-1.2-ubuntu/filter/common.c
+--- cups-1.2-ubuntu~/filter/common.c	2005-02-18 03:18:11.000000000 +0100
++++ cups-1.2-ubuntu/filter/common.c	2006-10-05 10:22:47.000000000 +0200
+@@ -28,6 +28,7 @@
+  *   SetCommonOptions() - Set common filter options for media size,
+  *                        etc.
+  *   UpdatePageVars()   - Update the page variables for the orientation.
++ *   WriteComment()     - Write a DSC comment.
+  *   WriteCommon()      - Write common procedures...
+  *   WriteLabelProlog() - Write the prolog with the classification
+  *                        and page label.
+@@ -46,30 +47,31 @@
+  * Globals...
+  */
+ 
+-int	Orientation = 0,	/* 0 = portrait, 1 = landscape, etc. */
+-	Duplex = 0,		/* Duplexed? */
+-	LanguageLevel = 1,	/* Language level of printer */
+-	ColorDevice = 1;	/* Do color text? */
+-float	PageLeft = 18.0f,	/* Left margin */
+-	PageRight = 594.0f,	/* Right margin */
+-	PageBottom = 36.0f,	/* Bottom margin */
+-	PageTop = 756.0f,	/* Top margin */
+-	PageWidth = 612.0f,	/* Total page width */
+-	PageLength = 792.0f;	/* Total page length */
++int	Orientation = 0,		/* 0 = portrait, 1 = landscape, etc. */
++	Duplex = 0,			/* Duplexed? */
++	LanguageLevel = 1,		/* Language level of printer */
++	ColorDevice = 1;		/* Do color text? */
++float	PageLeft = 18.0f,		/* Left margin */
++	PageRight = 594.0f,		/* Right margin */
++	PageBottom = 36.0f,		/* Bottom margin */
++	PageTop = 756.0f,		/* Top margin */
++	PageWidth = 612.0f,		/* Total page width */
++	PageLength = 792.0f;		/* Total page length */
+ 
+ 
+ /*
+  * 'SetCommonOptions()' - Set common filter options for media size, etc.
+  */
+ 
+-ppd_file_t *					/* O - PPD file */
+-SetCommonOptions(int           num_options,	/* I - Number of options */
+-                 cups_option_t *options,	/* I - Options */
+-		 int           change_size)	/* I - Change page size? */
++ppd_file_t *				/* O - PPD file */
++SetCommonOptions(
++    int           num_options,		/* I - Number of options */
++    cups_option_t *options,		/* I - Options */
++    int           change_size)		/* I - Change page size? */
+ {
+-  ppd_file_t	*ppd;		/* PPD file */
+-  ppd_size_t	*pagesize;	/* Current page size */
+-  const char	*val;		/* Option value */
++  ppd_file_t	*ppd;			/* PPD file */
++  ppd_size_t	*pagesize;		/* Current page size */
++  const char	*val;			/* Option value */
+ 
+ 
+ #ifdef LC_TIME
+@@ -227,7 +229,7 @@
+ void
+ UpdatePageVars(void)
+ {
+-  float		temp;		/* Swapping variable */
++  float		temp;			/* Swapping variable */
+ 
+ 
+   switch (Orientation & 3)
+@@ -467,5 +469,76 @@
+ 
+ 
+ /*
++ * 'WriteTextComment()' - Write a DSC text comment.
++ */
++
++void
++WriteTextComment(const char *name,	/* I - Comment name ("Title", etc.) */
++                 const char *value)	/* I - Comment value */
++{
++  int	len;				/* Current line length */
++
++
++ /*
++  * DSC comments are of the form:
++  *
++  *   %%name: value
++  *
++  * The name and value must be limited to 7-bit ASCII for most printers,
++  * so we escape all non-ASCII and ASCII control characters as described
++  * in the Adobe Document Structuring Conventions specification.
++  */
++
++  printf("%%%%%s: (", name);
++  len = 5 + strlen(name);
++
++  while (*value)
++  {
++    if (*value < ' ' || *value >= 127)
++    {
++     /*
++      * Escape this character value...
++      */
++
++      if (len >= 251)			/* Keep line < 254 chars */
++        break;
++
++      printf("\\%03o", *value & 255);
++      len += 4;
++    }
++    else if (*value == '\\')
++    {
++     /*
++      * Escape the backslash...
++      */
++
++      if (len >= 253)			/* Keep line < 254 chars */
++        break;
++
++      putchar('\\');
++      putchar('\\');
++      len += 2;
++    }
++    else
++    {
++     /*
++      * Put this character literally...
++      */
++
++      if (len >= 254)			/* Keep line < 254 chars */
++        break;
++
++      putchar(*value);
++      len ++;
++    }
++
++    value ++;
++  }
++
++  puts(")");
++}
++
++
++/*
+  * End of "$Id: common.c 4494 2005-02-18 02:18:11Z mike $".
+  */
+diff -urNad cups-1.2-ubuntu~/filter/common.h cups-1.2-ubuntu/filter/common.h
+--- cups-1.2-ubuntu~/filter/common.h	2005-02-18 03:09:53.000000000 +0100
++++ cups-1.2-ubuntu/filter/common.h	2006-10-05 10:22:47.000000000 +0200
+@@ -3,7 +3,7 @@
+  *
+  *   Common filter definitions for the Common UNIX Printing System (CUPS).
+  *
+- *   Copyright 1997-2005 by Easy Software Products.
++ *   Copyright 1997-2006 by Easy Software Products.
+  *
+  *   These coded instructions, statements, and computer programs are the
+  *   property of Easy Software Products and are protected by Federal
+@@ -76,6 +76,7 @@
+ extern void	WriteLabelProlog(const char *label, float bottom,
+ 		                 float top, float width);
+ extern void	WriteLabels(int orient);
++extern void	WriteTextComment(const char *name, const char *value);
+ 
+ 
+ /*
+diff -urNad cups-1.2-ubuntu~/filter/hpgl-prolog.c cups-1.2-ubuntu/filter/hpgl-prolog.c
+--- cups-1.2-ubuntu~/filter/hpgl-prolog.c	2005-09-21 11:28:39.000000000 +0200
++++ cups-1.2-ubuntu/filter/hpgl-prolog.c	2006-10-05 10:22:47.000000000 +0200
+@@ -70,8 +70,8 @@
+   puts("%%Creator: hpgltops/" CUPS_SVERSION);
+   strftime(line, sizeof(line), "%c", curtm);
+   printf("%%%%CreationDate: %s\n", line);
+-  printf("%%%%Title: %s\n", title);
+-  printf("%%%%For: %s\n", user);
++  WriteTextComment("Title", title);
++  WriteTextComment("For", user);
+   printf("%%cupsRotation: %d\n", (Orientation & 3) * 90);
+   puts("%%EndComments");
+   puts("%%BeginProlog");
+diff -urNad cups-1.2-ubuntu~/filter/imagetops.c cups-1.2-ubuntu/filter/imagetops.c
+--- cups-1.2-ubuntu~/filter/imagetops.c	2006-04-07 15:48:37.000000000 +0200
++++ cups-1.2-ubuntu/filter/imagetops.c	2006-10-05 10:22:47.000000000 +0200
+@@ -609,8 +609,8 @@
+   puts("%%Creator: imagetops/" CUPS_SVERSION);
+   strftime(curdate, sizeof(curdate), "%c", curtm);
+   printf("%%%%CreationDate: %s\n", curdate);
+-  printf("%%%%Title: %s\n", argv[3]);
+-  printf("%%%%For: %s\n", argv[2]);
++  WriteTextComment("Title", argv[3]);
++  WriteTextComment("For", argv[2]);
+   if (Orientation & 1)
+     puts("%%Orientation: Landscape");
+   else
+diff -urNad cups-1.2-ubuntu~/filter/pstops.c cups-1.2-ubuntu/filter/pstops.c
+--- cups-1.2-ubuntu~/filter/pstops.c	2006-08-24 21:53:17.000000000 +0200
++++ cups-1.2-ubuntu/filter/pstops.c	2006-10-05 10:22:47.000000000 +0200
+@@ -666,10 +666,10 @@
+     fputs("ERROR: No %%Pages: comment in header!\n", stderr);
+ 
+   if (!saw_for)
+-    printf("%%%%For: %s\n", doc->user);
++    WriteTextComment("For", doc->user);
+ 
+   if (!saw_title)
+-    printf("%%%%Title: %s\n", doc->title);
++    WriteTextComment("Title", doc->title);
+ 
+   if (doc->copies != 1 && (!doc->collate || !doc->slow_collate))
+   {
+@@ -946,8 +946,8 @@
+   else
+     puts("%%Pages: 1");
+ 
+-  printf("%%%%For: %s\n", doc->user);
+-  printf("%%%%Title: %s\n", doc->title);
++  WriteTextComment("For", doc->user);
++  WriteTextComment("Title", doc->title);
+ 
+   if (doc->copies != 1 && (!doc->collate || !doc->slow_collate))
+   {
+diff -urNad cups-1.2-ubuntu~/filter/texttops.c cups-1.2-ubuntu/filter/texttops.c
+--- cups-1.2-ubuntu~/filter/texttops.c	2005-09-21 11:28:39.000000000 +0200
++++ cups-1.2-ubuntu/filter/texttops.c	2006-10-05 10:22:47.000000000 +0200
+@@ -208,8 +208,8 @@
+   printf("%%cupsRotation: %d\n", (Orientation & 3) * 90);
+   puts("%%Creator: texttops/" CUPS_SVERSION);
+   printf("%%%%CreationDate: %s\n", curdate);
+-  printf("%%%%Title: %s\n", title);
+-  printf("%%%%For: %s\n", user);
++  WriteTextComment("Title", title);
++  WriteTextComment("For", user);
+   puts("%%Pages: (atend)");
+ 
+  /*

Modified: cupsys/branches/cups-1.2-ubuntu/debian/patches/00list
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/patches/00list	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/patches/00list	Thu Oct  5 08:33:22 2006
@@ -1,3 +1,4 @@
+00_dsc-comment-encoding.dpatch
 02_configure.dpatch
 #03_manext.dpatch
 03_clean.dpatch



More information about the Pkg-cups-devel mailing list