diff --git a/indra/llimagej2coj/llimagej2coj2.cpp b/indra/llimagej2coj/llimagej2coj2.cpp index 437ea88c94..c3f7f3d9bc 100644 --- a/indra/llimagej2coj/llimagej2coj2.cpp +++ b/indra/llimagej2coj/llimagej2coj2.cpp @@ -33,6 +33,7 @@ #include "lltimer.h" //#include "llmemory.h" +#define OPENJPEG_VERSION "2.1" // This actually needs to be in openjpeg.h struct ndUserdata { @@ -126,23 +127,16 @@ OPJ_BOOL nd_opj_stream_seek_fn(OPJ_OFF_T p_nb_bytes, void * p_user_data) return OPJ_TRUE; } -const char* fallbackEngineInfoLLImageJ2CImpl() -{ - static std::string version_string = - std::string("OpenJPEG: 2.1, Runtime: ") - + opj_version(); - return version_string.c_str(); -} - +// Factory function: see declaration in llimagej2c.cpp LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl() { return new LLImageJ2COJ(); } -void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl) +std::string LLImageJ2COJ::getEngineInfo() const { - delete impl; - impl = NULL; + return std::string("OpenJPEG: " OPENJPEG_VERSION ", Runtime: ") + + opj_version(); } // Return string from message, eliminating final \n if present @@ -200,19 +194,19 @@ LLImageJ2COJ::~LLImageJ2COJ() { } -BOOL LLImageJ2COJ::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) +bool LLImageJ2COJ::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) { // No specific implementation for this method in the OpenJpeg case - return FALSE; + return false; } -BOOL LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) +bool LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) { // No specific implementation for this method in the OpenJpeg case - return FALSE; + return false; } -BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) +bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { // texture comment metadata reader U8* c_data = base.getData(); @@ -304,7 +298,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod opj_image_destroy(image); } - return TRUE; // done + return true; // done } // sometimes we get bad data out of the cache - check to see if the decode succeeded @@ -314,8 +308,8 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod { // if we didn't get the discard level we're expecting, fail opj_image_destroy(image); - base.mDecoding = FALSE; - return TRUE; + base.mDecoding = false; + return true; } } @@ -327,7 +321,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod opj_image_destroy(image); } - return TRUE; + return true; } // Copy image data into our raw image format (instead of the separate channel format @@ -351,6 +345,16 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod raw_image.resize(width, height, channels); U8 *rawp = raw_image.getData(); + // Port fix for MAINT-4327/MAINT-6584 to OpenJPEG decoder + if (!rawp) + { + base.setLastError("Memory error"); + base.decodeFailed(); + opj_image_destroy(image); + return true; // done + } + // + // first_channel is what channel to start copying from // dest is what channel to copy to. first_channel comes from the // argument, dest always starts writing at channel zero. @@ -374,18 +378,18 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)" << LL_ENDL; opj_image_destroy(image); - return TRUE; // done + return true; // done } } /* free image data structure */ opj_image_destroy(image); - return TRUE; // done + return true; // done } -BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, BOOL reversible) +bool LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, bool reversible) { const S32 MAX_COMPS = 5; opj_cparameters_t parameters; /* compression parameters */ @@ -495,7 +499,7 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con if (!bSuccess) { LL_DEBUGS("Texture") << "Failed to encode image." << LL_ENDL; - return FALSE; + return false; } codestream_length = pStreamdata->mOutput.size(); @@ -513,7 +517,7 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con /* free image data */ opj_image_destroy(image); - return TRUE; + return true; } inline S32 extractLong4( U8 const *aBuffer, int nOffset ) @@ -573,7 +577,7 @@ bool getMetadataFast( LLImageJ2C &aImage, S32 &aW, S32 &aH, S32 &aComps ) return true; } -BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) +bool LLImageJ2COJ::getMetadata(LLImageJ2C &base) { // // FIXME: We get metadata by decoding the ENTIRE image. @@ -589,7 +593,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) if ( getMetadataFast( base, width, height, img_components ) ) { base.setSize(width, height, img_components); - return TRUE; + return true; } // Do it the old and slow way, decode the image with openjpeg @@ -634,7 +638,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) if(!image) { LL_WARNS() << "ERROR -> getMetadata: failed to decode image!" << LL_ENDL; - return FALSE; + return false; } // Copy image data into our raw image format (instead of the separate channel format @@ -647,5 +651,5 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) /* free image data structure */ opj_image_destroy(image); - return TRUE; + return true; } diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 60b0d019a5..f4a5bb5d5d 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -59,6 +59,7 @@ #include "llwindow.h" #include "llnotificationsutil.h" // Add float LSL color entry widgets +#include // System includes #include @@ -744,7 +745,7 @@ void LLFloaterColorPicker::updateTextEntry () getChild("gspin_lsl")->setValue(( getCurG () ) ); getChild("bspin_lsl")->setValue(( getCurB () ) ); - getChild("hex_value")->setValue(llformat("%02x%02x%02x",(S32) (getCurR()*255.0),(S32) (getCurG()*255.0),(S32) (getCurB()*255.0))); + getChild("hex_value")->setValue(llformat("%02x%02x%02x", (S32)(getCurR() * 255.f), (S32)(getCurG() * 255.f), (S32)(getCurB() * 255.f))); // } @@ -805,7 +806,7 @@ void LLFloaterColorPicker::onTextEntryChanged ( LLUICtrl* ctrl ) } // update current RGB (and implicitly HSL) - setCurRgb ( rVal, gVal, bVal ); + selectCurRgb ( rVal, gVal, bVal ); updateTextEntry (); } @@ -816,24 +817,23 @@ void LLFloaterColorPicker::onTextEntryChanged ( LLUICtrl* ctrl ) F32 rVal, gVal, bVal; getCurRgb ( rVal, gVal, bVal ); - std::string hex_string=ctrl->getValue().asString(); + std::string hex_string = ctrl->getValue().asString(); - if(hex_string.length()!=6) + std::string reg_ex("[[:xdigit:]]{6}"); + boost::regex pattern(reg_ex.c_str()); + if (!boost::regex_match(hex_string, pattern)) + { return; + } - LLStringUtil::toLower(hex_string); + sscanf(hex_string.c_str(), "%02x%02x%02x", &r, &g, &b); - if(hex_string.find_first_not_of("0123456789abcdef")!=std::string::npos) - return; - - sscanf(hex_string.c_str(),"%02x%02x%02x", &r,&g,&b); - - rVal=(F32) r/255.0; - gVal=(F32) g/255.0; - bVal=(F32) b/255.0; + rVal = F32(r) / 255.f; + gVal = F32(g) / 255.f; + bVal = F32(b) / 255.f; // update current RGB (and implicitly HSL) - setCurRgb ( rVal, gVal, bVal ); + selectCurRgb ( rVal, gVal, bVal ); updateTextEntry (); } @@ -1217,11 +1217,11 @@ void LLFloaterColorPicker::onClickCopyLSL ( void* data ) { if (data) { - LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data; + LLFloaterColorPicker* self = (LLFloaterColorPicker*)data; - if ( self ) + if (self) { - getWindow()->copyTextToClipboard(utf8str_to_wstring(llformat("<%.3f, %.3f, %.3f>",self->getCurR(),self->getCurG(),self->getCurB()))); + getWindow()->copyTextToClipboard(utf8str_to_wstring(llformat("<%.3f, %.3f, %.3f>", self->getCurR(), self->getCurG(), self->getCurB()))); LLNotificationsUtil::add("LSLColorCopiedToClipboard"); } } diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp index 7e8be71f98..2c99d97019 100644 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -58,7 +58,6 @@ public: /*virtual*/ ~LLPanelSnapshotPostcard(); // Store settings at logout /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ S32 notify(const LLSD& info); private: /*virtual*/ std::string getWidthSpinnerName() const { return "postcard_snapshot_width"; } @@ -80,7 +79,6 @@ private: void onSend(); bool mHasFirstMsgFocus; - std::string mAgentEmail; }; static LLPanelInjector panel_class("llpanelsnapshotpostcard"); @@ -115,36 +113,19 @@ BOOL LLPanelSnapshotPostcard::postBuild() // virtual void LLPanelSnapshotPostcard::onOpen(const LLSD& key) { - // pick up the user's up-to-date email address - if (mAgentEmail.empty()) + // Fill "From" field + LLLineEditor* from = getChild("name_form"); + if (from->getText().empty()) { - gAgent.sendAgentUserInfoRequest(); - std::string name_string; LLAgentUI::buildFullname(name_string); - getChild("name_form")->setValue(LLSD(name_string)); + from->setText(name_string); } + // LLPanelSnapshot::onOpen(key); } -// virtual -S32 LLPanelSnapshotPostcard::notify(const LLSD& info) -{ - if (!info.has("agent-email")) - { - llassert(info.has("agent-email")); - return 0; - } - - if (mAgentEmail.empty()) - { - mAgentEmail = info["agent-email"].asString(); - } - - return 1; -} - // virtual void LLPanelSnapshotPostcard::updateControls(const LLSD& info) { @@ -197,7 +178,6 @@ void LLPanelSnapshotPostcard::sendPostcard() if (!url.empty()) { LLResourceUploadInfo::ptr_t uploadInfo(new LLPostcardUploadInfo( - mAgentEmail, getChild("name_form")->getValue().asString(), getChild("to_form")->getValue().asString(), getChild("subject_form")->getValue().asString(), @@ -260,12 +240,6 @@ void LLPanelSnapshotPostcard::onSend() return; } - if (mAgentEmail.empty() || !boost::regex_match(mAgentEmail, email_format)) - { - LLNotificationsUtil::add("PromptSelfEmail"); - return; - } - std::string subject(getChild("subject_form")->getValue().asString()); if(subject.empty() || !mHasFirstMsgFocus) { diff --git a/indra/newview/llpostcard.cpp b/indra/newview/llpostcard.cpp index 2e639b56eb..d5775042c1 100644 --- a/indra/newview/llpostcard.cpp +++ b/indra/newview/llpostcard.cpp @@ -40,11 +40,10 @@ /////////////////////////////////////////////////////////////////////////////// -LLPostcardUploadInfo::LLPostcardUploadInfo(std::string emailFrom, std::string nameFrom, std::string emailTo, +LLPostcardUploadInfo::LLPostcardUploadInfo(std::string nameFrom, std::string emailTo, std::string subject, std::string message, LLVector3d globalPosition, LLPointer image, invnUploadFinish_f finish) : LLBufferedAssetUploadInfo(LLUUID::null, image, finish), - mEmailFrom(emailFrom), mNameFrom(nameFrom), mEmailTo(emailTo), mSubject(subject), @@ -58,7 +57,6 @@ LLSD LLPostcardUploadInfo::generatePostBody() LLSD postcard = LLSD::emptyMap(); postcard["pos-global"] = mGlobalPosition.getValue(); postcard["to"] = mEmailTo; - postcard["from"] = mEmailFrom; postcard["name"] = mNameFrom; postcard["subject"] = mSubject; postcard["msg"] = mMessage; diff --git a/indra/newview/llpostcard.h b/indra/newview/llpostcard.h index 24157be636..1e932ae03f 100644 --- a/indra/newview/llpostcard.h +++ b/indra/newview/llpostcard.h @@ -53,13 +53,12 @@ private: class LLPostcardUploadInfo : public LLBufferedAssetUploadInfo { public: - LLPostcardUploadInfo(std::string emailFrom, std::string nameFrom, std::string emailTo, + LLPostcardUploadInfo(std::string nameFrom, std::string emailTo, std::string subject, std::string message, LLVector3d globalPosition, LLPointer image, invnUploadFinish_f finish); virtual LLSD generatePostBody(); private: - std::string mEmailFrom; std::string mNameFrom; std::string mEmailTo; std::string mSubject; diff --git a/indra/newview/skins/default/xui/ja/floater_fs_teleporthistory.xml b/indra/newview/skins/default/xui/ja/floater_fs_teleporthistory.xml index 39a35c5f68..ba83946f46 100644 --- a/indra/newview/skins/default/xui/ja/floater_fs_teleporthistory.xml +++ b/indra/newview/skins/default/xui/ja/floater_fs_teleporthistory.xml @@ -1,17 +1,23 @@ - + + + + +