Re: [LOW] STR #4006: Update all usage of "dpc" to "dpcm" to match current PWG recommendations

Michael Sweet <[email protected]>
Newsgroups gmane.comp.printing.cups.bugs
Message-ID <[email protected]>
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Closed w/Resolution]

Fixed in Subversion repository.

Link: http://www.cups.org/str.php?L4006
Version: 1.6-current
Fix Version: 1.6-current (r10299)

_______________________________________________
cups-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/cups-bugs
str4006.patch (text/plain, 10.6 KB)
Index: cups/dest-options.c
===================================================================
--- cups/dest-options.c	(revision 10298)
+++ cups/dest-options.c	(revision 10299)
@@ -187,7 +187,7 @@
 
           if (!strcmp(temp, "dpi"))
             units_value = IPP_RES_PER_INCH;
-          else if (!strcmp(temp, "dpc"))
+          else if (!strcmp(temp, "dpc") || !strcmp(temp, "dpcm"))
             units_value = IPP_RES_PER_CM;
           else
             return (0);
Index: cups/ipp-support.c
===================================================================
--- cups/ipp-support.c	(revision 10298)
+++ cups/ipp-support.c	(revision 10299)
@@ -3,7 +3,7 @@
  *
  *   Internet Printing Protocol support functions for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -487,12 +487,12 @@
             bufptr += snprintf(bufptr, bufend - bufptr + 1, "%dx%d%s",
                                val->resolution.xres, val->resolution.yres,
                                val->resolution.units == IPP_RES_PER_INCH ?
-                                   "dpi" : "dpc");
+                                   "dpi" : "dpcm");
           else
             bufptr += snprintf(temp, sizeof(temp), "%dx%d%s",
                                val->resolution.xres, val->resolution.yres,
                                val->resolution.units == IPP_RES_PER_INCH ?
-                                   "dpi" : "dpc");
+                                   "dpi" : "dpcm");
           break;
 
       case IPP_TAG_DATE :
Index: cups/encode.c
===================================================================
--- cups/encode.c	(revision 10298)
+++ cups/encode.c	(revision 10299)
@@ -3,7 +3,7 @@
  *
  *   Option encoding routines for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -539,7 +539,8 @@
 	    else
 	      attr->values[j].resolution.yres = attr->values[j].resolution.xres;
 
-	    if (!_cups_strcasecmp(s, "dpc"))
+	    if (!_cups_strcasecmp(s, "dpc") ||
+	        !_cups_strcasecmp(s, "dpcm"))
               attr->values[j].resolution.units = IPP_RES_PER_CM;
             else
               attr->values[j].resolution.units = IPP_RES_PER_INCH;
