Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6959 in orxonox.OLD for trunk/src/lib/network/converter.cc


Ignore:
Timestamp:
Feb 1, 2006, 4:40:34 PM (18 years ago)
Author:
patrick
Message:

trunk: merged network branche into trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/network/converter.cc

    r6753 r6959  
    9090 * @return: The number of written bytes
    9191 */
    92 int Converter::intToByteArray(int x, byte* a, int length)
     92int Converter::_intToByteArray(int x, byte* a, int length)
    9393{
    9494  if (length < INTSIZE)
     
    127127 * @return: The number of read bytes
    128128 */
    129 int Converter::byteArrayToInt(const byte* a, int* x)
     129int Converter::_byteArrayToInt(const byte* a, int* x)
    130130{
    131131  int mult = 1;
     
    146146    *x += a[INTSIZE - 1] * mult;
    147147
     148  return INTSIZE;
     149}
     150
     151int Converter::byteArrayToInt(const byte* a, int* x)
     152{
     153  memcpy( x, a, INTSIZE );
     154  return INTSIZE;
     155}
     156
     157int Converter::intToByteArray(int x, byte* a, int length)
     158{
     159  if ( length< INTSIZE )
     160  {
     161    PRINTF(1)("Byte Array to small\n");
     162    return 0;
     163  }
     164  memcpy(a, &x, INTSIZE);
    148165  return INTSIZE;
    149166}
Note: See TracChangeset for help on using the changeset viewer.