rpms/system-config-printer/devel pycups-requested_attributes.patch, NONE, 1.1 system-config-printer.spec, 1.205, 1.206

Tim Waugh (twaugh) fedora-extras-commits at redhat.com
Thu Jul 10 15:55:02 UTC 2008


Author: twaugh

Update of /cvs/pkgs/rpms/system-config-printer/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2330

Modified Files:
	system-config-printer.spec 
Added Files:
	pycups-requested_attributes.patch 
Log Message:
- Applied upstream patch for pycups to fix getPrinterAttributes when
  requested_attributes is specified.

pycups-requested_attributes.patch:

--- NEW FILE pycups-requested_attributes.patch ---
diff -U0 pycups-1.9.40/ChangeLog.requested_attributes pycups-1.9.40/ChangeLog
--- pycups-1.9.40/ChangeLog.requested_attributes	2008-06-20 17:58:49.000000000 +0100
+++ pycups-1.9.40/ChangeLog	2008-07-10 16:52:05.000000000 +0100
@@ -0,0 +1,5 @@
+2008-07-09  Tim Waugh  <twaugh at redhat.com>
+
+	* cupsconnection.c (Connection_getPrinterAttributes): Fixed
+	requested_attributes parameter.
+
diff -up pycups-1.9.40/cupsconnection.c.requested_attributes pycups-1.9.40/cupsconnection.c
--- pycups-1.9.40/cupsconnection.c.requested_attributes	2008-06-20 10:36:50.000000000 +0100
+++ pycups-1.9.40/cupsconnection.c	2008-07-10 16:52:05.000000000 +0100
@@ -2240,6 +2240,7 @@ Connection_getPrinterAttributes (Connect
   char *uri;
   PyObject *requested_attrs = NULL;
   char **attrs = NULL; /* initialised to calm compiler */
+  size_t n_attrs;
   ipp_t *request, *answer;
   ipp_attribute_t *attr;
   char consuri[HTTP_MAX_URI];
@@ -2269,16 +2270,16 @@ Connection_getPrinterAttributes (Connect
   }
 
   if (requested_attrs) {
-    int i, n;
+    int i;
 
     if (!PyList_Check (requested_attrs)) {
       PyErr_SetString (PyExc_TypeError, "List required");
       return NULL;
     }
 
-    n = PyList_Size (requested_attrs);
-    attrs = malloc ((n + 1) * sizeof (char *));
-    for (i = 0; i < n; i++) {
+    n_attrs = PyList_Size (requested_attrs);
+    attrs = malloc ((n_attrs + 1) * sizeof (char *));
+    for (i = 0; i < n_attrs; i++) {
       PyObject *val = PyList_GetItem (requested_attrs, i); // borrowed ref
       if (!PyString_Check (val)) {
 	PyErr_SetString (PyExc_TypeError, "String required");
@@ -2294,7 +2295,7 @@ Connection_getPrinterAttributes (Connect
 
       attrs[i] = strdup (PyString_AsString (val));
     }
-    attrs[n] = NULL;
+    attrs[n_attrs] = NULL;
   }
 
   debugprintf ("-> Connection_getPrinterAttributes(%s)\n",
@@ -2318,8 +2319,7 @@ Connection_getPrinterAttributes (Connect
 		  "printer-uri", NULL, uri);
     if (requested_attrs)
       ippAddStrings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
-		     "requested-attributes",
-		     sizeof (attrs) / sizeof (attrs[0]), NULL,
+		     "requested-attributes", n_attrs, NULL,
 		     (const char **) attrs);
     debugprintf ("trying request with uri %s\n", uri);
     answer = cupsDoRequest (self->http, request, "/");


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/devel/system-config-printer.spec,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -r1.205 -r1.206
--- system-config-printer.spec	10 Jul 2008 15:50:39 -0000	1.205
+++ system-config-printer.spec	10 Jul 2008 15:54:11 -0000	1.206
@@ -15,6 +15,7 @@
 Source1: http://cyberelk.net/tim/data/pycups/pycups-%{pycups_version}.tar.bz2
 Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
 
+Patch0: pycups-requested_attributes.patch
 Patch1: pysmbc-debug.patch
 
 BuildRequires: cups-devel >= 1.2
@@ -63,6 +64,10 @@
 %prep
 %setup -q -a 1 -a 2
 
+pushd pycups-%{pycups_version}
+%patch0 -p1 -b .requested_attributes
+popd
+
 pushd pysmbc-%{pysmbc_version}
 %patch1 -p1 -b .debug
 popd
@@ -154,6 +159,8 @@
 %changelog
 * Thu Jul 10 2008 Tim Waugh <twaugh at redhat.com> 1.0.4-1
 - 1.0.4.
+- Applied upstream patch for pycups to fix getPrinterAttributes when
+  requested_attributes is specified.
 
 * Tue Jul  8 2008 Tim Waugh <twaugh at redhat.com> 1.0.3-2
 - Better debugging for pysmbc.




More information about the fedora-extras-commits mailing list