mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 04:08:57 +08:00
http: 修复32位系统下,下载3GB以上文件失败的问题: #1446
This commit is contained in:
parent
4a7f5796ba
commit
b2bb37dc5c
@ -1 +1 @@
|
||||
Subproject commit 6a661111ea029538e1fafa505cb6e8bba8c95551
|
||||
Subproject commit 9d3124047d1ec64bf1674ae71bd4fddd728d2243
|
@ -205,7 +205,7 @@ int64_t HttpFileBody::remainSize() {
|
||||
}
|
||||
|
||||
Buffer::Ptr HttpFileBody::readData(size_t size) {
|
||||
size = MIN((size_t)remainSize(), size);
|
||||
size = (size_t)(MIN(remainSize(), (int64_t)size));
|
||||
if (!size) {
|
||||
//没有剩余字节了
|
||||
return nullptr;
|
||||
|
@ -159,18 +159,15 @@ static bool makeFolderMenu(const string &httpPath, const string &strFullPath, st
|
||||
continue;
|
||||
}
|
||||
//是文件
|
||||
struct stat fileData;
|
||||
if (0 == stat(strAbsolutePath.data(), &fileData)) {
|
||||
auto &fileSize = fileData.st_size;
|
||||
if (fileSize < 1024) {
|
||||
ss << " (" << fileData.st_size << "B)" << endl;
|
||||
} else if (fileSize < 1024 * 1024) {
|
||||
ss << fixed << setprecision(2) << " (" << fileData.st_size / 1024.0 << "KB)";
|
||||
} else if (fileSize < 1024 * 1024 * 1024) {
|
||||
ss << fixed << setprecision(2) << " (" << fileData.st_size / 1024 / 1024.0 << "MB)";
|
||||
} else {
|
||||
ss << fixed << setprecision(2) << " (" << fileData.st_size / 1024 / 1024 / 1024.0 << "GB)";
|
||||
}
|
||||
auto fileSize = File::fileSize(strAbsolutePath.data());
|
||||
if (fileSize < 1024) {
|
||||
ss << " (" << fileSize << "B)" << endl;
|
||||
} else if (fileSize < 1024 * 1024) {
|
||||
ss << fixed << setprecision(2) << " (" << fileSize / 1024.0 << "KB)";
|
||||
} else if (fileSize < 1024 * 1024 * 1024) {
|
||||
ss << fixed << setprecision(2) << " (" << fileSize / 1024 / 1024.0 << "MB)";
|
||||
} else {
|
||||
ss << fixed << setprecision(2) << " (" << fileSize / 1024 / 1024 / 1024.0 << "GB)";
|
||||
}
|
||||
ss << "</a></li>\r\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user