Skip to content

Commit

Permalink
Fix formatting and add some more constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansariel committed Aug 21, 2024
1 parent a0da63d commit b1fb522
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 43 deletions.
34 changes: 17 additions & 17 deletions indra/llinventory/llpermissionsflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,48 +37,48 @@ typedef U32 PermissionBit;
// Do you have permission to transfer ownership of the object or
// item. Fair use rules dictate that if you cannot copy, you can
// always transfer.
const PermissionBit PERM_TRANSFER = (1 << 13); // 0x00002000
constexpr PermissionBit PERM_TRANSFER = (1 << 13); // 0x00002000

// objects, scale or change textures
// parcels, allow building on it
const PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000
constexpr PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000

// objects, allow copy
const PermissionBit PERM_COPY = (1 << 15); // 0x00008000
constexpr PermissionBit PERM_COPY = (1 << 15); // 0x00008000

// parcels, allow entry, deprecated
//const PermissionBit PERM_ENTER = (1 << 16); // 0x00010000
//constexpr PermissionBit PERM_ENTER = (1 << 16); // 0x00010000

// parcels, allow terraform, deprecated
//const PermissionBit PERM_TERRAFORM = (1 << 17); // 0x00020000
//constexpr PermissionBit PERM_TERRAFORM = (1 << 17); // 0x00020000

// NOTA BENE: This flag is NO LONGER USED!!! However, it is possible that some
// objects in the universe have it set so DON"T USE IT going forward.
//const PermissionBit PERM_OWNER_DEBIT = (1 << 18); // 0x00040000
//constexpr PermissionBit PERM_OWNER_DEBIT = (1 << 18); // 0x00040000

// objects, can grab/translate/rotate
const PermissionBit PERM_MOVE = (1 << 19); // 0x00080000
constexpr PermissionBit PERM_MOVE = (1 << 19); // 0x00080000

// parcels, avatars take damage, deprecated
//const PermissionBit PERM_DAMAGE = (1 << 20); // 0x00100000

// don't use bit 31 -- printf/scanf with "%x" assume signed numbers
const PermissionBit PERM_RESERVED = ((U32)1) << 31;
constexpr PermissionBit PERM_RESERVED = ((U32)1) << 31;

const PermissionMask PERM_NONE = 0x00000000;
const PermissionMask PERM_ALL = 0x7FFFFFFF;
//const PermissionMask PERM_ALL_PARCEL = PERM_MODIFY | PERM_ENTER | PERM_TERRAFORM | PERM_DAMAGE;
const PermissionMask PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
constexpr PermissionMask PERM_NONE = 0x00000000;
constexpr PermissionMask PERM_ALL = 0x7FFFFFFF;
//constexpr PermissionMask PERM_ALL_PARCEL = PERM_MODIFY | PERM_ENTER | PERM_TERRAFORM | PERM_DAMAGE;
constexpr PermissionMask PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;


// Useful stuff for transmission.
// Which permissions field are we trying to change?
const U8 PERM_BASE = 0x01;
constexpr U8 PERM_BASE = 0x01;
// TODO: Add another PERM_OWNER operation type for allowOperationBy DK 04/03/06
const U8 PERM_OWNER = 0x02;
const U8 PERM_GROUP = 0x04;
const U8 PERM_EVERYONE = 0x08;
const U8 PERM_NEXT_OWNER = 0x10;
constexpr U8 PERM_OWNER = 0x02;
constexpr U8 PERM_GROUP = 0x04;
constexpr U8 PERM_EVERYONE = 0x08;
constexpr U8 PERM_NEXT_OWNER = 0x10;

// This is just a quickie debugging key
// no modify: PERM_ALL & ~PERM_MODIFY = 0x7fffbfff
Expand Down
56 changes: 30 additions & 26 deletions indra/newview/llpanelprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data)

setDescriptionText(avatar_data->about_text);

mSecondLifePic->setValue(avatar_data->image_id);
mSecondLifePic->setValue(avatar_data->image_id);

