public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: profiler: Fix formatting warnings
@ 2021-07-21  8:07 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2021-07-21  8:07 UTC (permalink / raw)
  To: cygwin-cvs

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;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-21  8:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21  8:07 [newlib-cygwin] Cygwin: profiler: Fix formatting warnings Corinna Vinschen

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).