Code format.
authorValentin Paramonov <valentine.paramonov@gmail.com>
Sun, 17 Nov 2013 00:46:00 +0000 (02:46 +0200)
committerValentin Paramonov <valentine.paramonov@gmail.com>
Sun, 17 Nov 2013 00:46:00 +0000 (02:46 +0200)
doc/RadenSolutions-CDT.xml [new file with mode: 0644]
src/libnetxms/config.cpp

diff --git a/doc/RadenSolutions-CDT.xml b/doc/RadenSolutions-CDT.xml
new file mode 100644 (file)
index 0000000..8c404ca
--- /dev/null
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<profiles version="1">
+<profile kind="CodeFormatterProfile" name="Raden Solutions" version="1">
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.lineSplit" value="132"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_member_access" value="0"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list" value="0"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment" value="1"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.tabulation.size" value="3"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_enumerator_list" value="48"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_declarator_list" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.join_wrapped_lines" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.continuation_indentation" value="1"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_expression_list" value="0"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression" value="34"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces" value="0"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer" value="0"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_compact_if" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_assignment" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain" value="18"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_binary_expression" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.tabulation.char" value="space"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block_in_case" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_switch" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indentation.size" value="3"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_array_initializer" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments" value="do not insert"/>
+</profile>
+</profiles>
index 16d20db..76eaa4e 100644 (file)
@@ -1,25 +1,25 @@
 /* 
-** NetXMS - Network Management System
-** NetXMS Foundation Library
-** Copyright (C) 2003-2013 Victor Kirhenshtein
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published
-** by the Free Software Foundation; either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program 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 Lesser General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** File: config.cpp
-**
-**/
+ ** NetXMS - Network Management System
+ ** NetXMS Foundation Library
+ ** Copyright (C) 2003-2013 Raden Solutions
+ **
+ ** This program is free software; you can redistribute it and/or modify
+ ** it under the terms of the GNU Lesser General Public License as published
+ ** by the Free Software Foundation; either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program 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 Lesser General Public License
+ ** along with this program; if not, write to the Free Software
+ ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ **
+ ** File: config.cpp
+ **
+ **/
 
 #include "libnetxms.h"
 #include <nxconfig.h>
  */
 ConfigEntry::ConfigEntry(const TCHAR *name, ConfigEntry *parent, const TCHAR *file, int line, int id)
 {
-       m_name = _tcsdup(CHECK_NULL(name));
-       m_first = NULL;
+   m_name = _tcsdup(CHECK_NULL(name));
+   m_first = NULL;
    m_last = NULL;
-       m_next = NULL;
-       if (parent != NULL)
-               parent->addEntry(this);
-       m_valueCount = 0;
-       m_values = NULL;
-       m_file = _tcsdup(CHECK_NULL(file));
-       m_line = line;
-       m_id = id;
+   m_next = NULL;
+   if (parent != NULL) parent->addEntry(this);
+   m_valueCount = 0;
+   m_values = NULL;
+   m_file = _tcsdup(CHECK_NULL(file));
+   m_line = line;
+   m_id = id;
 }
 
 /**
@@ -48,19 +47,19 @@ ConfigEntry::ConfigEntry(const TCHAR *name, ConfigEntry *parent, const TCHAR *fi
  */
 ConfigEntry::~ConfigEntry()
 {
-       ConfigEntry *entry, *next;
+   ConfigEntry *entry, *next;
 
-       for(entry = m_first; entry != NULL; entry = next)
-       {
-               next = entry->getNext();
-               delete entry;
-       }
-       safe_free(m_name);
-       safe_free(m_file);
+   for(entry = m_first; entry != NULL; entry = next)
+   {
+      next = entry->getNext();
+      delete entry;
+   }
+   safe_free(m_name);
+   safe_free(m_file);
 
-       for(int i = 0; i < m_valueCount; i++)
-               safe_free(m_values[i]);
-       safe_free(m_values);
+   for(int i = 0; i < m_valueCount; i++)
+      safe_free(m_values[i]);
+   safe_free(m_values);
 }
 
 /**
@@ -68,49 +67,45 @@ ConfigEntry::~ConfigEntry()
  */
 void ConfigEntry::setName(const TCHAR *name)
 {
-       safe_free(m_name);
-       m_name = _tcsdup(CHECK_NULL(name));
+   safe_free(m_name);
+   m_name = _tcsdup(CHECK_NULL(name));
 }
 
 /**
  * Find entry by name
  */
-ConfigEntry *ConfigEntry::findEntry(const TCHAR *name)
+ConfigEntryConfigEntry::findEntry(const TCHAR *name)
 {
-       ConfigEntry *e;
+   ConfigEntry *e;
 
-       for(e = m_first; e != NULL; e = e->getNext())
-               if (!_tcsicmp(e->getName(), name))
-                       return e;
-       return NULL;
+   for(e = m_first; e != NULL; e = e->getNext())
+      if (!_tcsicmp(e->getName(), name)) return e;
+   return NULL;
 }
 
 /**
  * Create (or find existing) subentry
  */
-ConfigEntry *ConfigEntry::createEntry(const TCHAR *name)
+ConfigEntryConfigEntry::createEntry(const TCHAR *name)
 {
-       ConfigEntry *e;
+   ConfigEntry *e;
 
-       for(e = m_first; e != NULL; e = e->getNext())
-               if (!_tcsicmp(e->getName(), name))
-                       return e;
+   for(e = m_first; e != NULL; e = e->getNext())
+      if (!_tcsicmp(e->getName(), name)) return e;
 
-       return new ConfigEntry(name, this, _T("<memory>"), 0, 0);
+   return new ConfigEntry(name, this, _T("<memory>"), 0, 0);
 }
 
 /**
  * Add sub-entry
  */
 void ConfigEntry::addEntry(ConfigEntry *entry)
