Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7315 in orxonox.OLD for trunk/src/lib/shell/shell_buffer.cc


Ignore:
Timestamp:
Apr 17, 2006, 1:32:25 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: more std::string style in the Shell

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_buffer.cc

    r7314 r7315  
    9090void ShellBuffer::flush()
    9191{
    92   // delete all the Chars in the Buffers
    93   list<char*>::iterator bufferLine;
    94   for (bufferLine = this->buffer.begin(); bufferLine != this->buffer.end(); bufferLine++)
    95   {
    96     delete[] (*bufferLine);
    97   }
    9892  this->buffer.clear();
    9993}
     
    176170    }
    177171
    178     char* addLine = new char[strlen(newLineBegin)+1];
    179     strcpy(addLine, newLineBegin);
    180 
    181172    this->lineCount++;
    182     this->buffer.push_back(addLine);
     173    this->buffer.push_back(newLineBegin);
    183174    if (likely (this->shell != NULL) && unlikely (this->shell->isActive()))
    184       this->shell->printToDisplayBuffer(addLine);
     175      this->shell->printToDisplayBuffer(newLineBegin);
    185176
    186177    if (this->buffer.size() > this->bufferSize)
    187     {
    188       delete[] this->buffer.front();
    189178      this->buffer.pop_front();
    190     }
    191179
    192180    newLineBegin = newLineEnd+1;
     
    201189  PRINT(3)("Debugging output to console (not this shell)\n");
    202190
    203   list<char*>::const_iterator bufferLine;
     191  list<std::string>::const_iterator bufferLine;
    204192  for (bufferLine = this->buffer.begin(); bufferLine != this->buffer.end(); bufferLine++)
    205     printf(*bufferLine);
     193    printf((*bufferLine).c_str());
    206194}
Note: See TracChangeset for help on using the changeset viewer.