[magics] 02/04: Move auto_ptr -> unique_ptr for c++11 (G++ 6) move

Alastair McKinstry mckinstry at moszumanska.debian.org
Tue Mar 22 17:34:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository magics.

commit 5a3a09f263720b622b48823df52b8cbcd8912c72
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Tue Mar 22 15:21:29 2016 +0000

    Move auto_ptr -> unique_ptr for c++11 (G++ 6) move
---
 debian/changelog                |   1 +
 debian/patches/series           |   1 +
 debian/patches/unique-ptr.patch | 338 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 340 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 54b1374..0450e83 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ magics++ (2.28.0-1) UNRELEASED; urgency=medium
   * New upstream release.
   * Refresh patches:
     - compile-fixes.patch: fixed upstream
+  * Move auto_ptr -> unique_ptr for c++11 (G++ 6) move
 
  -- Alastair McKinstry <mckinstry at debian.org>  Fri, 18 Mar 2016 10:44:16 +0000
 
diff --git a/debian/patches/series b/debian/patches/series
index 765f5d7..0622f20 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ soname-version.patch
 reproducibility.patch
 pkgconfig-fix.patch
 cmake-config.patch
+unique-ptr.patch
diff --git a/debian/patches/unique-ptr.patch b/debian/patches/unique-ptr.patch
new file mode 100644
index 0000000..42b2c6c
--- /dev/null
+++ b/debian/patches/unique-ptr.patch
@@ -0,0 +1,338 @@
+Author: Alastair McKinstry <mckinstry at debian.org>
+Description: For G++ 6, we move to c++11, auto_ptr is deprecated.
+ So use std::unique_ptr
+Last-Updated: 2016-03-22
+Forwarded: no
+
+Index: magics++-2.28.0/src/basic/ParameterSettings.cc
+===================================================================
+--- magics++-2.28.0.orig/src/basic/ParameterSettings.cc
++++ magics++-2.28.0/src/basic/ParameterSettings.cc
+@@ -59,7 +59,7 @@ void setAttribute(const vector<string>&
+ 	}
+ }
+ 
+-void setAttribute(const vector<string>& roots, const string& name, auto_ptr<Colour>& param, const map<string, string>& params)
++void setAttribute(const vector<string>& roots, const string& name, unique_ptr<Colour>& param, const map<string, string>& params)
+ {
+ 	vector<string> keys;	
+ 	buildkeys(roots, name, keys);
+@@ -70,7 +70,7 @@ void setAttribute(const vector<string>&
+ 		val = params.find(*key);
+ 		if ( val == params.end() ) continue;
+ 		MagLog::debug() << "Parameter [" << name << "] set to " << val->second << endl;
+-		param = auto_ptr<Colour>(new Colour(val->second));
++		param = unique_ptr<Colour>(new Colour(val->second));
+ 	}
+ }
+ 
+Index: magics++-2.28.0/src/basic/ParameterSettings.h
+===================================================================
+--- magics++-2.28.0.orig/src/basic/ParameterSettings.h
++++ magics++-2.28.0/src/basic/ParameterSettings.h
+@@ -32,10 +32,10 @@
+ #include <Colour.h>
+ 
+ void buildkeys(const vector<string>& roots, const string&, vector<string>& keys);
+-void setAttribute(const vector<string>& roots, const string& name, auto_ptr<Colour>&, const map<string, string>&);
++void setAttribute(const vector<string>& roots, const string& name, unique_ptr<Colour>&, const map<string, string>&);
+ 
+ template <class T>
+-void setMember(const string& value, auto_ptr<T>& object, const XmlNode& from)
++void setMember(const string& value, unique_ptr<T>& object, const XmlNode& from)
+ {
+ 	try{
+ 		T* new_object = MagTranslator<string, T>()(value);
+@@ -45,7 +45,7 @@ void setMember(const string& value, auto
+             MagLog::dev()<< "OK" << endl;
+             return;
+         }
+-        object = auto_ptr<T>(new_object);
++        object = unique_ptr<T>(new_object);
+         
+         
+ 	}
+@@ -56,7 +56,7 @@ void setMember(const string& value, auto
+ }
+ 
+ template <class T>
+-bool acceptNode(const string& node, auto_ptr<T>& object)
++bool acceptNode(const string& node, unique_ptr<T>& object)
+ {
+ 	try {
+ 		T* new_object = MagTranslator<string, T>()(node);
+@@ -71,7 +71,7 @@ bool acceptNode(const string& node, auto
+ }
+ 
+ template <class T>
+-void setMember(const vector<string>& roots, const string& name, auto_ptr<T>& object, const map<string, string>& params)
++void setMember(const vector<string>& roots, const string& name, unique_ptr<T>& object, const map<string, string>& params)
+ {	
+ 	vector<string> keys;
+ 	buildkeys(roots, name, keys);
+@@ -87,7 +87,7 @@ void setMember(const vector<string>& roo
+                 object->set(params);
+                 return;
+             }
+-			object = auto_ptr<T>(new_object);
++			object = unique_ptr<T>(new_object);
+ 			MagLog::debug() << "Parameter [" << name << "] set to " << val->second << endl;
+ 		}
+ 		catch (...) {
+Index: magics++-2.28.0/src/decoders/GribDecoder.cc
+===================================================================
+--- magics++-2.28.0.orig/src/decoders/GribDecoder.cc
++++ magics++-2.28.0/src/decoders/GribDecoder.cc
+@@ -97,7 +97,7 @@ void GribDecoder::set(const GribLoop& lo
+     index_           = loop.uniqueId_;
+     interpolation_method_ = loop.interpolation_method_;
+     missing_fill_count_ = loop.missing_fill_count_;
+-    wind_mode_       = auto_ptr<WindMode>(loop.wind_mode_->clone());
++    wind_mode_       = unique_ptr<WindMode>(loop.wind_mode_->clone());
+     internalIndex_ = index;
+ }
+ 
+@@ -1582,7 +1582,7 @@ void GribDecoder::visit(MetaDataCollecto
+                     string representation = getString("typeOfGrid");
+                     try
+                     {
+-                        auto_ptr<GribInterpretor> interpretor_(SimpleObjectMaker<GribInterpretor>::create(representation));
++                        unique_ptr<GribInterpretor> interpretor_(SimpleObjectMaker<GribInterpretor>::create(representation));
+                         interpretor_->scaling(*this, scaling, offset,oriUnits,derivedUnits);
+                         if(scaling==1 && offset == 0)
+                         {
+Index: magics++-2.28.0/src/decoders/TitleTemplate.cc
+===================================================================
+--- magics++-2.28.0.orig/src/decoders/TitleTemplate.cc
++++ magics++-2.28.0/src/decoders/TitleTemplate.cc
+@@ -179,7 +179,7 @@ bool TitleTemplate::verify(const GribDec
+ //#ifdef MAGICS_EXCEPTION
+ 		try{
+ 			MagLog::debug() << "Try  to create the MatchCriteria for " << criter->first << "\n";
+-			auto_ptr<MatchCriteria >  object(SimpleObjectMaker<MatchCriteria >::create(criter->first));
++			unique_ptr<MatchCriteria >  object(SimpleObjectMaker<MatchCriteria >::create(criter->first));
+ 			MagLog::debug() << "Found the MatchCriteria for " << criter->first << "\n";
+ 			if (!(*object).verify(data, criter->first, criter->second)) return false;
+ 		}
+Index: magics++-2.28.0/src/decoders/TitleTemplate.h
+===================================================================
+--- magics++-2.28.0.orig/src/decoders/TitleTemplate.h
++++ magics++-2.28.0/src/decoders/TitleTemplate.h
+@@ -130,7 +130,7 @@ public:
+ #ifdef MAGICS_EXCEPTION
+ 			try
+ 			{
+-				auto_ptr<TitleFieldHandler > object(SimpleObjectMaker<TitleFieldHandler >::create((*entry)->name()));
++				unique_ptr<TitleFieldHandler > object(SimpleObjectMaker<TitleFieldHandler >::create((*entry)->name()));
+ 				(*object)(*(*entry), lines, data);
+ 			}
+ 			catch (NoFactoryException& e)
+Index: magics++-2.28.0/src/libMagWrapper/MagPlus.cc
+===================================================================
+--- magics++-2.28.0.orig/src/libMagWrapper/MagPlus.cc
++++ magics++-2.28.0/src/libMagWrapper/MagPlus.cc
+@@ -548,7 +548,7 @@ bool MagPlus::cartesianGrid(magics::MagR
+ 		haxis->icon("Horizontal Axis", "MAXIS");
+ 		haxis->label_type_ = xtype;
+ 
+-		haxis->method_ = auto_ptr<AxisMethod>(MagTranslator<string, AxisMethod>()(in("X_AXIS_TYPE")));
++		haxis->method_ = unique_ptr<AxisMethod>(MagTranslator<string, AxisMethod>()(in("X_AXIS_TYPE")));
+ 		top()->push_back(haxis);
+ 	}
+ 
+@@ -584,7 +584,7 @@ bool MagPlus::cartesianGrid(magics::MagR
+ 		VerticalAxis* vaxis = new VerticalAxis();
+ 		vaxis->icon("Vertical Axis", "MAXIS");
+ 		vaxis->label_type_ = ytype;
+-		vaxis->method_ = auto_ptr<AxisMethod>(MagTranslator<string, AxisMethod>()(in("Y_AXIS_TYPE")));
++		vaxis->method_ = unique_ptr<AxisMethod>(MagTranslator<string, AxisMethod>()(in("Y_AXIS_TYPE")));
+ 		top()->push_back(vaxis);
+ 
+ 	}
+@@ -1392,7 +1392,7 @@ bool MagPlus::symbol(magics::MagRequest&
+ 
+     FortranAutomaticLegendVisitor* node = new FortranAutomaticLegendVisitor();
+     		LegendMethod* method = new ContinuousLegendMethod();
+-    		node->method_ = auto_ptr<LegendMethod>(method);
++    		node->method_ = unique_ptr<LegendMethod>(method);
+     		node->getReady();
+     		//top()->legend(node);
+ 	if ( geographical_ ) {
+Index: magics++-2.28.0/src/magics.h
+===================================================================
+--- magics++-2.28.0.orig/src/magics.h
++++ magics++-2.28.0/src/magics.h
+@@ -115,7 +115,7 @@ using std::pair;
+ //using std::list;
+ using std::map;
+ using std::set;
+-using std::auto_ptr;
++// using std::auto_ptr;
+ 
+ #include <exception>
+ 
+Index: magics++-2.28.0/src/visualisers/AutomaticContourMethod.h
+===================================================================
+--- magics++-2.28.0.orig/src/visualisers/AutomaticContourMethod.h
++++ magics++-2.28.0/src/visualisers/AutomaticContourMethod.h
+@@ -236,7 +236,7 @@ public:
+             //SampleContourMethod *am = static_cast < SampleContourMethod *> (MagTranslator<string, ContourMethod >()("sampling"));
+             SampleContourMethod *am =new  SampleContourMethod();
+ 
+-            auto_ptr<SampleContourMethod > pSampleContourMethod(am);
++            unique_ptr<SampleContourMethod > pSampleContourMethod(am);
+ 
+             pSampleContourMethod->setX (nSampleX);
+             pSampleContourMethod->setY (nSampleY);
+@@ -253,7 +253,7 @@ public:
+         // data, because the sub-sampling method (above) uses no interpolation.
+         if ((nSampleX > 1) && (nSampleY > 1))   {
+             ContourMethod* cm = MagTranslator<string, ContourMethod >()("linear");
+-            auto_ptr<ContourMethod > pContourMethod(cm);
++            unique_ptr<ContourMethod > pContourMethod(cm);
+ 
+             pMatrixHandler = pContourMethod->handler(matrix, owner);
+ 
+@@ -263,7 +263,7 @@ public:
+                  data.hasMissingValues())
+         {
+             ContourMethod* cm = MagTranslator<string, ContourMethod >()("linear");
+-            auto_ptr<ContourMethod > pContourMethod(cm);
++            unique_ptr<ContourMethod > pContourMethod(cm);
+ 
+             pMatrixHandler = pContourMethod->handler(matrix, owner);
+ 
+@@ -274,7 +274,7 @@ public:
+         else
+         {
+             Akima760Method *am = static_cast < Akima760Method *> (MagTranslator<string, ContourMethod >()("akima760"));
+-			auto_ptr<Akima760Method > pAkima760Method(am);
++			unique_ptr<Akima760Method > pAkima760Method(am);
+ 
+             pAkima760Method->resolutionX_ = (fContourResolutionX);
+             pAkima760Method->resolutionY_ =  (fContourResolutionY);
+Index: magics++-2.28.0/src/visualisers/CalculateColourTechnique.cc
+===================================================================
+--- magics++-2.28.0.orig/src/visualisers/CalculateColourTechnique.cc
++++ magics++-2.28.0/src/visualisers/CalculateColourTechnique.cc
+@@ -60,8 +60,8 @@ void CalculateColourTechnique::print(ost
+ 
+ void CalculateColourTechnique::set(const ColourTechniqueInterface& attributes)
+ {
+-    max_ = auto_ptr<Colour>(attributes.getMaxColour().clone());
+-    min_ = auto_ptr<Colour>(attributes.getMinColour().clone());
++    max_ = unique_ptr<Colour>(attributes.getMaxColour().clone());
++    min_ = unique_ptr<Colour>(attributes.getMinColour().clone());
+ 	direction_ = attributes.getDirection();
+ }
+ 
+Index: magics++-2.28.0/src/visualisers/LabelPlotting.cc
+===================================================================
+--- magics++-2.28.0.orig/src/visualisers/LabelPlotting.cc
++++ magics++-2.28.0/src/visualisers/LabelPlotting.cc
+@@ -49,7 +49,7 @@ void LabelPlotting::prepare(NoGridPlotti
+ 	
+ 	if ( *colour_ == "UNDEFINED" ) {
+ 
+-		colour_ = auto_ptr<Colour>(new Colour(grid.colour()));
++		colour_ = unique_ptr<Colour>(new Colour(grid.colour()));
+ 	}
+ 	
+ 	if ( longitudes_.empty() )
+Index: magics++-2.28.0/tools/xml2cc.pl
+===================================================================
+--- magics++-2.28.0.orig/tools/xml2cc.pl
++++ magics++-2.28.0/tools/xml2cc.pl
+@@ -292,7 +292,7 @@ EOF
+     {
+         print <<EOF;   
+ 	void set$method($to* $value) 
+-		{ auto_ptr<$to> tmp($value); $member\_ = tmp; } 
++		{ unique_ptr<$to> tmp($value); $member\_ = tmp; } 
+ 	const $to&  get$method() const 
+ 		{ return *$member\_; }
+      
+@@ -334,7 +334,7 @@ EOF
+         }
+         else 
+         {
+-            print "\tauto_ptr<$to> $member\_;\n";  
++            print "\tunique_ptr<$to> $member\_;\n";  
+         }
+     }
+ 
+Index: magics++-2.28.0/tools/xml2cc.pl.workshop
+===================================================================
+--- magics++-2.28.0.orig/tools/xml2cc.pl.workshop
++++ magics++-2.28.0/tools/xml2cc.pl.workshop
+@@ -315,7 +315,7 @@ EOF
+     {
+         print <<EOF;   
+ 	void set$method($to* $value) 
+-		{ auto_ptr<$to> tmp($value); $member\_ = tmp; } 
++		{ unique_ptr<$to> tmp($value); $member\_ = tmp; } 
+ 	const $to&  get$method() const 
+ 		{ return *$member\_; }
+      
+@@ -352,7 +352,7 @@ EOF
+         }
+         else 
+         {
+-            print "\tauto_ptr<$to> $member\_;\n";  
++            print "\tunique_ptr<$to> $member\_;\n";  
+         }
+     }
+ 
+Index: magics++-2.28.0/tools/xml2cc_new.pl
+===================================================================
+--- magics++-2.28.0.orig/tools/xml2cc_new.pl
++++ magics++-2.28.0/tools/xml2cc_new.pl
+@@ -296,7 +296,7 @@ EOF
+         }
+         else 
+         {
+-            print "\tauto_ptr<$to> $member\_;\n";  
++            print "\tunique_ptr<$to> $member\_;\n";  
+         }
+     }
+ 
+@@ -541,7 +541,7 @@ EOF
+         }
+         else 
+         {
+-           print "\t$member\_ = auto_ptr<$to>(other.$member\_->clone());\n";          
++           print "\t$member\_ = unique_ptr<$to>(other.$member\_->clone());\n";          
+         }
+        
+         print "";
+Index: magics++-2.28.0/tools/xml2mv.pl
+===================================================================
+--- magics++-2.28.0.orig/tools/xml2mv.pl
++++ magics++-2.28.0/tools/xml2mv.pl
+@@ -442,7 +442,7 @@ EOF
+             {
+ 				
+                 print "\t\t\tstring $member\_s = request(\"$name\");\n";
+-                print "\t\t\t$wrapper\_->$member\_ = auto_ptr<$magto>(MagTranslator<string, $magto>()($member\_s));\n";
++                print "\t\t\t$wrapper\_->$member\_ = unique_ptr<$magto>(MagTranslator<string, $magto>()($member\_s));\n";
+             }
+             else
+             {
+@@ -469,7 +469,7 @@ EOF
+                  $arg = "(request.countValues(\"$name\") ? (string) request(\"$name\") : \"$mv_default\")";
+                 
+                 print "\t\tstring $member\_s = $arg;\n";
+-                print "\t\t$wrapper\_->$member\_ = auto_ptr<$magto>(MagTranslator<string, $magto>()($member\_s));\n\n";
++                print "\t\t$wrapper\_->$member\_ = unique_ptr<$magto>(MagTranslator<string, $magto>()($member\_s));\n\n";
+ 			}
+             else
+             {
+@@ -506,7 +506,7 @@ EOF
+                 print "\t\t\t$member\_w = SimpleFactory<$wrapper_t>::create(\"$mv_default\");\n";
+ 			    print "\t\t}\n";
+                 print "\t\t$member\_w->set(request);\n";
+-                print "\t\t$wrapper\_->$member\_ =  auto_ptr<$magto>($member\_w->object());\n";
++                print "\t\t$wrapper\_->$member\_ =  unique_ptr<$magto>($member\_w->object());\n";
+                 print "\t\tdelete $member\_w;\n\n";
+          }
+     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/magics.git



More information about the debian-science-commits mailing list