-CHANGES.txt - 2.2.4 - 2017-04-24
+CHANGES.txt - 2.2.4 - 2017-05-01
--------------------------------
CHANGES IN CUPS V2.2.4
- cupsEnumDests did not return early when all printers had been
discovered (Issue #4989)
- The CUPS build system now supports cross-compilation (Issue #4897)
+ - Added a new CUPS Programming Manual to replace the aging API
+ documentation.
+ - Added the cupsAddIntegerOption and cupsGetIntegerOption functions
+ (Issue #4992)
CHANGES IN CUPS V2.2.3
/* New in CUPS 2.2/macOS 10.12 */
extern ssize_t cupsHashData(const char *algorithm, const void *data, size_t datalen, unsigned char *hash, size_t hashsize) _CUPS_API_2_2;
+/* New in CUPS 2.2.4 */
+extern int cupsAddIntegerOption(const char *name, int value, int num_options, cups_option_t **options) _CUPS_API_2_2_4;
+extern int cupsGetIntegerOption(const char *name, int num_options, cups_option_t *options) _CUPS_API_2_2_4;
+
# ifdef __cplusplus
}
# endif /* __cplusplus */
cups_option_t *option, int prev, int *rdiff);
+/*
+ * 'cupsAddIntegerOption()' - Add an integer option to an option array.
+ *
+ * New option arrays can be initialized simply by passing 0 for the
+ * "num_options" parameter.
+ *
+ * @since CUPS 2.2.4@
+ */
+
+int /* O - Number of options */
+cupsAddIntegerOption(
+ const char *name, /* I - Name of option */
+ int value, /* I - Value of option */
+ int num_options, /* I - Number of options */
+ cups_option_t **options) /* IO - Pointer to options */
+{
+ char strvalue[32]; /* String value */
+
+
+ snprintf(strvalue, sizeof(strvalue), "%d", value);
+
+ return (cupsAddOption(name, strvalue, num_options, options));
+}
+
+
/*
* 'cupsAddOption()' - Add an option to an option array.
*
}
+/*
+ * 'cupsGetIntegerOption()' - Get an integer option value.
+ *
+ * INT_MIN is returned when the option does not exist, is not an integer, or
+ * exceeds the range of values for the "int" type.
+ *
+ * @since 2.2.4@
+ */
+
+int /* O - Option value or @code INT_MIN@ */
+cupsGetIntegerOption(
+ const char *name, /* I - Name of option */
+ int num_options, /* I - Number of options */
+ cups_option_t *options) /* I - Options */
+{
+ const char *value = cupsGetOption(name, num_options, options);
+ /* String value of option */
+ char *ptr; /* Pointer into string value */
+ long intvalue; /* Integer value */
+
+
+ if (!value || !*value)
+ return (INT_MIN);
+
+ intvalue = strtol(value, &ptr, 10);
+ if (intvalue < INT_MIN || intvalue > INT_MAX || *ptr)
+ return (INT_MIN);
+
+ return ((int)intvalue);
+}
+
+
/*
* 'cupsGetOption()' - Get an option value.
*/
/*
* API versioning definitions for CUPS.
*
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
/*
* This header defines several constants - _CUPS_DEPRECATED,
- * _CUPS_DEPRECATED_MSG, _CUPS_INTERNAL_MSG, _CUPS_API_1_1, _CUPS_API_1_1_19,
- * _CUPS_API_1_1_20, _CUPS_API_1_1_21, _CUPS_API_1_2, _CUPS_API_1_3,
- * _CUPS_API_1_4, _CUPS_API_1_5, _CUPS_API_1_6, _CUPS_API_1_7, and
- * _CUPS_API_2_0 - which add compiler-specific attributes that flag functions
- * that are deprecated, added in particular releases, or internal to CUPS.
+ * _CUPS_DEPRECATED_MSG, _CUPS_INTERNAL_MSG, _CUPS_API_major_minor, and
+ * _CUPS_API_major_minor_patch - which add compiler-specific attributes that
+ * flag functions that are deprecated, added in particular releases, or internal
+ * to CUPS.
*
* On macOS, the _CUPS_API_* constants are defined based on the values of
* the MAC_OS_X_VERSION_MIN_ALLOWED and MAC_OS_X_VERSION_MAX_ALLOWED constants
# ifndef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
# define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER __attribute__((unavailable))
# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER */
+# ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
+# define AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER __attribute__((unavailable))
+# endif /* !AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER */
# define _CUPS_API_1_1_19 AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
# define _CUPS_API_1_1_20 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
# define _CUPS_API_1_1_21 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
# define _CUPS_API_1_7 AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER
# define _CUPS_API_2_0 AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
# define _CUPS_API_2_2 AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
+# define _CUPS_API_2_2_4 AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
# else
# define _CUPS_API_1_1_19
# define _CUPS_API_1_1_20
# define _CUPS_API_1_7
# define _CUPS_API_2_0
# define _CUPS_API_2_2
+# define _CUPS_API_2_2_4
# endif /* __APPLE__ && !_CUPS_SOURCE */
/*