mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 12:11:36 +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) {
|
Buffer::Ptr HttpFileBody::readData(size_t size) {
|
||||||
size = MIN((size_t)remainSize(), size);
|
size = (size_t)(MIN(remainSize(), (int64_t)size));
|
||||||
if (!size) {
|
if (!size) {
|
||||||
//没有剩余字节了
|
//没有剩余字节了
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -159,18 +159,15 @@ static bool makeFolderMenu(const string &httpPath, const string &strFullPath, st
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//是文件
|
//是文件
|
||||||
struct stat fileData;
|
auto fileSize = File::fileSize(strAbsolutePath.data());
|
||||||
if (0 == stat(strAbsolutePath.data(), &fileData)) {
|
if (fileSize < 1024) {
|
||||||
auto &fileSize = fileData.st_size;
|
ss << " (" << fileSize << "B)" << endl;
|
||||||
if (fileSize < 1024) {
|
} else if (fileSize < 1024 * 1024) {
|
||||||
ss << " (" << fileData.st_size << "B)" << endl;
|
ss << fixed << setprecision(2) << " (" << fileSize / 1024.0 << "KB)";
|
||||||
} else if (fileSize < 1024 * 1024) {
|
} else if (fileSize < 1024 * 1024 * 1024) {
|
||||||
ss << fixed << setprecision(2) << " (" << fileData.st_size / 1024.0 << "KB)";
|
ss << fixed << setprecision(2) << " (" << fileSize / 1024 / 1024.0 << "MB)";
|
||||||
} else if (fileSize < 1024 * 1024 * 1024) {
|
} else {
|
||||||
ss << fixed << setprecision(2) << " (" << fileData.st_size / 1024 / 1024.0 << "MB)";
|
ss << fixed << setprecision(2) << " (" << fileSize / 1024 / 1024 / 1024.0 << "GB)";
|
||||||
} else {
|
|
||||||
ss << fixed << setprecision(2) << " (" << fileData.st_size / 1024 / 1024 / 1024.0 << "GB)";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ss << "</a></li>\r\n";
|
ss << "</a></li>\r\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user