Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6901 in orxonox.OLD


Ignore:
Timestamp:
Jan 31, 2006, 4:45:33 PM (18 years ago)
Author:
rennerc
Message:
 
Location:
branches/network/src/lib/network
Files:
2 edited

Legend:

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

    r6753 r6901  
    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}
  • branches/network/src/lib/network/converter.h

    r6753 r6901  
    3030    static int intToByteArray(int x, byte* a, int length);
    3131    static int byteArrayToInt(const byte* a, int* x);
     32   
     33    static int _intToByteArray(int x, byte* a, int length);
     34    static int _byteArrayToInt(const byte* a, int* x);
    3235
    3336    static int stringToByteArray(const char* s, byte* a, int length, int maxLength);
Note: See TracChangeset for help on using the changeset viewer.