michaelrsweet / pappl

PAPPL - Printer Application Framework
https://www.msweet.org/pappl
Apache License 2.0
309 stars 49 forks source link

papplDeviceParseID() should return a size_t to better work with cupsGetOption() #221

Closed wifiprintguy closed 1 year ago

wifiprintguy commented 2 years ago

Describe the bug The papplDeviceParseID() function has the following signature / prototype:

int papplDeviceParseID(const char *device_id, cups_option_t **pairs);

It is expected that "pairs" is then used with cupsGetOption(). That has the following signature:

extern const char *cupsGetOption(const char *name, size_t num_options, cups_option_t *options) _CUPS_PUBLIC;

Notice that the return value of papplDeviceParseID() is supposed to be provided to cupsGetOption() as the "num_options" parameter, which is defined as a size_t. Casting works but should be unnecessary.

Change papplDeviceParseID() to return a size_t.

michaelrsweet commented 2 years ago

Actually, current CUPS 2.x uses the int type for the option count. size_t is being introduced for CUPS 3.x.

Deferring this request to a future PAPPL 2.0 release where we can a) require CUPS 3.x and b) break binary compatibility with prior PAPPL releases.

michaelrsweet commented 1 year ago

This is now done.