-{ 
-   entry->m_parent = this; 
+{
+   entry->m_parent = this;
    entry->m_next = NULL;
-   if (m_last != NULL)
-      m_last->m_next = entry;
+   if (m_last != NULL) m_last->m_next = entry;
    m_last = entry;
-   if (m_first == NULL)
-      m_first = entry;
+   if (m_first == NULL) m_first = entry;
 }
 
 /**
@@ -118,161 +113,154 @@ void ConfigEntry::addEntry(ConfigEntry *entry)
  */
 void ConfigEntry::unlinkEntry(ConfigEntry *entry)
 {
-       ConfigEntry *curr, *prev;
-
-       for(curr = m_first, prev = NULL; curr != NULL; curr = curr->m_next)
-       {
-               if (curr == entry)
-               {
-                       if (prev != NULL)
-                       {
-                               prev->m_next = curr->m_next;
-                       }
-                       else
-                       {
-                               m_first = curr->m_next;
-                       }
-         if (m_last == curr)
-            m_last = prev;
+   ConfigEntry *curr, *prev;
+
+   for(curr = m_first, prev = NULL; curr != NULL; curr = curr->m_next)
+   {
+      if (curr == entry)
+      {
+         if (prev != NULL)
+         {
+            prev->m_next = curr->m_next;
+         }
+         else
+         {
+            m_first = curr->m_next;
+         }
+         if (m_last == curr) m_last = prev;
          curr->m_next = NULL;
-                       break;
-               }
-               prev = curr;
-       }
+         break;
+      }
+      prev = curr;
+   }
 }
 
 /**
  * Get all subentries with names matched to mask
  */
-ConfigEntryList *ConfigEntry::getSubEntries(const TCHAR *mask)
+ConfigEntryListConfigEntry::getSubEntries(const TCHAR *mask)
 {
-       ConfigEntry *e, **list = NULL;
-       int count = 0, allocated = 0;
+   ConfigEntry *e, **list = NULL;
+   int count = 0, allocated = 0;
 
-       for(e = m_first; e != NULL; e = e->getNext())
-               if ((mask == NULL) || MatchString(mask, e->getName(), FALSE))
-               {
-                       if (count == allocated)
-                       {
-                               allocated += 10;
-                               list = (ConfigEntry **)realloc(list, sizeof(ConfigEntry *) * allocated);
-                       }
-                       list[count++] = e;
-               }
-       return new ConfigEntryList(list, count);
+   for(e = m_first; e != NULL; e = e->getNext())
+      if ((mask == NULL) || MatchString(mask, e->getName(), FALSE))
+      {
+         if (count == allocated)
+         {
+            allocated += 10;
+            list = (ConfigEntry **) realloc(list, sizeof(ConfigEntry *) * allocated);
+         }
+         list[count++] = e;
+      }
+   return new ConfigEntryList(list, count);
 }
 
 /**
  * Get all subentries with names matched to mask ordered by id
  */
-ConfigEntryList *ConfigEntry::getOrderedSubEntries(const TCHAR *mask)
+ConfigEntryListConfigEntry::getOrderedSubEntries(const TCHAR *mask)
 {
-       ConfigEntryList *list = getSubEntries(mask);
-       list->sortById();
-       return list;
+   ConfigEntryList *list = getSubEntries(mask);
+   list->sortById();
+   return list;
 }
 
+/*
+ * Get value
+ */
 
-//
-// Get value
-//
-
-const TCHAR *ConfigEntry::getValue(int index)
+const TCHAR* ConfigEntry::getValue(int index)
 {
-       if ((index < 0) || (index >= m_valueCount))
-               return NULL;
-       return m_values[index];
+   if ((index < 0) || (index >= m_valueCount)) return NULL;
+   return m_values[index];
 }
 
 INT32 ConfigEntry::getValueInt(int index, INT32 defaultValue)
 {
-       const TCHAR *value = getValue(index);
-       return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getValue(index);
+   return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
 }
 
 UINT32 ConfigEntry::getValueUInt(int index, UINT32 defaultValue)
 {
-       const TCHAR *value = getValue(index);
-       return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getValue(index);
+   return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
 }
 
 INT64 ConfigEntry::getValueInt64(int index, INT64 defaultValue)
 {
-       const TCHAR *value = getValue(index);
-       return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getValue(index);
+   return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
 }
 
 UINT64 ConfigEntry::getValueUInt64(int index, UINT64 defaultValue)
 {
-       const TCHAR *value = getValue(index);
-       return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getValue(index);
+   return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
 }
 
 bool ConfigEntry::getValueBoolean(int index, bool defaultValue)
 {
-       const TCHAR *value = getValue(index);
-       if (value != NULL)
-       {
-               return !_tcsicmp(value, _T("yes")) || !_tcsicmp(value, _T("true")) || 
-                      !_tcsicmp(value, _T("on")) || (_tcstol(value, NULL, 0) != 0);
-       }
-       else
-       {
-               return defaultValue;
-       }
+   const TCHAR *value = getValue(index);
+   if (value != NULL)
+   {
+      return !_tcsicmp(value, _T("yes")) || !_tcsicmp(value, _T("true")) || !_tcsicmp(value, _T("on"))
+         || (_tcstol(value, NULL, 0) != 0);
+   }
+   else
+   {
+      return defaultValue;
+   }
 }
 
 bool ConfigEntry::getValueUUID(int index, uuid_t uuid)
 {
-       const TCHAR *value = getValue(index);
-       if (value != NULL)
-       {
-               return uuid_parse(value, uuid) == 0;
-       }
-       return false;
+   const TCHAR *value = getValue(index);
+   if (value != NULL)
+   {
+      return uuid_parse(value, uuid) == 0;
+   }
+   return false;
 }
 
-
-//
-// Set value
-//
+/*
+ * Set value
+ */
 
 void ConfigEntry::setValue(const TCHAR *value)
 {
-       for(int i = 0; i < m_valueCount; i++)
-               safe_free(m_values[i]);
-       m_valueCount = 1;
-       m_values = (TCHAR **)realloc(m_values, sizeof(TCHAR *));
-       m_values[0] = _tcsdup(value);
+   for(int i = 0; i < m_valueCount; i++)
+      safe_free(m_values[i]);
+   m_valueCount = 1;
+   m_values = (TCHAR **) realloc(m_values, sizeof(TCHAR *));
+   m_values[0] = _tcsdup(value);
 }
 
-
-//
-// Add value
-//
+/*
+ *  Add value
+ */
 
 void ConfigEntry::addValue(const TCHAR *value)
 {
-       m_values = (TCHAR **)realloc(m_values, sizeof(TCHAR *) * (m_valueCount + 1));
-       m_values[m_valueCount] = _tcsdup(value);
-       m_valueCount++;
+   m_values = (TCHAR **) realloc(m_values, sizeof(TCHAR *) * (m_valueCount + 1));
+   m_values[m_valueCount] = _tcsdup(value);
+   m_valueCount++;
 }
 
-
-//
-// Get summary length of all values as if they was concatenated with separator character
-//
+/*
+ * Get summary length of all values as if they was concatenated with separator character
+ */
 
 int ConfigEntry::getConcatenatedValuesLength()
 {
-       int i, len;
+   int i, len;
 
-       if (m_valueCount < 1)
-               return 0;
+   if (m_valueCount < 1) return 0;
 
-       for(i = 0, len = 0; i < m_valueCount; i++)
-               len += (int)_tcslen(m_values[i]);
-       return len + m_valueCount;
+   for(i = 0, len = 0; i < m_valueCount; i++)
+      len += (int) _tcslen(m_values[i]);
+   return len + m_valueCount;
 }
 
 /**
@@ -283,64 +271,63 @@ int ConfigEntry::getConcatenatedValuesLength()
  * @param defaultValue value to be returned if requested sub-entry is missing (NULL if omited)
  * @return sub-entry value or default value if requested sub-entry does not exist
  */
-const TCHAR *ConfigEntry::getSubEntryValue(const TCHAR *name, int index, const TCHAR *defaultValue)
+const TCHARConfigEntry::getSubEntryValue(const TCHAR *name, int index, const TCHAR *defaultValue)
 {
-       ConfigEntry *e = findEntry(name);
-       if (e == NULL)
-               return defaultValue;
-       const TCHAR *value = e->getValue(index);
-       return (value != NULL) ? value : defaultValue;
+   ConfigEntry *e = findEntry(name);
+   if (e == NULL) return defaultValue;
+   const TCHAR *value = e->getValue(index);
+   return (value != NULL) ? value : defaultValue;
 }
 
 INT32 ConfigEntry::getSubEntryValueInt(const TCHAR *name, int index, INT32 defaultValue)
 {
-       const TCHAR *value = getSubEntryValue(name, index);
-       return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getSubEntryValue(name, index);
+   return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
 }
 
 UINT32 ConfigEntry::getSubEntryValueUInt(const TCHAR *name, int index, UINT32 defaultValue)
 {
-       const TCHAR *value = getSubEntryValue(name, index);
-       return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getSubEntryValue(name, index);
+   return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
 }
 
 INT64 ConfigEntry::getSubEntryValueInt64(const TCHAR *name, int index, INT64 defaultValue)
 {
-       const TCHAR *value = getSubEntryValue(name, index);
-       return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getSubEntryValue(name, index);
+   return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
 }
 
 UINT64 ConfigEntry::getSubEntryValueUInt64(const TCHAR *name, int index, UINT64 defaultValue)
 {
-       const TCHAR *value = getSubEntryValue(name, index);
-       return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getSubEntryValue(name, index);
+   return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
 }
 
 bool ConfigEntry::getSubEntryValueBoolean(const TCHAR *name, int index, bool defaultValue)
 {
-       const TCHAR *value = getSubEntryValue(name, index);
-       if (value != NULL)
-       {
-               return !_tcsicmp(value, _T("yes")) || !_tcsicmp(value, _T("true")) || 
-                      !_tcsicmp(value, _T("on")) || (_tcstol(value, NULL, 0) != 0);
-       }
-       else
-       {
-               return defaultValue;
-       }
+   const TCHAR *value = getSubEntryValue(name, index);
+   if (value != NULL)
+   {
+      return !_tcsicmp(value, _T("yes")) || !_tcsicmp(value, _T("true")) || !_tcsicmp(value, _T("on"))
+         || (_tcstol(value, NULL, 0) != 0);
+   }
+   else
+   {
+      return defaultValue;
+   }
 }
 
 bool ConfigEntry::getSubEntryValueUUID(const TCHAR *name, uuid_t uuid, int index)
 {
-       const TCHAR *value = getSubEntryValue(name, index);
-       if (value != NULL)
-       {
-               return uuid_parse(value, uuid) == 0;
-       }
-       else
-       {
-               return false;
-       }
+   const TCHAR *value = getSubEntryValue(name, index);
+   if (value != NULL)
+   {
+      return uuid_parse(value, uuid) == 0;
+   }
+   else
+   {
+      return false;
+   }
 }
 
 /**
@@ -348,12 +335,12 @@ bool ConfigEntry::getSubEntryValueUUID(const TCHAR *name, uuid_t uuid, int index
  */
 void ConfigEntry::print(FILE *file, int level)
 {
-       _tprintf(_T("%*s%s\n"), level * 4, _T(""), m_name);
-       for(ConfigEntry *e = m_first; e != NULL; e = e->getNext())
-               e->print(file, level + 1);
+   _tprintf(_T("%*s%s\n"), level * 4, _T(""), m_name);
+   for(ConfigEntry *e = m_first; e != NULL; e = e->getNext())
+      e->print(file, level + 1);
 
-       for(int i = 0, len = 0; i < m_valueCount; i++)
-               _tprintf(_T("%*svalue: %s\n"), level * 4 + 2, _T(""), m_values[i]);
+   for(int i = 0, len = 0; i < m_valueCount; i++)
+      _tprintf(_T("%*svalue: %s\n"), level * 4 + 2, _T(""), m_values[i]);
 }
 
 /**
@@ -361,366 +348,345 @@ void ConfigEntry::print(FILE *file, int level)
  */
 void ConfigEntry::createXml(String &xml, int level)
 {
-       TCHAR *name = _tcsdup(m_name);
-       TCHAR *ptr = _tcschr(name, _T('#'));
-       if (ptr != NULL)
-               *ptr = 0;
+   TCHAR *name = _tcsdup(m_name);
+   TCHAR *ptr = _tcschr(name, _T('#'));
+   if (ptr != NULL) *ptr = 0;
 
-       if (m_id == 0)
-               xml.addFormattedString(_T("%*s<%s>"), level * 4, _T(""), name);
-       else
-               xml.addFormattedString(_T("%*s<%s id=\"%d\">"), level * 4, _T(""), name, m_id);
+   if (m_id == 0)
+      xml.addFormattedString(_T("%*s<%s>"), level * 4, _T(""), name);
+   else
+      xml.addFormattedString(_T("%*s<%s id=\"%d\">"), level * 4, _T(""), name, m_id);
 
-       if (m_first != NULL)
-       {
-               xml += _T("\n");
-               for(ConfigEntry *e = m_first; e != NULL; e = e->getNext())
-                       e->createXml(xml, level + 1);
-               xml.addFormattedString(_T("%*s"), level * 4, _T(""));
-       }
+   if (m_first != NULL)
+   {
+      xml += _T("\n");
+      for(ConfigEntry *e = m_first; e != NULL; e = e->getNext())
+         e->createXml(xml, level + 1);
+      xml.addFormattedString(_T("%*s"), level * 4, _T(""));
+   }
 
-       if (m_valueCount > 0)
-               xml.addDynamicString(EscapeStringForXML(m_values[0], -1));
-       xml.addFormattedString(_T("</%s>\n"), name);
+   if (m_valueCount > 0) xml.addDynamicString(EscapeStringForXML(m_values[0], -1));
+   xml.addFormattedString(_T("</%s>\n"), name);
 
-       for(int i = 1, len = 0; i < m_valueCount; i++)
-       {
-               if (m_id == 0)
-                       xml.addFormattedString(_T("%*s<%s>"), level * 4, _T(""), name);
-               else
-                       xml.addFormattedString(_T("%*s<%s id=\"%d\">"), level * 4, _T(""), name, m_id);
-               xml.addDynamicString(EscapeStringForXML(m_values[i], -1));
-               xml.addFormattedString(_T("</%s>\n"), name);
-       }
+   for(int i = 1, len = 0; i < m_valueCount; i++)
+   {
+      if (m_id == 0)
+         xml.addFormattedString(_T("%*s<%s>"), level * 4, _T(""), name);
+      else
+         xml.addFormattedString(_T("%*s<%s id=\"%d\">"), level * 4, _T(""), name, m_id);
+      xml.addDynamicString(EscapeStringForXML(m_values[i], -1));
+      xml.addFormattedString(_T("</%s>\n"), name);
+   }
 
-       free(name);
+   free(name);
 }
 
-
-//
-// Sort entry list
-//
+/*
+ *  Sort entry list
+ */
 
 static int CompareById(const void *p1, const void *p2)
 {
-       ConfigEntry *e1 = *((ConfigEntry **)p1);
-       ConfigEntry *e2 = *((ConfigEntry **)p2);
-       return e1->getId() - e2->getId();
+   ConfigEntry *e1 = *((ConfigEntry **) p1);
+   ConfigEntry *e2 = *((ConfigEntry **) p2);
+   return e1->getId() - e2->getId();
 }
 
 void ConfigEntryList::sortById()
 {
-       qsort(m_list, m_size, sizeof(ConfigEntry *), CompareById);
+   qsort(m_list, m_size, sizeof(ConfigEntry *), CompareById);
 }
 
-
-//
-// Constructor for config
-//
+/*
+ * Constructor for config
+ */
 
 Config::Config()
 {
-       m_root = new ConfigEntry(_T("[root]"), NULL, NULL, 0, 0);
-       m_errorCount = 0;
-       m_mutex = MutexCreate();
+   m_root = new ConfigEntry(_T("[root]"), NULL, NULL, 0, 0);
+   m_errorCount = 0;
+   m_mutex = MutexCreate();
 }
 
-
-//
-// Destructor
-//
+/*
+ * Destructor
+ */
 
 Config::~Config()
 {
-       delete m_root;
-       MutexDestroy(m_mutex);
+   delete m_root;
+   MutexDestroy(m_mutex);
 }
 
-
-//
-// Default error handler
-//
+/*
+ * Default error handler
+ */
 
 void Config::onError(const TCHAR *errorMessage)
 {
-       _ftprintf(stderr, _T("%s\n"), errorMessage);
+   _ftprintf(stderr, _T("%s\n"), errorMessage);
 }
 
-
-//
-// Report error
-//
+/*
+ * Report error
+ */
 
 void Config::error(const TCHAR *format, ...)
 {
-       va_list args;
-       TCHAR buffer[4096];
+   va_list args;
+   TCHAR buffer[4096];
 
-       m_errorCount++;
-       va_start(args, format);
-       _vsntprintf(buffer, 4096, format, args);
-       va_end(args);
-       onError(buffer);
+   m_errorCount++;
+   va_start(args, format);
+   _vsntprintf(buffer, 4096, format, args);
+   va_end(args);
+   onError(buffer);
 }
 
-
-//
-// Simulation of old NxLoadConfig() API
-//
+/*
+ * Simulation of old NxLoadConfig() API
+ */
 
 bool Config::parseTemplate(const TCHAR *section, NX_CFG_TEMPLATE *cfgTemplate)
 {
-       TCHAR name[MAX_PATH], *curr, *eptr;
-       int i, j, pos, initialErrorCount = m_errorCount;
-       ConfigEntry *entry;
-
-       name[0] = _T('/');
-       nx_strncpy(&name[1], section, MAX_PATH - 2);
-       _tcscat(name, _T("/"));
-       pos = (int)_tcslen(name);
-       
-       for(i = 0; cfgTemplate[i].iType != CT_END_OF_LIST; i++)
-       {
-               nx_strncpy(&name[pos], cfgTemplate[i].szToken, MAX_PATH - pos);
-               entry = getEntry(name);
-               if (entry != NULL)
-               {
-                       const TCHAR *value = CHECK_NULL(entry->getValue(entry->getValueCount() - 1));
-         switch(cfgTemplate[i].iType)
+   TCHAR name[MAX_PATH], *curr, *eptr;
+   int i, j, pos, initialErrorCount = m_errorCount;
+   ConfigEntry *entry;
+
+   name[0] = _T('/');
+   nx_strncpy(&name[1], section, MAX_PATH - 2);
+   _tcscat(name, _T("/"));
+   pos = (int) _tcslen(name);
+
+   for(i = 0; cfgTemplate[i].iType != CT_END_OF_LIST; i++)
+   {
+      nx_strncpy(&name[pos], cfgTemplate[i].szToken, MAX_PATH - pos);
+      entry = getEntry(name);
+      if (entry != NULL)
+      {
+         const TCHAR *value = CHECK_NULL(entry->getValue(entry->getValueCount() - 1));
+         switch (cfgTemplate[i].iType)
          {
             case CT_LONG:
-                                       *((LONG *)cfgTemplate[i].pBuffer) = _tcstol(value, &eptr, 0);
+               *((LONG *) cfgTemplate[i].pBuffer) = _tcstol(value, &eptr, 0);
                if (*eptr != 0)
                {
-                                               error(_T("Invalid number '%s' in configuration file %s at line %d\n"), value, entry->getFile(), entry->getLine());
+                  error(_T("Invalid number '%s' in configuration file %s at line %d\n"), value, entry->getFile(), entry->getLine());
                }
                break;
             case CT_WORD:
-               *((WORD *)cfgTemplate[i].pBuffer) = (WORD)_tcstoul(value, &eptr, 0);
+               *((WORD *) cfgTemplate[i].pBuffer) = (WORD) _tcstoul(value, &eptr, 0);
                if (*eptr != 0)
                {
-                                               error(_T("Invalid number '%s' in configuration file %s at line %d\n"), value, entry->getFile(), entry->getLine());
+                  error(_T("Invalid number '%s' in configuration file %s at line %d\n"), value, entry->getFile(), entry->getLine());
                }
                break;
             case CT_BOOLEAN:
-               if (!_tcsicmp(value, _T("yes")) || !_tcsicmp(value, _T("true")) ||
-                   !_tcsicmp(value, _T("on")) || !_tcsicmp(value, _T("1")))
+               if (!_tcsicmp(value, _T("yes")) || !_tcsicmp(value, _T("true")) || !_tcsicmp(value, _T("on"))
+                  || !_tcsicmp(value, _T("1")))
                {
-                  *((UINT32 *)cfgTemplate[i].pBuffer) |= cfgTemplate[i].dwBufferSize;
+                  *((UINT32 *) cfgTemplate[i].pBuffer) |= cfgTemplate[i].dwBufferSize;
                }
                else
                {
-                  *((UINT32 *)cfgTemplate[i].pBuffer) &= ~(cfgTemplate[i].dwBufferSize);
+                  *((UINT32 *) cfgTemplate[i].pBuffer) &= ~(cfgTemplate[i].dwBufferSize);
                }
                break;
             case CT_STRING:
-               nx_strncpy((TCHAR *)cfgTemplate[i].pBuffer, value, cfgTemplate[i].dwBufferSize);
+               nx_strncpy((TCHAR *) cfgTemplate[i].pBuffer, value, cfgTemplate[i].dwBufferSize);
                break;
             case CT_MB_STRING:
 #ifdef UNICODE
-                                       memset(cfgTemplate[i].pBuffer, 0, cfgTemplate[i].dwBufferSize);
-                                       WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, value, -1, (char *)cfgTemplate[i].pBuffer, cfgTemplate[i].dwBufferSize - 1, NULL, NULL);
+               memset(cfgTemplate[i].pBuffer, 0, cfgTemplate[i].dwBufferSize);
+               WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, value, -1, (char *)cfgTemplate[i].pBuffer, cfgTemplate[i].dwBufferSize - 1, NULL, NULL);
 #else
-               nx_strncpy((TCHAR *)cfgTemplate[i].pBuffer, value, cfgTemplate[i].dwBufferSize);
+               nx_strncpy((TCHAR *) cfgTemplate[i].pBuffer, value, cfgTemplate[i].dwBufferSize);
 #endif
                break;
             case CT_STRING_LIST:
-                                       *((TCHAR **)cfgTemplate[i].pBuffer) = (TCHAR *)malloc(sizeof(TCHAR) * (entry->getConcatenatedValuesLength() + 1));
-                                       for(j = 0, curr = *((TCHAR **)cfgTemplate[i].pBuffer); j < entry->getValueCount(); j++)
-                                       {
-                                               _tcscpy(curr, entry->getValue(j));
-                                               curr += _tcslen(curr);
-                                               *curr = cfgTemplate[i].cSeparator;
-                                               curr++;
-                                       }
-                                       *curr = 0;
+               *((TCHAR **) cfgTemplate[i].pBuffer) = (TCHAR *) malloc(sizeof(TCHAR) * (entry->getConcatenatedValuesLength() + 1));
+               for(j = 0, curr = *((TCHAR **) cfgTemplate[i].pBuffer); j < entry->getValueCount(); j++)
+               {
+                  _tcscpy(curr, entry->getValue(j));
+                  curr += _tcslen(curr);
+                  *curr = cfgTemplate[i].cSeparator;
+                  curr++;
+               }
+               *curr = 0;
                break;
             case CT_IGNORE:
                break;
             default:
                break;
          }
-               }
-       }
+      }
+   }
 
