variable initialization inside a switch case does not compile on some versions of gcc; fixed

This commit is contained in:
fgerlits 2007-02-02 16:25:59 +00:00
parent 75c77d8a3a
commit 3bc21101aa
1 changed files with 4 additions and 2 deletions

View File

@ -353,16 +353,18 @@ xmlpp::Node *
OptionsContainer :: createNode(OptionItemString optionItem) throw ()
{
xmlpp::Element * rootNode = optionsDocument.get_root_node();
xmlpp::Element * element = 0;
xmlpp::Node * attribute = 0;
// only supports the serialDeviceName option item, for now
switch (optionItem) {
case serialDeviceName :
xmlpp::Element * element = dynamic_cast<xmlpp::Element*>(
element = dynamic_cast<xmlpp::Element*>(
getNode("serialPort"));
if (!element) {
element = rootNode->add_child("serialPort");
}
xmlpp::Node * attribute = dynamic_cast<xmlpp::Attribute*>(
attribute = dynamic_cast<xmlpp::Attribute*>(
getNode("serialPort/@path"));
if (!attribute) {
attribute = element->set_attribute("path", "");