From 7b9da4eeda7505162f37cbfa52591f7adff032e7 Mon Sep 17 00:00:00 2001
From: Monty Brandenberg <monty@lindenlab.com>
Date: Fri, 1 Jun 2012 17:23:51 -0400
Subject: [PATCH] Missed two instances of priority typed as 'float'.  Became an
 excuse to go through an use a typedef for priority and policy class id.

---
 indra/llcorehttp/_httpoperation.h       | 13 ++++++-------
 indra/llcorehttp/_httpoprequest.cpp     |  8 ++++----
 indra/llcorehttp/_httpoprequest.h       | 12 ++++++------
 indra/llcorehttp/_httpopsetpriority.cpp |  2 +-
 indra/llcorehttp/_httpopsetpriority.h   | 10 +++++-----
 indra/llcorehttp/_httppolicy.cpp        |  2 +-
 indra/llcorehttp/_httppolicy.h          |  2 +-
 indra/llcorehttp/_httpservice.cpp       |  2 +-
 indra/llcorehttp/_httpservice.h         |  3 ++-
 indra/llcorehttp/httprequest.cpp        | 18 +++++++++---------
 indra/llcorehttp/httprequest.h          | 20 ++++++++++++--------
 11 files changed, 48 insertions(+), 44 deletions(-)

diff --git a/indra/llcorehttp/_httpoperation.h b/indra/llcorehttp/_httpoperation.h
index 6c0c3183b74..4d9298d8010 100644
--- a/indra/llcorehttp/_httpoperation.h
+++ b/indra/llcorehttp/_httpoperation.h
@@ -29,7 +29,7 @@
 
 
 #include "httpcommon.h"
-
+#include "httprequest.h"
 #include "_refcounted.h"
 
 
@@ -39,7 +39,6 @@ namespace LLCore
 class HttpReplyQueue;
 class HttpHandler;
 class HttpService;
-class HttpRequest;
 
 /// HttpOperation is the base class for all request/reply
 /// pairs.
@@ -102,13 +101,13 @@ class HttpOperation : public LLCoreInt::RefCounted
 	void addAsReply();
 	
 protected:
-	HttpReplyQueue *	mReplyQueue;					// Have refcount
-	HttpHandler *		mLibraryHandler;				// Have refcount
-	HttpHandler *		mUserHandler;					// Have refcount
+	HttpReplyQueue *			mReplyQueue;			// Have refcount
+	HttpHandler *				mLibraryHandler;		// Have refcount
+	HttpHandler *				mUserHandler;			// Have refcount
 
 public:
-	unsigned int		mReqPolicy;
-	unsigned int		mReqPriority;
+	HttpRequest::policy_t		mReqPolicy;
+	HttpRequest::priority_t		mReqPriority;
 	
 };  // end class HttpOperation
 
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index 54b9990057d..791ee5f8600 100644
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -233,8 +233,8 @@ HttpStatus HttpOpRequest::cancel()
 }
 
 