if (getSelfProfile())
{
Expand Down Expand Up @@ -1052,7 +1052,7 @@ void LLPanelProfileSecondLife::fillAccountStatus(const LLAvatarData* avatar_data
std::string caption_text = getString("CaptionTextAcctInfo", args);
getChild<LLUICtrl>("account_info")->setValue(caption_text);

const S32 LINDEN_EMPLOYEE_INDEX = 3;
constexpr S32 LINDEN_EMPLOYEE_INDEX = 3;
LLDate sl_release;
sl_release.fromYMDHMS(2003, 6, 23, 0, 0, 0);
std::string customer_lower = avatar_data->customer_type;
Expand Down Expand Up @@ -1117,7 +1117,7 @@ void LLPanelProfileSecondLife::fillRightsData()
// If true - we are viewing friend's profile, enable check boxes and set values.
if (relation)
{
S32 rights = relation->getRightsGrantedTo();
const S32 rights = relation->getRightsGrantedTo();
bool can_see_online = LLRelationship::GRANT_ONLINE_STATUS & rights;
bool can_see_on_map = LLRelationship::GRANT_MAP_LOCATION & rights;
bool can_edit_objects = LLRelationship::GRANT_MODIFY_OBJECTS & rights;
Expand Down Expand Up @@ -1165,10 +1165,10 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data)
}
else
{
std::string register_date = getString("age_format");
LLSD args_age;
std::string register_date = getString("age_format");
LLSD args_age;
args_age["[AGE]"] = LLDateUtil::ageFromDate(avatar_data->born_on, LLDate::now());
LLStringUtil::format(register_date, args_age);
LLStringUtil::format(register_date, args_age);
userAgeCtrl->setValue(register_date);
}

Expand Down Expand Up @@ -1247,7 +1247,7 @@ void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id)
void LLPanelProfileSecondLife::updateOnlineStatus()
{
const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
if (relationship != NULL)
if (relationship)
{
// For friend let check if he allowed me to see his status
bool online = relationship->isOnline();
Expand Down Expand Up @@ -1328,7 +1328,7 @@ void LLProfileImagePicker::notify(const std::vector<std::string>& filenames)
// generate a temp texture file for coroutine
std::string temp_file = gDirUtilp->getTempFilename();
U32 codec = LLImageBase::getCodecFromExtension(gDirUtilp->getExtension(file_path));
const S32 MAX_DIM = 256;
constexpr S32 MAX_DIM = 256;
if (!LLViewerTextureList::createUploadFile(file_path, temp_file, codec, MAX_DIM))
{
LLSD notif_args;
Expand Down Expand Up @@ -1611,12 +1611,12 @@ void LLPanelProfileSecondLife::onShowInSearchCallback()
if (value == mAllowPublish)
return;

mAllowPublish = value;
mAllowPublish = value;
saveAgentUserInfoCoro("allow_publish", value);
}
}

void LLPanelProfileSecondLife::onHideAgeCallback()
{
{
bool value = mHideAgeCombo->getValue().asInteger();
if (value == mHideAge)
return;
Expand All @@ -1642,7 +1642,7 @@ void LLPanelProfileSecondLife::onDiscardDescriptionChanges()

void LLPanelProfileSecondLife::onShowAgentPermissionsDialog()
{
LLFloater *floater = mFloaterPermissionsHandle.get();
LLFloater* floater = mFloaterPermissionsHandle.get();
if (!floater)
{
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
Expand Down Expand Up @@ -1670,7 +1670,7 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture()
return;
}

LLFloater *floater = mFloaterProfileTextureHandle.get();
LLFloater* floater = mFloaterProfileTextureHandle.get();
if (!floater)
{
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
Expand Down Expand Up @@ -1765,43 +1765,47 @@ void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id)
if (mSecondLifePic->getImageAssetId() == id)
return;

std::function<void(bool)> callback = [id](bool result)
std::function<void(bool)> callback = [id](bool result)
{
if (result)
{
if (result)
{
LLAvatarIconIDCache::getInstance()->add(gAgentID, id);
LLAvatarIconIDCache::getInstance()->add(gAgentID, id);
// Should trigger callbacks in icon controls (or request Legacy)
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID);
}
};
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgentID);
}
};

if (!saveAgentUserInfoCoro("sl_image_id", id, callback))
return;

mSecondLifePic->setValue(id);

LLFloater *floater = mFloaterProfileTextureHandle.get();
if (floater)
LLFloater* floater = mFloaterProfileTextureHandle.get();
if (floater)
{
LLFloaterProfileTexture* texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater);
if (texture_view)
{
LLFloaterProfileTexture * texture_view = dynamic_cast<LLFloaterProfileTexture*>(floater);
if (id == LLUUID::null)
if (id.isNull())
{
texture_view->resetAsset();
}
else
{
texture_view->loadAsset(id);
texture_view->loadAsset(id);
}
}
}
}

//////////////////////////////////////////////////////////////////////////
// LLPanelProfileWeb

LLPanelProfileWeb::LLPanelProfileWeb()
: LLPanelProfileTab()
, mWebBrowser(NULL)
, mWebBrowser(nullptr)
, mAvatarNameCacheConnection()
, mFirstNavigate(false)
{
}

Expand Down

0 comments on commit b1fb522

Please sign in to comment.