From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 51D573857400; Wed, 21 Jul 2021 08:07:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51D573857400 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: profiler: Fix formatting warnings X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: ca7b4bd23676a9cb6d82974c2ed452e08abb7ecf X-Git-Newrev: bf8f2a95dfb0f780e65cd9821b397fbb47e1c0ce Message-Id: <20210721080739.51D573857400@sourceware.org> Date: Wed, 21 Jul 2021 08:07:39 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jul 2021 08:07:39 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=bf8f2a95dfb0f780e65cd9821b397fbb47e1c0ce commit bf8f2a95dfb0f780e65cd9821b397fbb47e1c0ce Author: Corinna Vinschen 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 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; }