-       return (m_errorCount - initialErrorCount) == 0;
+   return (m_errorCount - initialErrorCount) == 0;
 }
 
+/*
+ * Get value
+ */
 
-//
-// Get value
-//
-
-const TCHAR *Config::getValue(const TCHAR *path, const TCHAR *defaultValue)
+const TCHAR * Config::getValue(const TCHAR *path, const TCHAR *defaultValue)
 {
-       const TCHAR *value;
-       ConfigEntry *entry = getEntry(path);
-       if (entry != NULL)
-       {
-               value = entry->getValue();
-               if (value == NULL)
-                       value = defaultValue;
-       }
-       else
-       {
-               value = defaultValue;
-       }
-       return value;
+   const TCHAR *value;
+   ConfigEntry *entry = getEntry(path);
+   if (entry != NULL)
+   {
+      value = entry->getValue();
+      if (value == NULL) value = defaultValue;
+   }
+   else
+   {
+      value = defaultValue;
+   }
+   return value;
 }
 
 INT32 Config::getValueInt(const TCHAR *path, INT32 defaultValue)
 {
-       const TCHAR *value = getValue(path);
-       return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getValue(path);
+   return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
 }
 
 UINT32 Config::getValueUInt(const TCHAR *path, UINT32 defaultValue)
 {
-       const TCHAR *value = getValue(path);
-       return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getValue(path);
+   return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
 }
 
 INT64 Config::getValueInt64(const TCHAR *path, INT64 defaultValue)
 {
-       const TCHAR *value = getValue(path);
-       return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getValue(path);
+   return (value != NULL) ? _tcstol(value, NULL, 0) : defaultValue;
 }
 
 UINT64 Config::getValueUInt64(const TCHAR *path, UINT64 defaultValue)
 {
-       const TCHAR *value = getValue(path);
-       return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
+   const TCHAR *value = getValue(path);
+   return (value != NULL) ? _tcstoul(value, NULL, 0) : defaultValue;
 }
 
 bool Config::getValueBoolean(const TCHAR *path, bool defaultValue)
 {
-       const TCHAR *value = getValue(path);
-       if (value != NULL)
-       {
-               return !_tcsicmp(value, _T("yes")) || !_tcsicmp(value, _T("true")) || 
-                      !_tcsicmp(value, _T("on")) || (_tcstol(value, NULL, 0) != 0);
-       }
-       else
-       {
-               return defaultValue;
-       }
+   const TCHAR *value = getValue(path);
+   if (value != NULL)
+   {
+      return !_tcsicmp(value, _T("yes")) || !_tcsicmp(value, _T("true")) || !_tcsicmp(value, _T("on"))
+         || (_tcstol(value, NULL, 0) != 0);
+   }
+   else
+   {
+      return defaultValue;
+   }
 }
 
 bool Config::getValueUUID(const TCHAR *path, uuid_t uuid)
 {
-       const TCHAR *value = getValue(path);
-       if (value != NULL)
-       {
-               return uuid_parse(value, uuid) == 0;
-       }
-       else
-       {
-               return false;
-       }
+   const TCHAR *value = getValue(path);
+   if (value != NULL)
+   {
+      return uuid_parse(value, uuid) == 0;
+   }
+   else
+   {
+      return false;
+   }
 }
 