Index: cups/testipp.c
===================================================================
--- cups/testipp.c	(revision 10298)
+++ cups/testipp.c	(revision 10299)
@@ -3,7 +3,7 @@
  *
  *   IPP test program for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 1997-2005 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -901,7 +901,7 @@
       case IPP_TAG_RESOLUTION :
           for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
 	    printf(" %dx%d%s", val->resolution.xres, val->resolution.yres,
-	           val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpc");
+	           val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
           putchar('\n');
           break;
 
Index: test/ipptool.c
===================================================================
--- test/ipptool.c	(revision 10298)
+++ test/ipptool.c	(revision 10299)
@@ -1608,7 +1608,9 @@
 	        }
 
 	        if (ptr <= token || xres <= 0 || yres <= 0 || !ptr ||
-	            (_cups_strcasecmp(ptr, "dpi") && _cups_strcasecmp(ptr, "dpc") &&
+	            (_cups_strcasecmp(ptr, "dpi") &&
+	             _cups_strcasecmp(ptr, "dpc") &&
+	             _cups_strcasecmp(ptr, "dpcm") &&
 	             _cups_strcasecmp(ptr, "other")))
 	        {
 	          print_fatal_error("Bad resolution value \"%s\" on line %d.",
@@ -1620,7 +1622,8 @@
 	        if (!_cups_strcasecmp(ptr, "dpi"))
 	          attrptr = ippAddResolution(request, group, attr, IPP_RES_PER_INCH,
 	                                     xres, yres);
-	        else if (!_cups_strcasecmp(ptr, "dpc"))
+	        else if (!_cups_strcasecmp(ptr, "dpc") ||
+	                 !_cups_strcasecmp(ptr, "dpcm"))
 	          attrptr = ippAddResolution(request, group, attr, IPP_RES_PER_CM,
 	                                     xres, yres);
 	        else
@@ -2501,8 +2504,8 @@
 	  {
 	    int out_of_order = 0;	/* Are attribute groups out-of-order? */
 	    cupsArrayClear(a);
-	    
 
+
             switch (attrptr->group_tag)
             {
               case IPP_TAG_ZERO :
@@ -2639,7 +2642,7 @@
 		  add_stringf(errors, "EXPECTED: %s OF-TYPE %s (got %s)",
 			      expect->name, expect->of_type,
 			      ippTagString(found->value_tag));
-    
+
 		if (expect->in_group && found->group_tag != expect->in_group)
 		  add_stringf(errors, "EXPECTED: %s IN-GROUP %s (got %s).",
 			      expect->name, ippTagString(expect->in_group),
@@ -3273,7 +3276,9 @@
 	      char	units[6];	/* Units */
 
 	      if (sscanf(token, "%dx%d%5s", &xres, &yres, units) != 3 ||
-		  (_cups_strcasecmp(units, "dpi") && _cups_strcasecmp(units, "dpc") &&
+		  (_cups_strcasecmp(units, "dpi") &&
+		   _cups_strcasecmp(units, "dpc") &&
+		   _cups_strcasecmp(units, "dpcm") &&
 		   _cups_strcasecmp(units, "other")))
 	      {
 		print_fatal_error("Bad resolution value \"%s\" on line %d.",
@@ -3284,7 +3289,8 @@
 	      if (!_cups_strcasecmp(units, "dpi"))
 		ippAddResolution(col, IPP_TAG_ZERO, attr, xres, yres,
 		                 IPP_RES_PER_INCH);
-	      else if (!_cups_strcasecmp(units, "dpc"))
+	      else if (!_cups_strcasecmp(units, "dpc") ||
+	               !_cups_strcasecmp(units, "dpcm"))
 		ippAddResolution(col, IPP_TAG_ZERO, attr, xres, yres,
 		                 IPP_RES_PER_CM);
 	      else
@@ -3679,12 +3685,12 @@
 		     attr->values[i].resolution.xres,
 		     attr->values[i].resolution.yres,
 		     attr->values[i].resolution.units == IPP_RES_PER_INCH ?
-			 "dpi" : "dpc");
+			 "dpi" : "dpcm");
 	    else
 	      printf("%dx%d%s ", attr->values[i].resolution.xres,
 		     attr->values[i].resolution.yres,
 		     attr->values[i].resolution.units == IPP_RES_PER_INCH ?
-			 "dpi" : "dpc");
+			 "dpi" : "dpcm");
 	  break;
 
       case IPP_TAG_DATE :
@@ -3831,7 +3837,7 @@
 	    printf("%dx%d%s ", attr->values[i].resolution.xres,
 		   attr->values[i].resolution.yres,
 		   attr->values[i].resolution.units == IPP_RES_PER_INCH ?
-		       "dpi" : "dpc");
+		       "dpi" : "dpcm");
 	  break;
 
       case IPP_TAG_STRING :
@@ -4554,7 +4560,7 @@
 			attr->values[i].resolution.units ==
 			    IPP_RES_PER_INCH ? "dpi" :
 			    attr->values[i].resolution.units ==
-				IPP_RES_PER_CM ? "dpc" : "unknown");
+				IPP_RES_PER_CM ? "dpcm" : "unknown");
 	  }
 
 	  if (attr->values[i].resolution.yres <= 0)
@@ -4570,7 +4576,7 @@
 			attr->values[i].resolution.units ==
 			    IPP_RES_PER_INCH ? "dpi" :
 			    attr->values[i].resolution.units ==
-				IPP_RES_PER_CM ? "dpc" : "unknown");
+				IPP_RES_PER_CM ? "dpcm" : "unknown");
 	  }
 
 	  if (attr->values[i].resolution.units != IPP_RES_PER_INCH &&
@@ -4586,7 +4592,7 @@
 			attr->values[i].resolution.units ==
 			    IPP_RES_PER_INCH ? "dpi" :
 			    attr->values[i].resolution.units ==
-				IPP_RES_PER_CM ? "dpc" : "unknown");
+				IPP_RES_PER_CM ? "dpcm" : "unknown");
 	  }
 	}
         break;
