[MPlayer-dev-eng] [PATCH] Remove direct uses of __attribute__((packed)).

KO Myung-Hun komh78 at gmail.com
Tue Jan 26 07:45:01 EET 2021


Hi/2.

Reimar Döffinger wrote:
> It is not portable and ideally it should not be used
> at all.
> However as a quick-fix wrap it in a macro so it is not
> necessary to edit each occurrence individually to support
> other compilers.
> Code that is completely platform-dependent anyway is not changed
> at this point.
> ---
>  libmpcodecs/ad_realaud.c       |  5 +-
>  libmpdemux/asf.h               | 29 ++++++++---
>  libmpdemux/aviheader.h         |  5 +-
>  libmpdemux/demux_ogg.c         |  5 +-
>  libmpdemux/ms_hdr.h            | 23 ++++++---
>  loader/dshow/guids.h           | 15 ++++--
>  loader/dshow/mediatype.h       |  5 +-
>  loader/qtx/qtxsdk/components.h | 90 +++++++++++++++++++++++++---------
>  mppacked.h                     | 33 +++++++++++++
>  stream/stream_netstream.h      |  9 +++-
>  stream/tvi_dshow.c             |  5 +-
>  11 files changed, 179 insertions(+), 45 deletions(-)
>  create mode 100644 mppacked.h
> 

[...]

> diff --git a/loader/dshow/guids.h b/loader/dshow/guids.h
> index 76a4970d2..cd708f7c7 100644
> --- a/loader/dshow/guids.h
> +++ b/loader/dshow/guids.h
> @@ -18,18 +18,26 @@ under MinGW
> 
>  #include "mediatype.h"
> 
> +#include "mppacked.h"
> +
>  //#define Debug if(1)
>  #define Debug if(0)
> 
> 
>  typedef long long REFERENCE_TIME;
> 
> -typedef struct __attribute__((__packed__)) RECT32
> +MP_PACKED(
> +typedef struct, RECT32
>  {
> -    int left, top, right, bottom;
> +    int left
> +    int top
> +    int right

';' missing.

> +    int bottom;
>  } RECT32;
> +)
> 
> -typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER
> +MP_PACKED(
> +typedef struct, tagVIDEOINFOHEADER
>  {
>      RECT32            rcSource;          // The bit we really want to use
>      RECT32            rcTarget;          // Where the video should go
> @@ -39,6 +47,7 @@ typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER
>      BITMAPINFOHEADER  bmiHeader;
>      //int               reserved[3];
>  } VIDEOINFOHEADER;
> +)
> 
>  typedef GUID CLSID;
>  typedef GUID IID;

[...]

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v6.1.10 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/



More information about the MPlayer-dev-eng mailing list