+/*
+ * Get subentries
+ */
 
-//
-// Get subentries
-//
-
-ConfigEntryList *Config::getSubEntries(const TCHAR *path, const TCHAR *mask)
+ConfigEntryList * Config::getSubEntries(const TCHAR *path, const TCHAR *mask)
 {
-       ConfigEntry *entry = getEntry(path);
-       return (entry != NULL) ? entry->getSubEntries(mask) : NULL;
+   ConfigEntry *entry = getEntry(path);
+   return (entry != NULL) ? entry->getSubEntries(mask) : NULL;
 }
 
+/*
+ * Get subentries ordered by id
+ */
 
-//
-// Get subentries ordered by id
-//
-
-ConfigEntryList *Config::getOrderedSubEntries(const TCHAR *path, const TCHAR *mask)
+ConfigEntryList * Config::getOrderedSubEntries(const TCHAR *path, const TCHAR *mask)
 {
-       ConfigEntry *entry = getEntry(path);
-       return (entry != NULL) ? entry->getOrderedSubEntries(mask) : NULL;
+   ConfigEntry *entry = getEntry(path);
+   return (entry != NULL) ? entry->getOrderedSubEntries(mask) : NULL;
 }
 
+/*
+ * Get entry
+ */
 
-//
-// Get entry
-//
-
-ConfigEntry *Config::getEntry(const TCHAR *path)
+ConfigEntry * Config::getEntry(const TCHAR *path)
 {
-       const TCHAR *curr, *end;
-       TCHAR name[256];
-       ConfigEntry *entry = m_root;
+   const TCHAR *curr, *end;
+   TCHAR name[256];
+   ConfigEntry *entry = m_root;
 
-       if ((path == NULL) || (*path != _T('/')))
-               return NULL;
+   if ((path == NULL) || (*path != _T('/'))) return NULL;
 
-       if (!_tcscmp(path, _T("/")))
-               return m_root;
+   if (!_tcscmp(path, _T("/"))) return m_root;
 
-       curr = path + 1;
-       while(entry != NULL)
-       {
-               end = _tcschr(curr, _T('/'));
-               if (end != NULL)
-               {
-                       int len = min((int)(end - curr), 255);
-                       _tcsncpy(name, curr, len);
-                       name[len] = 0;
-                       entry = entry->findEntry(name);
-                       curr = end + 1;
-               }
-               else
-               {
-                       return entry->findEntry(curr);
-               }
-       }
-       return NULL;
+   curr = path + 1;
+   while(entry != NULL)
+   {
+      end = _tcschr(curr, _T('/'));
+      if (end != NULL)
+      {
+         int len = min((int )(end - curr), 255);
+         _tcsncpy(name, curr, len);
+         name[len] = 0;
+         entry = entry->findEntry(name);
+         curr = end + 1;
+      }
+      else
+      {
+         return entry->findEntry(curr);
+      }
+   }
+   return NULL;
 }
 
