FIX archivers/p7zip - fix for clang 6.0

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

FIX archivers/p7zip - fix for clang 6.0

Björn Ketelaars
Diff below fixes p7zip (clang 6.0).

OK?


Index: patches/patch-CPP_Windows_ErrorMsg_cpp
===================================================================
RCS file: patches/patch-CPP_Windows_ErrorMsg_cpp
diff -N patches/patch-CPP_Windows_ErrorMsg_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-CPP_Windows_ErrorMsg_cpp 7 Apr 2018 13:11:53 -0000
@@ -0,0 +1,30 @@
+$OpenBSD$
+
+Index: CPP/Windows/ErrorMsg.cpp
+--- CPP/Windows/ErrorMsg.cpp.orig
++++ CPP/Windows/ErrorMsg.cpp
+@@ -14,15 +14,15 @@ UString MyFormatMessage(DWORD errorCode)
+   AString msg;
+
+   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 ERROR_DIRECTORY          : txt = "Error Directory"; break ;
++    case (DWORD)(ERROR_NO_MORE_FILES)   : txt = "No more files"; 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 (DWORD)(ERROR_DIRECTORY)       : txt = "Error Directory"; break ;
+     default:
+       txt = strerror(errorCode);
+   }

Reply | Threaded
Open this post in threaded view
|

Re: FIX archivers/p7zip - fix for clang 6.0

Rafael Sadowski
On Sat Apr 07, 2018 at 03:15:53PM +0200, Björn Ketelaars wrote:

> Diff below fixes p7zip (clang 6.0).
>
> OK?
>
>
> Index: patches/patch-CPP_Windows_ErrorMsg_cpp
> ===================================================================
> RCS file: patches/patch-CPP_Windows_ErrorMsg_cpp
> diff -N patches/patch-CPP_Windows_ErrorMsg_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-CPP_Windows_ErrorMsg_cpp 7 Apr 2018 13:11:53 -0000
> @@ -0,0 +1,30 @@
> +$OpenBSD$
> +
> +Index: CPP/Windows/ErrorMsg.cpp
> +--- CPP/Windows/ErrorMsg.cpp.orig
> ++++ CPP/Windows/ErrorMsg.cpp
> +@@ -14,15 +14,15 @@ UString MyFormatMessage(DWORD errorCode)
> +   AString msg;
> +
> +   switch(errorCode) {

Please use only:

switch(static_cast<int>(errorCode))

ok to that.

> +-    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 ERROR_DIRECTORY          : txt = "Error Directory"; break ;
> ++    case (DWORD)(ERROR_NO_MORE_FILES)   : txt = "No more files"; 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 (DWORD)(ERROR_DIRECTORY)       : txt = "Error Directory"; break ;
> +     default:
> +       txt = strerror(errorCode);
> +   }
>

Reply | Threaded
Open this post in threaded view
|

Re: FIX archivers/p7zip - fix for clang 6.0

Björn Ketelaars
On Sat 07/04/2018 16:52, Rafael Sadowski wrote:

> On Sat Apr 07, 2018 at 03:15:53PM +0200, Björn Ketelaars wrote:
> > Diff below fixes p7zip (clang 6.0).
> >
> > OK?
> >
> >
> > Index: patches/patch-CPP_Windows_ErrorMsg_cpp
> > ===================================================================
> > RCS file: patches/patch-CPP_Windows_ErrorMsg_cpp
> > diff -N patches/patch-CPP_Windows_ErrorMsg_cpp
> > --- /dev/null 1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-CPP_Windows_ErrorMsg_cpp 7 Apr 2018 13:11:53 -0000
> > @@ -0,0 +1,30 @@
> > +$OpenBSD$
> > +
> > +Index: CPP/Windows/ErrorMsg.cpp
> > +--- CPP/Windows/ErrorMsg.cpp.orig
> > ++++ CPP/Windows/ErrorMsg.cpp
> > +@@ -14,15 +14,15 @@ UString MyFormatMessage(DWORD errorCode)
> > +   AString msg;
> > +
> > +   switch(errorCode) {
>
> Please use only:
>
> switch(static_cast<int>(errorCode))
>
> ok to that.

...which results is a much smaller additional patch. Thanks!

OK?


Index: patches/patch-CPP_Windows_ErrorMsg_cpp
===================================================================
RCS file: patches/patch-CPP_Windows_ErrorMsg_cpp
diff -N patches/patch-CPP_Windows_ErrorMsg_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-CPP_Windows_ErrorMsg_cpp 7 Apr 2018 15:25:11 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: CPP/Windows/ErrorMsg.cpp
+--- CPP/Windows/ErrorMsg.cpp.orig
++++ CPP/Windows/ErrorMsg.cpp
+@@ -13,7 +13,7 @@ UString MyFormatMessage(DWORD errorCode)
+   const char * txt = 0;
+   AString msg;
+
+-  switch(errorCode) {
++  switch(static_cast<int>(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 ;

Reply | Threaded
Open this post in threaded view
|

Re: FIX archivers/p7zip - fix for clang 6.0

Josh Grosse-3
On Sat, Apr 07, 2018 at 05:26:50PM +0200, Bj??rn Ketelaars wrote:

> On Sat 07/04/2018 16:52, Rafael Sadowski wrote:
> > Please use only:
> >
> > switch(static_cast<int>(errorCode))
> >
> > ok to that.
>
> ...which results is a much smaller additional patch. Thanks!
>
> OK?
Maintainer's OK with the addition of a REVISION bump.

p7zip.16.02p4.patch (1K) Download Attachment