blob: ae27517458d3c6865a9d742c6c810d8baedae8c8 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From b6b1782af4aa7f9084d32e4144738dc2535c8d6f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 23 Apr 2018 23:07:21 -0700
4Subject: [PATCH] Fix narrowing errors -Wc++11-narrowing
5
6Clang 6.x finds these errors
7
8 ../../../../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]
9 case E_INVALIDARG : txt = "E_INVALIDARG"; break ;
10 ^
11
12HRESULT causes the macro to be parsed as a signed long, so we need to force it
13to be checked as an unsigned long instead.
14
15also reported here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224930
16
17Upstream-Status: Pending
18
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 CPP/Windows/ErrorMsg.cpp | 14 +++++++-------
22 1 file changed, 7 insertions(+), 7 deletions(-)
23
24diff --git a/CPP/Windows/ErrorMsg.cpp b/CPP/Windows/ErrorMsg.cpp
25index 99684ae..78a64ba 100644
26--- a/CPP/Windows/ErrorMsg.cpp
27+++ b/CPP/Windows/ErrorMsg.cpp
28@@ -15,13 +15,13 @@ UString MyFormatMessage(DWORD errorCode)
29
30 switch(errorCode) {
31 case ERROR_NO_MORE_FILES : txt = "No more files"; break ;
32- case E_NOTIMPL : txt = "E_NOTIMPL"; break ;
33- case E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
34- case E_ABORT : txt = "E_ABORT"; break ;
35- case E_FAIL : txt = "E_FAIL"; break ;
36- case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
37- case E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
38- case E_INVALIDARG : txt = "E_INVALIDARG"; break ;
39+ case (DWORD) E_NOTIMPL : txt = "E_NOTIMPL"; break ;
40+ case (DWORD) E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
41+ case (DWORD) E_ABORT : txt = "E_ABORT"; break ;
42+ case (DWORD) E_FAIL : txt = "E_FAIL"; break ;
43+ case (DWORD) STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
44+ case (DWORD) E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
45+ case (DWORD) E_INVALIDARG : txt = "E_INVALIDARG"; break ;
46 case ERROR_DIRECTORY : txt = "Error Directory"; break ;
47 default:
48 txt = strerror(errorCode);