tags 358289 +patch
thanks

The last error reported here is yet another case of reliance on friend
name injection.  Let's fix that:

--- src/misc/CNestedDataFile/CNestedDataFile.h.orig     2006-05-27 
22:10:24.000000000 +0000
+++ src/misc/CNestedDataFile/CNestedDataFile.h  2006-05-27 22:02:26.000000000 
+0000
@@ -160,6 +160,11 @@
        friend union cfg_parse_union;
 };
 
+void checkForDupMember(int line,const char *key);
+int cfg_parse();
+void cfg_init();
+void cfg_error(int line,const char *msg);
+
 #include "anytype.h"
 #include <istring>
 template<class type> const type CNestedDataFile::getValue(const string 
&_key,bool throwIfNotExists) const
-- END --

But there's worse: CNestedDataFile.h and anytype.h are mutually
inclusive, which means that the inline functions in CNestedDataFile.h
may or may not be able to "see" some of the declarations in anytype.h,
depending on which is included first.  (This wasn't a problem before gcc
implemented overload resolution correctly in function templates.)  This
results in a couple of errors from the linker:

./.libs/libfrontend.a(CActionParamDialog.o): In function `void 
CNestedDataFile::setValue<std::vector<std::string> >(std::string const&, 
std::vector<std::string>, bool)':
../../src/misc/CNestedDataFile/CNestedDataFile.h:208: undefined reference to 
`std::string const anytype_to_string<std::vector<std::string> 
>(std::vector<std::string> const&)'
./.libs/libfrontend.a(FXGraphParamValue.o): In function `void 
CNestedDataFile::setValue<std::vector<double, std::allocator<double> > 
>(std::string const&, std::vector<double, std::allocator<double> >, bool)':
../../src/misc/CNestedDataFile/CNestedDataFile.h:208: undefined reference to 
`std::string const anytype_to_string<std::vector<double> >(std::vector<double> 
const&)'

