Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bunch of compiler warnings on 32bit builds #2784

Merged
merged 2 commits into from Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/rpmfi.c
Expand Up @@ -14,6 +14,7 @@
#include <rpm/rpmbase64.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>

#include "rpmfi_internal.h"
#include "rpmte_internal.h" /* relocations */
Expand Down Expand Up @@ -1362,7 +1363,7 @@ static int indexSane(rpmtd xd, rpmtd yd, rpmtd zd)
} \
if (rpmTagGetTagType(_tag) != RPM_STRING_ARRAY_TYPE && rpmTagGetTagType(_tag) != RPM_I18NSTRING_TYPE && \
(_td)->size < totalfc * sizeof(*(_data))) { \
rpmlog(RPMLOG_ERR, _("Malformed data for tag %s: %u bytes found but %lu expected.\n"), rpmTagGetName(_tag), (_td)->size, totalfc * sizeof(*(_data))); \
rpmlog(RPMLOG_ERR, _("Malformed data for tag %s: %u bytes found but %" PRIu64 " expected.\n"), rpmTagGetName(_tag), (_td)->size, (uint64_t)totalfc * sizeof(*(_data))); \
goto err; \
} \
_data = ((_td)->data); \
Expand Down Expand Up @@ -1578,15 +1579,15 @@ static uint8_t *base2bin(Header h, rpmTagVal tag, rpm_count_t num, int *len)
if (lengths[i] > maxlen)
maxlen = lengths[i];
if (status) {
rpmlog(RPMLOG_DEBUG, _("%s: base64 decode failed, len %li\n"),
rpmlog(RPMLOG_DEBUG, _("%s: base64 decode failed, len %zu\n"),
__func__, lengths[i]);
goto out;
}
i++;
}

if (maxlen) {
rpmlog(RPMLOG_DEBUG, _("%s: base64 decode success, len %li\n"),
rpmlog(RPMLOG_DEBUG, _("%s: base64 decode success, len %zu\n"),
__func__, maxlen);

t = bin = xcalloc(num, maxlen);
Expand Down
4 changes: 2 additions & 2 deletions lib/rpmrc.c
Expand Up @@ -908,8 +908,8 @@ static inline int RPMClass(void)
cpu = (tfms>>8)&15;

if (cpu == 5
&& cpuid_ecx(0) == '68xM'
&& cpuid_edx(0) == 'Teni'
&& cpuid_ecx(0) == 0x3638784d /* '68xM' */
&& cpuid_edx(0) == 0x54656e69 /* 'Teni' */
&& (cpuid_edx(1) & ((1<<8)|(1<<15))) == ((1<<8)|(1<<15))) {
sigaction(SIGILL, &oldsa, NULL);
return 6; /* has CX8 and CMOV */
Expand Down
2 changes: 1 addition & 1 deletion lib/transaction.c
Expand Up @@ -1391,7 +1391,7 @@ static rpmps checkProblems(rpmts ts)

/* The ordering doesn't matter here */
/* XXX Only added packages need be checked. */
rpmlog(RPMLOG_DEBUG, "sanity checking %lu elements\n", npkgs);
rpmlog(RPMLOG_DEBUG, "sanity checking %" PRIu64 " elements\n", npkgs);
pi = rpmtsiInit(ts);
while ((p = rpmtsiNext(pi, etypes)) != NULL) {
switch (rpmteType(p)) {
Expand Down
3 changes: 2 additions & 1 deletion plugins/fapolicyd.c
Expand Up @@ -8,6 +8,7 @@
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <inttypes.h>
#include <sys/stat.h>

struct fapolicyd_data {
Expand Down Expand Up @@ -231,7 +232,7 @@ static rpmRC fapolicyd_fsm_file_prepare(rpmPlugin plugin, rpmfi fi,
rpm_loff_t size = rpmfiFSize(fi);
char * sha = rpmfiFDigestHex(fi, NULL);

snprintf(buffer, 4096, "%s %lu %64s\n", dest, size, sha);
snprintf(buffer, 4096, "%s %" PRIu64 " %64s\n", dest, size, sha);
(void) try_to_write_to_fifo(&fapolicyd_state, buffer);

free(sha);
Expand Down
10 changes: 6 additions & 4 deletions sign/rpmsignverity.c
Expand Up @@ -6,6 +6,8 @@

#include "system.h"

#include <inttypes.h>

#include <rpm/rpmlib.h> /* RPMSIGTAG & related */
#include <rpm/rpmlog.h> /* rpmlog */
#include <rpm/rpmfi.h>
Expand Down Expand Up @@ -65,10 +67,10 @@ static char *rpmVeritySignFile(rpmfi fi, size_t *sig_size, char *key,

digest_hex = rpmhex(digest->digest, digest->digest_size);
digest_base64 = rpmBase64Encode(digest->digest, digest->digest_size, -1);
rpmlog(RPMLOG_DEBUG, _("file(size %li): %s: digest(%i): %s, idx %i\n"),
rpmlog(RPMLOG_DEBUG, _("file(size %" PRIu64 "): %s: digest(%i): %s, idx %i\n"),
file_size, rpmfiFN(fi), digest->digest_size, digest_hex,
rpmfiFX(fi));
rpmlog(RPMLOG_DEBUG, _("file(size %li): %s: digest sz (%i): base64 sz (%li), %s, idx %i\n"),
rpmlog(RPMLOG_DEBUG, _("file(size %" PRIu64 "): %s: digest sz (%u): base64 sz (%zu), %s, idx %i\n"),
file_size, rpmfiFN(fi), digest->digest_size, strlen(digest_base64),
digest_base64, rpmfiFX(fi));

Expand All @@ -84,7 +86,7 @@ static char *rpmVeritySignFile(rpmfi fi, size_t *sig_size, char *key,

sig_hex = rpmhex(sig, *sig_size);
sig_base64 = rpmBase64Encode(sig, *sig_size, -1);
rpmlog(RPMLOG_DEBUG, _("%s: sig_size(%li), base64_size(%li), idx %i: signature:\n%s\n"),
rpmlog(RPMLOG_DEBUG, _("%s: sig_size(%zu), base64_size(%zu), idx %i: signature:\n%s\n"),
rpmfiFN(fi), *sig_size, strlen(sig_base64), rpmfiFX(fi), sig_hex);
out:
free(sig_hex);
Expand Down Expand Up @@ -189,7 +191,7 @@ rpmRC rpmSignVerity(FD_t fd, Header sigh, Header h, char *key,
goto out;
}
rpmlog(RPMLOG_DEBUG, _("signature: %s\n"), signatures[idx]);
rpmlog(RPMLOG_DEBUG, _("digest signed, len: %li\n"), sig_size);
rpmlog(RPMLOG_DEBUG, _("digest signed, len: %zu\n"), sig_size);
free(signatures[idx]);
signatures[idx] = NULL;
}
Expand Down