Bug 825627, part 1: Make nsUrlClassifierDBService.cpp's "gethashNoise" & "aCount" variables as unsigned, since counts are unsigned by definition. r=gcp

This commit is contained in:
Daniel Holbert 2013-01-02 09:05:19 -08:00
parent df741f9977
commit d056e13800
3 changed files with 13 additions and 13 deletions

View File

@ -778,7 +778,7 @@ Classifier::GetLookupCache(const nsACString& aTable)
nsresult
Classifier::ReadNoiseEntries(const Prefix& aPrefix,
const nsACString& aTableName,
int32_t aCount,
uint32_t aCount,
PrefixArray* aNoiseEntries)
{
LookupCache *cache = GetLookupCache(aTableName);

View File

@ -67,7 +67,7 @@ public:
*/
nsresult ReadNoiseEntries(const Prefix& aPrefix,
const nsACString& aTableName,
int32_t aCount,
uint32_t aCount,
PrefixArray* aNoiseEntries);
private:
void DropStores();

View File

@ -116,7 +116,7 @@ public:
NS_DECL_NSIURLCLASSIFIERDBSERVICE
NS_DECL_NSIURLCLASSIFIERDBSERVICEWORKER
nsresult Init(int32_t gethashNoise, nsCOMPtr<nsIFile> aCacheDir,
nsresult Init(uint32_t aGethashNoise, nsCOMPtr<nsIFile> aCacheDir,
bool aPerClientRandomize);
// Queue a lookup for the worker to perform, called in the main thread.
@ -150,7 +150,7 @@ private:
nsresult AddNoise(const Prefix aPrefix,
const nsCString tableName,
int32_t aCount,
uint32_t aCount,
LookupResultArray& results);
nsCOMPtr<nsICryptoHash> mCryptoHash;
@ -184,7 +184,7 @@ private:
uint32_t mHashKey;
// The number of noise entries to add to the set of lookup results.
int32_t mGethashNoise;
uint32_t mGethashNoise;
// Randomize clients with a key or not.
bool mPerClientRandomize;
@ -224,11 +224,11 @@ nsUrlClassifierDBServiceWorker::~nsUrlClassifierDBServiceWorker()
}
nsresult
nsUrlClassifierDBServiceWorker::Init(int32_t gethashNoise,
nsUrlClassifierDBServiceWorker::Init(uint32_t aGethashNoise,
nsCOMPtr<nsIFile> aCacheDir,
bool aPerClientRandomize)
{
mGethashNoise = gethashNoise;
mGethashNoise = aGethashNoise;
mCacheDir = aCacheDir;
mPerClientRandomize = aPerClientRandomize;
@ -357,7 +357,7 @@ nsUrlClassifierDBServiceWorker::HandlePendingLookups()
nsresult
nsUrlClassifierDBServiceWorker::AddNoise(const Prefix aPrefix,
const nsCString tableName,
int32_t aCount,
uint32_t aCount,
LookupResultArray& results)
{
if (aCount < 1) {
@ -1129,7 +1129,7 @@ nsUrlClassifierDBService::Init()
// Should we check document loads for malware URIs?
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
int32_t gethashNoise = 0;
uint32_t gethashNoise = 0;
if (prefs) {
bool tmpbool;
rv = prefs->GetBoolPref(CHECK_MALWARE_PREF, &tmpbool);
@ -1142,9 +1142,10 @@ nsUrlClassifierDBService::Init()
prefs->AddObserver(CHECK_PHISHING_PREF, this, false);
if (NS_FAILED(prefs->GetIntPref(GETHASH_NOISE_PREF, &gethashNoise))) {
gethashNoise = GETHASH_NOISE_DEFAULT;
}
int32_t tmpint;
rv = prefs->GetIntPref(GETHASH_NOISE_PREF, &tmpint);
gethashNoise = (NS_SUCCEEDED(rv) && tmpint >= 0) ?
static_cast<uint32_t>(tmpint) : GETHASH_NOISE_DEFAULT;
nsXPIDLCString tmpstr;
if (NS_SUCCEEDED(prefs->GetCharPref(GETHASH_TABLES_PREF, getter_Copies(tmpstr)))) {
@ -1153,7 +1154,6 @@ nsUrlClassifierDBService::Init()
prefs->AddObserver(GETHASH_TABLES_PREF, this, false);
int32_t tmpint;
rv = prefs->GetIntPref(CONFIRM_AGE_PREF, &tmpint);
PR_ATOMIC_SET(&gFreshnessGuarantee, NS_SUCCEEDED(rv) ? tmpint : CONFIRM_AGE_DEFAULT_SEC);