зеркало из https://github.com/mozilla/gecko-dev.git
Bug 785738 Part 3: use PRTime instead of int64_t where appropriate; r=ehsan
This commit is contained in:
Родитель
38e4045ea6
Коммит
3f08ff498e
|
@ -494,7 +494,7 @@ nsDOMFileFile::GetMozFullPathInternal(nsAString &aFilename)
|
|||
NS_IMETHODIMP
|
||||
nsDOMFileFile::GetLastModifiedDate(JSContext* cx, JS::Value *aLastModifiedDate)
|
||||
{
|
||||
int64_t msecs;
|
||||
PRTime msecs;
|
||||
mFile->GetLastModifiedTime(&msecs);
|
||||
JSObject* date = JS_NewDateObjectMsec(cx, msecs);
|
||||
if (date) {
|
||||
|
|
|
@ -316,7 +316,7 @@ DeviceStorageFile::collectFilesInternal(nsTArray<nsRefPtr<DeviceStorageFile> > &
|
|||
|
||||
while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(f))) && f) {
|
||||
|
||||
int64_t msecs;
|
||||
PRTime msecs;
|
||||
f->GetLastModifiedTime(&msecs);
|
||||
|
||||
if (msecs < aSince) {
|
||||
|
|
|
@ -2004,7 +2004,7 @@ namespace {
|
|||
|
||||
int64_t GetPluginLastModifiedTime(const nsCOMPtr<nsIFile>& localfile)
|
||||
{
|
||||
int64_t fileModTime = LL_ZERO;
|
||||
PRTime fileModTime = LL_ZERO;
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
// On OS X the date of a bundle's "contents" (i.e. of its Info.plist file)
|
||||
|
|
|
@ -1284,7 +1284,7 @@ bool imgLoader::ValidateEntry(imgCacheEntry *aEntry,
|
|||
nsCOMPtr<nsIFile> theFile;
|
||||
rv = fileUrl->GetFile(getter_AddRefs(theFile));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
int64_t fileLastMod;
|
||||
PRTime fileLastMod;
|
||||
rv = theFile->GetLastModifiedTime(&fileLastMod);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// nsIFile uses millisec, NSPR usec
|
||||
|
|
|
@ -364,7 +364,7 @@ NS_IMETHODIMP nsZipWriter::AddEntryFile(const nsACString & aZipEntry,
|
|||
rv = aFile->IsDirectory(&isdir);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
int64_t modtime;
|
||||
PRTime modtime;
|
||||
rv = aFile->GetLastModifiedTime(&modtime);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
modtime *= PR_USEC_PER_MSEC;
|
||||
|
|
|
@ -278,7 +278,7 @@ nsDirectoryIndexStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount)
|
|||
int64_t fileSize = 0;
|
||||
current->GetFileSize( &fileSize );
|
||||
|
||||
int64_t fileInfoModifyTime = 0;
|
||||
PRTime fileInfoModifyTime = 0;
|
||||
current->GetLastModifiedTime( &fileInfoModifyTime );
|
||||
fileInfoModifyTime *= PR_USEC_PER_MSEC;
|
||||
|
||||
|
|
|
@ -426,7 +426,7 @@ PR_BEGIN_MACRO \
|
|||
}
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
nsresult nsProfileLock::GetReplacedLockTime(int64_t *aResult) {
|
||||
nsresult nsProfileLock::GetReplacedLockTime(PRTime *aResult) {
|
||||
*aResult = mReplacedLockTime;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -59,11 +59,11 @@ public:
|
|||
/**
|
||||
* Get the modification time of a replaced profile lock, otherwise 0.
|
||||
*/
|
||||
nsresult GetReplacedLockTime(int64_t* aResult);
|
||||
nsresult GetReplacedLockTime(PRTime* aResult);
|
||||
|
||||
private:
|
||||
bool mHaveLock;
|
||||
int64_t mReplacedLockTime;
|
||||
PRTime mReplacedLockTime;
|
||||
|
||||
#if defined (XP_WIN)
|
||||
HANDLE mLockFileHandle;
|
||||
|
|
|
@ -1133,7 +1133,7 @@ FileSystemDataSource::GetLastMod(nsIRDFResource *source, nsIRDFDate **aResult)
|
|||
// ensure that we DO NOT resolve aliases
|
||||
aFile->SetFollowLinks(false);
|
||||
|
||||
int64_t lastModDate;
|
||||
PRTime lastModDate;
|
||||
if (NS_FAILED(rv = aFile->GetLastModifiedTime(&lastModDate)))
|
||||
return(rv);
|
||||
|
||||
|
|
|
@ -750,7 +750,7 @@ nsFileView::GetCellText(int32_t aRow, nsITreeColumn* aCol,
|
|||
if (NS_LITERAL_STRING("FilenameColumn").Equals(colID)) {
|
||||
curFile->GetLeafName(aCellText);
|
||||
} else if (NS_LITERAL_STRING("LastModifiedColumn").Equals(colID)) {
|
||||
int64_t lastModTime;
|
||||
PRTime lastModTime;
|
||||
curFile->GetLastModifiedTime(&lastModTime);
|
||||
// XXX FormatPRTime could take an nsAString&
|
||||
nsAutoString temp;
|
||||
|
@ -946,7 +946,7 @@ SortDateCallback(const void* aElement1, const void* aElement2, void* aContext)
|
|||
nsIFile* file1 = *static_cast<nsIFile* const *>(aElement1);
|
||||
nsIFile* file2 = *static_cast<nsIFile* const *>(aElement2);
|
||||
|
||||
int64_t time1, time2;
|
||||
PRTime time1, time2;
|
||||
file1->GetLastModifiedTime(&time1);
|
||||
file2->GetLastModifiedTime(&time2);
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ hasRecentCorruptDB()
|
|||
if (NS_SUCCEEDED(currFile->GetLeafName(leafName)) &&
|
||||
leafName.Length() >= DATABASE_CORRUPT_FILENAME.Length() &&
|
||||
leafName.Find(".corrupt", DATABASE_FILENAME.Length()) != -1) {
|
||||
int64_t lastMod = 0;
|
||||
PRTime lastMod = 0;
|
||||
currFile->GetLastModifiedTime(&lastMod);
|
||||
NS_ENSURE_TRUE(lastMod > 0, false);
|
||||
return (PR_Now() - lastMod) > RECENT_BACKUP_TIME_MICROSEC;
|
||||
|
|
|
@ -957,7 +957,7 @@ nsAppStartup::TrackStartupCrashBegin(bool *aIsSafeModeNecessary)
|
|||
|
||||
xr->GetInSafeMode(&inSafeMode);
|
||||
|
||||
int64_t replacedLockTime;
|
||||
PRTime replacedLockTime;
|
||||
rv = xr->GetReplacedLockTime(&replacedLockTime);
|
||||
|
||||
if (NS_FAILED(rv) || !replacedLockTime) {
|
||||
|
|
|
@ -34,7 +34,7 @@ interface nsIProfileLock : nsISupports
|
|||
/**
|
||||
* The timestamp of an existing profile lock at lock time.
|
||||
*/
|
||||
readonly attribute int64_t replacedLockTime;
|
||||
readonly attribute PRTime replacedLockTime;
|
||||
|
||||
/**
|
||||
* Unlock the profile.
|
||||
|
|
|
@ -352,7 +352,7 @@ nsToolkitProfileLock::Unlock()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsToolkitProfileLock::GetReplacedLockTime(int64_t *aResult)
|
||||
nsToolkitProfileLock::GetReplacedLockTime(PRTime *aResult)
|
||||
{
|
||||
mLock.GetReplacedLockTime(aResult);
|
||||
return NS_OK;
|
||||
|
|
|
@ -810,7 +810,7 @@ nsXULAppInfo::InvalidateCachesOnRestart()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAppInfo::GetReplacedLockTime(int64_t *aReplacedLockTime)
|
||||
nsXULAppInfo::GetReplacedLockTime(PRTime *aReplacedLockTime)
|
||||
{
|
||||
if (!gProfileLock)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
|
|
@ -188,8 +188,8 @@ interface nsIFile : nsISupports
|
|||
* midnight (00:00:00), January 1, 1970 Greenwich Mean
|
||||
* Time (GMT).
|
||||
*/
|
||||
attribute int64_t lastModifiedTime;
|
||||
attribute int64_t lastModifiedTimeOfLink;
|
||||
attribute PRTime lastModifiedTime;
|
||||
attribute PRTime lastModifiedTimeOfLink;
|
||||
|
||||
/**
|
||||
* WARNING! On the Mac, getting/setting the file size with nsIFile
|
||||
|
|
|
@ -1702,7 +1702,7 @@ nsLocalFile::Remove(bool recursive)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetLastModifiedTime(int64_t *aLastModifiedTime)
|
||||
nsLocalFile::GetLastModifiedTime(PRTime *aLastModifiedTime)
|
||||
{
|
||||
// Check we are correctly initialized.
|
||||
CHECK_mWorkingPath();
|
||||
|
@ -1723,14 +1723,14 @@ nsLocalFile::GetLastModifiedTime(int64_t *aLastModifiedTime)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModifiedTime)
|
||||
nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModifiedTime)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::SetLastModifiedTime(int64_t aLastModifiedTime)
|
||||
nsLocalFile::SetLastModifiedTime(PRTime aLastModifiedTime)
|
||||
{
|
||||
// Check we are correctly initialized.
|
||||
CHECK_mWorkingPath();
|
||||
|
@ -1740,13 +1740,13 @@ nsLocalFile::SetLastModifiedTime(int64_t aLastModifiedTime)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::SetLastModifiedTimeOfLink(int64_t aLastModifiedTime)
|
||||
nsLocalFile::SetLastModifiedTimeOfLink(PRTime aLastModifiedTime)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsLocalFile::SetModDate(int64_t aLastModifiedTime)
|
||||
nsLocalFile::SetModDate(PRTime aLastModifiedTime)
|
||||
{
|
||||
nsresult rv = Stat();
|
||||
|
||||
|
|
|
@ -963,7 +963,7 @@ nsLocalFile::Remove(bool recursive)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetLastModifiedTime(int64_t *aLastModTime)
|
||||
nsLocalFile::GetLastModifiedTime(PRTime *aLastModTime)
|
||||
{
|
||||
CHECK_mPath();
|
||||
NS_ENSURE_ARG(aLastModTime);
|
||||
|
@ -971,17 +971,17 @@ nsLocalFile::GetLastModifiedTime(int64_t *aLastModTime)
|
|||
PRFileInfo64 info;
|
||||
if (PR_GetFileInfo64(mPath.get(), &info) != PR_SUCCESS)
|
||||
return NSRESULT_FOR_ERRNO();
|
||||
int64_t modTime = int64_t(info.modifyTime);
|
||||
PRTime modTime = info.modifyTime;
|
||||
if (modTime == 0)
|
||||
*aLastModTime = 0;
|
||||
else
|
||||
*aLastModTime = modTime / int64_t(PR_USEC_PER_MSEC);
|
||||
*aLastModTime = modTime / PR_USEC_PER_MSEC;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::SetLastModifiedTime(int64_t aLastModTime)
|
||||
nsLocalFile::SetLastModifiedTime(PRTime aLastModTime)
|
||||
{
|
||||
CHECK_mPath();
|
||||
|
||||
|
@ -992,7 +992,7 @@ nsLocalFile::SetLastModifiedTime(int64_t aLastModTime)
|
|||
ut.actime = mCachedStat.st_atime;
|
||||
|
||||
// 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);
|
||||
} else {
|
||||
result = utime(mPath.get(), nullptr);
|
||||
|
@ -1001,7 +1001,7 @@ nsLocalFile::SetLastModifiedTime(int64_t aLastModTime)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModTimeOfLink)
|
||||
nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModTimeOfLink)
|
||||
{
|
||||
CHECK_mPath();
|
||||
NS_ENSURE_ARG(aLastModTimeOfLink);
|
||||
|
@ -1009,7 +1009,7 @@ nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModTimeOfLink)
|
|||
struct STAT sbuf;
|
||||
if (LSTAT(mPath.get(), &sbuf) == -1)
|
||||
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;
|
||||
}
|
||||
|
@ -1018,7 +1018,7 @@ nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModTimeOfLink)
|
|||
* utime(2) may or may not dereference symlinks, joy.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::SetLastModifiedTimeOfLink(int64_t aLastModTimeOfLink)
|
||||
nsLocalFile::SetLastModifiedTimeOfLink(PRTime aLastModTimeOfLink)
|
||||
{
|
||||
return SetLastModifiedTime(aLastModTimeOfLink);
|
||||
}
|
||||
|
|
|
@ -2250,7 +2250,7 @@ nsLocalFile::Remove(bool recursive)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetLastModifiedTime(int64_t *aLastModifiedTime)
|
||||
nsLocalFile::GetLastModifiedTime(PRTime *aLastModifiedTime)
|
||||
{
|
||||
// Check we are correctly initialized.
|
||||
CHECK_mWorkingPath();
|
||||
|
@ -2275,7 +2275,7 @@ nsLocalFile::GetLastModifiedTime(int64_t *aLastModifiedTime)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModifiedTime)
|
||||
nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModifiedTime)
|
||||
{
|
||||
// Check we are correctly initialized.
|
||||
CHECK_mWorkingPath();
|
||||
|
@ -2299,7 +2299,7 @@ nsLocalFile::GetLastModifiedTimeOfLink(int64_t *aLastModifiedTime)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::SetLastModifiedTime(int64_t aLastModifiedTime)
|
||||
nsLocalFile::SetLastModifiedTime(PRTime aLastModifiedTime)
|
||||
{
|
||||
// Check we are correctly initialized.
|
||||
CHECK_mWorkingPath();
|
||||
|
@ -2322,7 +2322,7 @@ nsLocalFile::SetLastModifiedTime(int64_t aLastModifiedTime)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::SetLastModifiedTimeOfLink(int64_t aLastModifiedTime)
|
||||
nsLocalFile::SetLastModifiedTimeOfLink(PRTime aLastModifiedTime)
|
||||
{
|
||||
// The caller is assumed to have already called IsSymlink
|
||||
// and to have found that this file is a link.
|
||||
|
@ -2335,7 +2335,7 @@ nsLocalFile::SetLastModifiedTimeOfLink(int64_t aLastModifiedTime)
|
|||
}
|
||||
|
||||
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
|
||||
// modification time for directories.
|
||||
|
|
|
@ -88,7 +88,7 @@ interface nsIXULRuntime : nsISupports
|
|||
* 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.
|
||||
*/
|
||||
readonly attribute int64_t replacedLockTime;
|
||||
readonly attribute PRTime replacedLockTime;
|
||||
|
||||
/**
|
||||
* Local ID of the minidump generated when the process crashed
|
||||
|
|
Загрузка…
Ссылка в новой задаче