- Applied upstream patch for pycups to fix getPrinterAttributes when

requested_attributes is specified.
This commit is contained in:
Tim Waugh 2008-07-10 15:54:11 +00:00
parent fa6f71c58a
commit 45e77948e9
2 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,60 @@
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@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, "/");

View File

@ -15,6 +15,7 @@ Source0: http://cyberelk.net/tim/data/system-config-printer/1.0.x/system-config-
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 @@ the configuration tool.
%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 @@ exit 0
%changelog
* Thu Jul 10 2008 Tim Waugh <twaugh@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@redhat.com> 1.0.3-2
- Better debugging for pysmbc.