-
-//
-// Create entry if does not exist, or return existing
-// Will return NULL on error
-//
+/*
+ * Create entry if does not exist, or return existing
+ * Will return NULL on error
+ */
 
 ConfigEntry *Config::createEntry(const TCHAR *path)
 {
-       const TCHAR *curr, *end;
-       TCHAR name[256];
-       ConfigEntry *entry, *parent;
-
-       if ((path == NULL) || (*path != _T('/')))
-               return NULL;
-
-       if (!_tcscmp(path, _T("/")))
-               return m_root;
-
-       curr = path + 1;
-       parent = m_root;
-       do
-       {
-               end = _tcschr(curr, _T('/'));
-               if (end != NULL)
-               {
-                       int len = min((int)(end - curr), 255);
-                       _tcsncpy(name, curr, len);
-                       name[len] = 0;
-                       entry = parent->findEntry(name);
-                       curr = end + 1;
-                       if (entry == NULL)
-                               entry = new ConfigEntry(name, parent, _T("<memory>"), 0, 0);
-                       parent = entry;
-               }
-               else
-               {
-                       entry = parent->findEntry(curr);
-                       if (entry == NULL)
-                               entry = new ConfigEntry(curr, parent, _T("<memory>"), 0, 0);
-               }
-       }
-       while(end != NULL);
-       return entry;
+   const TCHAR *curr, *end;
+   TCHAR name[256];
+   ConfigEntry *entry, *parent;
+
+   if ((path == NULL) || (*path != _T('/'))) return NULL;
+
+   if (!_tcscmp(path, _T("/"))) return m_root;
+
+   curr = path + 1;
+   parent = m_root;
+   do
+   {
+      end = _tcschr(curr, _T('/'));
+      if (end != NULL)
+      {
+         int len = min((int )(end - curr), 255);
+         _tcsncpy(name, curr, len);
+         name[len] = 0;
+         entry = parent->findEntry(name);
+         curr = end + 1;
+         if (entry == NULL) entry = new ConfigEntry(name, parent, _T("<memory>"), 0, 0);
+         parent = entry;
+      }
+      else
+      {
+         entry = parent->findEntry(curr);
+         if (entry == NULL) entry = new ConfigEntry(curr, parent, _T("<memory>"), 0, 0);
+      }
+   } while(end != NULL);
+   return entry;
 }
 
 /**
@@ -728,96 +694,94 @@ ConfigEntry *Config::createEntry(const TCHAR *path)
  */
 void Config::deleteEntry(const TCHAR *path)
 {
-       ConfigEntry *entry = getEntry(path);
-       if (entry == NULL)
-               return;
+   ConfigEntry *entry = getEntry(path);
+   if (entry == NULL) return;
 
-       ConfigEntry *parent = entry->getParent();
-       if (parent == NULL)     // root entry
-               return;
+   ConfigEntry *parent = entry->getParent();
+   if (parent == NULL) // root entry
+      return;
 
-       parent->unlinkEntry(entry);
-       delete entry;
+   parent->unlinkEntry(entry);
+   delete entry;
 }
 
