blob: ae27517458d3c6865a9d742c6c810d8baedae8c8 [file] [log] [blame]
From b6b1782af4aa7f9084d32e4144738dc2535c8d6f 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);