[vlc-devel] [PATCH] define __STDC_*_MACROS in vlc_fixups.h

KO Myung-Hun komh78 at gmail.com
Thu Jun 18 11:22:52 CEST 2015


Hi/2.

Thomas Guillem wrote:
> ---
>  include/vlc_fixups.h                                     | 14 ++++++++++++++
>  modules/access/dcp/dcp.cpp                               |  1 -
>  modules/access/decklink.cpp                              |  2 --
>  modules/access/dshow/dshow.cpp                           |  2 --
>  modules/access/live555.cpp                               |  6 ------
>  modules/demux/adaptative/PlaylistManager.cpp             |  6 ------
>  modules/demux/adaptative/Streams.cpp                     |  1 -
>  modules/demux/adaptative/playlist/Segment.cpp            |  1 -
>  modules/demux/adaptative/playlist/SegmentInformation.hpp |  4 ----
>  modules/demux/adaptative/playlist/SegmentTimeline.cpp    |  1 -
>  modules/demux/dash/DASHManager.cpp                       |  6 ------
>  modules/demux/dash/dash.cpp                              |  1 -
>  modules/demux/dash/mp4/AtomsReader.hpp                   |  2 --
>  modules/demux/dash/mpd/DASHSegment.cpp                   |  1 -
>  modules/demux/hls/hls.cpp                                |  1 -
>  modules/demux/hls/playlist/Tags.cpp                      |  1 -
>  modules/demux/hls/playlist/Tags.hpp                      |  4 ----
>  modules/demux/mkv/mkv.hpp                                |  7 -------
>  modules/demux/sid.cpp                                    |  5 -----
>  modules/gui/qt4/components/extended_panels.cpp           |  2 --
>  modules/gui/qt4/components/info_panels.cpp               |  3 ---
>  modules/gui/qt4/input_manager.cpp                        |  3 ---
>  modules/gui/qt4/menus.cpp                                |  3 ---
>  modules/services_discovery/upnp.cpp                      |  2 --
>  modules/stream_out/chromecast/cast.cpp                   |  4 ----
>  modules/video_filter/atmo/AtmoLiveView.cpp               |  2 --
>  modules/video_filter/atmo/atmo.cpp                       |  1 -
>  modules/video_output/decklink.cpp                        |  3 ---
>  modules/visualization/projectm.cpp                       |  3 ---
>  modules/visualization/vsxu.cpp                           |  3 ---
>  30 files changed, 14 insertions(+), 81 deletions(-)
> 

I eagerly want this patch. ^^

> diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
> index f844641..451a437 100644
> --- a/include/vlc_fixups.h
> +++ b/include/vlc_fixups.h
> @@ -26,6 +26,20 @@
>  #ifndef LIBVLC_FIXUPS_H
>  # define LIBVLC_FIXUPS_H 1
>  
> +/* C++11 says there's no need to define __STDC_*_MACROS when including
> + * inttypes.h and stdint.h. However, some bugged hosts still need them. */
> +#ifdef __cplusplus
> +#ifndef __STDC_FORMAT_MACROS
> +#define __STDC_FORMAT_MACROS 1
> +#endif
> +#ifndef __STDC_CONSTANT_MACROS
> +#define __STDC_CONSTANT_MACROS 1
> +#endif
> +#ifndef __STDC_LIMIT_MACROS
> +#define __STDC_LIMIT_MACROS 1
> +#endif
> +#endif
> +
>  #if !defined (HAVE_GMTIME_R) || !defined (HAVE_LOCALTIME_R)
>  # include <time.h> /* time_t */
>  #endif
> diff --git a/modules/access/dcp/dcp.cpp b/modules/access/dcp/dcp.cpp
> index e53b1f8..691b1d7 100644
> --- a/modules/access/dcp/dcp.cpp
> +++ b/modules/access/dcp/dcp.cpp
> @@ -40,7 +40,6 @@
>  # include "config.h"
>  #endif
>  
> -#define __STDC_CONSTANT_MACROS 1
>  #define KDM_HELP_TEXT          "KDM file"
>  #define KDM_HELP_LONG_TEXT     "Path to Key Delivery Message XML file"
>  
> diff --git a/modules/access/decklink.cpp b/modules/access/decklink.cpp
> index d1b9c33..55c48b8 100644
> --- a/modules/access/decklink.cpp
> +++ b/modules/access/decklink.cpp
> @@ -22,8 +22,6 @@
>   * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
>  
> -#define __STDC_CONSTANT_MACROS 1
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
> index 990b2fb..9e27f99 100644
> --- a/modules/access/dshow/dshow.cpp
> +++ b/modules/access/dshow/dshow.cpp
> @@ -30,8 +30,6 @@
>  # include "config.h"
>  #endif
>  
> -#define __STDC_CONSTANT_MACROS 1
> -#define __STDC_FORMAT_MACROS 1
>  #define CFG_PREFIX "dshow-"
>  #include <inttypes.h>
>  #include <list>
> diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
> index a3faa77..4b84e8e 100644
> --- a/modules/access/live555.cpp
> +++ b/modules/access/live555.cpp
> @@ -28,12 +28,6 @@
>   * Preamble
>   *****************************************************************************/
>  
> -/* For inttypes.h
> - * Note: config.h may include inttypes.h, so make sure we define this option
> - * early enough. */
> -#define __STDC_CONSTANT_MACROS 1
> -#define __STDC_LIMIT_MACROS 1
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/demux/adaptative/PlaylistManager.cpp b/modules/demux/adaptative/PlaylistManager.cpp
> index 1a0b7c2..4caa4be 100644
> --- a/modules/demux/adaptative/PlaylistManager.cpp
> +++ b/modules/demux/adaptative/PlaylistManager.cpp
> @@ -19,12 +19,6 @@
>   * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
>  
> -/* config.h may include inttypes.h, so make sure we define that option
> - * early enough. */
> -#define __STDC_FORMAT_MACROS
> -#define __STDC_CONSTANT_MACROS
> -#define __STDC_LIMIT_MACROS
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
> index 2c5a0c2..c5a8807 100644
> --- a/modules/demux/adaptative/Streams.cpp
> +++ b/modules/demux/adaptative/Streams.cpp
> @@ -17,7 +17,6 @@
>   * along with this program; if not, write to the Free Software Foundation,
>   * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
> -#define __STDC_CONSTANT_MACROS
>  #include "Streams.hpp"
>  #include "StreamsType.hpp"
>  #include "http/HTTPConnection.hpp"
> diff --git a/modules/demux/adaptative/playlist/Segment.cpp b/modules/demux/adaptative/playlist/Segment.cpp
> index 5b738d5..96aa168 100644
> --- a/modules/demux/adaptative/playlist/Segment.cpp
> +++ b/modules/demux/adaptative/playlist/Segment.cpp
> @@ -21,7 +21,6 @@
>   * along with this program; if not, write to the Free Software Foundation,
>   * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
> -#define __STDC_CONSTANT_MACROS
>  
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
> diff --git a/modules/demux/adaptative/playlist/SegmentInformation.hpp b/modules/demux/adaptative/playlist/SegmentInformation.hpp
> index adae8d0..11c4160 100644
> --- a/modules/demux/adaptative/playlist/SegmentInformation.hpp
> +++ b/modules/demux/adaptative/playlist/SegmentInformation.hpp
> @@ -20,10 +20,6 @@
>  #ifndef SEGMENTINFORMATION_HPP
>  #define SEGMENTINFORMATION_HPP
>  
> -#ifndef __STDC_CONSTANT_MACROS
> -  #define __STDC_CONSTANT_MACROS
> -#endif
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/demux/adaptative/playlist/SegmentTimeline.cpp b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
> index 9101a62..2fe0bcd 100644
> --- a/modules/demux/adaptative/playlist/SegmentTimeline.cpp
> +++ b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
> @@ -20,7 +20,6 @@
>   * along with this program; if not, write to the Free Software Foundation,
>   * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
> -#define __STDC_CONSTANT_MACROS
>  
>  #include "SegmentTimeline.h"
>  
> diff --git a/modules/demux/dash/DASHManager.cpp b/modules/demux/dash/DASHManager.cpp
> index e39ef6b..c387460 100644
> --- a/modules/demux/dash/DASHManager.cpp
> +++ b/modules/demux/dash/DASHManager.cpp
> @@ -22,12 +22,6 @@
>   * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
>  
> -/* config.h may include inttypes.h, so make sure we define that option
> - * early enough. */
> -#define __STDC_FORMAT_MACROS 1
> -#define __STDC_CONSTANT_MACROS 1
> -#define __STDC_LIMIT_MACROS 1
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/demux/dash/dash.cpp b/modules/demux/dash/dash.cpp
> index e5a17ef..bb3a0a7 100644
> --- a/modules/demux/dash/dash.cpp
> +++ b/modules/demux/dash/dash.cpp
> @@ -25,7 +25,6 @@
>  /*****************************************************************************
>   * Preamble
>   *****************************************************************************/
> -#define __STDC_CONSTANT_MACROS 1
>  
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
> diff --git a/modules/demux/dash/mp4/AtomsReader.hpp b/modules/demux/dash/mp4/AtomsReader.hpp
> index ed04ffb..d7fa964 100644
> --- a/modules/demux/dash/mp4/AtomsReader.hpp
> +++ b/modules/demux/dash/mp4/AtomsReader.hpp
> @@ -20,8 +20,6 @@
>  #ifndef ATOMSREADER_HPP
>  #define ATOMSREADER_HPP
>  
> -#define __STDC_CONSTANT_MACROS
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/demux/dash/mpd/DASHSegment.cpp b/modules/demux/dash/mpd/DASHSegment.cpp
> index 71f517b..a940251 100644
> --- a/modules/demux/dash/mpd/DASHSegment.cpp
> +++ b/modules/demux/dash/mpd/DASHSegment.cpp
> @@ -21,7 +21,6 @@
>   * along with this program; if not, write to the Free Software Foundation,
>   * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
> -#define __STDC_CONSTANT_MACROS
>  
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
> diff --git a/modules/demux/hls/hls.cpp b/modules/demux/hls/hls.cpp
> index 1385c2b..943b585 100644
> --- a/modules/demux/hls/hls.cpp
> +++ b/modules/demux/hls/hls.cpp
> @@ -21,7 +21,6 @@
>  /*****************************************************************************
>   * Preamble
>   *****************************************************************************/
> -#define __STDC_CONSTANT_MACROS 1
>  
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
> diff --git a/modules/demux/hls/playlist/Tags.cpp b/modules/demux/hls/playlist/Tags.cpp
> index 8ad96ac..30dca03 100644
> --- a/modules/demux/hls/playlist/Tags.cpp
> +++ b/modules/demux/hls/playlist/Tags.cpp
> @@ -21,7 +21,6 @@
>  #include <sstream>
>  #include <stack>
>  
> -#define __STDC_CONSTANT_MACROS
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/demux/hls/playlist/Tags.hpp b/modules/demux/hls/playlist/Tags.hpp
> index 0820f7f..229f0db 100644
> --- a/modules/demux/hls/playlist/Tags.hpp
> +++ b/modules/demux/hls/playlist/Tags.hpp
> @@ -20,10 +20,6 @@
>  #ifndef TAGS_HPP
>  #define TAGS_HPP
>  
> -#ifndef __STDC_CONSTANT_MACROS
> - #define __STDC_CONSTANT_MACROS
> -#endif
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
> index 7157bda..b547641 100644
> --- a/modules/demux/mkv/mkv.hpp
> +++ b/modules/demux/mkv/mkv.hpp
> @@ -29,13 +29,6 @@
>   * Preamble
>   *****************************************************************************/
>  
> -
> -/* config.h may include inttypes.h, so make sure we define that option
> - * early enough. */
> -#define __STDC_FORMAT_MACROS 1
> -#define __STDC_CONSTANT_MACROS 1
> -#define __STDC_LIMIT_MACROS 1
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/demux/sid.cpp b/modules/demux/sid.cpp
> index c31a659..d2a71a3 100644
> --- a/modules/demux/sid.cpp
> +++ b/modules/demux/sid.cpp
> @@ -33,11 +33,6 @@
>  # include <config.h>
>  #endif
>  
> -/* INT64_C and UINT64_C are only exposed to c++ if this is defined */
> -#ifndef __STDC_CONSTANT_MACROS
> -# define __STDC_CONSTANT_MACROS
> -#endif
> -
>  #include <vlc_common.h>
>  #include <vlc_input.h>
>  #include <vlc_demux.h>
> diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
> index e1d44cc..14711d6 100644
> --- a/modules/gui/qt4/components/extended_panels.cpp
> +++ b/modules/gui/qt4/components/extended_panels.cpp
> @@ -23,8 +23,6 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
>  
> -#define __STDC_FORMAT_MACROS 1
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/gui/qt4/components/info_panels.cpp b/modules/gui/qt4/components/info_panels.cpp
> index a2d8db1..3ebff49 100644
> --- a/modules/gui/qt4/components/info_panels.cpp
> +++ b/modules/gui/qt4/components/info_panels.cpp
> @@ -23,9 +23,6 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
>  
> -#define __STDC_FORMAT_MACROS 1
> -#define __STDC_CONSTANT_MACROS 1
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
> index 669e93e..b12cf2d 100644
> --- a/modules/gui/qt4/input_manager.cpp
> +++ b/modules/gui/qt4/input_manager.cpp
> @@ -23,9 +23,6 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
>  
> -#define __STDC_FORMAT_MACROS 1
> -#define __STDC_CONSTANT_MACROS 1
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
> index 8916130..9b27f32 100644
> --- a/modules/gui/qt4/menus.cpp
> +++ b/modules/gui/qt4/menus.cpp
> @@ -27,9 +27,6 @@
>   * - Remove static currentGroup
>   */
>  
> -#define __STDC_FORMAT_MACROS 1
> -#define __STDC_CONSTANT_MACROS 1
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
> index 602950b..27e965c 100644
> --- a/modules/services_discovery/upnp.cpp
> +++ b/modules/services_discovery/upnp.cpp
> @@ -26,8 +26,6 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>   *****************************************************************************/
>  
> -#define __STDC_CONSTANT_MACROS 1
> -
>  #include "upnp.hpp"
>  
>  #include <vlc_access.h>
> diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
> index f568150..d609e49 100644
> --- a/modules/stream_out/chromecast/cast.cpp
> +++ b/modules/stream_out/chromecast/cast.cpp
> @@ -33,10 +33,6 @@
>  # include <poll.h>
>  #endif
>  
> -#ifndef __STDC_CONSTANT_MACROS
> -# define __STDC_CONSTANT_MACROS
> -#endif
> -
>  #include <vlc_common.h>
>  #include <vlc_plugin.h>
>  #include <vlc_sout.h>
> diff --git a/modules/video_filter/atmo/AtmoLiveView.cpp b/modules/video_filter/atmo/AtmoLiveView.cpp
> index 8cef916..fb03c14 100644
> --- a/modules/video_filter/atmo/AtmoLiveView.cpp
> +++ b/modules/video_filter/atmo/AtmoLiveView.cpp
> @@ -12,8 +12,6 @@
>  # include "config.h"
>  #endif
>  
> -#define __STDC_FORMAT_MACROS 1
> -
>  #include "AtmoDefs.h"
>  #include "AtmoLiveView.h"
>  #include "AtmoOutputFilter.h"
> diff --git a/modules/video_filter/atmo/atmo.cpp b/modules/video_filter/atmo/atmo.cpp
> index 5de3e6b..4b1f1c8 100644
> --- a/modules/video_filter/atmo/atmo.cpp
> +++ b/modules/video_filter/atmo/atmo.cpp
> @@ -28,7 +28,6 @@
>  /*****************************************************************************
>  * Preamble
>  *****************************************************************************/
> -#define __STDC_FORMAT_MACROS 1
>  #include <stdlib.h>                                      /* malloc(), free() */
>  #include <string.h>
>  #include <math.h>                                            /* sin(), cos() */
> diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
> index c0b2d1e..62087d3 100644
> --- a/modules/video_output/decklink.cpp
> +++ b/modules/video_output/decklink.cpp
> @@ -26,9 +26,6 @@
>   * TODO: test non stereo audio
>   */
>  
> -#define __STDC_FORMAT_MACROS
> -#define __STDC_CONSTANT_MACROS
> -
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> diff --git a/modules/visualization/projectm.cpp b/modules/visualization/projectm.cpp
> index 9d2cf53..2fe007d 100644
> --- a/modules/visualization/projectm.cpp
> +++ b/modules/visualization/projectm.cpp
> @@ -25,9 +25,6 @@
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> -#ifndef __STDC_CONSTANT_MACROS
> -# define __STDC_CONSTANT_MACROS
> -#endif
>  
>  #include <vlc_common.h>
>  #include <vlc_plugin.h>
> diff --git a/modules/visualization/vsxu.cpp b/modules/visualization/vsxu.cpp
> index d71bbf1..a58e162 100644
> --- a/modules/visualization/vsxu.cpp
> +++ b/modules/visualization/vsxu.cpp
> @@ -28,9 +28,6 @@
>  #ifdef HAVE_CONFIG_H
>  # include "config.h"
>  #endif
> -#ifndef __STDC_CONSTANT_MACROS
> -# define __STDC_CONSTANT_MACROS
> -#endif
>  
>  #include <vlc_common.h>
>  #include <vlc_plugin.h>



More information about the vlc-devel mailing list