Updated config.guess file

Added mac specific ardour2_mac_ui.rc file
Fixed some memory leaks in add_instant_xml() usage.
Added EXTRA_WARN scons option for pedants.
Reformatted xml++.cc into something that wouldn't drive me insane.


git-svn-id: svn://localhost/ardour2/trunk@686 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Taybin Rutkin 2006-07-19 03:49:52 +00:00
parent edde9b5983
commit 50a4504e48
10 changed files with 1827 additions and 533 deletions

View file

@ -31,6 +31,7 @@ opts.AddOptions(
PathOption('DESTDIR', 'Set the intermediate install "prefix"', '/'), PathOption('DESTDIR', 'Set the intermediate install "prefix"', '/'),
EnumOption('DIST_TARGET', 'Build target for cross compiling packagers', 'auto', allowed_values=('auto', 'i386', 'i686', 'x86_64', 'powerpc', 'tiger', 'panther', 'none' ), ignorecase=2), EnumOption('DIST_TARGET', 'Build target for cross compiling packagers', 'auto', allowed_values=('auto', 'i386', 'i686', 'x86_64', 'powerpc', 'tiger', 'panther', 'none' ), ignorecase=2),
BoolOption('DMALLOC', 'Compile and link using the dmalloc library', 0), BoolOption('DMALLOC', 'Compile and link using the dmalloc library', 0),
BoolOption('EXTRA_WARN', 'Compile with -Wextra, -ansi, and -pedantic. Might break compilation. For pedants', 0),
BoolOption('FFT_ANALYSIS', 'Include FFT analysis window', 0), BoolOption('FFT_ANALYSIS', 'Include FFT analysis window', 0),
BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1), BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1),
BoolOption('LIBLO', 'Compile with support for liblo library', 1), BoolOption('LIBLO', 'Compile with support for liblo library', 1),
@ -818,6 +819,10 @@ else:
env.Append(CCFLAGS="-Wall") env.Append(CCFLAGS="-Wall")
env.Append(CXXFLAGS="-Woverloaded-virtual") env.Append(CXXFLAGS="-Woverloaded-virtual")
if env['EXTRA_WARN']:
env.Append(CCFLAGS="-Wextra -pedantic")
env.Append(CXXFLAGS="-ansi")
if env['LIBLO']: if env['LIBLO']:
env.Append(CCFLAGS="-DHAVE_LIBLO") env.Append(CCFLAGS="-DHAVE_LIBLO")

View file

@ -19,7 +19,7 @@
*/ */
#include <vector> #include <vector>
#include <string.h> #include <string>
#include <gtk/gtkaccelmap.h> #include <gtk/gtkaccelmap.h>
#include <gtk/gtkuimanager.h> #include <gtk/gtkuimanager.h>

View file

@ -339,15 +339,15 @@ ARDOUR_UI::save_ardour_state ()
Config->add_extra_xml (*node); Config->add_extra_xml (*node);
Config->save_state(); Config->save_state();
XMLNode& enode (static_cast<Stateful*>(editor)->get_state()); XMLNode* enode = new XMLNode (static_cast<Stateful*>(editor)->get_state());
XMLNode& mnode (mixer->get_state()); XMLNode* mnode = new XMLNode (mixer->get_state());
if (session) { if (session) {
session->add_instant_xml(enode, session->path()); session->add_instant_xml(*enode, session->path());
session->add_instant_xml(mnode, session->path()); session->add_instant_xml(*mnode, session->path());
} else { } else {
Config->add_instant_xml(enode, get_user_ardour_path()); Config->add_instant_xml(*enode, get_user_ardour_path());
Config->add_instant_xml(mnode, get_user_ardour_path()); Config->add_instant_xml(*mnode, get_user_ardour_path());
} }
/* keybindings */ /* keybindings */

View file

