Bug 785738 Part 3: use PRTime instead of int64_t where appropriate; r=ehsan

This commit is contained in:
Landry Breuil 2012-08-30 09:10:35 +02:00
parent e29b54c9f3
commit 038741989a
20 changed files with 38 additions and 38 deletions

View File

@ -494,7 +494,7 @@ nsDOMFileFile::GetMozFullPathInternal(nsAString &aFilename)
NS_IMETHODIMP NS_IMETHODIMP
nsDOMFileFile::GetLastModifiedDate(JSContext* cx, JS::Value *aLastModifiedDate) nsDOMFileFile::GetLastModifiedDate(JSContext* cx, JS::Value *aLastModifiedDate)
{ {
int64_t msecs; PRTime msecs;
mFile->GetLastModifiedTime(&msecs); mFile->GetLastModifiedTime(&msecs);
JSObject* date = JS_NewDateObjectMsec(cx, msecs); JSObject* date = JS_NewDateObjectMsec(cx, msecs);
if (date) { if (date) {

View File

@ -316,7 +316,7 @@ DeviceStorageFile::collectFilesInternal(nsTArray<nsRefPtr<DeviceStorageFile> > &
while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(f))) && f) { while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(f))) && f) {
int64_t msecs; PRTime msecs;
f->GetLastModifiedTime(&msecs); f->GetLastModifiedTime(&msecs);
if (msecs < aSince) { if (msecs < aSince) {

View File

@ -2004,7 +2004,7 @@ namespace {
int64_t GetPluginLastModifiedTime(const nsCOMPtr<nsIFile>& localfile) int64_t GetPluginLastModifiedTime(const nsCOMPtr<nsIFile>& localfile)
{ {
int64_t fileModTime = LL_ZERO; PRTime fileModTime = LL_ZERO;
#if defined(XP_MACOSX) #if defined(XP_MACOSX)
// On OS X the date of a bundle's "contents" (i.e. of its Info.plist file) // On OS X the date of a bundle's "contents" (i.e. of its Info.plist file)

View File

@ -1284,7 +1284,7 @@ bool imgLoader::ValidateEntry(imgCacheEntry *aEntry,
nsCOMPtr<nsIFile> theFile; nsCOMPtr<nsIFile> theFile;
rv = fileUrl->GetFile(getter_AddRefs(theFile)); rv = fileUrl->GetFile(getter_AddRefs(theFile));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
int64_t fileLastMod; PRTime fileLastMod;
rv = theFile->GetLastModifiedTime(&fileLastMod); rv = theFile->GetLastModifiedTime(&fileLastMod);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
// nsIFile uses millisec, NSPR usec // nsIFile uses millisec, NSPR usec

View File

@ -364,7 +364,7 @@ NS_IMETHODIMP nsZipWriter::AddEntryFile(const nsACString & aZipEntry,
rv = aFile->IsDirectory(&isdir); rv = aFile->IsDirectory(&isdir);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
int64_t modtime; PRTime modtime;
rv = aFile->GetLastModifiedTime(&modtime); rv = aFile->GetLastModifiedTime(&modtime);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
modtime *= PR_USEC_PER_MSEC; modtime *= PR_USEC_PER_MSEC;

View File

@ -278,7 +278,7 @@ nsDirectoryIndexStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount)
int64_t fileSize = 0; int64_t fileSize = 0;
current->GetFileSize( &fileSize ); current->GetFileSize( &fileSize );
int64_t fileInfoModifyTime = 0; PRTime fileInfoModifyTime = 0;
current->GetLastModifiedTime( &fileInfoModifyTime ); current->GetLastModifiedTime( &fileInfoModifyTime );
fileInfoModifyTime *= PR_USEC_PER_MSEC; fileInfoModifyTime *= PR_USEC_PER_MSEC;

View File

@ -426,7 +426,7 @@ PR_BEGIN_MACRO \
} }
#endif /* XP_UNIX */ #endif /* XP_UNIX */
nsresult nsProfileLock::GetReplacedLockTime(int64_t *aResult) { nsresult nsProfileLock::GetReplacedLockTime(PRTime *aResult) {
*aResult = mReplacedLockTime; *aResult = mReplacedLockTime;
return NS_OK; return NS_OK;
} }

View File

@ -59,11 +59,11 @@ public:
/** /**
* Get the modification time of a replaced profile lock, otherwise 0. * Get the modification time of a replaced profile lock, otherwise 0.
*/ */
nsresult GetReplacedLockTime(int64_t* aResult); nsresult GetReplacedLockTime(PRTime* aResult);
private: private:
bool mHaveLock; bool mHaveLock;
int64_t mReplacedLockTime; PRTime mReplacedLockTime;
#if defined (XP_WIN) #if defined (XP_WIN)
HANDLE mLockFileHandle; HANDLE mLockFileHandle;

View File

@ -1133,7 +1133,7 @@ FileSystemDataSource::GetLastMod(nsIRDFResource *source, nsIRDFDate **aResult)
// ensure that we DO NOT resolve aliases // ensure that we DO NOT resolve aliases
aFile->SetFollowLinks(false); aFile->SetFollowLinks(false);
int64_t lastModDate; PRTime lastModDate;
if (NS_FAILED(rv = aFile->GetLastModifiedTime(&lastModDate))) if (NS_FAILED(rv = aFile->GetLastModifiedTime(&lastModDate)))
return(rv); return(rv);

View File

@ -750,7 +750,7 @@ nsFileView::GetCellText(int32_t aRow, nsITreeColumn* aCol,
if (NS_LITERAL_STRING("FilenameColumn").Equals(colID)) { if (NS_LITERAL_STRING("FilenameColumn").Equals(colID)) {
curFile->GetLeafName(aCellText); curFile->GetLeafName(aCellText);
} else if (NS_LITERAL_STRING("LastModifiedColumn").Equals(colID)) { } else if (NS_LITERAL_STRING("LastModifiedColumn").Equals(colID)) {
int64_t lastModTime; PRTime lastModTime;
curFile->GetLastModifiedTime(&lastModTime); curFile->GetLastModifiedTime(&lastModTime);
// XXX FormatPRTime could take an nsAString& // XXX FormatPRTime could take an nsAString&
nsAutoString temp; nsAutoString temp;
@ -946,7 +946,7 @@ SortDateCallback(const void* aElement1, const void* aElement2, void* aContext)
nsIFile* file1 = *static_cast<nsIFile* const *>(aElement1); nsIFile* file1 = *static_cast<nsIFile* const *>(aElement1);
nsIFile* file2 = *static_cast<nsIFile* const *>(aElement2); nsIFile* file2 = *static_cast<nsIFile* const *>(aElement2);
int64_t time1, time2; PRTime time1, time2;
file1->GetLastModifiedTime(&time1); file1->GetLastModifiedTime(&time1);
file2->GetLastModifiedTime(&time2); file2->GetLastModifiedTime(&time2);

View File

@ -90,7 +90,7 @@ hasRecentCorruptDB()
if (NS_SUCCEEDED(currFile->GetLeafName(leafName)) && if (NS_SUCCEEDED(currFile->GetLeafName(leafName)) &&
leafName.Length() >= DATABASE_CORRUPT_FILENAME.Length() && leafName.Length() >= DATABASE_CORRUPT_FILENAME.Length() &&
leafName.Find(".corrupt", DATABASE_FILENAME.Length()) != -1) { leafName.Find(".corrupt", DATABASE_FILENAME.Length()) != -1) {
int64_t lastMod = 0; PRTime lastMod = 0;
currFile->GetLastModifiedTime(&lastMod); currFile->GetLastModifiedTime(&lastMod);
NS_ENSURE_TRUE(lastMod > 0, false); NS_ENSURE_TRUE(lastMod > 0, false);
return (PR_Now() - lastMod) > RECENT_BACKUP_TIME_MICROSEC; return (PR_Now() - lastMod) > RECENT_BACKUP_TIME_MICROSEC;

View File

@ -957,7 +957,7 @@ nsAppStartup::TrackStartupCrashBegin(bool *aIsSafeModeNecessary)
xr->GetInSafeMode(&inSafeMode); xr->GetInSafeMode(&inSafeMode);
int64_t replacedLockTime; PRTime replacedLockTime;
rv = xr->GetReplacedLockTime(&replacedLockTime); rv = xr->GetReplacedLockTime(&replacedLockTime);
if (NS_FAILED(rv) || !replacedLockTime) { if (NS_FAILED(rv) || !replacedLockTime) {

View File

@ -34,7 +34,7 @@ interface nsIProfileLock : nsISupports
/** /**
* The timestamp of an existing profile lock at lock time. * The timestamp of an existing profile lock at lock time.
*/ */
readonly attribute int64_t replacedLockTime; readonly attribute PRTime replacedLockTime;
/** /**
* Unlock the profile. * Unlock the profile.

View File

@ -352,7 +352,7 @@ nsToolkitProfileLock::Unlock()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsToolkitProfileLock::GetReplacedLockTime(int64_t *aResult) nsToolkitProfileLock::GetReplacedLockTime(PRTime *aResult)
{ {
mLock.GetReplacedLockTime(aResult); mLock.GetReplacedLockTime(aResult);
return NS_OK; return NS_OK;

View File

@ -810,7 +810,7 @@ nsXULAppInfo::InvalidateCachesOnRestart()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsXULAppInfo::GetReplacedLockTime(int64_t *aReplacedLockTime) nsXULAppInfo::GetReplacedLockTime(PRTime *aReplacedLockTime)
{ {
if (!gProfileLock) if (!gProfileLock)
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;

View File

@ -188,8 +188,8 @@ interface nsIFile : nsISupports
* midnight (00:00:00), January 1, 1970 Greenwich Mean * midnight (00:00:00), January 1, 1970 Greenwich Mean
* Time (GMT). * Time (GMT).
*/ */
attribute int64_t lastModifiedTime; attribute PRTime lastModifiedTime;
attribute int64_t lastModifiedTimeOfLink; attribute PRTime lastModifiedTimeOfLink;
/** /**
* WARNING! On the Mac, getting/setting the file size with nsIFile * WARNING! On the Mac, getting/setting the file size with nsIFile

View File

@ -1702,7 +1702,7 @@ nsLocalFile::Remove(bool recursive)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::GetLastModifiedTime(int64_t *aLastModifiedTime) nsLocalFile::GetLastModifiedTime(PRTime *aLastModifiedTime)
{ {
// Check we are correctly initialized. // Check we are correctly initialized.
CHECK_mWorkingPath(); CHECK_mWorkingPath();
@ -1723,14 +1723,14 @@ nsLocalFile::GetLastModifiedTime(int64_t *aLastModifiedTime)
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModifiedTime) nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModifiedTime)
{ {
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::SetLastModifiedTime(int64_t aLastModifiedTime) nsLocalFile::SetLastModifiedTime(PRTime aLastModifiedTime)
{ {
// Check we are correctly initialized. // Check we are correctly initialized.
CHECK_mWorkingPath(); CHECK_mWorkingPath();
@ -1740,13 +1740,13 @@ nsLocalFile::SetLastModifiedTime(int64_t aLastModifiedTime)
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::SetLastModifiedTimeOfLink(int64_t aLastModifiedTime) nsLocalFile::SetLastModifiedTimeOfLink(PRTime aLastModifiedTime)
{ {
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
nsresult nsresult
nsLocalFile::SetModDate(int64_t aLastModifiedTime) nsLocalFile::SetModDate(PRTime aLastModifiedTime)
{ {
nsresult rv = Stat(); nsresult rv = Stat();

View File

@ -963,7 +963,7 @@ nsLocalFile::Remove(bool recursive)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::GetLastModifiedTime(int64_t *aLastModTime) nsLocalFile::GetLastModifiedTime(PRTime *aLastModTime)
{ {
CHECK_mPath(); CHECK_mPath();
NS_ENSURE_ARG(aLastModTime); NS_ENSURE_ARG(aLastModTime);
@ -971,17 +971,17 @@ nsLocalFile::GetLastModifiedTime(int64_t *aLastModTime)
PRFileInfo64 info; PRFileInfo64 info;
if (PR_GetFileInfo64(mPath.get(), &info) != PR_SUCCESS) if (PR_GetFileInfo64(mPath.get(), &info) != PR_SUCCESS)
return NSRESULT_FOR_ERRNO(); return NSRESULT_FOR_ERRNO();
int64_t modTime = int64_t(info.modifyTime); PRTime modTime = info.modifyTime;
if (modTime == 0) if (modTime == 0)
*aLastModTime = 0; *aLastModTime = 0;
else else
*aLastModTime = modTime / int64_t(PR_USEC_PER_MSEC); *aLastModTime = modTime / PR_USEC_PER_MSEC;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::SetLastModifiedTime(int64_t aLastModTime) nsLocalFile::SetLastModifiedTime(PRTime aLastModTime)
{ {
CHECK_mPath(); CHECK_mPath();
@ -992,7 +992,7 @@ nsLocalFile::SetLastModifiedTime(int64_t aLastModTime)
ut.actime = mCachedStat.st_atime; ut.actime = mCachedStat.st_atime;
// convert milliseconds to seconds since the unix epoch // convert milliseconds to seconds since the unix epoch
ut.modtime = (time_t)(double(aLastModTime) / PR_MSEC_PER_SEC); ut.modtime = (time_t)(aLastModTime / PR_MSEC_PER_SEC);
result = utime(mPath.get(), &ut); result = utime(mPath.get(), &ut);
} else { } else {
result = utime(mPath.get(), nullptr); result = utime(mPath.get(), nullptr);
@ -1001,7 +1001,7 @@ nsLocalFile::SetLastModifiedTime(int64_t aLastModTime)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModTimeOfLink) nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModTimeOfLink)
{ {
CHECK_mPath(); CHECK_mPath();
NS_ENSURE_ARG(aLastModTimeOfLink); NS_ENSURE_ARG(aLastModTimeOfLink);
@ -1009,7 +1009,7 @@ nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModTimeOfLink)
struct STAT sbuf; struct STAT sbuf;
if (LSTAT(mPath.get(), &sbuf) == -1) if (LSTAT(mPath.get(), &sbuf) == -1)
return NSRESULT_FOR_ERRNO(); return NSRESULT_FOR_ERRNO();
*aLastModTimeOfLink = int64_t(sbuf.st_mtime) * int64_t(PR_MSEC_PER_SEC); *aLastModTimeOfLink = PRTime(sbuf.st_mtime) * PR_MSEC_PER_SEC;
return NS_OK; return NS_OK;
} }
@ -1018,7 +1018,7 @@ nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModTimeOfLink)
* utime(2) may or may not dereference symlinks, joy. * utime(2) may or may not dereference symlinks, joy.
*/ */
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::SetLastModifiedTimeOfLink(int64_t aLastModTimeOfLink) nsLocalFile::SetLastModifiedTimeOfLink(PRTime aLastModTimeOfLink)
{ {
return SetLastModifiedTime(aLastModTimeOfLink); return SetLastModifiedTime(aLastModTimeOfLink);
} }

View File

@ -2250,7 +2250,7 @@ nsLocalFile::Remove(bool recursive)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::GetLastModifiedTime(int64_t *aLastModifiedTime) nsLocalFile::GetLastModifiedTime(PRTime *aLastModifiedTime)
{ {
// Check we are correctly initialized. // Check we are correctly initialized.
CHECK_mWorkingPath(); CHECK_mWorkingPath();
@ -2275,7 +2275,7 @@ nsLocalFile::GetLastModifiedTime(int64_t *aLastModifiedTime)
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModifiedTime) nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModifiedTime)
{ {
// Check we are correctly initialized. // Check we are correctly initialized.
CHECK_mWorkingPath(); CHECK_mWorkingPath();
@ -2299,7 +2299,7 @@ nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModifiedTime)
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::SetLastModifiedTime(int64_t aLastModifiedTime) nsLocalFile::SetLastModifiedTime(PRTime aLastModifiedTime)
{ {
// Check we are correctly initialized. // Check we are correctly initialized.
CHECK_mWorkingPath(); CHECK_mWorkingPath();
@ -2322,7 +2322,7 @@ nsLocalFile::SetLastModifiedTime(int64_t aLastModifiedTime)
NS_IMETHODIMP NS_IMETHODIMP
nsLocalFile::SetLastModifiedTimeOfLink(int64_t aLastModifiedTime) nsLocalFile::SetLastModifiedTimeOfLink(PRTime aLastModifiedTime)
{ {
// The caller is assumed to have already called IsSymlink // The caller is assumed to have already called IsSymlink
// and to have found that this file is a link. // and to have found that this file is a link.
@ -2335,7 +2335,7 @@ nsLocalFile::SetLastModifiedTimeOfLink(int64_t aLastModifiedTime)
} }
nsresult nsresult
nsLocalFile::SetModDate(int64_t aLastModifiedTime, const PRUnichar *filePath) nsLocalFile::SetModDate(PRTime aLastModifiedTime, const PRUnichar *filePath)
{ {
// The FILE_FLAG_BACKUP_SEMANTICS is required in order to change the // The FILE_FLAG_BACKUP_SEMANTICS is required in order to change the
// modification time for directories. // modification time for directories.

View File

@ -88,7 +88,7 @@ interface nsIXULRuntime : nsISupports
* this startup. Used to know the last time the profile was used and not * this startup. Used to know the last time the profile was used and not
* closed cleanly. This is set to 0 if there was no existing profile lock. * closed cleanly. This is set to 0 if there was no existing profile lock.
*/ */
readonly attribute int64_t replacedLockTime; readonly attribute PRTime replacedLockTime;
/** /**
* Local ID of the minidump generated when the process crashed * Local ID of the minidump generated when the process crashed