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.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index 337c18f218..7ef2c8d697 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -226,7 +226,7 @@ LLUUID LLResourceUploadInfo::finishUpload(LLSD &result)
LL_INFOS() << "inventory_item_flags " << flagsInventoryItem << LL_ENDL;
}
}
- S32 creationDate = time_corrected();
+ S32 creationDate = (S32)time_corrected();
LLUUID serverInventoryItem = result["new_inventory_item"].asUUID();
LLUUID serverAssetId = result["new_asset"].asUUID();
@@ -370,7 +370,8 @@ LLNewFileResourceUploadInfo::LLNewFileResourceUploadInfo(
LLResourceUploadInfo(name, description, compressionInfo,
destinationType, inventoryType,
nextOWnerPerms, groupPerms, everyonePerms, expectedCost, show_inventory),
- mFileName(fileName)
+ mFileName(fileName),
+ mMaxImageSize(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT)
{
}
@@ -422,7 +423,7 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
else if (assetType == LLAssetType::AT_TEXTURE)
{
// It's an image file, the upload procedure is the same for all
- if (!LLViewerTextureList::createUploadFile(getFileName(), filename, codec))
+ if (!LLViewerTextureList::createUploadFile(getFileName(), filename, codec, mMaxImageSize))
{
errorMessage = llformat("Problem with file %s:\n\n%s\n",
getFileName().c_str(), LLImage::getLastThreadError().c_str());
@@ -478,7 +479,12 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
else
{
S32 size = LLAPRFile::size(getFileName());
- U8* buffer = new U8[size];
+ U8* buffer = new(std::nothrow) U8[size];
+ if (!buffer)
+ {
+ LLError::LLUserWarningMsg::showOutOfMemory();
+ LL_ERRS() << "Bad memory allocation for buffer, size: " << size << LL_ENDL;
+ }
S32 size_read = infile.read(buffer,size);
if (size_read != size)
{
@@ -978,6 +984,7 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res
label = result["label"].asString();
}
+ LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
if (result.has("message"))
{
reason = result["message"].asString();
@@ -988,6 +995,12 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res
{
case 404:
reason = LLTrans::getString("AssetUploadServerUnreacheble");
+ if (floater_snapshot
+ && floater_snapshot->isWaitingState()
+ && uploadInfo->getAssetType() == LLAssetType::AT_IMAGE_JPEG)
+ {
+ label = "CannotUploadSnapshotEmailTooBig";
+ }
break;
case 499:
reason = LLTrans::getString("AssetUploadServerDifficulties");
@@ -1024,7 +1037,6 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res
// Todo: move these floater specific actions into proper callbacks
// Let the Snapshot floater know we have failed uploading.
- LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
if (floater_snapshot && floater_snapshot->isWaitingState())
{
if (uploadInfo->getAssetType() == LLAssetType::AT_IMAGE_JPEG)