meow-7.2.2
Eli Linden 2010-04-15 14:13:00 -07:00
commit 4fe28de53a
5 changed files with 33 additions and 10 deletions

View File

@ -543,14 +543,13 @@ S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nb
return 0;
}
S32 off;
if (offset < 0)
off = LLAPRFile::seek(file_handle, APR_END, 0);
else
off = LLAPRFile::seek(file_handle, APR_SET, offset);
llassert(offset >= 0);
if (offset > 0)
offset = LLAPRFile::seek(file_handle, APR_SET, offset);
apr_size_t bytes_read;
if (off < 0)
if (offset < 0)
{
bytes_read = 0;
}

View File

@ -255,12 +255,12 @@ public:
// Returns bytes read/written, 0 if read/write fails:
static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);
static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);
static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); // offset<0 means append
//*******************************************************************************************************************************
};
/**
* @brief Function which approprately logs error or remains quiet on
* @brief Function which appropriately logs error or remains quiet on
* APR_SUCCESS.
* @return Returns <code>true</code> if status is an error condition.
*/

View File

@ -70,6 +70,8 @@ class LLVector2
void setVec(const LLVector2 &vec); // deprecated
void setVec(const F32 *vec); // deprecated
inline bool isFinite() const; // checks to see if all values of LLVector2 are finite
F32 length() const; // Returns magnitude of LLVector2
F32 lengthSquared() const; // Returns magnitude squared of LLVector2
F32 normalize(); // Normalizes and returns the magnitude of LLVector2
@ -215,6 +217,7 @@ inline void LLVector2::setVec(const F32 *vec)
mV[VY] = vec[VY];
}
// LLVector2 Magnitude and Normalization Functions
inline F32 LLVector2::length(void) const
@ -247,6 +250,12 @@ inline F32 LLVector2::normalize(void)
return (mag);
}
// checker
inline bool LLVector2::isFinite() const
{
return (llfinite(mV[VX]) && llfinite(mV[VY]));
}
// deprecated
inline F32 LLVector2::magVec(void) const
{

View File

@ -1738,8 +1738,18 @@ BOOL LLImageGL::getMask(const LLVector2 &tc)
if (mPickMask)
{
F32 u = tc.mV[0] - floorf(tc.mV[0]);
F32 v = tc.mV[1] - floorf(tc.mV[1]);
F32 u,v;
if (LL_LIKELY(tc.isFinite()))
{
u = tc.mV[0] - floorf(tc.mV[0]);
v = tc.mV[1] - floorf(tc.mV[1]);
}
else
{
LL_WARNS_ONCE("render") << "Ugh, non-finite u/v in mask pick" << LL_ENDL;
u = v = 0.f;
llassert(false);
}
if (LL_UNLIKELY(u < 0.f || u > 1.f ||
v < 0.f || v > 1.f))

View File

@ -116,6 +116,11 @@
#include "llnotificationmanager.h" //
#if LL_MSVC
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
#endif
//
// Constants
//