Skip to content

Commit

Permalink
Sync up with libcups3 changes, fix some clang-reported issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Sep 11, 2024
1 parent 0388dfa commit bd48f58
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
3 changes: 3 additions & 0 deletions pappl/base-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ extern char **environ;
# define cupsGetError cupsLastError
# define cupsGetErrorString cupsLastErrorString
# define cupsGetUser cupsUser
static inline int cupsParseOptions2(const char *s, const char **end, int num_options, cups_option_t **options) { (void)end; return (cupsParseOptions(s, num_options, options)); }
# define cupsParseOptions cupsParseOptions2
# define cupsRasterGetErrorString cupsRasterErrorString
# define httpAddrGetFamily httpAddrFamily
# define httpAddrGetLength httpAddrLength
Expand All @@ -86,6 +88,7 @@ typedef cups_afree_func_t cups_afree_cb_t;
typedef cups_raster_iocb_t cups_raster_cb_t;
typedef ipp_copycb_t ipp_copy_cb_t;
# else
# define cupsParseOptions cupsParseOptions2
# define httpDecode64 httpDecode64_3
# define httpEncode64 httpEncode64_3
# endif // CUPS_VERSION_MINOR < 5
Expand Down
2 changes: 1 addition & 1 deletion pappl/job-process.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ finish_job(pappl_job_t *job) // I - Job
if (papplPrinterIsDeleted(printer))
{
papplPrinterDelete(printer);
printer = NULL;
return;
}
else if (!strncmp(printer->device_uri, "file:", 5) || cupsArrayGetCount(printer->active_jobs) == 0)
{
Expand Down
4 changes: 2 additions & 2 deletions pappl/mainloop-subcommands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,7 @@ default_system_cb(
else if (!strcmp(valptr, "web-security") || !strncmp(valptr, "web-security,", 13))
soptions |= PAPPL_SOPTIONS_WEB_SECURITY;
else if (!strcmp(valptr, "no-tls") || !strncmp(valptr, "no-tls,", 7))
soptions = (pappl_soptions_t)((soptions | PAPPL_SOPTIONS_NO_TLS) & ~PAPPL_SOPTIONS_WEB_TLS);
soptions = (pappl_soptions_t)((soptions | PAPPL_SOPTIONS_NO_TLS) & (pappl_soptions_t)~PAPPL_SOPTIONS_WEB_TLS);

if ((valptr = strchr(valptr, ',')) != NULL)
valptr ++;
Expand Down Expand Up @@ -1945,7 +1945,7 @@ load_options(const char *filename, // I - Filename
continue;

// Parse any options on this line...
num_loptions = cupsParseOptions(line, 0, &loptions);
num_loptions = cupsParseOptions(line, /*end*/NULL, 0, &loptions);

// Copy any unset line options to the options array...
for (i = num_loptions, loption = loptions; i > 0; i --, loption ++)
Expand Down
2 changes: 1 addition & 1 deletion pappl/mainloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ papplMainloop(
return (1);
}

num_options = cupsParseOptions(argv[i], num_options, &options);
num_options = cupsParseOptions(argv[i], /*end*/NULL, num_options, &options);
break;

case 't' : // -t TITLE
Expand Down
8 changes: 4 additions & 4 deletions pappl/system-loadsave.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ papplSystemLoadState(
pappl_printer_t *printer; // Current printer


if ((num_options = cupsParseOptions(value, 0, &options)) == 0 || (printer_id = cupsGetOption("id", num_options, options)) == NULL || strtol(printer_id, NULL, 10) <= 0 || (printer_name = cupsGetOption("name", num_options, options)) == NULL || (device_id = cupsGetOption("did", num_options, options)) == NULL || (device_uri = cupsGetOption("uri", num_options, options)) == NULL || (driver_name = cupsGetOption("driver", num_options, options)) == NULL)
if ((num_options = cupsParseOptions(value, /*end*/NULL, 0, &options)) == 0 || (printer_id = cupsGetOption("id", num_options, options)) == NULL || strtol(printer_id, NULL, 10) <= 0 || (printer_name = cupsGetOption("name", num_options, options)) == NULL || (device_id = cupsGetOption("did", num_options, options)) == NULL || (device_uri = cupsGetOption("uri", num_options, options)) == NULL || (driver_name = cupsGetOption("driver", num_options, options)) == NULL)
{
papplLog(system, PAPPL_LOGLEVEL_ERROR, "Bad printer definition on line %d of '%s'.", linenum, filename);
break;
Expand Down Expand Up @@ -288,7 +288,7 @@ papplSystemLoadState(
*job_format, // Job format
*job_value; // Job option value

num_options = cupsParseOptions(value, 0, &options);
num_options = cupsParseOptions(value, /*end*/NULL, 0, &options);

if ((job_id = cupsGetOption("id", num_options, options)) == NULL || strtol(job_id, NULL, 10) <= 0 || (job_name = cupsGetOption("name", num_options, options)) == NULL || (job_username = cupsGetOption("username", num_options, options)) == NULL || (job_format = cupsGetOption("format", num_options, options)) == NULL)
{
Expand Down Expand Up @@ -664,7 +664,7 @@ parse_contact(char *value, // I - Value


memset(contact, 0, sizeof(pappl_contact_t));
num_options = cupsParseOptions(value, 0, &options);
num_options = cupsParseOptions(value, /*end*/NULL, 0, &options);

for (i = num_options, option = options; i > 0; i --, option ++)
{
Expand Down Expand Up @@ -696,7 +696,7 @@ parse_media_col(


memset(media, 0, sizeof(pappl_media_col_t));
num_options = cupsParseOptions(value, 0, &options);
num_options = cupsParseOptions(value, /*end*/NULL, 0, &options);

for (i = num_options, option = options; i > 0; i --, option ++)
{
Expand Down
6 changes: 2 additions & 4 deletions testsuite/testpappl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3651,7 +3651,7 @@ test_client_max(pappl_system_t *system, // I - System
}
}

papplSystemSetMaxClients(system, data.num_children + 1);
papplSystemSetMaxClients(system, (int)data.num_children + 1);

total = data.num_children * data.num_requests;

Expand All @@ -3666,8 +3666,6 @@ test_client_max(pappl_system_t *system, // I - System
current = last;
while (data.completed_count < data.num_children)
{
last = current;

if (current > 0)
fputs("\b\b\b\b\b\b\b\b\b\b\b\b", stdout);

Expand Down Expand Up @@ -3708,7 +3706,7 @@ test_client_max(pappl_system_t *system, // I - System

// Report on activity and return...
secs = (double)(data.end.tv_sec - data.start.tv_sec) + 0.000001 * (data.end.tv_usec - data.start.tv_usec);
i = cupsArrayGetCount(data.errors);
i = (size_t)cupsArrayGetCount(data.errors);

testEndMessage(i == 0, "%.3f seconds, %.0f requests/sec, %lu errors", secs, data.request_count / secs, (unsigned long)i);
for (ptr = (const char *)cupsArrayGetFirst(data.errors); ptr; ptr = (const char *)cupsArrayGetNext(data.errors))
Expand Down

0 comments on commit bd48f58

Please sign in to comment.