MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / sizeInStream

Method sizeInStream

Telegram/SourceFiles/storage/serialize_document.cpp:276–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276int 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

Callers

nothing calls this directly

Calls 7

bytearraySizeFunction · 0.85
stringSizeFunction · 0.85
imageLocationSizeFunction · 0.85
filenameMethod · 0.80
mimeStringMethod · 0.80
stickerMethod · 0.45
inlineThumbnailBytesMethod · 0.45

Tested by

no test coverage detected