[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/6] Update string typedefs


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Date: Tue, 29 Sep 2026 19:05:10 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
  • Cc: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Delivery-date: Tue, 29 Sep 2026 17:06:04 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

Mechanical pass, no functional change.

Types:
  const CHAR */CHAR *  -> PCSTR/PSTR
  const WCHAR */WCHAR* -> PCWSTR
  const PCHAR          -> PCSTR
  PCHAR                -> PSTR

PCSTR/PCWSTR are _Null_terminated_ in ntdef.h, so the type gives the
analyser the buffer extent; PCHAR does not.  "const PCHAR" qualified
the pointer rather than the characters and so asserted nothing.
Buffers that are not single strings keep PCHAR.

Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 src/xenhid/assert.h    | 12 ++++++------
 src/xenhid/dbg_print.h | 20 ++++++++++----------
 src/xenhid/fdo.c       |  4 ++--
 src/xenhid/string.c    |  8 ++++----
 src/xenhid/string.h    |  4 ++--
 src/xenhid/util.h      |  8 ++++----
 6 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/xenhid/assert.h b/src/xenhid/assert.h
index 6cea1de..3c7398e 100644
--- a/src/xenhid/assert.h
+++ b/src/xenhid/assert.h
@@ -154,8 +154,8 @@ __Bug(
 
 static __inline BOOLEAN
 _IsZeroMemory(
-    _In_ const PCHAR    Caller,
-    _In_ const PCHAR    Name,
+    _In_ PCSTR          Caller,
+    _In_ PCSTR          Name,
     _In_ PVOID          Buffer,
     _In_ ULONG          Length
     )
@@ -178,10 +178,10 @@ _IsZeroMemory(
 
 static __inline BOOLEAN
 _IsZeroMemory(
-    _In_ const PCHAR    Caller,
-    _In_ const PCHAR    Name,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Length
+    _In_ PCSTR  Caller,
+    _In_ PCSTR  Name,
+    _In_ PVOID  Buffer,
+    _In_ ULONG  Length
     )
 {
     UNREFERENCED_PARAMETER(Caller);
diff --git a/src/xenhid/dbg_print.h b/src/xenhid/dbg_print.h
index 758311d..e13cd8e 100644
--- a/src/xenhid/dbg_print.h
+++ b/src/xenhid/dbg_print.h
@@ -44,8 +44,8 @@
 
 static __inline VOID
 __Error(
-    _In_ const CHAR *Prefix,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
@@ -67,8 +67,8 @@ __Error(
 
 static __inline VOID
 __Warning(
-    _In_ const CHAR *Prefix,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
@@ -92,8 +92,8 @@ __Warning(
 
 static __inline VOID
 __Trace(
-    _In_ const CHAR *Prefix,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
@@ -114,8 +114,8 @@ __Trace(
 
 static __inline VOID
 __Trace(
-    _In_ const CHAR *Prefix,
-    _In_ const CHAR *Format,
+    _In_ PCSTR  Prefix,
+    _In_ PCSTR  Format,
     ...
     )
 {
@@ -130,8 +130,8 @@ __Trace(
 
 static __inline VOID
 __Info(
-    _In_ const CHAR *Prefix,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
diff --git a/src/xenhid/fdo.c b/src/xenhid/fdo.c
index b021dbd..970320a 100644
--- a/src/xenhid/fdo.c
+++ b/src/xenhid/fdo.c
@@ -249,7 +249,7 @@ __FdoGetDevicePowerState(
 
 static FORCEINLINE PANSI_STRING
 __FdoMultiSzToUpcaseAnsi(
-    _Inout_ PCHAR   Buffer
+    _Inout_ PSTR    Buffer
 )
 {
     PANSI_STRING    Ansi;
@@ -329,7 +329,7 @@ __FdoFreeAnsi(
 static FORCEINLINE BOOLEAN
 __FdoMatchDistribution(
     _In_ PXENHID_FDO    Fdo,
-    _In_ PCHAR          Buffer
+    _In_ PSTR           Buffer
 )
 {
     PCHAR               Vendor;
diff --git a/src/xenhid/string.c b/src/xenhid/string.c
index b3f0305..ad82053 100644
--- a/src/xenhid/string.c
+++ b/src/xenhid/string.c
@@ -53,7 +53,7 @@ __StringPut(
 
 static PCHAR
 FormatNumber(
-    _Inout_ PCHAR   Buffer,
+    _Inout_ PSTR    Buffer,
     _In_ ULONGLONG  Value,
     _In_ UCHAR      Base,
     _In_ BOOLEAN    UpperCase
@@ -114,7 +114,7 @@ FormatNumber(
 static NTSTATUS
 StringWriteBuffer(
     _In_ PSTRING        String,
-    _In_ const CHAR     *Format,
+    _In_ PCSTR          Format,
     _In_ va_list        Arguments
     )
 {
@@ -420,7 +420,7 @@ done:
 NTSTATUS
 StringVPrintf(
     _In_ PSTRING    String,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Format,
     _In_ va_list    Arguments
     )
 {
@@ -453,7 +453,7 @@ fail1:
 NTSTATUS
 StringPrintf(
     _In_ PSTRING    String,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Format,
     ...
     )
 {
diff --git a/src/xenhid/string.h b/src/xenhid/string.h
index 9c6f008..cc0d3a8 100644
--- a/src/xenhid/string.h
+++ b/src/xenhid/string.h
@@ -38,14 +38,14 @@
 extern NTSTATUS
 StringVPrintf(
     _In_ PSTRING    String,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Format,
     _In_ va_list    Arguments
     );
 
 extern NTSTATUS
 StringPrintf(
     _In_ PSTRING    String,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Format,
     ...
     );
 
diff --git a/src/xenhid/util.h b/src/xenhid/util.h
index 66282d6..3a10d06 100644
--- a/src/xenhid/util.h
+++ b/src/xenhid/util.h
@@ -267,8 +267,8 @@ __FreePages(
 
 static FORCEINLINE PCHAR
 __strtok_r(
-    _Inout_ PCHAR   Buffer,
-    _In_ PCHAR      Delimiter,
+    _Inout_ PSTR    Buffer,
+    _In_ PSTR       Delimiter,
     _Inout_ PCHAR   *Context
     )
 {
@@ -305,8 +305,8 @@ __strtok_r(
 
 static FORCEINLINE PWCHAR
 __wcstok_r(
-    _Inout_ PWCHAR  Buffer,
-    _In_ PWCHAR     Delimiter,
+    _Inout_ PWSTR   Buffer,
+    _In_ PWSTR      Delimiter,
     _Inout_ PWCHAR  *Context
     )
 {
-- 
2.55.0.windows.5



--
Césaire Mounah | Vates Windows Guest Tools Engineer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.