diff options
Diffstat (limited to 'indra/llmessage')
| -rwxr-xr-x | indra/llmessage/llcurl.cpp | 49 | ||||
| -rwxr-xr-x | indra/llmessage/llcurl.h | 5 | ||||
| -rwxr-xr-x | indra/llmessage/llhttpclient.cpp | 35 | ||||
| -rwxr-xr-x | indra/llmessage/llhttpclient.h | 19 | ||||
| -rwxr-xr-x | indra/llmessage/llpartdata.cpp | 282 | ||||
| -rwxr-xr-x | indra/llmessage/llpartdata.h | 61 | ||||
| -rwxr-xr-x | indra/llmessage/lltransfermanager.cpp | 60 | ||||
| -rwxr-xr-x | indra/llmessage/lltransfermanager.h | 4 | ||||
| -rwxr-xr-x | indra/llmessage/llurlrequest.cpp | 21 | ||||
| -rwxr-xr-x | indra/llmessage/llurlrequest.h | 9 | ||||
| -rwxr-xr-x | indra/llmessage/tests/llpartdata_test.cpp | 256 | 
11 files changed, 472 insertions, 329 deletions
| diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index f2a3e059ef..081f070866 100755 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -92,6 +92,7 @@ S32      LLCurl::sTotalHandles = 0 ;  bool     LLCurl::sNotQuitting = true;  F32      LLCurl::sCurlRequestTimeOut = 120.f; //seonds  S32      LLCurl::sMaxHandles = 256; //max number of handles, (multi handles and easy handles combined). +CURL*	 LLCurl::sCurlTemplateStandardHandle = NULL;  void check_curl_code(CURLcode code)  { @@ -1815,10 +1816,10 @@ CURL*  LLCurl::newEasyHandle()  	}  	sTotalHandles++; -	CURL* ret = curl_easy_init() ; +	CURL* ret = createStandardCurlHandle();  	if(!ret)  	{ -		llwarns << "curl_easy_init failed." << llendl ; +		llwarns << "failed to create curl handle." << llendl ;  	}  	return ret ; @@ -1848,3 +1849,47 @@ void LLCurlFF::check_multi_code(CURLMcode code)  {  	check_curl_multi_code(code);  } + + +// Static +CURL* LLCurl::createStandardCurlHandle() +{ +	if (sCurlTemplateStandardHandle == NULL) +	{	// Late creation of the template curl handle +		sCurlTemplateStandardHandle = curl_easy_init(); +		if (sCurlTemplateStandardHandle == NULL) +		{ +			llwarns << "curl error calling curl_easy_init()" << llendl; +		} +		else +		{ +			CURLcode result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); +			check_curl_code(result); +			result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_NOSIGNAL, 1); +			check_curl_code(result); +			result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_NOPROGRESS, 1); +			check_curl_code(result); +			result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_ENCODING, "");	 +			check_curl_code(result); +			result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_AUTOREFERER, 1); +			check_curl_code(result); +			result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_FOLLOWLOCATION, 1);	 +			check_curl_code(result); +			result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_SSL_VERIFYPEER, 1); +			check_curl_code(result); +			result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_SSL_VERIFYHOST, 0); +			check_curl_code(result); + +			// The Linksys WRT54G V5 router has an issue with frequent +			// DNS lookups from LAN machines.  If they happen too often, +			// like for every HTTP request, the router gets annoyed after +			// about 700 or so requests and starts issuing TCP RSTs to +			// new connections.  Reuse the DNS lookups for even a few +			// seconds and no RSTs. +			result = curl_easy_setopt(sCurlTemplateStandardHandle, CURLOPT_DNS_CACHE_TIMEOUT, 15); +			check_curl_code(result); +		} +	} + +	return curl_easy_duphandle(sCurlTemplateStandardHandle); +} diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 7bcf61e233..90b3f2815d 100755 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -45,7 +45,7 @@  #include "llqueuedthread.h"  #include "llframetimer.h"  #include "llpointer.h" - +#include "llsingleton.h"  class LLMutex;  class LLCurlThread; @@ -188,6 +188,8 @@ public:  	static CURL*  newEasyHandle() ;  	static void   deleteEasyHandle(CURL* handle) ; +	static CURL*	createStandardCurlHandle(); +  private:  	static std::string sCAPath;  	static std::string sCAFile; @@ -197,6 +199,7 @@ private:  	static LLMutex* sHandleMutexp ;  	static S32      sTotalHandles ;  	static S32      sMaxHandles; +	static CURL*	sCurlTemplateStandardHandle;  public:  	static bool     sNotQuitting;  	static F32      sCurlRequestTimeOut;	 diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 6110b035dc..11648717ad 100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -217,7 +217,8 @@ static void request(  	Injector* body_injector,  	LLCurl::ResponderPtr responder,  	const F32 timeout = HTTP_REQUEST_EXPIRY_SECS, -	const LLSD& headers = LLSD() +	const LLSD& headers = LLSD(), +	bool follow_redirects = true      )  {  	if (!LLHTTPClient::hasPump()) @@ -231,7 +232,7 @@ static void request(  	}  	LLPumpIO::chain_t chain; -	LLURLRequest* req = new LLURLRequest(method, url); +	LLURLRequest* req = new LLURLRequest(method, url, follow_redirects);  	if(!req->isValid())//failed  	{  		if (responder) @@ -334,7 +335,8 @@ void LLHTTPClient::getByteRange(  	S32 bytes,  	ResponderPtr responder,  	const LLSD& hdrs, -	const F32 timeout) +	const F32 timeout, +	bool follow_redirects /* = true */)  {  	LLSD headers = hdrs;  	if(offset > 0 || bytes > 0) @@ -342,37 +344,42 @@ void LLHTTPClient::getByteRange(  		std::string range = llformat("bytes=%d-%d", offset, offset+bytes-1);  		headers["Range"] = range;  	} -    request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); +    request(url,LLURLRequest::HTTP_GET, NULL, responder, timeout, headers, follow_redirects);  }  void LLHTTPClient::head(  	const std::string& url,  	ResponderPtr responder,  	const LLSD& headers, -	const F32 timeout) +	const F32 timeout, +	bool follow_redirects /* = true */)  { -	request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers); +	request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers, follow_redirects);  } -void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) +void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout, +					   bool follow_redirects /* = true */)  { -	request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); +	request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout, headers, follow_redirects);  } -void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) +void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers, +								 const F32 timeout, bool follow_redirects /* = true */)  { -	request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers); +	request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers, follow_redirects);  } -void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout) +void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout, +								 bool follow_redirects /* = true */)  { -	getHeaderOnly(url, responder, LLSD(), timeout); +	getHeaderOnly(url, responder, LLSD(), timeout, follow_redirects);  } -void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const LLSD& headers, const F32 timeout) +void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const LLSD& headers, +					   const F32 timeout, bool follow_redirects /* = true */)  {  	LLURI uri;  	uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query); -	get(uri.asString(), responder, headers, timeout); +	get(uri.asString(), responder, headers, timeout, follow_redirects);  }  // A simple class for managing data returned from a curl http request. diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index a7236ba169..5de257a4f6 100755 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -63,10 +63,15 @@ public:  		const std::string& url,  		ResponderPtr,  		const LLSD& headers = LLSD(), -		const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); -	static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); -	static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); -	static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); +		const F32 timeout=HTTP_REQUEST_EXPIRY_SECS, +		bool follow_redirects = true); +	static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, +							 const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS, +							 bool follow_redirects = true); +	static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), +					const F32 timeout=HTTP_REQUEST_EXPIRY_SECS, bool follow_redirects = true); +	static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), +					const F32 timeout=HTTP_REQUEST_EXPIRY_SECS, bool follow_redirects = true);  	static void put(  		const std::string& url, @@ -74,8 +79,10 @@ public:  		ResponderPtr,  		const LLSD& headers = LLSD(),  		const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); -	static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); -	static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); +	static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS, +							  bool follow_redirects = true); +	static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, +							  const F32 timeout=HTTP_REQUEST_EXPIRY_SECS, bool follow_redirects = true);  	static void post(  		const std::string& url, diff --git a/indra/llmessage/llpartdata.cpp b/indra/llmessage/llpartdata.cpp index 26cafa025f..41a0310ce0 100755 --- a/indra/llmessage/llpartdata.cpp +++ b/indra/llmessage/llpartdata.cpp @@ -37,53 +37,46 @@ -const S32 PS_PART_DATA_BLOCK_SIZE = 4 + 2 + 4 + 4 + 2 + 2; // 18 -const S32 PS_DATA_BLOCK_SIZE = 68 + PS_PART_DATA_BLOCK_SIZE; // 68 + 18 = 86 +const S32 PS_PART_DATA_GLOW_SIZE = 2; +const S32 PS_PART_DATA_BLEND_SIZE = 2; +const S32 PS_LEGACY_PART_DATA_BLOCK_SIZE = 4 + 2 + 4 + 4 + 2 + 2; //18 +const S32 PS_SYS_DATA_BLOCK_SIZE = 68; +const S32 PS_MAX_DATA_BLOCK_SIZE = PS_SYS_DATA_BLOCK_SIZE+ +									PS_LEGACY_PART_DATA_BLOCK_SIZE + +									PS_PART_DATA_BLEND_SIZE + +									PS_PART_DATA_GLOW_SIZE+ +									8; //two S32 size fields + +const S32 PS_LEGACY_DATA_BLOCK_SIZE = PS_SYS_DATA_BLOCK_SIZE + PS_LEGACY_PART_DATA_BLOCK_SIZE; + + +const U32 PART_DATA_MASK = LLPartData::LL_PART_DATA_GLOW | LLPartData::LL_PART_DATA_BLEND; +  const F32 MAX_PART_SCALE = 4.f; -BOOL LLPartData::pack(LLDataPacker &dp) +bool LLPartData::hasGlow() const  { -	LLColor4U coloru; -	dp.packU32(mFlags, "pdflags"); -	dp.packFixed(mMaxAge, "pdmaxage", FALSE, 8, 8); -	coloru.setVec(mStartColor); -	dp.packColor4U(coloru, "pdstartcolor"); -	coloru.setVec(mEndColor); -	dp.packColor4U(coloru, "pdendcolor"); -	dp.packFixed(mStartScale.mV[0], "pdstartscalex", FALSE, 3, 5); -	dp.packFixed(mStartScale.mV[1], "pdstartscaley", FALSE, 3, 5); -	dp.packFixed(mEndScale.mV[0], "pdendscalex", FALSE, 3, 5); -	dp.packFixed(mEndScale.mV[1], "pdendscaley", FALSE, 3, 5); -	return TRUE; +	return mStartGlow > 0.f || mEndGlow > 0.f;  } -LLSD LLPartData::asLLSD() const +bool LLPartData::hasBlendFunc() const  { -	LLSD sd = LLSD(); -	sd["pdflags"] = ll_sd_from_U32(mFlags); -	sd["pdmaxage"] = mMaxAge; -	sd["pdstartcolor"] = ll_sd_from_color4(mStartColor); -	sd["pdendcolor"] = ll_sd_from_color4(mEndColor); -	sd["pdstartscale"] = ll_sd_from_vector2(mStartScale); -	sd["pdendscale"] = ll_sd_from_vector2(mEndScale); -	return sd; +	return mBlendFuncSource != LLPartData::LL_PART_BF_SOURCE_ALPHA || mBlendFuncDest != LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_ALPHA;  } -bool LLPartData::fromLLSD(LLSD& sd) +S32 LLPartData::getSize() const  { -	mFlags = ll_U32_from_sd(sd["pdflags"]); -	mMaxAge = (F32)sd["pdmaxage"].asReal(); -	mStartColor = ll_color4_from_sd(sd["pdstartcolor"]); -	mEndColor = ll_color4_from_sd(sd["pdendcolor"]); -	mStartScale = ll_vector2_from_sd(sd["pdstartscale"]); -	mEndScale = ll_vector2_from_sd(sd["pdendscale"]); -	return true; +	S32 size = PS_LEGACY_PART_DATA_BLOCK_SIZE; +	if (hasGlow()) size += PS_PART_DATA_GLOW_SIZE; +	if (hasBlendFunc()) size += PS_PART_DATA_BLEND_SIZE; + +	return size;  } -BOOL LLPartData::unpack(LLDataPacker &dp) +BOOL LLPartData::unpackLegacy(LLDataPacker &dp)  {  	LLColor4U coloru; @@ -98,9 +91,70 @@ BOOL LLPartData::unpack(LLDataPacker &dp)  	dp.unpackFixed(mStartScale.mV[1], "pdstartscaley", FALSE, 3, 5);  	dp.unpackFixed(mEndScale.mV[0], "pdendscalex", FALSE, 3, 5);  	dp.unpackFixed(mEndScale.mV[1], "pdendscaley", FALSE, 3, 5); + +	mStartGlow = 0.f; +	mEndGlow = 0.f; +	mBlendFuncSource = LLPartData::LL_PART_BF_SOURCE_ALPHA; +	mBlendFuncDest = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_ALPHA; +  	return TRUE;  } +BOOL LLPartData::unpack(LLDataPacker &dp) +{ +	S32 size = 0; +	dp.unpackS32(size, "partsize"); + +	unpackLegacy(dp); +	size -= PS_LEGACY_PART_DATA_BLOCK_SIZE; + +	if (mFlags & LL_PART_DATA_GLOW) +	{ +		if (size < PS_PART_DATA_GLOW_SIZE) return FALSE; + +		U8 tmp_glow = 0; +		dp.unpackU8(tmp_glow,"pdstartglow"); +		mStartGlow = tmp_glow / 255.f; +		dp.unpackU8(tmp_glow,"pdendglow"); +		mEndGlow = tmp_glow / 255.f; + +		size -= PS_PART_DATA_GLOW_SIZE; +	} +	else +	{ +		mStartGlow = 0.f; +		mEndGlow = 0.f; +	} + +	if (mFlags & LL_PART_DATA_BLEND) +	{ +		if (size < PS_PART_DATA_BLEND_SIZE) return FALSE; +		dp.unpackU8(mBlendFuncSource,"pdblendsource"); +		dp.unpackU8(mBlendFuncDest,"pdblenddest"); +		size -= PS_PART_DATA_BLEND_SIZE; +	} +	else +	{ +		mBlendFuncSource = LLPartData::LL_PART_BF_SOURCE_ALPHA; +		mBlendFuncDest = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_ALPHA; +	} + +	if (size > 0) +	{ //leftover bytes, unrecognized parameters +		U8 feh = 0; +		while (size > 0) +		{ //read remaining bytes in block +			dp.unpackU8(feh, "whippang"); +			size--; +		} + +		//this particle system won't display properly, better to not show anything +		return FALSE; +	} + + +	return TRUE; +}  void LLPartData::setFlags(const U32 flags)  { @@ -148,6 +202,18 @@ void LLPartData::setEndAlpha(const F32 alpha)  	mEndColor.mV[3] = alpha;  } +// static +bool LLPartData::validBlendFunc(S32 func) +{ +	if (func >= 0 +		&& func < LL_PART_BF_COUNT +		&& func != UNSUPPORTED_DEST_ALPHA +		&& func != UNSUPPORTED_ONE_MINUS_DEST_ALPHA) +	{ +		return true; +	} +	return false; +}  LLPartSysData::LLPartSysData()  { @@ -160,6 +226,10 @@ LLPartSysData::LLPartSysData()  	mPartData.mStartScale = LLVector2(1.f, 1.f);  	mPartData.mEndScale = LLVector2(1.f, 1.f);  	mPartData.mMaxAge = 10.0; +	mPartData.mBlendFuncSource = LLPartData::LL_PART_BF_SOURCE_ALPHA; +	mPartData.mBlendFuncDest = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_ALPHA; +	mPartData.mStartGlow = 0.f; +	mPartData.mEndGlow = 0.f;  	mMaxAge = 0.0;  	mStartAge = 0.0; @@ -175,38 +245,7 @@ LLPartSysData::LLPartSysData()  	mNumParticles = 0;  } - -BOOL LLPartSysData::pack(LLDataPacker &dp) -{ -	dp.packU32(mCRC, "pscrc"); -	dp.packU32(mFlags, "psflags"); -	dp.packU8(mPattern, "pspattern"); -	dp.packFixed(mMaxAge, "psmaxage", FALSE, 8, 8); -	dp.packFixed(mStartAge, "psstartage", FALSE, 8, 8); -	dp.packFixed(mInnerAngle, "psinnerangle", FALSE, 3, 5); -	dp.packFixed(mOuterAngle, "psouterangle", FALSE, 3, 5); -	dp.packFixed(mBurstRate, "psburstrate", FALSE, 8, 8); -	dp.packFixed(mBurstRadius, "psburstradius", FALSE, 8, 8); -	dp.packFixed(mBurstSpeedMin, "psburstspeedmin", FALSE, 8, 8); -	dp.packFixed(mBurstSpeedMax, "psburstspeedmax", FALSE, 8, 8); -	dp.packU8(mBurstPartCount, "psburstpartcount"); - -	dp.packFixed(mAngularVelocity.mV[0], "psangvelx", TRUE, 8, 7); -	dp.packFixed(mAngularVelocity.mV[1], "psangvely", TRUE, 8, 7); -	dp.packFixed(mAngularVelocity.mV[2], "psangvelz", TRUE, 8, 7); - -	dp.packFixed(mPartAccel.mV[0], "psaccelx", TRUE, 8, 7); -	dp.packFixed(mPartAccel.mV[1], "psaccely", TRUE, 8, 7); -	dp.packFixed(mPartAccel.mV[2], "psaccelz", TRUE, 8, 7); - -	dp.packUUID(mPartImageID, "psuuid"); -	dp.packUUID(mTargetUUID, "pstargetuuid"); -	mPartData.pack(dp); -	return TRUE; -} - - -BOOL LLPartSysData::unpack(LLDataPacker &dp) +BOOL LLPartSysData::unpackSystem(LLDataPacker &dp)  {  	dp.unpackU32(mCRC, "pscrc");  	dp.unpackU32(mFlags, "psflags"); @@ -232,10 +271,48 @@ BOOL LLPartSysData::unpack(LLDataPacker &dp)  	dp.unpackUUID(mPartImageID, "psuuid");  	dp.unpackUUID(mTargetUUID, "pstargetuuid"); -	mPartData.unpack(dp);  	return TRUE;  } +BOOL LLPartSysData::unpackLegacy(LLDataPacker &dp) +{ +	unpackSystem(dp); +	mPartData.unpackLegacy(dp); + +	return TRUE; +} + +BOOL LLPartSysData::unpack(LLDataPacker &dp) +{ +	// syssize is currently unused.  Adding now when modifying the 'version to make extensible in the future +	S32 size = 0; +	dp.unpackS32(size, "syssize"); +	 +	if (size != PS_SYS_DATA_BLOCK_SIZE) +	{ //unexpected size, this viewer doesn't know how to parse this particle system +		 +		//skip to LLPartData block +		U8 feh = 0; +		 +		for (U32 i = 0; i < size; ++i) +		{ +			dp.unpackU8(feh, "whippang"); +		} +				 +		dp.unpackS32(size, "partsize"); +		//skip LLPartData block +		for (U32 i = 0; i < size; ++i) +		{ +			dp.unpackU8(feh, "whippang"); +		} +		return FALSE; +	} + +	unpackSystem(dp); +	 +	return mPartData.unpack(dp); +} +  std::ostream& operator<<(std::ostream& s, const LLPartSysData &data)  {  	s << "Flags: " << std::hex << data.mFlags; @@ -253,7 +330,7 @@ std::ostream& operator<<(std::ostream& s, const LLPartSysData &data)  BOOL LLPartSysData::isNullPS(const S32 block_num)  { -	U8 ps_data_block[PS_DATA_BLOCK_SIZE]; +	U8 ps_data_block[PS_MAX_DATA_BLOCK_SIZE];  	U32 crc;  	S32 size; @@ -264,14 +341,28 @@ BOOL LLPartSysData::isNullPS(const S32 block_num)  	{  		return TRUE;  	} -	else if (size != PS_DATA_BLOCK_SIZE) +	 +	if (size > PS_MAX_DATA_BLOCK_SIZE)  	{ -		llwarns << "PSBlock is wrong size for particle system data - got " << size << ", expecting " << PS_DATA_BLOCK_SIZE << llendl; +		//size is too big, newer particle version unsupported  		return TRUE;  	} -	gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, PS_DATA_BLOCK_SIZE, block_num, PS_DATA_BLOCK_SIZE); -	LLDataPackerBinaryBuffer dp(ps_data_block, PS_DATA_BLOCK_SIZE); +	gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, size, block_num, PS_MAX_DATA_BLOCK_SIZE); + +	LLDataPackerBinaryBuffer dp(ps_data_block, size); +	if (size > PS_LEGACY_DATA_BLOCK_SIZE) +	{ +		// non legacy systems pack a size before the CRC +		S32 tmp = 0; +		dp.unpackS32(tmp, "syssize"); + +		if (tmp > PS_SYS_DATA_BLOCK_SIZE) +		{ //unknown system data block size, don't know how to parse it, treat as NULL +			return TRUE; +		} +	} +  	dp.unpackU32(crc, "crc");  	if (crc == 0) @@ -281,50 +372,37 @@ BOOL LLPartSysData::isNullPS(const S32 block_num)  	return FALSE;  } - -//static -BOOL LLPartSysData::packNull() -{ -	U8 ps_data_block[PS_DATA_BLOCK_SIZE]; -	gMessageSystem->addBinaryData("PSBlock", ps_data_block, 0); -	return TRUE; -} - - -BOOL LLPartSysData::packBlock() -{ -	U8 ps_data_block[PS_DATA_BLOCK_SIZE]; - -	LLDataPackerBinaryBuffer dp(ps_data_block, PS_DATA_BLOCK_SIZE); -	pack(dp); - -	// Add to message -	gMessageSystem->addBinaryData("PSBlock", ps_data_block, PS_DATA_BLOCK_SIZE); - -	return TRUE; -}                                          - -  BOOL LLPartSysData::unpackBlock(const S32 block_num)  { -	U8 ps_data_block[PS_DATA_BLOCK_SIZE]; +	U8 ps_data_block[PS_MAX_DATA_BLOCK_SIZE];  	// Check size of block  	S32 size = gMessageSystem->getSize("ObjectData", block_num, "PSBlock"); -	if (size != PS_DATA_BLOCK_SIZE) +	if (size > PS_MAX_DATA_BLOCK_SIZE)  	{ -		llwarns << "PSBlock is wrong size for particle system data - got " << size << ", expecting " << PS_DATA_BLOCK_SIZE << llendl; +		// Larger packets are newer and unsupported  		return FALSE;  	}  	// Get from message -	gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, PS_DATA_BLOCK_SIZE, block_num, PS_DATA_BLOCK_SIZE); +	gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, size, block_num, PS_MAX_DATA_BLOCK_SIZE); -	LLDataPackerBinaryBuffer dp(ps_data_block, PS_DATA_BLOCK_SIZE); -	unpack(dp); +	LLDataPackerBinaryBuffer dp(ps_data_block, size); -	return TRUE; +	if (size == PS_LEGACY_DATA_BLOCK_SIZE) +	{ +		return unpackLegacy(dp); +	} +	else +	{ +		return unpack(dp); +	} +} + +bool LLPartSysData::isLegacyCompatible() const +{ +	return !mPartData.hasGlow() && !mPartData.hasBlendFunc();  }  void LLPartSysData::clampSourceParticleRate() diff --git a/indra/llmessage/llpartdata.h b/indra/llmessage/llpartdata.h index a4ef058b30..ed5c1a6ac7 100755 --- a/indra/llmessage/llpartdata.h +++ b/indra/llmessage/llpartdata.h @@ -70,7 +70,12 @@ enum LLPSScriptFlags  	LLPS_SRC_TARGET_UUID,  	LLPS_SRC_OMEGA,  	LLPS_SRC_ANGLE_BEGIN, -	LLPS_SRC_ANGLE_END +	LLPS_SRC_ANGLE_END, + +	LLPS_PART_BLEND_FUNC_SOURCE, +	LLPS_PART_BLEND_FUNC_DEST, +	LLPS_PART_START_GLOW, +	LLPS_PART_END_GLOW  }; @@ -83,11 +88,13 @@ public:  		mParameter(0.f)  	{  	} +	BOOL unpackLegacy(LLDataPacker &dp);  	BOOL unpack(LLDataPacker &dp); +  	BOOL pack(LLDataPacker &dp); -	LLSD asLLSD() const; -	operator LLSD() const {return asLLSD(); } -	bool fromLLSD(LLSD& sd); +	 +	bool hasGlow() const; +	bool hasBlendFunc() const;  	// Masks for the different particle flags  	enum @@ -102,17 +109,39 @@ public:  		LL_PART_TARGET_LINEAR_MASK =	0x80,		// Particle uses a direct linear interpolation  		LL_PART_EMISSIVE_MASK =			0x100,		// Particle is "emissive", instead of being lit  		LL_PART_BEAM_MASK =				0x200,		// Particle is a "beam" connecting source and target +		LL_PART_RIBBON_MASK =			0x400,		// Particles are joined together into one continuous triangle strip  		// Not implemented yet!  		//LL_PART_RANDOM_ACCEL_MASK =		0x100,		// Particles have random acceleration  		//LL_PART_RANDOM_VEL_MASK =		0x200,		// Particles have random velocity shifts"  		//LL_PART_TRAIL_MASK =			0x400,		// Particles have historical "trails" +		//sYSTEM SET FLAGS +		LL_PART_DATA_GLOW =				0x10000, +		LL_PART_DATA_BLEND =			0x20000, +  		// Viewer side use only!  		LL_PART_HUD =					0x40000000,  		LL_PART_DEAD_MASK =				0x80000000,  	}; +	enum +	{ +		LL_PART_BF_ONE = 0, +		LL_PART_BF_ZERO = 1, +		LL_PART_BF_DEST_COLOR = 2, +		LL_PART_BF_SOURCE_COLOR = 3, +		LL_PART_BF_ONE_MINUS_DEST_COLOR = 4, +		LL_PART_BF_ONE_MINUS_SOURCE_COLOR = 5, +		UNSUPPORTED_DEST_ALPHA = 6, +		LL_PART_BF_SOURCE_ALPHA = 7, +		UNSUPPORTED_ONE_MINUS_DEST_ALPHA = 8, +		LL_PART_BF_ONE_MINUS_SOURCE_ALPHA = 9, +		LL_PART_BF_COUNT = 10 +	}; + +	static bool validBlendFunc(S32 func); +  	void setFlags(const U32 flags);  	void setMaxAge(const F32 max_age);  	void setStartScale(const F32 xs, F32 ys); @@ -126,6 +155,9 @@ public:  	friend class LLPartSysData;  	friend class LLViewerPartSourceScript; +private: +	S32 getSize() const; +  	// These are public because I'm really lazy...  public:  	U32					mFlags;						// Particle state/interpolators in effect @@ -137,6 +169,12 @@ public:  	LLVector3			mPosOffset;					// Offset from source if using FOLLOW_SOURCE  	F32					mParameter;					// A single floating point parameter + +	F32					mStartGlow; +	F32					mEndGlow; +	 +	U8					mBlendFuncSource; +	U8					mBlendFuncDest;  }; @@ -146,15 +184,13 @@ public:  	LLPartSysData();  	BOOL unpack(LLDataPacker &dp); -	BOOL pack(LLDataPacker &dp); - -	 +	BOOL unpackLegacy(LLDataPacker &dp);  	BOOL unpackBlock(const S32 block_num); -	BOOL packBlock(); - -	static BOOL packNull(); +		  	static BOOL isNullPS(const S32 block_num); // Returns FALSE if this is a "NULL" particle system (i.e. no system) +	bool isLegacyCompatible() const; +  	// Different masks for effects on the source  	enum  	{ @@ -187,7 +223,12 @@ public:  	void clampSourceParticleRate();  	friend std::ostream&	 operator<<(std::ostream& s, const LLPartSysData &data);		// Stream a + +	S32 getdataBlockSize() const; +private: +	BOOL unpackSystem(LLDataPacker &dp); +  public:  	// Public because I'm lazy.... diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp index 034680caf8..38b743fb75 100755 --- a/indra/llmessage/lltransfermanager.cpp +++ b/indra/llmessage/lltransfermanager.cpp @@ -606,16 +606,21 @@ void LLTransferManager::processTransferAbort(LLMessageSystem *msgp, void **)  void LLTransferManager::reliablePacketCallback(void **user_data, S32 result)  {  	LLUUID *transfer_idp = (LLUUID *)user_data; -	if (result) +	if (result && +		transfer_idp != NULL)  	{ -		llwarns << "Aborting reliable transfer " << *transfer_idp << " due to failed reliable resends!" << llendl;  		LLTransferSource *tsp = gTransferManager.findTransferSource(*transfer_idp);  		if (tsp)  		{ +			llwarns << "Aborting reliable transfer " << *transfer_idp << " due to failed reliable resends!" << llendl;  			LLTransferSourceChannel *tscp = tsp->mChannelp;  			tsp->abortTransfer();  			tscp->deleteTransfer(tsp);  		} +		else +		{ +			llwarns << "Aborting reliable transfer " << *transfer_idp << " but can't find the LLTransferSource object" << llendl; +		}  	}  	delete transfer_idp;  } @@ -892,22 +897,26 @@ LLTransferSource *LLTransferSourceChannel::findTransferSource(const LLUUID &tran  } -BOOL LLTransferSourceChannel::deleteTransfer(LLTransferSource *tsp) +void LLTransferSourceChannel::deleteTransfer(LLTransferSource *tsp)  { - -	LLPriQueueMap<LLTransferSource *>::pqm_iter iter; -	for (iter = mTransferSources.mMap.begin(); iter != mTransferSources.mMap.end(); iter++) +	if (tsp)  	{ -		if (iter->second == tsp) +		LLPriQueueMap<LLTransferSource *>::pqm_iter iter; +		for (iter = mTransferSources.mMap.begin(); iter != mTransferSources.mMap.end(); iter++)  		{ -			delete tsp; -			mTransferSources.mMap.erase(iter); -			return TRUE; +			if (iter->second == tsp) +			{ +				delete tsp; +				mTransferSources.mMap.erase(iter); +				return; +			}  		} -	} -	llerrs << "Unable to find transfer source to delete!" << llendl; -	return FALSE; +		llwarns << "Unable to find transfer source id "  +			<< tsp->getID() +			<< " to delete!"  +			<< llendl; +	}  } @@ -1008,21 +1017,26 @@ LLTransferTarget *LLTransferTargetChannel::findTransferTarget(const LLUUID &tran  } -BOOL LLTransferTargetChannel::deleteTransfer(LLTransferTarget *ttp) +void LLTransferTargetChannel::deleteTransfer(LLTransferTarget *ttp)  { -	tt_iter iter; -	for (iter = mTransferTargets.begin(); iter != mTransferTargets.end(); iter++) +	if (ttp)  	{ -		if (*iter == ttp) +		tt_iter iter; +		for (iter = mTransferTargets.begin(); iter != mTransferTargets.end(); iter++)  		{ -			delete ttp; -			mTransferTargets.erase(iter); -			return TRUE; +			if (*iter == ttp) +			{ +				delete ttp; +				mTransferTargets.erase(iter); +				return; +			}  		} -	} -	llerrs << "Unable to find transfer target to delete!" << llendl; -	return FALSE; +		llwarns << "Unable to find transfer target id "  +			<< ttp->getID() +			<< " to delete!"  +			<< llendl; +	}  } diff --git a/indra/llmessage/lltransfermanager.h b/indra/llmessage/lltransfermanager.h index 252e05d1d1..6aad153c24 100755 --- a/indra/llmessage/lltransfermanager.h +++ b/indra/llmessage/lltransfermanager.h @@ -199,7 +199,7 @@ public:  	void				addTransferSource(LLTransferSource *sourcep);  	LLTransferSource	*findTransferSource(const LLUUID &transfer_id); -	BOOL				deleteTransfer(LLTransferSource *tsp); +	void				deleteTransfer(LLTransferSource *tsp);  	void					setThrottleID(const S32 throttle_id)	{ mThrottleID = throttle_id; } @@ -232,7 +232,7 @@ public:  						 const F32 priority);  	LLTransferTarget		*findTransferTarget(const LLUUID &transfer_id); -	BOOL					deleteTransfer(LLTransferTarget *ttp); +	void					deleteTransfer(LLTransferTarget *ttp);  	LLTransferChannelType	getChannelType() const		{ return mChannelType; } diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index de9e2fe294..683065357d 100755 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -150,16 +150,19 @@ std::string LLURLRequest::actionAsVerb(LLURLRequest::ERequestAction action)  	return VERBS[action];  } -LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action) : -	mAction(action) +LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, bool follow_redirects /* = true */) : +	mAction(action), +	mFollowRedirects(follow_redirects)  {  	initialize();  }  LLURLRequest::LLURLRequest(  	LLURLRequest::ERequestAction action, -	const std::string& url) : -	mAction(action) +	const std::string& url, +	bool follow_redirects /* = true */) : +	mAction(action), +	mFollowRedirects(follow_redirects)  {  	initialize();  	setURL(url); @@ -479,12 +482,18 @@ bool LLURLRequest::configure()  	case HTTP_HEAD:  		mDetail->mCurlRequest->setopt(CURLOPT_HEADER, 1);  		mDetail->mCurlRequest->setopt(CURLOPT_NOBODY, 1); -		mDetail->mCurlRequest->setopt(CURLOPT_FOLLOWLOCATION, 1); +		if (mFollowRedirects) +		{ +			mDetail->mCurlRequest->setopt(CURLOPT_FOLLOWLOCATION, 1); +		}  		rv = true;  		break;  	case HTTP_GET:  		mDetail->mCurlRequest->setopt(CURLOPT_HTTPGET, 1); -		mDetail->mCurlRequest->setopt(CURLOPT_FOLLOWLOCATION, 1); +		if (mFollowRedirects) +		{ +			mDetail->mCurlRequest->setopt(CURLOPT_FOLLOWLOCATION, 1); +		}  		// Set Accept-Encoding to allow response compression  		mDetail->mCurlRequest->setoptString(CURLOPT_ENCODING, ""); diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h index 44d358d906..20d6e30d17 100755 --- a/indra/llmessage/llurlrequest.h +++ b/indra/llmessage/llurlrequest.h @@ -95,7 +95,7 @@ public:  	 *  	 * @param action One of the ERequestAction enumerations.  	 */ -	LLURLRequest(ERequestAction action); +	LLURLRequest(ERequestAction action, bool follow_redirects = true);  	/**   	 * @brief Constructor. @@ -103,7 +103,7 @@ public:  	 * @param action One of the ERequestAction enumerations.  	 * @param url The url of the request. It should already be encoded.  	 */ -	LLURLRequest(ERequestAction action, const std::string& url); +	LLURLRequest(ERequestAction action, const std::string& url, bool follow_redirects = true);  	/**   	 * @brief Destructor. @@ -219,10 +219,11 @@ protected:  	};  	EState mState;  	ERequestAction mAction; +	bool mFollowRedirects;  	LLURLRequestDetail* mDetail;  	LLIOPipe::ptr_t mCompletionCallback; -	 S32 mRequestTransferedBytes; -	 S32 mResponseTransferedBytes; +	S32 mRequestTransferedBytes; +	S32 mResponseTransferedBytes;  	static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param); diff --git a/indra/llmessage/tests/llpartdata_test.cpp b/indra/llmessage/tests/llpartdata_test.cpp index 9123bd06c7..de81e0bbb2 100755 --- a/indra/llmessage/tests/llpartdata_test.cpp +++ b/indra/llmessage/tests/llpartdata_test.cpp @@ -38,10 +38,34 @@  namespace tut  { + +	//bunch of sniffed data that *should* be a valid particle system +	static U8 msg[] = {  +		0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,  +		0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x80, 0x00, 0x80,  +		0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x5e, 0x12, 0x0b, 0xa1, 0x58, 0x05, 0xdc, 0x57, 0x66,  +		0xb7, 0xf5, 0xac, 0x4b, 0xd1, 0x8f, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  +		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x05, 0x02, 0x00, 0x00, 0x0a, 0xff,  +		0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00,  +		0x00, 0x7e, 0xc6, 0x81, 0xdc, 0x7e, 0xc6, 0x81, 0xdc, 0x77, 0xcf, 0xef, 0xd4, 0xce, 0x64, 0x1a, 0x7e,  +		0x26, 0x87, 0x55, 0x7f, 0xdd, 0x65, 0x22, 0x7f, 0xdd, 0x65, 0x22, 0x7f, 0x77, 0xcf, 0x98, 0xa3, 0xab,  +		0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf2,  +		0xf1, 0x65, 0x32, 0x1b, 0xef, 0x18, 0x70, 0x66, 0xba, 0x30, 0xa0, 0x11, 0xaa, 0x2f, 0xb0, 0xab, 0xd0,  +		0x30, 0x7d, 0xbd, 0x01, 0x00, 0xf8, 0x0d, 0xb8, 0x30, 0x01, 0x00, 0x00, 0x00, 0xce, 0xc6, 0x81, 0xdc,  +		0xce, 0xc6, 0x81, 0xdc, 0xc7, 0xcf, 0xef, 0xd4, 0x75, 0x65, 0x1a, 0x7f, 0x62, 0x6f, 0x55, 0x7f, 0x6d,  +		0x65, 0x22, 0x7f, 0x6d, 0x65, 0x22, 0x7f, 0xc7, 0xcf, 0x98, 0xa3, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,  +		0xab, 0xab, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xf2, 0xf1, 0x62, 0x12, 0x1b, 0xef,  +		0x18, 0x7e, 0xbd, 0x01, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  +		0x00, 0x00, 0x00, 0x00, 0x7c, 0xac, 0x28, 0x03, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48,  +		0xe0, 0xb9, 0x30, 0x03, 0xe1, 0xb9, 0x30, 0xbb, 0x00, 0x00, 0x00, 0x48, 0xe0, 0xb9, 0x30, 0x36, 0xd9,  +		0x81, 0xdc, 0x36, 0xd9, 0x81, 0xdc, 0x3f, 0xd0, 0xef, 0xd4, 0xa5, 0x7a, 0x72, 0x7f, 0x26, 0x30, 0x55,  +		0x7f, 0x95, 0x7a, 0x22, 0x7f, 0x95, 0x7a, 0x22, 0x7f, 0x3f, 0xd0, 0x98, 0xa3, 0xab, 0xab, 0xab, 0xab,  +		0xab, 0xab, 0xab, 0xab, 0x00, 0x00, 0x00, 0x00, 0x00 };  	struct partdata_test  	{  	}; +  	typedef test_group<partdata_test> partdata_test_t;  	typedef partdata_test_t::object partdata_test_object_t;  	tut::partdata_test_t tut_partdata_test("LLPartData"); @@ -49,168 +73,82 @@ namespace tut  	template<> template<>  	void partdata_test_object_t::test<1>()  	{ -		LLPartData llpdata,llpdata1; -		U8 pkbuf[128]; - -		llpdata.setFlags(LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK | -		LLPartData::LL_PART_BOUNCE_MASK | LLPartData::LL_PART_WIND_MASK | LLPartData::LL_PART_FOLLOW_SRC_MASK | -		LLPartData::LL_PART_FOLLOW_VELOCITY_MASK | LLPartData::LL_PART_TARGET_POS_MASK | LLPartData::LL_PART_TARGET_LINEAR_MASK | -		LLPartData::LL_PART_EMISSIVE_MASK | LLPartData::LL_PART_BEAM_MASK | LLPartData::LL_PART_DEAD_MASK); - -		llpdata.setMaxAge(29.3f); - -		LLVector3 llvec1(1.0f, .5f, .25f); -		llpdata.setStartColor(llvec1); -		llpdata.setStartAlpha(.7f); - -		LLVector3 llvec2(.2f, .3f, 1.0f); -		llpdata.setEndColor(llvec2); -		llpdata.setEndAlpha(1.0f); +		LLPartSysData llpsysdata; +		LLDataPackerBinaryBuffer dp1(msg, sizeof(msg)); -		llpdata.setStartScale(3.23f, 4.0f); -		llpdata.setEndScale(2.4678f, 1.0f); +		ensure("LLPartSysData::unpack failed.", llpsysdata.unpack(dp1)); -		LLDataPackerBinaryBuffer dp((U8*)pkbuf, 128); -		llpdata.pack(dp); -		S32 cur_size = dp.getCurrentSize(); -		 -		LLDataPackerBinaryBuffer dp1((U8*)pkbuf, cur_size); -		llpdata1.unpack(dp1); - -		ensure("1.mFlags values are different after unpacking", llpdata1.mFlags == llpdata.mFlags); -		ensure_approximately_equals("2.mMaxAge values are different after unpacking", llpdata1.mMaxAge, llpdata.mMaxAge, 8); - -		ensure_approximately_equals("3.mStartColor[0] values are different after unpacking", llpdata1.mStartColor.mV[0], llpdata.mStartColor.mV[0], 8); -		ensure_approximately_equals("4.mStartColor[1] values are different after unpacking", llpdata1.mStartColor.mV[1], llpdata.mStartColor.mV[1], 8); -		ensure_approximately_equals("5.mStartColor[2] values are different after unpacking", llpdata1.mStartColor.mV[2], llpdata.mStartColor.mV[2], 8); -		ensure_approximately_equals("6.mStartColor[3] values are different after unpacking", llpdata1.mStartColor.mV[3], llpdata.mStartColor.mV[3], 8); - -		ensure_approximately_equals("7.mEndColor[0] values are different after unpacking", llpdata1.mEndColor.mV[0], llpdata.mEndColor.mV[0], 8); -		ensure_approximately_equals("8.mEndColor[1] values are different after unpacking", llpdata1.mEndColor.mV[1], llpdata.mEndColor.mV[1], 8); -		ensure_approximately_equals("9.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[2], llpdata.mEndColor.mV[2], 8); -		ensure_approximately_equals("10.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[3], llpdata.mEndColor.mV[3], 8); - -		ensure_approximately_equals("11.mStartScale[0] values are different after unpacking", llpdata1.mStartScale.mV[0], llpdata.mStartScale.mV[0], 5); -		ensure_approximately_equals("12.mStartScale[1] values are different after unpacking", llpdata1.mStartScale.mV[1], llpdata.mStartScale.mV[1], 5); - -		ensure_approximately_equals("13.mEndScale[0] values are different after unpacking", llpdata1.mEndScale.mV[0], llpdata.mEndScale.mV[0], 5); -		ensure_approximately_equals("14.mEndScale[1] values are different after unpacking", llpdata1.mEndScale.mV[1], llpdata.mEndScale.mV[1], 5); -	} - - -	template<> template<> -	void partdata_test_object_t::test<2>() -	{ -		LLPartData llpdata,llpdata1; - -		llpdata.setFlags(LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK | -		LLPartData::LL_PART_BOUNCE_MASK | LLPartData::LL_PART_WIND_MASK | LLPartData::LL_PART_FOLLOW_SRC_MASK | -		LLPartData::LL_PART_FOLLOW_VELOCITY_MASK | LLPartData::LL_PART_TARGET_POS_MASK | LLPartData::LL_PART_TARGET_LINEAR_MASK | -		LLPartData::LL_PART_EMISSIVE_MASK | LLPartData::LL_PART_BEAM_MASK | LLPartData::LL_PART_DEAD_MASK); -		 -		llpdata.setMaxAge(29.3f); - -		LLVector3 llvec1(1.0f, .5f, .25f); -		llpdata.setStartColor(llvec1); -		llpdata.setStartAlpha(.7f); - -		LLVector3 llvec2(.2f, .3f, 1.0f); -		llpdata.setEndColor(llvec2); -		llpdata.setEndAlpha(1.0f); - -		llpdata.setStartScale(3.23f, 4.0f); -		llpdata.setEndScale(2.4678f, 1.0f); - -		LLSD llsd = llpdata.asLLSD(); - -		llpdata1.fromLLSD(llsd); - -		ensure("1.mFlags values are different after unpacking", llpdata1.mFlags == llpdata.mFlags); -		ensure_approximately_equals("2.mMaxAge values are different after unpacking", llpdata1.mMaxAge, llpdata.mMaxAge, 8); - -		ensure_approximately_equals("3.mStartColor[0] values are different after unpacking", llpdata1.mStartColor.mV[0], llpdata.mStartColor.mV[0], 8); -		ensure_approximately_equals("4.mStartColor[1] values are different after unpacking", llpdata1.mStartColor.mV[1], llpdata.mStartColor.mV[1], 8); -		ensure_approximately_equals("5.mStartColor[2] values are different after unpacking", llpdata1.mStartColor.mV[2], llpdata.mStartColor.mV[2], 8); -		ensure_approximately_equals("6.mStartColor[3] values are different after unpacking", llpdata1.mStartColor.mV[3], llpdata.mStartColor.mV[3], 8); - -		ensure_approximately_equals("7.mEndColor[0] values are different after unpacking", llpdata1.mEndColor.mV[0], llpdata.mEndColor.mV[0], 8); -		ensure_approximately_equals("8.mEndColor[1] values are different after unpacking", llpdata1.mEndColor.mV[1], llpdata.mEndColor.mV[1], 8); -		ensure_approximately_equals("9.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[2], llpdata.mEndColor.mV[2], 8); -		ensure_approximately_equals("10.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[3], llpdata.mEndColor.mV[3], 8); - -		ensure_approximately_equals("11.mStartScale[0] values are different after unpacking", llpdata1.mStartScale.mV[0], llpdata.mStartScale.mV[0], 5); -		ensure_approximately_equals("12.mStartScale[1] values are different after unpacking", llpdata1.mStartScale.mV[1], llpdata.mStartScale.mV[1], 5); - -		ensure_approximately_equals("13.mEndScale[0] values are different after unpacking", llpdata1.mEndScale.mV[0], llpdata.mEndScale.mV[0], 5); -		ensure_approximately_equals("14.mEndScale[1] values are different after unpacking", llpdata1.mEndScale.mV[1], llpdata.mEndScale.mV[1], 5); -	} - - -//*********llpartsysdata*********** - -	template<> template<> -	void partdata_test_object_t::test<3>() -	{ -		LLPartSysData llpsysdata, llpsysdata1; -		U8 pkbuf[256]; -		llpsysdata.setBurstSpeedMin(33.33f); -		ensure("1.mBurstSpeedMin coudnt be set", 33.33f == llpsysdata.mBurstSpeedMin); - -		llpsysdata.setBurstSpeedMax(44.44f);  -		ensure("2.mBurstSpeedMax coudnt be set", 44.44f == llpsysdata.mBurstSpeedMax); - -		llpsysdata.setBurstRadius(45.55f); -		ensure("3.mBurstRadius coudnt be set", 45.55f == llpsysdata.mBurstRadius); - -		LLVector3 llvec(44.44f, 111.11f, -40.4f); -		llpsysdata.setPartAccel(llvec); - -		llpsysdata.mCRC = 0xFFFFFFFF; -		llpsysdata.mFlags = 0x20; - -		llpsysdata.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY; - -		llpsysdata.mMaxAge = 99.99f; -		llpsysdata.mStartAge = 18.5f; -		llpsysdata.mInnerAngle = 4.234f; -		llpsysdata.mOuterAngle = 7.123f; -		llpsysdata.mBurstRate  = 245.53f; -		llpsysdata.mBurstPartCount = 0xFF; -		llpsysdata.mAngularVelocity = llvec; - -		llpsysdata.mPartImageID.generate(); -		llpsysdata.mTargetUUID.generate(); +		//mCRC	1	unsigned int +		ensure("mCRC different after unpacking", llpsysdata.mCRC == (U32) 1); +		//mFlags	0	unsigned int +		ensure ("mFlags different after unpacking", llpsysdata.mFlags == (U32) 0); +		//mPattern	1 ''	unsigned char +		ensure ("mPattern different after unpacking", llpsysdata.mPattern == (U8) 1); +		//mInnerAngle	0.00000000	float +		ensure_approximately_equals("mInnerAngle different after unpacking", llpsysdata.mInnerAngle, 0.f, 8); +		//mOuterAngle	0.00000000	float +		ensure_approximately_equals("mOuterAngle different after unpacking", llpsysdata.mOuterAngle, 0.f, 8); +		//mAngularVelocity	0,0,0 +		ensure_approximately_equals("mAngularVelocity.mV[0] different after unpacking", llpsysdata.mAngularVelocity.mV[0], 0.f, 8); +		ensure_approximately_equals("mAngularVelocity.mV[0] different after unpacking", llpsysdata.mAngularVelocity.mV[1], 0.f, 8); +		ensure_approximately_equals("mAngularVelocity.mV[0] different after unpacking", llpsysdata.mAngularVelocity.mV[2], 0.f, 8); +		//mBurstRate	0.097656250	float +		ensure_approximately_equals("mBurstRate different after unpacking", llpsysdata.mBurstRate, 0.097656250f, 8); +		//mBurstPartCount	1 ''	unsigned char +		ensure("mBurstPartCount different after unpacking", llpsysdata.mBurstPartCount == (U8) 1); +		//mBurstRadius	0.00000000	float +		ensure_approximately_equals("mBurstRadius different after unpacking", llpsysdata.mBurstRadius, 0.f, 8); +		//mBurstSpeedMin	1.0000000	float +		ensure_approximately_equals("mBurstSpeedMin different after unpacking", llpsysdata.mBurstSpeedMin, 1.f, 8); +		//mBurstSpeedMax	1.0000000	float +		ensure_approximately_equals("mBurstSpeedMax different after unpacking", llpsysdata.mBurstSpeedMax, 1.f, 8); +		//mMaxAge	0.00000000	float +		ensure_approximately_equals("mMaxAge different after unpacking", llpsysdata.mMaxAge, 0.f, 8); +		//mStartAge	0.00000000	float +		ensure_approximately_equals("mStartAge different after unpacking", llpsysdata.mStartAge, 0.f, 8); +		//mPartAccel	<0,0,0> +		ensure_approximately_equals("mPartAccel.mV[0] different after unpacking", llpsysdata.mPartAccel.mV[0], 0.f, 7); +		ensure_approximately_equals("mPartAccel.mV[1] different after unpacking", llpsysdata.mPartAccel.mV[1], 0.f, 7); +		ensure_approximately_equals("mPartAccel.mV[2] different after unpacking", llpsysdata.mPartAccel.mV[2], 0.f, 7); + +		//mPartData +		LLPartData& data = llpsysdata.mPartData; + +		//mFlags	132354	unsigned int +		ensure ("mPartData.mFlags different after unpacking", data.mFlags == (U32) 132354); +		//mMaxAge	10.000000	float +		ensure_approximately_equals("mPartData.mMaxAge different after unpacking", data.mMaxAge, 10.f, 8);  +		//mStartColor	<1,1,1,1> +		ensure_approximately_equals("mPartData.mStartColor.mV[0] different after unpacking", data.mStartColor.mV[0], 1.f, 8); +		ensure_approximately_equals("mPartData.mStartColor.mV[1] different after unpacking", data.mStartColor.mV[1], 1.f, 8); +		ensure_approximately_equals("mPartData.mStartColor.mV[2] different after unpacking", data.mStartColor.mV[2], 1.f, 8); +		ensure_approximately_equals("mPartData.mStartColor.mV[3] different after unpacking", data.mStartColor.mV[3], 1.f, 8); +		//mEndColor	<1,1,0,0> +		ensure_approximately_equals("mPartData.mEndColor.mV[0] different after unpacking", data.mEndColor.mV[0], 1.f, 8); +		ensure_approximately_equals("mPartData.mEndColor.mV[1] different after unpacking", data.mEndColor.mV[1], 1.f, 8); +		ensure_approximately_equals("mPartData.mEndColor.mV[2] different after unpacking", data.mEndColor.mV[2], 0.f, 8); +		ensure_approximately_equals("mPartData.mEndColor.mV[3] different after unpacking", data.mEndColor.mV[3], 0.f, 8); +		//mStartScale	<1,1> +		ensure_approximately_equals("mPartData.mStartScale.mV[0] different after unpacking", data.mStartScale.mV[0], 1.f, 8); +		ensure_approximately_equals("mPartData.mStartScale.mV[1] different after unpacking", data.mStartScale.mV[1], 1.f, 8); +		//mEndScale	<0,0> +		ensure_approximately_equals("mPartData.mEndScale.mV[0] different after unpacking", data.mEndScale.mV[0], 0.f, 8); +		ensure_approximately_equals("mPartData.mEndScale.mV[1] different after unpacking", data.mEndScale.mV[1], 0.f, 8); +		//mPosOffset	<0,0,0> +		ensure_approximately_equals("mPartData.mPosOffset.mV[0] different after unpacking", data.mPosOffset.mV[0], 0.f, 8); +		ensure_approximately_equals("mPartData.mPosOffset.mV[1] different after unpacking", data.mPosOffset.mV[1], 0.f, 8); +		ensure_approximately_equals("mPartData.mPosOffset.mV[2] different after unpacking", data.mPosOffset.mV[2], 0.f, 8); +		//mParameter	0.00000000	float +		ensure_approximately_equals("mPartData.mParameter different after unpacking", data.mParameter, 0.f, 8); -		LLDataPackerBinaryBuffer dp((U8*)pkbuf, 256); -		llpsysdata.pack(dp); -		S32 cur_size = dp.getCurrentSize(); -		LLDataPackerBinaryBuffer dp1((U8*)pkbuf, cur_size); -		llpsysdata1.unpack(dp1); - -		ensure("1.mCRC's not equal", llpsysdata.mCRC == llpsysdata1.mCRC); -		ensure("2.mFlags's not equal", llpsysdata.mFlags == llpsysdata1.mFlags); -		ensure("3.mPattern's not equal", llpsysdata.mPattern == llpsysdata1.mPattern); -		ensure_approximately_equals("4.mMaxAge's not equal", llpsysdata.mMaxAge , llpsysdata1.mMaxAge, 8); -		ensure_approximately_equals("5.mStartAge's not equal", llpsysdata.mStartAge, llpsysdata1.mStartAge, 8); -		ensure_approximately_equals("6.mOuterAngle's not equal", llpsysdata.mOuterAngle, llpsysdata1.mOuterAngle, 5); -		ensure_approximately_equals("7.mInnerAngles's not equal", llpsysdata.mInnerAngle, llpsysdata1.mInnerAngle, 5); -		ensure_approximately_equals("8.mBurstRate's not equal", llpsysdata.mBurstRate, llpsysdata1.mBurstRate, 8); -		ensure("9.mBurstPartCount's not equal", llpsysdata.mBurstPartCount == llpsysdata1.mBurstPartCount); - -		ensure_approximately_equals("10.mBurstSpeedMin's not equal", llpsysdata.mBurstSpeedMin, llpsysdata1.mBurstSpeedMin, 8); -		ensure_approximately_equals("11.mBurstSpeedMax's not equal", llpsysdata.mBurstSpeedMax, llpsysdata1.mBurstSpeedMax, 8); - -		ensure_approximately_equals("12.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[0], llpsysdata1.mAngularVelocity.mV[0], 7); -		ensure_approximately_equals("13.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[1], llpsysdata1.mAngularVelocity.mV[1], 7); -		ensure_approximately_equals("14.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[2], llpsysdata1.mAngularVelocity.mV[2], 7); -			 -		ensure_approximately_equals("15.mPartAccel's not equal", llpsysdata.mPartAccel.mV[0], llpsysdata1.mPartAccel.mV[0], 7); -		ensure_approximately_equals("16.mPartAccel's not equal", llpsysdata.mPartAccel.mV[1], llpsysdata1.mPartAccel.mV[1], 7); -		ensure_approximately_equals("17.mPartAccel's not equal", llpsysdata.mPartAccel.mV[2], llpsysdata1.mPartAccel.mV[2], 7); - -		ensure("18.mPartImageID's not equal", llpsysdata.mPartImageID == llpsysdata1.mPartImageID); -		ensure("19.mTargetUUID's not equal", llpsysdata.mTargetUUID == llpsysdata1.mTargetUUID); -		ensure_approximately_equals("20.mBurstRadius's not equal", llpsysdata.mBurstRadius, llpsysdata1.mBurstRadius, 8); +		//mStartGlow	0.00000000	float +		ensure_approximately_equals("mPartData.mStartGlow different after unpacking", data.mStartGlow, 0.f, 8); +		//mEndGlow	0.00000000	float +		ensure_approximately_equals("mPartData.mEndGlow different after unpacking", data.mEndGlow, 0.f, 8); +		//mBlendFuncSource	2 ''	unsigned char +		ensure("mPartData.mBlendFuncSource different after unpacking", data.mBlendFuncSource == (U8) 2); +		//mBlendFuncDest	1 ''	unsigned char  +		ensure("mPartData.mBlendFuncDest different after unpacking", data.mBlendFuncDest == (U8) 1);  	}  } | 
