mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed chat bug that was truncating some messages, due to using a uint16_t to store a local size. Totally backward compatible. This fix might also affect blog messages.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2880 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c87844277a
commit
23a0b60e59
@ -41,7 +41,7 @@ inline void* right_shift_void_pointer(void* p, uint32_t len) {
|
|||||||
#define TLV_BASE_DEBUG 1
|
#define TLV_BASE_DEBUG 1
|
||||||
|
|
||||||
/**** Basic TLV Functions ****/
|
/**** Basic TLV Functions ****/
|
||||||
uint16_t GetTlvSize(void *data) {
|
uint32_t GetTlvSize(void *data) {
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ bool SetTlvString(void *data, uint32_t size, uint32_t *offset,
|
|||||||
|
|
||||||
void * to = right_shift_void_pointer(data, *offset);
|
void * to = right_shift_void_pointer(data, *offset);
|
||||||
|
|
||||||
uint16_t strlen = tlvsize - TLV_HEADER_SIZE;
|
uint32_t strlen = tlvsize - TLV_HEADER_SIZE;
|
||||||
memcpy(to, out.c_str(), strlen);
|
memcpy(to, out.c_str(), strlen);
|
||||||
|
|
||||||
*offset += strlen;
|
*offset += strlen;
|
||||||
@ -456,7 +456,7 @@ bool GetTlvString(void *data, uint32_t size, uint32_t *offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *strdata = (char *) right_shift_void_pointer(tlvstart, TLV_HEADER_SIZE);
|
char *strdata = (char *) right_shift_void_pointer(tlvstart, TLV_HEADER_SIZE);
|
||||||
uint16_t strsize = tlvsize - TLV_HEADER_SIZE; /* remove the header */
|
uint32_t strsize = tlvsize - TLV_HEADER_SIZE; /* remove the header */
|
||||||
if (strsize <= 0) {
|
if (strsize <= 0) {
|
||||||
in = "";
|
in = "";
|
||||||
} else {
|
} else {
|
||||||
@ -560,7 +560,7 @@ bool GetTlvWideString(void *data, uint32_t size, uint32_t *offset,
|
|||||||
bool ok = true;
|
bool ok = true;
|
||||||
/* remove the header, calc string length */
|
/* remove the header, calc string length */
|
||||||
*offset += TLV_HEADER_SIZE;
|
*offset += TLV_HEADER_SIZE;
|
||||||
uint16_t strlen = (tlvsize - TLV_HEADER_SIZE) / RS_WCHAR_SIZE;
|
uint32_t strlen = (tlvsize - TLV_HEADER_SIZE) / RS_WCHAR_SIZE;
|
||||||
|
|
||||||
/* Must convert manually to ensure its always the same! */
|
/* Must convert manually to ensure its always the same! */
|
||||||
for(uint32_t i = 0; i < strlen; i++)
|
for(uint32_t i = 0; i < strlen; i++)
|
||||||
|
@ -209,7 +209,7 @@ const uint16_t TLV_TYPE_IMAGE = 0x1060;
|
|||||||
|
|
||||||
|
|
||||||
/**** Basic TLV Functions ****/
|
/**** Basic TLV Functions ****/
|
||||||
uint16_t GetTlvSize(void *data);
|
uint32_t GetTlvSize(void *data);
|
||||||
uint16_t GetTlvType(void *data);
|
uint16_t GetTlvType(void *data);
|
||||||
bool SetTlvBase(void *data, uint32_t size, uint32_t *offset, uint16_t type, uint32_t len);
|
bool SetTlvBase(void *data, uint32_t size, uint32_t *offset, uint16_t type, uint32_t len);
|
||||||
bool SetTlvSize(void *data, uint32_t size, uint32_t len);
|
bool SetTlvSize(void *data, uint32_t size, uint32_t len);
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
/*****
|
/*****
|
||||||
* #define CHAT_DEBUG 1
|
* #define CHAT_DEBUG 1
|
||||||
*****/
|
*****/
|
||||||
#define CHAT_DEBUG 1
|
|
||||||
|
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
PopupChatDialog::PopupChatDialog(std::string id, std::string name,
|
PopupChatDialog::PopupChatDialog(std::string id, std::string name,
|
||||||
|
Loading…
Reference in New Issue
Block a user