@ -253,6 +253,7 @@ OptionEditor::setup_path_options()
sfdb_path_view.append_column(_("Paths"), sfdb_path_columns.paths); sfdb_path_view.append_column(_("Paths"), sfdb_path_columns.paths);
sfdb_path_view.set_size_request(-1, 100); sfdb_path_view.set_size_request(-1, 100);
sfdb_path_view.set_headers_visible (false);
path_table.show_all(); path_table.show_all();
} }

View file

@ -84,7 +84,6 @@ AudioLibrary::AudioLibrary ()
AudioLibrary::~AudioLibrary () AudioLibrary::~AudioLibrary ()
{ {
add_instant_xml(get_state(), get_user_ardour_path());
} }
void void
@ -361,6 +360,8 @@ void
AudioLibrary::set_paths (vector<string> paths) AudioLibrary::set_paths (vector<string> paths)
{ {
sfdb_paths = paths; sfdb_paths = paths;
add_instant_xml(get_state(), get_user_ardour_path());
} }
vector<string> vector<string>

View file

@ -82,7 +82,7 @@ Stateful::add_instant_xml (XMLNode& node, const string& dir)
} }
_instant_xml->remove_nodes_and_delete (node.name()); _instant_xml->remove_nodes_and_delete (node.name());
_instant_xml->add_child_copy (node); _instant_xml->add_child_nocopy (node);
XMLTree tree; XMLTree tree;
tree.set_filename(dir+"/instant.xml"); tree.set_filename(dir+"/instant.xml");

View file

