Bug 792581 - part 16: Replace LL_L2UI macro with uint32_t cast. r=ehsan

This commit is contained in:
Andrew Quartey 2012-10-12 13:29:11 -04:00
parent ea52f5f496
commit 6d6e443bea
13 changed files with 19 additions and 42 deletions

View File

@ -4110,7 +4110,7 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(uint32_t *aPosition)
{
WarnAboutLSProgressEvent(nsIDocument::ePosition);
// XXX can we change the iface?
LL_L2UI(*aPosition, mCurProgress);
*aPosition = uint32_t(mCurProgress);
return NS_OK;
}
@ -4118,7 +4118,7 @@ NS_IMETHODIMP nsXMLHttpProgressEvent::GetTotalSize(uint32_t *aTotalSize)
{
WarnAboutLSProgressEvent(nsIDocument::eTotalSize);
// XXX can we change the iface?
LL_L2UI(*aTotalSize, mMaxProgress);
*aTotalSize = uint32_t(mMaxProgress);
return NS_OK;
}

View File

@ -418,13 +418,13 @@ nsresult nsAutoConfig::evaluateLocalFile(nsIFile *file)
return rv;
int64_t fileSize;
uint32_t fs, amt=0;
file->GetFileSize(&fileSize);
LL_L2UI(fs, fileSize); // Converting 64 bit structure to unsigned int
uint32_t fs = fileSize; // Converting 64 bit structure to unsigned int
char *buf = (char *)PR_Malloc(fs * sizeof(char));
if (!buf)
return NS_ERROR_OUT_OF_MEMORY;
uint32_t amt = 0;
rv = inStr->Read(buf, fs, &amt);
if (NS_SUCCEEDED(rv)) {
EvaluateAdminConfigScript(buf, fs, nullptr, false,

View File

@ -770,8 +770,7 @@ mozJSComponentLoader::GlobalForLocation(nsIFile *aComponentFile,
// Make sure the file map is closed, no matter how we return.
FileMapAutoCloser mapCloser(map);
uint32_t fileSize32;
LL_L2UI(fileSize32, fileSize);
uint32_t fileSize32 = fileSize;
char *buf = static_cast<char*>(PR_MemMap(map, 0, fileSize32));
if (!buf) {

View File

@ -786,11 +786,8 @@ nsProtocolProxyService::SecondsSinceSessionStart()
LL_I2L(ups, PR_USEC_PER_SEC);
diff /= ups;
// convert to 32 bit value
uint32_t dsec;
LL_L2UI(dsec, diff);
return dsec;
// return converted 32 bit value
return uint32_t(diff);
}
void

View File

@ -45,13 +45,9 @@ CacheLogPrintPath(PRLogModuleLevel level, const char * format, nsIFile * item)
uint32_t
SecondsFromPRTime(PRTime prTime)
{
int64_t microSecondsPerSecond, intermediateResult;
uint32_t seconds;
int64_t microSecondsPerSecond;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
intermediateResult = prTime / microSecondsPerSecond;
LL_L2UI(seconds, intermediateResult);
return seconds;
return uint32_t(prTime / microSecondsPerSecond);
}

View File

@ -88,12 +88,9 @@ MoveCList(PRCList &from, PRCList &to)
static uint32_t
NowInMinutes()
{
PRTime now = PR_Now(), minutes, factor;
PRTime now = PR_Now(), factor;
LL_I2L(factor, 60 * PR_USEC_PER_SEC);
minutes = now / factor;
uint32_t result;
LL_L2UI(result, minutes);
return result;
return uint32_t(now / factor);
}
//----------------------------------------------------------------------------

View File

@ -352,9 +352,7 @@ int main(int argc, char **argv)
PumpEvents();
finish = PR_Now();
uint32_t totalTime32;
uint64_t totalTime64 = finish - start;
LL_L2UI(totalTime32, totalTime64);
uint32_t totalTime32 = uint32_t(finish - start);
printf("\n\n--------------------\nAll done:\nnum found:%d\nnum start:%d\n", numFound, numStart);

View File

@ -1012,7 +1012,7 @@ static int32_t kShift = 6;
// 3. The same anonymous resource gets requested, and refers
// to something completely different.
// 4. The serialization is read back in.
LL_L2UI(gCounter, PR_Now());
gCounter = uint32_t(PR_Now());
}
nsresult rv;

View File

@ -1385,7 +1385,6 @@ nsNSSComponent::DefineNextTimer()
{
PRTime nextFiring;
PRTime now = PR_Now();
uint64_t diff;
uint32_t interval;
uint32_t primaryDelay = CRL_AUTOUPDATE_DEFAULT_DELAY;
nsresult rv;
@ -1416,8 +1415,7 @@ nsNSSComponent::DefineNextTimer()
//Define the firing interval, from NOW
if ( now < nextFiring) {
diff = nextFiring - now;
LL_L2UI(interval, diff);
interval = uint32_t(nextFiring - now);
//Now, we are doing 32 operations - so, don't need LL_ functions...
interval = interval/PR_USEC_PER_MSEC;
}else {

View File

@ -111,7 +111,6 @@ showHelp(void)
uint32_t
ticks2xsec(tmreader * aReader, uint32_t aTicks, uint32_t aResolution)
{
uint32_t retval = 0;
uint64_t bigone;
uint64_t tmp64;
@ -120,8 +119,7 @@ ticks2xsec(tmreader * aReader, uint32_t aTicks, uint32_t aResolution)
bigone *= tmp64;
LL_UI2L(tmp64, aReader->ticksPerSec);
bigone /= tmp64;
LL_L2UI(retval, bigone);
return retval;
return (uint32)bigone;
}
#define ticks2msec(reader, ticks) ticks2xsec((reader), (ticks), 1000)

View File

@ -416,7 +416,6 @@ uint32_t ticks2xsec(tmreader* aReader, uint32_t aTicks, uint32_t aResolution)
** Convert platform specific ticks to second units
*/
{
uint32_t retval = 0;
uint64_t bigone;
uint64_t tmp64;
@ -425,8 +424,7 @@ uint32_t ticks2xsec(tmreader* aReader, uint32_t aTicks, uint32_t aResolution)
bigone *= tmp64;
LL_UI2L(tmp64, aReader->ticksPerSec);
bigone /= tmp64;
LL_L2UI(retval, bigone);
return retval;
return uint32(bigone);
}

View File

@ -532,7 +532,6 @@ uint32_t ticks2xsec(tmreader* aReader, uint32_t aTicks, uint32_t aResolution)
** Returns 0 on success.
*/
{
uint32_t retval = 0;
uint64_t bigone;
uint64_t tmp64;
@ -541,9 +540,7 @@ uint32_t ticks2xsec(tmreader* aReader, uint32_t aTicks, uint32_t aResolution)
bigone *= tmp64;
LL_UI2L(tmp64, aReader->ticksPerSec);
bigone /= tmp64;
LL_L2UI(retval, bigone);
return retval;
return (uint32_t)bigone;
}
#define ticks2msec(reader, ticks) ticks2xsec((reader), (ticks), 1000)

View File

@ -180,9 +180,8 @@ DataStruct::ReadCache(nsISupports** aData, uint32_t* aDataLen)
cacheFile->GetFileSize(&fileSize);
if (fileSize > max32)
return NS_ERROR_OUT_OF_MEMORY;
uint32_t size;
LL_L2UI(size, fileSize);
uint32_t size = uint32_t(fileSize);
// create new memory for the large clipboard data
nsAutoArrayPtr<char> data(new char[size]);
if ( !data )