diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-12-17 17:27:47 +0200 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-01-07 02:15:43 +0200 |
| commit | 43cdddd715ff71ddc447c1d47f5d4f3868ecafb4 (patch) | |
| tree | 254fb183c3b9f83ea7b08a1a3b479db409490693 | |
| parent | 59257c136e2baa00a7ff74f462a9fd210e5dc5fc (diff) | |
#4899 Fix erros related to negative file size
| -rw-r--r-- | indra/llcharacter/llkeyframemotion.cpp | 2 | ||||
| -rwxr-xr-x | indra/llcommon/llfile.cpp | 6 | ||||
| -rwxr-xr-x | indra/llcommon/llfile.h | 4 | ||||
| -rw-r--r-- | indra/newview/llviewerassetupload.cpp | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index be1c74a908..4e5a920230 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -589,7 +589,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact } else { - LL_WARNS() << "Failed to allocate buffer: " << anim_file_size << mID << LL_ENDL; + LL_WARNS() << "Failed to allocate buffer: " << anim_file_size << " " << mID << LL_ENDL; } delete anim_file; anim_file = NULL; diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index ec4e15c690..0ceb2eb03b 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -564,7 +564,8 @@ S64 LLFile::size(std::error_code& ec) return statval.st_size; } #endif - return set_ec_from_system_error(ec); + set_ec_from_system_error(ec); + return 0; } S64 LLFile::tell(std::error_code& ec) @@ -1070,7 +1071,8 @@ S64 LLFile::size(const std::string& filename, int suppress_warning) std::intmax_t size = static_cast<std::intmax_t>(std::filesystem::file_size(file_path, ec)); if (ec) { - return warnif("size", filename, ec, suppress_warning); + warnif("size", filename, ec, suppress_warning); + return 0; } return size; } diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 0036e896c3..dcd561ce7f 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -203,7 +203,7 @@ public: /// Determine the size of the opened file S64 size(std::error_code& ec); - ///< @returns the number of bytes in the file or -1 on failure + ///< @returns the number of bytes in the file or 0 on failure /// Query the position of the current file pointer in the file S64 tell(std::error_code& ec); @@ -383,7 +383,7 @@ public: static S64 size(const std::string& filename, int suppress_warning = ENOENT); ///< we pass by default ENOENT in the optional 'suppress_warning' parameter to not spam /// the log with warnings when the file does not exist - /// @returns the file size on success or -1 on failure. + /// @returns the file size on success or 0 on failure. /// check if filename is an existing file or directory static bool exists(const std::string& filename); diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 5ac7d6b1fe..d93e900519 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -488,7 +488,7 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() } else if (size > INT_MAX) { - LL_ERRS() << "File is too big, size: " << size << LL_ENDL; + LL_ERRS() << "File " << getFileName() << " is too big, size: " << size << LL_ENDL; } U8* buffer = new(std::nothrow) U8[size]; if (!buffer) |
