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: fix declaration of RtlInitEmptyUnicodeString
Date: Fri,  3 Sep 2021 11:21:34 +0000 (GMT)	[thread overview]
Message-ID: <20210903112134.8A26E385803C@sourceware.org> (raw)

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

commit eeeb5650cf706f4dde72ce8b8598aef41f88718a
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Sep 3 13:16:48 2021 +0200

    Cygwin: fix declaration of RtlInitEmptyUnicodeString
    
    This avoids "-Werror=maybe-uninitialized" errors due to
    using WCSTR accidentally.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/ntdll.h     | 5 +++--
 winsup/cygwin/syscalls.cc | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index 7eee383dd..4504bdf6d 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -1638,13 +1638,14 @@ extern "C"
 
   /* RtlInitEmptyUnicodeString is defined as a macro in wdm.h, but that file
      is missing entirely in w32api. */
+
   inline
-  VOID NTAPI RtlInitEmptyUnicodeString(PUNICODE_STRING dest, PCWSTR buf,
+  VOID NTAPI RtlInitEmptyUnicodeString(PUNICODE_STRING dest, PWSTR buf,
 				       USHORT len)
   {
     dest->Length = 0;
     dest->MaximumLength = len;
-    dest->Buffer = (PWSTR) buf;
+    dest->Buffer = buf;
   }
   /* Like RtlInitEmptyUnicodeString, but initialize Length to len, too.
      This is for instance useful when creating a UNICODE_STRING from an
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 6f7efa928..c34de2929 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -561,7 +561,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags)
     {
       /* In the remote case we need the full path, but recycler is only
 	 a relative path.  Convert to absolute path. */
-      RtlInitEmptyUnicodeString (&fname, (PCWSTR) tp.w_get (),
+      RtlInitEmptyUnicodeString (&fname, tp.w_get (),
 				 (NT_MAX_PATH - 1) * sizeof (WCHAR));
       RtlCopyUnicodeString (&fname, pc.get_nt_native_path ());
       RtlSplitUnicodePath (&fname, &fname, NULL);


                 reply	other threads:[~2021-09-03 11:21 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=20210903112134.8A26E385803C@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).