Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 27, 2005, 5:52:32 PM (18 years ago)
Author:
patrick
Message:

network: testing env. got segfault in the code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/subprojects/network/simple_sync.cc

    r5650 r5798  
    3131{
    3232  this->outLength = 10;
    33   this->inLength = 0;
     33  this->inLength = 40;
    3434  this->outData = new byte[this->outLength];
     35  this->inData = new byte[this->inLength];
    3536 
    3637  for( int i = 0; i < this->outLength; i++)
     
    4849
    4950/**
    50  *  write data to NetworkStream
     51 *  write data to Synchronizeable
    5152 */
    5253void SimpleSync::writeBytes(byte* data, int length)
    5354{
     55  if(this->inLength < length)
     56    PRINTF(0)("ERROR: local buffer is smaller than the data to receive.\n");
    5457  /* copy the data localy */
    55   this->inLength = length;
    56   for(int i = 0; i < length; i++)
     58  for( int i = 0; i < this->inLength; i++)
    5759  {
    5860    this->inData[i] = data[i];
     
    6466
    6567/**
    66  *  read data from NetworkStream
     68 *  read data from Synchronizeable
    6769 */
    6870int SimpleSync::readBytes(byte* data)
     
    7981{
    8082  PRINTF(0)("Write in: |");
    81   for(int i = 0; i < inLength; i++)
     83  for(int i = 0; i < this->inLength; i++)
    8284  {
    8385    PRINT(0)(" %i ",this->inData[i]);
     
    8991{
    9092  PRINTF(0)("Read out: |");
    91   for(int i = 0; i < outLength; i++)
     93  for(int i = 0; i < this->outLength; i++)
    9294  {
    9395    PRINT(0)(" %i ",this->outData[i]);
Note: See TracChangeset for help on using the changeset viewer.