[Opentnl-cvs] tnl/tnl bitStream.cpp,1.8,1.9 netConnection.cpp,1.14,1.15 tnlBitStream.h,1.9,1.10 udp.
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2005-05-01 00:30:05
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13600/tnl Modified Files: bitStream.cpp netConnection.cpp tnlBitStream.h udp.cpp Log Message: Zeroed out port in unix version of getInterfaceAddresses Fixed BitStream overwrite issue Checked parameters on setFixedRateParams on NetConnection Index: bitStream.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/bitStream.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bitStream.cpp 28 Apr 2005 17:30:30 -0000 1.8 --- bitStream.cpp 1 May 2005 00:29:55 -0000 1.9 *************** *** 51,55 **** { bitNum = 0; ! error = false; mCompressRelative = false; mStringBuffer[0] = 0; --- 51,55 ---- { bitNum = 0; ! mError = false; mCompressRelative = false; mStringBuffer[0] = 0; *************** *** 83,87 **** if(!resize(newSize)) { ! error = true; return false; } --- 83,87 ---- if(!resize(newSize)) { ! mError = true; return false; } *************** *** 98,102 **** --- 98,106 ---- if(bitCount + bitNum > maxWriteBitNum) if(!resizeBits(bitCount + bitNum - maxWriteBitNum)) + { + // fill to the end, so the higher level code knows the BitStream is full. + bitNum = maxWriteBitNum; return false; + } U32 upShift = bitNum & 0x7; *************** *** 167,171 **** if(bitCount + bitNum > maxReadBitNum) { ! error = true; return false; } --- 171,175 ---- if(bitCount + bitNum > maxReadBitNum) { ! setError(); return false; } Index: udp.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/udp.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** udp.cpp 28 Apr 2005 20:49:36 -0000 1.8 --- udp.cpp 1 May 2005 00:29:55 -0000 1.9 *************** *** 576,581 **** Address theAddress; SocketToTNLAddress((struct sockaddr *) sin, &theAddress); ! if(theAddress.netNum[0] != INADDR_ANY && theAddress.netNum[0] != 0x7F000001) ! { addressVector->push_back(theAddress); } --- 576,582 ---- Address theAddress; SocketToTNLAddress((struct sockaddr *) sin, &theAddress); ! theAddress.port = 0; ! if(theAddress.netNum[0] != INADDR_ANY && theAddress.netNum[0] != 0x7F000001) ! { addressVector->push_back(theAddress); } Index: tnlBitStream.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlBitStream.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tnlBitStream.h 28 Apr 2005 18:01:38 -0000 1.9 --- tnlBitStream.h 1 May 2005 00:29:55 -0000 1.10 *************** *** 68,72 **** }; U32 bitNum; ///< The current bit position for reading/writing in the bit stream. ! bool error; ///< Flag set if a user operation attempts to read or write past the max read/write sizes. bool mCompressRelative; ///< Flag set if the bit stream should compress points relative to a compression point. Point3F mCompressPoint; ///< Reference point for relative point compression. --- 68,72 ---- }; U32 bitNum; ///< The current bit position for reading/writing in the bit stream. ! bool mError; ///< Flag set if a user operation attempts to read or write past the max read/write sizes. bool mCompressRelative; ///< Flag set if the bit stream should compress points relative to a compression point. Point3F mCompressPoint; ///< Reference point for relative point compression. *************** *** 114,118 **** /// clears the error state from an attempted read or write overrun ! void clearError() { error = false; } /// Returns a pointer to the next byte in the BitStream from the current bit position --- 114,118 ---- /// clears the error state from an attempted read or write overrun ! void clearError() { mError = false; } /// Returns a pointer to the next byte in the BitStream from the current bit position *************** *** 238,243 **** bool readFlag(); ! bool write(bool value) { writeFlag(value); return !error; } ! bool read(bool *value) { *value = readFlag(); return !error; } /// Writes a huffman compressed string into the stream. --- 238,243 ---- bool readFlag(); ! bool write(bool value) { writeFlag(value); return !mError; } ! bool read(bool *value) { *value = readFlag(); return !mError; } /// Writes a huffman compressed string into the stream. *************** *** 282,286 **** bool isFull() { return bitNum > (getBufferSize() << 3); } /// Returns whether the stream has generated an error condition due to reading or writing past the end of the buffer. ! bool isValid() { return !error; } /// Hashes the BitStream, writing the hash digest into the end of the buffer, and then encrypts with the given cipher --- 282,293 ---- bool isFull() { return bitNum > (getBufferSize() << 3); } /// Returns whether the stream has generated an error condition due to reading or writing past the end of the buffer. ! bool isValid() { return !mError; } ! ! /// Sets the error condition on the bit stream. ! void setError() ! { ! TNLAssert(0, "BitStream error set."); ! mError = true; ! } /// Hashes the BitStream, writing the hash digest into the end of the buffer, and then encrypts with the given cipher *************** *** 340,345 **** if(bitNum > maxReadBitNum) { ! error = true; ! TNLAssert(false, "Out of range read"); return false; } --- 347,351 ---- if(bitNum > maxReadBitNum) { ! setError(); return false; } *************** *** 379,384 **** if(val > rangeEnd) { ! TNLAssert(0, "Value out of range in readRangedU32"); ! error = true; return rangeStart; } --- 385,389 ---- if(val > rangeEnd) { ! setError(); return rangeStart; } Index: netConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/netConnection.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** netConnection.cpp 28 Apr 2005 20:42:55 -0000 1.14 --- netConnection.cpp 1 May 2005 00:29:55 -0000 1.15 *************** *** 544,547 **** --- 544,551 ---- { mTypeFlags.clear(ConnectionAdaptive); + if(maxRecvBandwidth > MaxFixedBandwidth) + maxRecvBandwidth = MaxFixedBandwidth; + if(maxSendBandwidth > MaxFixedBandwidth) + maxSendBandwidth = MaxFixedBandwidth; mLocalRate.maxRecvBandwidth = maxRecvBandwidth; |