Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5938 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Dec 6, 2005, 7:01:46 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ini_parser and gui clean-up, do not know if this fixed the Problem

Location:
trunk/src/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gtk_gui/gui_exec.cc

    r5936 r5938  
    274274    printf("GROUP:::%s\n", groupName);
    275275    if((groupWidget = locateGroup(widget, groupName, 1))==NULL)
    276     {
    277       PRINTF(2)("!!There is no group called %s in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n", groupName);
    278       groupWidget = widget;
    279       continue;
    280     }
     276      {
     277        PRINTF(2)("!!There is no group called %s in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n", groupName);
     278        groupWidget = widget;
     279        continue;
     280      }
    281281    else
    282       PRINT(0)("Group %s located.\n", static_cast<Packer*>(groupWidget)->groupName);
     282      PRINT(4)("Group %s located.\n", static_cast<Packer*>(groupWidget)->groupName);
    283283
    284284    const char* entryName;
     
    286286    while(entryName = iniParser.getCurrentName())
    287287    {
    288       printf("ENTRY:::%s = %s\n", entryName, iniParser.getCurrentValue());
     288      PRINTF(4)("ENTRY:::%s = %s\n", entryName, iniParser.getCurrentValue());
    289289      varInfo.variableName = entryName;
    290290      varInfo.variableValue = iniParser.getCurrentValue();
     
    306306{
    307307  VarInfo* info =(VarInfo*)varInfo;
     308  if (info == NULL || info->variableName == NULL)
     309    return;
     310
    308311  if(widget->title && !strcmp(widget->title, info->variableName))
    309312    {
    310313      PRINT(5)("Located Option %s.\n", widget->title);
    311314      if(widget->optionType > GUI_NOTHING)
    312         static_cast<Option*>(widget)->load(info->variableValue);
     315        if (info->variableValue != NULL)
     316          static_cast<Option*>(widget)->load(info->variableValue);
    313317    }
    314318}
     
    326330{
    327331  Widget* tmp;
     332  if (widget  == NULL || groupName == NULL)
     333    return NULL;
    328334
    329335  if(widget->optionType < GUI_NOTHING)
    330336    {
    331       if(static_cast<Packer*>(widget)->getGroupName() &&
     337      if(static_cast<Packer*>(widget)->getGroupName() != NULL &&
    332338         !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName()))
    333         {
    334           return widget;
    335         }
     339        return widget;
    336340      else
    337341        {
    338           if((tmp = locateGroup(static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL)
     342          if((tmp = locateGroup(static_cast<Packer*>(widget)->down,
     343                                groupName, depth+1)) != NULL)
    339344            return tmp;
    340345        }
  • trunk/src/lib/util/ini_parser.cc

    r5936 r5938  
    2323#include <stdlib.h>
    2424#include <string.h>
     25
     26#if HAVE_CONFIG_H
     27#include <config.h>
     28#endif
    2529
    2630#ifdef DEBUG
     
    8690 * @brief sets the Name of the input-file
    8791 * @param fileName The new FileName to set to the IniParser
    88  * IF fileName is NULL the new Name will be set to NULL too.
     92 * If fileName is NULL the new Name will be set to NULL too.
    8993 */
    9094void IniParser::setFileName(const char* fileName)
     
    9296  if (this->fileName)
    9397    delete []this->fileName;
    94   if (fileName)
     98  if (fileName != NULL)
    9599  {
    96100    this->fileName = new char[strlen(fileName)+1];
     
    358362  {
    359363    (*section).entries.push_back(IniEntry());
    360     (*section).entries.back().name = new char[strlen (entryName)+1];
     364    (*section).entries.back().name = new char[strlen(entryName)+1];
    361365    strcpy((*section).entries.back().name, entryName);
    362366    (*section).entries.back().value = new char[strlen(value)+1];
     
    479483    PRINTF(1)("no opened ini-file.\n");
    480484}
     485
     486
Note: See TracChangeset for help on using the changeset viewer.