From 779ab335dd81d47f9aa7ef06822de37c8fec1c6e Mon Sep 17 00:00:00 2001 From: X512 Date: Thu, 10 Dec 2020 04:02:02 +0900 Subject: [PATCH] use .IsSet() instead if .Get() != NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia2b7a719fd398e78cc3b11d4f7b02cb81179f65f Reviewed-on: https://review.haiku-os.org/c/haiku/+/3488 Reviewed-by: Jérôme Duval --- .../package_links/PackageLinkSymlink.cpp | 2 +- .../kernel/network/stack/net_socket.cpp | 6 ++-- .../haikudepot/edits_generic/EditManager.cpp | 4 +-- src/apps/haikudepot/model/Model.cpp | 10 +++--- .../model/PackageIconTarRepository.cpp | 2 +- src/apps/haikudepot/model/PackageInfo.cpp | 6 ++-- src/apps/haikudepot/model/PackageManager.cpp | 10 +++--- src/apps/haikudepot/model/RatingStability.cpp | 4 +-- .../haikudepot/server/AbstractProcess.cpp | 6 ++-- .../server/LocalPkgDataLoadProcess.cpp | 8 ++--- .../server/ServerPkgDataUpdateProcess.cpp | 2 +- src/apps/haikudepot/textview/Bullet.cpp | 2 +- .../haikudepot/textview/CharacterStyle.cpp | 2 +- src/apps/haikudepot/textview/MarkupParser.cpp | 2 +- .../haikudepot/textview/ParagraphStyle.cpp | 2 +- src/apps/haikudepot/textview/TextDocument.cpp | 12 +++---- .../textview/TextDocumentLayout.cpp | 16 +++++----- .../haikudepot/textview/TextDocumentView.cpp | 24 +++++++------- src/apps/haikudepot/textview/TextEditor.cpp | 26 +++++++-------- src/apps/haikudepot/ui/App.cpp | 2 +- .../haikudepot/ui/FeaturedPackagesView.cpp | 6 ++-- src/apps/haikudepot/ui/MainWindow.cpp | 16 +++++----- .../haikudepot/ui/MessagePackageListener.cpp | 4 +-- .../haikudepot/ui/PackageContentsView.cpp | 8 ++--- src/apps/haikudepot/ui/PackageInfoView.cpp | 14 ++++---- src/apps/haikudepot/ui/PackageListView.cpp | 22 ++++++------- src/apps/haikudepot/ui/RatePackageWindow.cpp | 2 +- src/apps/haikudepot/ui/ScreenshotWindow.cpp | 8 ++--- src/apps/haikudepot/ui_generic/BitmapView.cpp | 4 +-- src/apps/mediaplayer/Controller.cpp | 8 ++--- src/apps/mediaplayer/MainWin.cpp | 2 +- .../debug_info/ImageDebugInfoLoadingState.cpp | 2 +- src/kits/interface/Gradient.cpp | 2 +- src/kits/locale/DateFormat.cpp | 16 +++++----- src/kits/locale/DateTimeFormat.cpp | 6 ++-- src/kits/locale/FormattingConventions.cpp | 6 ++-- src/kits/locale/TimeFormat.cpp | 12 +++---- src/kits/network/libnetapi/NetworkAddress.cpp | 8 ++--- src/kits/storage/mime/DatabaseLocation.cpp | 2 +- src/libs/alm/ALMLayout.cpp | 10 +++--- src/servers/app/Canvas.cpp | 2 +- src/servers/app/Desktop.cpp | 6 ++-- src/servers/app/DrawState.cpp | 30 ++++++++--------- src/servers/app/EventDispatcher.cpp | 8 ++--- src/servers/app/EventStream.cpp | 2 +- src/servers/app/Layer.cpp | 2 +- src/servers/app/OffscreenWindow.cpp | 4 +-- src/servers/app/Screen.cpp | 4 +-- src/servers/app/ScreenManager.cpp | 2 +- src/servers/app/ServerPicture.cpp | 12 +++---- src/servers/app/ServerWindow.cpp | 20 ++++++------ src/servers/app/ServerWindow.h | 2 +- src/servers/app/View.cpp | 16 +++++----- src/servers/app/View.h | 6 ++-- src/servers/app/Window.cpp | 32 +++++++++---------- .../app/decorator/DefaultWindowBehaviour.cpp | 14 ++++---- src/servers/app/drawing/AlphaMask.cpp | 4 +-- src/servers/app/drawing/BBitmapBuffer.cpp | 2 +- .../app/drawing/BitmapDrawingEngine.cpp | 6 ++-- src/servers/app/drawing/BitmapHWInterface.cpp | 4 +-- .../app/drawing/DWindowHWInterface.cpp | 4 +-- src/servers/app/drawing/HWInterface.cpp | 14 ++++---- src/servers/app/drawing/ViewHWInterface.cpp | 10 +++--- .../interface/local/AccelerantHWInterface.cpp | 12 +++---- .../drawing/interface/remote/NetReceiver.cpp | 2 +- .../interface/remote/RemoteDrawingEngine.cpp | 4 +-- .../interface/remote/RemoteHWInterface.cpp | 14 ++++---- src/servers/app/font/FontCacheEntry.cpp | 2 +- src/servers/app/font/FontManager.cpp | 6 ++-- src/servers/app/stackandtile/SATGroup.cpp | 2 +- 70 files changed, 277 insertions(+), 277 deletions(-) diff --git a/src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp b/src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp index 64ded39b11..681d6287a9 100644 --- a/src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp @@ -187,7 +187,7 @@ status_t PackageLinkSymlink::OpenAttribute(const StringKey& name, int openMode, AttributeCookie*& _cookie) { - if (fPackage.Get() == NULL) + if (!fPackage.IsSet()) return B_ENTRY_NOT_FOUND; return AutoPackageAttributes::OpenCookie(fPackage, name, openMode, _cookie); diff --git a/src/add-ons/kernel/network/stack/net_socket.cpp b/src/add-ons/kernel/network/stack/net_socket.cpp index 25b10ec469..79a3d14005 100644 --- a/src/add-ons/kernel/network/stack/net_socket.cpp +++ b/src/add-ons/kernel/network/stack/net_socket.cpp @@ -352,7 +352,7 @@ print_socket_line(net_socket_private* socket, const char* prefix) kprintf("%s%p %2d.%2d.%2d %6" B_PRId32 " %p %p %p%s\n", prefix, socket, socket->family, socket->type, socket->protocol, socket->owner, socket->first_protocol, socket->first_info, parent.Get(), - parent.Get() != NULL ? socket->is_connected ? " (c)" : " (p)" : ""); + parent.IsSet() ? socket->is_connected ? " (c)" : " (p)" : ""); } @@ -836,7 +836,7 @@ socket_connected(net_socket* _socket) } BReference parent = socket->parent.GetReference(); - if (parent.Get() == NULL) + if (!parent.IsSet()) return B_BAD_VALUE; MutexLocker _(parent->lock); @@ -864,7 +864,7 @@ socket_aborted(net_socket* _socket) TRACE("socket_aborted(%p)\n", socket); BReference parent = socket->parent.GetReference(); - if (parent.Get() == NULL) + if (!parent.IsSet()) return B_BAD_VALUE; MutexLocker _(parent->lock); diff --git a/src/apps/haikudepot/edits_generic/EditManager.cpp b/src/apps/haikudepot/edits_generic/EditManager.cpp index b91f1954f0..bd593623e1 100644 --- a/src/apps/haikudepot/edits_generic/EditManager.cpp +++ b/src/apps/haikudepot/edits_generic/EditManager.cpp @@ -41,7 +41,7 @@ EditManager::Perform(UndoableEdit* edit, EditContext& context) status_t EditManager::Perform(const UndoableEditRef& edit, EditContext& context) { - status_t ret = edit.Get() != NULL ? B_OK : B_BAD_VALUE; + status_t ret = edit.IsSet() ? B_OK : B_BAD_VALUE; if (ret == B_OK) ret = edit->InitCheck(); @@ -150,7 +150,7 @@ bool EditManager::IsSaved() { bool saved = fUndoHistory.IsEmpty(); - if (fEditAtSave.Get() != NULL && !saved) { + if (fEditAtSave.IsSet() && !saved) { if (fEditAtSave == fUndoHistory.Top()) saved = true; } diff --git a/src/apps/haikudepot/model/Model.cpp b/src/apps/haikudepot/model/Model.cpp index 6fd1803c07..d51081d567 100644 --- a/src/apps/haikudepot/model/Model.cpp +++ b/src/apps/haikudepot/model/Model.cpp @@ -104,12 +104,12 @@ public: virtual bool AcceptsPackage(const PackageInfoRef& package) const { - if (package.Get() == NULL) + if (!package.IsSet()) return false; for (int i = package->CountCategories() - 1; i >= 0; i--) { const CategoryRef& category = package->CategoryAtIndex(i); - if (category.Get() == NULL) + if (!category.IsSet()) continue; if (category->Code() == fCategory) return true; @@ -207,7 +207,7 @@ public: virtual bool AcceptsPackage(const PackageInfoRef& package) const { - if (package.Get() == NULL) + if (!package.IsSet()) return false; // Every search term must be found in one of the package texts for (int32 i = fSearchTerms.CountStrings() - 1; i >= 0; i--) { @@ -990,7 +990,7 @@ Model::_NotifyAuthorizationChanged() std::vector::const_iterator it; for (it = fListeners.begin(); it != fListeners.end(); it++) { const ModelListenerRef& listener = *it; - if (listener.Get() != NULL) + if (listener.IsSet()) listener->AuthorizationChanged(); } } @@ -1002,7 +1002,7 @@ Model::_NotifyCategoryListChanged() std::vector::const_iterator it; for (it = fListeners.begin(); it != fListeners.end(); it++) { const ModelListenerRef& listener = *it; - if (listener.Get() != NULL) + if (listener.IsSet()) listener->CategoryListChanged(); } } diff --git a/src/apps/haikudepot/model/PackageIconTarRepository.cpp b/src/apps/haikudepot/model/PackageIconTarRepository.cpp index fa69d6d94a..e75d6088ea 100644 --- a/src/apps/haikudepot/model/PackageIconTarRepository.cpp +++ b/src/apps/haikudepot/model/PackageIconTarRepository.cpp @@ -235,7 +235,7 @@ PackageIconTarRepository::GetIcon(const BString& pkgName, BitmapSize size, off_t iconDataTarOffset = -1; const IconTarPtrRef tarPtrRef = _GetIconTarPtr(pkgName); - if (tarPtrRef.Get() != NULL) { + if (tarPtrRef.IsSet()) { iconDataTarOffset = _OffsetToBestRepresentation(tarPtrRef, size, &actualSize); } diff --git a/src/apps/haikudepot/model/PackageInfo.cpp b/src/apps/haikudepot/model/PackageInfo.cpp index acdacc3fb1..c9dbd445a7 100644 --- a/src/apps/haikudepot/model/PackageInfo.cpp +++ b/src/apps/haikudepot/model/PackageInfo.cpp @@ -358,9 +358,9 @@ PackageCategory::Compare(const PackageCategory& other) const bool IsPackageCategoryBefore(const CategoryRef& c1, const CategoryRef& c2) { - if (c1.Get() == NULL || c2.Get() == NULL) + if (!c1.IsSet() || !c2.IsSet()) HDFATAL("unexpected NULL reference in a referencable"); - return c1.Get()->Compare(*(c2.Get())) < 0; + return c1->Compare(*c2) < 0; } @@ -1068,7 +1068,7 @@ PackageInfo::_NotifyListenersImmediate(uint32 changes) std::vector::iterator it; for (it = listeners.begin(); it != listeners.end(); it++) { const PackageInfoListenerRef listener = *it; - if (listener.Get() != NULL) + if (listener.IsSet()) listener->PackageChanged(event); } } diff --git a/src/apps/haikudepot/model/PackageManager.cpp b/src/apps/haikudepot/model/PackageManager.cpp index 9b2d21e818..0ba08f9921 100644 --- a/src/apps/haikudepot/model/PackageManager.cpp +++ b/src/apps/haikudepot/model/PackageManager.cpp @@ -197,7 +197,7 @@ public: tempName.Truncate(tempName.FindFirst('-')); // strip version suffix off package filename PackageInfoRef ref(FindPackageByName(tempName)); - if (ref.Get() != NULL) { + if (ref.IsSet()) { ref->SetDownloadProgress(progress); fLastDownloadUpdate = now; } @@ -210,7 +210,7 @@ public: tempName.Truncate(tempName.FindFirst('-')); // strip version suffix off package filename PackageInfoRef ref(FindPackageByName(tempName)); - if (ref.Get() != NULL) { + if (ref.IsSet()) { ref->SetDownloadProgress(1.0); fDownloadedPackages.insert(ref); } @@ -225,7 +225,7 @@ public: BSolverPackage* package = NULL; for (int32 i = 0; (package = activationList.ItemAt(i)); i++) { PackageInfoRef ref(FindPackageByName(package->Info().Name())); - if (ref.Get() != NULL) + if (ref.IsSet()) ref->SetState(PENDING); } } @@ -311,7 +311,7 @@ public: for (int32 i = 0; i < packages.CountItems(); i++) { PackageInfoRef ref(FindPackageByName(packages.ItemAt(i) ->Name())); - if (ref.Get() != NULL) + if (ref.IsSet()) fRemovedPackages.Add(ref); } } @@ -512,7 +512,7 @@ public: static bool FindAppToLaunch(const PackageInfoRef& package, std::vector& foundLinks) { - if (package.Get() == NULL) + if (!package.IsSet()) return false; int32 installLocation = InstallLocation(package); diff --git a/src/apps/haikudepot/model/RatingStability.cpp b/src/apps/haikudepot/model/RatingStability.cpp index d85ec02d16..422c5703ea 100644 --- a/src/apps/haikudepot/model/RatingStability.cpp +++ b/src/apps/haikudepot/model/RatingStability.cpp @@ -15,9 +15,9 @@ bool IsRatingStabilityBefore(const RatingStabilityRef& rs1, const RatingStabilityRef& rs2) { - if (rs1.Get() == NULL || rs2.Get() == NULL) + if (!rs1.IsSet() || !rs2.IsSet()) HDFATAL("unexpected NULL reference in a referencable"); - return rs1.Get()->Compare(*(rs2.Get())) < 0; + return rs1->Compare(*rs2) < 0; } diff --git a/src/apps/haikudepot/server/AbstractProcess.cpp b/src/apps/haikudepot/server/AbstractProcess.cpp index 9c949fcb4a..05f72c3da4 100644 --- a/src/apps/haikudepot/server/AbstractProcess.cpp +++ b/src/apps/haikudepot/server/AbstractProcess.cpp @@ -76,7 +76,7 @@ AbstractProcess::Run() // this process may be part of a larger bulk-load process and // if so, the process orchestration needs to know when this // process has completed. - if (listener.Get() != NULL) + if (listener.IsSet()) listener->ProcessExited(); return runResult; @@ -126,7 +126,7 @@ AbstractProcess::Stop() } } - if (listener.Get() != NULL) + if (listener.IsSet()) listener->ProcessExited(); return result; @@ -152,4 +152,4 @@ AbstractProcess::ProcessState() { AutoLocker locker(&fLock); return fProcessState; -} \ No newline at end of file +} diff --git a/src/apps/haikudepot/server/LocalPkgDataLoadProcess.cpp b/src/apps/haikudepot/server/LocalPkgDataLoadProcess.cpp index d7d71a33ec..ea76e560ce 100644 --- a/src/apps/haikudepot/server/LocalPkgDataLoadProcess.cpp +++ b/src/apps/haikudepot/server/LocalPkgDataLoadProcess.cpp @@ -104,7 +104,7 @@ LocalPkgDataLoadProcess::RunInternal() DepotInfoRef depotInfoRef = DepotInfoRef( new(std::nothrow) DepotInfo(repoName), true); - if (depotInfoRef.Get() == NULL) + if (!depotInfoRef.IsSet()) HDFATAL("unable to create new depot info - memory exhaustion"); BRepositoryConfig repoConfig; @@ -186,10 +186,10 @@ LocalPkgDataLoadProcess::RunInternal() modelInfo.SetTo(it->second); else { // Add new package info - modelInfo.SetTo(new(std::nothrow) PackageInfo(repoPackageInfo), + modelInfo.SetTo(new(std::nothrow) PackageInfo(repoPackageInfo), true); - if (modelInfo.Get() == NULL) + if (!modelInfo.IsSet()) return B_ERROR; foundPackages[repoPackageInfo.Name()] = modelInfo; @@ -270,7 +270,7 @@ LocalPkgDataLoadProcess::RunInternal() BString repoName = B_TRANSLATE("Local"); DepotInfoRef depotInfoRef(new(std::nothrow) DepotInfo(repoName), true); - if (depotInfoRef.Get() == NULL) + if (!depotInfoRef.IsSet()) HDFATAL("unable to create a new depot info - memory exhaustion"); depots.push_back(depotInfoRef); diff --git a/src/apps/haikudepot/server/ServerPkgDataUpdateProcess.cpp b/src/apps/haikudepot/server/ServerPkgDataUpdateProcess.cpp index 771b8a4ba0..19dee090c5 100644 --- a/src/apps/haikudepot/server/ServerPkgDataUpdateProcess.cpp +++ b/src/apps/haikudepot/server/ServerPkgDataUpdateProcess.cpp @@ -119,7 +119,7 @@ PackageFillingPkgListener::ConsumePackage(const PackageInfoRef& package, BString* categoryCode = pkg->PkgCategoriesItemAt(i)->Code(); CategoryRef category = fModel->CategoryByCode(*categoryCode); - if (category.Get() == NULL) { + if (!category.IsSet()) { HDERROR("unable to find the category for [%s]", categoryCode->String()); } else diff --git a/src/apps/haikudepot/textview/Bullet.cpp b/src/apps/haikudepot/textview/Bullet.cpp index ce1bbb30f5..44cf89440d 100644 --- a/src/apps/haikudepot/textview/Bullet.cpp +++ b/src/apps/haikudepot/textview/Bullet.cpp @@ -50,7 +50,7 @@ Bullet::operator==(const Bullet& other) const if (fBulletData == other.fBulletData) return true; - if (fBulletData.Get() != NULL && other.fBulletData.Get() != NULL) + if (fBulletData.IsSet() && other.fBulletData.IsSet()) return *fBulletData.Get() == *other.fBulletData.Get(); return false; diff --git a/src/apps/haikudepot/textview/CharacterStyle.cpp b/src/apps/haikudepot/textview/CharacterStyle.cpp index 85261bba64..d944ffe4eb 100644 --- a/src/apps/haikudepot/textview/CharacterStyle.cpp +++ b/src/apps/haikudepot/textview/CharacterStyle.cpp @@ -40,7 +40,7 @@ CharacterStyle::operator==(const CharacterStyle& other) const if (fStyleData == other.fStyleData) return true; - if (fStyleData.Get() != NULL && other.fStyleData.Get() != NULL) + if (fStyleData.IsSet() && other.fStyleData.IsSet()) return *fStyleData.Get() == *other.fStyleData.Get(); return false; diff --git a/src/apps/haikudepot/textview/MarkupParser.cpp b/src/apps/haikudepot/textview/MarkupParser.cpp index 5c11c14dc6..399783d916 100644 --- a/src/apps/haikudepot/textview/MarkupParser.cpp +++ b/src/apps/haikudepot/textview/MarkupParser.cpp @@ -67,7 +67,7 @@ TextDocumentRef MarkupParser::CreateDocumentFromMarkup(const BString& text) { TextDocumentRef document(new(std::nothrow) TextDocument(), true); - if (document.Get() == NULL) + if (!document.IsSet()) return document; AppendMarkup(document, text); diff --git a/src/apps/haikudepot/textview/ParagraphStyle.cpp b/src/apps/haikudepot/textview/ParagraphStyle.cpp index 9c27c706c7..fdad94923f 100644 --- a/src/apps/haikudepot/textview/ParagraphStyle.cpp +++ b/src/apps/haikudepot/textview/ParagraphStyle.cpp @@ -40,7 +40,7 @@ ParagraphStyle::operator==(const ParagraphStyle& other) const if (fStyleData == other.fStyleData) return true; - if (fStyleData.Get() != NULL && other.fStyleData.Get() != NULL) + if (fStyleData.IsSet() && other.fStyleData.IsSet()) return *fStyleData.Get() == *other.fStyleData.Get(); return false; diff --git a/src/apps/haikudepot/textview/TextDocument.cpp b/src/apps/haikudepot/textview/TextDocument.cpp index 0cce1b4f5e..f89bf92a04 100644 --- a/src/apps/haikudepot/textview/TextDocument.cpp +++ b/src/apps/haikudepot/textview/TextDocument.cpp @@ -128,7 +128,7 @@ TextDocument::Replace(int32 textOffset, int32 length, const BString& text, { TextDocumentRef document = NormalizeText(text, characterStyle, paragraphStyle); - if (document.Get() == NULL || document->Length() != text.CountChars()) + if (!document.IsSet() || document->Length() != text.CountChars()) return B_NO_MEMORY; return Replace(textOffset, length, document); } @@ -312,7 +312,7 @@ TextDocument::SubDocument(int32 start, int32 length) const TextDocumentRef result(new(std::nothrow) TextDocument( fDefaultCharacterStyle, fEmptyLastParagraph.Style()), true); - if (result.Get() == NULL) + if (!result.IsSet()) return result; if (start < 0) @@ -373,7 +373,7 @@ TextDocument::NormalizeText(const BString& text, { TextDocumentRef document(new(std::nothrow) TextDocument(characterStyle, paragraphStyle), true); - if (document.Get() == NULL) + if (!document.IsSet()) throw B_NO_MEMORY; Paragraph paragraph(paragraphStyle); @@ -679,7 +679,7 @@ TextDocument::_NotifyTextChanging(TextChangingEvent& event) const int32 count = listeners.CountItems(); for (int32 i = 0; i < count; i++) { const TextListenerRef& listener = listeners.ItemAtFast(i); - if (listener.Get() == NULL) + if (!listener.IsSet()) continue; listener->TextChanging(event); if (event.IsCanceled()) @@ -697,7 +697,7 @@ TextDocument::_NotifyTextChanged(const TextChangedEvent& event) const int32 count = listeners.CountItems(); for (int32 i = 0; i < count; i++) { const TextListenerRef& listener = listeners.ItemAtFast(i); - if (listener.Get() == NULL) + if (!listener.IsSet()) continue; listener->TextChanged(event); } @@ -713,7 +713,7 @@ TextDocument::_NotifyUndoableEditHappened(const UndoableEditRef& edit) const int32 count = listeners.CountItems(); for (int32 i = 0; i < count; i++) { const UndoableEditListenerRef& listener = listeners.ItemAtFast(i); - if (listener.Get() == NULL) + if (!listener.IsSet()) continue; listener->UndoableEditHappened(this, edit); } diff --git a/src/apps/haikudepot/textview/TextDocumentLayout.cpp b/src/apps/haikudepot/textview/TextDocumentLayout.cpp index 6d00d78f46..c708989445 100644 --- a/src/apps/haikudepot/textview/TextDocumentLayout.cpp +++ b/src/apps/haikudepot/textview/TextDocumentLayout.cpp @@ -80,7 +80,7 @@ TextDocumentLayout::TextDocumentLayout(const TextDocumentLayout& other) fTextListener(new(std::nothrow) LayoutTextListener(this), true), fParagraphLayouts(other.fParagraphLayouts) { - if (fDocument.Get() != NULL) + if (fDocument.IsSet()) fDocument->AddListener(fTextListener); } @@ -97,14 +97,14 @@ TextDocumentLayout::SetTextDocument(const TextDocumentRef& document) if (fDocument == document) return; - if (fDocument.Get() != NULL) + if (fDocument.IsSet()) fDocument->RemoveListener(fTextListener); fDocument = document; _Init(); fLayoutValid = false; - if (fDocument.Get() != NULL) + if (fDocument.IsSet()) fDocument->AddListener(fTextListener); } @@ -112,7 +112,7 @@ TextDocumentLayout::SetTextDocument(const TextDocumentRef& document) void TextDocumentLayout::Invalidate() { - if (fDocument.Get() != NULL) + if (fDocument.IsSet()) InvalidateParagraphs(0, fDocument->Paragraphs().CountItems()); } @@ -120,7 +120,7 @@ TextDocumentLayout::Invalidate() void TextDocumentLayout::InvalidateParagraphs(int32 start, int32 count) { - if (start < 0 || count == 0 || fDocument.Get() == NULL) + if (start < 0 || count == 0 || !fDocument.IsSet()) return; fLayoutValid = false; @@ -134,7 +134,7 @@ TextDocumentLayout::InvalidateParagraphs(int32 start, int32 count) if (start >= fParagraphLayouts.CountItems()) { ParagraphLayoutRef layout(new(std::nothrow) ParagraphLayout( paragraph), true); - if (layout.Get() == NULL + if (!layout.IsSet() || !fParagraphLayouts.Add(ParagraphLayoutInfo(0.0f, layout))) { fprintf(stderr, "TextDocumentLayout::InvalidateParagraphs() - " "out of memory\n"); @@ -345,7 +345,7 @@ TextDocumentLayout::_Init() { fParagraphLayouts.Clear(); - if (fDocument.Get() == NULL) + if (!fDocument.IsSet()) return; const ParagraphList& paragraphs = fDocument->Paragraphs(); @@ -355,7 +355,7 @@ TextDocumentLayout::_Init() const Paragraph& paragraph = paragraphs.ItemAtFast(i); ParagraphLayoutRef layout(new(std::nothrow) ParagraphLayout(paragraph), true); - if (layout.Get() == NULL + if (!layout.IsSet() || !fParagraphLayouts.Add(ParagraphLayoutInfo(0.0f, layout))) { fprintf(stderr, "TextDocumentLayout::_Layout() - out of memory\n"); return; diff --git a/src/apps/haikudepot/textview/TextDocumentView.cpp b/src/apps/haikudepot/textview/TextDocumentView.cpp index 7eba3e681f..e474646766 100644 --- a/src/apps/haikudepot/textview/TextDocumentView.cpp +++ b/src/apps/haikudepot/textview/TextDocumentView.cpp @@ -89,7 +89,7 @@ TextDocumentView::Draw(BRect updateRect) fTextDocumentLayout.SetWidth(_TextLayoutWidth(Bounds().Width())); fTextDocumentLayout.Draw(this, BPoint(fInsetLeft, fInsetTop), updateRect); - if (!fSelectionEnabled || fTextEditor.Get() == NULL) + if (!fSelectionEnabled || !fTextEditor.IsSet()) return; bool isCaret = fTextEditor->SelectionLength() == 0; @@ -179,7 +179,7 @@ TextDocumentView::MouseMoved(BPoint where, uint32 transit, void TextDocumentView::KeyDown(const char* bytes, int32 numBytes) { - if (fTextEditor.Get() == NULL) + if (!fTextEditor.IsSet()) return; KeyEvent event; @@ -263,7 +263,7 @@ TextDocumentView::SetTextDocument(const TextDocumentRef& document) { fTextDocument = document; fTextDocumentLayout.SetTextDocument(fTextDocument); - if (fTextEditor.Get() != NULL) + if (fTextEditor.IsSet()) fTextEditor->SetDocument(document); InvalidateLayout(); @@ -275,7 +275,7 @@ TextDocumentView::SetTextDocument(const TextDocumentRef& document) void TextDocumentView::SetEditingEnabled(bool enabled) { - if (fTextEditor.Get() != NULL) + if (fTextEditor.IsSet()) fTextEditor->SetEditingEnabled(enabled); } @@ -286,7 +286,7 @@ TextDocumentView::SetTextEditor(const TextEditorRef& editor) if (fTextEditor == editor) return; - if (fTextEditor.Get() != NULL) { + if (fTextEditor.IsSet()) { fTextEditor->SetDocument(TextDocumentRef()); fTextEditor->SetLayout(TextDocumentLayoutRef()); // TODO: Probably has to remove listeners @@ -294,7 +294,7 @@ TextDocumentView::SetTextEditor(const TextEditorRef& editor) fTextEditor = editor; - if (fTextEditor.Get() != NULL) { + if (fTextEditor.IsSet()) { fTextEditor->SetDocument(fTextDocument); fTextEditor->SetLayout(TextDocumentLayoutRef( &fTextDocumentLayout)); @@ -349,7 +349,7 @@ TextDocumentView::SetSelectionEnabled(bool enabled) void TextDocumentView::SetCaret(BPoint location, bool extendSelection) { - if (!fSelectionEnabled || fTextEditor.Get() == NULL) + if (!fSelectionEnabled || !fTextEditor.IsSet()) return; location.x -= fInsetLeft; @@ -364,7 +364,7 @@ TextDocumentView::SetCaret(BPoint location, bool extendSelection) void TextDocumentView::SelectAll() { - if (!fSelectionEnabled || fTextEditor.Get() == NULL) + if (!fSelectionEnabled || !fTextEditor.IsSet()) return; fTextEditor->SelectAll(); @@ -376,14 +376,14 @@ TextDocumentView::SelectAll() bool TextDocumentView::HasSelection() const { - return fTextEditor.Get() != NULL && fTextEditor->HasSelection(); + return fTextEditor.IsSet() && fTextEditor->HasSelection(); } void TextDocumentView::GetSelection(int32& start, int32& end) const { - if (fTextEditor.Get() != NULL) { + if (fTextEditor.IsSet()) { start = fTextEditor->SelectionStart(); end = fTextEditor->SelectionEnd(); } @@ -393,7 +393,7 @@ TextDocumentView::GetSelection(int32& start, int32& end) const void TextDocumentView::Copy(BClipboard* clipboard) { - if (!HasSelection() || fTextDocument.Get() == NULL) { + if (!HasSelection() || !fTextDocument.IsSet()) { // Nothing to copy, don't clear clipboard contents for now reason. return; } @@ -493,7 +493,7 @@ TextDocumentView::_ShowCaret(bool show) void TextDocumentView::_BlinkCaret() { - if (!fSelectionEnabled || fTextEditor.Get() == NULL) + if (!fSelectionEnabled || !fTextEditor.IsSet()) return; _ShowCaret(!fShowCaret); diff --git a/src/apps/haikudepot/textview/TextEditor.cpp b/src/apps/haikudepot/textview/TextEditor.cpp index eaf6b688d5..9a7596ea00 100644 --- a/src/apps/haikudepot/textview/TextEditor.cpp +++ b/src/apps/haikudepot/textview/TextEditor.cpp @@ -105,7 +105,7 @@ TextEditor::SetEditingEnabled(bool enabled) void TextEditor::SetCaret(BPoint location, bool extendSelection) { - if (fDocument.Get() == NULL || fLayout.Get() == NULL) + if (!fDocument.IsSet() || !fLayout.IsSet()) return; bool rightOfChar = false; @@ -122,7 +122,7 @@ TextEditor::SetCaret(BPoint location, bool extendSelection) void TextEditor::SelectAll() { - if (fDocument.Get() == NULL) + if (!fDocument.IsSet()) return; SetSelection(TextSelection(0, fDocument->Length())); @@ -153,7 +153,7 @@ TextEditor::SetCharacterStyle(::CharacterStyle style) void TextEditor::KeyDown(KeyEvent event) { - if (fDocument.Get() == NULL) + if (!fDocument.IsSet()) return; bool select = (event.modifiers & B_SHIFT_KEY) != 0; @@ -250,7 +250,7 @@ TextEditor::KeyDown(KeyEvent event) status_t TextEditor::Insert(int32 offset, const BString& string) { - if (!fEditingEnabled || fDocument.Get() == NULL) + if (!fEditingEnabled || !fDocument.IsSet()) return B_ERROR; status_t ret = fDocument->Insert(offset, string, fStyleAtCaret); @@ -266,7 +266,7 @@ TextEditor::Insert(int32 offset, const BString& string) status_t TextEditor::Remove(int32 offset, int32 length) { - if (!fEditingEnabled || fDocument.Get() == NULL) + if (!fEditingEnabled || !fDocument.IsSet()) return B_ERROR; status_t ret = fDocument->Remove(offset, length); @@ -282,7 +282,7 @@ TextEditor::Remove(int32 offset, int32 length) status_t TextEditor::Replace(int32 offset, int32 length, const BString& string) { - if (!fEditingEnabled || fDocument.Get() == NULL) + if (!fEditingEnabled || !fDocument.IsSet()) return B_ERROR; status_t ret = fDocument->Replace(offset, length, string); @@ -301,7 +301,7 @@ TextEditor::Replace(int32 offset, int32 length, const BString& string) void TextEditor::LineUp(bool select) { - if (fLayout.Get() == NULL) + if (!fLayout.IsSet()) return; int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret()); @@ -312,7 +312,7 @@ TextEditor::LineUp(bool select) void TextEditor::LineDown(bool select) { - if (fLayout.Get() == NULL) + if (!fLayout.IsSet()) return; int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret()); @@ -323,7 +323,7 @@ TextEditor::LineDown(bool select) void TextEditor::LineStart(bool select) { - if (fLayout.Get() == NULL) + if (!fLayout.IsSet()) return; int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret()); @@ -335,7 +335,7 @@ TextEditor::LineStart(bool select) void TextEditor::LineEnd(bool select) { - if (fLayout.Get() == NULL) + if (!fLayout.IsSet()) return; int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret()); @@ -418,7 +418,7 @@ void TextEditor::_SetCaretOffset(int32 offset, bool updateAnchor, bool lockSelectionAnchor, bool updateSelectionStyle) { - if (fDocument.Get() == NULL) + if (!fDocument.IsSet()) return; if (offset < 0) @@ -437,7 +437,7 @@ void TextEditor::_SetSelection(int32 caret, int32 anchor, bool updateAnchor, bool updateSelectionStyle) { - if (fLayout.Get() == NULL) + if (!fLayout.IsSet()) return; if (caret == fSelection.Caret() && anchor == fSelection.Anchor()) @@ -464,7 +464,7 @@ TextEditor::_SetSelection(int32 caret, int32 anchor, bool updateAnchor, void TextEditor::_UpdateStyleAtCaret() { - if (fDocument.Get() == NULL) + if (!fDocument.IsSet()) return; int32 offset = fSelection.Caret() - 1; diff --git a/src/apps/haikudepot/ui/App.cpp b/src/apps/haikudepot/ui/App.cpp index a9f3f64d1f..ceb677f05e 100644 --- a/src/apps/haikudepot/ui/App.cpp +++ b/src/apps/haikudepot/ui/App.cpp @@ -377,7 +377,7 @@ App::_Open(const BEntry& entry) // Transfer information into PackageInfo PackageInfoRef package(new(std::nothrow) PackageInfo(info), true); - if (package.Get() == NULL) { + if (!package.IsSet()) { fprintf(stderr, "Could not allocate PackageInfo\n"); return; } diff --git a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp index 9176fcc84f..af04bde19b 100644 --- a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp +++ b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp @@ -245,7 +245,7 @@ public: static bool _IsPackageBefore(const PackageInfoRef& packageA, const PackageInfoRef& packageB) { - if (packageA.Get() == NULL || packageB.Get() == NULL) + if (!packageA.IsSet() || !packageB.IsSet()) HDFATAL("unexpected NULL reference in a referencable"); int c = _CmpProminences(packageA->Prominence(), packageB->Prominence()); if (c == 0) @@ -399,7 +399,7 @@ public: pkg->Name(), BITMAP_SIZE_64, icon); if (iconResult == B_OK) { - if (icon.Get() != NULL) { + if (icon.IsSet()) { float inset = (HEIGHT_PACKAGE - SIZE_ICON) / 2.0; BRect targetRect = BRect(inset, y + inset, SIZE_ICON + inset, y + SIZE_ICON + inset); @@ -559,7 +559,7 @@ public: float TopOfPackage(const PackageInfoRef& package) { - if (package.Get() != NULL) { + if (package.IsSet()) { int index = _IndexOfPackage(package); if (-1 != index) return _YOfIndex(index); diff --git a/src/apps/haikudepot/ui/MainWindow.cpp b/src/apps/haikudepot/ui/MainWindow.cpp index 6581e3b033..8017384c74 100644 --- a/src/apps/haikudepot/ui/MainWindow.cpp +++ b/src/apps/haikudepot/ui/MainWindow.cpp @@ -429,7 +429,7 @@ MainWindow::MessageReceived(BMessage* message) BAutolock locker(fModel.Lock()); package = fModel.PackageForName(name); } - if (package.Get() == NULL) + if (!package.IsSet()) debugger("unable to find the named package"); else _AdoptPackage(package); @@ -494,7 +494,7 @@ MainWindow::MessageReceived(BMessage* message) } _AddRemovePackageFromLists(ref); if ((changes & PKG_CHANGED_STATE) != 0 - && fCoordinator.Get() == NULL) { + && !fCoordinator.IsSet()) { fWorkStatusView->PackageStatusChanged(ref); } } @@ -998,7 +998,7 @@ MainWindow::_PackageActionWorker(void* arg) { AutoLocker lock(&window->fPendingActionsLock); ref = window->fPendingActions.ItemAt(0); - if (ref.Get() == NULL) + if (!ref.IsSet()) break; window->fPendingActions.Remove(0); } @@ -1058,7 +1058,7 @@ MainWindow::_PopulatePackageWorker(void* arg) force = window->fForcePopulatePackage; } - if (package.Get() != NULL) { + if (package.IsSet()) { uint32 populateFlags = Model::POPULATE_USER_RATINGS | Model::POPULATE_SCREEN_SHOTS | Model::POPULATE_CHANGELOG; @@ -1326,7 +1326,7 @@ MainWindow::_AddProcessCoordinator(ProcessCoordinator* item) { AutoLocker lock(&fCoordinatorLock); - if (fCoordinator.Get() == NULL) { + if (!fCoordinator.IsSet()) { if (acquire_sem(fCoordinatorRunningSem) != B_OK) debugger("unable to acquire the process coordinator sem"); HDINFO("adding and starting a process coordinator [%s]", @@ -1352,7 +1352,7 @@ MainWindow::_SpinUntilProcessCoordinatorComplete() debugger("unable to release the process coordinator sem"); { AutoLocker lock(&fCoordinatorLock); - if (fCoordinator.Get() == NULL) + if (!fCoordinator.IsSet()) return; } } @@ -1375,7 +1375,7 @@ MainWindow::_StopProcessCoordinators() fCoordinatorQueue.pop(); } - if (fCoordinator.Get() != NULL) { + if (fCoordinator.IsSet()) { fCoordinator->Stop(); } } @@ -1475,4 +1475,4 @@ MainWindow::_CreateSnapshotOfDepots() for(int32 i = 0; i < countDepots; i++) result.push_back(fModel.DepotAtIndex(i)); return result; -} \ No newline at end of file +} diff --git a/src/apps/haikudepot/ui/MessagePackageListener.cpp b/src/apps/haikudepot/ui/MessagePackageListener.cpp index 382f8cd106..fb6759b036 100644 --- a/src/apps/haikudepot/ui/MessagePackageListener.cpp +++ b/src/apps/haikudepot/ui/MessagePackageListener.cpp @@ -76,12 +76,12 @@ OnePackageMessagePackageListener::SetPackage(const PackageInfoRef& package) PackageInfoListenerRef listener(this); - if (fPackage.Get() != NULL) + if (fPackage.IsSet()) fPackage->RemoveListener(listener); fPackage = package; - if (fPackage.Get() != NULL) + if (fPackage.IsSet()) fPackage->AddListener(listener); } diff --git a/src/apps/haikudepot/ui/PackageContentsView.cpp b/src/apps/haikudepot/ui/PackageContentsView.cpp index 25288f6bb0..db29500122 100644 --- a/src/apps/haikudepot/ui/PackageContentsView.cpp +++ b/src/apps/haikudepot/ui/PackageContentsView.cpp @@ -281,7 +281,7 @@ PackageContentsView::SetPackage(const PackageInfoRef& package) // to read contents where we previously could not. (For example, the // package has been installed.) if (fPackage == package - && (package.Get() == NULL || package->State() == fLastPackageState)) { + && (!package.IsSet() || package->State() == fLastPackageState)) { return; } @@ -290,13 +290,13 @@ PackageContentsView::SetPackage(const PackageInfoRef& package) { BAutolock lock(&fPackageLock); fPackage = package; - fLastPackageState = package.Get() != NULL ? package->State() : NONE; + fLastPackageState = package.IsSet() ? package->State() : NONE; } // if the package is not installed and is not a local file on disk then // there is no point in attempting to populate data for it. - if (package.Get() != NULL + if (package.IsSet() && (package->State() == ACTIVATED || package->IsLocalFile())) { release_sem_etc(fContentPopulatorSem, 1, 0); } @@ -344,7 +344,7 @@ PackageContentsView::_ContentPopulatorThread(void* arg) package = view->fPackage; } - if (package.Get() != NULL) { + if (package.IsSet()) { if (!view->_PopulatePackageContents(*package.Get())) { if (view->LockLooperWithTimeout(1000000) == B_OK) { view->fContentListView->AddItem( diff --git a/src/apps/haikudepot/ui/PackageInfoView.cpp b/src/apps/haikudepot/ui/PackageInfoView.cpp index 76f098d17e..0f22a54116 100644 --- a/src/apps/haikudepot/ui/PackageInfoView.cpp +++ b/src/apps/haikudepot/ui/PackageInfoView.cpp @@ -635,7 +635,7 @@ private: return; const PackageActionRef& action = fPackageActions[index]; - if (action.Get() == NULL) + if (!action.IsSet()) return; PackageActionList actions; @@ -842,7 +842,7 @@ public: bool hasScreenshot = false; if (countScreenshots > 0) { const BitmapRef& bitmapRef = package.ScreenshotAtIndex(0); - if (bitmapRef.Get() != NULL) { + if (bitmapRef.IsSet()) { HDDEBUG("did find screenshot for package [%s]", package.Name().String()); hasScreenshot = true; @@ -1274,9 +1274,9 @@ public: Select(TAB_ABOUT); TabAt(TAB_CHANGELOG)->SetEnabled( - package.Get() != NULL && package->HasChangelog()); + package.IsSet() && package->HasChangelog()); TabAt(TAB_CONTENTS)->SetEnabled( - package.Get() != NULL + package.IsSet() && (package->State() == ACTIVATED || package->IsLocalFile())); Invalidate(TabFrame(TAB_CHANGELOG)); Invalidate(TabFrame(TAB_CONTENTS)); @@ -1375,7 +1375,7 @@ PackageInfoView::MessageReceived(BMessage* message) switch (message->what) { case MSG_UPDATE_PACKAGE: { - if (fPackageListener->Package().Get() == NULL) + if (!fPackageListener->Package().IsSet()) break; BString name; @@ -1423,7 +1423,7 @@ PackageInfoView::SetPackage(const PackageInfoRef& packageRef) { BAutolock _(fModel->Lock()); - if (packageRef.Get() == NULL) { + if (!packageRef.IsSet()) { Clear(); return; } @@ -1433,7 +1433,7 @@ PackageInfoView::SetPackage(const PackageInfoRef& packageRef) // When asked to display the already showing package ref, // don't switch to the default tab. switchToDefaultTab = false; - } else if (fPackage.Get() != NULL && packageRef.Get() != NULL + } else if (fPackage.IsSet() && packageRef.IsSet() && fPackage->Name() == packageRef->Name()) { // When asked to display a different PackageInfo instance, // but it has the same package title as the already showing diff --git a/src/apps/haikudepot/ui/PackageListView.cpp b/src/apps/haikudepot/ui/PackageListView.cpp index c63e882189..64184385d0 100644 --- a/src/apps/haikudepot/ui/PackageListView.cpp +++ b/src/apps/haikudepot/ui/PackageListView.cpp @@ -358,7 +358,7 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent) bitmapRef); if (bitmapResult == B_OK) { - if (bitmapRef.Get() != NULL) { + if (bitmapRef.IsSet()) { const BBitmap* bitmap = bitmapRef->Bitmap(BITMAP_SIZE_16); parent->SetDrawingMode(B_OP_ALPHA); BRect viewRect(x, y, x + 15, y + 15); @@ -544,7 +544,7 @@ PackageRow::PackageRow(const PackageInfoRef& packageRef, fPackageListener(packageListener), fNextInHash(NULL) { - if (packageRef.Get() == NULL) + if (!packageRef.IsSet()) return; PackageInfo& package = *packageRef.Get(); @@ -577,7 +577,7 @@ PackageRow::PackageRow(const PackageInfoRef& packageRef, PackageRow::~PackageRow() { - if (fPackage.Get() != NULL) + if (fPackage.IsSet()) fPackage->RemoveListener(fPackageListener); } @@ -585,7 +585,7 @@ PackageRow::~PackageRow() void PackageRow::UpdateIconAndTitle() { - if (fPackage.Get() == NULL) + if (!fPackage.IsSet()) return; SetField(new PackageIconAndTitleField( @@ -596,7 +596,7 @@ PackageRow::UpdateIconAndTitle() void PackageRow::UpdateState() { - if (fPackage.Get() == NULL) + if (!fPackage.IsSet()) return; SetField(new BStringField(package_state_to_string(fPackage)), @@ -607,7 +607,7 @@ PackageRow::UpdateState() void PackageRow::UpdateSummary() { - if (fPackage.Get() == NULL) + if (!fPackage.IsSet()) return; SetField(new BStringField(fPackage->ShortDescription()), @@ -618,7 +618,7 @@ PackageRow::UpdateSummary() void PackageRow::UpdateRating() { - if (fPackage.Get() == NULL) + if (!fPackage.IsSet()) return; RatingSummary summary = fPackage->CalculateRatingSummary(); SetField(new RatingField(summary.averageRating), kRatingColumn); @@ -628,7 +628,7 @@ PackageRow::UpdateRating() void PackageRow::UpdateSize() { - if (fPackage.Get() == NULL) + if (!fPackage.IsSet()) return; SetField(new SizeField(fPackage->Size()), kSizeColumn); @@ -638,7 +638,7 @@ PackageRow::UpdateSize() void PackageRow::UpdateRepository() { - if (fPackage.Get() == NULL) + if (!fPackage.IsSet()) return; SetField(new BStringField(fPackage->DepotName()), kRepositoryColumn); @@ -648,7 +648,7 @@ PackageRow::UpdateRepository() void PackageRow::UpdateVersion() { - if (fPackage.Get() == NULL) + if (!fPackage.IsSet()) return; SetField(new BStringField(fPackage->Version().ToString()), kVersionColumn); @@ -983,7 +983,7 @@ PackageListView::AttachWorkStatusView(WorkStatusView* view) PackageRow* PackageListView::_FindRow(const PackageInfoRef& package) { - if (package.Get() == NULL) + if (!package.IsSet()) return NULL; return fRowByNameTable->Lookup(package->Name().String()); } diff --git a/src/apps/haikudepot/ui/RatePackageWindow.cpp b/src/apps/haikudepot/ui/RatePackageWindow.cpp index 8cfd90643f..8830ad684c 100644 --- a/src/apps/haikudepot/ui/RatePackageWindow.cpp +++ b/src/apps/haikudepot/ui/RatePackageWindow.cpp @@ -538,7 +538,7 @@ RatePackageWindow::_QueryRatingThread() BString nickname = fModel.Nickname(); locker.Unlock(); - if (package.Get() == NULL) { + if (!package.IsSet()) { HDERROR("rating query: No package"); _SetWorkerThread(-1); return; diff --git a/src/apps/haikudepot/ui/ScreenshotWindow.cpp b/src/apps/haikudepot/ui/ScreenshotWindow.cpp index 111a13533a..4aad6ae0a3 100644 --- a/src/apps/haikudepot/ui/ScreenshotWindow.cpp +++ b/src/apps/haikudepot/ui/ScreenshotWindow.cpp @@ -172,7 +172,7 @@ ScreenshotWindow::SetPackage(const PackageInfoRef& package) fPackage = package; BString title = B_TRANSLATE("Screenshot"); - if (package.Get() != NULL) { + if (package.IsSet()) { title = package->Title(); _DownloadScreenshot(); } @@ -263,7 +263,7 @@ ScreenshotWindow::_DownloadThread() fScreenshotView->UnsetBitmap(); - if (fPackage.Get() == NULL) + if (!fPackage.IsSet()) HDINFO("package not set"); else { if (fPackage->CountScreenshotInfos() == 0) @@ -276,7 +276,7 @@ ScreenshotWindow::_DownloadThread() Unlock(); - if (info.Get() == NULL) { + if (!info.IsSet()) { HDINFO("screenshot not set"); return; } @@ -314,7 +314,7 @@ ScreenshotWindow::_MaxWidthAndHeightOfAllScreenshots() BSize size(0, 0); // Find out dimensions of the largest screenshot of this package - if (fPackage.Get() != NULL) { + if (fPackage.IsSet()) { int count = fPackage->CountScreenshotInfos(); for(int32 i = 0; i < count; i++) { const ScreenshotInfoRef& info = fPackage->ScreenshotInfoAtIndex(i); diff --git a/src/apps/haikudepot/ui_generic/BitmapView.cpp b/src/apps/haikudepot/ui_generic/BitmapView.cpp index 6b70d0d9ee..51bbb6f5f6 100644 --- a/src/apps/haikudepot/ui_generic/BitmapView.cpp +++ b/src/apps/haikudepot/ui_generic/BitmapView.cpp @@ -140,7 +140,7 @@ BitmapView::SetBitmap(SharedBitmap* bitmap, BitmapSize bitmapSize) void BitmapView::UnsetBitmap() { - if (fReference.Get() == NULL) + if (!fReference.IsSet()) return; fBitmap = NULL; @@ -160,4 +160,4 @@ BitmapView::SetScaleBitmap(bool scaleBitmap) fScaleBitmap = scaleBitmap; Invalidate(); -} \ No newline at end of file +} diff --git a/src/apps/mediaplayer/Controller.cpp b/src/apps/mediaplayer/Controller.cpp index 2138e62f1c..866a0fb566 100644 --- a/src/apps/mediaplayer/Controller.cpp +++ b/src/apps/mediaplayer/Controller.cpp @@ -281,7 +281,7 @@ Controller::SetTo(const PlaylistItemRef& item) fSeekFrame = -1; fRequestedSeekFrame = -1; - if (fItem.Get() == NULL) + if (!fItem.IsSet()) return B_BAD_VALUE; TrackSupplier* trackSupplier = fItem->GetTrackSupplier(); @@ -703,7 +703,7 @@ Controller::TimePosition() status_t Controller::SaveState(bool reset) { - if (fItem.Get() == NULL) + if (!fItem.IsSet()) return B_OK; if (reset) fCurrentFrame = 0; @@ -906,7 +906,7 @@ status_t Controller::GetLocation(BString* location) { // you need to hold the data lock - if (fItem.Get() == NULL) + if (!fItem.IsSet()) return B_NO_INIT; *location = fItem->LocationURI(); return B_OK; @@ -917,7 +917,7 @@ status_t Controller::GetName(BString* name) { // you need to hold the data lock - if (fItem.Get() == NULL) + if (!fItem.IsSet()) return B_NO_INIT; *name = fItem->Name(); return B_OK; diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index 6832535afd..4563b33580 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -726,7 +726,7 @@ MainWin::MessageReceived(BMessage* msg) || index != fPlaylist->CurrentItemIndex()) break; PlaylistItemRef item(fPlaylist->ItemAt(index)); - if (item.Get() != NULL) { + if (item.IsSet()) { printf("open playlist item: %s\n", item->Name().String()); OpenPlaylistItem(item); _MarkPlaylistItem(index); diff --git a/src/kits/debugger/debug_info/ImageDebugInfoLoadingState.cpp b/src/kits/debugger/debug_info/ImageDebugInfoLoadingState.cpp index dffab2fb85..fbf837af48 100644 --- a/src/kits/debugger/debug_info/ImageDebugInfoLoadingState.cpp +++ b/src/kits/debugger/debug_info/ImageDebugInfoLoadingState.cpp @@ -25,7 +25,7 @@ ImageDebugInfoLoadingState::~ImageDebugInfoLoadingState() bool ImageDebugInfoLoadingState::HasSpecificDebugInfoLoadingState() const { - return fSpecificInfoLoadingState.Get() != NULL; + return fSpecificInfoLoadingState.IsSet(); } diff --git a/src/kits/interface/Gradient.cpp b/src/kits/interface/Gradient.cpp index 0002e885ba..c0c8fce68b 100644 --- a/src/kits/interface/Gradient.cpp +++ b/src/kits/interface/Gradient.cpp @@ -568,7 +568,7 @@ BGradient::Unflatten(BGradient *&output, BDataIO* stream) return status; ObjectDeleter gradient(gradient_for_type(gradientType)); - if (gradient.Get() == NULL) + if (!gradient.IsSet()) return B_NO_MEMORY; if (colorsCount > 0) { diff --git a/src/kits/locale/DateFormat.cpp b/src/kits/locale/DateFormat.cpp index b2d28a98b8..eaca192bb3 100644 --- a/src/kits/locale/DateFormat.cpp +++ b/src/kits/locale/DateFormat.cpp @@ -83,7 +83,7 @@ BDateFormat::Format(char* string, const size_t maxSize, const time_t time, const BDateFormatStyle style) const { ObjectDeleter dateFormatter(_CreateDateFormatter(style)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; UnicodeString icuString; @@ -104,13 +104,13 @@ BDateFormat::Format(BString& string, const time_t time, const BDateFormatStyle style, const BTimeZone* timeZone) const { ObjectDeleter dateFormatter(_CreateDateFormatter(style)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; if (timeZone != NULL) { ObjectDeleter icuTimeZone( TimeZone::createTimeZone(timeZone->ID().String())); - if (icuTimeZone.Get() == NULL) + if (!icuTimeZone.IsSet()) return B_NO_MEMORY; dateFormatter->setTimeZone(*icuTimeZone.Get()); } @@ -134,7 +134,7 @@ BDateFormat::Format(BString& string, const BDate& time, return B_BAD_DATA; ObjectDeleter dateFormatter(_CreateDateFormatter(style)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; UErrorCode err = U_ZERO_ERROR; @@ -145,7 +145,7 @@ BDateFormat::Format(BString& string, const BDate& time, if (timeZone != NULL) { ObjectDeleter icuTimeZone( TimeZone::createTimeZone(timeZone->ID().String())); - if (icuTimeZone.Get() == NULL) + if (!icuTimeZone.IsSet()) return B_NO_MEMORY; dateFormatter->setTimeZone(*icuTimeZone.Get()); calendar->setTimeZone(*icuTimeZone.Get()); @@ -172,7 +172,7 @@ BDateFormat::Format(BString& string, int*& fieldPositions, int& fieldCount, const time_t time, const BDateFormatStyle style) const { ObjectDeleter dateFormatter(_CreateDateFormatter(style)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; fieldPositions = NULL; @@ -213,7 +213,7 @@ BDateFormat::GetFields(BDateElement*& fields, int& fieldCount, BDateFormatStyle style) const { ObjectDeleter dateFormatter(_CreateDateFormatter(style)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; fields = NULL; @@ -385,7 +385,7 @@ BDateFormat::Parse(BString source, BDateFormatStyle style, BDate& output) // timezone aware so things like BDate::Difference can work for dates in // different timezones. ObjectDeleter dateFormatter(_CreateDateFormatter(style)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; ParsePosition p(0); diff --git a/src/kits/locale/DateTimeFormat.cpp b/src/kits/locale/DateTimeFormat.cpp index c8d7f34b53..a21d7ac7e4 100644 --- a/src/kits/locale/DateTimeFormat.cpp +++ b/src/kits/locale/DateTimeFormat.cpp @@ -104,7 +104,7 @@ BDateTimeFormat::Format(char* target, size_t maxSize, time_t time, BString format; fConventions.GetDateTimeFormat(dateStyle, timeStyle, format); ObjectDeleter dateFormatter(_CreateDateTimeFormatter(format)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; UnicodeString icuString; @@ -128,13 +128,13 @@ BDateTimeFormat::Format(BString& target, const time_t time, BString format; fConventions.GetDateTimeFormat(dateStyle, timeStyle, format); ObjectDeleter dateFormatter(_CreateDateTimeFormatter(format)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; if (timeZone != NULL) { ObjectDeleter icuTimeZone( TimeZone::createTimeZone(timeZone->ID().String())); - if (icuTimeZone.Get() == NULL) + if (!icuTimeZone.IsSet()) return B_NO_MEMORY; dateFormatter->setTimeZone(*icuTimeZone.Get()); } diff --git a/src/kits/locale/FormattingConventions.cpp b/src/kits/locale/FormattingConventions.cpp index 5601634f61..76d9d0b746 100644 --- a/src/kits/locale/FormattingConventions.cpp +++ b/src/kits/locale/FormattingConventions.cpp @@ -434,7 +434,7 @@ BFormattingConventions::GetDateFormat(BDateFormatStyle style, ObjectDeleter dateFormatter( DateFormat::createDateInstance((DateFormat::EStyle)style, *fICULocale)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; SimpleDateFormat* dateFormatterImpl @@ -467,7 +467,7 @@ BFormattingConventions::GetTimeFormat(BTimeFormatStyle style, ObjectDeleter timeFormatter( DateFormat::createTimeInstance((DateFormat::EStyle)style, *fICULocale)); - if (timeFormatter.Get() == NULL) + if (!timeFormatter.IsSet()) return B_NO_MEMORY; SimpleDateFormat* timeFormatterImpl @@ -511,7 +511,7 @@ BFormattingConventions::GetDateTimeFormat(BDateFormatStyle dateStyle, ObjectDeleter dateFormatter( DateFormat::createDateTimeInstance((DateFormat::EStyle)dateStyle, (DateFormat::EStyle)timeStyle, *fICULocale)); - if (dateFormatter.Get() == NULL) + if (!dateFormatter.IsSet()) return B_NO_MEMORY; SimpleDateFormat* dateFormatterImpl diff --git a/src/kits/locale/TimeFormat.cpp b/src/kits/locale/TimeFormat.cpp index 230cc2a13f..44c64d7004 100644 --- a/src/kits/locale/TimeFormat.cpp +++ b/src/kits/locale/TimeFormat.cpp @@ -67,7 +67,7 @@ BTimeFormat::Format(char* string, size_t maxSize, time_t time, BTimeFormatStyle style) const { ObjectDeleter timeFormatter(_CreateTimeFormatter(style)); - if (timeFormatter.Get() == NULL) + if (!timeFormatter.IsSet()) return B_NO_MEMORY; UnicodeString icuString; @@ -88,13 +88,13 @@ BTimeFormat::Format(BString& string, const time_t time, const BTimeFormatStyle style, const BTimeZone* timeZone) const { ObjectDeleter timeFormatter(_CreateTimeFormatter(style)); - if (timeFormatter.Get() == NULL) + if (!timeFormatter.IsSet()) return B_NO_MEMORY; if (timeZone != NULL) { ObjectDeleter icuTimeZone( TimeZone::createTimeZone(timeZone->ID().String())); - if (icuTimeZone.Get() == NULL) + if (!icuTimeZone.IsSet()) return B_NO_MEMORY; timeFormatter->setTimeZone(*icuTimeZone.Get()); } @@ -115,7 +115,7 @@ BTimeFormat::Format(BString& string, int*& fieldPositions, int& fieldCount, time_t time, BTimeFormatStyle style) const { ObjectDeleter timeFormatter(_CreateTimeFormatter(style)); - if (timeFormatter.Get() == NULL) + if (!timeFormatter.IsSet()) return B_NO_MEMORY; fieldPositions = NULL; @@ -155,7 +155,7 @@ BTimeFormat::GetTimeFields(BDateElement*& fields, int& fieldCount, BTimeFormatStyle style) const { ObjectDeleter timeFormatter(_CreateTimeFormatter(style)); - if (timeFormatter.Get() == NULL) + if (!timeFormatter.IsSet()) return B_NO_MEMORY; fields = NULL; @@ -210,7 +210,7 @@ status_t BTimeFormat::Parse(BString source, BTimeFormatStyle style, BTime& output) { ObjectDeleter timeFormatter(_CreateTimeFormatter(style)); - if (timeFormatter.Get() == NULL) + if (!timeFormatter.IsSet()) return B_NO_MEMORY; // If no timezone is specified in the time string, assume GMT diff --git a/src/kits/network/libnetapi/NetworkAddress.cpp b/src/kits/network/libnetapi/NetworkAddress.cpp index 7eaf5a166c..30be866b58 100644 --- a/src/kits/network/libnetapi/NetworkAddress.cpp +++ b/src/kits/network/libnetapi/NetworkAddress.cpp @@ -162,7 +162,7 @@ BNetworkAddress::SetTo(const char* host, uint16 port, uint32 flags) { BReference resolver = BNetworkAddressResolver::Resolve(host, port, flags); - if (resolver.Get() == NULL) + if (!resolver.IsSet()) return B_NO_MEMORY; status_t status = resolver->InitCheck(); if (status != B_OK) @@ -189,7 +189,7 @@ BNetworkAddress::SetTo(const char* host, const char* service, uint32 flags) { BReference resolver = BNetworkAddressResolver::Resolve(host, service, flags); - if (resolver.Get() == NULL) + if (!resolver.IsSet()) return B_NO_MEMORY; status_t status = resolver->InitCheck(); if (status != B_OK) @@ -223,7 +223,7 @@ BNetworkAddress::SetTo(int family, const char* host, uint16 port, uint32 flags) BReference resolver = BNetworkAddressResolver::Resolve(family, host, port, flags); - if (resolver.Get() == NULL) + if (!resolver.IsSet()) return B_NO_MEMORY; status_t status = resolver->InitCheck(); if (status != B_OK) @@ -252,7 +252,7 @@ BNetworkAddress::SetTo(int family, const char* host, const char* service, BReference resolver = BNetworkAddressResolver::Resolve(family, host, service, flags); - if (resolver.Get() == NULL) + if (!resolver.IsSet()) return B_NO_MEMORY; status_t status = resolver->InitCheck(); if (status != B_OK) diff --git a/src/kits/storage/mime/DatabaseLocation.cpp b/src/kits/storage/mime/DatabaseLocation.cpp index 7ebd10bcf7..7edde916a8 100644 --- a/src/kits/storage/mime/DatabaseLocation.cpp +++ b/src/kits/storage/mime/DatabaseLocation.cpp @@ -832,7 +832,7 @@ DatabaseLocation::_CopyTypeNode(BNode& source, const char* type, BNode& _target) // resize our buffer, if necessary if (info.size > (off_t)bufferSize) { bufferDeleter.SetTo(malloc(info.size)); - if (bufferDeleter.Get() == NULL) + if (!bufferDeleter.IsSet()) return B_NO_MEMORY; bufferSize = info.size; } diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp index a294f0143b..00ee118261 100644 --- a/src/libs/alm/ALMLayout.cpp +++ b/src/libs/alm/ALMLayout.cpp @@ -373,7 +373,7 @@ BReference BALMLayout::AddYTab() { BReference tab(new(std::nothrow) YTab(this), true); - if (tab.Get() == NULL) + if (!tab.IsSet()) return NULL; if (!Solver()->AddVariable(tab)) return NULL; @@ -862,16 +862,16 @@ BALMLayout::AddItem(BLayoutItem* item, XTab* _left, YTab* _top, XTab* _right, debugger("Tab added to unfriendly layout!"); BReference right = _right; - if (right.Get() == NULL) + if (!right.IsSet()) right = AddXTab(); BReference bottom = _bottom; - if (bottom.Get() == NULL) + if (!bottom.IsSet()) bottom = AddYTab(); BReference left = _left; - if (left.Get() == NULL) + if (!left.IsSet()) left = AddXTab(); BReference top = _top; - if (top.Get() == NULL) + if (!top.IsSet()) top = AddYTab(); TabAddTransaction leftTabAdd(this); diff --git a/src/servers/app/Canvas.cpp b/src/servers/app/Canvas.cpp index 5307fa639c..781241d258 100644 --- a/src/servers/app/Canvas.cpp +++ b/src/servers/app/Canvas.cpp @@ -57,7 +57,7 @@ Canvas::~Canvas() status_t Canvas::InitCheck() const { - if (fDrawState.Get() == NULL) + if (!fDrawState.IsSet()) return B_NO_MEMORY; return B_OK; diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index cc2b0387e6..ef2d2dea4e 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -656,7 +656,7 @@ Desktop::SetCursor(ServerCursor* newCursor) fCursor = newCursor; - if (fManagementCursor.Get() == NULL) + if (!fManagementCursor.IsSet()) HWInterface()->SetCursor(newCursor); } @@ -2563,7 +2563,7 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) ObjectDeleter app(new (std::nothrow) ServerApp(this, clientReplyPort, clientLooperPort, clientTeamID, htoken, appSignature)); status_t status = B_OK; - if (app.Get() == NULL) + if (!app.IsSet()) status = B_NO_MEMORY; if (status == B_OK) status = app->InitCheck(); @@ -3771,7 +3771,7 @@ Desktop::_SetWorkspace(int32 index, bool moveFocusWindow) // window if they changed their order ObjectDeleter region(new (std::nothrow) BRegion(window->VisibleRegion())); - if (region.Get() != NULL) { + if (region.IsSet()) { if (previousRegions.AddItem(region.Detach())) windows.AddWindow(window); } diff --git a/src/servers/app/DrawState.cpp b/src/servers/app/DrawState.cpp index a2d9fd547e..8c26c004a1 100644 --- a/src/servers/app/DrawState.cpp +++ b/src/servers/app/DrawState.cpp @@ -244,7 +244,7 @@ DrawState::ReadFromLink(BPrivate::LinkReceiver& link) fAlphaFncMode = info.alphaFunctionMode; fFontAliasing = info.fontAntialiasing; - if (fPreviousState.Get() != NULL) { + if (fPreviousState.IsSet()) { fCombinedOrigin = fPreviousState->fCombinedOrigin + fOrigin; fCombinedScale = fPreviousState->fCombinedScale * fScale; fCombinedTransform = fPreviousState->fCombinedTransform * fTransform; @@ -323,7 +323,7 @@ DrawState::WriteToLink(BPrivate::LinkSender& link) const // TODO: Could be optimized, but is low prio, since most views do not // use a custom clipping region... - if (fClippingRegion.Get() != NULL) { + if (fClippingRegion.IsSet()) { int32 clippingRectCount = fClippingRegion->CountRects(); link.Attach(clippingRectCount); for (int i = 0; i < clippingRectCount; i++) @@ -342,7 +342,7 @@ DrawState::SetOrigin(BPoint origin) // NOTE: the origins of earlier states are never expected to // change, only the topmost state ever changes - if (fPreviousState.Get() != NULL) { + if (fPreviousState.IsSet()) { fCombinedOrigin.x = fPreviousState->fCombinedOrigin.x + fOrigin.x * fPreviousState->fCombinedScale; fCombinedOrigin.y = fPreviousState->fCombinedOrigin.y @@ -363,7 +363,7 @@ DrawState::SetScale(float scale) // NOTE: the scales of earlier states are never expected to // change, only the topmost state ever changes - if (fPreviousState.Get() != NULL) + if (fPreviousState.IsSet()) fCombinedScale = fPreviousState->fCombinedScale * fScale; else fCombinedScale = fScale; @@ -385,7 +385,7 @@ DrawState::SetTransform(BAffineTransform transform) // NOTE: the transforms of earlier states are never expected to // change, only the topmost state ever changes - if (fPreviousState.Get() != NULL) + if (fPreviousState.IsSet()) fCombinedTransform = fPreviousState->fCombinedTransform * fTransform; else fCombinedTransform = fTransform; @@ -420,7 +420,7 @@ void DrawState::SetClippingRegion(const BRegion* region) { if (region) { - if (fClippingRegion.Get() != NULL) + if (fClippingRegion.IsSet()) *fClippingRegion.Get() = *region; else fClippingRegion.SetTo(new(nothrow) BRegion(*region)); @@ -433,9 +433,9 @@ DrawState::SetClippingRegion(const BRegion* region) bool DrawState::HasClipping() const { - if (fClippingRegion.Get() != NULL) + if (fClippingRegion.IsSet()) return true; - if (fPreviousState.Get() != NULL) + if (fPreviousState.IsSet()) return fPreviousState->HasClipping(); return false; } @@ -444,26 +444,26 @@ DrawState::HasClipping() const bool DrawState::HasAdditionalClipping() const { - return fClippingRegion.Get() != NULL; + return fClippingRegion.IsSet(); } bool DrawState::GetCombinedClippingRegion(BRegion* region) const { - if (fClippingRegion.Get() != NULL) { + if (fClippingRegion.IsSet()) { BRegion localTransformedClipping(*fClippingRegion.Get()); SimpleTransform penTransform; Transform(penTransform); penTransform.Apply(&localTransformedClipping); - if (fPreviousState.Get() != NULL + if (fPreviousState.IsSet() && fPreviousState->GetCombinedClippingRegion(region)) { localTransformedClipping.IntersectWith(region); } *region = localTransformedClipping; return true; } else { - if (fPreviousState.Get() != NULL) + if (fPreviousState.IsSet()) return fPreviousState->GetCombinedClippingRegion(region); } return false; @@ -506,7 +506,7 @@ DrawState::ClipToRect(BRect rect, bool inverse) } if (inverse) { - if (fClippingRegion.Get() == NULL) { + if (!fClippingRegion.IsSet()) { fClippingRegion.SetTo(new(nothrow) BRegion(BRect( -(1 << 16), -(1 << 16), (1 << 16), (1 << 16)))); // TODO: we should have a definition for a rect (or region) @@ -514,7 +514,7 @@ DrawState::ClipToRect(BRect rect, bool inverse) } fClippingRegion->Exclude(rect); } else { - if (fClippingRegion.Get() == NULL) + if (!fClippingRegion.IsSet()) fClippingRegion.SetTo(new(nothrow) BRegion(rect)); else { BRegion rectRegion(rect); @@ -827,7 +827,7 @@ DrawState::PrintToStream() const printf("\t LineCap: %d\t LineJoin: %d\t MiterLimit: %.2f\n", (int16)fLineCapMode, (int16)fLineJoinMode, fMiterLimit); - if (fClippingRegion.Get() != NULL) + if (fClippingRegion.IsSet()) fClippingRegion->PrintToStream(); printf("\t ===== Font Data =====\n"); diff --git a/src/servers/app/EventDispatcher.cpp b/src/servers/app/EventDispatcher.cpp index f5fe5e8771..3ec8842677 100644 --- a/src/servers/app/EventDispatcher.cpp +++ b/src/servers/app/EventDispatcher.cpp @@ -343,9 +343,9 @@ EventDispatcher::RemoveTarget(EventTarget& target) if (fPreviousMouseTarget == &target) fPreviousMouseTarget = NULL; - if (fKeyboardFilter.Get() != NULL) + if (fKeyboardFilter.IsSet()) fKeyboardFilter->RemoveTarget(&target); - if (fMouseFilter.Get() != NULL) + if (fMouseFilter.IsSet()) fMouseFilter->RemoveTarget(&target); fTargets.RemoveItem(&target); @@ -812,7 +812,7 @@ EventDispatcher::_EventLoop() #endif pointerEvent = true; - if (fMouseFilter.Get() == NULL) + if (!fMouseFilter.IsSet()) break; EventTarget* mouseTarget = fPreviousMouseTarget; @@ -890,7 +890,7 @@ EventDispatcher::_EventLoop() case B_INPUT_METHOD_EVENT: ETRACE(("key event, focus = %p\n", fFocus)); - if (fKeyboardFilter.Get() != NULL + if (fKeyboardFilter.IsSet() && fKeyboardFilter->Filter(event, &fFocus) == B_SKIP_MESSAGE) { break; diff --git a/src/servers/app/EventStream.cpp b/src/servers/app/EventStream.cpp index 3d96cd854d..aa50275720 100644 --- a/src/servers/app/EventStream.cpp +++ b/src/servers/app/EventStream.cpp @@ -264,7 +264,7 @@ InputServerStream::_MessageFromPort(BMessage** _message, bigtime_t timeout) // we have the message, now let's unflatten it ObjectDeleter message(new BMessage(code)); - if (message.Get() == NULL) + if (!message.IsSet()) return B_NO_MEMORY; if (buffer == NULL) { diff --git a/src/servers/app/Layer.cpp b/src/servers/app/Layer.cpp index b07a398ac4..7ddef3add4 100644 --- a/src/servers/app/Layer.cpp +++ b/src/servers/app/Layer.cpp @@ -122,7 +122,7 @@ Layer::RenderToBitmap(Canvas* canvas) BitmapHWInterface layerInterface(layerBitmap); ObjectDeleter const layerEngine(layerInterface.CreateDrawingEngine()); - if (layerEngine.Get() == NULL) + if (!layerEngine.IsSet()) return NULL; layerEngine->SetRendererOffset(boundingBox.left, boundingBox.top); diff --git a/src/servers/app/OffscreenWindow.cpp b/src/servers/app/OffscreenWindow.cpp index 12ea161136..dca3717843 100644 --- a/src/servers/app/OffscreenWindow.cpp +++ b/src/servers/app/OffscreenWindow.cpp @@ -31,7 +31,7 @@ OffscreenWindow::OffscreenWindow(ServerBitmap* bitmap, fBitmap(bitmap), fHWInterface(new (nothrow) BitmapHWInterface(fBitmap)) { - if (fHWInterface.Get() == NULL || !GetDrawingEngine()) + if (!fHWInterface.IsSet() || !GetDrawingEngine()) return; fHWInterface->Initialize(); @@ -50,7 +50,7 @@ OffscreenWindow::~OffscreenWindow() if (GetDrawingEngine()) GetDrawingEngine()->SetHWInterface(NULL); - if (fHWInterface.Get() != NULL) { + if (fHWInterface.IsSet()) { fHWInterface->LockExclusiveAccess(); fHWInterface->Shutdown(); fHWInterface->UnlockExclusiveAccess(); diff --git a/src/servers/app/Screen.cpp b/src/servers/app/Screen.cpp index 98bae2cb0c..c37096bbbb 100644 --- a/src/servers/app/Screen.cpp +++ b/src/servers/app/Screen.cpp @@ -67,7 +67,7 @@ Screen::~Screen() status_t Screen::Initialize() { - if (fHWInterface.Get() != NULL) { + if (fHWInterface.IsSet()) { // init the graphics hardware return fHWInterface->Initialize(); } @@ -79,7 +79,7 @@ Screen::Initialize() void Screen::Shutdown() { - if (fHWInterface.Get() != NULL) + if (fHWInterface.IsSet()) fHWInterface->Shutdown(); } diff --git a/src/servers/app/ScreenManager.cpp b/src/servers/app/ScreenManager.cpp index a931ba5f27..15c0307f33 100644 --- a/src/servers/app/ScreenManager.cpp +++ b/src/servers/app/ScreenManager.cpp @@ -234,7 +234,7 @@ ScreenManager::_AddHWInterface(HWInterface* interface) item->owner = NULL; item->listener.SetTo( new(nothrow) ScreenChangeListener(*this, screen)); - if (item->listener.Get() != NULL + if (item->listener.IsSet() && interface->AddListener(item->listener.Get())) { if (fScreenList.AddItem(item)) return item; diff --git a/src/servers/app/ServerPicture.cpp b/src/servers/app/ServerPicture.cpp index 0756fe36ad..69de264097 100644 --- a/src/servers/app/ServerPicture.cpp +++ b/src/servers/app/ServerPicture.cpp @@ -1120,7 +1120,7 @@ ServerPicture::ServerPicture(const char* fileName, int32 offset) fToken = gTokenSpace.NewToken(kPictureToken, this); fFile.SetTo(new(std::nothrow) BFile(fileName, B_READ_WRITE)); - if (fFile.Get() == NULL) + if (!fFile.IsSet()) return; BPrivate::Storage::OffsetFile* offsetFile @@ -1142,7 +1142,7 @@ ServerPicture::~ServerPicture() gTokenSpace.RemoveToken(fToken); - if (fPictures.Get() != NULL) { + if (fPictures.IsSet()) { for (int32 i = fPictures->CountItems(); i-- > 0;) { ServerPicture* picture = fPictures->ItemAt(i); picture->SetOwner(NULL); @@ -1314,10 +1314,10 @@ ServerPicture::AppendPicture(ServerPicture* picture) bool ServerPicture::NestPicture(ServerPicture* picture) { - if (fPictures.Get() == NULL) + if (!fPictures.IsSet()) fPictures.SetTo(new(std::nothrow) PictureList); - if (fPictures.Get() == NULL || !fPictures->AddItem(picture)) + if (!fPictures.IsSet() || !fPictures->AddItem(picture)) return false; picture->AcquireReference(); @@ -1328,7 +1328,7 @@ ServerPicture::NestPicture(ServerPicture* picture) off_t ServerPicture::DataLength() const { - if (fData.Get() == NULL) + if (!fData.IsSet()) return 0; off_t size; fData->GetSize(&size); @@ -1369,7 +1369,7 @@ ServerPicture::ExportData(BPrivate::PortLink& link) fData->Seek(0, SEEK_SET); int32 subPicturesCount = 0; - if (fPictures.Get() != NULL) + if (fPictures.IsSet()) subPicturesCount = fPictures->CountItems(); link.Attach(subPicturesCount); if (subPicturesCount > 0) { diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index ffac582539..f512e8a239 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -280,7 +280,7 @@ ServerWindow::Init(BRect frame, window_look look, window_feel feel, // We cannot call MakeWindow in the constructor, since it // is a virtual function! fWindow.SetTo(MakeWindow(frame, fTitle, look, feel, flags, workspace)); - if (fWindow.Get() == NULL || fWindow->InitCheck() != B_OK) { + if (!fWindow.IsSet() || fWindow->InitCheck() != B_OK) { fWindow.Unset(); return B_NO_MEMORY; } @@ -349,7 +349,7 @@ ServerWindow::_Show() // instead of doing it from this thread. fDesktop->UnlockSingleWindow(); fDesktop->ShowWindow(fWindow.Get()); - if (fDirectWindowInfo.Get() != NULL && fDirectWindowInfo->IsFullScreen()) + if (fDirectWindowInfo.IsSet() && fDirectWindowInfo->IsFullScreen()) _ResizeToFullScreen(); fDesktop->LockSingleWindow(); @@ -408,7 +408,7 @@ ServerWindow::SetTitle(const char* newTitle) rename_thread(Thread(), name); } - if (fWindow.Get() != NULL) + if (fWindow.IsSet()) fDesktop->SetWindowTitle(fWindow.Get(), newTitle); } @@ -972,7 +972,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) Title())); int32 size; - if (fWindow.Get() != NULL && link.Read(&size) == B_OK) { + if (fWindow.IsSet() && link.Read(&size) == B_OK) { char buffer[size]; if (link.Read(buffer, size) == B_OK) { BMessage settings; @@ -1096,7 +1096,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) link.Read(&enable); status_t status = B_OK; - if (fDirectWindowInfo.Get() != NULL) + if (fDirectWindowInfo.IsSet()) _DirectWindowSetFullScreen(enable); else status = B_BAD_TYPE; @@ -3650,7 +3650,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver& link) ArrayDeleter opList(new(std::nothrow) uint32[opCount]); ArrayDeleter ptList(new(std::nothrow) BPoint[ptCount]); - if (opList.Get() == NULL || ptList.Get() == NULL + if (!opList.IsSet() || !ptList.IsSet() || link.Read(opList.Get(), opCount * sizeof(uint32)) != B_OK || link.Read(ptList.Get(), ptCount * sizeof(BPoint)) != B_OK) break; @@ -4289,7 +4289,7 @@ ServerWindow::ScreenChanged(const BMessage* message) { SendMessageToClient(message); - if (fDirectWindowInfo.Get() != NULL && fDirectWindowInfo->IsFullScreen()) + if (fDirectWindowInfo.IsSet() && fDirectWindowInfo->IsFullScreen()) _ResizeToFullScreen(); } @@ -4323,7 +4323,7 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState) { ASSERT_MULTI_LOCKED(fDesktop->WindowLocker()); - if (fDirectWindowInfo.Get() == NULL) + if (!fDirectWindowInfo.IsSet()) return; STRACE(("HandleDirectConnection(bufferState = %" B_PRId32 ", driverState = " @@ -4475,7 +4475,7 @@ ServerWindow::_ResizeToFullScreen() status_t ServerWindow::_EnableDirectWindowMode() { - if (fDirectWindowInfo.Get() != NULL) { + if (fDirectWindowInfo.IsSet()) { // already in direct window mode return B_ERROR; } @@ -4486,7 +4486,7 @@ ServerWindow::_EnableDirectWindowMode() } fDirectWindowInfo.SetTo(new(std::nothrow) DirectWindowInfo); - if (fDirectWindowInfo.Get() == NULL) + if (!fDirectWindowInfo.IsSet()) return B_NO_MEMORY; status_t status = fDirectWindowInfo->InitCheck(); diff --git a/src/servers/app/ServerWindow.h b/src/servers/app/ServerWindow.h index 7141726986..86b352f270 100644 --- a/src/servers/app/ServerWindow.h +++ b/src/servers/app/ServerWindow.h @@ -107,7 +107,7 @@ public: void HandleDirectConnection(int32 bufferState, int32 driverState = 0); bool HasDirectFrameBufferAccess() const - { return fDirectWindowInfo.Get() != NULL; } + { return fDirectWindowInfo.IsSet(); } bool IsDirectlyAccessing() const { return fIsDirectlyAccessing; } diff --git a/src/servers/app/View.cpp b/src/servers/app/View.cpp index 0e3b561616..b9708dbe60 100644 --- a/src/servers/app/View.cpp +++ b/src/servers/app/View.cpp @@ -126,7 +126,7 @@ View::View(IntRect frame, IntPoint scrollingOffset, const char* name, fUserClipping(NULL), fScreenAndUserClipping(NULL) { - if (fDrawState.Get() != NULL) + if (fDrawState.IsSet()) fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE); } @@ -1349,13 +1349,13 @@ View::PrintToStream() const printf(" valid: %d\n", fScreenClippingValid); printf(" fUserClipping:\n"); - if (fUserClipping.Get() != NULL) + if (fUserClipping.IsSet()) fUserClipping->PrintToStream(); else printf(" none\n"); printf(" fScreenAndUserClipping:\n"); - if (fScreenAndUserClipping.Get() != NULL) + if (fScreenAndUserClipping.IsSet()) fScreenAndUserClipping->PrintToStream(); else printf(" invalid\n"); @@ -1409,9 +1409,9 @@ View::RebuildClipping(bool deep) // hand, views for which this feature is actually used will // probably not have any children, so it is not that expensive // after all - if (fUserClipping.Get() == NULL) { + if (!fUserClipping.IsSet()) { fUserClipping.SetTo(new (nothrow) BRegion); - if (fUserClipping.Get() == NULL) + if (!fUserClipping.IsSet()) return; } @@ -1429,16 +1429,16 @@ BRegion& View::ScreenAndUserClipping(BRegion* windowContentClipping, bool force) const { // no user clipping - return screen clipping directly - if (fUserClipping.Get() == NULL) + if (!fUserClipping.IsSet()) return _ScreenClipping(windowContentClipping, force); // combined screen and user clipping already valid - if (fScreenAndUserClipping.Get() != NULL) + if (fScreenAndUserClipping.IsSet()) return *fScreenAndUserClipping.Get(); // build a new combined user and screen clipping fScreenAndUserClipping.SetTo(new (nothrow) BRegion(*fUserClipping.Get())); - if (fScreenAndUserClipping.Get() == NULL) + if (!fScreenAndUserClipping.IsSet()) return fScreenClipping; LocalToScreenTransform().Apply(fScreenAndUserClipping.Get()); diff --git a/src/servers/app/View.h b/src/servers/app/View.h index d5a7ee2f7e..331072e7e6 100644 --- a/src/servers/app/View.h +++ b/src/servers/app/View.h @@ -210,9 +210,9 @@ public: inline bool IsScreenClippingValid() const { return fScreenClippingValid - && (fUserClipping.Get() == NULL - || (fUserClipping.Get() != NULL - && fScreenAndUserClipping.Get() != NULL)); + && (!fUserClipping.IsSet() + || (fUserClipping.IsSet() + && fScreenAndUserClipping.IsSet())); } // debugging diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 552badc188..1cef1b2e62 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -129,7 +129,7 @@ Window::Window(const BRect& frame, const char *name, SetFlags(flags, NULL); - if (fLook != B_NO_BORDER_WINDOW_LOOK && fCurrentStack.Get() != NULL) { + if (fLook != B_NO_BORDER_WINDOW_LOOK && fCurrentStack.IsSet()) { // allocates a decorator ::Decorator* decorator = Decorator(); if (decorator != NULL) { @@ -167,7 +167,7 @@ Window::Window(const BRect& frame, const char *name, Window::~Window() { - if (fTopView.Get() != NULL) { + if (fTopView.IsSet()) { fTopView->DetachedFromWindow(); } @@ -181,7 +181,7 @@ status_t Window::InitCheck() const { if (GetDrawingEngine() == NULL - || (fFeel != kOffscreenWindowFeel && fWindowBehaviour.Get() == NULL)) + || (fFeel != kOffscreenWindowFeel && !fWindowBehaviour.IsSet())) return B_NO_MEMORY; // TODO: anything else? return B_OK; @@ -298,7 +298,7 @@ Window::MoveBy(int32 x, int32 y, bool moveStack) fEffectiveDrawingRegionValid = false; - if (fTopView.Get() != NULL) { + if (fTopView.IsSet()) { fTopView->MoveBy(x, y, NULL); fTopView->UpdateOverlay(); } @@ -365,7 +365,7 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion, bool resizeStack) fContentRegionValid = false; fEffectiveDrawingRegionValid = false; - if (fTopView.Get() != NULL) { + if (fTopView.IsSet()) { fTopView->ResizeBy(x, y, dirtyRegion); fTopView->UpdateOverlay(); } @@ -515,13 +515,13 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset) void Window::SetTopView(View* topView) { - if (fTopView.Get() != NULL) { + if (fTopView.IsSet()) { fTopView->DetachedFromWindow(); } fTopView.SetTo(topView); - if (fTopView.Get() != NULL) { + if (fTopView.IsSet()) { // the top view is special, it has a coordinate system // as if it was attached directly to the desktop, therefor, // the coordinate conversion through the view tree works @@ -572,7 +572,7 @@ Window::PreviousWindow(int32 index) const ::Decorator* Window::Decorator() const { - if (fCurrentStack.Get() == NULL) + if (!fCurrentStack.IsSet()) return NULL; return fCurrentStack->Decorator(); } @@ -1118,7 +1118,7 @@ Window::IsVisible() const bool Window::IsDragging() const { - if (fWindowBehaviour.Get() == NULL) + if (!fWindowBehaviour.IsSet()) return false; return fWindowBehaviour->IsDragging(); } @@ -1127,7 +1127,7 @@ Window::IsDragging() const bool Window::IsResizing() const { - if (fWindowBehaviour.Get() == NULL) + if (!fWindowBehaviour.IsSet()) return false; return fWindowBehaviour->IsResizing(); } @@ -1261,7 +1261,7 @@ Window::SetLook(window_look look, BRegion* updateRegion) // ...and therefor the drawing region is // likely not valid anymore either - if (fCurrentStack.Get() == NULL) + if (!fCurrentStack.IsSet()) return; int32 stackPosition = PositionInStack(); @@ -2073,7 +2073,7 @@ Window::UpdateSession::AddCause(uint8 cause) int32 Window::PositionInStack() const { - if (fCurrentStack.Get() == NULL) + if (!fCurrentStack.IsSet()) return -1; return fCurrentStack->WindowList().IndexOf(this); } @@ -2085,7 +2085,7 @@ Window::DetachFromWindowStack(bool ownStackNeeded) // The lock must normally be held but is not held when closing the window. //ASSERT_MULTI_WRITE_LOCKED(fDesktop->WindowLocker()); - if (fCurrentStack.Get() == NULL) + if (!fCurrentStack.IsSet()) return false; if (fCurrentStack->CountWindows() == 1) return true; @@ -2196,7 +2196,7 @@ Window::StackedWindowAt(const BPoint& where) Window* Window::TopLayerStackWindow() { - if (fCurrentStack.Get() == NULL) + if (!fCurrentStack.IsSet()) return this; return fCurrentStack->TopLayerWindow(); } @@ -2205,7 +2205,7 @@ Window::TopLayerStackWindow() WindowStack* Window::GetWindowStack() { - if (fCurrentStack.Get() == NULL) + if (!fCurrentStack.IsSet()) return _InitWindowStack(); return fCurrentStack; } @@ -2227,7 +2227,7 @@ Window::MoveToTopStackLayer() bool Window::MoveToStackPosition(int32 to, bool isMoving) { - if (fCurrentStack.Get() == NULL) + if (!fCurrentStack.IsSet()) return false; int32 index = PositionInStack(); if (fCurrentStack->Move(index, to) == false) diff --git a/src/servers/app/decorator/DefaultWindowBehaviour.cpp b/src/servers/app/decorator/DefaultWindowBehaviour.cpp index e9818de666..5a75e2847a 100644 --- a/src/servers/app/decorator/DefaultWindowBehaviour.cpp +++ b/src/servers/app/decorator/DefaultWindowBehaviour.cpp @@ -724,7 +724,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where, } // if a state is active, let it do the job - if (fState.Get() != NULL) { + if (fState.IsSet()) { bool unhandled = false; bool result = fState->MouseDown(message, where, unhandled); if (!unhandled) @@ -917,7 +917,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where, void DefaultWindowBehaviour::MouseUp(BMessage* message, BPoint where) { - if (fState.Get() != NULL) + if (fState.IsSet()) fState->MouseUp(message, where); } @@ -925,7 +925,7 @@ DefaultWindowBehaviour::MouseUp(BMessage* message, BPoint where) void DefaultWindowBehaviour::MouseMoved(BMessage* message, BPoint where, bool isFake) { - if (fState.Get() != NULL) { + if (fState.IsSet()) { fState->MouseMoved(message, where, isFake); } else { // If the window modifiers are hold, enter the window management state. @@ -952,7 +952,7 @@ DefaultWindowBehaviour::ModifiersChanged(int32 modifiers) int32 buttons; fDesktop->GetLastMouseState(&where, &buttons); - if (fState.Get() != NULL) { + if (fState.IsSet()) { fState->ModifiersChanged(where, modifiers); } else { // If the window modifiers are hold, enter the window management state. @@ -1164,17 +1164,17 @@ void DefaultWindowBehaviour::_NextState(State* state) { // exit the old state - if (fState.Get() != NULL) + if (fState.IsSet()) fState->ExitState(state); // set and enter the new state ObjectDeleter oldState(fState.Detach()); fState.SetTo(state); - if (fState.Get() != NULL) { + if (fState.IsSet()) { fState->EnterState(oldState.Get()); fDesktop->SetMouseEventWindow(fWindow); - } else if (oldState.Get() != NULL) { + } else if (oldState.IsSet()) { // no state anymore -- reset the mouse event window, if it's still us if (fDesktop->MouseEventWindow() == fWindow) fDesktop->SetMouseEventWindow(NULL); diff --git a/src/servers/app/drawing/AlphaMask.cpp b/src/servers/app/drawing/AlphaMask.cpp index 73d64ece2c..78b1708e6a 100644 --- a/src/servers/app/drawing/AlphaMask.cpp +++ b/src/servers/app/drawing/AlphaMask.cpp @@ -101,7 +101,7 @@ AlphaMask::AlphaMask(uint8 backgroundOpacity) AlphaMask::~AlphaMask() { - if (fPreviousMask.Get() != NULL) + if (fPreviousMask.IsSet()) atomic_add(&fPreviousMask->fNextMaskCount, -1); recursive_lock_destroy(&fLock); @@ -339,7 +339,7 @@ VectorAlphaMask::_RenderSource(const IntRect& canvasBounds) // Render the picture to the bitmap BitmapHWInterface interface(bitmap); ObjectDeleter engine(interface.CreateDrawingEngine()); - if (engine.Get() == NULL) + if (!engine.IsSet()) return NULL; engine->SetRendererOffset(fBounds.left, fBounds.top); diff --git a/src/servers/app/drawing/BBitmapBuffer.cpp b/src/servers/app/drawing/BBitmapBuffer.cpp index 383c11a1b0..c19b817296 100644 --- a/src/servers/app/drawing/BBitmapBuffer.cpp +++ b/src/servers/app/drawing/BBitmapBuffer.cpp @@ -20,7 +20,7 @@ status_t BBitmapBuffer::InitCheck() const { status_t ret = B_NO_INIT; - if (fBitmap.Get() != NULL) + if (fBitmap.IsSet()) ret = fBitmap->InitCheck(); return ret; } diff --git a/src/servers/app/drawing/BitmapDrawingEngine.cpp b/src/servers/app/drawing/BitmapDrawingEngine.cpp index bf652efd0e..8e7ca58fca 100644 --- a/src/servers/app/drawing/BitmapDrawingEngine.cpp +++ b/src/servers/app/drawing/BitmapDrawingEngine.cpp @@ -48,7 +48,7 @@ BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight) } SetHWInterface(NULL); - if (fHWInterface.Get() != NULL) { + if (fHWInterface.IsSet()) { fHWInterface->LockExclusiveAccess(); fHWInterface->Shutdown(); fHWInterface->UnlockExclusiveAccess(); @@ -60,11 +60,11 @@ BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight) fBitmap.SetTo(new(std::nothrow) UtilityBitmap(BRect(0, 0, newWidth - 1, newHeight - 1), fColorSpace, 0)); - if (fBitmap.Get() == NULL) + if (!fBitmap.IsSet()) return B_NO_MEMORY; fHWInterface.SetTo(new(std::nothrow) BitmapHWInterface(fBitmap)); - if (fHWInterface.Get() == NULL) + if (!fHWInterface.IsSet()) return B_NO_MEMORY; status_t result = fHWInterface->Initialize(); diff --git a/src/servers/app/drawing/BitmapHWInterface.cpp b/src/servers/app/drawing/BitmapHWInterface.cpp index c748953584..993493c7b6 100644 --- a/src/servers/app/drawing/BitmapHWInterface.cpp +++ b/src/servers/app/drawing/BitmapHWInterface.cpp @@ -205,8 +205,8 @@ bool BitmapHWInterface::IsDoubleBuffered() const { // overwrite double buffered preference - if (fFrontBuffer.Get() != NULL) - return fBackBuffer.Get() != NULL; + if (fFrontBuffer.IsSet()) + return fBackBuffer.IsSet(); return HWInterface::IsDoubleBuffered(); } diff --git a/src/servers/app/drawing/DWindowHWInterface.cpp b/src/servers/app/drawing/DWindowHWInterface.cpp index 376a0f006c..a6f043dfc3 100644 --- a/src/servers/app/drawing/DWindowHWInterface.cpp +++ b/src/servers/app/drawing/DWindowHWInterface.cpp @@ -653,7 +653,7 @@ DWindowHWInterface::SetMode(const display_mode& mode) status_t ret = B_OK; // prevent from doing the unnecessary - if (fFrontBuffer.Get() != NULL + if (fFrontBuffer.IsSet() && fDisplayMode.virtual_width == mode.virtual_width && fDisplayMode.virtual_height == mode.virtual_height && fDisplayMode.space == mode.space) @@ -772,7 +772,7 @@ DWindowHWInterface::GetDeviceInfo(accelerant_device_info* info) status_t DWindowHWInterface::GetFrameBufferConfig(frame_buffer_config& config) { - if (fFrontBuffer.Get() == NULL) + if (!fFrontBuffer.IsSet()) return B_ERROR; config.frame_buffer = fFrontBuffer->Bits(); diff --git a/src/servers/app/drawing/HWInterface.cpp b/src/servers/app/drawing/HWInterface.cpp index bb1d9c4119..91e91913cc 100644 --- a/src/servers/app/drawing/HWInterface.cpp +++ b/src/servers/app/drawing/HWInterface.cpp @@ -235,7 +235,7 @@ HWInterface::MoveCursorTo(float x, float y) // anything if the cursor is hidden // (invalid cursor frame), but explicitly // testing for it here saves us some cycles - if (fCursorAreaBackup.Get() != NULL) { + if (fCursorAreaBackup.IsSet()) { // means we have a software cursor which we need to draw _RestoreCursorArea(); _DrawCursor(_CursorFrame()); @@ -294,12 +294,12 @@ void HWInterface::SetAsyncDoubleBuffered(bool doubleBuffered) { if (doubleBuffered) { - if (fUpdateExecutor.Get() != NULL) + if (fUpdateExecutor.IsSet()) return; fUpdateExecutor.SetTo(new (nothrow) UpdateQueue(this)); AddListener(fUpdateExecutor.Get()); } else { - if (fUpdateExecutor.Get() == NULL) + if (!fUpdateExecutor.IsSet()) return; RemoveListener(fUpdateExecutor.Get()); fUpdateExecutor.Unset(); @@ -480,7 +480,7 @@ HWInterface::HideFloatingOverlays(const BRect& area) return false; if (!fFloatingOverlaysLock.Lock()) return false; - if (fCursorAreaBackup.Get() != NULL && !fCursorAreaBackup->cursor_hidden) { + if (fCursorAreaBackup.IsSet() && !fCursorAreaBackup->cursor_hidden) { BRect backupArea(fCursorAreaBackup->left, fCursorAreaBackup->top, fCursorAreaBackup->right, fCursorAreaBackup->bottom); if (area.Intersects(backupArea)) { @@ -510,7 +510,7 @@ HWInterface::HideFloatingOverlays() void HWInterface::ShowFloatingOverlays() { - if (fCursorAreaBackup.Get() != NULL && fCursorAreaBackup->cursor_hidden) + if (fCursorAreaBackup.IsSet() && fCursorAreaBackup->cursor_hidden) _DrawCursor(_CursorFrame()); fFloatingOverlaysLock.Unlock(); @@ -588,7 +588,7 @@ HWInterface::_DrawCursor(IntRect area) const uint8* dst = buffer; - if (fCursorAreaBackup.Get() != NULL && fCursorAreaBackup->buffer + if (fCursorAreaBackup.IsSet() && fCursorAreaBackup->buffer && fFloatingOverlaysLock.Lock()) { fCursorAreaBackup->cursor_hidden = false; // remember which area the backup contains @@ -885,7 +885,7 @@ HWInterface::_CursorFrame() const void HWInterface::_RestoreCursorArea() const { - if (fCursorAreaBackup.Get() != NULL && !fCursorAreaBackup->cursor_hidden) { + if (fCursorAreaBackup.IsSet() && !fCursorAreaBackup->cursor_hidden) { _CopyToFront(fCursorAreaBackup->buffer, fCursorAreaBackup->bpr, fCursorAreaBackup->left, fCursorAreaBackup->top, fCursorAreaBackup->right, fCursorAreaBackup->bottom); diff --git a/src/servers/app/drawing/ViewHWInterface.cpp b/src/servers/app/drawing/ViewHWInterface.cpp index 351ed58ef1..95e9914cb1 100644 --- a/src/servers/app/drawing/ViewHWInterface.cpp +++ b/src/servers/app/drawing/ViewHWInterface.cpp @@ -437,7 +437,7 @@ ViewHWInterface::SetMode(const display_mode& mode) status_t ret = B_OK; // prevent from doing the unnecessary - if (fBackBuffer.Get() != NULL && fFrontBuffer.Get() != NULL + if (fBackBuffer.IsSet() && fFrontBuffer.IsSet() && fDisplayMode.virtual_width == mode.virtual_width && fDisplayMode.virtual_height == mode.virtual_height && fDisplayMode.space == mode.space) @@ -549,7 +549,7 @@ ViewHWInterface::SetMode(const display_mode& mode) if (ret >= B_OK) { // clear out buffers, alpha is 255 this way // TODO: maybe this should handle different color spaces in different ways - if (fBackBuffer.Get() != NULL) + if (fBackBuffer.IsSet()) memset(fBackBuffer->Bits(), 255, fBackBuffer->BitsLength()); memset(fFrontBuffer->Bits(), 255, fFrontBuffer->BitsLength()); @@ -603,7 +603,7 @@ ViewHWInterface::GetDeviceInfo(accelerant_device_info* info) status_t ViewHWInterface::GetFrameBufferConfig(frame_buffer_config& config) { - if (fFrontBuffer.Get() == NULL) + if (!fFrontBuffer.IsSet()) return B_ERROR; config.frame_buffer = fFrontBuffer->Bits(); @@ -777,8 +777,8 @@ ViewHWInterface::BackBuffer() const bool ViewHWInterface::IsDoubleBuffered() const { - if (fFrontBuffer.Get() != NULL) - return fBackBuffer.Get() != NULL; + if (fFrontBuffer.IsSet()) + return fBackBuffer.IsSet(); return HWInterface::IsDoubleBuffered(); } diff --git a/src/servers/app/drawing/interface/local/AccelerantHWInterface.cpp b/src/servers/app/drawing/interface/local/AccelerantHWInterface.cpp index 3dee893c94..3c41f21fb8 100644 --- a/src/servers/app/drawing/interface/local/AccelerantHWInterface.cpp +++ b/src/servers/app/drawing/interface/local/AccelerantHWInterface.cpp @@ -564,7 +564,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode) // error. // prevent from doing the unnecessary - if (fModeCount > 0 && fFrontBuffer.Get() != NULL && fDisplayMode == mode) { + if (fModeCount > 0 && fFrontBuffer.IsSet() && fDisplayMode == mode) { // TODO: better comparison of display modes return B_OK; } @@ -574,7 +574,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode) if (!_IsValidMode(mode)) return B_BAD_VALUE; - if (fFrontBuffer.Get() == NULL) + if (!fFrontBuffer.IsSet()) return B_NO_INIT; // just try to set the mode - we let the graphics driver @@ -680,11 +680,11 @@ AccelerantHWInterface::SetMode(const display_mode& mode) fOffscreenBackBuffer = false; // update backbuffer if neccessary - if (fBackBuffer.Get() == NULL + if (!fBackBuffer.IsSet() || fBackBuffer->Width() != fFrontBuffer->Width() || fBackBuffer->Height() != fFrontBuffer->Height() || fOffscreenBackBuffer - || (fFrontBuffer->ColorSpace() == B_RGB32 && fBackBuffer.Get() != NULL + || (fFrontBuffer->ColorSpace() == B_RGB32 && fBackBuffer.IsSet() && !HWInterface::IsDoubleBuffered())) { // NOTE: backbuffer is always B_RGBA32, this simplifies the // drawing backend implementation tremendously for the time @@ -713,7 +713,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode) fFrontBuffer->Width(), fFrontBuffer->Height())); } - status = fBackBuffer.Get() != NULL + status = fBackBuffer.IsSet() ? fBackBuffer->InitCheck() : B_NO_MEMORY; if (status < B_OK) { fBackBuffer.Unset(); @@ -1530,7 +1530,7 @@ AccelerantHWInterface::BackBuffer() const bool AccelerantHWInterface::IsDoubleBuffered() const { - return fBackBuffer.Get() != NULL; + return fBackBuffer.IsSet(); } diff --git a/src/servers/app/drawing/interface/remote/NetReceiver.cpp b/src/servers/app/drawing/interface/remote/NetReceiver.cpp index cefdf1e6f6..ffdcbc4984 100644 --- a/src/servers/app/drawing/interface/remote/NetReceiver.cpp +++ b/src/servers/app/drawing/interface/remote/NetReceiver.cpp @@ -70,7 +70,7 @@ NetReceiver::_Listen() while (!fStopThread) { fEndpoint.SetTo(fListener->Accept(5000)); - if (fEndpoint.Get() == NULL) { + if (!fEndpoint.IsSet()) { TRACE("got NULL endpoint from accept\n"); continue; } diff --git a/src/servers/app/drawing/interface/remote/RemoteDrawingEngine.cpp b/src/servers/app/drawing/interface/remote/RemoteDrawingEngine.cpp index a3a68617ae..dc0b701bae 100644 --- a/src/servers/app/drawing/interface/remote/RemoteDrawingEngine.cpp +++ b/src/servers/app/drawing/interface/remote/RemoteDrawingEngine.cpp @@ -1107,10 +1107,10 @@ RemoteDrawingEngine::_ExtractBitmapRegions(ServerBitmap& bitmap, uint32 options, * (int32)(sourceRect.Height() + 1.5))) { // the target bitmap is smaller than the source, scale it locally // and send over the smaller version to avoid sending any extra data - if (fBitmapDrawingEngine.Get() == NULL) { + if (!fBitmapDrawingEngine.IsSet()) { fBitmapDrawingEngine.SetTo( new(std::nothrow) BitmapDrawingEngine(B_RGBA32)); - if (fBitmapDrawingEngine.Get() == NULL) + if (!fBitmapDrawingEngine.IsSet()) result = B_NO_MEMORY; } diff --git a/src/servers/app/drawing/interface/remote/RemoteHWInterface.cpp b/src/servers/app/drawing/interface/remote/RemoteHWInterface.cpp index 0362699f50..a8af706102 100644 --- a/src/servers/app/drawing/interface/remote/RemoteHWInterface.cpp +++ b/src/servers/app/drawing/interface/remote/RemoteHWInterface.cpp @@ -67,7 +67,7 @@ RemoteHWInterface::RemoteHWInterface(const char* target) } fListenEndpoint.SetTo(new(std::nothrow) BNetEndpoint()); - if (fListenEndpoint.Get() == NULL) { + if (!fListenEndpoint.IsSet()) { fInitStatus = B_NO_MEMORY; return; } @@ -77,7 +77,7 @@ RemoteHWInterface::RemoteHWInterface(const char* target) return; fSendBuffer.SetTo(new(std::nothrow) StreamingRingBuffer(16 * 1024)); - if (fSendBuffer.Get() == NULL) { + if (!fSendBuffer.IsSet()) { fInitStatus = B_NO_MEMORY; return; } @@ -87,7 +87,7 @@ RemoteHWInterface::RemoteHWInterface(const char* target) return; fReceiveBuffer.SetTo(new(std::nothrow) StreamingRingBuffer(16 * 1024)); - if (fReceiveBuffer.Get() == NULL) { + if (!fReceiveBuffer.IsSet()) { fInitStatus = B_NO_MEMORY; return; } @@ -98,13 +98,13 @@ RemoteHWInterface::RemoteHWInterface(const char* target) fReceiver.SetTo(new(std::nothrow) NetReceiver(fListenEndpoint.Get(), fReceiveBuffer.Get(), _NewConnectionCallback, this)); - if (fReceiver.Get() == NULL) { + if (!fReceiver.IsSet()) { fInitStatus = B_NO_MEMORY; return; } fEventStream.SetTo(new(std::nothrow) RemoteEventStream()); - if (fEventStream.Get() == NULL) { + if (!fEventStream.IsSet()) { fInitStatus = B_NO_MEMORY; return; } @@ -335,7 +335,7 @@ RemoteHWInterface::_NewConnection(BNetEndpoint &endpoint) return B_NO_MEMORY; fSender.SetTo(new(std::nothrow) NetSender(sendEndpoint, fSendBuffer.Get())); - if (fSender.Get() == NULL) { + if (!fSender.IsSet()) { delete sendEndpoint; return B_NO_MEMORY; } @@ -354,7 +354,7 @@ RemoteHWInterface::_Disconnect() fIsConnected = false; } - if (fListenEndpoint.Get() != NULL) + if (fListenEndpoint.IsSet()) fListenEndpoint->Close(); } diff --git a/src/servers/app/font/FontCacheEntry.cpp b/src/servers/app/font/FontCacheEntry.cpp index 4a044e2013..d38e89280d 100644 --- a/src/servers/app/font/FontCacheEntry.cpp +++ b/src/servers/app/font/FontCacheEntry.cpp @@ -149,7 +149,7 @@ FontCacheEntry::~FontCacheEntry() bool FontCacheEntry::Init(const ServerFont& font, bool forceVector) { - if (fGlyphCache.Get() == NULL) + if (!fGlyphCache.IsSet()) return false; glyph_rendering renderingType = _RenderTypeFor(font, forceVector); diff --git a/src/servers/app/font/FontManager.cpp b/src/servers/app/font/FontManager.cpp index adec713314..a98b03ae86 100644 --- a/src/servers/app/font/FontManager.cpp +++ b/src/servers/app/font/FontManager.cpp @@ -469,7 +469,7 @@ FontManager::_SetDefaultFonts() fDefaultPlainFont.SetTo(new (std::nothrow) ServerFont(*style, DEFAULT_PLAIN_FONT_SIZE)); - if (fDefaultPlainFont.Get() == NULL) + if (!fDefaultPlainFont.IsSet()) return B_NO_MEMORY; // bold font @@ -478,7 +478,7 @@ FontManager::_SetDefaultFonts() fDefaultBoldFont.SetTo(new (std::nothrow) ServerFont(*style, DEFAULT_BOLD_FONT_SIZE)); - if (fDefaultBoldFont.Get() == NULL) + if (!fDefaultBoldFont.IsSet()) return B_NO_MEMORY; // fixed font @@ -487,7 +487,7 @@ FontManager::_SetDefaultFonts() fDefaultFixedFont.SetTo(new (std::nothrow) ServerFont(*style, DEFAULT_FIXED_FONT_SIZE)); - if (fDefaultFixedFont.Get() == NULL) + if (!fDefaultFixedFont.IsSet()) return B_NO_MEMORY; fDefaultFixedFont->SetSpacing(B_FIXED_SPACING); diff --git a/src/servers/app/stackandtile/SATGroup.cpp b/src/servers/app/stackandtile/SATGroup.cpp index 572ec34936..805e6a6b78 100644 --- a/src/servers/app/stackandtile/SATGroup.cpp +++ b/src/servers/app/stackandtile/SATGroup.cpp @@ -914,7 +914,7 @@ SATGroup::RemoveWindow(SATWindow* window, bool stayBelowMouse) // We need the area a little bit longer because the area could hold the // last reference to the group. BReference area = window->GetWindowArea(); - if (area.Get() != NULL) + if (area.IsSet()) area->_RemoveWindow(window); window->RemovedFromGroup(this, stayBelowMouse);