summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenufile.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2011-05-13 13:28:51 -0400
committerOz Linden <oz@lindenlab.com>2011-05-13 13:28:51 -0400
commit66c078de5e5a6b685d435f7b1a462d64ca80f35e (patch)
treea1fe4ac67d499a565ea98b390dedbeef0a62acc2 /indra/newview/llviewermenufile.cpp
parent27fd0d1a93da8a2ad1aa445e8d8258f9e910ae8c (diff)
parente8ede07451c65aea898bc3f58a980b6b0d9af302 (diff)
merge up to latest viewer-development
Diffstat (limited to 'indra/newview/llviewermenufile.cpp')
-rw-r--r--indra/newview/llviewermenufile.cpp55
1 files changed, 5 insertions, 50 deletions
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index fda291f3c1..2cf8dbec89 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -493,6 +493,7 @@ void upload_new_resource(const std::string& src_filename, std::string name,
LLSD args;
std::string exten = gDirUtilp->getExtension(src_filename);
+ U32 codec = LLImageBase::getCodecFromExtension(exten);
LLAssetType::EType asset_type = LLAssetType::AT_NONE;
std::string error_message;
@@ -510,66 +511,20 @@ void upload_new_resource(const std::string& src_filename, std::string name,
upload_error(error_message, "NoFileExtension", filename, args);
return;
}
- else if( exten == "bmp")
+ else if (codec != IMG_CODEC_INVALID)
{
+ // It's an image file, the upload procedure is the same for all
asset_type = LLAssetType::AT_TEXTURE;
- if (!LLViewerTextureList::createUploadFile(src_filename,
- filename,
- IMG_CODEC_BMP ))
+ if (!LLViewerTextureList::createUploadFile(src_filename, filename, codec ))
{
error_message = llformat( "Problem with file %s:\n\n%s\n",
- src_filename.c_str(), LLImage::getLastError().c_str());
+ src_filename.c_str(), LLImage::getLastError().c_str());
args["FILE"] = src_filename;
args["ERROR"] = LLImage::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
return;
}
}
- else if( exten == "tga")
- {
- asset_type = LLAssetType::AT_TEXTURE;
- if (!LLViewerTextureList::createUploadFile(src_filename,
- filename,
- IMG_CODEC_TGA ))
- {
- error_message = llformat("Problem with file %s:\n\n%s\n",
- src_filename.c_str(), LLImage::getLastError().c_str());
- args["FILE"] = src_filename;
- args["ERROR"] = LLImage::getLastError();
- upload_error(error_message, "ProblemWithFile", filename, args);
- return;
- }
- }
- else if( exten == "jpg" || exten == "jpeg")
- {
- asset_type = LLAssetType::AT_TEXTURE;
- if (!LLViewerTextureList::createUploadFile(src_filename,
- filename,
- IMG_CODEC_JPEG ))
- {
- error_message = llformat("Problem with file %s:\n\n%s\n",
- src_filename.c_str(), LLImage::getLastError().c_str());
- args["FILE"] = src_filename;
- args["ERROR"] = LLImage::getLastError();
- upload_error(error_message, "ProblemWithFile", filename, args);
- return;
- }
- }
- else if( exten == "png")
- {
- asset_type = LLAssetType::AT_TEXTURE;
- if (!LLViewerTextureList::createUploadFile(src_filename,
- filename,
- IMG_CODEC_PNG ))
- {
- error_message = llformat("Problem with file %s:\n\n%s\n",
- src_filename.c_str(), LLImage::getLastError().c_str());
- args["FILE"] = src_filename;
- args["ERROR"] = LLImage::getLastError();
- upload_error(error_message, "ProblemWithFile", filename, args);
- return;
- }
- }
else if(exten == "wav")
{
asset_type = LLAssetType::AT_SOUND; // tag it as audio