summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerassetupload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerassetupload.cpp')
-rw-r--r--indra/newview/llviewerassetupload.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index 5ac7d6b1fe..65a69acc88 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -45,7 +45,11 @@
#include "llappviewer.h"
#include "llviewerstats.h"
#include "llfilesystem.h"
+#include "llgesturemgr.h"
+#include "llpreviewnotecard.h"
+#include "llpreviewgesture.h"
#include "llcoproceduremanager.h"
+#include "llthread.h"
#include "llkeyframemotion.h"
#include "lldatapacker.h"
#include "llvoavatarself.h"
@@ -401,7 +405,6 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
std::string errorMessage;
std::string errorLabel;
- std::error_code ec;
bool error = false;
@@ -472,38 +475,30 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
error = true;
// read from getFileName()
- LLFile infile(getFileName(), LLFile::in | LLFile::binary, ec);
- if (ec || !infile)
+ LLAPRFile infile;
+ infile.open(getFileName(),LL_APR_RB);
+ if (!infile.getFileHandle())
{
LL_WARNS() << "Couldn't open file for reading: " << getFileName() << LL_ENDL;
errorMessage = llformat("Failed to open animation file %s\n", getFileName().c_str());
}
else
{
- S64 size = infile.size(ec);
- if (ec || size <= 0)
- {
- LLError::LLUserWarningMsg::showMissingFiles();
- LL_ERRS() << "Invalid file" << LL_ENDL;
- }
- else if (size > INT_MAX)
- {
- LL_ERRS() << "File is too big, size: " << size << LL_ENDL;
- }
+ S32 size = LLAPRFile::size(getFileName());
U8* buffer = new(std::nothrow) U8[size];
if (!buffer)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Bad memory allocation for buffer, size: " << size << LL_ENDL;
}
- S64 size_read = infile.read(buffer, size, ec);
- if (ec || size_read != size)
+ S32 size_read = infile.read(buffer,size);
+ if (size_read != size)
{
errorMessage = llformat("Failed to read animation file %s: wanted %d bytes, got %d\n", getFileName().c_str(), size, size_read);
}
else
{
- LLDataPackerBinaryBuffer dp(buffer, (S32)size);
+ LLDataPackerBinaryBuffer dp(buffer, size);
LLKeyframeMotion *motionp = new LLKeyframeMotion(getAssetId());
motionp->setCharacter(gAgentAvatarp);
if (motionp->deserialize(dp, getAssetId(), false))
@@ -549,17 +544,18 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
setAssetType(assetType);
// copy this file into the cache for upload
- LLFile infile(filename, LLFile::in | LLFile::binary, ec);
- if (!ec && infile.size(ec) > 0)
+ S32 file_size;
+ LLAPRFile infile;
+ infile.open(filename, LL_APR_RB, NULL, &file_size);
+ if (infile.getFileHandle())
{
LLFileSystem file(getAssetId(), assetType, LLFileSystem::APPEND);
- S64 read_bytes;
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
- while (((read_bytes = infile.read(copy_buf, buf_size, ec))) > 0)
+ while ((file_size = infile.read(copy_buf, buf_size)))
{
- file.write(copy_buf, (S32)read_bytes);
+ file.write(copy_buf, file_size);
}
}
else
@@ -573,6 +569,7 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
}
return LLSD();
+
}
//=========================================================================