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

Re: [XENBUS PATCH v2 1/5] Cleanup duplicate error variables in TryAutoReboot


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Paul Durrant <xadimgnik@xxxxxxxxx>
  • Date: Wed, 11 Jun 2025 11:47:55 +0100
  • Delivery-date: Wed, 11 Jun 2025 10:48:03 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

On 09/06/2025 15:00, Tu Dinh wrote:
These variables should also be DWORD instead of HRESULT.


Why? According to the docs I have read StringCbPrintf() returns an HRESULT.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
  src/monitor/monitor.c | 15 +++++++--------
  1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 185838f..3a166db 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -459,7 +459,6 @@ TryAutoReboot(
      )
  {
      PMONITOR_CONTEXT    Context = &MonitorContext;
-    HRESULT             Result;
      DWORD               Type;
      DWORD               AutoReboot;
      DWORD               RebootCount;
@@ -469,7 +468,7 @@ TryAutoReboot(
      PTCHAR              Description;
      PTCHAR              Text;
      DWORD               TextLength;
-    HRESULT             Error;
+    DWORD               Error;
Length = sizeof (DWORD); @@ -547,12 +546,12 @@ TryAutoReboot(
      if (Text == NULL)
          goto fail2;
- Result = StringCbPrintf(Text,
-                            TextLength,
-                            TEXT("%s %s"),
-                            Description,
-                            Context->Text);
-    assert(SUCCEEDED(Result));
+    Error = StringCbPrintf(Text,
+                           TextLength,
+                           TEXT("%s %s"),
+                           Description,
+                           Context->Text);
+    assert(SUCCEEDED(Error));
free(DisplayName);




 


Rackspace

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