Bug 124157 - KDEprint incorrectly uses private CUPS APIs _ipp_add and _ipp_free
Summary: KDEprint incorrectly uses private CUPS APIs _ipp_add and _ipp_free
Status: CLOSED FIXED
Alias: None
Product: kdeprint
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR grave
Target Milestone: ---
Assignee: KDEPrint Devel Mailinglist
URL:
Keywords:
: 126275 127705 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-03-23 21:37 UTC by Michael Sweet
Modified: 2008-12-31 19:48 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Sweet 2006-03-23 21:37:23 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    Unspecified
Compiler:          GCC 4 
OS:                Linux

KDEprint incorrectly uses the private, undocumented CUPS APIs _ipp_add() and _ipp_free().  These APIs are now gone in CUPS 1.2, so anyone using CUPS 1.2 can't use KDE!

I've temporarily added stub functions with the old names which call the new functions that serve the same purpose, however those will be removed for the final 1.2 release.
Comment 1 Stephan Kulow 2006-03-24 10:45:05 UTC
so the new functions aren't in the older releases, right?
So there is no way to write code that will work with both releases beside evil #ifdefs?
Comment 2 Michael Sweet 2006-03-24 11:25:20 UTC
No, _ipp_free() and _ipp_add() are only in the 1.1.x releases (and not even all of those!), and since they start with an underscore that means they are PRIVATE APIs that are subject to change, even within minor releasess!

There is no reason to use them in user code; they are used internally by the ippAdd*() and ippDelete() functions, and by the scheduler when manipulating IPP requests. You should only be using the public, documented APIs...
Comment 3 Thiago Macieira 2006-03-27 23:02:29 UTC
I think those functions are necessary to remove some of the unnecessary information before displaying them to the user. But one could argue that it should be handled in a higher level.
Comment 4 Michael Sweet 2006-03-27 23:07:47 UTC
Regardless, _ipp_add() and _ipp_free() are private APIs and subject to change. They aren't meant to be used by application developers.
Comment 5 Cristian Tibirna 2006-04-05 04:37:31 UTC
I removed today the latest use of _ipp_free_attr(). Is this what you refer to?
Comment 6 Michael Sweet 2006-04-05 05:23:40 UTC
Yes, thanks!
Comment 7 Cristian Tibirna 2006-04-06 13:45:35 UTC
fixed with svn r526593 (branch 3.5) and r526940 (trunk).

Thanks for reporting.
Comment 8 Michael Goffioul 2006-04-26 09:51:14 UTC
*** Bug 126275 has been marked as a duplicate of this bug. ***
Comment 9 Matthew Carson 2006-04-27 09:22:45 UTC
> > is there a simple patch I could use - how do I fix this pls ?
Yes. Look below. This is also commited to the 3.5 SVN branch right now.

Index: ipprequest.cpp
===================================================================
--- ipprequest.cpp      (revision 534402)
+++ ipprequest.cpp      (working copy)
@@ -511,7 +511,11 @@
        cupsFreeOptions(n, options);

        // find an remove that annoying "document-format" attribute
-       // (can't use IppDeleteAttribute as cups 1.0.9 doesn't have that)
+#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2
+    ipp_attribute_t *attr = ippFindAttribute(request_, "document-format", 
IPP_TAG_NAME);
+    ippDeleteAttribute(request_, attr);
+#else
+       // (can't use IppDeleteAttribute as older cups doesn't have that)
        ipp_attribute_t *attr = request_->attrs;
        while (attr)
        {
@@ -524,4 +528,5 @@
                }
                attr = attr->next;
        }
+#endif
 }
Comment 10 Matthew Carson 2006-04-27 09:30:38 UTC
*** *** *** *** *** *** *** ***
with special thanks to : 
Cristian Tibirna, KDE developer
*** *** *** *** *** *** *** ***
Comment 11 Thiago Macieira 2006-05-27 11:15:33 UTC
*** Bug 127705 has been marked as a duplicate of this bug. ***
Comment 12 John Layt 2008-12-31 19:48:23 UTC
Closing old Resolved status bug.