Re: [PATCH] cwm: use PRId64 for numberstring formatting

Ricardson <[email protected]>
Newsgroups gmane.os.openbsd.misc
Message-ID <CAAq5vGBK=6cERBtmZaKJ7Wr-rU-FLcTd5WghPQ1ryDcxW1wtcQ@mail.gmail.com>
 Updated patch attached, using the explicit long long cast as suggested.

On Thu, Aug 6, 2026 at 6:14 PM Ricardson <[email protected]> wrote:
>
> Thanks. I will update the patch to use an explicit long long cast.
>
> On Thu, Aug 6, 2026 at 6:07 PM Stuart Henderson
> <[email protected]> wrote:
> >
> > Standard OpenBSD approach for this is to cast (long long)..
> >
> > On 2026-08-06, Ricardson <[email protected]> wrote:
> > > --0000000000009f8a1a065864bc80
> > > Content-Type: text/plain; charset="UTF-8"
> > >
> > > Hello,
> > >
> > > This patch fixes a format warning on systems where int64_t is
> > > defined as long rather than long long.
> > >
> > > The current "%lld" format in parse.y does not match int64_t on
> > > such systems. Using PRId64 makes the format portable without
> > > changing the generated configuration text.
> > >
> > > The patch was tested by building cwm on Linux with GCC. It applies
> > > cleanly to the current Xenocara cwm source.
> > >
> > > --
> > > Regards
> > > r1w1s1
> > >
> > > --0000000000009f8a1a065864bc80
> > > Content-Type: application/x-patch; name="cwm-openbsd-numberstring.patch"
> > > Content-Disposition: attachment; filename="cwm-openbsd-numberstring.patch"
> > > Content-Transfer-Encoding: base64
> > > Content-ID: <f_msht65do0>
> > > X-Attachment-Id: f_msht65do0
> > >
> > > LS0tIGEvcGFyc2UueQorKysgYi9wYXJzZS55CkBAIC0yMiw2ICsyMiw3IEBACiAlewogCiAjaW5j
> > > bHVkZSA8c3lzL3R5cGVzLmg+CisjaW5jbHVkZSA8aW50dHlwZXMuaD4KICNpbmNsdWRlIDxzeXMv
> > > cXVldWUuaD4KIAogI2luY2x1ZGUgPGN0eXBlLmg+CkBAIC0xMDYsNyArMTA3LDcgQEAKIAogbnVt
> > > YmVyc3RyaW5nCTogTlVNQkVSCQkJCXsKIAkJCWNoYXIJKnM7Ci0JCQlpZiAoYXNwcmludGYoJnMs
> > > ICIlbGxkIiwgJDEpID09IC0xKSB7CisJCQlpZiAoYXNwcmludGYoJnMsICIlIiBQUklkNjQsICQx
> > > KSA9PSAtMSkgewogCQkJCXl5ZXJyb3IoInN0cmluZzogYXNwcmludGYiKTsKIAkJCQlZWUVSUk9S
> > > OwogCQkJfQo=
> > > --0000000000009f8a1a065864bc80--
> > >
> > >
> >
> >
> > --
> > Please keep replies on the mailing list.
> >
cwm-openbsd-numberstring.patch (text/x-patch, 240 B)
--- a/parse.y
+++ b/parse.y
@@ -106,7 +106,7 @@
 
 numberstring	: NUMBER				{
 			char	*s;
-			if (asprintf(&s, "%lld", $1) == -1) {
+			if (asprintf(&s, "%lld", (long long)$1) == -1) {
 				yyerror("string: asprintf");
 				YYERROR;
 			}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.