(manually stlfilt'd).

To fix this, either CNestedDataFile.h or anytype.h must be split into
two headers.  My solution is to move the class definition from
CNestedDataFile.h into CNestedDataFile_no_inline.h and to include only
that in anytype.h.

I'm attaching a patch that fixes all the compiler/linker errors.

The build dependencies for this package also need to be updated:
xlibmesa-gl-dev is replaced by libgl1-mesa-dev and xlibmesa-glu-dev by
libglu1-mesa-dev.

Ben.

-- 
Ben Hutchings
It is easier to change the specification to fit the program than vice versa.
--- rezound-0.12.2beta.orig/src/misc/CNestedDataFile/CNestedDataFile.h	2005-02-28 06:29:19.000000000 +0000
+++ rezound-0.12.2beta/src/misc/CNestedDataFile/CNestedDataFile.h	2006-05-27 23:09:25.000000000 +0000
@@ -21,145 +21,7 @@
 #ifndef __CNestedDataFile_H__
 #define __CNestedDataFile_H__
 
-#include "../../../config/common.h"
-
-#include <string>
-#include <vector>
-#include <map>
-using namespace std; // maybe see about removing this?
-
-#include <CMutex.h>
-
-class CNestedDataFile
-{
-public:
-	static const string delim; // the scope separator character so it can be changed easily
-	#define DOT +(CNestedDataFile::delim)+
-
-	// create a scope from this filename
-	CNestedDataFile(const string filename="",bool saveOnEachEdit=false);
-	CNestedDataFile(const CNestedDataFile &src);
-	virtual ~CNestedDataFile();
-
-	// This method can be used to set a CNestedDataFile object to check for a value when it doesn't exist in this object
-	// It is only used by getValue(), keyExists() and getChildKeys, thus the alternate file is read-only
-	// NULL can be passed to unset an alternate object
-	void setAlternateReadFile(const CNestedDataFile *_alternate) { alternate=_alternate; }
-
-	enum KeyTypes
-	{
-		ktNotExists=0,
-		ktScope,
-		ktValue
-	};
-
-	// if(keyExists(...)) will tell you if a key does exist, but the return
-	// value actually tells you if the key is a value, a child scope
-	KeyTypes keyExists(const string &key) const;
-
-
-
-	template<class type> const type getValue(const string &key,bool throwIfNotExists=false) const;
-	template<class type> void setValue(const string &key,const type value,bool throwIfExists=false); // will create the parents of key as necessary, overwrites any existing value
-	void removeKey(const string &key,bool throwOnError=false);
-
-	void clear();
-
-	// just pass this "" if you want everything in the root scope
-	// or "foo" for a list of all keys under the scope named "foo"
-	const vector<string> getChildKeys(const string &parentKey,bool throwIfNotExists=false) const;
-
-// these methods may need to be organized/documented better ???
-// 	the filename datamember is annoying .. would be nice if I just had to always pass the filename when saving
-// 	also, then could remove the filename from the constructor, and just require them to call parseFile()
-// 	ack, but then saveOnEveryEdit can't work
-
-	// CAUTION: these collaps all arithmetic expressions to the evaluated value and throws away all comments in the original file
-	void save() const;
-	void writeFile(const string filename) const;
-
-	// creates this data struction from a string
-	void parseString(const string str,bool clearExisting=true);
-
-	// returns this data struction as a string
-	const string asString() const;
-
-	void parseFile(const string filename,bool clearExisting=true);
-	void setFilename(const string filename);
-	const string getFilename() const { return filename; }
-
-	// write our files to the given CNestedDataFile under the given key
-	void writeToFile(CNestedDataFile *f,const string key) const;
-
-	// read our values from the given CNestedDataFile that are under the given key (but the scope names within 'key' will not be included in this object's struction)
-	void readFromFile(const CNestedDataFile *f,const string key,bool clearExisting=true);
-
-private:
-
-	class CVariant
-	{
-	public:
-		CVariant(const KeyTypes type=ktNotExists);
-		CVariant(const string &value);			// sets keyType to ktValue
-		CVariant(const CVariant &src);
-		virtual ~CVariant();
-
-		const CVariant &operator=(const CVariant &src);
-
-		void writeToFile(CNestedDataFile *f,const string key) const;
-		void readFromFile(const CNestedDataFile *f,const string key);
-
-		void asString(string &acc,int indent,const string &name) const;
-
-		KeyTypes type;			// depending on this we use one of the following data-members
-		//union {   would, but can't have constructor-ed classes in a union
-			map<string,CVariant> members;	// I could be a bit more efficient if I were to use CVariant *'s, but this is a quick implementation right now
-			string stringValue;
-		//} u;
-
-	};
-
-	class CVariant;
-	friend class CVariant;
-
-	string filename;
-	CVariant *root;
-	bool saveOnEachEdit;
-
-	const CNestedDataFile *alternate;
-
-	// I would have to implement this if I were to allow qualified idents in the input file which aren't always fully qualified... I would also need to have a parent * in CVariant to be able to implement this (unless I suppose I wanted to search more than Iad to.. which I would do.. okay.. ya)
-	//CVariant *upwardsScopeLookup(const string key) const;
-
-	// this could be a method of CVariant
-	bool findVariantNode(CVariant *&retValue,const string &key,int offset,bool throwOnError,const CVariant *variant) const;
-
-	// this could be a method of CVariant
-	void prvCreateKey(const string &key,int offset,const CVariant &value,CVariant *variant);
-
-	const vector<string> prvGetChildKeys(const string &parentKey,bool throwIfNotExists=false) const;
-
-	void verifyKey(const string &key);
-
-	// used in cfg_parse/cfg_init
-	static CNestedDataFile *parseTree;		// what the yacc parser should put things into when parsing not in s2at mode
-	static string initialFilename;			// the file that the yacc parser should parse when not in s2at mode
-	static vector<string> s2at_return_value;	// what the yacc parser should put things into when parsing s2at mode (NULL when not s2at mode)
-	static string s2at_string;			// what the yacc parser should parse when in s2at mode
-
-	static CMutex cfg_parse_mutex;
-
-	static const string stripLeadingDOTs(const string &key);
-
-	friend void checkForDupMember(int line,const char *key);
-	friend int cfg_parse();
-	friend void cfg_init();
-	friend void cfg_error(int line,const char *msg);
-	template<class type> friend const vector<type> &string_to_anytype(const string &str,vector<type> &ret);
-
-	friend union cfg_parse_union;
-};
-
+#include "CNestedDataFile_no_inline.h"
 #include "anytype.h"
 #include <istring>
 template<class type> const type CNestedDataFile::getValue(const string &_key,bool throwIfNotExists) const
--- rezound-0.12.2beta.orig/src/misc/CNestedDataFile/anytype.h	2005-02-06 04:00:35.000000000 +0000
+++ rezound-0.12.2beta/src/misc/CNestedDataFile/anytype.h	2006-05-27 23:12:35.000000000 +0000
@@ -92,7 +92,7 @@
 
 // I really wished that I didn't have to explicitly use 'vector' in the definition; I'd have like to use any container with an iterator interface
 #include <CMutex.h>
-#include <CNestedDataFile/CNestedDataFile.h>
+#include "CNestedDataFile_no_inline.h"
 template<class Type> static const vector<Type> &string_to_anytype(const string &str,vector<Type> &ret)
 {
 	// This function has to parse '{' ..., ... '}' where the ... can contain
nested array
--- /dev/null	2006-04-16 14:56:53.000000000 +0000
+++ rezound-0.12.2beta/src/misc/CNestedDataFile/CNestedDataFile_no_inline.h	2006-05-27 23:13:02.000000000 +0000
@@ -0,0 +1,168 @@
+/* 
+ * Copyright (C) 2002 - David W. Durham
+ * 
+ * This file is not part of any particular application.
+ * 
+ * CNestedDataFile is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ * 
+ * CNestedDataFile is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ */
+
+#ifndef __CNestedDataFile_no_inline_H__
+#define __CNestedDataFile_no_inline_H__
+
+#include "../../../config/common.h"
+
+#include <string>
+#include <vector>
+#include <map>
+using namespace std; // maybe see about removing this?
+
+#include <CMutex.h>
+
+class CNestedDataFile
+{
+public:
+	static const string delim; // the scope separator character so it can be changed easily
+	#define DOT +(CNestedDataFile::delim)+
+
+	// create a scope from this filename
+	CNestedDataFile(const string filename="",bool saveOnEachEdit=false);
+	CNestedDataFile(const CNestedDataFile &src);
+	virtual ~CNestedDataFile();
+
+	// This method can be used to set a CNestedDataFile object to check for a value when it doesn't exist in this object
+	// It is only used by getValue(), keyExists() and getChildKeys, thus the alternate file is read-only
+	// NULL can be passed to unset an alternate object
+	void setAlternateReadFile(const CNestedDataFile *_alternate) { alternate=_alternate; }
+
+	enum KeyTypes
+	{
+		ktNotExists=0,
+		ktScope,
+		ktValue
+	};
+
+	// if(keyExists(...)) will tell you if a key does exist, but the return
+	// value actually tells you if the key is a value, a child scope
+	KeyTypes keyExists(const string &key) const;
+
+
+
+	template<class type> const type getValue(const string &key,bool throwIfNotExists=false) const;
+	template<class type> void setValue(const string &key,const type value,bool throwIfExists=false); // will create the parents of key as necessary, overwrites any existing value
+	void removeKey(const string &key,bool throwOnError=false);
+
+	void clear();
+
+	// just pass this "" if you want everything in the root scope
+	// or "foo" for a list of all keys under the scope named "foo"
+	const vector<string> getChildKeys(const string &parentKey,bool throwIfNotExists=false) const;
+
+// these methods may need to be organized/documented better ???
+// 	the filename datamember is annoying .. would be nice if I just had to always pass the filename when saving
+// 	also, then could remove the filename from the constructor, and just require them to call parseFile()
+// 	ack, but then saveOnEveryEdit can't work
+
+	// CAUTION: these collaps all arithmetic expressions to the evaluated value and throws away all comments in the original file
+	void save() const;
+	void writeFile(const string filename) const;
+
+	// creates this data struction from a string
+	void parseString(const string str,bool clearExisting=true);
+
+	// returns this data struction as a string
+	const string asString() const;
+
+	void parseFile(const string filename,bool clearExisting=true);
+	void setFilename(const string filename);
+	const string getFilename() const { return filename; }
+
+	// write our files to the given CNestedDataFile under the given key
+	void writeToFile(CNestedDataFile *f,const string key) const;
+
+	// read our values from the given CNestedDataFile that are under the given key (but the scope names within 'key' will not be included in this object's struction)
+	void readFromFile(const CNestedDataFile *f,const string key,bool clearExisting=true);
+
+private:
+
+	class CVariant
+	{
+	public:
+		CVariant(const KeyTypes type=ktNotExists);
+		CVariant(const string &value);			// sets keyType to ktValue
+		CVariant(const CVariant &src);
+		virtual ~CVariant();
+
+		const CVariant &operator=(const CVariant &src);
+
+		void writeToFile(CNestedDataFile *f,const string key) const;
+		void readFromFile(const CNestedDataFile *f,const string key);
+
+		void asString(string &acc,int indent,const string &name) const;
+
+		KeyTypes type;			// depending on this we use one of the following data-members
+		//union {   would, but can't have constructor-ed classes in a union
+			map<string,CVariant> members;	// I could be a bit more efficient if I were to use CVariant *'s, but this is a quick implementation right now
+			string stringValue;
+		//} u;
+
+	};
+
+	class CVariant;
+	friend class CVariant;
+
+	string filename;
+	CVariant *root;
+	bool saveOnEachEdit;
+
+	const CNestedDataFile *alternate;
+
+	// I would have to implement this if I were to allow qualified idents in the input file which aren't always fully qualified... I would also need to have a parent * in CVariant to be able to implement this (unless I suppose I wanted to search more than Iad to.. which I would do.. okay.. ya)
+	//CVariant *upwardsScopeLookup(const string key) const;
+
+	// this could be a method of CVariant
+	bool findVariantNode(CVariant *&retValue,const string &key,int offset,bool throwOnError,const CVariant *variant) const;
+
+	// this could be a method of CVariant
+	void prvCreateKey(const string &key,int offset,const CVariant &value,CVariant *variant);
+
+	const vector<string> prvGetChildKeys(const string &parentKey,bool throwIfNotExists=false) const;
+
+	void verifyKey(const string &key);
+
+	// used in cfg_parse/cfg_init
+	static CNestedDataFile *parseTree;		// what the yacc parser should put things into when parsing not in s2at mode
+	static string initialFilename;			// the file that the yacc parser should parse when not in s2at mode
+	static vector<string> s2at_return_value;	// what the yacc parser should put things into when parsing s2at mode (NULL when not s2at mode)
+	static string s2at_string;			// what the yacc parser should parse when in s2at mode
+
+	static CMutex cfg_parse_mutex;
+
+	static const string stripLeadingDOTs(const string &key);
+
+	friend void checkForDupMember(int line,const char *key);
+	friend int cfg_parse();
+	friend void cfg_init();
+	friend void cfg_error(int line,const char *msg);
+	template<class type> friend const vector<type> &string_to_anytype(const string &str,vector<type> &ret);
+
+	friend union cfg_parse_union;
+};
+
+void checkForDupMember(int line,const char *key);
+int cfg_parse();
+void cfg_init();
+void cfg_error(int line,const char *msg);
+
+#endif
--- ./src/frontend_fox/FileActionDialogs.h~	2006-03-22 02:33:07.000000000 +0000
+++ ./src/frontend_fox/FileActionDialogs.h	2006-03-22 02:33:14.000000000 +0000
@@ -87,7 +87,7 @@
 	long onDetectDeviceButton(FXObject *object,FXSelector sel,void *ptr);
 
 protected:
-	CBurnToCDDialog::CBurnToCDDialog() {}
+	CBurnToCDDialog() {}
 
 	const string getExplanation() const;
 };
@@ -111,7 +111,7 @@
 	long onRemoveButton(FXObject *object,FXSelector sel,void *ptr);
 
 protected:
-	CRunMacroDialog::CRunMacroDialog() {}
+	CRunMacroDialog() {}
 
 };
 
