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

[PATCH 4/6] xennet: use correct string annotations


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Date: Mon, 5 Oct 2026 18:03:29 +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: Mon, 05 Oct 2026 16:03:46 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

STR types come built-in with recommended annotations for manipulating
strings.
CHAR*/WCHAR* and variants should be converted to STR.

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

Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 src/xennet/adapter.c   |  6 +++---
 src/xennet/dbg_print.h | 16 ++++++++--------
 src/xennet/string.c    |  8 ++++----
 src/xennet/string.h    |  4 ++--
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
index 9fd93d3..f1414fc 100644
--- a/src/xennet/adapter.c
+++ b/src/xennet/adapter.c
@@ -239,7 +239,7 @@ AdapterVifCallback(
 
 static VOID
 DisplayOffload(
-    _In_ const CHAR     *Type,
+    _In_ PCSTR          Type,
     _In_ PNDIS_OFFLOAD  Offload
     )
 {
@@ -1542,7 +1542,7 @@ __AdapterFree(
 
 static FORCEINLINE PANSI_STRING
 __AdapterMultiSzToUpcaseAnsi(
-    _Inout_ PCHAR   Buffer
+    _Inout_ PSTR    Buffer
     )
 {
     PANSI_STRING    Ansi;
@@ -1621,7 +1621,7 @@ __AdapterFreeAnsi(
 static FORCEINLINE BOOLEAN
 __AdapterMatchDistribution(
     _In_ PXENNET_ADAPTER    Adapter,
-    _Inout_opt_ PCHAR       Buffer
+    _Inout_opt_ PSTR        Buffer
     )
 {
     PCHAR                   Vendor;
diff --git a/src/xennet/dbg_print.h b/src/xennet/dbg_print.h
index 0d1f8be..9c2acdf 100644
--- a/src/xennet/dbg_print.h
+++ b/src/xennet/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,
     ...
     )
 {
@@ -91,8 +91,8 @@ __Warning(
 #if DBG
 static __inline VOID
 __Trace(
-    _In_ const CHAR *Prefix,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
@@ -117,8 +117,8 @@ __Trace(
 
 static __inline VOID
 __Info(
-    _In_ const CHAR *Prefix,
-    _In_ const CHAR *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
diff --git a/src/xennet/string.c b/src/xennet/string.c
index a740951..5b84568 100644
--- a/src/xennet/string.c
+++ b/src/xennet/string.c
@@ -53,7 +53,7 @@ __StringPut(
 
 static PCHAR
 FormatNumber(
-    _Out_ PCHAR     Buffer,
+    _Out_ 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/xennet/string.h b/src/xennet/string.h
index 295617c..d69dfb3 100644
--- a/src/xennet/string.h
+++ b/src/xennet/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,
     ...
     );
 
-- 
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®.