@ -29,100 +29,101 @@ XMLTree::XMLTree(const string &fn)
XMLTree::XMLTree(const XMLTree * from) XMLTree::XMLTree(const XMLTree * from)
{ {
_filename = from->filename(); _filename = from->filename();
_root = new XMLNode(*from->root()); _root = new XMLNode(*from->root());
_compression = from->compression(); _compression = from->compression();
_initialized = true; _initialized = true;
} }
XMLTree::~XMLTree() XMLTree::~XMLTree()
{ {
if (_initialized && _root) if (_initialized && _root)
delete _root; delete _root;
} }
int int
XMLTree::set_compression(int c) XMLTree::set_compression(int c)
{ {
if (c > 9) if (c > 9) {
c = 9; c = 9;
} else if (c < 0) {
if (c < 0) c = 0;
c = 0; }
_compression = c; _compression = c;
return _compression; return _compression;
} }
bool bool
XMLTree::read(void) XMLTree::read(void)
{ {
xmlDocPtr doc; xmlDocPtr doc;
if (_root) { if (_root) {
delete _root; delete _root;
_root = 0; _root = 0;
} }
xmlKeepBlanksDefault(0); xmlKeepBlanksDefault(0);
doc = xmlParseFile(_filename.c_str()); doc = xmlParseFile(_filename.c_str());
if (!doc) { if (!doc) {
_initialized = false; _initialized = false;
return false; return false;
} }
_root = readnode(xmlDocGetRootElement(doc)); _root = readnode(xmlDocGetRootElement(doc));
xmlFreeDoc(doc); xmlFreeDoc(doc);
_initialized = true; _initialized = true;
return true; return true;
} }
bool bool
XMLTree::read_buffer(const string & buffer) XMLTree::read_buffer(const string & buffer)
{ {
xmlDocPtr doc; xmlDocPtr doc;
_filename = ""; _filename = "";
if (_root) { if (_root) {
delete _root; delete _root;
_root = 0; _root = 0;
} }
doc = xmlParseMemory((char *) buffer.c_str(), buffer.length()); doc = xmlParseMemory((char *) buffer.c_str(), buffer.length());
if (!doc) { if (!doc) {
_initialized = false; _initialized = false;
return false; return false;
} }
_root = readnode(xmlDocGetRootElement(doc)); _root = readnode(xmlDocGetRootElement(doc));
xmlFreeDoc(doc); xmlFreeDoc(doc);
_initialized = true; _initialized = true;
return true; return true;
} }
bool bool
XMLTree::write(void) const XMLTree::write(void) const
{ {
xmlDocPtr doc; xmlDocPtr doc;
XMLNodeList children; XMLNodeList children;
int result; int result;
xmlKeepBlanksDefault(0); xmlKeepBlanksDefault(0);
doc = xmlNewDoc((xmlChar *) "1.0"); doc = xmlNewDoc((xmlChar *) "1.0");
xmlSetDocCompressMode(doc, _compression); xmlSetDocCompressMode(doc, _compression);
writenode(doc, _root, doc->children, 1); writenode(doc, _root, doc->children, 1);
result = xmlSaveFormatFile(_filename.c_str(), doc, 1); result = xmlSaveFormatFile(_filename.c_str(), doc, 1);
xmlFreeDoc(doc); xmlFreeDoc(doc);
if (result == -1) if (result == -1) {
return false; return false;
}
return true;
return true;
} }
void void
@ -142,105 +143,111 @@ XMLTree::debug(FILE* out) const
const string & const string &
XMLTree::write_buffer(void) const XMLTree::write_buffer(void) const
{ {
static string retval; static string retval;
char *ptr; char *ptr;
int len; int len;
xmlDocPtr doc; xmlDocPtr doc;
XMLNodeList children; XMLNodeList children;
xmlKeepBlanksDefault(0); xmlKeepBlanksDefault(0);
doc = xmlNewDoc((xmlChar *) "1.0"); doc = xmlNewDoc((xmlChar *) "1.0");
xmlSetDocCompressMode(doc, _compression); xmlSetDocCompressMode(doc, _compression);
writenode(doc, _root, doc->children, 1); writenode(doc, _root, doc->children, 1);
xmlDocDumpMemory(doc, (xmlChar **) & ptr, &len); xmlDocDumpMemory(doc, (xmlChar **) & ptr, &len);
xmlFreeDoc(doc); xmlFreeDoc(doc);
retval = ptr; retval = ptr;
free(ptr); free(ptr);
return retval; return retval;
} }
XMLNode::XMLNode(const string & n) XMLNode::XMLNode(const string & n)
: _name(n), _is_content(false), _content(string()) : _name(n), _is_content(false), _content(string())
{ {
if (_name.empty()) {
if (_name.empty())
_initialized = false; _initialized = false;
else } else {
_initialized = true; _initialized = true;
}
} }
XMLNode::XMLNode(const string & n, const string & c) XMLNode::XMLNode(const string & n, const string & c)
:_name(string()), _is_content(true), _content(c) :_name(n), _is_content(true), _content(c)
{ {
_initialized = true; _initialized = true;
} }
XMLNode::XMLNode(const XMLNode& from) XMLNode::XMLNode(const XMLNode& from)
: _initialized(false) : _initialized(false)
{ {
XMLPropertyList props; XMLPropertyList props;
XMLPropertyIterator curprop; XMLPropertyIterator curprop;
XMLNodeList nodes; XMLNodeList nodes;
XMLNodeIterator curnode; XMLNodeIterator curnode;
_name = from.name(); _name = from.name();
set_content(from.content()); set_content(from.content());
props = from.properties(); props = from.properties();
for (curprop = props.begin(); curprop != props.end(); curprop++) for (curprop = props.begin(); curprop != props.end(); ++curprop) {
add_property((*curprop)->name().c_str(), (*curprop)->value()); add_property((*curprop)->name().c_str(), (*curprop)->value());
}
nodes = from.children();
for (curnode = nodes.begin(); curnode != nodes.end(); curnode++) nodes = from.children();
for (curnode = nodes.begin(); curnode != nodes.end(); ++curnode) {
add_child_copy(**curnode); add_child_copy(**curnode);
}
} }
XMLNode::~XMLNode() XMLNode::~XMLNode()
{ {
XMLNodeIterator curchild; XMLNodeIterator curchild;
XMLPropertyIterator curprop; XMLPropertyIterator curprop;
for (curchild = _children.begin(); curchild != _children.end(); for (curchild = _children.begin(); curchild != _children.end(); ++curchild) {
curchild++)
delete *curchild; delete *curchild;
}
for (curprop = _proplist.begin(); curprop != _proplist.end();
curprop++) for (curprop = _proplist.begin(); curprop != _proplist.end(); ++curprop) {
delete *curprop; delete *curprop;
}
} }
const string & const string &
XMLNode::set_content(const string & c) XMLNode::set_content(const string & c)
{ {
if (c.empty()) if (c.empty()) {
_is_content = false; _is_content = false;
else } else {
_is_content = true; _is_content = true;
}
_content = c;
_content = c;
return _content;
return _content;
} }
const XMLNodeList & const XMLNodeList &
XMLNode::children(const string & n) const XMLNode::children(const string & n) const
{ {
static XMLNodeList retval; static XMLNodeList retval;
XMLNodeConstIterator cur; XMLNodeConstIterator cur;
if (n.length() == 0) if (n.length() == 0) {
return _children; return _children;
}
retval.erase(retval.begin(), retval.end());
retval.erase(retval.begin(), retval.end());
for (cur = _children.begin(); cur != _children.end(); cur++)
if ((*cur)->name() == n) for (cur = _children.begin(); cur != _children.end(); ++cur) {
retval.insert(retval.end(), *cur); if ((*cur)->name() == n) {
retval.insert(retval.end(), *cur);
return retval; }
}
return retval;
} }
XMLNode * XMLNode *
@ -273,8 +280,10 @@ XMLProperty *
XMLNode::property(const char * n) XMLNode::property(const char * n)
{ {
string ns(n); string ns(n);
if (_propmap.find(ns) == _propmap.end()) if (_propmap.find(ns) == _propmap.end()) {
return 0; return 0;
}
return _propmap[ns]; return _propmap[ns];
} }
@ -288,8 +297,9 @@ XMLNode::add_property(const char * n, const string & v)
XMLProperty *tmp = new XMLProperty(ns, v); XMLProperty *tmp = new XMLProperty(ns, v);
if (!tmp) if (!tmp) {
return 0; return 0;
}
_propmap[tmp->name()] = tmp; _propmap[tmp->name()] = tmp;
_proplist.insert(_proplist.end(), tmp); _proplist.insert(_proplist.end(), tmp);
@ -307,43 +317,43 @@ XMLNode::add_property(const char * n, const char * v)
void void
XMLNode::remove_property(const string & n) XMLNode::remove_property(const string & n)
{ {
if (_propmap.find(n) != _propmap.end()) { if (_propmap.find(n) != _propmap.end()) {
_proplist.remove(_propmap[n]); _proplist.remove(_propmap[n]);
_propmap.erase(n); _propmap.erase(n);
} }
} }
void void
XMLNode::remove_nodes(const string & n) XMLNode::remove_nodes(const string & n)
{ {
XMLNodeIterator i = _children.begin(); XMLNodeIterator i = _children.begin();
XMLNodeIterator tmp; XMLNodeIterator tmp;
while (i != _children.end()) { while (i != _children.end()) {
tmp = i; tmp = i;
++tmp; ++tmp;
if ((*i)->name() == n) { if ((*i)->name() == n) {
_children.erase (i); _children.erase (i);
} }
i = tmp; i = tmp;
} }
} }
void void
XMLNode::remove_nodes_and_delete(const string & n) XMLNode::remove_nodes_and_delete(const string & n)
{ {
XMLNodeIterator i = _children.begin(); XMLNodeIterator i = _children.begin();
XMLNodeIterator tmp; XMLNodeIterator tmp;
while (i != _children.end()) { while (i != _children.end()) {
tmp = i; tmp = i;
++tmp; ++tmp;
if ((*i)->name() == n) { if ((*i)->name() == n) {
delete *i; delete *i;
_children.erase (i); _children.erase (i);
} }
i = tmp; i = tmp;
} }
} }
XMLProperty::XMLProperty(const string &n, const string &v) XMLProperty::XMLProperty(const string &n, const string &v)
@ -359,64 +369,65 @@ XMLProperty::~XMLProperty()
static XMLNode * static XMLNode *
readnode(xmlNodePtr node) readnode(xmlNodePtr node)
{ {
string name, content; string name, content;
xmlNodePtr child; xmlNodePtr child;
XMLNode *tmp; XMLNode *tmp;
xmlAttrPtr attr; xmlAttrPtr attr;
if (node->name) if (node->name) {
name = (char *) node->name; name = (char *) node->name;
}
tmp = new XMLNode(name);
tmp = new XMLNode(name);
for (attr = node->properties; attr; attr = attr->next) {
for (attr = node->properties; attr; attr = attr->next) {
content = ""; content = "";
if (attr->children) if (attr->children) {
content = (char *) attr->children->content; content = (char *) attr->children->content;
}
tmp->add_property((char *) attr->name, content); tmp->add_property((char *) attr->name, content);
} }
if (node->content) if (node->content) {
tmp->set_content((char *) node->content); tmp->set_content((char *) node->content);
else } else {
tmp->set_content(string()); tmp->set_content(string());
}
for (child = node->children; child; child = child->next)
tmp->add_child_nocopy (*readnode(child)); for (child = node->children; child; child = child->next) {
tmp->add_child_nocopy (*readnode(child));
return tmp; }
return tmp;
} }
static void static void
writenode(xmlDocPtr doc, XMLNode * n, xmlNodePtr p, int root = writenode(xmlDocPtr doc, XMLNode * n, xmlNodePtr p, int root = 0)
0)
{ {
XMLPropertyList props; XMLPropertyList props;
XMLPropertyIterator curprop; XMLPropertyIterator curprop;
XMLNodeList children; XMLNodeList children;
XMLNodeIterator curchild; XMLNodeIterator curchild;
xmlNodePtr node; xmlNodePtr node;
if (root) if (root) {
node = doc->children = node = doc->children = xmlNewDocNode(doc, 0, (xmlChar *) n->name().c_str(), 0);
xmlNewDocNode(doc, 0, (xmlChar *) n->name().c_str(), 0); } else {
else
node = xmlNewChild(p, 0, (xmlChar *) n->name().c_str(), 0); node = xmlNewChild(p, 0, (xmlChar *) n->name().c_str(), 0);
}
if (n->is_content()) {
if (n->is_content()) {
node->type = XML_TEXT_NODE; node->type = XML_TEXT_NODE;
xmlNodeSetContentLen(node, (const xmlChar *) n->content().c_str(), xmlNodeSetContentLen(node, (const xmlChar *) n->content().c_str(), n->content().length());
n->content().length()); }
}
props = n->properties();
props = n->properties(); for (curprop = props.begin(); curprop != props.end(); ++curprop) {
for (curprop = props.begin(); curprop != props.end(); curprop++) xmlSetProp(node, (xmlChar *) (*curprop)->name().c_str(), (xmlChar *) (*curprop)->value().c_str());
xmlSetProp(node, (xmlChar *) (*curprop)->name().c_str(), }
(xmlChar *) (*curprop)->value().c_str());
children = n->children();
children = n->children(); for (curchild = children.begin(); curchild != children.end(); ++curchild) {
for (curchild = children.begin(); curchild != children.end();
curchild++)
writenode(doc, *curchild, node); writenode(doc, *curchild, node);
}
} }

View file

@ -1,3 +0,0 @@
ard_i18n
Makefile.in
Makefile

696
tools/config.guess vendored

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff