Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1889 for code/trunk/src/core


Ignore:
Timestamp:
Oct 6, 2008, 1:05:07 AM (16 years ago)
Author:
landauf
Message:

unsigned int → size_t for std::string related functions
I hope this fixes some problems on 64bit systems

Location:
code/trunk/src/core
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/ConfigFileManager.cc

    r1795 r1889  
    255255            if (!isEmpty(temp) && !isComment(temp))
    256256            {
    257                 unsigned int   pos1 = temp.find('[');
     257                size_t   pos1 = temp.find('[');
    258258                if (pos1 == 0) pos1 = line.find('['); else pos1 = std::string::npos;
    259                 unsigned int   pos2 = line.find(']');
     259                size_t   pos2 = line.find(']');
    260260
    261261                if (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1)
     
    282282                else
    283283                {
    284                     unsigned int pos1 = line.find('=');
     284                    size_t pos1 = line.find('=');
    285285
    286286                    if (pos1 != std::string::npos && pos1 > 0)
    287287                    {
    288288                        // New entry
    289                         unsigned int pos2 = line.find('[');
    290                         unsigned int pos3 = line.find(']');
    291                         unsigned int commentposition = getNextCommentPosition(line, pos1 + 1);
     289                        size_t pos2 = line.find('[');
     290                        size_t pos3 = line.find(']');
     291                        size_t commentposition = getNextCommentPosition(line, pos1 + 1);
    292292                        while (isBetweenQuotes(line, commentposition))
    293293                        {
  • code/trunk/src/core/Executor.h

    r1879 r1889  
    177177            inline FunctionType getType() const
    178178                { return this->functor_->getType(); }
    179             inline MultiType getReturnvalue() const
     179            inline const MultiType& getReturnvalue() const
    180180                { return this->functor_->getReturnvalue(); }
    181             inline std::string getTypenameParam(unsigned int param) const
     181            inline const std::string& getTypenameParam(unsigned int param) const
    182182                { return this->functor_->getTypenameParam(param); }
    183             inline std::string getTypenameReturnvalue() const
     183            inline const std::string& getTypenameReturnvalue() const
    184184                { return this->functor_->getTypenameReturnvalue(); }
    185185
  • code/trunk/src/core/Functor.h

    r1879 r1889  
    3434
    3535#include "util/MultiType.h"
     36#include "util/String.h"
    3637#include "util/Debug.h"
    3738
     
    103104            inline bool hasReturnvalue() const { return this->hasReturnValue_; }
    104105            inline FunctionType getType() const { return this->type_; }
    105             inline MultiType getReturnvalue() const { return this->returnedValue_; }
    106 
    107             std::string getTypenameParam(unsigned int param) const { return (param < 5) ? this->typeParam_[param] : ""; }
    108             std::string getTypenameReturnvalue() const { return this->typeReturnvalue_; }
     106            inline const MultiType& getReturnvalue() const { return this->returnedValue_; }
     107
     108            const std::string& getTypenameParam(unsigned int param) const { return (param < 5) ? this->typeParam_[param] : blankString; }
     109            const std::string& getTypenameReturnvalue() const { return this->typeReturnvalue_; }
    109110
    110111            virtual void evaluateParam(unsigned int index, MultiType& param) const = 0;
  • code/trunk/src/core/Namespace.cc

    r1854 r1889  
    6363
    6464        std::string name = this->getName();
    65         unsigned int pos = 0;
     65        size_t pos = 0;
    6666        while ((pos = name.find(',')) != std::string::npos)
    6767            name.replace(pos, 1, " ");
  • code/trunk/src/core/NamespaceNode.cc

    r1747 r1889  
    5656        else
    5757        {
    58             unsigned int pos = name.find("::");
     58            size_t pos = name.find("::");
    5959            std::string firstPart = name;
    6060            std::string secondPart;
  • code/trunk/src/core/Script.cc

    r1810 r1889  
    3333
    3434#include "CoreIncludes.h"
     35
     36#include "util/String.h"
    3537
    3638#include "lua/lua.hpp"
     
    131133  }
    132134
    133   unsigned int Script::getNextQuote(const std::string& text, unsigned int start)
    134   {
    135     unsigned int quote = start - 1;
    136 
    137     while ((quote = text.find('\"', quote + 1)) != std::string::npos)
    138     {
    139       unsigned int backslash = quote;
    140       unsigned int numbackslashes = 0;
    141       for (; backslash > 0; backslash--, numbackslashes++)
    142         if (text[backslash - 1] != '\\')
    143           break;
    144 
    145       if (numbackslashes % 2 == 0)
    146         break;
    147     }
    148 
    149     return quote;
    150   }
    151 
    152135  std::string Script::replaceLuaTags(const std::string& text)
    153136  {
    154137    // chreate map with all Lua tags
    155     std::map<unsigned int, bool> luaTags;
    156     {
    157       unsigned int pos = 0;
     138    std::map<size_t, bool> luaTags;
     139    {
     140      size_t pos = 0;
    158141      while ((pos = text.find("<?lua", pos)) != std::string::npos)
    159142        luaTags[pos++] = true;
    160143    }
    161144    {
    162       unsigned int pos = 0;
     145      size_t pos = 0;
    163146      while ((pos = text.find("?>", pos)) != std::string::npos)
    164147        luaTags[pos++] = false;
     
    167150    // erase all tags from the map that are between two quotes
    168151    {
    169       std::map<unsigned int, bool>::iterator it = luaTags.begin();
    170       std::map<unsigned int, bool>::iterator it2 = it;
     152      std::map<size_t, bool>::iterator it = luaTags.begin();
     153      std::map<size_t, bool>::iterator it2 = it;
    171154      bool bBetweenQuotes = false;
    172       unsigned int pos = 0;
     155      size_t pos = 0;
    173156      while ((pos = getNextQuote(text, pos)) != std::string::npos)
    174157      {
     
    193176    {
    194177      bool expectedValue = true;
    195       for (std::map<unsigned int, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it)
     178      for (std::map<size_t, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it)
    196179      {
    197180        if (it->second == expectedValue)
     
    212195    std::string output;
    213196    {
    214       std::map<unsigned int, bool>::iterator it = luaTags.begin();
     197      std::map<size_t, bool>::iterator it = luaTags.begin();
    215198      bool bInPrintFunction = true;
    216       unsigned int start = 0;
    217       unsigned int end = 0;
     199      size_t start = 0;
     200      size_t end = 0;
    218201
    219202      do
     
    231214          std::string temp = text.substr(start, end - start);
    232215          {
    233             unsigned int pos = 0;
     216            size_t pos = 0;
    234217            while ((pos = temp.find('[', pos)) != std::string::npos)
    235218            {
    236219              unsigned int tempCounter = 1;
    237               unsigned int tempPos = pos++;
     220              size_t tempPos = pos++;
    238221              while(temp[++tempPos] == '=') {
    239222                tempCounter++;
     
    250233          }
    251234          {
    252             unsigned int pos = 0;
     235            size_t pos = 0;
    253236            while ((pos = temp.find(']', pos)) != std::string::npos)
    254237            {
    255238              unsigned int tempCounter = 1;
    256               unsigned int tempPos = pos++;
     239              size_t tempPos = pos++;
    257240              while(temp[++tempPos] == '=') {
    258241                tempCounter++;
  • code/trunk/src/core/Script.h

    r1810 r1889  
    7676    inline void clearLuaOutput() { output_ = ""; }
    7777
    78     unsigned int getNextQuote(const std::string& text, unsigned int start);
    7978    std::string replaceLuaTags(const std::string& text);
    8079
  • code/trunk/src/core/XMLPort.h

    r1856 r1889  
    8383*/
    8484#define XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, ...) \
    85     XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode)
     85    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode)
    8686
    8787// --------------------
     
    105105*/
    106106#define XMLPortParamLoadOnlyTemplate(classname, paramname, loadfunction, xmlelement, mode, ...) \
    107     XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), 0, xmlelement, mode)
     107    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), 0, xmlelement, mode)
    108108
    109109// ------------------
     
    135135*/
    136136#define XMLPortParamExternTemplate(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode, ...) \
    137     XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction), xmlelement, mode);
     137    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, orxonox::createExecutor(orxonox::createFunctor<externclass, __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction), xmlelement, mode);
    138138
    139139// -------------------
Note: See TracChangeset for help on using the changeset viewer.