diff options
author | Aaron Brashears <aaronb@lindenlab.com> | 2007-02-02 17:28:58 +0000 |
---|---|---|
committer | Aaron Brashears <aaronb@lindenlab.com> | 2007-02-02 17:28:58 +0000 |
commit | 305c74d5163c5e344a675d39ca2394a9e45bd2c2 (patch) | |
tree | 42836c4a6010b2b015156024d3cfb6bf64a48ad6 /indra/newview/llfloaterregioninfo.cpp | |
parent | 54d89549df38bb61881583a3eb8d3645c107d79f (diff) |
Result of svn merge -r57264:57370 svn+ssh://svn/svn/linden/branches/adroit.r40-68 into release.
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 123 |
1 files changed, 64 insertions, 59 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 297d5941f2..1ad724024b 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -202,7 +202,7 @@ void LLFloaterRegionInfo::show(LLViewerRegion* region) "EstateOwnerMessage", &processEstateOwnerRequest); } - sInstance->open(); + sInstance->open(); /* Flawfinder: ignore*/ sInstance->refreshFromRegion(region); // Must allow anyone to request the RegionInfo data @@ -272,7 +272,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) if(!tab) return; // extract message - char sim_name[MAX_STRING]; + char sim_name[MAX_STRING]; /* Flawfinder: ignore*/ U32 region_flags; U8 agent_limit; F32 object_bonus_factor; @@ -572,7 +572,7 @@ void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& name strings_t strings; // [0] = our agent id // [1] = target agent id - char buffer[MAX_STRING]; + char buffer[MAX_STRING]; /* Flawfinder: ignore*/ gAgent.getID().toString(buffer); strings.push_back(buffer); @@ -600,7 +600,7 @@ void LLPanelRegionGeneralInfo::onKickAllCommit(S32 option, void* userdata) if(!self) return; strings_t strings; // [0] = our agent id - char buffer[MAX_STRING]; + char buffer[MAX_STRING]; /* Flawfinder: ignore*/ gAgent.getID().toString(buffer); strings.push_back(buffer); @@ -635,7 +635,7 @@ void LLPanelRegionGeneralInfo::onMessageCommit(S32 option, const LLString& text, // [4] message strings.push_back("-1"); strings.push_back("-1"); - char buffer[MAX_STRING]; + char buffer[MAX_STRING]; /* Flawfinder: ignore*/ gAgent.getID().toString(buffer); strings.push_back(buffer); std::string name; @@ -669,35 +669,35 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() llinfos << "LLPanelRegionGeneralInfo::sendUpdate()" << llendl; strings_t strings; //integers_t integers; - char buffer[MAX_STRING]; - sprintf(buffer, "%s", (childGetValue("block_terraform_check").asBoolean() ? "Y" : "N")); + char buffer[MAX_STRING]; /* Flawfinder: ignore*/ + snprintf(buffer, MAX_STRING, "%s", (childGetValue("block_terraform_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ strings.push_back(strings_t::value_type(buffer)); - sprintf(buffer, "%s", (childGetValue("block_fly_check").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("block_fly_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ strings.push_back(strings_t::value_type(buffer)); - sprintf(buffer, "%s", (childGetValue("allow_damage_check").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_damage_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ strings.push_back(strings_t::value_type(buffer)); - sprintf(buffer, "%s", (childGetValue("allow_land_resell_check").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_land_resell_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ strings.push_back(strings_t::value_type(buffer)); F32 value = (F32)childGetValue("agent_limit_spin").asReal(); - sprintf(buffer, "%f", value); + snprintf(buffer, MAX_STRING, "%f", value); /* Flawfinder: ignore*/ strings.push_back(strings_t::value_type(buffer)); value = (F32)childGetValue("object_bonus_spin").asReal(); - sprintf(buffer, "%f", value); + snprintf(buffer, MAX_STRING, "%f", value); /* Flawfinder: ignore*/ strings.push_back(strings_t::value_type(buffer)); U8 access = LLViewerRegion::stringToAccess(childGetValue("access_combo").asString().c_str()); - sprintf(buffer, "%d", (S32)access); + snprintf(buffer, MAX_STRING, "%d", (S32)access); /* Flawfinder: ignore */ strings.push_back(strings_t::value_type(buffer)); - sprintf(buffer, "%s", (childGetValue("restrict_pushobject").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("restrict_pushobject").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ strings.push_back(strings_t::value_type(buffer)); - sprintf(buffer, "%s", (childGetValue("allow_parcel_changes_check").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("allow_parcel_changes_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ strings.push_back(strings_t::value_type(buffer)); LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); @@ -705,7 +705,7 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() LLViewerRegion* region = gAgent.getRegion(); if (region - && access != region->getSimAccess() ) + && access != region->getSimAccess() ) /* Flawfinder: ignore */ { gViewerWindow->alertXml("RegionMaturityChange"); } @@ -764,15 +764,15 @@ BOOL LLPanelRegionDebugInfo::sendUpdate() { llinfos << "LLPanelRegionDebugInfo::sendUpdate" << llendl; strings_t strings; - char buffer[MAX_STRING]; + char buffer[MAX_STRING]; /* Flawfinder: ignore */ - sprintf(buffer, "%s", (childGetValue("disable_scripts_check").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_scripts_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ strings.push_back(buffer); - sprintf(buffer, "%s", (childGetValue("disable_collisions_check").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_collisions_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ strings.push_back(buffer); - sprintf(buffer, "%s", (childGetValue("disable_physics_check").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("disable_physics_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore */ strings.push_back(buffer); LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); @@ -927,10 +927,10 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) LLVLComposition* compp = region->getComposition(); LLTextureCtrl* texture_ctrl; - char buffer[MAX_STRING]; + char buffer[MAX_STRING]; /* Flawfinder: ignore */ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { - sprintf(buffer, "texture_detail_%d", i); + snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer); if(texture_ctrl) { @@ -943,9 +943,9 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) for(S32 i = 0; i < CORNER_COUNT; ++i) { - sprintf(buffer, "height_start_spin_%d", i); + snprintf(buffer, MAX_STRING, "height_start_spin_%d", i); /* Flawfinder: ignore */ childSetValue(buffer, LLSD(compp->getStartHeight(i))); - sprintf(buffer, "height_range_spin_%d", i); + snprintf(buffer, MAX_STRING, "height_range_spin_%d", i); /* Flawfinder: ignore */ childSetValue(buffer, LLSD(compp->getHeightRange(i))); } @@ -957,18 +957,18 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) BOOL LLPanelRegionTextureInfo::postBuild() { LLPanelRegionInfo::postBuild(); - char buffer[MAX_STRING]; + char buffer[MAX_STRING]; /* Flawfinder: ignore */ for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { - sprintf(buffer, "texture_detail_%d", i); + snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ initCtrl(buffer); } for(S32 i = 0; i < CORNER_COUNT; ++i) { - sprintf(buffer, "height_start_spin_%d", i); + snprintf(buffer, MAX_STRING, "height_start_spin_%d", i); /* Flawfinder: ignore */ initCtrl(buffer); - sprintf(buffer, "height_range_spin_%d", i); + snprintf(buffer, MAX_STRING, "height_range_spin_%d", i); /* Flawfinder: ignore */ initCtrl(buffer); } @@ -998,9 +998,9 @@ BOOL LLPanelRegionTextureInfo::sendUpdate() } LLTextureCtrl* texture_ctrl; - char buffer[MAX_STRING]; - char buffer2[MAX_STRING]; - char id_str[UUID_STR_LENGTH]; + char buffer[MAX_STRING]; /* Flawfinder: ignore */ + char buffer2[MAX_STRING]; /* Flawfinder: ignore */ + char id_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ LLMessageSystem* msg = gMessageSystem; strings_t strings; @@ -1008,13 +1008,13 @@ BOOL LLPanelRegionTextureInfo::sendUpdate() for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { - sprintf(buffer, "texture_detail_%d", i); + snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer); if(texture_ctrl) { LLUUID tmp_id(texture_ctrl->getImageAssetID()); tmp_id.toString(id_str); - sprintf(buffer, "%d %s", i, id_str); + snprintf(buffer, MAX_STRING, "%d %s", i, id_str); /* Flawfinder: ignore */ strings.push_back(strings_t::value_type(buffer)); } } @@ -1022,9 +1022,9 @@ BOOL LLPanelRegionTextureInfo::sendUpdate() strings.clear(); for(S32 i = 0; i < CORNER_COUNT; ++i) { - sprintf(buffer, "height_start_spin_%d", i); - sprintf(buffer2, "height_range_spin_%d", i); - sprintf(buffer, "%d %f %f", i, (F32)childGetValue(buffer).asReal(), (F32)childGetValue(buffer2).asReal()); + snprintf(buffer, MAX_STRING, "height_start_spin_%d", i); /* Flawfinder: ignore */ + snprintf(buffer2, MAX_STRING, "height_range_spin_%d", i); /* Flawfinder: ignore */ + snprintf(buffer, MAX_STRING, "%d %f %f", i, (F32)childGetValue(buffer).asReal(), (F32)childGetValue(buffer2).asReal()); /* Flawfinder: ignore */ strings.push_back(strings_t::value_type(buffer)); } sendEstateOwnerMessage(msg, "textureheights", invoice, strings); @@ -1037,8 +1037,8 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes() { for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { - char buffer[MAX_STRING]; - sprintf(buffer, "texture_detail_%d", i); + char buffer[MAX_STRING]; /* Flawfinder: ignore */ + snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ LLTextureCtrl* texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer); if (!texture_ctrl) continue; @@ -1139,21 +1139,21 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) BOOL LLPanelRegionTerrainInfo::sendUpdate() { llinfos << "LLPanelRegionTerrainInfo::sendUpdate" << llendl; - char buffer[MAX_STRING]; + char buffer[MAX_STRING]; /* Flawfinder: ignore */ strings_t strings; LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); - sprintf(buffer, "%f", (F32)childGetValue("water_height_spin").asReal()); + snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("water_height_spin").asReal()); /* Flawfinder: ignore */ strings.push_back(buffer); - sprintf(buffer, "%f", (F32)childGetValue("terrain_raise_spin").asReal()); + snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("terrain_raise_spin").asReal()); /* Flawfinder: ignore */ strings.push_back(buffer); - sprintf(buffer, "%f", (F32)childGetValue("terrain_lower_spin").asReal()); + snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("terrain_lower_spin").asReal()); /* Flawfinder: ignore */ strings.push_back(buffer); - sprintf(buffer, "%s", (childGetValue("use_estate_sun_check").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("use_estate_sun_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore*/ strings.push_back(buffer); - sprintf(buffer, "%s", (childGetValue("fixed_sun_check").asBoolean() ? "Y" : "N")); + snprintf(buffer, MAX_STRING, "%s", (childGetValue("fixed_sun_check").asBoolean() ? "Y" : "N")); /* Flawfinder: ignore*/ strings.push_back(buffer); - sprintf(buffer, "%f", (F32)childGetValue("sun_hour_slider").asReal() ); + snprintf(buffer, MAX_STRING, "%f", (F32)childGetValue("sun_hour_slider").asReal() ); /* Flawfinder: ignore*/ strings.push_back(buffer); // Grab estate information in case the user decided to set the @@ -1179,11 +1179,11 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() estate_sun_hour = panel->getSunHour(); } - sprintf(buffer, "%s", (estate_global_time ? "Y" : "N") ); + snprintf(buffer, MAX_STRING, "%s", (estate_global_time ? "Y" : "N") ); /* Flawfinder: ignore*/ strings.push_back(buffer); - sprintf(buffer, "%s", (estate_fixed_sun ? "Y" : "N") ); + snprintf(buffer, MAX_STRING, "%s", (estate_fixed_sun ? "Y" : "N") ); /* Flawfinder: ignore*/ strings.push_back(buffer); - sprintf(buffer, "%f", estate_sun_hour); + snprintf(buffer, MAX_STRING, "%f", estate_sun_hour); /* Flawfinder: ignore*/ strings.push_back(buffer); sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); @@ -1512,7 +1512,7 @@ void LLPanelEstateInfo::kickUserConfirm(S32 option, void* userdata) LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); strings_t strings; - char buffer[MAX_STRING]; + char buffer[MAX_STRING]; /* Flawfinder: ignore*/ switch(option) { @@ -1795,12 +1795,12 @@ void LLPanelEstateInfo::sendEstateAccessDelta(U32 flags, const LLUUID& agent_or_ msg->addString("Method", "estateaccessdelta"); msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); - char buf[MAX_STRING]; + char buf[MAX_STRING]; /* Flawfinder: ignore*/ gAgent.getID().toString(buf); msg->nextBlock("ParamList"); msg->addString("Parameter", buf); - sprintf(buf, "%u", flags); + snprintf(buf, MAX_STRING, "%u", flags); /* Flawfinder: ignore*/ msg->nextBlock("ParamList"); msg->addString("Parameter", buf); @@ -2056,8 +2056,8 @@ void LLPanelEstateInfo::commitEstateInfo() msg->nextBlock("ParamList"); msg->addString("Parameter", getEstateName()); - char buf[MAX_STRING]; - sprintf(buf, "%u", computeEstateFlags()); + char buf[MAX_STRING]; /* Flawfinder: ignore*/ + snprintf(buf, MAX_STRING, "%u", computeEstateFlags()); /* Flawfinder: ignore*/ msg->nextBlock("ParamList"); msg->addString("Parameter", buf); @@ -2067,7 +2067,7 @@ void LLPanelEstateInfo::commitEstateInfo() sun_hour = 0.f; // 0 = global time } - sprintf(buf, "%d", (S32)(sun_hour*1024.0f)); + snprintf(buf, MAX_STRING, "%d", (S32)(sun_hour*1024.0f)); /* Flawfinder: ignore*/ msg->nextBlock("ParamList"); msg->addString("Parameter", buf); @@ -2541,8 +2541,13 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, S32 file_length = file.getSize(); char* buffer = new char[file_length+1]; - file.read((U8*)buffer, file_length); + if (buffer == NULL) + { + llerrs << "Memory Allocation Failed" << llendl; + return; + } + file.read((U8*)buffer, file_length); /* Flawfinder: ignore */ // put a EOS at the end buffer[file_length] = 0; @@ -2860,7 +2865,7 @@ bool LLDispatchSetEstateAccess::operator()( for (S32 i = 0; i < num_allowed_agents && i < ESTATE_MAX_ACCESS_IDS; i++) { LLUUID id; - memcpy(id.mData, strings[index++].data(), UUID_BYTES); + memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ allowed_agent_name_list->addNameItem(id); } panel->childSetEnabled("remove_allowed_avatar_btn", allowed_agent_name_list->getFirstSelected() ? TRUE : FALSE); @@ -2884,7 +2889,7 @@ bool LLDispatchSetEstateAccess::operator()( for (S32 i = 0; i < num_allowed_groups && i < ESTATE_MAX_GROUP_IDS; i++) { LLUUID id; - memcpy(id.mData, strings[index++].data(), UUID_BYTES); + memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ allowed_group_name_list->addGroupNameItem(id); } panel->childSetEnabled("remove_allowed_group_btn", allowed_group_name_list->getFirstSelected() ? TRUE : FALSE); @@ -2916,7 +2921,7 @@ bool LLDispatchSetEstateAccess::operator()( for (S32 i = 0; i < num_banned_agents && i < ESTATE_MAX_ACCESS_IDS; i++) { LLUUID id; - memcpy(id.mData, strings[index++].data(), UUID_BYTES); + memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ banned_agent_name_list->addNameItem(id); } panel->childSetEnabled("remove_banned_avatar_btn", banned_agent_name_list->getFirstSelected() ? TRUE : FALSE); @@ -2939,7 +2944,7 @@ bool LLDispatchSetEstateAccess::operator()( for (S32 i = 0; i < num_estate_managers && i < ESTATE_MAX_MANAGERS; i++) { LLUUID id; - memcpy(id.mData, strings[index++].data(), UUID_BYTES); + memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ estate_manager_name_list->addNameItem(id); } panel->childSetEnabled("remove_estate_manager_btn", estate_manager_name_list->getFirstSelected() ? TRUE : FALSE); |