Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions indra/llcommon/llbase64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size)
&& input_size > 0)
{
// Yes, it returns int.
int b64_buffer_length = apr_base64_encode_len(narrow(input_size));
int b64_buffer_length = apr_base64_encode_len(narrow<size_t>(input_size));
char* b64_buffer = new char[b64_buffer_length];

// This is faster than apr_base64_encode() if you know
Expand All @@ -52,7 +52,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size)
b64_buffer_length = apr_base64_encode_binary(
b64_buffer,
input,
narrow(input_size));
narrow<size_t>(input_size));
output.assign(b64_buffer);
delete[] b64_buffer;
}
Expand Down
2 changes: 1 addition & 1 deletion indra/llcommon/llrand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ inline F32 ll_internal_random<F32>()
// Per Monty, it's important to clamp using the correct fmodf() rather
// than expanding to F64 for fmod() and then truncating back to F32. Prior
// to this change, we were getting sporadic ll_frand() == 1.0 results.
F32 rv{ narrow(gRandomGenerator()) };
F32 rv{ narrow<F32>(gRandomGenerator()) };
if(!((rv >= 0.0f) && (rv < 1.0f))) return fmodf(rv, 1.0f);
return rv;
}
Expand Down
4 changes: 2 additions & 2 deletions indra/llcommon/llsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ class LL_COMMON_API LLSD
typename std::enable_if<std::is_integral<VALUE>::value &&
! std::is_same<VALUE, Boolean>::value,
bool>::type = true>
LLSD(VALUE v): LLSD(Integer(narrow(v))) {}
LLSD(VALUE v): LLSD(Integer(narrow<VALUE>(v))) {}
// support construction from F32 et al.
template <typename VALUE,
typename std::enable_if<std::is_floating_point<VALUE>::value,
bool>::type = true>
LLSD(VALUE v): LLSD(Real(narrow(v))) {}
LLSD(VALUE v): LLSD(Real(narrow<VALUE>(v))) {}
//@}

/** @name Scalar Assignment */
Expand Down
2 changes: 1 addition & 1 deletion indra/llcommon/llsdserialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2174,7 +2174,7 @@ std::string zip_llsd(LLSD& data)

U8 out[CHUNK];

strm.avail_in = narrow(source.size());
strm.avail_in = narrow<size_t>(source.size());
strm.next_in = (U8*) source.data();
U8* output = NULL;

Expand Down
4 changes: 2 additions & 2 deletions indra/llcommon/llsdserialize_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr,
// *FIX: memory inefficient.
// *TODO: convert to use LLBase64
ostr << pre << "<binary encoding=\"base64\">";
int b64_buffer_length = apr_base64_encode_len(narrow(buffer.size()));
int b64_buffer_length = apr_base64_encode_len(narrow<size_t>(buffer.size()));
char* b64_buffer = new char[b64_buffer_length];
b64_buffer_length = apr_base64_encode_binary(
b64_buffer,
&buffer[0],
narrow(buffer.size()));
narrow<size_t>(buffer.size()));
ostr.write(b64_buffer, b64_buffer_length - 1);
delete[] b64_buffer;
ostr << "</binary>" << post;
Expand Down
2 changes: 1 addition & 1 deletion indra/llcommon/llsys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ void LLMemoryInfo::stream(std::ostream& s) const
// Now stream stats
BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap))
{
s << pfx << std::setw(narrow(key_width+1)) << (pair.first + ':') << ' ';
s << pfx << std::setw(narrow<size_t>(key_width+1)) << (pair.first + ':') << ' ';
LLSD value(pair.second);
if (value.isInteger())
s << std::setw(12) << value.asInteger();
Expand Down
2 changes: 1 addition & 1 deletion indra/llcommon/lltrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void TimeBlockTreeNode::setParent( BlockTimerStatHandle* parent )
llassert_always(parent != mBlock);
llassert_always(parent != NULL);

TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(narrow(parent->getIndex()));
TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(narrow<size_t>(parent->getIndex()));
if (!parent_tree_node) return;

if (mParent)
Expand Down
2 changes: 1 addition & 1 deletion indra/llcommon/lltraceaccumulators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void AccumulatorBufferGroup::makeCurrent()
// update stacktimer parent pointers
for (size_t i = 0, end_i = mStackTimers.size(); i < end_i; i++)
{
TimeBlockTreeNode* tree_node = thread_recorder->getTimeBlockTreeNode(narrow(i));
TimeBlockTreeNode* tree_node = thread_recorder->getTimeBlockTreeNode(narrow<size_t>(i));
if (tree_node)
{
timer_accumulator_buffer[i].mParent = tree_node->mParent;
Expand Down
2 changes: 1 addition & 1 deletion indra/llcorehttp/bufferarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ int BufferArray::findBlock(size_t pos, size_t * ret_offset)
if (pos >= mLen)
return -1; // Doesn't exist

const int block_limit(narrow(mBlocks.size()));
const int block_limit(narrow<size_t>(mBlocks.size()));
for (int i(0); i < block_limit; ++i)
{
if (pos < mBlocks[i]->mUsed)
Expand Down
8 changes: 4 additions & 4 deletions indra/newview/llmaterialeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2228,15 +2228,15 @@ bool LLMaterialEditor::canModifyObjectsMaterial()
LLSelectedTEGetMatData func(true);
LLPermissions permissions;
LLViewerInventoryItem* item_out;
return can_use_objects_material(func, std::vector({PERM_MODIFY}), ItemSource::OBJECT, permissions, item_out);
return can_use_objects_material(func, std::vector<PermissionBit>({PERM_MODIFY}), ItemSource::OBJECT, permissions, item_out);
}

bool LLMaterialEditor::canSaveObjectsMaterial()
{
LLSelectedTEGetMatData func(true);
LLPermissions permissions;
LLViewerInventoryItem* item_out;
return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), ItemSource::AGENT, permissions, item_out);
return can_use_objects_material(func, std::vector<PermissionBit>({PERM_COPY, PERM_MODIFY}), ItemSource::AGENT, permissions, item_out);
}

bool LLMaterialEditor::canClipboardObjectsMaterial()
Expand All @@ -2262,15 +2262,15 @@ bool LLMaterialEditor::canClipboardObjectsMaterial()
LLSelectedTEGetMatData func(true);
LLPermissions permissions;
LLViewerInventoryItem* item_out;
return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY, PERM_TRANSFER}), ItemSource::OBJECT, permissions, item_out);
return can_use_objects_material(func, std::vector<PermissionBit>({PERM_COPY, PERM_MODIFY, PERM_TRANSFER}), ItemSource::OBJECT, permissions, item_out);
}

void LLMaterialEditor::saveObjectsMaterialAs()
{
LLSelectedTEGetMatData func(true);
LLPermissions permissions;
LLViewerInventoryItem* item = nullptr;
bool allowed = can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), ItemSource::AGENT, permissions, item);
bool allowed = can_use_objects_material(func, std::vector<PermissionBit>({PERM_COPY, PERM_MODIFY}), ItemSource::AGENT, permissions, item);
if (!allowed)
{
LL_WARNS("MaterialEditor") << "Failed to save GLTF material from object" << LL_ENDL;
Expand Down