blob: 1f08d1603a789b1dfb2b90e668602226ebddf3e4 [file] [log] [blame]
From 653674e11872465dd5edf1c1e8413ea813d7e086 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 23 Apr 2018 23:07:21 -0700
Subject: [PATCH] Fix narrowing errors -Wc++11-narrowing
Clang 6.x finds these errors
../../../../CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates to -2147024809, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
case E_INVALIDARG : txt = "E_INVALIDARG"; break ;
^
HRESULT causes the macro to be parsed as a signed long, so we need to force it
to be checked as an unsigned long instead.
also reported here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224930
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
CPP/Windows/ErrorMsg.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/CPP/Windows/ErrorMsg.cpp b/CPP/Windows/ErrorMsg.cpp
index 99684ae..78a64ba 100644
--- a/CPP/Windows/ErrorMsg.cpp
+++ b/CPP/Windows/ErrorMsg.cpp
@@ -15,13 +15,13 @@ UString MyFormatMessage(DWORD errorCode)
switch(errorCode) {
case ERROR_NO_MORE_FILES : txt = "No more files"; break ;
- case E_NOTIMPL : txt = "E_NOTIMPL"; break ;
- case E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
- case E_ABORT : txt = "E_ABORT"; break ;
- case E_FAIL : txt = "E_FAIL"; break ;
- case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
- case E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
- case E_INVALIDARG : txt = "E_INVALIDARG"; break ;
+ case (DWORD) E_NOTIMPL : txt = "E_NOTIMPL"; break ;
+ case (DWORD) E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
+ case (DWORD) E_ABORT : txt = "E_ABORT"; break ;
+ case (DWORD) E_FAIL : txt = "E_FAIL"; break ;
+ case (DWORD) STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
+ case (DWORD) E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
+ case (DWORD) E_INVALIDARG : txt = "E_INVALIDARG"; break ;
case ERROR_DIRECTORY : txt = "Error Directory"; break ;
default:
txt = strerror(errorCode);