-
-//
-// Set value
-// Returns false on error (usually caused by incorrect path)
-//
+/*
+ * Set value
+ * Returns false on error (usually caused by incorrect path)
+ */
 
 bool Config::setValue(const TCHAR *path, const TCHAR *value)
 {
-       ConfigEntry *entry = createEntry(path);
-       if (entry == NULL)
-               return false;
-       entry->setValue(value);
-       return true;
+   ConfigEntry *entry = createEntry(path);
+   if (entry == NULL) return false;
+   entry->setValue(value);
+   return true;
 }
 
 bool Config::setValue(const TCHAR *path, INT32 value)
 {
-       TCHAR buffer[32];
-       _sntprintf(buffer, 32, _T("%ld"), (long)value);
-       return setValue(path, buffer);
+   TCHAR buffer[32];
+   _sntprintf(buffer, 32, _T("%ld"), (long) value);
+   return setValue(path, buffer);
 }
 
 bool Config::setValue(const TCHAR *path, UINT32 value)
 {
-       TCHAR buffer[32];
-       _sntprintf(buffer, 32, _T("%lu"), (unsigned long)value);
-       return setValue(path, buffer);
+   TCHAR buffer[32];
+   _sntprintf(buffer, 32, _T("%lu"), (unsigned long) value);
+   return setValue(path, buffer);
 }
 
 bool Config::setValue(const TCHAR *path, INT64 value)
 {
-       TCHAR buffer[32];
-       _sntprintf(buffer, 32, INT64_FMT, value);
-       return setValue(path, buffer);
+   TCHAR buffer[32];
+   _sntprintf(buffer, 32, INT64_FMT, value);
+   return setValue(path, buffer);
 }
 
 bool Config::setValue(const TCHAR *path, UINT64 value)
 {
-       TCHAR buffer[32];
-       _sntprintf(buffer, 32, UINT64_FMT, value);
-       return setValue(path, buffer);
+   TCHAR buffer[32];
+   _sntprintf(buffer, 32, UINT64_FMT, value);
+   return setValue(path, buffer);
 }
 
 bool Config::setValue(const TCHAR *path, double value)
 {
-       TCHAR buffer[32];
-       _sntprintf(buffer, 32, _T("%f"), value);
-       return setValue(path, buffer);
+   TCHAR buffer[32];
+   _sntprintf(buffer, 32, _T("%f"), value);
+   return setValue(path, buffer);
 }
 
 bool Config::setValue(const TCHAR *path, uuid_t value)
 {
-       TCHAR buffer[64];
-       uuid_to_string(value, buffer);
-       return setValue(path, buffer);
+   TCHAR buffer[64];
+   uuid_to_string(value, buffer);
+   return setValue(path, buffer);
 }
 
 /**
  * Find comment start in INI style config line
  * Comment starts with # character, characters within double quotes ignored
  */
