diff --git a/Android.mk b/Android.mk index 8149a08..b46ba10 100644 --- a/Android.mk +++ b/Android.mk @@ -3,7 +3,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE:= libwebm LOCAL_CPPFLAGS:=-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -LOCAL_CPPFLAGS+=-D__STDC_LIMIT_MACROS -Wno-extern-c-compat +LOCAL_CPPFLAGS+=-D__STDC_LIMIT_MACROS -std=c++11 LOCAL_C_INCLUDES:= $(LOCAL_PATH) LOCAL_EXPORT_C_INCLUDES:= $(LOCAL_PATH) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05da869..ba42a7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,9 +21,7 @@ option(ENABLE_IWYU "Enables include-what-you-use support." OFF) option(ENABLE_WERROR "Enable warnings as errors." OFF) option(ENABLE_WEBM_PARSER "Enables new parser API." OFF) -if (ENABLE_TESTS OR ENABLE_WEBMTS OR ENABLE_WEBMINFO OR ENABLE_WEBM_PARSER) - require_cxx_flag_nomsvc("-std=c++11") -endif () +require_cxx_flag_nomsvc("-std=c++11") add_cxx_preproc_definition("__STDC_CONSTANT_MACROS") add_cxx_preproc_definition("__STDC_FORMAT_MACROS") diff --git a/Makefile.unix b/Makefile.unix index 09e24f0..0430d17 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -2,7 +2,7 @@ CXX := g++ DEFINES := -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS DEFINES += -D__STDC_LIMIT_MACROS INCLUDES := -I. -CXXFLAGS := -W -Wall -g +CXXFLAGS := -W -Wall -g -std=c++11 ALL_CXXFLAGS := -MMD -MP $(DEFINES) $(INCLUDES) $(CXXFLAGS) LIBWEBMA := libwebm.a LIBWEBMSO := libwebm.so diff --git a/common/hdr_util.cc b/common/hdr_util.cc index e1618ce..916f717 100644 --- a/common/hdr_util.cc +++ b/common/hdr_util.cc @@ -36,10 +36,10 @@ bool CopyMasteringMetadata(const mkvparser::MasteringMetadata& parser_mm, if (MasteringMetadataValuePresent(parser_mm.luminance_min)) muxer_mm->set_luminance_min(parser_mm.luminance_min); - PrimaryChromaticityPtr r_ptr(NULL); - PrimaryChromaticityPtr g_ptr(NULL); - PrimaryChromaticityPtr b_ptr(NULL); - PrimaryChromaticityPtr wp_ptr(NULL); + PrimaryChromaticityPtr r_ptr(nullptr); + PrimaryChromaticityPtr g_ptr(nullptr); + PrimaryChromaticityPtr b_ptr(nullptr); + PrimaryChromaticityPtr wp_ptr(nullptr); if (parser_mm.r) { if (!CopyPrimaryChromaticity(*parser_mm.r, &r_ptr)) diff --git a/common/hdr_util.h b/common/hdr_util.h index c414aaf..78e2eeb 100644 --- a/common/hdr_util.h +++ b/common/hdr_util.h @@ -47,19 +47,7 @@ struct Vp9CodecFeatures { int chroma_subsampling; }; -// disable deprecation warnings for auto_ptr -#if defined(__GNUC__) -#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif -#endif -typedef std::auto_ptr PrimaryChromaticityPtr; -#if defined(__GNUC__) -#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) -#pragma GCC diagnostic pop -#endif -#endif +typedef std::unique_ptr PrimaryChromaticityPtr; bool CopyPrimaryChromaticity(const mkvparser::PrimaryChromaticity& parser_pc, PrimaryChromaticityPtr* muxer_pc); diff --git a/mkvmuxer/mkvmuxer.cc b/mkvmuxer/mkvmuxer.cc index 71f026a..481771d 100644 --- a/mkvmuxer/mkvmuxer.cc +++ b/mkvmuxer/mkvmuxer.cc @@ -26,13 +26,6 @@ #include "mkvmuxer/mkvwriter.h" #include "mkvparser/mkvparser.h" -// disable deprecation warnings for auto_ptr -#if defined(__GNUC__) -#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif -#endif - namespace mkvmuxer { const float PrimaryChromaticity::kChromaticityMin = 0.0f; @@ -76,7 +69,7 @@ bool StrCpy(const char* src, char** dst_ptr) { return true; } -typedef std::auto_ptr PrimaryChromaticityPtr; +typedef std::unique_ptr PrimaryChromaticityPtr; bool CopyChromaticity(const PrimaryChromaticity* src, PrimaryChromaticityPtr* dst) { if (!dst) @@ -1061,22 +1054,22 @@ bool MasteringMetadata::Write(IMkvWriter* writer) const { bool MasteringMetadata::SetChromaticity( const PrimaryChromaticity* r, const PrimaryChromaticity* g, const PrimaryChromaticity* b, const PrimaryChromaticity* white_point) { - PrimaryChromaticityPtr r_ptr(NULL); + PrimaryChromaticityPtr r_ptr(nullptr); if (r) { if (!CopyChromaticity(r, &r_ptr)) return false; } - PrimaryChromaticityPtr g_ptr(NULL); + PrimaryChromaticityPtr g_ptr(nullptr); if (g) { if (!CopyChromaticity(g, &g_ptr)) return false; } - PrimaryChromaticityPtr b_ptr(NULL); + PrimaryChromaticityPtr b_ptr(nullptr); if (b) { if (!CopyChromaticity(b, &b_ptr)) return false; } - PrimaryChromaticityPtr wp_ptr(NULL); + PrimaryChromaticityPtr wp_ptr(nullptr); if (white_point) { if (!CopyChromaticity(white_point, &wp_ptr)) return false; @@ -1242,7 +1235,7 @@ bool Colour::Write(IMkvWriter* writer) const { } bool Colour::SetMasteringMetadata(const MasteringMetadata& mastering_metadata) { - std::auto_ptr mm_ptr(new MasteringMetadata()); + std::unique_ptr mm_ptr(new MasteringMetadata()); if (!mm_ptr.get()) return false; @@ -1550,7 +1543,7 @@ bool VideoTrack::Write(IMkvWriter* writer) const { } bool VideoTrack::SetColour(const Colour& colour) { - std::auto_ptr colour_ptr(new Colour()); + std::unique_ptr colour_ptr(new Colour()); if (!colour_ptr.get()) return false; @@ -1578,7 +1571,7 @@ bool VideoTrack::SetColour(const Colour& colour) { } bool VideoTrack::SetProjection(const Projection& projection) { - std::auto_ptr projection_ptr(new Projection()); + std::unique_ptr projection_ptr(new Projection()); if (!projection_ptr.get()) return false; diff --git a/mkvmuxer_sample.cc b/mkvmuxer_sample.cc index e534582..6261804 100644 --- a/mkvmuxer_sample.cc +++ b/mkvmuxer_sample.cc @@ -29,11 +29,6 @@ #include "sample_muxer_metadata.h" -// disable deprecation warnings for auto_ptr -#if defined(__GNUC__) && __GNUC__ >= 5 -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - namespace { void Usage() { @@ -350,7 +345,7 @@ int main(int argc, char* argv[]) { return EXIT_FAILURE; } - const std::auto_ptr parser_segment(parser_segment_); + const std::unique_ptr parser_segment(parser_segment_); ret = parser_segment->Load(); if (ret < 0) { printf("\n Segment::Load() failed."); diff --git a/mkvparser/mkvparser.cc b/mkvparser/mkvparser.cc index d4f8e5e..99131d8 100644 --- a/mkvparser/mkvparser.cc +++ b/mkvparser/mkvparser.cc @@ -22,13 +22,6 @@ #include "common/webmids.h" -// disable deprecation warnings for auto_ptr -#if defined(__GNUC__) -#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif -#endif - namespace mkvparser { const float MasteringMetadata::kValueNotPresent = FLT_MAX; const long long Colour::kValueNotPresent = LLONG_MAX; @@ -5017,7 +5010,7 @@ bool MasteringMetadata::Parse(IMkvReader* reader, long long mm_start, if (!reader || *mm) return false; - std::auto_ptr mm_ptr(new MasteringMetadata()); + std::unique_ptr mm_ptr(new MasteringMetadata()); if (!mm_ptr.get()) return false; @@ -5106,7 +5099,7 @@ bool Colour::Parse(IMkvReader* reader, long long colour_start, if (!reader || *colour) return false; - std::auto_ptr colour_ptr(new Colour()); + std::unique_ptr colour_ptr(new Colour()); if (!colour_ptr.get()) return false; @@ -5204,7 +5197,7 @@ bool Projection::Parse(IMkvReader* reader, long long start, long long size, if (!reader || *projection) return false; - std::auto_ptr projection_ptr(new Projection()); + std::unique_ptr projection_ptr(new Projection()); if (!projection_ptr.get()) return false; diff --git a/mkvparser_sample.cc b/mkvparser_sample.cc index 6f7dc00..f285c3e 100644 --- a/mkvparser_sample.cc +++ b/mkvparser_sample.cc @@ -16,13 +16,6 @@ #include "mkvparser/mkvparser.h" #include "mkvparser/mkvreader.h" -// disable deprecation warnings for auto_ptr -#if defined(__GNUC__) -#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif -#endif - namespace { const wchar_t* utf8towcs(const char* str) { if (str == NULL) @@ -115,7 +108,7 @@ int main(int argc, char* argv[]) { return EXIT_FAILURE; } - const std::auto_ptr pSegment(pSegment_); + const std::unique_ptr pSegment(pSegment_); ret = pSegment->Load(); if (ret < 0) { diff --git a/vttdemux.cc b/vttdemux.cc index 62f987d..186783b 100644 --- a/vttdemux.cc +++ b/vttdemux.cc @@ -20,19 +20,12 @@ using std::string; -// disable deprecation warnings for auto_ptr -#if defined(__GNUC__) -#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif -#endif - namespace libwebm { namespace vttdemux { typedef long long mkvtime_t; // NOLINT typedef long long mkvpos_t; // NOLINT -typedef std::auto_ptr segment_ptr_t; +typedef std::unique_ptr segment_ptr_t; // WebVTT metadata tracks have a type (encoded in the CodecID for the track). // We use |type| to synthesize a filename for the out-of-band WebVTT |file|. diff --git a/webm_info.cc b/webm_info.cc index 2a97629..03077e7 100644 --- a/webm_info.cc +++ b/webm_info.cc @@ -1190,8 +1190,7 @@ int main(int argc, char* argv[]) { return EXIT_FAILURE; } - // TODO(fgalligan): Replace auto_ptr with scoped_ptr. - std::auto_ptr reader( + std::unique_ptr reader( new (std::nothrow) mkvparser::MkvReader()); // NOLINT if (reader->Open(input.c_str())) { fprintf(stderr, "Error opening file:%s\n", input.c_str()); @@ -1199,7 +1198,7 @@ int main(int argc, char* argv[]) { } long long int pos = 0; - std::auto_ptr ebml_header( + std::unique_ptr ebml_header( new (std::nothrow) mkvparser::EBMLHeader()); // NOLINT if (ebml_header->Parse(reader.get(), pos) < 0) { fprintf(stderr, "Error parsing EBML header.\n"); @@ -1217,7 +1216,7 @@ int main(int argc, char* argv[]) { fprintf(stderr, "Segment::CreateInstance() failed.\n"); return EXIT_FAILURE; } - std::auto_ptr segment(temp_segment); + std::unique_ptr segment(temp_segment); if (segment->Load() < 0) { fprintf(stderr, "Segment::Load() failed.\n");