public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: profiler: Fix formatting warnings
Date: Wed, 21 Jul 2021 08:07:39 +0000 (GMT)	[thread overview]
Message-ID: <20210721080739.51D573857400@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=bf8f2a95dfb0f780e65cd9821b397fbb47e1c0ce

commit bf8f2a95dfb0f780e65cd9821b397fbb47e1c0ce
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Jul 21 10:07:16 2021 +0200

    Cygwin: profiler: Fix formatting warnings
    
    DWORD has different types on 32 and 64 bit.  Use a common cast to
    unsigned long to use %lu format for DWORD values throughout.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/utils/profiler.cc | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/winsup/utils/profiler.cc b/winsup/utils/profiler.cc
index d1a01c3a2..354aefca8 100644
--- a/winsup/utils/profiler.cc
+++ b/winsup/utils/profiler.cc
@@ -312,10 +312,11 @@ dump_profile_data (child *c)
       if (s->name)
         {
           WCHAR *name = 1 + wcsrchr (s->name, L'\\');
-          sprintf (filename, "%s.%u.%ls", prefix, c->pid, name);
+          sprintf (filename, "%s.%lu.%ls", prefix, (unsigned long) c->pid,
+					   name);
         }
       else
-        sprintf (filename, "%s.%u", prefix, c->pid);
+        sprintf (filename, "%s.%lu", prefix, (unsigned long) c->pid);
 
       fd = open (filename, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY);
       if (fd < 0)
@@ -804,9 +805,10 @@ cygwin_pid (DWORD winpid)
   cygpid = (DWORD) cygwin_internal (CW_WINPID_TO_CYGWIN_PID, winpid);
 
   if (cygpid >= max_cygpid)
-    snprintf (buf, sizeof buf, "%u", winpid);
+    snprintf (buf, sizeof buf, "%lu", (unsigned long) winpid);
   else
-    snprintf (buf, sizeof buf, "%u (pid: %u)", winpid, cygpid);
+    snprintf (buf, sizeof buf, "%lu (pid: %lu)", (unsigned long) winpid,
+						 (unsigned long) cygpid);
   return buf;
 }


                 reply	other threads:[~2021-07-21  8:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210721080739.51D573857400@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).