Merge "Replace uses of deprecated std::auto_ptr with std::unique_ptr."
This commit is contained in:
		| @@ -3,7 +3,7 @@ LOCAL_PATH:= $(call my-dir) | |||||||
| include $(CLEAR_VARS) | include $(CLEAR_VARS) | ||||||
| LOCAL_MODULE:= libwebm | LOCAL_MODULE:= libwebm | ||||||
| LOCAL_CPPFLAGS:=-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS | 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_C_INCLUDES:= $(LOCAL_PATH) | ||||||
| LOCAL_EXPORT_C_INCLUDES:= $(LOCAL_PATH) | LOCAL_EXPORT_C_INCLUDES:= $(LOCAL_PATH) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,9 +21,7 @@ option(ENABLE_IWYU "Enables include-what-you-use support." OFF) | |||||||
| option(ENABLE_WERROR "Enable warnings as errors." OFF) | option(ENABLE_WERROR "Enable warnings as errors." OFF) | ||||||
| option(ENABLE_WEBM_PARSER "Enables new parser API." 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") | ||||||
|   require_cxx_flag_nomsvc("-std=c++11") |  | ||||||
| endif () |  | ||||||
|  |  | ||||||
| add_cxx_preproc_definition("__STDC_CONSTANT_MACROS") | add_cxx_preproc_definition("__STDC_CONSTANT_MACROS") | ||||||
| add_cxx_preproc_definition("__STDC_FORMAT_MACROS") | add_cxx_preproc_definition("__STDC_FORMAT_MACROS") | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ CXX       := g++ | |||||||
| DEFINES   := -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS | DEFINES   := -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS | ||||||
| DEFINES   += -D__STDC_LIMIT_MACROS | DEFINES   += -D__STDC_LIMIT_MACROS | ||||||
| INCLUDES  := -I. | INCLUDES  := -I. | ||||||
| CXXFLAGS  := -W -Wall -g | CXXFLAGS  := -W -Wall -g -std=c++11 | ||||||
| ALL_CXXFLAGS := -MMD -MP $(DEFINES) $(INCLUDES) $(CXXFLAGS) | ALL_CXXFLAGS := -MMD -MP $(DEFINES) $(INCLUDES) $(CXXFLAGS) | ||||||
| LIBWEBMA  := libwebm.a | LIBWEBMA  := libwebm.a | ||||||
| LIBWEBMSO := libwebm.so | LIBWEBMSO := libwebm.so | ||||||
|   | |||||||
| @@ -36,10 +36,10 @@ bool CopyMasteringMetadata(const mkvparser::MasteringMetadata& parser_mm, | |||||||
|   if (MasteringMetadataValuePresent(parser_mm.luminance_min)) |   if (MasteringMetadataValuePresent(parser_mm.luminance_min)) | ||||||
|     muxer_mm->set_luminance_min(parser_mm.luminance_min); |     muxer_mm->set_luminance_min(parser_mm.luminance_min); | ||||||
|  |  | ||||||
|   PrimaryChromaticityPtr r_ptr(NULL); |   PrimaryChromaticityPtr r_ptr(nullptr); | ||||||
|   PrimaryChromaticityPtr g_ptr(NULL); |   PrimaryChromaticityPtr g_ptr(nullptr); | ||||||
|   PrimaryChromaticityPtr b_ptr(NULL); |   PrimaryChromaticityPtr b_ptr(nullptr); | ||||||
|   PrimaryChromaticityPtr wp_ptr(NULL); |   PrimaryChromaticityPtr wp_ptr(nullptr); | ||||||
|  |  | ||||||
|   if (parser_mm.r) { |   if (parser_mm.r) { | ||||||
|     if (!CopyPrimaryChromaticity(*parser_mm.r, &r_ptr)) |     if (!CopyPrimaryChromaticity(*parser_mm.r, &r_ptr)) | ||||||
|   | |||||||
| @@ -47,19 +47,7 @@ struct Vp9CodecFeatures { | |||||||
|   int chroma_subsampling; |   int chroma_subsampling; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // disable deprecation warnings for auto_ptr | typedef std::unique_ptr<mkvmuxer::PrimaryChromaticity> PrimaryChromaticityPtr; | ||||||
| #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<mkvmuxer::PrimaryChromaticity> PrimaryChromaticityPtr; |  | ||||||
| #if defined(__GNUC__) |  | ||||||
| #if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) |  | ||||||
| #pragma GCC diagnostic pop |  | ||||||
| #endif |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| bool CopyPrimaryChromaticity(const mkvparser::PrimaryChromaticity& parser_pc, | bool CopyPrimaryChromaticity(const mkvparser::PrimaryChromaticity& parser_pc, | ||||||
|                              PrimaryChromaticityPtr* muxer_pc); |                              PrimaryChromaticityPtr* muxer_pc); | ||||||
|   | |||||||
| @@ -26,13 +26,6 @@ | |||||||
| #include "mkvmuxer/mkvwriter.h" | #include "mkvmuxer/mkvwriter.h" | ||||||
| #include "mkvparser/mkvparser.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 { | namespace mkvmuxer { | ||||||
|  |  | ||||||
| const float PrimaryChromaticity::kChromaticityMin = 0.0f; | const float PrimaryChromaticity::kChromaticityMin = 0.0f; | ||||||
| @@ -76,7 +69,7 @@ bool StrCpy(const char* src, char** dst_ptr) { | |||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
|  |  | ||||||
| typedef std::auto_ptr<PrimaryChromaticity> PrimaryChromaticityPtr; | typedef std::unique_ptr<PrimaryChromaticity> PrimaryChromaticityPtr; | ||||||
| bool CopyChromaticity(const PrimaryChromaticity* src, | bool CopyChromaticity(const PrimaryChromaticity* src, | ||||||
|                       PrimaryChromaticityPtr* dst) { |                       PrimaryChromaticityPtr* dst) { | ||||||
|   if (!dst) |   if (!dst) | ||||||
| @@ -1061,22 +1054,22 @@ bool MasteringMetadata::Write(IMkvWriter* writer) const { | |||||||
| bool MasteringMetadata::SetChromaticity( | bool MasteringMetadata::SetChromaticity( | ||||||
|     const PrimaryChromaticity* r, const PrimaryChromaticity* g, |     const PrimaryChromaticity* r, const PrimaryChromaticity* g, | ||||||
|     const PrimaryChromaticity* b, const PrimaryChromaticity* white_point) { |     const PrimaryChromaticity* b, const PrimaryChromaticity* white_point) { | ||||||
|   PrimaryChromaticityPtr r_ptr(NULL); |   PrimaryChromaticityPtr r_ptr(nullptr); | ||||||
|   if (r) { |   if (r) { | ||||||
|     if (!CopyChromaticity(r, &r_ptr)) |     if (!CopyChromaticity(r, &r_ptr)) | ||||||
|       return false; |       return false; | ||||||
|   } |   } | ||||||
|   PrimaryChromaticityPtr g_ptr(NULL); |   PrimaryChromaticityPtr g_ptr(nullptr); | ||||||
|   if (g) { |   if (g) { | ||||||
|     if (!CopyChromaticity(g, &g_ptr)) |     if (!CopyChromaticity(g, &g_ptr)) | ||||||
|       return false; |       return false; | ||||||
|   } |   } | ||||||
|   PrimaryChromaticityPtr b_ptr(NULL); |   PrimaryChromaticityPtr b_ptr(nullptr); | ||||||
|   if (b) { |   if (b) { | ||||||
|     if (!CopyChromaticity(b, &b_ptr)) |     if (!CopyChromaticity(b, &b_ptr)) | ||||||
|       return false; |       return false; | ||||||
|   } |   } | ||||||
|   PrimaryChromaticityPtr wp_ptr(NULL); |   PrimaryChromaticityPtr wp_ptr(nullptr); | ||||||
|   if (white_point) { |   if (white_point) { | ||||||
|     if (!CopyChromaticity(white_point, &wp_ptr)) |     if (!CopyChromaticity(white_point, &wp_ptr)) | ||||||
|       return false; |       return false; | ||||||
| @@ -1242,7 +1235,7 @@ bool Colour::Write(IMkvWriter* writer) const { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool Colour::SetMasteringMetadata(const MasteringMetadata& mastering_metadata) { | bool Colour::SetMasteringMetadata(const MasteringMetadata& mastering_metadata) { | ||||||
|   std::auto_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata()); |   std::unique_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata()); | ||||||
|   if (!mm_ptr.get()) |   if (!mm_ptr.get()) | ||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
| @@ -1550,7 +1543,7 @@ bool VideoTrack::Write(IMkvWriter* writer) const { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool VideoTrack::SetColour(const Colour& colour) { | bool VideoTrack::SetColour(const Colour& colour) { | ||||||
|   std::auto_ptr<Colour> colour_ptr(new Colour()); |   std::unique_ptr<Colour> colour_ptr(new Colour()); | ||||||
|   if (!colour_ptr.get()) |   if (!colour_ptr.get()) | ||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
| @@ -1578,7 +1571,7 @@ bool VideoTrack::SetColour(const Colour& colour) { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool VideoTrack::SetProjection(const Projection& projection) { | bool VideoTrack::SetProjection(const Projection& projection) { | ||||||
|   std::auto_ptr<Projection> projection_ptr(new Projection()); |   std::unique_ptr<Projection> projection_ptr(new Projection()); | ||||||
|   if (!projection_ptr.get()) |   if (!projection_ptr.get()) | ||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -29,11 +29,6 @@ | |||||||
|  |  | ||||||
| #include "sample_muxer_metadata.h" | #include "sample_muxer_metadata.h" | ||||||
|  |  | ||||||
| // disable deprecation warnings for auto_ptr |  | ||||||
| #if defined(__GNUC__) && __GNUC__ >= 5 |  | ||||||
| #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| namespace { | namespace { | ||||||
|  |  | ||||||
| void Usage() { | void Usage() { | ||||||
| @@ -350,7 +345,7 @@ int main(int argc, char* argv[]) { | |||||||
|     return EXIT_FAILURE; |     return EXIT_FAILURE; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   const std::auto_ptr<mkvparser::Segment> parser_segment(parser_segment_); |   const std::unique_ptr<mkvparser::Segment> parser_segment(parser_segment_); | ||||||
|   ret = parser_segment->Load(); |   ret = parser_segment->Load(); | ||||||
|   if (ret < 0) { |   if (ret < 0) { | ||||||
|     printf("\n Segment::Load() failed."); |     printf("\n Segment::Load() failed."); | ||||||
|   | |||||||
| @@ -22,13 +22,6 @@ | |||||||
|  |  | ||||||
| #include "common/webmids.h" | #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 { | namespace mkvparser { | ||||||
| const float MasteringMetadata::kValueNotPresent = FLT_MAX; | const float MasteringMetadata::kValueNotPresent = FLT_MAX; | ||||||
| const long long Colour::kValueNotPresent = LLONG_MAX; | const long long Colour::kValueNotPresent = LLONG_MAX; | ||||||
| @@ -5017,7 +5010,7 @@ bool MasteringMetadata::Parse(IMkvReader* reader, long long mm_start, | |||||||
|   if (!reader || *mm) |   if (!reader || *mm) | ||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
|   std::auto_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata()); |   std::unique_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata()); | ||||||
|   if (!mm_ptr.get()) |   if (!mm_ptr.get()) | ||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
| @@ -5106,7 +5099,7 @@ bool Colour::Parse(IMkvReader* reader, long long colour_start, | |||||||
|   if (!reader || *colour) |   if (!reader || *colour) | ||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
|   std::auto_ptr<Colour> colour_ptr(new Colour()); |   std::unique_ptr<Colour> colour_ptr(new Colour()); | ||||||
|   if (!colour_ptr.get()) |   if (!colour_ptr.get()) | ||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
| @@ -5204,7 +5197,7 @@ bool Projection::Parse(IMkvReader* reader, long long start, long long size, | |||||||
|   if (!reader || *projection) |   if (!reader || *projection) | ||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
|   std::auto_ptr<Projection> projection_ptr(new Projection()); |   std::unique_ptr<Projection> projection_ptr(new Projection()); | ||||||
|   if (!projection_ptr.get()) |   if (!projection_ptr.get()) | ||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,13 +16,6 @@ | |||||||
| #include "mkvparser/mkvparser.h" | #include "mkvparser/mkvparser.h" | ||||||
| #include "mkvparser/mkvreader.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 { | namespace { | ||||||
| const wchar_t* utf8towcs(const char* str) { | const wchar_t* utf8towcs(const char* str) { | ||||||
|   if (str == NULL) |   if (str == NULL) | ||||||
| @@ -115,7 +108,7 @@ int main(int argc, char* argv[]) { | |||||||
|     return EXIT_FAILURE; |     return EXIT_FAILURE; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   const std::auto_ptr<seg_t> pSegment(pSegment_); |   const std::unique_ptr<seg_t> pSegment(pSegment_); | ||||||
|  |  | ||||||
|   ret = pSegment->Load(); |   ret = pSegment->Load(); | ||||||
|   if (ret < 0) { |   if (ret < 0) { | ||||||
|   | |||||||
| @@ -20,19 +20,12 @@ | |||||||
|  |  | ||||||
| using std::string; | 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 libwebm { | ||||||
| namespace vttdemux { | namespace vttdemux { | ||||||
|  |  | ||||||
| typedef long long mkvtime_t;  // NOLINT | typedef long long mkvtime_t;  // NOLINT | ||||||
| typedef long long mkvpos_t;  // NOLINT | typedef long long mkvpos_t;  // NOLINT | ||||||
| typedef std::auto_ptr<mkvparser::Segment> segment_ptr_t; | typedef std::unique_ptr<mkvparser::Segment> segment_ptr_t; | ||||||
|  |  | ||||||
| // WebVTT metadata tracks have a type (encoded in the CodecID for the track). | // 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|. | // We use |type| to synthesize a filename for the out-of-band WebVTT |file|. | ||||||
|   | |||||||
| @@ -1190,8 +1190,7 @@ int main(int argc, char* argv[]) { | |||||||
|     return EXIT_FAILURE; |     return EXIT_FAILURE; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // TODO(fgalligan): Replace auto_ptr with scoped_ptr. |   std::unique_ptr<mkvparser::MkvReader> reader( | ||||||
|   std::auto_ptr<mkvparser::MkvReader> reader( |  | ||||||
|       new (std::nothrow) mkvparser::MkvReader());  // NOLINT |       new (std::nothrow) mkvparser::MkvReader());  // NOLINT | ||||||
|   if (reader->Open(input.c_str())) { |   if (reader->Open(input.c_str())) { | ||||||
|     fprintf(stderr, "Error opening file:%s\n", 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; |   long long int pos = 0; | ||||||
|   std::auto_ptr<mkvparser::EBMLHeader> ebml_header( |   std::unique_ptr<mkvparser::EBMLHeader> ebml_header( | ||||||
|       new (std::nothrow) mkvparser::EBMLHeader());  // NOLINT |       new (std::nothrow) mkvparser::EBMLHeader());  // NOLINT | ||||||
|   if (ebml_header->Parse(reader.get(), pos) < 0) { |   if (ebml_header->Parse(reader.get(), pos) < 0) { | ||||||
|     fprintf(stderr, "Error parsing EBML header.\n"); |     fprintf(stderr, "Error parsing EBML header.\n"); | ||||||
| @@ -1217,7 +1216,7 @@ int main(int argc, char* argv[]) { | |||||||
|     fprintf(stderr, "Segment::CreateInstance() failed.\n"); |     fprintf(stderr, "Segment::CreateInstance() failed.\n"); | ||||||
|     return EXIT_FAILURE; |     return EXIT_FAILURE; | ||||||
|   } |   } | ||||||
|   std::auto_ptr<mkvparser::Segment> segment(temp_segment); |   std::unique_ptr<mkvparser::Segment> segment(temp_segment); | ||||||
|  |  | ||||||
|   if (segment->Load() < 0) { |   if (segment->Load() < 0) { | ||||||
|     fprintf(stderr, "Segment::Load() failed.\n"); |     fprintf(stderr, "Segment::Load() failed.\n"); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tom Finegan
					Tom Finegan