blob: 1f08d1603a789b1dfb2b90e668602226ebddf3e4 [file] [log] [blame]
William A. Kennington IIIb95905d2021-06-02 12:40:56 -07001From 653674e11872465dd5edf1c1e8413ea813d7e086 Mon Sep 17 00:00:00 2001
Brad Bishop316dfdd2018-06-25 12:45:53 -04002From: 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>
William A. Kennington IIIb95905d2021-06-02 12:40:56 -070020
Brad Bishop316dfdd2018-06-25 12:45:53 -040021---
22 CPP/Windows/ErrorMsg.cpp | 14 +++++++-------
23 1 file changed, 7 insertions(+), 7 deletions(-)
24
25diff --git a/CPP/Windows/ErrorMsg.cpp b/CPP/Windows/ErrorMsg.cpp
26index 99684ae..78a64ba 100644
27--- a/CPP/Windows/ErrorMsg.cpp
28+++ b/CPP/Windows/ErrorMsg.cpp
29@@ -15,13 +15,13 @@ UString MyFormatMessage(DWORD errorCode)
30
31 switch(errorCode) {
32 case ERROR_NO_MORE_FILES : txt = "No more files"; break ;
33- case E_NOTIMPL : txt = "E_NOTIMPL"; break ;
34- case E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
35- case E_ABORT : txt = "E_ABORT"; break ;
36- case E_FAIL : txt = "E_FAIL"; break ;
37- case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
38- case E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
39- case E_INVALIDARG : txt = "E_INVALIDARG"; break ;
40+ case (DWORD) E_NOTIMPL : txt = "E_NOTIMPL"; break ;
41+ case (DWORD) E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
42+ case (DWORD) E_ABORT : txt = "E_ABORT"; break ;
43+ case (DWORD) E_FAIL : txt = "E_FAIL"; break ;
44+ case (DWORD) STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
45+ case (DWORD) E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
46+ case (DWORD) E_INVALIDARG : txt = "E_INVALIDARG"; break ;
47 case ERROR_DIRECTORY : txt = "Error Directory"; break ;
48 default:
49 txt = strerror(errorCode);