--- ./src/frontend_fox/CMetersWindow.cpp~	2006-03-22 02:34:25.000000000 +0000
+++ ./src/frontend_fox/CMetersWindow.cpp	2006-03-22 02:36:55.000000000 +0000
@@ -82,7 +82,7 @@
 {
 	FXDECLARE(CLevelMeter);
 public:
-	CLevelMeter::CLevelMeter(FXComposite *parent) :
+	CLevelMeter(FXComposite *parent) :
 		FXHorizontalFrame(parent,LAYOUT_FILL_X|LAYOUT_FIX_HEIGHT|LAYOUT_TOP | FRAME_NONE,0,0,0,0, 0,0,0,0, 0,0),
 		statusFont(getApp()->getNormalFont()),
 		canvas(new FXCanvas(this,this,ID_CANVAS,FRAME_NONE | LAYOUT_FILL_X|LAYOUT_FILL_Y)),
@@ -121,7 +121,7 @@
 
 	}
 
-	CLevelMeter::~CLevelMeter()
+	~CLevelMeter()
 	{
 		delete statusFont;
 	}
@@ -133,7 +133,7 @@
 		setHeight(max(statusFont->getFontHeight(),MIN_METER_HEIGHT)); // make meter only as tall as necessary (also with a defined minimum)
 	}
 
