Renamed 'byte' to 'byte_t'.

This commit is contained in:
Vincent Richard 2006-04-18 19:04:30 +00:00
parent b16c5ca684
commit 3bbffc18de
26 changed files with 98 additions and 94 deletions

View File

@ -2,6 +2,11 @@
VERSION 0.8.1cvs
================
2006-04-18 Vincent Richard <vincent@vincent-richard.net>
* Renamed 'byte' to 'byte_t' to fix compilation problems on Fedora
core 5 (thanks to Rafael Fernandez).
2006-02-20 Vincent Richard <vincent@vincent-richard.net>
* net/imap/IMAPParser.hpp: added a "relaxed" mode to allow 8-bit

View File

@ -370,10 +370,10 @@ void IMAPConnection::authenticateSASL()
continue;
}
byte* challenge = 0;
byte_t* challenge = 0;
int challengeLen = 0;
byte* resp = 0;
byte_t* resp = 0;
int respLen = 0;
try

View File

@ -454,10 +454,10 @@ void POP3Store::authenticateSASL()
}
case RESPONSE_READY:
{
byte* challenge = 0;
byte_t* challenge = 0;
int challengeLen = 0;
byte* resp = 0;
byte_t* resp = 0;
int respLen = 0;
try

View File

@ -355,10 +355,10 @@ void SMTPTransport::authenticateSASL()
}
case 334:
{
byte* challenge = 0;
byte_t* challenge = 0;
int challengeLen = 0;
byte* resp = 0;
byte_t* resp = 0;
int respLen = 0;
try

View File

@ -319,7 +319,7 @@ ref <security::cert::certificateChain> TLSSocket::getPeerCertificates() const
gnutls_x509_crt_export(x509Certs[i],
GNUTLS_X509_FMT_DER, NULL, &dataSize);
byte* data = new byte[dataSize];
byte_t* data = new byte_t[dataSize];
gnutls_x509_crt_export(x509Certs[i],
GNUTLS_X509_FMT_DER, data, &dataSize);

View File

@ -92,12 +92,12 @@ ref <X509Certificate> X509Certificate::import(utility::inputStream& is)
// static
ref <X509Certificate> X509Certificate::import
(const byte* data, const unsigned int length)
(const byte_t* data, const unsigned int length)
{
ref <X509Certificate> cert = vmime::create <X509Certificate>();
gnutls_datum buffer;
buffer.data = const_cast <byte*>(data);
buffer.data = const_cast <byte_t*>(data);
buffer.size = length;
// Try DER format
@ -126,7 +126,7 @@ void X509Certificate::write
gnutls_x509_crt_export(m_data->cert, fmt, NULL, &dataSize);
byte* data = new byte[dataSize];
byte_t* data = new byte_t[dataSize];
gnutls_x509_crt_export(m_data->cert, fmt, data, &dataSize);
@ -210,7 +210,7 @@ const byteArray X509Certificate::getFingerprint(const DigestAlgorithm algo) cons
gnutls_x509_crt_get_fingerprint
(m_data->cert, galgo, NULL, &bufferSize);
byte* buffer = new byte[bufferSize];
byte_t* buffer = new byte_t[bufferSize];
if (gnutls_x509_crt_get_fingerprint
(m_data->cert, galgo, buffer, &bufferSize) == 0)

View File

@ -117,7 +117,7 @@ static inline void swapUint32Array(vmime_uint32* buf, unsigned long words)
}
void md5MessageDigest::update(const byte b)
void md5MessageDigest::update(const byte_t b)
{
update(&b, 1);
}
@ -125,18 +125,18 @@ void md5MessageDigest::update(const byte b)
void md5MessageDigest::update(const string& s)
{
update(reinterpret_cast <const byte*>(s.data()), s.length());
update(reinterpret_cast <const byte_t*>(s.data()), s.length());
}
void md5MessageDigest::update(const byte* data, const unsigned long offset,
void md5MessageDigest::update(const byte_t* data, const unsigned long offset,
const unsigned long len)
{
update(data + offset, len);
}
void md5MessageDigest::update(const byte* data, const unsigned long length)
void md5MessageDigest::update(const byte_t* data, const unsigned long length)
{
const unsigned long avail = 64 - (m_byteCount & 0x3f);
unsigned long len = length;
@ -175,14 +175,14 @@ void md5MessageDigest::finalize(const string& s)
}
void md5MessageDigest::finalize(const byte* buffer, const unsigned long len)
void md5MessageDigest::finalize(const byte_t* buffer, const unsigned long len)
{
update(buffer, len);
finalize();
}
void md5MessageDigest::finalize(const byte* buffer,
void md5MessageDigest::finalize(const byte_t* buffer,
const unsigned long offset, const unsigned long len)
{
update(buffer, offset, len);
@ -333,9 +333,9 @@ const int md5MessageDigest::getDigestLength() const
}
const byte* md5MessageDigest::getDigest() const
const byte_t* md5MessageDigest::getDigest() const
{
return reinterpret_cast <const byte*>(m_hash);
return reinterpret_cast <const byte_t*>(m_hash);
}

View File

@ -33,7 +33,7 @@ namespace digest {
const string messageDigest::getHexDigest() const
{
const byte* hash = getDigest();
const byte_t* hash = getDigest();
const int len = getDigestLength();
static const unsigned char hex[] = "0123456789abcdef";
@ -47,7 +47,6 @@ const string messageDigest::getHexDigest() const
}
return oss.str();
}

View File

@ -80,7 +80,7 @@ void sha1MessageDigest::init()
}
void sha1MessageDigest::update(const byte b)
void sha1MessageDigest::update(const byte_t b)
{
update(&b, 1);
}
@ -88,18 +88,18 @@ void sha1MessageDigest::update(const byte b)
void sha1MessageDigest::update(const string& s)
{
update(reinterpret_cast <const byte*>(s.data()), s.length());
update(reinterpret_cast <const byte_t*>(s.data()), s.length());
}
void sha1MessageDigest::update(const byte* buffer, const unsigned long offset,
void sha1MessageDigest::update(const byte_t* buffer, const unsigned long offset,
const unsigned long len)
{
update(buffer + offset, len);
}
void sha1MessageDigest::update(const byte* buffer, const unsigned long len)
void sha1MessageDigest::update(const byte_t* buffer, const unsigned long len)
{
unsigned int i, j;
@ -142,10 +142,10 @@ void sha1MessageDigest::finalize()
>> ((3-(i & 3)) * 8) ) & 255); // Endian independent
}
update(reinterpret_cast <const byte*>("\200"), 1);
update(reinterpret_cast <const byte_t*>("\200"), 1);
while ((m_count[0] & 504) != 448)
update(reinterpret_cast <const byte*>("\0"), 1);
update(reinterpret_cast <const byte_t*>("\0"), 1);
update(finalcount, 8); // Should cause a transform()
@ -167,18 +167,18 @@ void sha1MessageDigest::finalize()
void sha1MessageDigest::finalize(const string& s)
{
finalize(reinterpret_cast <const byte*>(s.data()), s.length());
finalize(reinterpret_cast <const byte_t*>(s.data()), s.length());
}
void sha1MessageDigest::finalize(const byte* buffer, const unsigned long len)
void sha1MessageDigest::finalize(const byte_t* buffer, const unsigned long len)
{
update(buffer, len);
finalize();
}
void sha1MessageDigest::finalize(const byte* buffer,
void sha1MessageDigest::finalize(const byte_t* buffer,
const unsigned long offset, const unsigned long len)
{
finalize(buffer + offset, len);
@ -252,7 +252,7 @@ const int sha1MessageDigest::getDigestLength() const
}
const byte* sha1MessageDigest::getDigest() const
const byte_t* sha1MessageDigest::getDigest() const
{
return m_digest;
}

View File

@ -96,7 +96,7 @@ ref <SASLMechanism> SASLContext::suggestMechanism
}
void SASLContext::decodeB64(const string& input, byte** output, int* outputLen)
void SASLContext::decodeB64(const string& input, byte_t** output, int* outputLen)
{
string res;
@ -107,7 +107,7 @@ void SASLContext::decodeB64(const string& input, byte** output, int* outputLen)
dec->decode(is, os);
byte* out = new byte[res.length()];
byte_t* out = new byte_t[res.length()];
std::copy(res.begin(), res.end(), out);
@ -116,7 +116,7 @@ void SASLContext::decodeB64(const string& input, byte** output, int* outputLen)
}
const string SASLContext::encodeB64(const byte* input, const int inputLen)
const string SASLContext::encodeB64(const byte_t* input, const int inputLen)
{
string res;

View File

@ -93,8 +93,8 @@ ref <SASLContext> SASLSession::getContext()
const bool SASLSession::evaluateChallenge
(const byte* challenge, const int challengeLen,
byte** response, int* responseLen)
(const byte_t* challenge, const int challengeLen,
byte_t** response, int* responseLen)
{
return m_mech->step(thisRef().dynamicCast <SASLSession>(),
challenge, challengeLen, response, responseLen);

View File

@ -105,11 +105,11 @@ const int SASLSocket::receiveRaw(char* buffer, const int count)
const int n = m_wrapped->receiveRaw(buffer, count);
byte* output = 0;
byte_t* output = 0;
int outputLen = 0;
m_session->getMechanism()->decode
(m_session, reinterpret_cast <const byte*>(buffer), n,
(m_session, reinterpret_cast <const byte_t*>(buffer), n,
&output, &outputLen);
// If we can not copy all decoded data into the output buffer, put
@ -143,11 +143,11 @@ void SASLSocket::send(const string& buffer)
void SASLSocket::sendRaw(const char* buffer, const int count)
{
byte* output = 0;
byte_t* output = 0;
int outputLen = 0;
m_session->getMechanism()->encode
(m_session, reinterpret_cast <const byte*>(buffer), count,
(m_session, reinterpret_cast <const byte_t*>(buffer), count,
&output, &outputLen);
try

View File

@ -57,8 +57,8 @@ const string builtinSASLMechanism::getName() const
const bool builtinSASLMechanism::step
(ref <SASLSession> sess, const byte* challenge, const int challengeLen,
byte** response, int* responseLen)
(ref <SASLSession> sess, const byte_t* challenge, const int challengeLen,
byte_t** response, int* responseLen)
{
char* output = 0;
size_t outputLen = 0;
@ -69,7 +69,7 @@ const bool builtinSASLMechanism::step
if (result == GSASL_OK || result == GSASL_NEEDS_MORE)
{
byte* res = new byte[outputLen];
byte_t* res = new byte_t[outputLen];
for (size_t i = 0 ; i < outputLen ; ++i)
res[i] = output[i];
@ -115,8 +115,8 @@ const bool builtinSASLMechanism::isComplete() const
void builtinSASLMechanism::encode
(ref <SASLSession> sess, const byte* input, const int inputLen,
byte** output, int* outputLen)
(ref <SASLSession> sess, const byte_t* input, const int inputLen,
byte_t** output, int* outputLen)
{
char* coutput = 0;
size_t coutputLen = 0;
@ -130,7 +130,7 @@ void builtinSASLMechanism::encode
try
{
byte* res = new byte[coutputLen];
byte_t* res = new byte_t[coutputLen];
std::copy(coutput, coutput + coutputLen, res);
@ -148,8 +148,8 @@ void builtinSASLMechanism::encode
void builtinSASLMechanism::decode
(ref <SASLSession> sess, const byte* input, const int inputLen,
byte** output, int* outputLen)
(ref <SASLSession> sess, const byte_t* input, const int inputLen,
byte_t** output, int* outputLen)
{
char* coutput = 0;
size_t coutputLen = 0;
@ -163,7 +163,7 @@ void builtinSASLMechanism::decode
throw exceptions::sasl_exception("Decoding error.");
}
byte* res = new byte[coutputLen];
byte_t* res = new byte_t[coutputLen];
std::copy(coutput, coutput + coutputLen, res);

View File

@ -363,7 +363,7 @@ const stream::size_type inputStreamPointerAdapter::skip(const size_type count)
// inputStreamByteBufferAdapter
inputStreamByteBufferAdapter::inputStreamByteBufferAdapter(const byte* buffer, const size_type length)
inputStreamByteBufferAdapter::inputStreamByteBufferAdapter(const byte_t* buffer, const size_type length)
: m_buffer(buffer), m_length(length), m_pos(0)
{
}

View File

@ -74,7 +74,7 @@ VMIME_TEST_SUITE_BEGIN
{
INIT_DIGEST(algo, "sha1");
vmime::byte* buffer = new vmime::byte[1000000];
vmime::byte_t* buffer = new vmime::byte_t[1000000];
for (int i = 0 ; i < 1000000 ; ++i)
buffer[i] = 'a';

View File

@ -83,7 +83,7 @@ public:
* @return a X.509 certificate, or NULL if the given data does not
* represent a valid certificate
*/
static ref <X509Certificate> import(const byte* data, const unsigned int length);
static ref <X509Certificate> import(const byte_t* data, const unsigned int length);
/** Exports this X.509 certificate to the specified format.
*

View File

@ -40,18 +40,18 @@ public:
md5MessageDigest();
void update(const byte b);
void update(const byte_t b);
void update(const string& s);
void update(const byte* buffer, const unsigned long len);
void update(const byte* buffer, const unsigned long offset, const unsigned long len);
void update(const byte_t* buffer, const unsigned long len);
void update(const byte_t* buffer, const unsigned long offset, const unsigned long len);
void finalize();
void finalize(const string& s);
void finalize(const byte* buffer, const unsigned long len);
void finalize(const byte* buffer, const unsigned long offset, const unsigned long len);
void finalize(const byte_t* buffer, const unsigned long len);
void finalize(const byte_t* buffer, const unsigned long offset, const unsigned long len);
const int getDigestLength() const;
const byte* getDigest() const;
const byte_t* getDigest() const;
void reset();

View File

@ -52,14 +52,14 @@ public:
*
* @param b the byte with which to update the digest.
*/
virtual void update(const byte b) = 0;
virtual void update(const byte_t b) = 0;
/** Updates the digest using the specified array of bytes.
*
* @param buffer array of bytes
* @param len number of bytes to use in the buffer
*/
virtual void update(const byte* buffer, const unsigned long len) = 0;
virtual void update(const byte_t* buffer, const unsigned long len) = 0;
/** Updates the digest using the specified array of bytes,
* starting at the specified offset.
@ -68,7 +68,7 @@ public:
* @param offset offset to start from in the array of bytes
* @param len number of bytes to use, starting at offset
*/
virtual void update(const byte* buffer,
virtual void update(const byte_t* buffer,
const unsigned long offset,
const unsigned long len) = 0;
@ -87,14 +87,14 @@ public:
* such as padding. This is equivalent to calling update() and
* then finalize().
*/
virtual void finalize(const byte* buffer,
virtual void finalize(const byte_t* buffer,
const unsigned long len) = 0;
/** Completes the hash computation by performing final operations
* such as padding. This is equivalent to calling update() and
* then finalize().
*/
virtual void finalize(const byte* buffer,
virtual void finalize(const byte_t* buffer,
const unsigned long offset,
const unsigned long len) = 0;
@ -112,7 +112,7 @@ public:
*
* @return computed hash
*/
virtual const byte* getDigest() const = 0;
virtual const byte_t* getDigest() const = 0;
/** Returns the hash as an hexadecimal string.
* You must call finalize() before using this function, or the

View File

@ -40,18 +40,18 @@ public:
sha1MessageDigest();
void update(const byte b);
void update(const byte_t b);
void update(const string& s);
void update(const byte* buffer, const unsigned long len);
void update(const byte* buffer, const unsigned long offset, const unsigned long len);
void update(const byte_t* buffer, const unsigned long len);
void update(const byte_t* buffer, const unsigned long offset, const unsigned long len);
void finalize();
void finalize(const string& s);
void finalize(const byte* buffer, const unsigned long len);
void finalize(const byte* buffer, const unsigned long offset, const unsigned long len);
void finalize(const byte_t* buffer, const unsigned long len);
void finalize(const byte_t* buffer, const unsigned long offset, const unsigned long len);
const int getDigestLength() const;
const byte* getDigest() const;
const byte_t* getDigest() const;
void reset();
@ -59,13 +59,13 @@ protected:
void init();
static void transform(unsigned long state[5], const byte buffer[64]);
static void transform(unsigned long state[5], const byte_t buffer[64]);
unsigned long m_state[5];
unsigned long m_count[2];
byte m_buffer[64];
byte_t m_buffer[64];
byte m_digest[20];
byte_t m_digest[20];
};

View File

@ -87,7 +87,7 @@ public:
* @param output output buffer
* @param outputLen length of output buffer
*/
void decodeB64(const string& input, byte** output, int* outputLen);
void decodeB64(const string& input, byte_t** output, int* outputLen);
/** Helper function for encoding challenge in Base64.
*
@ -95,7 +95,7 @@ public:
* @param inputLen length of input buffer
* @return Base64-encoded challenge
*/
const string encodeB64(const byte* input, const int inputLen);
const string encodeB64(const byte_t* input, const int inputLen);
private:

View File

@ -66,8 +66,8 @@ public:
*/
virtual const bool step
(ref <SASLSession> sess,
const byte* challenge, const int challengeLen,
byte** response, int* responseLen) = 0;
const byte_t* challenge, const int challengeLen,
byte_t** response, int* responseLen) = 0;
/** Check whether authentication has completed. If false, more
* calls to evaluateChallenge() are needed to complete the
@ -92,8 +92,8 @@ public:
* 'outputLen' are undetermined)
*/
virtual void encode(ref <SASLSession> sess,
const byte* input, const int inputLen,
byte** output, int* outputLen) = 0;
const byte_t* input, const int inputLen,
byte_t** output, int* outputLen) = 0;
/** Decode data according to negotiated SASL mechanism. This
* might mean that data is integrity or privacy protected.
@ -109,8 +109,8 @@ public:
* 'outputLen' are undetermined)
*/
virtual void decode(ref <SASLSession> sess,
const byte* input, const int inputLen,
byte** output, int* outputLen) = 0;
const byte_t* input, const int inputLen,
byte_t** output, int* outputLen) = 0;
};

View File

@ -102,8 +102,8 @@ public:
* 'responseLen' are undetermined)
*/
const bool evaluateChallenge
(const byte* challenge, const int challengeLen,
byte** response, int* responseLen);
(const byte_t* challenge, const int challengeLen,
byte_t** response, int* responseLen);
/** Return a socket in which transmitted data is integrity
* and/or privacy protected, depending on the QOP (Quality of

View File

@ -63,7 +63,7 @@ private:
ref <SASLSession> m_session;
ref <net::socket> m_wrapped;
byte* m_pendingBuffer;
byte_t* m_pendingBuffer;
int m_pendingPos;
int m_pendingLen;

View File

@ -51,18 +51,18 @@ public:
const bool step
(ref <SASLSession> sess,
const byte* challenge, const int challengeLen,
byte** response, int* responseLen);
const byte_t* challenge, const int challengeLen,
byte_t** response, int* responseLen);
const bool isComplete() const;
void encode(ref <SASLSession> sess,
const byte* input, const int inputLen,
byte** output, int* outputLen);
const byte_t* input, const int inputLen,
byte_t** output, int* outputLen);
void decode(ref <SASLSession> sess,
const byte* input, const int inputLen,
byte** output, int* outputLen);
const byte_t* input, const int inputLen,
byte_t** output, int* outputLen);
private:

View File

@ -44,8 +44,8 @@ namespace vmime
typedef int char_t;
typedef vmime_uint8 byte;
typedef std::vector <byte> byteArray;
typedef vmime_uint8 byte_t;
typedef std::vector <byte_t> byteArray;
// Some aliases
namespace utils = utility;

View File

@ -362,7 +362,7 @@ class inputStreamByteBufferAdapter : public inputStream
{
public:
inputStreamByteBufferAdapter(const byte* buffer, size_type length);
inputStreamByteBufferAdapter(const byte_t* buffer, size_type length);
const bool eof() const;
void reset();
@ -371,7 +371,7 @@ public:
private:
const byte* m_buffer;
const byte_t* m_buffer;
const size_type m_length;
size_type m_pos;