SL-19299 Code formatting in modified files

master
Alexander Gavriliuk 2023-08-23 07:13:43 +02:00 committed by Guru
parent 85efb85acf
commit beb6181863
4 changed files with 84 additions and 83 deletions

View File

@ -46,33 +46,32 @@
template <class Type> class LLPointer
{
public:
LLPointer() :
LLPointer() :
mPointer(NULL)
{
}
LLPointer(Type* ptr) :
LLPointer(Type* ptr) :
mPointer(ptr)
{
ref();
}
LLPointer(const LLPointer<Type>& ptr) :
LLPointer(const LLPointer<Type>& ptr) :
mPointer(ptr.mPointer)
{
ref();
}
// support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
// Support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass>
LLPointer(const LLPointer<Subclass>& ptr) :
LLPointer(const LLPointer<Subclass>& ptr) :
mPointer(ptr.get())
{
ref();
}
~LLPointer()
~LLPointer()
{
unref();
}
@ -83,39 +82,39 @@ public:
const Type& operator*() const { return *mPointer; }
Type& operator*() { return *mPointer; }
operator BOOL() const { return (mPointer != NULL); }
operator bool() const { return (mPointer != NULL); }
operator BOOL() const { return (mPointer != NULL); }
operator bool() const { return (mPointer != NULL); }
bool operator!() const { return (mPointer == NULL); }
bool isNull() const { return (mPointer == NULL); }
bool notNull() const { return (mPointer != NULL); }
operator Type*() const { return mPointer; }
bool operator !=(Type* ptr) const { return (mPointer != ptr); }
bool operator ==(Type* ptr) const { return (mPointer == ptr); }
bool operator ==(const LLPointer<Type>& ptr) const { return (mPointer == ptr.mPointer); }
bool operator < (const LLPointer<Type>& ptr) const { return (mPointer < ptr.mPointer); }
bool operator > (const LLPointer<Type>& ptr) const { return (mPointer > ptr.mPointer); }
operator Type*() const { return mPointer; }
bool operator !=(Type* ptr) const { return (mPointer != ptr); }
bool operator ==(Type* ptr) const { return (mPointer == ptr); }
bool operator ==(const LLPointer<Type>& ptr) const { return (mPointer == ptr.mPointer); }
bool operator < (const LLPointer<Type>& ptr) const { return (mPointer < ptr.mPointer); }
bool operator > (const LLPointer<Type>& ptr) const { return (mPointer > ptr.mPointer); }
LLPointer<Type>& operator =(Type* ptr)
{
LLPointer<Type>& operator =(Type* ptr)
{
assign(ptr);
return *this;
return *this;
}
LLPointer<Type>& operator =(const LLPointer<Type>& ptr)
{
LLPointer<Type>& operator =(const LLPointer<Type>& ptr)
{
assign(ptr);
return *this;
return *this;
}
// support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass>
LLPointer<Type>& operator =(const LLPointer<Subclass>& ptr)
{
LLPointer<Type>& operator =(const LLPointer<Subclass>& ptr)
{
assign(ptr.get());
return *this;
return *this;
}
// Just exchange the pointers, which will not change the reference counts.
static void swap(LLPointer<Type>& a, LLPointer<Type>& b)
{
@ -170,18 +169,18 @@ protected:
template <class Type> class LLConstPointer
{
public:
LLConstPointer() :
LLConstPointer() :
mPointer(NULL)
{
}
LLConstPointer(const Type* ptr) :
LLConstPointer(const Type* ptr) :
mPointer(ptr)
{
ref();
}
LLConstPointer(const LLConstPointer<Type>& ptr) :
LLConstPointer(const LLConstPointer<Type>& ptr) :
mPointer(ptr.mPointer)
{
ref();
@ -189,7 +188,7 @@ public:
// support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass>
LLConstPointer(const LLConstPointer<Subclass>& ptr) :
LLConstPointer(const LLConstPointer<Subclass>& ptr) :
mPointer(ptr.get())
{
ref();
@ -204,55 +203,55 @@ public:
const Type* operator->() const { return mPointer; }
const Type& operator*() const { return *mPointer; }
operator BOOL() const { return (mPointer != NULL); }
operator bool() const { return (mPointer != NULL); }
operator BOOL() const { return (mPointer != NULL); }
operator bool() const { return (mPointer != NULL); }
bool operator!() const { return (mPointer == NULL); }
bool isNull() const { return (mPointer == NULL); }
bool notNull() const { return (mPointer != NULL); }
operator const Type*() const { return mPointer; }
bool operator !=(const Type* ptr) const { return (mPointer != ptr); }
bool operator ==(const Type* ptr) const { return (mPointer == ptr); }
bool operator ==(const LLConstPointer<Type>& ptr) const { return (mPointer == ptr.mPointer); }
bool operator < (const LLConstPointer<Type>& ptr) const { return (mPointer < ptr.mPointer); }
bool operator > (const LLConstPointer<Type>& ptr) const { return (mPointer > ptr.mPointer); }
operator const Type*() const { return mPointer; }
bool operator !=(const Type* ptr) const { return (mPointer != ptr); }
bool operator ==(const Type* ptr) const { return (mPointer == ptr); }
bool operator ==(const LLConstPointer<Type>& ptr) const { return (mPointer == ptr.mPointer); }
bool operator < (const LLConstPointer<Type>& ptr) const { return (mPointer < ptr.mPointer); }
bool operator > (const LLConstPointer<Type>& ptr) const { return (mPointer > ptr.mPointer); }
LLConstPointer<Type>& operator =(const Type* ptr)
LLConstPointer<Type>& operator =(const Type* ptr)
{
if( mPointer != ptr )
{
unref();
mPointer = ptr;
unref();
mPointer = ptr;
ref();
}
return *this;
return *this;
}
LLConstPointer<Type>& operator =(const LLConstPointer<Type>& ptr)
{
LLConstPointer<Type>& operator =(const LLConstPointer<Type>& ptr)
{
if( mPointer != ptr.mPointer )
{
unref();
unref();
mPointer = ptr.mPointer;
ref();
}
return *this;
return *this;
}
// support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass>
LLConstPointer<Type>& operator =(const LLConstPointer<Subclass>& ptr)
{
LLConstPointer<Type>& operator =(const LLConstPointer<Subclass>& ptr)
{
if( mPointer != ptr.get() )
{
unref();
unref();
mPointer = ptr.get();
ref();
}
return *this;
return *this;
}
// Just exchange the pointers, which will not change the reference counts.
static void swap(LLConstPointer<Type>& a, LLConstPointer<Type>& b)
{
@ -263,11 +262,11 @@ public:
protected:
#ifdef LL_LIBRARY_INCLUDE
void ref();
void ref();
void unref();
#else // LL_LIBRARY_INCLUDE
void ref()
{
void ref()
{
if (mPointer)
{
mPointer->ref();
@ -289,6 +288,7 @@ protected:
}
}
#endif // LL_LIBRARY_INCLUDE
protected:
const Type* mPointer;
};
@ -298,13 +298,13 @@ class LLCopyOnWritePointer : public LLPointer<Type>
{
public:
typedef LLCopyOnWritePointer<Type> self_t;
typedef LLPointer<Type> pointer_t;
LLCopyOnWritePointer()
typedef LLPointer<Type> pointer_t;
LLCopyOnWritePointer()
: mStayUnique(false)
{}
LLCopyOnWritePointer(Type* ptr)
LLCopyOnWritePointer(Type* ptr)
: LLPointer<Type>(ptr),
mStayUnique(false)
{}

View File

@ -49,7 +49,7 @@ LLRefCount::LLRefCount() :
}
LLRefCount::~LLRefCount()
{
{
if (mRef != LL_REFCOUNT_FREE && mRef != 0)
{
LL_ERRS() << "deleting non-zero reference" << LL_ENDL;

View File

@ -52,11 +52,11 @@ public:
LLRefCount();
inline void ref() const
{
{
llassert(mRef != LL_REFCOUNT_FREE); // object is deleted
mRef++;
mRef++;
llassert(mRef < gMaxRefCount); // ref count excessive, likely memory leak
}
}
inline S32 unref() const
{
@ -64,7 +64,7 @@ public:
llassert(mRef > 0); // ref count below 1, likely corrupted
if (0 == --mRef)
{
mRef = LL_REFCOUNT_FREE; // set to nonsense yet recognizable value to aid in debugging
mRef = LL_REFCOUNT_FREE; // set to nonsense yet recognizable value to aid in debugging
delete this;
return 0;
}
@ -78,8 +78,8 @@ public:
return mRef;
}
private:
mutable S32 mRef;
private:
mutable S32 mRef;
};
@ -102,7 +102,7 @@ protected:
public:
LLThreadSafeRefCount();
LLThreadSafeRefCount(const LLThreadSafeRefCount&);
LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref)
LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref)
{
mRef = 0;
return *this;
@ -110,8 +110,8 @@ public:
void ref()
{
mRef++;
}
mRef++;
}
void unref()
{
@ -132,36 +132,36 @@ public:
return currentVal;
}
private:
LLAtomicS32 mRef;
private:
LLAtomicS32 mRef;
};
/**
* intrusive pointer support for LLThreadSafeRefCount
* this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type
*/
inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p)
inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p)
{
p->ref();
}
inline void intrusive_ptr_release(LLThreadSafeRefCount* p)
inline void intrusive_ptr_release(LLThreadSafeRefCount* p)
{
p->unref();
p->unref();
}
/**
* intrusive pointer support
* this allows you to use boost::intrusive_ptr with any LLRefCount-derived type
*/
inline void intrusive_ptr_add_ref(LLRefCount* p)
inline void intrusive_ptr_add_ref(LLRefCount* p)
{
p->ref();
}
inline void intrusive_ptr_release(LLRefCount* p)
inline void intrusive_ptr_release(LLRefCount* p)
{
p->unref();
p->unref();
}
#endif

View File

@ -248,7 +248,7 @@ void LLModelPreview::updateDimentionsAndOffsets()
{
accounted.insert(instance.mModel);
//update instance skin info for each lods pelvisZoffset
// update instance skin info for each lods pelvisZoffset
for (int j = 0; j<LLModel::NUM_LODS; ++j)
{
if (instance.mLOD[j])
@ -310,7 +310,7 @@ void LLModelPreview::rebuildUploadData()
mat *= scale_mat;
for (LLModelLoader::model_instance_list::iterator model_iter = iter->second.begin(); model_iter != iter->second.end();)
{ //for each instance with said transform applied
{ // for each instance with said transform applied
LLModelInstance instance = *model_iter++;
LLModel* base_model = instance.mModel;
@ -573,7 +573,7 @@ void LLModelPreview::rebuildUploadData()
else if (getLoadState() == LLModelLoader::ERROR_MATERIALS
|| getLoadState() == LLModelLoader::WARNING_BIND_SHAPE_ORIENTATION)
{
// This is only valid for these two error types because they are
// This is only valid for these two error types because they are
// only used inside rebuildUploadData() and updateStatusMessages()
// updateStatusMessages() is called after rebuildUploadData()
setLoadState(LLModelLoader::DONE);
@ -775,7 +775,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable
// it tends to force the UI into strange checkbox options
// which cannot be altered.
//only try to load from slm if viewer is configured to do so and this is the
//only try to load from slm if viewer is configured to do so and this is the
//initial model load (not an LoD or physics shape)
mModelLoader->mTrySLM = gSavedSettings.getBOOL("MeshImportUseSLM") && mUploadData.empty();
}
@ -861,12 +861,13 @@ void LLModelPreview::clearIncompatible(S32 lod)
// Check if already started
bool subscribe_for_generation = mLodsQuery.empty();
// Remove previously scheduled work
mLodsQuery.clear();
LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance;
if (!fmp) return;
if (!fmp)
return;
// Schedule new work
for (S32 i = LLModel::LOD_HIGH; i >= 0; --i)
@ -1696,7 +1697,7 @@ F32 LLModelPreview::genMeshOptimizerPerFace(LLModel *base_model, LLModel *target
ll_aligned_free_16(output_indices);
ll_aligned_free_16(shadow_indices);
if (size_new_indices < 3)
{
// At least one triangle is needed
@ -1881,7 +1882,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
{
precise_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, MESH_OPTIMIZER_NO_UVS);
}
if (precise_ratio < 0 || (precise_ratio * allowed_ratio_drift < indices_decimator))
{
// Try sloppy variant if normal one failed to simplify model enough.