-	long CLevelMeter::onCanvasPaint(FXObject *sender,FXSelector sel,void *ptr)
+	long onCanvasPaint(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		FXDCWindow dc(canvas);
 
@@ -327,7 +327,7 @@
 {
 	FXDECLARE(CBalanceMeter);
 public:
-	CBalanceMeter::CBalanceMeter(FXComposite *parent) :
+	CBalanceMeter(FXComposite *parent) :
 		FXHorizontalFrame(parent,LAYOUT_FILL_X|LAYOUT_FIX_HEIGHT | FRAME_NONE, 0,0,0,0, 0,0,0,0, 0,0),
 		statusFont(getApp()->getNormalFont()),
 		leftLabel(new FXLabel(this,"-1.0")),
@@ -361,7 +361,7 @@
 
 	}
 
-	CBalanceMeter::~CBalanceMeter()
+	~CBalanceMeter()
 	{
 		delete statusFont;
 	}
@@ -372,7 +372,7 @@
 		setHeight(max(statusFont->getFontHeight(),MIN_METER_HEIGHT)); // make meter only as tall as necessary (also with a defined minimum)
 	}
 
-	long CBalanceMeter::onCanvasPaint(FXObject *sender,FXSelector sel,void *ptr)
+	long onCanvasPaint(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		FXDCWindow dc(canvas);
 
@@ -478,7 +478,7 @@
 {
 	FXDECLARE(CStereoPhaseMeter);
 public:
-	CStereoPhaseMeter::CStereoPhaseMeter(FXComposite *parent,sample_t *_samplingBuffer,size_t _samplingNFrames,unsigned _samplingNChannels,unsigned _samplingLeftChannel,unsigned _samplingRightChannel) :
+	CStereoPhaseMeter(FXComposite *parent,sample_t *_samplingBuffer,size_t _samplingNFrames,unsigned _samplingNChannels,unsigned _samplingLeftChannel,unsigned _samplingRightChannel) :
 		FXHorizontalFrame(parent,LAYOUT_RIGHT|LAYOUT_FIX_WIDTH|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0, 0,0),
 		canvasFrame(new FXVerticalFrame(this,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK,0,0,0,0, 2,2,2,2, 0,1)),
 			canvas(new FXBackBufferedCanvas(canvasFrame,this,ID_CANVAS,LAYOUT_FILL_X|LAYOUT_FILL_Y)),
@@ -519,19 +519,19 @@
 		statusFont=new FXFont(getApp(),d);
 	}
 
-	CStereoPhaseMeter::~CStereoPhaseMeter()
+	~CStereoPhaseMeter()
 	{
 		delete statusFont;
 	}
 
-	long CStereoPhaseMeter::onZoomDial(FXObject *sender,FXSelector sel,void *ptr)
+	long onZoomDial(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		zoom=((float)zoomDial->getValue())/100.0f;
 		canvas->update(); // not really necessary since we're doing it several times a second anyway
 		return 1;
 	}
 
-	long CStereoPhaseMeter::onResize(FXObject *sender,FXSelector sel,void *ptr)
+	long onResize(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		// make square
 		resize(getHeight()+getHSpacing()+zoomDial->getWidth(),getHeight());
@@ -540,7 +540,7 @@
 		return 1;
 	}
 
-	long CStereoPhaseMeter::onCanvasPaint(FXObject *sender,FXSelector sel,void *ptr)
+	long onCanvasPaint(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		FXColor *data=(FXColor *)canvas->getBackBufferData();
 
@@ -730,7 +730,7 @@
 {
 	FXDECLARE(CAnalyzer);
 public:
-	CAnalyzer::CAnalyzer(FXComposite *parent) :
+	CAnalyzer(FXComposite *parent) :
 		FXHorizontalFrame(parent,LAYOUT_RIGHT|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0, 0,0),
 		canvasFrame(new FXVerticalFrame(this,LAYOUT_FIX_WIDTH|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK,0,0,0,0, 2,2,2,2, 0,1)),
 			canvas(new FXBackBufferedCanvas(canvasFrame,this,ID_CANVAS,LAYOUT_FILL_X|LAYOUT_FILL_Y)),
@@ -763,25 +763,25 @@
 		canvasFrame->setWidth(150);
 	}
 
-	CAnalyzer::~CAnalyzer()
+	~CAnalyzer()
 	{
 		delete statusFont;
 	}
 
-	long CAnalyzer::onZoomDial(FXObject *sender,FXSelector sel,void *ptr)
+	long onZoomDial(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		zoom=zoomDial->getValue();
 		canvas->update(); // not really necessary since we're doing it several times a second anyway
 		return 1;
 	}
 
-	long CAnalyzer::onZoomDialDefault(FXObject *sender,FXSelector sel,void *ptr)
+	long onZoomDialDefault(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		zoomDial->setValue(25);
 		return onZoomDial(sender,sel,ptr);
 	}
 
-	long CAnalyzer::onCanvasPaint(FXObject *sender,FXSelector sel,void *ptr)
+	long onCanvasPaint(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		FXDC &dc=*((FXDC*)ptr); // back buffered canvases send the DC to draw onto in ptr
 
@@ -865,19 +865,19 @@
 		return 1;
 	}
 
-	long CAnalyzer::onCanvasEnter(FXObject *sender,FXSelector sel,void *ptr)
+	long onCanvasEnter(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		drawBarFreq=true;
 		return onCanvasMotion(sender,sel,ptr);
 	}
 
-	long CAnalyzer::onCanvasLeave(FXObject *sender,FXSelector sel,void *ptr)
+	long onCanvasLeave(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		drawBarFreq=false;
 		return onCanvasMotion(sender,sel,ptr);
 	}
 
-	long CAnalyzer::onCanvasMotion(FXObject *sender,FXSelector sel,void *ptr)
+	long onCanvasMotion(FXObject *sender,FXSelector sel,void *ptr)
 	{
 		barFreqIndex=((FXEvent *)ptr)->win_x/ANALYZER_BAR_WIDTH;
 		return 1;


Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to