| 274 | } |
| 275 | |
| 276 | int Document::sizeInStream(DocumentData *document) { |
| 277 | int result = 0; |
| 278 | |
| 279 | // id + access + date |
| 280 | result += sizeof(quint64) + sizeof(quint64) + sizeof(qint32); |
| 281 | // file_reference + version tag + version |
| 282 | result += bytearraySize(document->_fileReference) + sizeof(qint32) * 2; |
| 283 | // + namelen + name + mimelen + mime + dc + size |
| 284 | result += stringSize(document->filename()) + stringSize(document->mimeString()) + sizeof(qint32) + sizeof(qint32); |
| 285 | // + width + height |
| 286 | result += sizeof(qint32) + sizeof(qint32); |
| 287 | // + type |
| 288 | result += sizeof(qint32); |
| 289 | |
| 290 | if (auto sticker = document->sticker()) { // type == StickerDocument |
| 291 | // + altlen + alt + type-of-set |
| 292 | result += stringSize(sticker->alt) + sizeof(qint32); |
| 293 | } else { |
| 294 | // + duration |
| 295 | result += sizeof(qint32); |
| 296 | } |
| 297 | // + thumb loc |
| 298 | result += Serialize::imageLocationSize(document->thumbnailLocation()); |
| 299 | result += sizeof(qint32); // thumbnail_byte_size |
| 300 | result += Serialize::imageLocationSize(document->videoThumbnailLocation()); |
| 301 | result += sizeof(qint32); // video_thumbnail_byte_size |
| 302 | |
| 303 | result += sizeof(qint32) + Serialize::bytearraySize(document->inlineThumbnailBytes()); |
| 304 | |
| 305 | return result; |
| 306 | } |
| 307 | |
| 308 | } // namespace Serialize |
nothing calls this directly
no test coverage detected