- Timestamp:
- Jan 31, 2006, 4:45:33 PM (19 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/converter.cc
r6753 r6901 90 90 * @return: The number of written bytes 91 91 */ 92 int Converter:: intToByteArray(int x, byte* a, int length)92 int Converter::_intToByteArray(int x, byte* a, int length) 93 93 { 94 94 if (length < INTSIZE) … … 127 127 * @return: The number of read bytes 128 128 */ 129 int Converter:: byteArrayToInt(const byte* a, int* x)129 int Converter::_byteArrayToInt(const byte* a, int* x) 130 130 { 131 131 int mult = 1; … … 146 146 *x += a[INTSIZE - 1] * mult; 147 147 148 return INTSIZE; 149 } 150 151 int Converter::byteArrayToInt(const byte* a, int* x) 152 { 153 memcpy( x, a, INTSIZE ); 154 return INTSIZE; 155 } 156 157 int 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); 148 165 return INTSIZE; 149 166 } -
branches/network/src/lib/network/converter.h
r6753 r6901 30 30 static int intToByteArray(int x, byte* a, int length); 31 31 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); 32 35 33 36 static int stringToByteArray(const char* s, byte* a, int length, int maxLength);
Note: See TracChangeset
for help on using the changeset viewer.