зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1651016 - Convert remaining NS_ENSURE_SUCCESS to QM_TRY in FileStreams.cpp; r=dom-workers-and-storage-reviewers,ttung,sg
Differential Revision: https://phabricator.services.mozilla.com/D84312
This commit is contained in:
Родитель
d380b48ae6
Коммит
82f28d2c55
|
@ -13,13 +13,11 @@ BEGIN_QUOTA_NAMESPACE
|
|||
|
||||
template <class FileStreamBase>
|
||||
NS_IMETHODIMP FileQuotaStream<FileStreamBase>::SetEOF() {
|
||||
nsresult rv = FileStreamBase::SetEOF();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
QM_TRY(FileStreamBase::SetEOF());
|
||||
|
||||
if (mQuotaObject) {
|
||||
int64_t offset;
|
||||
nsresult rv = FileStreamBase::Tell(&offset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
QM_TRY(FileStreamBase::Tell(&offset));
|
||||
|
||||
DebugOnly<bool> res =
|
||||
mQuotaObject->MaybeUpdateSize(offset, /* aTruncate */ true);
|
||||
|
@ -31,8 +29,7 @@ NS_IMETHODIMP FileQuotaStream<FileStreamBase>::SetEOF() {
|
|||
|
||||
template <class FileStreamBase>
|
||||
NS_IMETHODIMP FileQuotaStream<FileStreamBase>::Close() {
|
||||
nsresult rv = FileStreamBase::Close();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
QM_TRY(FileStreamBase::Close());
|
||||
|
||||
mQuotaObject = nullptr;
|
||||
|
||||
|
@ -49,8 +46,7 @@ nsresult FileQuotaStream<FileStreamBase>::DoOpen() {
|
|||
mPersistenceType, mGroup, mOrigin, mClientType,
|
||||
FileStreamBase::mOpenParams.localFile);
|
||||
|
||||
nsresult rv = FileStreamBase::DoOpen();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
QM_TRY(FileStreamBase::DoOpen());
|
||||
|
||||
if (mQuotaObject && (FileStreamBase::mOpenParams.ioFlags & PR_TRUNCATE)) {
|
||||
DebugOnly<bool> res =
|
||||
|
@ -64,12 +60,9 @@ nsresult FileQuotaStream<FileStreamBase>::DoOpen() {
|
|||
template <class FileStreamBase>
|
||||
NS_IMETHODIMP FileQuotaStreamWithWrite<FileStreamBase>::Write(
|
||||
const char* aBuf, uint32_t aCount, uint32_t* _retval) {
|
||||
nsresult rv;
|
||||
|
||||
if (FileQuotaStreamWithWrite::mQuotaObject) {
|
||||
int64_t offset;
|
||||
rv = FileStreamBase::Tell(&offset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
QM_TRY(FileStreamBase::Tell(&offset));
|
||||
|
||||
MOZ_ASSERT(INT64_MAX - offset >= int64_t(aCount));
|
||||
|
||||
|
@ -80,8 +73,7 @@ NS_IMETHODIMP FileQuotaStreamWithWrite<FileStreamBase>::Write(
|
|||
}
|
||||
}
|
||||
|
||||
rv = FileStreamBase::Write(aBuf, aCount, _retval);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
QM_TRY(FileStreamBase::Write(aBuf, aCount, _retval));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -92,8 +84,9 @@ already_AddRefed<FileInputStream> CreateFileInputStream(
|
|||
int32_t aIOFlags, int32_t aPerm, int32_t aBehaviorFlags) {
|
||||
RefPtr<FileInputStream> stream =
|
||||
new FileInputStream(aPersistenceType, aGroup, aOrigin, aClientType);
|
||||
nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
QM_TRY(stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags), nullptr);
|
||||
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
|
@ -103,8 +96,9 @@ already_AddRefed<FileOutputStream> CreateFileOutputStream(
|
|||
int32_t aIOFlags, int32_t aPerm, int32_t aBehaviorFlags) {
|
||||
RefPtr<FileOutputStream> stream =
|
||||
new FileOutputStream(aPersistenceType, aGroup, aOrigin, aClientType);
|
||||
nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
QM_TRY(stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags), nullptr);
|
||||
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
|
@ -114,8 +108,9 @@ already_AddRefed<FileStream> CreateFileStream(
|
|||
int32_t aIOFlags, int32_t aPerm, int32_t aBehaviorFlags) {
|
||||
RefPtr<FileStream> stream =
|
||||
new FileStream(aPersistenceType, aGroup, aOrigin, aClientType);
|
||||
nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
QM_TRY(stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags), nullptr);
|
||||
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче