diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_file.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_file.cpp index a966e89e35..1fd884e212 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_file.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_file.cpp @@ -54,8 +54,9 @@ int64_t File::Context::Seek(void *opaque, int64_t offset, int whence) { } int File::Context::read(bytes::span buffer) { - Assert(_size >= _offset); - const auto amount = std::min(std::size_t(_size - _offset), buffer.size()); + Expects(_size >= _offset); + + const auto amount = std::min(_size - _offset, int64(buffer.size())); if (unroll()) { return -1; @@ -102,7 +103,7 @@ int File::Context::read(bytes::span buffer) { int64_t File::Context::seek(int64_t offset, int whence) { const auto checkedSeek = [&](int64_t offset) { if (_failed || offset < 0 || offset > _size) { - return -1; + return int64(-1); } return (_offset = offset); }; diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_file.h b/Telegram/SourceFiles/media/streaming/media_streaming_file.h index e72da47eed..8ffea94309 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_file.h +++ b/Telegram/SourceFiles/media/streaming/media_streaming_file.h @@ -97,8 +97,8 @@ private: const not_null _reader; base::flat_map> _queuedPackets; - int _offset = 0; - int _size = 0; + int64 _offset = 0; + int64 _size = 0; bool _failed = false; bool _readTillEnd = false; std::optional _fullInCache; diff --git a/Telegram/SourceFiles/storage/streamed_file_downloader.cpp b/Telegram/SourceFiles/storage/streamed_file_downloader.cpp index edff06b253..71b9016799 100644 --- a/Telegram/SourceFiles/storage/streamed_file_downloader.cpp +++ b/Telegram/SourceFiles/storage/streamed_file_downloader.cpp @@ -32,7 +32,7 @@ StreamedFileDownloader::StreamedFileDownloader( // For FileLoader const QString &toFile, - int32 size, + int64 size, LocationType locationType, LoadToCacheSetting toCache, LoadFromCloudSetting fromCloud, diff --git a/Telegram/SourceFiles/storage/streamed_file_downloader.h b/Telegram/SourceFiles/storage/streamed_file_downloader.h index f00e4627e4..4dd2e9b129 100644 --- a/Telegram/SourceFiles/storage/streamed_file_downloader.h +++ b/Telegram/SourceFiles/storage/streamed_file_downloader.h @@ -34,7 +34,7 @@ public: // For FileLoader const QString &toFile, - int32 size, + int64 size, LocationType locationType, LoadToCacheSetting toCache, LoadFromCloudSetting fromCloud,