Skip to content

Commit 538ebf4

Browse files
committed
Fix some clang warnings.
1 parent 9632409 commit 538ebf4

21 files changed

Lines changed: 76 additions & 199 deletions

backend/lpd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
11091109
{
11101110
_cupsLangPrintFilter(stderr, "INFO",
11111111
_("Spooling job, %.0f%% complete."),
1112-
100.0 * tbytes / filestats.st_size);
1112+
100.0 * (double)tbytes / (double)filestats.st_size);
11131113

11141114
if (lpd_write(fd, buffer, (size_t)nbytes) < nbytes)
11151115
{

backend/snmp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* SNMP discovery backend for CUPS.
33
*
4-
* Copyright © 2020-2024 by OpenPrinting.
4+
* Copyright © 2020-2026 by OpenPrinting.
55
* Copyright © 2007-2014 by Apple Inc.
66
* Copyright © 2006-2007 by Easy Software Products, all rights reserved.
77
*
@@ -1142,8 +1142,8 @@ run_time(void)
11421142

11431143
gettimeofday(&curtime, NULL);
11441144

1145-
return (curtime.tv_sec - StartTime.tv_sec +
1146-
0.000001 * (curtime.tv_usec - StartTime.tv_usec));
1145+
return ((double)(curtime.tv_sec - StartTime.tv_sec) +
1146+
0.000001 * (double)(curtime.tv_usec - StartTime.tv_usec));
11471147
}
11481148

11491149

cups/backchannel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Backchannel functions for CUPS.
33
*
4-
* Copyright © 2020-2025 by OpenPrinting.
4+
* Copyright © 2020-2026 by OpenPrinting.
55
* Copyright © 2007-2014 by Apple Inc.
66
* Copyright © 1997-2007 by Easy Software Products.
77
*
@@ -170,8 +170,8 @@ cups_setup(fd_set *set, /* I - Set for select() */
170170
struct timeval *tval, /* I - Timer value */
171171
double timeout) /* I - Timeout in seconds */
172172
{
173-
tval->tv_sec = (time_t)timeout;
174-
tval->tv_usec = (suseconds_t)(1000000.0 * (timeout - tval->tv_sec));
173+
tval->tv_sec = (time_t)timeout;
174+
tval->tv_usec = (suseconds_t)(1000000.0 * (timeout - (double)tval->tv_sec));
175175

176176
FD_ZERO(set);
177177
FD_SET(3, set);

cups/clock.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Monotonic clock API for CUPS.
33
//
4-
// Copyright © 2024-2025 by OpenPrinting.
4+
// Copyright © 2024-2026 by OpenPrinting.
55
//
66
// Licensed under Apache License v2.0. See the file "LICENSE" for more
77
// information.
@@ -89,7 +89,7 @@ cupsGetClock(void)
8989
}
9090

9191
// Convert clock value to seconds...
92-
if ((secs = curclock.tv_sec - cups_first_clock.tv_sec + 0.000000001 * (curclock.tv_nsec - cups_first_clock.tv_nsec)) < 0.0)
92+
if ((secs = (double)(curclock.tv_sec - cups_first_clock.tv_sec) + 0.000000001 * (double)(curclock.tv_nsec - cups_first_clock.tv_nsec)) < 0.0)
9393
secs = 0.0;
9494
}
9595
else
@@ -105,7 +105,7 @@ cupsGetClock(void)
105105
}
106106

107107
// Convert time value to seconds...
108-
if ((secs = curtime.tv_sec - cups_first_time.tv_sec + 0.000001 * (curtime.tv_usec - cups_first_time.tv_usec)) < 0.0)
108+
if ((secs = (double)(curtime.tv_sec - cups_first_time.tv_sec) + 0.000001 * (double)(curtime.tv_usec - cups_first_time.tv_usec)) < 0.0)
109109
secs = 0.0;
110110
}
111111
#endif // _WIN32

cups/jwt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ cupsJWTLoadCredentials(
780780
qi[1024], // First CRT coefficient
781781
x[1024], // X coordinate
782782
y[1024]; // Y coordinate
783-
const char *crv; // Curve value
783+
const char *crv = NULL; // Curve value
784784

785785

786786

cups/raster-interpret.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* PPD command interpreter for CUPS.
33
*
4-
* Copyright © 2020-2025 by OpenPrinting.
4+
* Copyright © 2020-2026 by OpenPrinting.
55
* Copyright © 2007-2018 by Apple Inc.
66
* Copyright © 1993-2007 by Easy Software Products.
77
*
@@ -386,9 +386,9 @@ _cupsRasterInterpretPPD(
386386
*/
387387

388388
h->cupsWidth = (unsigned)((right - left) * h->cupsBorderlessScalingFactor *
389-
h->HWResolution[0] / 72.0f + 0.5f);
389+
(double)h->HWResolution[0] / 72.0f + 0.5f);
390390
h->cupsHeight = (unsigned)((top - bottom) * h->cupsBorderlessScalingFactor *
391-
h->HWResolution[1] / 72.0f + 0.5f);
391+
(double)h->HWResolution[1] / 72.0f + 0.5f);
392392

