Skip to content
Snippets Groups Projects
Commit beb61818 authored by Alexander Gavriliuk's avatar Alexander Gavriliuk Committed by Guru
Browse files

SL-19299 Code formatting in modified files

parent 85efb85a
No related branches found
No related tags found
No related merge requests found
...@@ -46,33 +46,32 @@ ...@@ -46,33 +46,32 @@
template <class Type> class LLPointer template <class Type> class LLPointer
{ {
public: public:
LLPointer() :
LLPointer() :
mPointer(NULL) mPointer(NULL)
{ {
} }
LLPointer(Type* ptr) : LLPointer(Type* ptr) :
mPointer(ptr) mPointer(ptr)
{ {
ref(); ref();
} }
LLPointer(const LLPointer<Type>& ptr) : LLPointer(const LLPointer<Type>& ptr) :
mPointer(ptr.mPointer) mPointer(ptr.mPointer)
{ {
ref(); 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> template<typename Subclass>
LLPointer(const LLPointer<Subclass>& ptr) : LLPointer(const LLPointer<Subclass>& ptr) :
mPointer(ptr.get()) mPointer(ptr.get())
{ {
ref(); ref();
} }
~LLPointer() ~LLPointer()
{ {
unref(); unref();
} }
...@@ -83,39 +82,39 @@ template <class Type> class LLPointer ...@@ -83,39 +82,39 @@ template <class Type> class LLPointer
const Type& operator*() const { return *mPointer; } const Type& operator*() const { return *mPointer; }
Type& operator*() { 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 operator!() const { return (mPointer == NULL); }
bool isNull() const { return (mPointer == NULL); } bool isNull() const { return (mPointer == NULL); }
bool notNull() const { return (mPointer != NULL); } bool notNull() const { return (mPointer != NULL); }
operator Type*() const { return mPointer; } operator Type*() const { return mPointer; }
bool operator !=(Type* ptr) const { return (mPointer != ptr); } bool operator !=(Type* ptr) const { return (mPointer != ptr); }
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); } 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); assign(ptr);
return *this; return *this;
} }
LLPointer<Type>& operator =(const LLPointer<Type>& ptr) LLPointer<Type>& operator =(const LLPointer<Type>& ptr)
{ {
assign(ptr); assign(ptr);
return *this; return *this;
} }
// support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed. // support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass> template<typename Subclass>
LLPointer<Type>& operator =(const LLPointer<Subclass>& ptr) LLPointer<Type>& operator =(const LLPointer<Subclass>& ptr)
{ {
assign(ptr.get()); assign(ptr.get());
return *this; return *this;
} }
// Just exchange the pointers, which will not change the reference counts. // Just exchange the pointers, which will not change the reference counts.
static void swap(LLPointer<Type>& a, LLPointer<Type>& b) static void swap(LLPointer<Type>& a, LLPointer<Type>& b)
{ {
...@@ -170,18 +169,18 @@ template <class Type> class LLPointer ...@@ -170,18 +169,18 @@ template <class Type> class LLPointer
template <class Type> class LLConstPointer template <class Type> class LLConstPointer
{ {
public: public:
LLConstPointer() : LLConstPointer() :
mPointer(NULL) mPointer(NULL)
{ {
} }
LLConstPointer(const Type* ptr) : LLConstPointer(const Type* ptr) :
mPointer(ptr) mPointer(ptr)
{ {
ref(); ref();
} }
LLConstPointer(const LLConstPointer<Type>& ptr) : LLConstPointer(const LLConstPointer<Type>& ptr) :
mPointer(ptr.mPointer) mPointer(ptr.mPointer)
{ {
ref(); ref();
...@@ -189,7 +188,7 @@ template <class Type> class LLConstPointer ...@@ -189,7 +188,7 @@ template <class Type> class LLConstPointer
// 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> template<typename Subclass>
LLConstPointer(const LLConstPointer<Subclass>& ptr) : LLConstPointer(const LLConstPointer<Subclass>& ptr) :
mPointer(ptr.get()) mPointer(ptr.get())
{ {
ref(); ref();
...@@ -204,55 +203,55 @@ template <class Type> class LLConstPointer ...@@ -204,55 +203,55 @@ template <class Type> class LLConstPointer
const Type* operator->() const { return mPointer; } const Type* operator->() const { return mPointer; }
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 operator!() const { return (mPointer == NULL); }
bool isNull() const { return (mPointer == NULL); } bool isNull() const { return (mPointer == NULL); }
bool notNull() const { return (mPointer != NULL); } bool notNull() const { return (mPointer != NULL); }
operator const Type*() const { return 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 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); } 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 ) if( mPointer != ptr )
{ {
unref(); unref();
mPointer = ptr; mPointer = ptr;
ref(); ref();
} }
return *this; return *this;
} }
LLConstPointer<Type>& operator =(const LLConstPointer<Type>& ptr) LLConstPointer<Type>& operator =(const LLConstPointer<Type>& ptr)
{ {
if( mPointer != ptr.mPointer ) if( mPointer != ptr.mPointer )
{ {
unref(); unref();
mPointer = ptr.mPointer; mPointer = ptr.mPointer;
ref(); ref();
} }
return *this; return *this;
} }
// support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed. // support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass> template<typename Subclass>
LLConstPointer<Type>& operator =(const LLConstPointer<Subclass>& ptr) LLConstPointer<Type>& operator =(const LLConstPointer<Subclass>& ptr)
{ {
if( mPointer != ptr.get() ) if( mPointer != ptr.get() )
{ {
unref(); unref();
mPointer = ptr.get(); mPointer = ptr.get();
ref(); ref();
} }
return *this; return *this;
} }
// Just exchange the pointers, which will not change the reference counts. // Just exchange the pointers, which will not change the reference counts.
static void swap(LLConstPointer<Type>& a, LLConstPointer<Type>& b) static void swap(LLConstPointer<Type>& a, LLConstPointer<Type>& b)
{ {
...@@ -263,11 +262,11 @@ template <class Type> class LLConstPointer ...@@ -263,11 +262,11 @@ template <class Type> class LLConstPointer
protected: protected:
#ifdef LL_LIBRARY_INCLUDE #ifdef LL_LIBRARY_INCLUDE
void ref(); void ref();
void unref(); void unref();
#else // LL_LIBRARY_INCLUDE #else // LL_LIBRARY_INCLUDE
void ref() void ref()
{ {
if (mPointer) if (mPointer)
{ {
mPointer->ref(); mPointer->ref();
...@@ -289,6 +288,7 @@ template <class Type> class LLConstPointer ...@@ -289,6 +288,7 @@ template <class Type> class LLConstPointer
} }
} }
#endif // LL_LIBRARY_INCLUDE #endif // LL_LIBRARY_INCLUDE
protected: protected:
const Type* mPointer; const Type* mPointer;
}; };
...@@ -298,13 +298,13 @@ class LLCopyOnWritePointer : public LLPointer<Type> ...@@ -298,13 +298,13 @@ class LLCopyOnWritePointer : public LLPointer<Type>
{ {
public: public:
typedef LLCopyOnWritePointer<Type> self_t; typedef LLCopyOnWritePointer<Type> self_t;
typedef LLPointer<Type> pointer_t; typedef LLPointer<Type> pointer_t;
LLCopyOnWritePointer() LLCopyOnWritePointer()
: mStayUnique(false) : mStayUnique(false)
{} {}
LLCopyOnWritePointer(Type* ptr) LLCopyOnWritePointer(Type* ptr)
: LLPointer<Type>(ptr), : LLPointer<Type>(ptr),
mStayUnique(false) mStayUnique(false)
{} {}
......
...@@ -49,7 +49,7 @@ LLRefCount::LLRefCount() : ...@@ -49,7 +49,7 @@ LLRefCount::LLRefCount() :
} }
LLRefCount::~LLRefCount() LLRefCount::~LLRefCount()
{ {
if (mRef != LL_REFCOUNT_FREE && mRef != 0) if (mRef != LL_REFCOUNT_FREE && mRef != 0)
{ {
LL_ERRS() << "deleting non-zero reference" << LL_ENDL; LL_ERRS() << "deleting non-zero reference" << LL_ENDL;
......
...@@ -52,11 +52,11 @@ class LL_COMMON_API LLRefCount ...@@ -52,11 +52,11 @@ class LL_COMMON_API LLRefCount
LLRefCount(); LLRefCount();
inline void ref() const inline void ref() const
{ {
llassert(mRef != LL_REFCOUNT_FREE); // object is deleted llassert(mRef != LL_REFCOUNT_FREE); // object is deleted
mRef++; mRef++;
llassert(mRef < gMaxRefCount); // ref count excessive, likely memory leak llassert(mRef < gMaxRefCount); // ref count excessive, likely memory leak
} }
inline S32 unref() const inline S32 unref() const
{ {
...@@ -64,7 +64,7 @@ class LL_COMMON_API LLRefCount ...@@ -64,7 +64,7 @@ class LL_COMMON_API LLRefCount
llassert(mRef > 0); // ref count below 1, likely corrupted llassert(mRef > 0); // ref count below 1, likely corrupted
if (0 == --mRef) 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; delete this;
return 0; return 0;
} }
...@@ -78,8 +78,8 @@ class LL_COMMON_API LLRefCount ...@@ -78,8 +78,8 @@ class LL_COMMON_API LLRefCount
return mRef; return mRef;
} }
private: private:
mutable S32 mRef; mutable S32 mRef;
}; };
...@@ -102,7 +102,7 @@ class LL_COMMON_API LLThreadSafeRefCount ...@@ -102,7 +102,7 @@ class LL_COMMON_API LLThreadSafeRefCount
public: public:
LLThreadSafeRefCount(); LLThreadSafeRefCount();
LLThreadSafeRefCount(const LLThreadSafeRefCount&); LLThreadSafeRefCount(const LLThreadSafeRefCount&);
LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref) LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref)
{ {
mRef = 0; mRef = 0;
return *this; return *this;
...@@ -110,8 +110,8 @@ class LL_COMMON_API LLThreadSafeRefCount ...@@ -110,8 +110,8 @@ class LL_COMMON_API LLThreadSafeRefCount
void ref() void ref()
{ {
mRef++; mRef++;
} }
void unref() void unref()
{ {
...@@ -132,36 +132,36 @@ class LL_COMMON_API LLThreadSafeRefCount ...@@ -132,36 +132,36 @@ class LL_COMMON_API LLThreadSafeRefCount
return currentVal; return currentVal;
} }
private: private:
LLAtomicS32 mRef; LLAtomicS32 mRef;
}; };
/** /**
* intrusive pointer support for LLThreadSafeRefCount * intrusive pointer support for LLThreadSafeRefCount
* this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type * 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(); p->ref();
} }
inline void intrusive_ptr_release(LLThreadSafeRefCount* p) inline void intrusive_ptr_release(LLThreadSafeRefCount* p)
{ {
p->unref(); p->unref();
} }
/** /**
* intrusive pointer support * intrusive pointer support
* this allows you to use boost::intrusive_ptr with any LLRefCount-derived type * 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(); p->ref();
} }
inline void intrusive_ptr_release(LLRefCount* p) inline void intrusive_ptr_release(LLRefCount* p)
{ {
p->unref(); p->unref();
} }
#endif #endif
...@@ -248,7 +248,7 @@ void LLModelPreview::updateDimentionsAndOffsets() ...@@ -248,7 +248,7 @@ void LLModelPreview::updateDimentionsAndOffsets()
{ {
accounted.insert(instance.mModel); 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) for (int j = 0; j<LLModel::NUM_LODS; ++j)
{ {
if (instance.mLOD[j]) if (instance.mLOD[j])
...@@ -310,7 +310,7 @@ void LLModelPreview::rebuildUploadData() ...@@ -310,7 +310,7 @@ void LLModelPreview::rebuildUploadData()
mat *= scale_mat; mat *= scale_mat;
for (LLModelLoader::model_instance_list::iterator model_iter = iter->second.begin(); model_iter != iter->second.end();) 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++; LLModelInstance instance = *model_iter++;
LLModel* base_model = instance.mModel; LLModel* base_model = instance.mModel;
...@@ -573,7 +573,7 @@ void LLModelPreview::rebuildUploadData() ...@@ -573,7 +573,7 @@ void LLModelPreview::rebuildUploadData()
else if (getLoadState() == LLModelLoader::ERROR_MATERIALS else if (getLoadState() == LLModelLoader::ERROR_MATERIALS
|| getLoadState() == LLModelLoader::WARNING_BIND_SHAPE_ORIENTATION) || 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() // only used inside rebuildUploadData() and updateStatusMessages()
// updateStatusMessages() is called after rebuildUploadData() // updateStatusMessages() is called after rebuildUploadData()
setLoadState(LLModelLoader::DONE); setLoadState(LLModelLoader::DONE);
...@@ -775,7 +775,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable ...@@ -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 // it tends to force the UI into strange checkbox options
// which cannot be altered. // 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) //initial model load (not an LoD or physics shape)
mModelLoader->mTrySLM = gSavedSettings.getBOOL("MeshImportUseSLM") && mUploadData.empty(); mModelLoader->mTrySLM = gSavedSettings.getBOOL("MeshImportUseSLM") && mUploadData.empty();
} }
...@@ -861,12 +861,13 @@ void LLModelPreview::clearIncompatible(S32 lod) ...@@ -861,12 +861,13 @@ void LLModelPreview::clearIncompatible(S32 lod)
// Check if already started // Check if already started
bool subscribe_for_generation = mLodsQuery.empty(); bool subscribe_for_generation = mLodsQuery.empty();
// Remove previously scheduled work // Remove previously scheduled work
mLodsQuery.clear(); mLodsQuery.clear();
LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance; LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance;
if (!fmp) return; if (!fmp)
return;
// Schedule new work // Schedule new work
for (S32 i = LLModel::LOD_HIGH; i >= 0; --i) for (S32 i = LLModel::LOD_HIGH; i >= 0; --i)
...@@ -1696,7 +1697,7 @@ F32 LLModelPreview::genMeshOptimizerPerFace(LLModel *base_model, LLModel *target ...@@ -1696,7 +1697,7 @@ F32 LLModelPreview::genMeshOptimizerPerFace(LLModel *base_model, LLModel *target
ll_aligned_free_16(output_indices); ll_aligned_free_16(output_indices);
ll_aligned_free_16(shadow_indices); ll_aligned_free_16(shadow_indices);
if (size_new_indices < 3) if (size_new_indices < 3)
{ {
// At least one triangle is needed // At least one triangle is needed
...@@ -1881,7 +1882,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d ...@@ -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); 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)) if (precise_ratio < 0 || (precise_ratio * allowed_ratio_drift < indices_decimator))
{ {
// Try sloppy variant if normal one failed to simplify model enough. // Try sloppy variant if normal one failed to simplify model enough.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment