[8496] Resolve some #include cycles and unsafe code.

* Common.h  -> Threading.h ->  Errors.h -> Common.h
* Remove reduncdent #include "ByteBuffer.h" in headers
* Remove redundent #include "Auth/BigNumber.h" in headers
* Avoid multyply data copy at use some now dropped functions in BigNumber.
* Avoid copy fixed byte count from byte arrays with unknown real size created from BigNumber.
This commit is contained in:
VladimirMangos 2009-09-14 05:54:28 +04:00
parent b276b05363
commit 50d426e72c
13 changed files with 12 additions and 27 deletions

View file

@ -186,21 +186,6 @@ uint8 *BigNumber::AsByteArray(int minSize)
return _array;
}
ByteBuffer BigNumber::AsByteBuffer()
{
ByteBuffer ret(GetNumBytes());
ret.append(AsByteArray(), GetNumBytes());
return ret;
}
std::vector<uint8> BigNumber::AsByteVector()
{
std::vector<uint8> ret;
ret.resize(GetNumBytes());
memcpy(&ret[0], AsByteArray(), GetNumBytes());
return ret;
}
const char *BigNumber::AsHexStr()
{
return BN_bn2hex(_bn);

View file

@ -20,7 +20,6 @@
#define _AUTH_BIGNUMBER_H
#include "Common.h"
#include "ByteBuffer.h"
struct bignum_st;
@ -83,8 +82,6 @@ class BigNumber
uint32 AsDword();
uint8* AsByteArray(int minSize = 0);
ByteBuffer AsByteBuffer();
std::vector<uint8> AsByteVector();
const char *AsHexStr();
const char *AsDecStr();

View file

@ -17,6 +17,7 @@
*/
#include "Auth/Sha1.h"
#include "Auth/BigNumber.h"
#include <stdarg.h>
Sha1Hash::Sha1Hash()

View file

@ -22,7 +22,8 @@
#include "Common.h"
#include <openssl/sha.h>
#include <openssl/crypto.h>
#include "Auth/BigNumber.h"
class BigNumber;
class Sha1Hash
{

View file

@ -17,6 +17,7 @@
*/
#include "Threading.h"
#include "Errors.h"
#include <ace/OS_NS_unistd.h>
#include <ace/Sched_Params.h>
#include <vector>

View file

@ -23,7 +23,6 @@
#include <ace/TSS_T.h>
#include "ace/Atomic_Op.h"
#include <assert.h>
#include "Errors.h"
namespace ACE_Based
{

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8495"
#define REVISION_NR "8496"
#endif // __REVISION_NR_H__