diff options
author | George Hazan <ghazan@miranda.im> | 2021-04-21 20:06:07 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-04-21 20:06:07 +0300 |
commit | cefe13e9c64aa74f2a9e1b2d7bd6115267911a06 (patch) | |
tree | e6ce90fa05f9472279bae2cd2d0c70e15128dc93 /protocols/WhatsAppWeb/src/utils.cpp | |
parent | 8c9108eeb7a2a4e763973ed26b1ab2c0323f5dfb (diff) |
не пригодилось
Diffstat (limited to 'protocols/WhatsAppWeb/src/utils.cpp')
-rw-r--r-- | protocols/WhatsAppWeb/src/utils.cpp | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/protocols/WhatsAppWeb/src/utils.cpp b/protocols/WhatsAppWeb/src/utils.cpp index 70f2f5892f..47ab78b189 100644 --- a/protocols/WhatsAppWeb/src/utils.cpp +++ b/protocols/WhatsAppWeb/src/utils.cpp @@ -344,63 +344,3 @@ CMStringA WAReader::readStringFromChars(int size) m_buf += size; return ret; } - -///////////////////////////////////////////////////////////////////////////////////////// -// Object serialization - -bool WAS_Decoder::read(void *pObj, const WAS_Field *fields, size_t iFieldCount) -{ - BYTE *pDest = (BYTE *)pObj; - - for (int i = 0; i < iFieldCount; i++) { - auto &F = fields[i]; - switch (F.type) { - case WAS_STRING: - if (*m_buf++ != 0x0A) return false; - { - char **d = (char **)&pDest[F.offset]; - int len = (F.len == 0) ? *m_buf++ : F.len; - *d = (char *)mir_strndup((char*)m_buf, len); - m_buf += len; - } - break; - - case WAS_BINARY: - if (*m_buf++ != 0x1A) return false; - { - char **d = (char **)&pDest[F.offset]; - int len = (F.len == 0) ? *m_buf++ : F.len; - *d = (char *)mir_strndup((char*)m_buf, len); - m_buf += len; - } - break; - - case WAS_BOOL: - if (*m_buf++ != 0x10) return false; - { - bool *d = (bool *)&pDest[F.offset]; - *d = *m_buf++; - } - break; - - case WAS_INT8: - if (*m_buf++ != 0x12) return false; - { - BYTE *d = (BYTE*)&pDest[F.offset]; - *d = *m_buf++; - } - break; - - case WAS_INT64: - if (*m_buf++ != 0x18) return false; - { - __int64 *d = (__int64 *)&pDest[F.offset]; - *d = *(__int64 *)m_buf; - m_buf += sizeof(__int64); - } - break; - } - } - - return true; -} |