Index: CHANGES.txt
===================================================================
--- CHANGES.txt	(revision 10298)
+++ CHANGES.txt	(revision 10299)
@@ -4,6 +4,8 @@
 CHANGES IN CUPS V1.6b1
 
 	- Documentation updates (STR #3980)
+	- CUPS now prefers the suffix "dpcm" when reporting resolution in dots-
+	  per-centimeter (STR #4006)
 	- The configure script and build system no longer support building of
 	  separate 32-bit and 64-bit libraries.
 	- The "brightness", "columns", "fitplot", "gamma", "hue",
Index: cgi-bin/ipp-var.c
===================================================================
--- cgi-bin/ipp-var.c	(revision 10298)
+++ cgi-bin/ipp-var.c	(revision 10299)
@@ -3,7 +3,7 @@
  *
  *   CGI <-> IPP variable routines for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -1219,7 +1219,7 @@
 	             "%dx%d%s", attr->values[i].resolution.xres,
 		     attr->values[i].resolution.yres,
 		     attr->values[i].resolution.units == IPP_RES_PER_INCH ?
-			 "dpi" : "dpc");
+			 "dpi" : "dpcm");
 	    break;
 
 	case IPP_TAG_URI :
Index: scheduler/ipp.c
===================================================================
--- scheduler/ipp.c	(revision 10298)
+++ scheduler/ipp.c	(revision 10299)
@@ -4976,7 +4976,7 @@
 	      cupsFilePrintf(out, "%dx%d%s", attr->values[i].resolution.xres,
 		      attr->values[i].resolution.yres,
 		      attr->values[i].resolution.units == IPP_RES_PER_INCH ?
-			  "dpi" : "dpc");
+			  "dpi" : "dpcm");
 	      break;
 
 	  case IPP_TAG_URI :
@@ -11271,7 +11271,7 @@
           sprintf(value, "%dx%d%s", attr->values[0].resolution.xres,
 	          attr->values[0].resolution.yres,
 		  attr->values[0].resolution.units == IPP_RES_PER_INCH ?
-		      "dpi" : "dpc");
+		      "dpi" : "dpcm");
           printer->num_options = cupsAddOption(name, value,
 					       printer->num_options,
 					       &(printer->options));
Index: scheduler/job.c
===================================================================
--- scheduler/job.c	(revision 10298)
+++ scheduler/job.c	(revision 10299)
@@ -3659,7 +3659,7 @@
 	               "%dx%d%s", attr->values[i].resolution.xres,
 		       attr->values[i].resolution.yres,
 		       attr->values[i].resolution.units == IPP_RES_PER_INCH ?
-			   "dpi" : "dpc");
+			   "dpi" : "dpcm");
 	      break;
 
           case IPP_TAG_STRING :
Index: scheduler/testsub.c
===================================================================
--- scheduler/testsub.c	(revision 10298)
+++ scheduler/testsub.c	(revision 10299)
@@ -3,7 +3,7 @@
  *
  *   Scheduler notification tester for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 2006-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -453,7 +453,7 @@
       case IPP_TAG_RESOLUTION :
           for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
 	    printf(" %dx%d%s", val->resolution.xres, val->resolution.yres,
-	           val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpc");
+	           val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
           putchar('\n');
           break;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.