summaryrefslogtreecommitdiff
path: root/p7zip/CPP_Windows_ErrorMsg.patch
blob: 71de3e9f59c86f0979bb9e7539504e3a46fb553a (plain)
    1 This fixes the build with Clang 6.0:
    2 
    3  ../../../../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]
    4      case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
    5           ^
    6  ../../../../CPP/Common/MyWindows.h:89:22: note: expanded from macro 'E_INVALIDARG'
    7  #define E_INVALIDARG ((HRESULT)0x80070057L)
    8                       ^
    9 
   10 The HRESULT cast in the macro causes the value to be read as signed int.
   11 --- CPP/Windows/ErrorMsg.cpp.orig	2015-01-18 18:20:28 UTC
   12 +++ CPP/Windows/ErrorMsg.cpp
   13 @@ -15,13 +15,13 @@ UString MyFormatMessage(DWORD errorCode)
   14  
   15    switch(errorCode) {
   16      case ERROR_NO_MORE_FILES   : txt = "No more files"; break ;
   17 -    case E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
   18 -    case E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
   19 -    case E_ABORT               : txt = "E_ABORT"; break ;
   20 -    case E_FAIL                : txt = "E_FAIL"; break ;
   21 -    case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
   22 -    case E_OUTOFMEMORY         : txt = "E_OUTOFMEMORY"; break ;
   23 -    case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
   24 +    case (DWORD)(E_NOTIMPL)             : txt = "E_NOTIMPL"; break ;
   25 +    case (DWORD)(E_NOINTERFACE)         : txt = "E_NOINTERFACE"; break ;
   26 +    case (DWORD)(E_ABORT)               : txt = "E_ABORT"; break ;
   27 +    case (DWORD)(E_FAIL)                : txt = "E_FAIL"; break ;
   28 +    case (DWORD)(STG_E_INVALIDFUNCTION) : txt = "STG_E_INVALIDFUNCTION"; break ;
   29 +    case (DWORD)(E_OUTOFMEMORY)         : txt = "E_OUTOFMEMORY"; break ;
   30 +    case (DWORD)(E_INVALIDARG)          : txt = "E_INVALIDARG"; break ;
   31      case ERROR_DIRECTORY          : txt = "Error Directory"; break ;
   32      default:
   33        txt = strerror(errorCode);

Generated by cgit