-static TCHAR *FindComment(TCHAR *str)
+static TCHAR *
+FindComment(TCHAR *str)
 {
-       TCHAR *curr;
-       bool quotes;
+   TCHAR *curr;
+   bool quotes;
 
-       for(curr = str, quotes = false; *curr != 0; curr++)
-       {
-               if (*curr == _T('"'))
-               {
-                       quotes = !quotes;
-               }
-               else if ((*curr == _T('#')) && !quotes)
-               {
-                       return curr;
-               }
-       }
-       return NULL;
+   for(curr = str, quotes = false; *curr != 0; curr++)
+   {
+      if (*curr == _T('"'))
+      {
+         quotes = !quotes;
+      }
+      else if ((*curr == _T('#')) && !quotes)
+      {
+         return curr;
+      }
+   }
+   return NULL;
 }
 
 /**
@@ -825,64 +789,59 @@ static TCHAR *FindComment(TCHAR *str)
  */
 bool Config::loadIniConfig(const TCHAR *file, const TCHAR *defaultIniSection, bool ignoreErrors)
 {
-       FILE *cfg;
-       TCHAR buffer[4096], *ptr;
-       ConfigEntry *currentSection;
-       int sourceLine = 0;
+   FILE *cfg;
+   TCHAR buffer[4096], *ptr;
+   ConfigEntry *currentSection;
+   int sourceLine = 0;
    bool validConfig = true;
 
    cfg = _tfopen(file, _T("r"));
    if (cfg == NULL)
-       {
-               error(_T("Cannot open file %s"), file);
-               return false;
-       }
+   {
+      error(_T("Cannot open file %s"), file);
+      return false;
+   }
 
-       currentSection = m_root->findEntry(defaultIniSection);
-       if (currentSection == NULL)
-       {
-               currentSection = new ConfigEntry(defaultIniSection, m_root, file, 0, 0);
-       }
+   currentSection = m_root->findEntry(defaultIniSection);
+   if (currentSection == NULL)
+   {
+      currentSection = new ConfigEntry(defaultIniSection, m_root, file, 0, 0);
+   }
 
    while(!feof(cfg))
    {
       // Read line from file
       buffer[0] = 0;
-      if (_fgetts(buffer, 4095, cfg) == NULL)
-       break;  // EOF or error
+      if (_fgetts(buffer, 4095, cfg) == NULL) break;   // EOF or error
       sourceLine++;
       ptr = _tcschr(buffer, _T('\n'));
       if (ptr != NULL)
-               {
-                       if (ptr != buffer)
-                       {
-                               if (*(ptr - 1) == '\r')
-                                       ptr--;
-                       }
+      {
+         if (ptr != buffer)
+         {
+            if (*(ptr - 1) == '\r') ptr--;
+         }
          *ptr = 0;
-               }
+      }
       ptr = FindComment(buffer);
-      if (ptr != NULL)
-         *ptr = 0;
+      if (ptr != NULL) *ptr = 0;
 
       StrStrip(buffer);
-      if (buffer[0] == 0)
-         continue;
+      if (buffer[0] == 0) continue;
 
       // Check if it's a section name
       if ((buffer[0] == _T('*')) || (buffer[0] == _T('[')))
       {
-                       if (buffer[0] == _T('['))
-                       {
-                               TCHAR *end = _tcschr(buffer, _T(']'));
-                               if (end != NULL)
-                                       *end = 0;
-                       }
-                       currentSection = m_root->findEntry(&buffer[1]);
-                       if (currentSection == NULL)
-                       {
-                               currentSection = new ConfigEntry(&buffer[1], m_root, file, sourceLine, 0);
-                       }
+         if (buffer[0] == _T('['))
+         {
+            TCHAR *end = _tcschr(buffer, _T(']'));
+            if (end != NULL) *end = 0;
+         }
+         currentSection = m_root->findEntry(&buffer[1]);
+         if (currentSection == NULL)
+         {
+            currentSection = new ConfigEntry(&buffer[1], m_root, file, sourceLine, 0);
+         }
       }
       else
       {
@@ -899,16 +858,16 @@ bool Config::loadIniConfig(const TCHAR *file, const TCHAR *defaultIniSection, bo
          StrStrip(buffer);
          StrStrip(ptr);
 
-                       ConfigEntry *entry = currentSection->findEntry(buffer);
-                       if (entry == NULL)
-                       {
-                               entry = new ConfigEntry(buffer, currentSection, file, sourceLine, 0);
-                       }
-                       entry->addValue(ptr);
+         ConfigEntry *entry = currentSection->findEntry(buffer);
+         if (entry == NULL)
+         {
+            entry = new ConfigEntry(buffer, currentSection, file, sourceLine, 0);
+         }
+         entry->addValue(ptr);
       }
    }
    fclose(cfg);
-       return ignoreErrors || validConfig;
+   return ignoreErrors || validConfig;
 }
 
 /**
@@ -921,14 +880,14 @@ bool Config::loadIniConfig(const TCHAR *file, const TCHAR *defaultIniSection, bo
  */
 typedef struct
 {
-       const char *topLevelTag;
-       XML_Parser parser;
-       Config *config;
-       const TCHAR *file;
-       int level;
-       ConfigEntry *stack[MAX_STACK_DEPTH];
-       String charData[MAX_STACK_DEPTH];
-       bool trimValue[MAX_STACK_DEPTH];
+   const char *topLevelTag;
+   XML_Parser parser;
+   Config *config;
+   const TCHAR *file;
+   int level;
+   ConfigEntry *stack[MAX_STACK_DEPTH];
+   String charData[MAX_STACK_DEPTH];
+   bool trimValue[MAX_STACK_DEPTH];
 } XML_PARSER_STATE;
 
 /**
@@ -936,62 +895,63 @@ typedef struct
  */
 static void StartElement(void *userData, const char *name, const char **attrs)
 {
-       XML_PARSER_STATE *ps = (XML_PARSER_STATE *)userData;
-
-       if (ps->level == 0)
-       {
-               if (!stricmp(name, ps->topLevelTag))
-               {
-                       ps->stack[ps->level++] = ps->config->getEntry(_T("/"));
-               }
-               else
-               {
-                       ps->level = -1;
-               }
-       }
-       else if (ps->level > 0)
-       {
-               if (ps->level < MAX_STACK_DEPTH)
-               {
-                       TCHAR entryName[MAX_PATH];
-
-                       UINT32 id = XMLGetAttrUINT32(attrs, "id", 0);
+   XML_PARSER_STATE *ps = (XML_PARSER_STATE *) userData;
+
+   if (ps->level == 0)
+   {
+      if (!stricmp(name, ps->topLevelTag))
+      {
+         ps->stack[ps->level++] = ps->config->getEntry(_T("/"));
+      }
+      else
+      {
+         ps->level = -1;
+      }
+   }
+   else if (ps->level > 0)
+   {
+      if (ps->level < MAX_STACK_DEPTH)
+      {
+         TCHAR entryName[MAX_PATH];
+
+         UINT32 id = XMLGetAttrUINT32(attrs, "id", 0);
 #ifdef UNICODE
-                       if (id != 0)
-                       {
-                               WCHAR wname[MAX_PATH];
+         if (id != 0)
+         {
+            WCHAR wname[MAX_PATH];
 
-                               MultiByteToWideChar(CP_UTF8, 0, name, -1, wname, MAX_PATH);
-                               wname[MAX_PATH - 1] = 0;
+            MultiByteToWideChar(CP_UTF8, 0, name, -1, wname, MAX_PATH);
+            wname[MAX_PATH - 1] = 0;
 #ifdef _WIN32
-                               _snwprintf(entryName, MAX_PATH, L"%s#%u", wname, (unsigned int)id);
+            _snwprintf(entryName, MAX_PATH, L"%s#%u", wname, (unsigned int)id);
 #else
-                               swprintf(entryName, MAX_PATH, L"%S#%u", wname, (unsigned int)id);
+            swprintf(entryName, MAX_PATH, L"%S#%u", wname, (unsigned int)id);
 #endif
-                       }
-                       else
-                       {
-                               MultiByteToWideChar(CP_UTF8, 0, name, -1, entryName, MAX_PATH);
-                               entryName[MAX_PATH - 1] = 0;
-                       }
+         }
+         else
+         {
+            MultiByteToWideChar(CP_UTF8, 0, name, -1, entryName, MAX_PATH);
+            entryName[MAX_PATH - 1] = 0;
+         }
 #else
-                       if (id != 0)
-                               snprintf(entryName, MAX_PATH, "%s#%u", name, (unsigned int)id);
-                       else
-                               nx_strncpy(entryName, name, MAX_PATH);
+         if (id != 0)
+            snprintf(entryName, MAX_PATH, "%s#%u", name, (unsigned int) id);
+         else
+            nx_strncpy(entryName, name, MAX_PATH);
 #endif
-                       ps->stack[ps->level] = ps->stack[ps->level - 1]->findEntry(entryName);
-                       if (ps->stack[ps->level] == NULL)
-                               ps->stack[ps->level] = new ConfigEntry(entryName, ps->stack[ps->level - 1], ps->file, XML_GetCurrentLineNumber(ps->parser), (int)id);
-                       ps->charData[ps->level] = _T("");
-                       ps->trimValue[ps->level] = XMLGetAttrBoolean(attrs, "trim", true);
-                       ps->level++;
-               }
-               else
-               {
-                       ps->level++;
-               }
-       }
+         ps->stack[ps->level] = ps->stack[ps->level - 1]->findEntry(entryName);
+         if (ps->stack[ps->level] == NULL)
+            ps->stack[ps->level] = new ConfigEntry(entryName, ps->stack[ps->level - 1], ps->file,
+               XML_GetCurrentLineNumber(ps->parser), (int) id);
+         ps->charData[ps->level] = _T("");
+         ps->trimValue[ps->level] = XMLGetAttrBoolean(attrs, "trim", true);
+         ps->level++;
+      }
+      else
+      {
+         ps->level++;
+      }
+   }
 }
 
 /**
@@ -999,19 +959,18 @@ static void StartElement(void *userData, const char *name, const char **attrs)
  */
 static void EndElement(void *userData, const char *name)
 {
-       XML_PARSER_STATE *ps = (XML_PARSER_STATE *)userData;
+   XML_PARSER_STATE *ps = (XML_PARSER_STATE *) userData;
 
-       if (ps->level > MAX_STACK_DEPTH)
-       {
-               ps->level--;
-       }
-       else if (ps->level > 0)
-       {
-               ps->level--;
-               if (ps->trimValue[ps->level])
-                       ps->charData[ps->level].trim();
-               ps->stack[ps->level]->addValue(ps->charData[ps->level]);
-       }
+   if (ps->level > MAX_STACK_DEPTH)
+   {
+      ps->level--;
+   }
+   else if (ps->level > 0)
+   {
+      ps->level--;
+      if (ps->trimValue[ps->level]) ps->charData[ps->level].trim();
+      ps->stack[ps->level]->addValue(ps->charData[ps->level]);
+   }
 }
 
 /**
@@ -1019,10 +978,9 @@ static void EndElement(void *userData, const char *name)
  */
 static void CharData(void *userData, const XML_Char *s, int len)
 {
-       XML_PARSER_STATE *ps = (XML_PARSER_STATE *)userData;
+   XML_PARSER_STATE *ps = (XML_PARSER_STATE *) userData;
 
-       if ((ps->level > 0) && (ps->level <= MAX_STACK_DEPTH))
-               ps->charData[ps->level - 1].addMultiByteString(s, len, CP_UTF8);
+   if ((ps->level > 0) && (ps->level <= MAX_STACK_DEPTH)) ps->charData[ps->level - 1].addMultiByteString(s, len, CP_UTF8);
 }
 
 /**
@@ -1030,27 +988,26 @@ static void CharData(void *userData, const XML_Char *s, int len)
  */
 bool Config::loadXmlConfigFromMemory(const char *xml, int xmlSize, const TCHAR *name, const char *topLevelTag)
 {
-       XML_PARSER_STATE state;
+   XML_PARSER_STATE state;
 
-       XML_Parser parser = XML_ParserCreate(NULL);
-       XML_SetUserData(parser, &state);
-       XML_SetElementHandler(parser, StartElement, EndElement);
-       XML_SetCharacterDataHandler(parser, CharData);
+   XML_Parser parser = XML_ParserCreate(NULL);
+   XML_SetUserData(parser, &state);
+   XML_SetElementHandler(parser, StartElement, EndElement);
+   XML_SetCharacterDataHandler(parser, CharData);
 
-       state.topLevelTag = (topLevelTag != NULL) ? topLevelTag : "config";
-       state.config = this;
-       state.level = 0;
-       state.parser = parser;
-       state.file = (name != NULL) ? name : _T("<mem>");
+   state.topLevelTag = (topLevelTag != NULL) ? topLevelTag : "config";
+   state.config = this;
+   state.level = 0;
+   state.parser = parser;
+   state.file = (name != NULL) ? name : _T("<mem>");
 
-       bool success = (XML_Parse(parser, xml, xmlSize, TRUE) != XML_STATUS_ERROR);
-       if (!success)
-       {
-               error(_T("%hs at line %d"), XML_ErrorString(XML_GetErrorCode(parser)),
-            XML_GetCurrentLineNumber(parser));
-       }
-       XML_ParserFree(parser);
-       return success;
+   bool success = (XML_Parse(parser, xml, xmlSize, TRUE) != XML_STATUS_ERROR);
+   if (!success)
+   {
+      error(_T("%hs at line %d"), XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
+   }
+   XML_ParserFree(parser);
+   return success;
 }
 
 /**
@@ -1058,21 +1015,21 @@ bool Config::loadXmlConfigFromMemory(const char *xml, int xmlSize, const TCHAR *
  */
 bool Config::loadXmlConfig(const TCHAR *file, const char *topLevelTag)
 {
-       BYTE *xml;
-       UINT32 size;
-       bool success;
+   BYTE *xml;
+   UINT32 size;
+   bool success;
 
-       xml = LoadFile(file, &size);
-       if (xml != NULL)
-       {
-               success = loadXmlConfigFromMemory((char *)xml, (int)size, file, topLevelTag);
-       }
-       else
-       {
-               success = false;
-       }
+   xml = LoadFile(file, &size);
+   if (xml != NULL)
+   {
+      success = loadXmlConfigFromMemory((char *) xml, (int) size, file, topLevelTag);
+   }
+   else
+   {
+      success = false;
+   }
 
-       return success;
+   return success;
 }
 
 /**
@@ -1080,100 +1037,94 @@ bool Config::loadXmlConfig(const TCHAR *file, const char *topLevelTag)
  */
 bool Config::loadConfig(const TCHAR *file, const TCHAR *defaultIniSection, bool ignoreErrors)
 {
-       FILE *f;
-       int ch, ret;
-       struct stat fileStats;
+   FILE *f;
+   int ch, ret;
+   struct stat fileStats;
 
-       ret = _tstat(file, &fileStats);
+   ret = _tstat(file, &fileStats);
 
-       if (ret)
-       {
-          error(_T("Could not process '%s'!"), file);
-          return false;
-       }
+   if (ret)
+   {
+      error(_T("Could not process '%s'!"), file);
+      return false;
+   }
 
-       if (!S_ISREG(fileStats.st_mode))
-       {
-          error(_T("'%s' is not a file!"), file);
-          return false;
-       }
+   if (!S_ISREG(fileStats.st_mode))
+   {
+      error(_T("'%s' is not a file!"), file);
+      return false;
+   }
 
-       f = _tfopen(file, _T("r"));
-       if (f == NULL)
-       {
-               error(_T("Cannot open file %s"), file);
-               return false;
-       }
+   f = _tfopen(file, _T("r"));
+   if (f == NULL)
+   {
+      error(_T("Cannot open file %s"), file);
+      return false;
+   }
 
-       // Skip all space/newline characters
-       do
-       {
-               ch = fgetc(f);
-       } while(isspace(ch));
+   // Skip all space/newline characters
+   do
+   {
+      ch = fgetc(f);
+   } while(isspace(ch));
 
-       fclose(f);
+   fclose(f);
 
-       // If first non-space character is < assume XML format, otherwise assume INI format
-       return (ch == '<') ? loadXmlConfig(file) : loadIniConfig(file, defaultIniSection, ignoreErrors);
+   // If first non-space character is < assume XML format, otherwise assume INI format
+   return (ch == '<') ? loadXmlConfig(file) : loadIniConfig(file, defaultIniSection, ignoreErrors);
 }
 
-
-//
-// Load all files in given directory
-//
+/*
+ * Load all files in given directory
+ */
 
 bool Config::loadConfigDirectory(const TCHAR *path, const TCHAR *defaultIniSection, bool ignoreErrors)
 {
-       _TDIR *dir;
+   _TDIR *dir;
    struct _tdirent *file;
-       TCHAR fileName[MAX_PATH];
-       bool success;
+   TCHAR fileName[MAX_PATH];
+   bool success;
 
    dir = _topendir(path);
    if (dir != NULL)
    {
-               success = true;
+      success = true;
       while(1)
       {
          file = _treaddir(dir);
-         if (file == NULL)
-            break;
+         if (file == NULL) break;
 
-         if (!_tcscmp(file->d_name, _T(".")) || !_tcscmp(file->d_name, _T("..")))
-            continue;
-         
-                       size_t len = _tcslen(path) + _tcslen(file->d_name) + 2;
-                       if (len > MAX_PATH)
-                               continue;       // Full file name is too long
+         if (!_tcscmp(file->d_name, _T(".")) || !_tcscmp(file->d_name, _T(".."))) continue;
+
+         size_t len = _tcslen(path) + _tcslen(file->d_name) + 2;
+         if (len > MAX_PATH) continue; // Full file name is too long
 
          _tcscpy(fileName, path);
          _tcscat(fileName, FS_PATH_SEPARATOR);
          _tcscat(fileName, file->d_name);
 
-                       if (!loadConfig(fileName, defaultIniSection, ignoreErrors))
+         if (!loadConfig(fileName, defaultIniSection, ignoreErrors))
          {
             success = false;
          }
       }
       _tclosedir(dir);
    }
-       else
-       {
-               success = false;
-       }
+   else
+   {
+      success = false;
+   }
 
-       return success;
+   return success;
 }
 
-
-//
-// Print config to output stream
-//
+/*
+ * Print config to output stream
+ */
 
 void Config::print(FILE *file)
 {
-       if (m_root != NULL)
-               m_root->print(file, 0);
+   if (m_root != NULL) m_root->print(file, 0);
 }
 
 /**
@@ -1181,7 +1132,7 @@ void Config::print(FILE *file)
  */
 String Config::createXml()
 {
-       String xml;
-       m_root->createXml(xml);
-       return xml;
+   String xml;
+   m_root->createXml(xml);
+   return xml;
 }