From 9172d14dd335b8b7b0102b310f9b69a6ad183f7a Mon Sep 17 00:00:00 2001 From: Guillaume Dupuy Date: Fri, 14 Jul 2017 14:49:27 +0200 Subject: [PATCH 1/5] Fix issue #302 - incorrect freespace on 32 bits system --HG-- branch : fix_freespace_check --- code/nel/src/misc/system_info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index 680329dcf..545de0cc6 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -1390,7 +1390,7 @@ uint64 CSystemInfo::availableHDSpace (const string &filename) struct statfs stfs; if (::statfs(path.c_str(), &stfs) != 0) return 0; - return (uint64)(stfs.f_bavail * stfs.f_bsize); + return (uint64)stfs.f_bavail * (uint64)stfs.f_bsize; #else ULARGE_INTEGER freeSpace = {0}; BOOL bRes = ::GetDiskFreeSpaceExW(utf8ToWide(path), &freeSpace, NULL, NULL); From d163cde51e6ae9e8e319e6944bbef167334c90c4 Mon Sep 17 00:00:00 2001 From: Guillaume Dupuy Date: Sat, 15 Jul 2017 12:14:33 +0200 Subject: [PATCH 2/5] Fix ignoreFreeDiskSpaceChecks() usage Now actually ignore free space, instead of creating an error and refusing to go further everytime --HG-- branch : fix_freespace_check --- code/ryzom/tools/client/ryzom_installer/src/downloader.cpp | 7 ++++--- .../tools/client/ryzom_installer/src/migratedialog.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp index 81fc7ecd3..fd034aebf 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp @@ -180,9 +180,10 @@ void CDownloader::getFileHead() void CDownloader::downloadFile() { - qint64 freeSpace = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks() ? 0:NLMISC::CSystemInfo::availableHDSpace(m_fullPath.toUtf8().constData()); + bool ignoreFreeDiskSpaceChecks = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks(); + qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_fullPath.toUtf8().constData()); - if (freeSpace == 0) + if (!ignoreFreeDiskSpaceChecks && freeSpace == 0) { if (m_listener) { @@ -192,7 +193,7 @@ void CDownloader::downloadFile() return; } - if (freeSpace < m_size - m_offset) + if (!ignoreFreeDiskSpaceChecks && freeSpace < m_size - m_offset) { // we have not enough free disk space to continue download if (m_listener) m_listener->operationFail(tr("You only have %1 bytes left on the device, but %2 bytes are needed.").arg(freeSpace).arg(m_size - m_offset)); diff --git a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp index d246701ea..99a2194f7 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp @@ -123,10 +123,11 @@ void CMigrateDialog::updateDestinationText() void CMigrateDialog::accept() { // check free disk space - qint64 freeSpace = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks() ? 0:NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); + bool ignoreFreeDiskSpaceChecks = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks(); + qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); // shouldn't happen - if (freeSpace == 0) + if (!ignoreFreeDiskSpaceChecks && freeSpace == 0) { int error = NLMISC::getLastError(); @@ -134,7 +135,7 @@ void CMigrateDialog::accept() } // compare with exact size of current directory - if (freeSpace && freeSpace < getDirectorySize(m_currentDirectory, true)) + if (!ignoreFreeDiskSpaceChecks && freeSpace && freeSpace < getDirectorySize(m_currentDirectory, true)) { QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Not enough free disk space"), tr("You don't have enough free space on this disk, please make more space or choose a directory on another disk.")); return; From e35195252ff797f874f7147b9b5355d2726d8ea7 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 23 Jul 2017 21:37:42 +0300 Subject: [PATCH 3/5] Changed: Fix issue with table background images not displaying --HG-- branch : develop --- code/nel/src/gui/group_html.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 0c082ae58..dba5283a1 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -450,6 +450,19 @@ namespace NLGUI { string finalUrl = upgradeInsecureUrl(getAbsoluteUrl(url)); + // use requested url for local name (cache) + string dest = localImageName(url); + #ifdef LOG_DL + nlwarning("add to download '%s' dest '%s' img %p", finalUrl.c_str(), dest.c_str(), img); + #endif + + // Display cached image while downloading new + if (type != TImageType::OverImage && CFile::fileExists(dest)) + { + setImage(img, dest, type); + setImageSize(img, style); + } + // Search if we are not already downloading this url. for(uint i = 0; i < Curls.size(); i++) { @@ -463,12 +476,6 @@ namespace NLGUI } } - // use requested url for local name (cache) - string dest = localImageName(url); - #ifdef LOG_DL - nlwarning("add to download '%s' dest '%s' img %p", finalUrl.c_str(), dest.c_str(), img); - #endif - Curls.push_back(CDataDownload(finalUrl, dest, ImgType, img, "", "", style, type)); if (Curls.size() < options.curlMaxConnections) { if (!startCurlDownload(Curls.back())) From 8300821d0e56abd6ac1cae7a4a4e235dc6417bb1 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 23 Jul 2017 22:40:07 +0300 Subject: [PATCH 4/5] Changed: Minor fix for mouseover image --HG-- branch : develop --- code/nel/src/gui/group_html.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index dba5283a1..2f7400fa1 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -1774,7 +1774,7 @@ namespace NLGUI tooltip = value[MY_HTML_IMG_TITLE]; // Mouse over image - const char *overSrc = value[MY_HTML_IMG_SRC]; + string overSrc; if (present[MY_HTML_IMG_DATA_OVER_SRC] && value[MY_HTML_IMG_DATA_OVER_SRC]) { overSrc = value[MY_HTML_IMG_DATA_OVER_SRC]; @@ -1788,7 +1788,7 @@ namespace NLGUI overSrc, "browse", params.c_str(), tooltip, style); } else - if (tooltip || overSrc) + if (tooltip || !overSrc.empty()) { addButton(CCtrlButton::PushButton, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], overSrc, "", "", tooltip, style); From d6faf81c81013670c49593015efb2d3c837815ed Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 23 Jul 2017 22:50:14 +0300 Subject: [PATCH 5/5] Changed: Ignore cache status when local file has been deleted --HG-- branch : develop --- code/nel/src/gui/group_html.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 2f7400fa1..ab5644f9d 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -366,8 +366,11 @@ namespace NLGUI time_t currentTime; time(¤tTime); - CHttpCacheObject cache = CHttpCache::getInstance()->lookup(download.dest); - if (CFile::fileExists(download.dest) && cache.Expires > currentTime) + CHttpCacheObject cache; + if (CFile::fileExists(download.dest)) + cache = CHttpCache::getInstance()->lookup(download.dest); + + if (cache.Expires > currentTime) { #ifdef LOG_DL nlwarning("Cache for (%s) is not expired (%s, expires:%d)", download.url.c_str(), download.dest.c_str(), cache.Expires - currentTime);