-HttpStatus HttpOpRequest::setupGetByteRange(unsigned int policy_id,
-											float priority,
+HttpStatus HttpOpRequest::setupGetByteRange(HttpRequest::policy_t policy_id,
+											HttpRequest::priority_t priority,
 											const std::string & url,
 											size_t offset,
 											size_t len,
@@ -268,8 +268,8 @@ HttpStatus HttpOpRequest::setupGetByteRange(unsigned int policy_id,
 }
 
 
-HttpStatus HttpOpRequest::setupPost(unsigned int policy_id,
-									float priority,
+HttpStatus HttpOpRequest::setupPost(HttpRequest::policy_t policy_id,
+									HttpRequest::priority_t priority,
 									const std::string & url,
 									BufferArray * body,
 									HttpOptions * options,
diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h
index 7efed0b1d96..e973f6ad26a 100644
--- a/indra/llcorehttp/_httpoprequest.h
+++ b/indra/llcorehttp/_httpoprequest.h
@@ -30,10 +30,10 @@
 
 #include "linden_common.h"		// Modifies curl/curl.h interfaces
 
-#include "httpcommon.h"
-
 #include <curl/curl.h>
 
+#include "httpcommon.h"
+#include "httprequest.h"
 #include "_httpoperation.h"
 #include "_refcounted.h"
 
@@ -76,16 +76,16 @@ class HttpOpRequest : public HttpOperation
 			
 public:
 	// Setup Methods
-	HttpStatus setupGetByteRange(unsigned int policy_id,
-								 float priority,
+	HttpStatus setupGetByteRange(HttpRequest::policy_t policy_id,
+								 HttpRequest::priority_t priority,
 								 const std::string & url,
 								 size_t offset,
 								 size_t len,
 								 HttpOptions * options,
 								 HttpHeaders * headers);
 	
-	HttpStatus setupPost(unsigned int policy_id,
-						 float priority,
+	HttpStatus setupPost(HttpRequest::policy_t policy_id,
+						 HttpRequest::priority_t priority,
 						 const std::string & url,
 						 BufferArray * body,
 						 HttpOptions * options,
diff --git a/indra/llcorehttp/_httpopsetpriority.cpp b/indra/llcorehttp/_httpopsetpriority.cpp
index dc609421edf..b0ee577087b 100644
--- a/indra/llcorehttp/_httpopsetpriority.cpp
+++ b/indra/llcorehttp/_httpopsetpriority.cpp
@@ -35,7 +35,7 @@ namespace LLCore
 {
 
 
-HttpOpSetPriority::HttpOpSetPriority(HttpHandle handle, unsigned int priority)
+HttpOpSetPriority::HttpOpSetPriority(HttpHandle handle, HttpRequest::priority_t priority)
 	: HttpOperation(),
 	  mHandle(handle),
 	  mPriority(priority)
diff --git a/indra/llcorehttp/_httpopsetpriority.h b/indra/llcorehttp/_httpopsetpriority.h
index e5d8e5fc1f2..b972f50fff0 100644
--- a/indra/llcorehttp/_httpopsetpriority.h
+++ b/indra/llcorehttp/_httpopsetpriority.h
@@ -29,7 +29,7 @@
 
 
 #include "httpcommon.h"
-
+#include "httprequest.h"
 #include "_httpoperation.h"
 #include "_refcounted.h"
 
@@ -46,7 +46,7 @@ namespace LLCore
 class HttpOpSetPriority : public HttpOperation
 {
 public:
-	HttpOpSetPriority(HttpHandle handle, unsigned int priority);
+	HttpOpSetPriority(HttpHandle handle, HttpRequest::priority_t priority);
 	virtual ~HttpOpSetPriority();
 
 private:
@@ -59,9 +59,9 @@ class HttpOpSetPriority : public HttpOperation
 	virtual void visitNotifier(HttpRequest * request);
 
 protected:
-	HttpStatus			mStatus;
-	HttpHandle			mHandle;
-	unsigned int		mPriority;
+	HttpStatus					mStatus;
+	HttpHandle					mHandle;
+	HttpRequest::priority_t		mPriority;
 }; // end class HttpOpSetPriority
 
 }  // end namespace LLCore
diff --git a/indra/llcorehttp/_httppolicy.cpp b/indra/llcorehttp/_httppolicy.cpp
index 873b519c51a..1d28f23d563 100644
--- a/indra/llcorehttp/_httppolicy.cpp
+++ b/indra/llcorehttp/_httppolicy.cpp
@@ -112,7 +112,7 @@ HttpService::ELoopSpeed HttpPolicy::processReadyQueue()
 }
 
 
-bool HttpPolicy::changePriority(HttpHandle handle, unsigned int priority)
+bool HttpPolicy::changePriority(HttpHandle handle, HttpRequest::priority_t priority)
 {
 	for (int policy_class(0); policy_class < HttpRequest::POLICY_CLASS_LIMIT; ++policy_class)
 	{
diff --git a/indra/llcorehttp/_httppolicy.h b/indra/llcorehttp/_httppolicy.h
index c5e82d0a658..2bc03c531fb 100644
--- a/indra/llcorehttp/_httppolicy.h
+++ b/indra/llcorehttp/_httppolicy.h
@@ -67,7 +67,7 @@ class HttpPolicy
 	void addOp(HttpOpRequest *);
 
 	// Shadows HttpService's method
-	bool changePriority(HttpHandle handle, unsigned int priority);
+	bool changePriority(HttpHandle handle, HttpRequest::priority_t priority);
 	
 protected:
 	int					mReadyInClass[HttpRequest::POLICY_CLASS_LIMIT];
diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp
index 48884ca0602..337493ca12b 100644
--- a/indra/llcorehttp/_httpservice.cpp
+++ b/indra/llcorehttp/_httpservice.cpp
@@ -152,7 +152,7 @@ void HttpService::stopRequested()
 	mExitRequested = true;
 }
 
-bool HttpService::changePriority(HttpHandle handle, unsigned int priority)
+bool HttpService::changePriority(HttpHandle handle, HttpRequest::priority_t priority)
 {
 	bool found(false);
 
diff --git a/indra/llcorehttp/_httpservice.h b/indra/llcorehttp/_httpservice.h
index 3e5a5457d7d..095316c8a77 100644
--- a/indra/llcorehttp/_httpservice.h
+++ b/indra/llcorehttp/_httpservice.h
@@ -29,6 +29,7 @@
 
 
 #include "httpcommon.h"
+#include "httprequest.h"
 
 
 namespace LLCoreInt
@@ -145,7 +146,7 @@ class HttpService
 	/// @return			True if the request was found somewhere.
 	///
 	/// Threading:  callable by worker thread.
-	bool changePriority(HttpHandle handle, unsigned int priority);
+	bool changePriority(HttpHandle handle, HttpRequest::priority_t priority);
 	
 	HttpPolicy * getPolicy()
 		{
diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp
index a06b859a912..0e512d97ed5 100644
--- a/indra/llcorehttp/httprequest.cpp
+++ b/indra/llcorehttp/httprequest.cpp
@@ -83,7 +83,7 @@ class HttpRequest::InternalHandler : public HttpHandler
 // ====================================
 
 
-unsigned int HttpRequest::sNextPolicyID(1);
+HttpRequest::policy_t HttpRequest::sNextPolicyID(1);
 
 
 HttpRequest::HttpRequest()
@@ -133,15 +133,15 @@ HttpStatus HttpRequest::setPolicyGlobalOption(EGlobalPolicy opt, long value)
 }
 
 
-unsigned int HttpRequest::createPolicyClass()
+HttpRequest::policy_t HttpRequest::createPolicyClass()
 {
-	unsigned int policy_id = 1;
+	policy_t policy_id = 1;
 	
 	return policy_id;
 }
 
 
-HttpStatus HttpRequest::setPolicyClassOption(unsigned int policy_id,
+HttpStatus HttpRequest::setPolicyClassOption(policy_t policy_id,
 											 EClassPolicy opt,
 											 long value)
 {
@@ -162,8 +162,8 @@ HttpStatus HttpRequest::getStatus() const
 }
 
 
-HttpHandle HttpRequest::requestGetByteRange(unsigned int policy_id,
-											unsigned int priority,
+HttpHandle HttpRequest::requestGetByteRange(policy_t policy_id,
+											priority_t priority,
 											const std::string & url,
 											size_t offset,
 											size_t len,
@@ -191,8 +191,8 @@ HttpHandle HttpRequest::requestGetByteRange(unsigned int policy_id,
 }
 
 
-HttpHandle HttpRequest::requestPost(unsigned int policy_id,
-									unsigned int priority,
+HttpHandle HttpRequest::requestPost(policy_t policy_id,
+									priority_t priority,
 									const std::string & url,
 									BufferArray * body,
 									HttpOptions * options,
@@ -251,7 +251,7 @@ HttpHandle HttpRequest::requestNoOp(HttpHandler * user_handler)
 }
 
 
-HttpHandle HttpRequest::requestSetPriority(HttpHandle request, unsigned int priority,
+HttpHandle HttpRequest::requestSetPriority(HttpHandle request, priority_t priority,
 										   HttpHandler * handler)
 {
 	HttpStatus status;
diff --git a/indra/llcorehttp/httprequest.h b/indra/llcorehttp/httprequest.h
index e2ab9be5334..57d2da245b6 100644
--- a/indra/llcorehttp/httprequest.h
+++ b/indra/llcorehttp/httprequest.h
@@ -90,6 +90,10 @@ class HttpRequest
 	HttpRequest(const HttpRequest &);			// Disallowed
 	void operator=(const HttpRequest &);		// Disallowed		
 
+public:
+	typedef unsigned int policy_t;
+	typedef unsigned int priority_t;
+	
 public:
 	/// @name PolicyMethods
 	/// @{
@@ -125,7 +129,7 @@ class HttpRequest
 	///					the class in other methods.  If -1, an error
 	///					occurred and @see getStatus() may provide more
 	///					detail on the reason.
-	unsigned int createPolicyClass();
+	policy_t createPolicyClass();
 
 	enum EClassPolicy
 	{
@@ -149,7 +153,7 @@ class HttpRequest
 	/// @param opt				Enum of option to be set.
 	/// @param value			Desired value of option.
 	/// @return					Standard status code.
-	HttpStatus setPolicyClassOption(unsigned int policy_id,
+	HttpStatus setPolicyClassOption(policy_t policy_id,
 									EClassPolicy opt,
 									long value);
 
@@ -194,8 +198,8 @@ class HttpRequest
 	///							request could not be queued.  In the latter
 	///							case, @see getStatus() will return more info.
 	///
-	HttpHandle requestGetByteRange(unsigned int policy_id,
-								   unsigned int priority,
+	HttpHandle requestGetByteRange(policy_t policy_id,
+								   priority_t priority,
 								   const std::string & url,
 								   size_t offset,
 								   size_t len,
@@ -221,8 +225,8 @@ class HttpRequest
 	///							request could not be queued.  In the latter
 	///							case, @see getStatus() will return more info.
 	///
-	HttpHandle requestPost(unsigned int policy_id,
-						   unsigned int priority,
+	HttpHandle requestPost(policy_t policy_id,
+						   priority_t priority,
 						   const std::string & url,
 						   BufferArray * body,
 						   HttpOptions * options,
@@ -278,7 +282,7 @@ class HttpRequest
 	///							queued or LLCORE_HTTP_HANDLE_INVALID if the
 	///							request could not be queued.
 	///
-	HttpHandle requestSetPriority(HttpHandle request, unsigned int priority, HttpHandler * handler);
+	HttpHandle requestSetPriority(HttpHandle request, priority_t priority, HttpHandler * handler);
 
 	/// @}
 
@@ -345,7 +349,7 @@ class HttpRequest
 	/// Must be established before any threading is allowed to
 	/// start.
 	///
-	static unsigned int		sNextPolicyID;
+	static policy_t		sNextPolicyID;
 	
 	/// @}
 	// End Global State
-- 
GitLab