393393
switch (h->cupsColorSpace)
394394
{
@@ -1312,7 +1312,7 @@ scan_ps(_cups_ps_stack_t *st, /* I - Stack */
13121312
if (base < 2 || base > 36)
13131313
return (NULL);
13141314

1315-
obj.value.number = strtol(cur + 1, &cur, base);
1315+
obj.value.number = (double)strtol(cur + 1, &cur, base);
13161316
break;
13171317
}
13181318
else if (strchr(".Ee()<>[]{}/%", *cur) || isspace(*cur & 255))

cups/raster-stream.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ cupsRasterInitHeader(
345345
h->PageSize[1] = (unsigned)(72 * media->length / 2540);
346346

347347
// This never gets written but is needed for some applications
348-
h->cupsPageSize[0] = 72.0f * media->width / 2540.0f;
349-
h->cupsPageSize[1] = 72.0f * media->length / 2540.0f;
348+
h->cupsPageSize[0] = 72.0f * (float)media->width / 2540.0f;
349+
h->cupsPageSize[1] = 72.0f * (float)media->length / 2540.0f;
350350

351351
h->ImagingBoundingBox[0] = (unsigned)(72 * media->left / 2540);
352352
h->ImagingBoundingBox[1] = (unsigned)(72 * media->bottom / 2540);
@@ -568,8 +568,8 @@ _cupsRasterInitPWGHeader(
568568
h->PageSize[1] = (unsigned)(72 * media->length / 2540);
569569

570570
// This never gets written but is needed for some applications
571-
h->cupsPageSize[0] = 72.0f * media->width / 2540.0f;
572-
h->cupsPageSize[1] = 72.0f * media->length / 2540.0f;
571+
h->cupsPageSize[0] = 72.0f * (float)media->width / 2540.0f;
572+
h->cupsPageSize[1] = 72.0f * (float)media->length / 2540.0f;
573573

574574
h->ImagingBoundingBox[2] = h->PageSize[0];
575575
h->ImagingBoundingBox[3] = h->PageSize[1];
@@ -1322,10 +1322,10 @@ _cupsRasterWriteHeader(
13221322
fh.cupsInteger[0] = htonl(r->header.cupsInteger[0]);
13231323
fh.cupsInteger[1] = htonl(r->header.cupsInteger[1]);
13241324
fh.cupsInteger[2] = htonl(r->header.cupsInteger[2]);
1325-
fh.cupsInteger[3] = htonl((unsigned)(r->header.cupsImagingBBox[0] * r->header.HWResolution[0] / 72.0));
1326-
fh.cupsInteger[4] = htonl((unsigned)(r->header.cupsImagingBBox[1] * r->header.HWResolution[1] / 72.0));
1327-
fh.cupsInteger[5] = htonl((unsigned)(r->header.cupsImagingBBox[2] * r->header.HWResolution[0] / 72.0));
1328-
fh.cupsInteger[6] = htonl((unsigned)(r->header.cupsImagingBBox[3] * r->header.HWResolution[1] / 72.0));
1325+
fh.cupsInteger[3] = htonl((unsigned)(r->header.cupsImagingBBox[0] * (double)r->header.HWResolution[0] / 72.0));
1326+
fh.cupsInteger[4] = htonl((unsigned)(r->header.cupsImagingBBox[1] * (double)r->header.HWResolution[1] / 72.0));
1327+
fh.cupsInteger[5] = htonl((unsigned)(r->header.cupsImagingBBox[2] * (double)r->header.HWResolution[0] / 72.0));
1328+
fh.cupsInteger[6] = htonl((unsigned)(r->header.cupsImagingBBox[3] * (double)r->header.HWResolution[1] / 72.0));
13291329
fh.cupsInteger[7] = htonl(0xffffff);
13301330

13311331
return (cups_raster_io(r, (unsigned char *)&fh, sizeof(fh)) == sizeof(fh));

cups/rasterbench.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
22
* Raster benchmark program for CUPS.
33
*
4-
* Copyright © 2020-2024 by OpenPrinting.
5-
* Copyright 2007-2016 by Apple Inc.
6-
* Copyright 1997-2006 by Easy Software Products.
4+
* Copyright © 2020-2026 by OpenPrinting.
5+
* Copyright © 2007-2016 by Apple Inc.
6+
* Copyright © 1997-2006 by Easy Software Products.
77
*
8-
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
8+
* Licensed under Apache License v2.0. See the file "LICENSE" for more
9+
* information.
910
*/
1011

1112
/*
@@ -157,7 +158,7 @@ get_time(void)
157158

158159

159160
gettimeofday(&curtime, NULL);
160-
return (curtime.tv_sec + 0.000001 * curtime.tv_usec);
161+
return ((double)curtime.tv_sec + 0.000001 * (double)curtime.tv_usec);
161162
}
162163

163164

cups/testarray.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Array test program for CUPS.
33
//
4-
// Copyright © 2020-2024 by OpenPrinting.
4+
// Copyright © 2020-2026 by OpenPrinting.
55
// Copyright © 2007-2014 by Apple Inc.
66
// Copyright © 1997-2006 by Easy Software Products.
77
//
@@ -480,7 +480,7 @@ get_seconds(void)
480480

481481

482482
gettimeofday(&curtime, NULL);
483-
return (curtime.tv_sec + 0.000001 * curtime.tv_usec);
483+
return ((double)curtime.tv_sec + 0.000001 * (double)curtime.tv_usec);
484484
}
485485
#endif // _WIN32
486486

cups/testppd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* PPD test program for CUPS.
33
*
4-
* Copyright © 2020-2025 by OpenPrinting.
4+
* Copyright © 2020-2026 by OpenPrinting.
55
* Copyright © 2007-2018 by Apple Inc.
66
* Copyright © 1997-2006 by Easy Software Products.
77
*
@@ -1204,7 +1204,6 @@ main(int argc, /* I - Number of command-line arguments */
12041204
ppd_option_t *option; /* Option */
12051205
ppd_coption_t *coption; /* Custom option */
12061206
ppd_cparam_t *cparam; /* Custom parameter */
1207-
ppd_size_t *size; /* Default paper size */
12081207
ppd_const_t *c; /* UIConstraints */
12091208
char lang[255], /* LANG environment variable */
12101209
lc_all[255], /* LC_ALL environment variable */

0 commit comments

Comments
 (0)