merge of branch v0.6-idclean 7180

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7187 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2014-03-17 20:56:06 +00:00
parent 7815efb16f
commit 0f29d28b1b
397 changed files with 6503 additions and 5702 deletions

View file

@ -215,105 +215,6 @@ bool setRawUFloat32(void *data,uint32_t size,uint32_t *offset,float f)
return setRawUInt32(data, size, offset, n);
}
bool getRawSha1(void *data,uint32_t size,uint32_t *offset,Sha1CheckSum& cs)
{
uint32_t len = Sha1CheckSum::SIZE_IN_BYTES ; // SHA1 length in bytes = 20
/* check there is space for string */
if (size < *offset + len)
{
std::cerr << "getRawSha1() not enough size" << std::endl;
return false;
}
bool ok = true ;
cs = Sha1CheckSum(&((uint8_t*)data)[*offset]) ;
*offset += Sha1CheckSum::SIZE_IN_BYTES ;
return ok ;
}
bool setRawSha1(void *data,uint32_t size,uint32_t *offset,const Sha1CheckSum& cs)
{
uint32_t len = Sha1CheckSum::SIZE_IN_BYTES ; // SHA1 length in bytes
if (size < *offset + len)
{
std::cerr << "setRawSha1() Not enough size" << std::endl;
return false;
}
bool ok = true ;
/* pack it in */
memcpy((void *) &(((uint8_t *) data)[*offset]), cs.toByteArray(), Sha1CheckSum::SIZE_IN_BYTES) ;
offset += Sha1CheckSum::SIZE_IN_BYTES ;
return true ;
}
bool getRawSSLId(void *data,uint32_t size,uint32_t *offset,SSLIdType& cs)
{
uint32_t len = 16 ; // SSL id type
/* check there is space for string */
if (size < *offset + len)
{
std::cerr << "getRawSha1() not enough size" << std::endl;
return false;
}
bool ok = true ;
cs = SSLIdType(&((uint8_t*)data)[*offset]) ;
*offset += 16 ;
return ok ;
}
bool setRawSSLId(void *data,uint32_t size,uint32_t *offset,const SSLIdType& cs)
{
uint32_t len = 16 ; // SHA1 length in bytes
if (size < *offset + len)
{
std::cerr << "setRawSha1() Not enough size" << std::endl;
return false;
}
memcpy((void *) &(((uint8_t *) data)[*offset]), cs.toByteArray(), 16);
*offset += 16 ;
return true ;
}
bool getRawPGPFingerprint(void *data,uint32_t size,uint32_t *offset,PGPFingerprintType& cs)
{
uint32_t len = 20 ; // SSL id type
/* check there is space for string */
if (size < *offset + len)
{
std::cerr << "getRawPGPFingerprint() not enough size" << std::endl;
return false;
}
bool ok = true ;
cs = PGPFingerprintType(&((uint8_t*)data)[*offset]) ;
*offset += 20 ;
return ok ;
}
bool setRawPGPFingerprint(void *data,uint32_t size,uint32_t *offset,const PGPFingerprintType& cs)
{
uint32_t len = 20 ; // SHA1 length in bytes
if (size < *offset + len)
{
std::cerr << "setRawPGPFingerprint() Not enough size" << std::endl;
return false;
}
memcpy((void *) &(((uint8_t *) data)[*offset]), cs.toByteArray(), 20);
*offset += 20 ;
return true ;
}
bool getRawString(void *data, uint32_t size, uint32_t *offset, std::string &outStr)
{
uint32_t len = 0;