use .IsSet() instead if .Get() != NULL

Change-Id: Ia2b7a719fd398e78cc3b11d4f7b02cb81179f65f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3488
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
X512 2020-12-10 04:02:02 +09:00 committed by Jérôme Duval
parent 89dae40a65
commit 779ab335dd
70 changed files with 277 additions and 277 deletions

View File

@ -187,7 +187,7 @@ status_t
PackageLinkSymlink::OpenAttribute(const StringKey& name, int openMode, PackageLinkSymlink::OpenAttribute(const StringKey& name, int openMode,
AttributeCookie*& _cookie) AttributeCookie*& _cookie)
{ {
if (fPackage.Get() == NULL) if (!fPackage.IsSet())
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
return AutoPackageAttributes::OpenCookie(fPackage, name, openMode, _cookie); return AutoPackageAttributes::OpenCookie(fPackage, name, openMode, _cookie);

View File

@ -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, 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->family, socket->type, socket->protocol, socket->owner,
socket->first_protocol, socket->first_info, parent.Get(), 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<net_socket_private> parent = socket->parent.GetReference(); BReference<net_socket_private> parent = socket->parent.GetReference();
if (parent.Get() == NULL) if (!parent.IsSet())
return B_BAD_VALUE; return B_BAD_VALUE;
MutexLocker _(parent->lock); MutexLocker _(parent->lock);
@ -864,7 +864,7 @@ socket_aborted(net_socket* _socket)
TRACE("socket_aborted(%p)\n", socket); TRACE("socket_aborted(%p)\n", socket);
BReference<net_socket_private> parent = socket->parent.GetReference(); BReference<net_socket_private> parent = socket->parent.GetReference();
if (parent.Get() == NULL) if (!parent.IsSet())
return B_BAD_VALUE; return B_BAD_VALUE;
MutexLocker _(parent->lock); MutexLocker _(parent->lock);

View File

@ -41,7 +41,7 @@ EditManager::Perform(UndoableEdit* edit, EditContext& context)
status_t status_t
EditManager::Perform(const UndoableEditRef& edit, EditContext& context) 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) if (ret == B_OK)
ret = edit->InitCheck(); ret = edit->InitCheck();
@ -150,7 +150,7 @@ bool
EditManager::IsSaved() EditManager::IsSaved()
{ {
bool saved = fUndoHistory.IsEmpty(); bool saved = fUndoHistory.IsEmpty();
if (fEditAtSave.Get() != NULL && !saved) { if (fEditAtSave.IsSet() && !saved) {
if (fEditAtSave == fUndoHistory.Top()) if (fEditAtSave == fUndoHistory.Top())
saved = true; saved = true;
} }

View File

@ -104,12 +104,12 @@ public:
virtual bool AcceptsPackage(const PackageInfoRef& package) const virtual bool AcceptsPackage(const PackageInfoRef& package) const
{ {
if (package.Get() == NULL) if (!package.IsSet())
return false; return false;
for (int i = package->CountCategories() - 1; i >= 0; i--) { for (int i = package->CountCategories() - 1; i >= 0; i--) {
const CategoryRef& category = package->CategoryAtIndex(i); const CategoryRef& category = package->CategoryAtIndex(i);
if (category.Get() == NULL) if (!category.IsSet())
continue; continue;
if (category->Code() == fCategory) if (category->Code() == fCategory)
return true; return true;
@ -207,7 +207,7 @@ public:
virtual bool AcceptsPackage(const PackageInfoRef& package) const virtual bool AcceptsPackage(const PackageInfoRef& package) const
{ {
if (package.Get() == NULL) if (!package.IsSet())
return false; return false;
// Every search term must be found in one of the package texts // Every search term must be found in one of the package texts
for (int32 i = fSearchTerms.CountStrings() - 1; i >= 0; i--) { for (int32 i = fSearchTerms.CountStrings() - 1; i >= 0; i--) {
@ -990,7 +990,7 @@ Model::_NotifyAuthorizationChanged()
std::vector<ModelListenerRef>::const_iterator it; std::vector<ModelListenerRef>::const_iterator it;
for (it = fListeners.begin(); it != fListeners.end(); it++) { for (it = fListeners.begin(); it != fListeners.end(); it++) {
const ModelListenerRef& listener = *it; const ModelListenerRef& listener = *it;
if (listener.Get() != NULL) if (listener.IsSet())
listener->AuthorizationChanged(); listener->AuthorizationChanged();
} }
} }
@ -1002,7 +1002,7 @@ Model::_NotifyCategoryListChanged()
std::vector<ModelListenerRef>::const_iterator it; std::vector<ModelListenerRef>::const_iterator it;
for (it = fListeners.begin(); it != fListeners.end(); it++) { for (it = fListeners.begin(); it != fListeners.end(); it++) {
const ModelListenerRef& listener = *it; const ModelListenerRef& listener = *it;
if (listener.Get() != NULL) if (listener.IsSet())
listener->CategoryListChanged(); listener->CategoryListChanged();
} }
} }

View File

@ -235,7 +235,7 @@ PackageIconTarRepository::GetIcon(const BString& pkgName, BitmapSize size,
off_t iconDataTarOffset = -1; off_t iconDataTarOffset = -1;
const IconTarPtrRef tarPtrRef = _GetIconTarPtr(pkgName); const IconTarPtrRef tarPtrRef = _GetIconTarPtr(pkgName);
if (tarPtrRef.Get() != NULL) { if (tarPtrRef.IsSet()) {
iconDataTarOffset = _OffsetToBestRepresentation(tarPtrRef, size, iconDataTarOffset = _OffsetToBestRepresentation(tarPtrRef, size,
&actualSize); &actualSize);
} }

View File

@ -358,9 +358,9 @@ PackageCategory::Compare(const PackageCategory& other) const
bool IsPackageCategoryBefore(const CategoryRef& c1, bool IsPackageCategoryBefore(const CategoryRef& c1,
const CategoryRef& c2) const CategoryRef& c2)
{ {
if (c1.Get() == NULL || c2.Get() == NULL) if (!c1.IsSet() || !c2.IsSet())
HDFATAL("unexpected NULL reference in a referencable"); 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<PackageInfoListenerRef>::iterator it; std::vector<PackageInfoListenerRef>::iterator it;
for (it = listeners.begin(); it != listeners.end(); it++) { for (it = listeners.begin(); it != listeners.end(); it++) {
const PackageInfoListenerRef listener = *it; const PackageInfoListenerRef listener = *it;
if (listener.Get() != NULL) if (listener.IsSet())
listener->PackageChanged(event); listener->PackageChanged(event);
} }
} }

View File

@ -197,7 +197,7 @@ public:
tempName.Truncate(tempName.FindFirst('-')); tempName.Truncate(tempName.FindFirst('-'));
// strip version suffix off package filename // strip version suffix off package filename
PackageInfoRef ref(FindPackageByName(tempName)); PackageInfoRef ref(FindPackageByName(tempName));
if (ref.Get() != NULL) { if (ref.IsSet()) {
ref->SetDownloadProgress(progress); ref->SetDownloadProgress(progress);
fLastDownloadUpdate = now; fLastDownloadUpdate = now;
} }
@ -210,7 +210,7 @@ public:
tempName.Truncate(tempName.FindFirst('-')); tempName.Truncate(tempName.FindFirst('-'));
// strip version suffix off package filename // strip version suffix off package filename
PackageInfoRef ref(FindPackageByName(tempName)); PackageInfoRef ref(FindPackageByName(tempName));
if (ref.Get() != NULL) { if (ref.IsSet()) {
ref->SetDownloadProgress(1.0); ref->SetDownloadProgress(1.0);
fDownloadedPackages.insert(ref); fDownloadedPackages.insert(ref);
} }
@ -225,7 +225,7 @@ public:
BSolverPackage* package = NULL; BSolverPackage* package = NULL;
for (int32 i = 0; (package = activationList.ItemAt(i)); i++) { for (int32 i = 0; (package = activationList.ItemAt(i)); i++) {
PackageInfoRef ref(FindPackageByName(package->Info().Name())); PackageInfoRef ref(FindPackageByName(package->Info().Name()));
if (ref.Get() != NULL) if (ref.IsSet())
ref->SetState(PENDING); ref->SetState(PENDING);
} }
} }
@ -311,7 +311,7 @@ public:
for (int32 i = 0; i < packages.CountItems(); i++) { for (int32 i = 0; i < packages.CountItems(); i++) {
PackageInfoRef ref(FindPackageByName(packages.ItemAt(i) PackageInfoRef ref(FindPackageByName(packages.ItemAt(i)
->Name())); ->Name()));
if (ref.Get() != NULL) if (ref.IsSet())
fRemovedPackages.Add(ref); fRemovedPackages.Add(ref);
} }
} }
@ -512,7 +512,7 @@ public:
static bool FindAppToLaunch(const PackageInfoRef& package, static bool FindAppToLaunch(const PackageInfoRef& package,
std::vector<DeskbarLink>& foundLinks) std::vector<DeskbarLink>& foundLinks)
{ {
if (package.Get() == NULL) if (!package.IsSet())
return false; return false;
int32 installLocation = InstallLocation(package); int32 installLocation = InstallLocation(package);

View File

@ -15,9 +15,9 @@
bool IsRatingStabilityBefore(const RatingStabilityRef& rs1, bool IsRatingStabilityBefore(const RatingStabilityRef& rs1,
const RatingStabilityRef& rs2) const RatingStabilityRef& rs2)
{ {
if (rs1.Get() == NULL || rs2.Get() == NULL) if (!rs1.IsSet() || !rs2.IsSet())
HDFATAL("unexpected NULL reference in a referencable"); HDFATAL("unexpected NULL reference in a referencable");
return rs1.Get()->Compare(*(rs2.Get())) < 0; return rs1->Compare(*rs2) < 0;
} }

View File

@ -76,7 +76,7 @@ AbstractProcess::Run()
// this process may be part of a larger bulk-load process and // this process may be part of a larger bulk-load process and
// if so, the process orchestration needs to know when this // if so, the process orchestration needs to know when this
// process has completed. // process has completed.
if (listener.Get() != NULL) if (listener.IsSet())
listener->ProcessExited(); listener->ProcessExited();
return runResult; return runResult;
@ -126,7 +126,7 @@ AbstractProcess::Stop()
} }
} }
if (listener.Get() != NULL) if (listener.IsSet())
listener->ProcessExited(); listener->ProcessExited();
return result; return result;
@ -152,4 +152,4 @@ AbstractProcess::ProcessState()
{ {
AutoLocker<BLocker> locker(&fLock); AutoLocker<BLocker> locker(&fLock);
return fProcessState; return fProcessState;
} }

View File

@ -104,7 +104,7 @@ LocalPkgDataLoadProcess::RunInternal()
DepotInfoRef depotInfoRef = DepotInfoRef( DepotInfoRef depotInfoRef = DepotInfoRef(
new(std::nothrow) DepotInfo(repoName), true); new(std::nothrow) DepotInfo(repoName), true);
if (depotInfoRef.Get() == NULL) if (!depotInfoRef.IsSet())
HDFATAL("unable to create new depot info - memory exhaustion"); HDFATAL("unable to create new depot info - memory exhaustion");
BRepositoryConfig repoConfig; BRepositoryConfig repoConfig;
@ -186,10 +186,10 @@ LocalPkgDataLoadProcess::RunInternal()
modelInfo.SetTo(it->second); modelInfo.SetTo(it->second);
else { else {
// Add new package info // Add new package info
modelInfo.SetTo(new(std::nothrow) PackageInfo(repoPackageInfo), modelInfo.SetTo(new(std::nothrow) PackageInfo(repoPackageInfo),
true); true);
if (modelInfo.Get() == NULL) if (!modelInfo.IsSet())
return B_ERROR; return B_ERROR;
foundPackages[repoPackageInfo.Name()] = modelInfo; foundPackages[repoPackageInfo.Name()] = modelInfo;
@ -270,7 +270,7 @@ LocalPkgDataLoadProcess::RunInternal()
BString repoName = B_TRANSLATE("Local"); BString repoName = B_TRANSLATE("Local");
DepotInfoRef depotInfoRef(new(std::nothrow) DepotInfo(repoName), true); 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"); HDFATAL("unable to create a new depot info - memory exhaustion");
depots.push_back(depotInfoRef); depots.push_back(depotInfoRef);

View File

@ -119,7 +119,7 @@ PackageFillingPkgListener::ConsumePackage(const PackageInfoRef& package,
BString* categoryCode = pkg->PkgCategoriesItemAt(i)->Code(); BString* categoryCode = pkg->PkgCategoriesItemAt(i)->Code();
CategoryRef category = fModel->CategoryByCode(*categoryCode); CategoryRef category = fModel->CategoryByCode(*categoryCode);
if (category.Get() == NULL) { if (!category.IsSet()) {
HDERROR("unable to find the category for [%s]", HDERROR("unable to find the category for [%s]",
categoryCode->String()); categoryCode->String());
} else } else

View File

@ -50,7 +50,7 @@ Bullet::operator==(const Bullet& other) const
if (fBulletData == other.fBulletData) if (fBulletData == other.fBulletData)
return true; return true;
if (fBulletData.Get() != NULL && other.fBulletData.Get() != NULL) if (fBulletData.IsSet() && other.fBulletData.IsSet())
return *fBulletData.Get() == *other.fBulletData.Get(); return *fBulletData.Get() == *other.fBulletData.Get();
return false; return false;

View File

@ -40,7 +40,7 @@ CharacterStyle::operator==(const CharacterStyle& other) const
if (fStyleData == other.fStyleData) if (fStyleData == other.fStyleData)
return true; return true;
if (fStyleData.Get() != NULL && other.fStyleData.Get() != NULL) if (fStyleData.IsSet() && other.fStyleData.IsSet())
return *fStyleData.Get() == *other.fStyleData.Get(); return *fStyleData.Get() == *other.fStyleData.Get();
return false; return false;

View File

@ -67,7 +67,7 @@ TextDocumentRef
MarkupParser::CreateDocumentFromMarkup(const BString& text) MarkupParser::CreateDocumentFromMarkup(const BString& text)
{ {
TextDocumentRef document(new(std::nothrow) TextDocument(), true); TextDocumentRef document(new(std::nothrow) TextDocument(), true);
if (document.Get() == NULL) if (!document.IsSet())
return document; return document;
AppendMarkup(document, text); AppendMarkup(document, text);

View File

@ -40,7 +40,7 @@ ParagraphStyle::operator==(const ParagraphStyle& other) const
if (fStyleData == other.fStyleData) if (fStyleData == other.fStyleData)
return true; return true;
if (fStyleData.Get() != NULL && other.fStyleData.Get() != NULL) if (fStyleData.IsSet() && other.fStyleData.IsSet())
return *fStyleData.Get() == *other.fStyleData.Get(); return *fStyleData.Get() == *other.fStyleData.Get();
return false; return false;

View File

@ -128,7 +128,7 @@ TextDocument::Replace(int32 textOffset, int32 length, const BString& text,
{ {
TextDocumentRef document = NormalizeText(text, characterStyle, TextDocumentRef document = NormalizeText(text, characterStyle,
paragraphStyle); paragraphStyle);
if (document.Get() == NULL || document->Length() != text.CountChars()) if (!document.IsSet() || document->Length() != text.CountChars())
return B_NO_MEMORY; return B_NO_MEMORY;
return Replace(textOffset, length, document); return Replace(textOffset, length, document);
} }
@ -312,7 +312,7 @@ TextDocument::SubDocument(int32 start, int32 length) const
TextDocumentRef result(new(std::nothrow) TextDocument( TextDocumentRef result(new(std::nothrow) TextDocument(
fDefaultCharacterStyle, fEmptyLastParagraph.Style()), true); fDefaultCharacterStyle, fEmptyLastParagraph.Style()), true);
if (result.Get() == NULL) if (!result.IsSet())
return result; return result;
if (start < 0) if (start < 0)
@ -373,7 +373,7 @@ TextDocument::NormalizeText(const BString& text,
{ {
TextDocumentRef document(new(std::nothrow) TextDocument(characterStyle, TextDocumentRef document(new(std::nothrow) TextDocument(characterStyle,
paragraphStyle), true); paragraphStyle), true);
if (document.Get() == NULL) if (!document.IsSet())
throw B_NO_MEMORY; throw B_NO_MEMORY;
Paragraph paragraph(paragraphStyle); Paragraph paragraph(paragraphStyle);
@ -679,7 +679,7 @@ TextDocument::_NotifyTextChanging(TextChangingEvent& event) const
int32 count = listeners.CountItems(); int32 count = listeners.CountItems();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
const TextListenerRef& listener = listeners.ItemAtFast(i); const TextListenerRef& listener = listeners.ItemAtFast(i);
if (listener.Get() == NULL) if (!listener.IsSet())
continue; continue;
listener->TextChanging(event); listener->TextChanging(event);
if (event.IsCanceled()) if (event.IsCanceled())
@ -697,7 +697,7 @@ TextDocument::_NotifyTextChanged(const TextChangedEvent& event) const
int32 count = listeners.CountItems(); int32 count = listeners.CountItems();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
const TextListenerRef& listener = listeners.ItemAtFast(i); const TextListenerRef& listener = listeners.ItemAtFast(i);
if (listener.Get() == NULL) if (!listener.IsSet())
continue; continue;
listener->TextChanged(event); listener->TextChanged(event);
} }
@ -713,7 +713,7 @@ TextDocument::_NotifyUndoableEditHappened(const UndoableEditRef& edit) const
int32 count = listeners.CountItems(); int32 count = listeners.CountItems();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
const UndoableEditListenerRef& listener = listeners.ItemAtFast(i); const UndoableEditListenerRef& listener = listeners.ItemAtFast(i);
if (listener.Get() == NULL) if (!listener.IsSet())
continue; continue;
listener->UndoableEditHappened(this, edit); listener->UndoableEditHappened(this, edit);
} }

View File

@ -80,7 +80,7 @@ TextDocumentLayout::TextDocumentLayout(const TextDocumentLayout& other)
fTextListener(new(std::nothrow) LayoutTextListener(this), true), fTextListener(new(std::nothrow) LayoutTextListener(this), true),
fParagraphLayouts(other.fParagraphLayouts) fParagraphLayouts(other.fParagraphLayouts)
{ {
if (fDocument.Get() != NULL) if (fDocument.IsSet())
fDocument->AddListener(fTextListener); fDocument->AddListener(fTextListener);
} }
@ -97,14 +97,14 @@ TextDocumentLayout::SetTextDocument(const TextDocumentRef& document)
if (fDocument == document) if (fDocument == document)
return; return;
if (fDocument.Get() != NULL) if (fDocument.IsSet())
fDocument->RemoveListener(fTextListener); fDocument->RemoveListener(fTextListener);
fDocument = document; fDocument = document;
_Init(); _Init();
fLayoutValid = false; fLayoutValid = false;
if (fDocument.Get() != NULL) if (fDocument.IsSet())
fDocument->AddListener(fTextListener); fDocument->AddListener(fTextListener);
} }
@ -112,7 +112,7 @@ TextDocumentLayout::SetTextDocument(const TextDocumentRef& document)
void void
TextDocumentLayout::Invalidate() TextDocumentLayout::Invalidate()
{ {
if (fDocument.Get() != NULL) if (fDocument.IsSet())
InvalidateParagraphs(0, fDocument->Paragraphs().CountItems()); InvalidateParagraphs(0, fDocument->Paragraphs().CountItems());
} }
@ -120,7 +120,7 @@ TextDocumentLayout::Invalidate()
void void
TextDocumentLayout::InvalidateParagraphs(int32 start, int32 count) TextDocumentLayout::InvalidateParagraphs(int32 start, int32 count)
{ {
if (start < 0 || count == 0 || fDocument.Get() == NULL) if (start < 0 || count == 0 || !fDocument.IsSet())
return; return;
fLayoutValid = false; fLayoutValid = false;
@ -134,7 +134,7 @@ TextDocumentLayout::InvalidateParagraphs(int32 start, int32 count)
if (start >= fParagraphLayouts.CountItems()) { if (start >= fParagraphLayouts.CountItems()) {
ParagraphLayoutRef layout(new(std::nothrow) ParagraphLayout( ParagraphLayoutRef layout(new(std::nothrow) ParagraphLayout(
paragraph), true); paragraph), true);
if (layout.Get() == NULL if (!layout.IsSet()
|| !fParagraphLayouts.Add(ParagraphLayoutInfo(0.0f, layout))) { || !fParagraphLayouts.Add(ParagraphLayoutInfo(0.0f, layout))) {
fprintf(stderr, "TextDocumentLayout::InvalidateParagraphs() - " fprintf(stderr, "TextDocumentLayout::InvalidateParagraphs() - "
"out of memory\n"); "out of memory\n");
@ -345,7 +345,7 @@ TextDocumentLayout::_Init()
{ {
fParagraphLayouts.Clear(); fParagraphLayouts.Clear();
if (fDocument.Get() == NULL) if (!fDocument.IsSet())
return; return;
const ParagraphList& paragraphs = fDocument->Paragraphs(); const ParagraphList& paragraphs = fDocument->Paragraphs();
@ -355,7 +355,7 @@ TextDocumentLayout::_Init()
const Paragraph& paragraph = paragraphs.ItemAtFast(i); const Paragraph& paragraph = paragraphs.ItemAtFast(i);
ParagraphLayoutRef layout(new(std::nothrow) ParagraphLayout(paragraph), ParagraphLayoutRef layout(new(std::nothrow) ParagraphLayout(paragraph),
true); true);
if (layout.Get() == NULL if (!layout.IsSet()
|| !fParagraphLayouts.Add(ParagraphLayoutInfo(0.0f, layout))) { || !fParagraphLayouts.Add(ParagraphLayoutInfo(0.0f, layout))) {
fprintf(stderr, "TextDocumentLayout::_Layout() - out of memory\n"); fprintf(stderr, "TextDocumentLayout::_Layout() - out of memory\n");
return; return;

View File

@ -89,7 +89,7 @@ TextDocumentView::Draw(BRect updateRect)
fTextDocumentLayout.SetWidth(_TextLayoutWidth(Bounds().Width())); fTextDocumentLayout.SetWidth(_TextLayoutWidth(Bounds().Width()));
fTextDocumentLayout.Draw(this, BPoint(fInsetLeft, fInsetTop), updateRect); fTextDocumentLayout.Draw(this, BPoint(fInsetLeft, fInsetTop), updateRect);
if (!fSelectionEnabled || fTextEditor.Get() == NULL) if (!fSelectionEnabled || !fTextEditor.IsSet())
return; return;
bool isCaret = fTextEditor->SelectionLength() == 0; bool isCaret = fTextEditor->SelectionLength() == 0;
@ -179,7 +179,7 @@ TextDocumentView::MouseMoved(BPoint where, uint32 transit,
void void
TextDocumentView::KeyDown(const char* bytes, int32 numBytes) TextDocumentView::KeyDown(const char* bytes, int32 numBytes)
{ {
if (fTextEditor.Get() == NULL) if (!fTextEditor.IsSet())
return; return;
KeyEvent event; KeyEvent event;
@ -263,7 +263,7 @@ TextDocumentView::SetTextDocument(const TextDocumentRef& document)
{ {
fTextDocument = document; fTextDocument = document;
fTextDocumentLayout.SetTextDocument(fTextDocument); fTextDocumentLayout.SetTextDocument(fTextDocument);
if (fTextEditor.Get() != NULL) if (fTextEditor.IsSet())
fTextEditor->SetDocument(document); fTextEditor->SetDocument(document);
InvalidateLayout(); InvalidateLayout();
@ -275,7 +275,7 @@ TextDocumentView::SetTextDocument(const TextDocumentRef& document)
void void
TextDocumentView::SetEditingEnabled(bool enabled) TextDocumentView::SetEditingEnabled(bool enabled)
{ {
if (fTextEditor.Get() != NULL) if (fTextEditor.IsSet())
fTextEditor->SetEditingEnabled(enabled); fTextEditor->SetEditingEnabled(enabled);
} }
@ -286,7 +286,7 @@ TextDocumentView::SetTextEditor(const TextEditorRef& editor)
if (fTextEditor == editor) if (fTextEditor == editor)
return; return;
if (fTextEditor.Get() != NULL) { if (fTextEditor.IsSet()) {
fTextEditor->SetDocument(TextDocumentRef()); fTextEditor->SetDocument(TextDocumentRef());
fTextEditor->SetLayout(TextDocumentLayoutRef()); fTextEditor->SetLayout(TextDocumentLayoutRef());
// TODO: Probably has to remove listeners // TODO: Probably has to remove listeners
@ -294,7 +294,7 @@ TextDocumentView::SetTextEditor(const TextEditorRef& editor)
fTextEditor = editor; fTextEditor = editor;
if (fTextEditor.Get() != NULL) { if (fTextEditor.IsSet()) {
fTextEditor->SetDocument(fTextDocument); fTextEditor->SetDocument(fTextDocument);
fTextEditor->SetLayout(TextDocumentLayoutRef( fTextEditor->SetLayout(TextDocumentLayoutRef(
&fTextDocumentLayout)); &fTextDocumentLayout));
@ -349,7 +349,7 @@ TextDocumentView::SetSelectionEnabled(bool enabled)
void void
TextDocumentView::SetCaret(BPoint location, bool extendSelection) TextDocumentView::SetCaret(BPoint location, bool extendSelection)
{ {
if (!fSelectionEnabled || fTextEditor.Get() == NULL) if (!fSelectionEnabled || !fTextEditor.IsSet())
return; return;
location.x -= fInsetLeft; location.x -= fInsetLeft;
@ -364,7 +364,7 @@ TextDocumentView::SetCaret(BPoint location, bool extendSelection)
void void
TextDocumentView::SelectAll() TextDocumentView::SelectAll()
{ {
if (!fSelectionEnabled || fTextEditor.Get() == NULL) if (!fSelectionEnabled || !fTextEditor.IsSet())
return; return;
fTextEditor->SelectAll(); fTextEditor->SelectAll();
@ -376,14 +376,14 @@ TextDocumentView::SelectAll()
bool bool
TextDocumentView::HasSelection() const TextDocumentView::HasSelection() const
{ {
return fTextEditor.Get() != NULL && fTextEditor->HasSelection(); return fTextEditor.IsSet() && fTextEditor->HasSelection();
} }
void void
TextDocumentView::GetSelection(int32& start, int32& end) const TextDocumentView::GetSelection(int32& start, int32& end) const
{ {
if (fTextEditor.Get() != NULL) { if (fTextEditor.IsSet()) {
start = fTextEditor->SelectionStart(); start = fTextEditor->SelectionStart();
end = fTextEditor->SelectionEnd(); end = fTextEditor->SelectionEnd();
} }
@ -393,7 +393,7 @@ TextDocumentView::GetSelection(int32& start, int32& end) const
void void
TextDocumentView::Copy(BClipboard* clipboard) TextDocumentView::Copy(BClipboard* clipboard)
{ {
if (!HasSelection() || fTextDocument.Get() == NULL) { if (!HasSelection() || !fTextDocument.IsSet()) {
// Nothing to copy, don't clear clipboard contents for now reason. // Nothing to copy, don't clear clipboard contents for now reason.
return; return;
} }
@ -493,7 +493,7 @@ TextDocumentView::_ShowCaret(bool show)
void void
TextDocumentView::_BlinkCaret() TextDocumentView::_BlinkCaret()
{ {
if (!fSelectionEnabled || fTextEditor.Get() == NULL) if (!fSelectionEnabled || !fTextEditor.IsSet())
return; return;
_ShowCaret(!fShowCaret); _ShowCaret(!fShowCaret);

View File

@ -105,7 +105,7 @@ TextEditor::SetEditingEnabled(bool enabled)
void void
TextEditor::SetCaret(BPoint location, bool extendSelection) TextEditor::SetCaret(BPoint location, bool extendSelection)
{ {
if (fDocument.Get() == NULL || fLayout.Get() == NULL) if (!fDocument.IsSet() || !fLayout.IsSet())
return; return;
bool rightOfChar = false; bool rightOfChar = false;
@ -122,7 +122,7 @@ TextEditor::SetCaret(BPoint location, bool extendSelection)
void void
TextEditor::SelectAll() TextEditor::SelectAll()
{ {
if (fDocument.Get() == NULL) if (!fDocument.IsSet())
return; return;
SetSelection(TextSelection(0, fDocument->Length())); SetSelection(TextSelection(0, fDocument->Length()));
@ -153,7 +153,7 @@ TextEditor::SetCharacterStyle(::CharacterStyle style)
void void
TextEditor::KeyDown(KeyEvent event) TextEditor::KeyDown(KeyEvent event)
{ {
if (fDocument.Get() == NULL) if (!fDocument.IsSet())
return; return;
bool select = (event.modifiers & B_SHIFT_KEY) != 0; bool select = (event.modifiers & B_SHIFT_KEY) != 0;
@ -250,7 +250,7 @@ TextEditor::KeyDown(KeyEvent event)
status_t status_t
TextEditor::Insert(int32 offset, const BString& string) TextEditor::Insert(int32 offset, const BString& string)
{ {
if (!fEditingEnabled || fDocument.Get() == NULL) if (!fEditingEnabled || !fDocument.IsSet())
return B_ERROR; return B_ERROR;
status_t ret = fDocument->Insert(offset, string, fStyleAtCaret); status_t ret = fDocument->Insert(offset, string, fStyleAtCaret);
@ -266,7 +266,7 @@ TextEditor::Insert(int32 offset, const BString& string)
status_t status_t
TextEditor::Remove(int32 offset, int32 length) TextEditor::Remove(int32 offset, int32 length)
{ {
if (!fEditingEnabled || fDocument.Get() == NULL) if (!fEditingEnabled || !fDocument.IsSet())
return B_ERROR; return B_ERROR;
status_t ret = fDocument->Remove(offset, length); status_t ret = fDocument->Remove(offset, length);
@ -282,7 +282,7 @@ TextEditor::Remove(int32 offset, int32 length)
status_t status_t
TextEditor::Replace(int32 offset, int32 length, const BString& string) TextEditor::Replace(int32 offset, int32 length, const BString& string)
{ {
if (!fEditingEnabled || fDocument.Get() == NULL) if (!fEditingEnabled || !fDocument.IsSet())
return B_ERROR; return B_ERROR;
status_t ret = fDocument->Replace(offset, length, string); status_t ret = fDocument->Replace(offset, length, string);
@ -301,7 +301,7 @@ TextEditor::Replace(int32 offset, int32 length, const BString& string)
void void
TextEditor::LineUp(bool select) TextEditor::LineUp(bool select)
{ {
if (fLayout.Get() == NULL) if (!fLayout.IsSet())
return; return;
int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret()); int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret());
@ -312,7 +312,7 @@ TextEditor::LineUp(bool select)
void void
TextEditor::LineDown(bool select) TextEditor::LineDown(bool select)
{ {
if (fLayout.Get() == NULL) if (!fLayout.IsSet())
return; return;
int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret()); int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret());
@ -323,7 +323,7 @@ TextEditor::LineDown(bool select)
void void
TextEditor::LineStart(bool select) TextEditor::LineStart(bool select)
{ {
if (fLayout.Get() == NULL) if (!fLayout.IsSet())
return; return;
int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret()); int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret());
@ -335,7 +335,7 @@ TextEditor::LineStart(bool select)
void void
TextEditor::LineEnd(bool select) TextEditor::LineEnd(bool select)
{ {
if (fLayout.Get() == NULL) if (!fLayout.IsSet())
return; return;
int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret()); int32 lineIndex = fLayout->LineIndexForOffset(fSelection.Caret());
@ -418,7 +418,7 @@ void
TextEditor::_SetCaretOffset(int32 offset, bool updateAnchor, TextEditor::_SetCaretOffset(int32 offset, bool updateAnchor,
bool lockSelectionAnchor, bool updateSelectionStyle) bool lockSelectionAnchor, bool updateSelectionStyle)
{ {
if (fDocument.Get() == NULL) if (!fDocument.IsSet())
return; return;
if (offset < 0) if (offset < 0)
@ -437,7 +437,7 @@ void
TextEditor::_SetSelection(int32 caret, int32 anchor, bool updateAnchor, TextEditor::_SetSelection(int32 caret, int32 anchor, bool updateAnchor,
bool updateSelectionStyle) bool updateSelectionStyle)
{ {
if (fLayout.Get() == NULL) if (!fLayout.IsSet())
return; return;
if (caret == fSelection.Caret() && anchor == fSelection.Anchor()) if (caret == fSelection.Caret() && anchor == fSelection.Anchor())
@ -464,7 +464,7 @@ TextEditor::_SetSelection(int32 caret, int32 anchor, bool updateAnchor,
void void
TextEditor::_UpdateStyleAtCaret() TextEditor::_UpdateStyleAtCaret()
{ {
if (fDocument.Get() == NULL) if (!fDocument.IsSet())
return; return;
int32 offset = fSelection.Caret() - 1; int32 offset = fSelection.Caret() - 1;

View File

@ -377,7 +377,7 @@ App::_Open(const BEntry& entry)
// Transfer information into PackageInfo // Transfer information into PackageInfo
PackageInfoRef package(new(std::nothrow) PackageInfo(info), true); PackageInfoRef package(new(std::nothrow) PackageInfo(info), true);
if (package.Get() == NULL) { if (!package.IsSet()) {
fprintf(stderr, "Could not allocate PackageInfo\n"); fprintf(stderr, "Could not allocate PackageInfo\n");
return; return;
} }

View File

@ -245,7 +245,7 @@ public:
static bool _IsPackageBefore(const PackageInfoRef& packageA, static bool _IsPackageBefore(const PackageInfoRef& packageA,
const PackageInfoRef& packageB) const PackageInfoRef& packageB)
{ {
if (packageA.Get() == NULL || packageB.Get() == NULL) if (!packageA.IsSet() || !packageB.IsSet())
HDFATAL("unexpected NULL reference in a referencable"); HDFATAL("unexpected NULL reference in a referencable");
int c = _CmpProminences(packageA->Prominence(), packageB->Prominence()); int c = _CmpProminences(packageA->Prominence(), packageB->Prominence());
if (c == 0) if (c == 0)
@ -399,7 +399,7 @@ public:
pkg->Name(), BITMAP_SIZE_64, icon); pkg->Name(), BITMAP_SIZE_64, icon);
if (iconResult == B_OK) { if (iconResult == B_OK) {
if (icon.Get() != NULL) { if (icon.IsSet()) {
float inset = (HEIGHT_PACKAGE - SIZE_ICON) / 2.0; float inset = (HEIGHT_PACKAGE - SIZE_ICON) / 2.0;
BRect targetRect = BRect(inset, y + inset, SIZE_ICON + inset, BRect targetRect = BRect(inset, y + inset, SIZE_ICON + inset,
y + SIZE_ICON + inset); y + SIZE_ICON + inset);
@ -559,7 +559,7 @@ public:
float TopOfPackage(const PackageInfoRef& package) float TopOfPackage(const PackageInfoRef& package)
{ {
if (package.Get() != NULL) { if (package.IsSet()) {
int index = _IndexOfPackage(package); int index = _IndexOfPackage(package);
if (-1 != index) if (-1 != index)
return _YOfIndex(index); return _YOfIndex(index);

View File

@ -429,7 +429,7 @@ MainWindow::MessageReceived(BMessage* message)
BAutolock locker(fModel.Lock()); BAutolock locker(fModel.Lock());
package = fModel.PackageForName(name); package = fModel.PackageForName(name);
} }
if (package.Get() == NULL) if (!package.IsSet())
debugger("unable to find the named package"); debugger("unable to find the named package");
else else
_AdoptPackage(package); _AdoptPackage(package);
@ -494,7 +494,7 @@ MainWindow::MessageReceived(BMessage* message)
} }
_AddRemovePackageFromLists(ref); _AddRemovePackageFromLists(ref);
if ((changes & PKG_CHANGED_STATE) != 0 if ((changes & PKG_CHANGED_STATE) != 0
&& fCoordinator.Get() == NULL) { && !fCoordinator.IsSet()) {
fWorkStatusView->PackageStatusChanged(ref); fWorkStatusView->PackageStatusChanged(ref);
} }
} }
@ -998,7 +998,7 @@ MainWindow::_PackageActionWorker(void* arg)
{ {
AutoLocker<BLocker> lock(&window->fPendingActionsLock); AutoLocker<BLocker> lock(&window->fPendingActionsLock);
ref = window->fPendingActions.ItemAt(0); ref = window->fPendingActions.ItemAt(0);
if (ref.Get() == NULL) if (!ref.IsSet())
break; break;
window->fPendingActions.Remove(0); window->fPendingActions.Remove(0);
} }
@ -1058,7 +1058,7 @@ MainWindow::_PopulatePackageWorker(void* arg)
force = window->fForcePopulatePackage; force = window->fForcePopulatePackage;
} }
if (package.Get() != NULL) { if (package.IsSet()) {
uint32 populateFlags = Model::POPULATE_USER_RATINGS uint32 populateFlags = Model::POPULATE_USER_RATINGS
| Model::POPULATE_SCREEN_SHOTS | Model::POPULATE_SCREEN_SHOTS
| Model::POPULATE_CHANGELOG; | Model::POPULATE_CHANGELOG;
@ -1326,7 +1326,7 @@ MainWindow::_AddProcessCoordinator(ProcessCoordinator* item)
{ {
AutoLocker<BLocker> lock(&fCoordinatorLock); AutoLocker<BLocker> lock(&fCoordinatorLock);
if (fCoordinator.Get() == NULL) { if (!fCoordinator.IsSet()) {
if (acquire_sem(fCoordinatorRunningSem) != B_OK) if (acquire_sem(fCoordinatorRunningSem) != B_OK)
debugger("unable to acquire the process coordinator sem"); debugger("unable to acquire the process coordinator sem");
HDINFO("adding and starting a process coordinator [%s]", HDINFO("adding and starting a process coordinator [%s]",
@ -1352,7 +1352,7 @@ MainWindow::_SpinUntilProcessCoordinatorComplete()
debugger("unable to release the process coordinator sem"); debugger("unable to release the process coordinator sem");
{ {
AutoLocker<BLocker> lock(&fCoordinatorLock); AutoLocker<BLocker> lock(&fCoordinatorLock);
if (fCoordinator.Get() == NULL) if (!fCoordinator.IsSet())
return; return;
} }
} }
@ -1375,7 +1375,7 @@ MainWindow::_StopProcessCoordinators()
fCoordinatorQueue.pop(); fCoordinatorQueue.pop();
} }
if (fCoordinator.Get() != NULL) { if (fCoordinator.IsSet()) {
fCoordinator->Stop(); fCoordinator->Stop();
} }
} }
@ -1475,4 +1475,4 @@ MainWindow::_CreateSnapshotOfDepots()
for(int32 i = 0; i < countDepots; i++) for(int32 i = 0; i < countDepots; i++)
result.push_back(fModel.DepotAtIndex(i)); result.push_back(fModel.DepotAtIndex(i));
return result; return result;
} }

View File

@ -76,12 +76,12 @@ OnePackageMessagePackageListener::SetPackage(const PackageInfoRef& package)
PackageInfoListenerRef listener(this); PackageInfoListenerRef listener(this);
if (fPackage.Get() != NULL) if (fPackage.IsSet())
fPackage->RemoveListener(listener); fPackage->RemoveListener(listener);
fPackage = package; fPackage = package;
if (fPackage.Get() != NULL) if (fPackage.IsSet())
fPackage->AddListener(listener); fPackage->AddListener(listener);
} }

View File

@ -281,7 +281,7 @@ PackageContentsView::SetPackage(const PackageInfoRef& package)
// to read contents where we previously could not. (For example, the // to read contents where we previously could not. (For example, the
// package has been installed.) // package has been installed.)
if (fPackage == package if (fPackage == package
&& (package.Get() == NULL || package->State() == fLastPackageState)) { && (!package.IsSet() || package->State() == fLastPackageState)) {
return; return;
} }
@ -290,13 +290,13 @@ PackageContentsView::SetPackage(const PackageInfoRef& package)
{ {
BAutolock lock(&fPackageLock); BAutolock lock(&fPackageLock);
fPackage = package; 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 // 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. // there is no point in attempting to populate data for it.
if (package.Get() != NULL if (package.IsSet()
&& (package->State() == ACTIVATED || package->IsLocalFile())) { && (package->State() == ACTIVATED || package->IsLocalFile())) {
release_sem_etc(fContentPopulatorSem, 1, 0); release_sem_etc(fContentPopulatorSem, 1, 0);
} }
@ -344,7 +344,7 @@ PackageContentsView::_ContentPopulatorThread(void* arg)
package = view->fPackage; package = view->fPackage;
} }
if (package.Get() != NULL) { if (package.IsSet()) {
if (!view->_PopulatePackageContents(*package.Get())) { if (!view->_PopulatePackageContents(*package.Get())) {
if (view->LockLooperWithTimeout(1000000) == B_OK) { if (view->LockLooperWithTimeout(1000000) == B_OK) {
view->fContentListView->AddItem( view->fContentListView->AddItem(

View File

@ -635,7 +635,7 @@ private:
return; return;
const PackageActionRef& action = fPackageActions[index]; const PackageActionRef& action = fPackageActions[index];
if (action.Get() == NULL) if (!action.IsSet())
return; return;
PackageActionList actions; PackageActionList actions;
@ -842,7 +842,7 @@ public:
bool hasScreenshot = false; bool hasScreenshot = false;
if (countScreenshots > 0) { if (countScreenshots > 0) {
const BitmapRef& bitmapRef = package.ScreenshotAtIndex(0); const BitmapRef& bitmapRef = package.ScreenshotAtIndex(0);
if (bitmapRef.Get() != NULL) { if (bitmapRef.IsSet()) {
HDDEBUG("did find screenshot for package [%s]", HDDEBUG("did find screenshot for package [%s]",
package.Name().String()); package.Name().String());
hasScreenshot = true; hasScreenshot = true;
@ -1274,9 +1274,9 @@ public:
Select(TAB_ABOUT); Select(TAB_ABOUT);
TabAt(TAB_CHANGELOG)->SetEnabled( TabAt(TAB_CHANGELOG)->SetEnabled(
package.Get() != NULL && package->HasChangelog()); package.IsSet() && package->HasChangelog());
TabAt(TAB_CONTENTS)->SetEnabled( TabAt(TAB_CONTENTS)->SetEnabled(
package.Get() != NULL package.IsSet()
&& (package->State() == ACTIVATED || package->IsLocalFile())); && (package->State() == ACTIVATED || package->IsLocalFile()));
Invalidate(TabFrame(TAB_CHANGELOG)); Invalidate(TabFrame(TAB_CHANGELOG));
Invalidate(TabFrame(TAB_CONTENTS)); Invalidate(TabFrame(TAB_CONTENTS));
@ -1375,7 +1375,7 @@ PackageInfoView::MessageReceived(BMessage* message)
switch (message->what) { switch (message->what) {
case MSG_UPDATE_PACKAGE: case MSG_UPDATE_PACKAGE:
{ {
if (fPackageListener->Package().Get() == NULL) if (!fPackageListener->Package().IsSet())
break; break;
BString name; BString name;
@ -1423,7 +1423,7 @@ PackageInfoView::SetPackage(const PackageInfoRef& packageRef)
{ {
BAutolock _(fModel->Lock()); BAutolock _(fModel->Lock());
if (packageRef.Get() == NULL) { if (!packageRef.IsSet()) {
Clear(); Clear();
return; return;
} }
@ -1433,7 +1433,7 @@ PackageInfoView::SetPackage(const PackageInfoRef& packageRef)
// When asked to display the already showing package ref, // When asked to display the already showing package ref,
// don't switch to the default tab. // don't switch to the default tab.
switchToDefaultTab = false; switchToDefaultTab = false;
} else if (fPackage.Get() != NULL && packageRef.Get() != NULL } else if (fPackage.IsSet() && packageRef.IsSet()
&& fPackage->Name() == packageRef->Name()) { && fPackage->Name() == packageRef->Name()) {
// When asked to display a different PackageInfo instance, // When asked to display a different PackageInfo instance,
// but it has the same package title as the already showing // but it has the same package title as the already showing

View File

@ -358,7 +358,7 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent)
bitmapRef); bitmapRef);
if (bitmapResult == B_OK) { if (bitmapResult == B_OK) {
if (bitmapRef.Get() != NULL) { if (bitmapRef.IsSet()) {
const BBitmap* bitmap = bitmapRef->Bitmap(BITMAP_SIZE_16); const BBitmap* bitmap = bitmapRef->Bitmap(BITMAP_SIZE_16);
parent->SetDrawingMode(B_OP_ALPHA); parent->SetDrawingMode(B_OP_ALPHA);
BRect viewRect(x, y, x + 15, y + 15); BRect viewRect(x, y, x + 15, y + 15);
@ -544,7 +544,7 @@ PackageRow::PackageRow(const PackageInfoRef& packageRef,
fPackageListener(packageListener), fPackageListener(packageListener),
fNextInHash(NULL) fNextInHash(NULL)
{ {
if (packageRef.Get() == NULL) if (!packageRef.IsSet())
return; return;
PackageInfo& package = *packageRef.Get(); PackageInfo& package = *packageRef.Get();
@ -577,7 +577,7 @@ PackageRow::PackageRow(const PackageInfoRef& packageRef,
PackageRow::~PackageRow() PackageRow::~PackageRow()
{ {
if (fPackage.Get() != NULL) if (fPackage.IsSet())
fPackage->RemoveListener(fPackageListener); fPackage->RemoveListener(fPackageListener);
} }
@ -585,7 +585,7 @@ PackageRow::~PackageRow()
void void
PackageRow::UpdateIconAndTitle() PackageRow::UpdateIconAndTitle()
{ {
if (fPackage.Get() == NULL) if (!fPackage.IsSet())
return; return;
SetField(new PackageIconAndTitleField( SetField(new PackageIconAndTitleField(
@ -596,7 +596,7 @@ PackageRow::UpdateIconAndTitle()
void void
PackageRow::UpdateState() PackageRow::UpdateState()
{ {
if (fPackage.Get() == NULL) if (!fPackage.IsSet())
return; return;
SetField(new BStringField(package_state_to_string(fPackage)), SetField(new BStringField(package_state_to_string(fPackage)),
@ -607,7 +607,7 @@ PackageRow::UpdateState()
void void
PackageRow::UpdateSummary() PackageRow::UpdateSummary()
{ {
if (fPackage.Get() == NULL) if (!fPackage.IsSet())
return; return;
SetField(new BStringField(fPackage->ShortDescription()), SetField(new BStringField(fPackage->ShortDescription()),
@ -618,7 +618,7 @@ PackageRow::UpdateSummary()
void void
PackageRow::UpdateRating() PackageRow::UpdateRating()
{ {
if (fPackage.Get() == NULL) if (!fPackage.IsSet())
return; return;
RatingSummary summary = fPackage->CalculateRatingSummary(); RatingSummary summary = fPackage->CalculateRatingSummary();
SetField(new RatingField(summary.averageRating), kRatingColumn); SetField(new RatingField(summary.averageRating), kRatingColumn);
@ -628,7 +628,7 @@ PackageRow::UpdateRating()
void void
PackageRow::UpdateSize() PackageRow::UpdateSize()
{ {
if (fPackage.Get() == NULL) if (!fPackage.IsSet())
return; return;
SetField(new SizeField(fPackage->Size()), kSizeColumn); SetField(new SizeField(fPackage->Size()), kSizeColumn);
@ -638,7 +638,7 @@ PackageRow::UpdateSize()
void void
PackageRow::UpdateRepository() PackageRow::UpdateRepository()
{ {
if (fPackage.Get() == NULL) if (!fPackage.IsSet())
return; return;
SetField(new BStringField(fPackage->DepotName()), kRepositoryColumn); SetField(new BStringField(fPackage->DepotName()), kRepositoryColumn);
@ -648,7 +648,7 @@ PackageRow::UpdateRepository()
void void
PackageRow::UpdateVersion() PackageRow::UpdateVersion()
{ {
if (fPackage.Get() == NULL) if (!fPackage.IsSet())
return; return;
SetField(new BStringField(fPackage->Version().ToString()), kVersionColumn); SetField(new BStringField(fPackage->Version().ToString()), kVersionColumn);
@ -983,7 +983,7 @@ PackageListView::AttachWorkStatusView(WorkStatusView* view)
PackageRow* PackageRow*
PackageListView::_FindRow(const PackageInfoRef& package) PackageListView::_FindRow(const PackageInfoRef& package)
{ {
if (package.Get() == NULL) if (!package.IsSet())
return NULL; return NULL;
return fRowByNameTable->Lookup(package->Name().String()); return fRowByNameTable->Lookup(package->Name().String());
} }

View File

@ -538,7 +538,7 @@ RatePackageWindow::_QueryRatingThread()
BString nickname = fModel.Nickname(); BString nickname = fModel.Nickname();
locker.Unlock(); locker.Unlock();
if (package.Get() == NULL) { if (!package.IsSet()) {
HDERROR("rating query: No package"); HDERROR("rating query: No package");
_SetWorkerThread(-1); _SetWorkerThread(-1);
return; return;

View File

@ -172,7 +172,7 @@ ScreenshotWindow::SetPackage(const PackageInfoRef& package)
fPackage = package; fPackage = package;
BString title = B_TRANSLATE("Screenshot"); BString title = B_TRANSLATE("Screenshot");
if (package.Get() != NULL) { if (package.IsSet()) {
title = package->Title(); title = package->Title();
_DownloadScreenshot(); _DownloadScreenshot();
} }
@ -263,7 +263,7 @@ ScreenshotWindow::_DownloadThread()
fScreenshotView->UnsetBitmap(); fScreenshotView->UnsetBitmap();
if (fPackage.Get() == NULL) if (!fPackage.IsSet())
HDINFO("package not set"); HDINFO("package not set");
else { else {
if (fPackage->CountScreenshotInfos() == 0) if (fPackage->CountScreenshotInfos() == 0)
@ -276,7 +276,7 @@ ScreenshotWindow::_DownloadThread()
Unlock(); Unlock();
if (info.Get() == NULL) { if (!info.IsSet()) {
HDINFO("screenshot not set"); HDINFO("screenshot not set");
return; return;
} }
@ -314,7 +314,7 @@ ScreenshotWindow::_MaxWidthAndHeightOfAllScreenshots()
BSize size(0, 0); BSize size(0, 0);
// Find out dimensions of the largest screenshot of this package // Find out dimensions of the largest screenshot of this package
if (fPackage.Get() != NULL) { if (fPackage.IsSet()) {
int count = fPackage->CountScreenshotInfos(); int count = fPackage->CountScreenshotInfos();
for(int32 i = 0; i < count; i++) { for(int32 i = 0; i < count; i++) {
const ScreenshotInfoRef& info = fPackage->ScreenshotInfoAtIndex(i); const ScreenshotInfoRef& info = fPackage->ScreenshotInfoAtIndex(i);

View File

@ -140,7 +140,7 @@ BitmapView::SetBitmap(SharedBitmap* bitmap, BitmapSize bitmapSize)
void void
BitmapView::UnsetBitmap() BitmapView::UnsetBitmap()
{ {
if (fReference.Get() == NULL) if (!fReference.IsSet())
return; return;
fBitmap = NULL; fBitmap = NULL;
@ -160,4 +160,4 @@ BitmapView::SetScaleBitmap(bool scaleBitmap)
fScaleBitmap = scaleBitmap; fScaleBitmap = scaleBitmap;
Invalidate(); Invalidate();
} }

View File

@ -281,7 +281,7 @@ Controller::SetTo(const PlaylistItemRef& item)
fSeekFrame = -1; fSeekFrame = -1;
fRequestedSeekFrame = -1; fRequestedSeekFrame = -1;
if (fItem.Get() == NULL) if (!fItem.IsSet())
return B_BAD_VALUE; return B_BAD_VALUE;
TrackSupplier* trackSupplier = fItem->GetTrackSupplier(); TrackSupplier* trackSupplier = fItem->GetTrackSupplier();
@ -703,7 +703,7 @@ Controller::TimePosition()
status_t status_t
Controller::SaveState(bool reset) Controller::SaveState(bool reset)
{ {
if (fItem.Get() == NULL) if (!fItem.IsSet())
return B_OK; return B_OK;
if (reset) if (reset)
fCurrentFrame = 0; fCurrentFrame = 0;
@ -906,7 +906,7 @@ status_t
Controller::GetLocation(BString* location) Controller::GetLocation(BString* location)
{ {
// you need to hold the data lock // you need to hold the data lock
if (fItem.Get() == NULL) if (!fItem.IsSet())
return B_NO_INIT; return B_NO_INIT;
*location = fItem->LocationURI(); *location = fItem->LocationURI();
return B_OK; return B_OK;
@ -917,7 +917,7 @@ status_t
Controller::GetName(BString* name) Controller::GetName(BString* name)
{ {
// you need to hold the data lock // you need to hold the data lock
if (fItem.Get() == NULL) if (!fItem.IsSet())
return B_NO_INIT; return B_NO_INIT;
*name = fItem->Name(); *name = fItem->Name();
return B_OK; return B_OK;

View File

@ -726,7 +726,7 @@ MainWin::MessageReceived(BMessage* msg)
|| index != fPlaylist->CurrentItemIndex()) || index != fPlaylist->CurrentItemIndex())
break; break;
PlaylistItemRef item(fPlaylist->ItemAt(index)); PlaylistItemRef item(fPlaylist->ItemAt(index));
if (item.Get() != NULL) { if (item.IsSet()) {
printf("open playlist item: %s\n", item->Name().String()); printf("open playlist item: %s\n", item->Name().String());
OpenPlaylistItem(item); OpenPlaylistItem(item);
_MarkPlaylistItem(index); _MarkPlaylistItem(index);

View File

@ -25,7 +25,7 @@ ImageDebugInfoLoadingState::~ImageDebugInfoLoadingState()
bool bool
ImageDebugInfoLoadingState::HasSpecificDebugInfoLoadingState() const ImageDebugInfoLoadingState::HasSpecificDebugInfoLoadingState() const
{ {
return fSpecificInfoLoadingState.Get() != NULL; return fSpecificInfoLoadingState.IsSet();
} }

View File

@ -568,7 +568,7 @@ BGradient::Unflatten(BGradient *&output, BDataIO* stream)
return status; return status;
ObjectDeleter<BGradient> gradient(gradient_for_type(gradientType)); ObjectDeleter<BGradient> gradient(gradient_for_type(gradientType));
if (gradient.Get() == NULL) if (!gradient.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
if (colorsCount > 0) { if (colorsCount > 0) {

View File

@ -83,7 +83,7 @@ BDateFormat::Format(char* string, const size_t maxSize, const time_t time,
const BDateFormatStyle style) const const BDateFormatStyle style) const
{ {
ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style)); ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
UnicodeString icuString; UnicodeString icuString;
@ -104,13 +104,13 @@ BDateFormat::Format(BString& string, const time_t time,
const BDateFormatStyle style, const BTimeZone* timeZone) const const BDateFormatStyle style, const BTimeZone* timeZone) const
{ {
ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style)); ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
if (timeZone != NULL) { if (timeZone != NULL) {
ObjectDeleter<TimeZone> icuTimeZone( ObjectDeleter<TimeZone> icuTimeZone(
TimeZone::createTimeZone(timeZone->ID().String())); TimeZone::createTimeZone(timeZone->ID().String()));
if (icuTimeZone.Get() == NULL) if (!icuTimeZone.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
dateFormatter->setTimeZone(*icuTimeZone.Get()); dateFormatter->setTimeZone(*icuTimeZone.Get());
} }
@ -134,7 +134,7 @@ BDateFormat::Format(BString& string, const BDate& time,
return B_BAD_DATA; return B_BAD_DATA;
ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style)); ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
UErrorCode err = U_ZERO_ERROR; UErrorCode err = U_ZERO_ERROR;
@ -145,7 +145,7 @@ BDateFormat::Format(BString& string, const BDate& time,
if (timeZone != NULL) { if (timeZone != NULL) {
ObjectDeleter<TimeZone> icuTimeZone( ObjectDeleter<TimeZone> icuTimeZone(
TimeZone::createTimeZone(timeZone->ID().String())); TimeZone::createTimeZone(timeZone->ID().String()));
if (icuTimeZone.Get() == NULL) if (!icuTimeZone.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
dateFormatter->setTimeZone(*icuTimeZone.Get()); dateFormatter->setTimeZone(*icuTimeZone.Get());
calendar->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 const time_t time, const BDateFormatStyle style) const
{ {
ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style)); ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
fieldPositions = NULL; fieldPositions = NULL;
@ -213,7 +213,7 @@ BDateFormat::GetFields(BDateElement*& fields, int& fieldCount,
BDateFormatStyle style) const BDateFormatStyle style) const
{ {
ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style)); ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
fields = NULL; 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 // timezone aware so things like BDate::Difference can work for dates in
// different timezones. // different timezones.
ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style)); ObjectDeleter<DateFormat> dateFormatter(_CreateDateFormatter(style));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
ParsePosition p(0); ParsePosition p(0);

View File

@ -104,7 +104,7 @@ BDateTimeFormat::Format(char* target, size_t maxSize, time_t time,
BString format; BString format;
fConventions.GetDateTimeFormat(dateStyle, timeStyle, format); fConventions.GetDateTimeFormat(dateStyle, timeStyle, format);
ObjectDeleter<DateFormat> dateFormatter(_CreateDateTimeFormatter(format)); ObjectDeleter<DateFormat> dateFormatter(_CreateDateTimeFormatter(format));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
UnicodeString icuString; UnicodeString icuString;
@ -128,13 +128,13 @@ BDateTimeFormat::Format(BString& target, const time_t time,
BString format; BString format;
fConventions.GetDateTimeFormat(dateStyle, timeStyle, format); fConventions.GetDateTimeFormat(dateStyle, timeStyle, format);
ObjectDeleter<DateFormat> dateFormatter(_CreateDateTimeFormatter(format)); ObjectDeleter<DateFormat> dateFormatter(_CreateDateTimeFormatter(format));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
if (timeZone != NULL) { if (timeZone != NULL) {
ObjectDeleter<TimeZone> icuTimeZone( ObjectDeleter<TimeZone> icuTimeZone(
TimeZone::createTimeZone(timeZone->ID().String())); TimeZone::createTimeZone(timeZone->ID().String()));
if (icuTimeZone.Get() == NULL) if (!icuTimeZone.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
dateFormatter->setTimeZone(*icuTimeZone.Get()); dateFormatter->setTimeZone(*icuTimeZone.Get());
} }

View File

@ -434,7 +434,7 @@ BFormattingConventions::GetDateFormat(BDateFormatStyle style,
ObjectDeleter<DateFormat> dateFormatter( ObjectDeleter<DateFormat> dateFormatter(
DateFormat::createDateInstance((DateFormat::EStyle)style, *fICULocale)); DateFormat::createDateInstance((DateFormat::EStyle)style, *fICULocale));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
SimpleDateFormat* dateFormatterImpl SimpleDateFormat* dateFormatterImpl
@ -467,7 +467,7 @@ BFormattingConventions::GetTimeFormat(BTimeFormatStyle style,
ObjectDeleter<DateFormat> timeFormatter( ObjectDeleter<DateFormat> timeFormatter(
DateFormat::createTimeInstance((DateFormat::EStyle)style, *fICULocale)); DateFormat::createTimeInstance((DateFormat::EStyle)style, *fICULocale));
if (timeFormatter.Get() == NULL) if (!timeFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
SimpleDateFormat* timeFormatterImpl SimpleDateFormat* timeFormatterImpl
@ -511,7 +511,7 @@ BFormattingConventions::GetDateTimeFormat(BDateFormatStyle dateStyle,
ObjectDeleter<DateFormat> dateFormatter( ObjectDeleter<DateFormat> dateFormatter(
DateFormat::createDateTimeInstance((DateFormat::EStyle)dateStyle, DateFormat::createDateTimeInstance((DateFormat::EStyle)dateStyle,
(DateFormat::EStyle)timeStyle, *fICULocale)); (DateFormat::EStyle)timeStyle, *fICULocale));
if (dateFormatter.Get() == NULL) if (!dateFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
SimpleDateFormat* dateFormatterImpl SimpleDateFormat* dateFormatterImpl

View File

@ -67,7 +67,7 @@ BTimeFormat::Format(char* string, size_t maxSize, time_t time,
BTimeFormatStyle style) const BTimeFormatStyle style) const
{ {
ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style)); ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style));
if (timeFormatter.Get() == NULL) if (!timeFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
UnicodeString icuString; UnicodeString icuString;
@ -88,13 +88,13 @@ BTimeFormat::Format(BString& string, const time_t time,
const BTimeFormatStyle style, const BTimeZone* timeZone) const const BTimeFormatStyle style, const BTimeZone* timeZone) const
{ {
ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style)); ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style));
if (timeFormatter.Get() == NULL) if (!timeFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
if (timeZone != NULL) { if (timeZone != NULL) {
ObjectDeleter<TimeZone> icuTimeZone( ObjectDeleter<TimeZone> icuTimeZone(
TimeZone::createTimeZone(timeZone->ID().String())); TimeZone::createTimeZone(timeZone->ID().String()));
if (icuTimeZone.Get() == NULL) if (!icuTimeZone.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
timeFormatter->setTimeZone(*icuTimeZone.Get()); timeFormatter->setTimeZone(*icuTimeZone.Get());
} }
@ -115,7 +115,7 @@ BTimeFormat::Format(BString& string, int*& fieldPositions, int& fieldCount,
time_t time, BTimeFormatStyle style) const time_t time, BTimeFormatStyle style) const
{ {
ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style)); ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style));
if (timeFormatter.Get() == NULL) if (!timeFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
fieldPositions = NULL; fieldPositions = NULL;
@ -155,7 +155,7 @@ BTimeFormat::GetTimeFields(BDateElement*& fields, int& fieldCount,
BTimeFormatStyle style) const BTimeFormatStyle style) const
{ {
ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style)); ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style));
if (timeFormatter.Get() == NULL) if (!timeFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
fields = NULL; fields = NULL;
@ -210,7 +210,7 @@ status_t
BTimeFormat::Parse(BString source, BTimeFormatStyle style, BTime& output) BTimeFormat::Parse(BString source, BTimeFormatStyle style, BTime& output)
{ {
ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style)); ObjectDeleter<DateFormat> timeFormatter(_CreateTimeFormatter(style));
if (timeFormatter.Get() == NULL) if (!timeFormatter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
// If no timezone is specified in the time string, assume GMT // If no timezone is specified in the time string, assume GMT

View File

@ -162,7 +162,7 @@ BNetworkAddress::SetTo(const char* host, uint16 port, uint32 flags)
{ {
BReference<const BNetworkAddressResolver> resolver BReference<const BNetworkAddressResolver> resolver
= BNetworkAddressResolver::Resolve(host, port, flags); = BNetworkAddressResolver::Resolve(host, port, flags);
if (resolver.Get() == NULL) if (!resolver.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
status_t status = resolver->InitCheck(); status_t status = resolver->InitCheck();
if (status != B_OK) if (status != B_OK)
@ -189,7 +189,7 @@ BNetworkAddress::SetTo(const char* host, const char* service, uint32 flags)
{ {
BReference<const BNetworkAddressResolver> resolver BReference<const BNetworkAddressResolver> resolver
= BNetworkAddressResolver::Resolve(host, service, flags); = BNetworkAddressResolver::Resolve(host, service, flags);
if (resolver.Get() == NULL) if (!resolver.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
status_t status = resolver->InitCheck(); status_t status = resolver->InitCheck();
if (status != B_OK) if (status != B_OK)
@ -223,7 +223,7 @@ BNetworkAddress::SetTo(int family, const char* host, uint16 port, uint32 flags)
BReference<const BNetworkAddressResolver> resolver BReference<const BNetworkAddressResolver> resolver
= BNetworkAddressResolver::Resolve(family, host, port, flags); = BNetworkAddressResolver::Resolve(family, host, port, flags);
if (resolver.Get() == NULL) if (!resolver.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
status_t status = resolver->InitCheck(); status_t status = resolver->InitCheck();
if (status != B_OK) if (status != B_OK)
@ -252,7 +252,7 @@ BNetworkAddress::SetTo(int family, const char* host, const char* service,
BReference<const BNetworkAddressResolver> resolver BReference<const BNetworkAddressResolver> resolver
= BNetworkAddressResolver::Resolve(family, host, service, flags); = BNetworkAddressResolver::Resolve(family, host, service, flags);
if (resolver.Get() == NULL) if (!resolver.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
status_t status = resolver->InitCheck(); status_t status = resolver->InitCheck();
if (status != B_OK) if (status != B_OK)

View File

@ -832,7 +832,7 @@ DatabaseLocation::_CopyTypeNode(BNode& source, const char* type, BNode& _target)
// resize our buffer, if necessary // resize our buffer, if necessary
if (info.size > (off_t)bufferSize) { if (info.size > (off_t)bufferSize) {
bufferDeleter.SetTo(malloc(info.size)); bufferDeleter.SetTo(malloc(info.size));
if (bufferDeleter.Get() == NULL) if (!bufferDeleter.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
bufferSize = info.size; bufferSize = info.size;
} }

View File

@ -373,7 +373,7 @@ BReference<YTab>
BALMLayout::AddYTab() BALMLayout::AddYTab()
{ {
BReference<YTab> tab(new(std::nothrow) YTab(this), true); BReference<YTab> tab(new(std::nothrow) YTab(this), true);
if (tab.Get() == NULL) if (!tab.IsSet())
return NULL; return NULL;
if (!Solver()->AddVariable(tab)) if (!Solver()->AddVariable(tab))
return NULL; return NULL;
@ -862,16 +862,16 @@ BALMLayout::AddItem(BLayoutItem* item, XTab* _left, YTab* _top, XTab* _right,
debugger("Tab added to unfriendly layout!"); debugger("Tab added to unfriendly layout!");
BReference<XTab> right = _right; BReference<XTab> right = _right;
if (right.Get() == NULL) if (!right.IsSet())
right = AddXTab(); right = AddXTab();
BReference<YTab> bottom = _bottom; BReference<YTab> bottom = _bottom;
if (bottom.Get() == NULL) if (!bottom.IsSet())
bottom = AddYTab(); bottom = AddYTab();
BReference<XTab> left = _left; BReference<XTab> left = _left;
if (left.Get() == NULL) if (!left.IsSet())
left = AddXTab(); left = AddXTab();
BReference<YTab> top = _top; BReference<YTab> top = _top;
if (top.Get() == NULL) if (!top.IsSet())
top = AddYTab(); top = AddYTab();
TabAddTransaction<XTab> leftTabAdd(this); TabAddTransaction<XTab> leftTabAdd(this);

View File

@ -57,7 +57,7 @@ Canvas::~Canvas()
status_t status_t
Canvas::InitCheck() const Canvas::InitCheck() const
{ {
if (fDrawState.Get() == NULL) if (!fDrawState.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
return B_OK; return B_OK;

View File

@ -656,7 +656,7 @@ Desktop::SetCursor(ServerCursor* newCursor)
fCursor = newCursor; fCursor = newCursor;
if (fManagementCursor.Get() == NULL) if (!fManagementCursor.IsSet())
HWInterface()->SetCursor(newCursor); HWInterface()->SetCursor(newCursor);
} }
@ -2563,7 +2563,7 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
ObjectDeleter<ServerApp> app(new (std::nothrow) ServerApp(this, clientReplyPort, ObjectDeleter<ServerApp> app(new (std::nothrow) ServerApp(this, clientReplyPort,
clientLooperPort, clientTeamID, htoken, appSignature)); clientLooperPort, clientTeamID, htoken, appSignature));
status_t status = B_OK; status_t status = B_OK;
if (app.Get() == NULL) if (!app.IsSet())
status = B_NO_MEMORY; status = B_NO_MEMORY;
if (status == B_OK) if (status == B_OK)
status = app->InitCheck(); status = app->InitCheck();
@ -3771,7 +3771,7 @@ Desktop::_SetWorkspace(int32 index, bool moveFocusWindow)
// window if they changed their order // window if they changed their order
ObjectDeleter<BRegion> region(new (std::nothrow) ObjectDeleter<BRegion> region(new (std::nothrow)
BRegion(window->VisibleRegion())); BRegion(window->VisibleRegion()));
if (region.Get() != NULL) { if (region.IsSet()) {
if (previousRegions.AddItem(region.Detach())) if (previousRegions.AddItem(region.Detach()))
windows.AddWindow(window); windows.AddWindow(window);
} }

View File

@ -244,7 +244,7 @@ DrawState::ReadFromLink(BPrivate::LinkReceiver& link)
fAlphaFncMode = info.alphaFunctionMode; fAlphaFncMode = info.alphaFunctionMode;
fFontAliasing = info.fontAntialiasing; fFontAliasing = info.fontAntialiasing;
if (fPreviousState.Get() != NULL) { if (fPreviousState.IsSet()) {
fCombinedOrigin = fPreviousState->fCombinedOrigin + fOrigin; fCombinedOrigin = fPreviousState->fCombinedOrigin + fOrigin;
fCombinedScale = fPreviousState->fCombinedScale * fScale; fCombinedScale = fPreviousState->fCombinedScale * fScale;
fCombinedTransform = fPreviousState->fCombinedTransform * fTransform; 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 // TODO: Could be optimized, but is low prio, since most views do not
// use a custom clipping region... // use a custom clipping region...
if (fClippingRegion.Get() != NULL) { if (fClippingRegion.IsSet()) {
int32 clippingRectCount = fClippingRegion->CountRects(); int32 clippingRectCount = fClippingRegion->CountRects();
link.Attach<int32>(clippingRectCount); link.Attach<int32>(clippingRectCount);
for (int i = 0; i < clippingRectCount; i++) 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 // NOTE: the origins of earlier states are never expected to
// change, only the topmost state ever changes // change, only the topmost state ever changes
if (fPreviousState.Get() != NULL) { if (fPreviousState.IsSet()) {
fCombinedOrigin.x = fPreviousState->fCombinedOrigin.x fCombinedOrigin.x = fPreviousState->fCombinedOrigin.x
+ fOrigin.x * fPreviousState->fCombinedScale; + fOrigin.x * fPreviousState->fCombinedScale;
fCombinedOrigin.y = fPreviousState->fCombinedOrigin.y fCombinedOrigin.y = fPreviousState->fCombinedOrigin.y
@ -363,7 +363,7 @@ DrawState::SetScale(float scale)
// NOTE: the scales of earlier states are never expected to // NOTE: the scales of earlier states are never expected to
// change, only the topmost state ever changes // change, only the topmost state ever changes
if (fPreviousState.Get() != NULL) if (fPreviousState.IsSet())
fCombinedScale = fPreviousState->fCombinedScale * fScale; fCombinedScale = fPreviousState->fCombinedScale * fScale;
else else
fCombinedScale = fScale; fCombinedScale = fScale;
@ -385,7 +385,7 @@ DrawState::SetTransform(BAffineTransform transform)
// NOTE: the transforms of earlier states are never expected to // NOTE: the transforms of earlier states are never expected to
// change, only the topmost state ever changes // change, only the topmost state ever changes
if (fPreviousState.Get() != NULL) if (fPreviousState.IsSet())
fCombinedTransform = fPreviousState->fCombinedTransform * fTransform; fCombinedTransform = fPreviousState->fCombinedTransform * fTransform;
else else
fCombinedTransform = fTransform; fCombinedTransform = fTransform;
@ -420,7 +420,7 @@ void
DrawState::SetClippingRegion(const BRegion* region) DrawState::SetClippingRegion(const BRegion* region)
{ {
if (region) { if (region) {
if (fClippingRegion.Get() != NULL) if (fClippingRegion.IsSet())
*fClippingRegion.Get() = *region; *fClippingRegion.Get() = *region;
else else
fClippingRegion.SetTo(new(nothrow) BRegion(*region)); fClippingRegion.SetTo(new(nothrow) BRegion(*region));
@ -433,9 +433,9 @@ DrawState::SetClippingRegion(const BRegion* region)
bool bool
DrawState::HasClipping() const DrawState::HasClipping() const
{ {
if (fClippingRegion.Get() != NULL) if (fClippingRegion.IsSet())
return true; return true;
if (fPreviousState.Get() != NULL) if (fPreviousState.IsSet())
return fPreviousState->HasClipping(); return fPreviousState->HasClipping();
return false; return false;
} }
@ -444,26 +444,26 @@ DrawState::HasClipping() const
bool bool
DrawState::HasAdditionalClipping() const DrawState::HasAdditionalClipping() const
{ {
return fClippingRegion.Get() != NULL; return fClippingRegion.IsSet();
} }
bool bool
DrawState::GetCombinedClippingRegion(BRegion* region) const DrawState::GetCombinedClippingRegion(BRegion* region) const
{ {
if (fClippingRegion.Get() != NULL) { if (fClippingRegion.IsSet()) {
BRegion localTransformedClipping(*fClippingRegion.Get()); BRegion localTransformedClipping(*fClippingRegion.Get());
SimpleTransform penTransform; SimpleTransform penTransform;
Transform(penTransform); Transform(penTransform);
penTransform.Apply(&localTransformedClipping); penTransform.Apply(&localTransformedClipping);
if (fPreviousState.Get() != NULL if (fPreviousState.IsSet()
&& fPreviousState->GetCombinedClippingRegion(region)) { && fPreviousState->GetCombinedClippingRegion(region)) {
localTransformedClipping.IntersectWith(region); localTransformedClipping.IntersectWith(region);
} }
*region = localTransformedClipping; *region = localTransformedClipping;
return true; return true;
} else { } else {
if (fPreviousState.Get() != NULL) if (fPreviousState.IsSet())
return fPreviousState->GetCombinedClippingRegion(region); return fPreviousState->GetCombinedClippingRegion(region);
} }
return false; return false;
@ -506,7 +506,7 @@ DrawState::ClipToRect(BRect rect, bool inverse)
} }
if (inverse) { if (inverse) {
if (fClippingRegion.Get() == NULL) { if (!fClippingRegion.IsSet()) {
fClippingRegion.SetTo(new(nothrow) BRegion(BRect( fClippingRegion.SetTo(new(nothrow) BRegion(BRect(
-(1 << 16), -(1 << 16), (1 << 16), (1 << 16)))); -(1 << 16), -(1 << 16), (1 << 16), (1 << 16))));
// TODO: we should have a definition for a rect (or region) // TODO: we should have a definition for a rect (or region)
@ -514,7 +514,7 @@ DrawState::ClipToRect(BRect rect, bool inverse)
} }
fClippingRegion->Exclude(rect); fClippingRegion->Exclude(rect);
} else { } else {
if (fClippingRegion.Get() == NULL) if (!fClippingRegion.IsSet())
fClippingRegion.SetTo(new(nothrow) BRegion(rect)); fClippingRegion.SetTo(new(nothrow) BRegion(rect));
else { else {
BRegion rectRegion(rect); BRegion rectRegion(rect);
@ -827,7 +827,7 @@ DrawState::PrintToStream() const
printf("\t LineCap: %d\t LineJoin: %d\t MiterLimit: %.2f\n", printf("\t LineCap: %d\t LineJoin: %d\t MiterLimit: %.2f\n",
(int16)fLineCapMode, (int16)fLineJoinMode, fMiterLimit); (int16)fLineCapMode, (int16)fLineJoinMode, fMiterLimit);
if (fClippingRegion.Get() != NULL) if (fClippingRegion.IsSet())
fClippingRegion->PrintToStream(); fClippingRegion->PrintToStream();
printf("\t ===== Font Data =====\n"); printf("\t ===== Font Data =====\n");

View File

@ -343,9 +343,9 @@ EventDispatcher::RemoveTarget(EventTarget& target)
if (fPreviousMouseTarget == &target) if (fPreviousMouseTarget == &target)
fPreviousMouseTarget = NULL; fPreviousMouseTarget = NULL;
if (fKeyboardFilter.Get() != NULL) if (fKeyboardFilter.IsSet())
fKeyboardFilter->RemoveTarget(&target); fKeyboardFilter->RemoveTarget(&target);
if (fMouseFilter.Get() != NULL) if (fMouseFilter.IsSet())
fMouseFilter->RemoveTarget(&target); fMouseFilter->RemoveTarget(&target);
fTargets.RemoveItem(&target); fTargets.RemoveItem(&target);
@ -812,7 +812,7 @@ EventDispatcher::_EventLoop()
#endif #endif
pointerEvent = true; pointerEvent = true;
if (fMouseFilter.Get() == NULL) if (!fMouseFilter.IsSet())
break; break;
EventTarget* mouseTarget = fPreviousMouseTarget; EventTarget* mouseTarget = fPreviousMouseTarget;
@ -890,7 +890,7 @@ EventDispatcher::_EventLoop()
case B_INPUT_METHOD_EVENT: case B_INPUT_METHOD_EVENT:
ETRACE(("key event, focus = %p\n", fFocus)); ETRACE(("key event, focus = %p\n", fFocus));
if (fKeyboardFilter.Get() != NULL if (fKeyboardFilter.IsSet()
&& fKeyboardFilter->Filter(event, &fFocus) && fKeyboardFilter->Filter(event, &fFocus)
== B_SKIP_MESSAGE) { == B_SKIP_MESSAGE) {
break; break;

View File

@ -264,7 +264,7 @@ InputServerStream::_MessageFromPort(BMessage** _message, bigtime_t timeout)
// we have the message, now let's unflatten it // we have the message, now let's unflatten it
ObjectDeleter<BMessage> message(new BMessage(code)); ObjectDeleter<BMessage> message(new BMessage(code));
if (message.Get() == NULL) if (!message.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
if (buffer == NULL) { if (buffer == NULL) {

View File

@ -122,7 +122,7 @@ Layer::RenderToBitmap(Canvas* canvas)
BitmapHWInterface layerInterface(layerBitmap); BitmapHWInterface layerInterface(layerBitmap);
ObjectDeleter<DrawingEngine> const layerEngine(layerInterface.CreateDrawingEngine()); ObjectDeleter<DrawingEngine> const layerEngine(layerInterface.CreateDrawingEngine());
if (layerEngine.Get() == NULL) if (!layerEngine.IsSet())
return NULL; return NULL;
layerEngine->SetRendererOffset(boundingBox.left, boundingBox.top); layerEngine->SetRendererOffset(boundingBox.left, boundingBox.top);

View File

@ -31,7 +31,7 @@ OffscreenWindow::OffscreenWindow(ServerBitmap* bitmap,
fBitmap(bitmap), fBitmap(bitmap),
fHWInterface(new (nothrow) BitmapHWInterface(fBitmap)) fHWInterface(new (nothrow) BitmapHWInterface(fBitmap))
{ {
if (fHWInterface.Get() == NULL || !GetDrawingEngine()) if (!fHWInterface.IsSet() || !GetDrawingEngine())
return; return;
fHWInterface->Initialize(); fHWInterface->Initialize();
@ -50,7 +50,7 @@ OffscreenWindow::~OffscreenWindow()
if (GetDrawingEngine()) if (GetDrawingEngine())
GetDrawingEngine()->SetHWInterface(NULL); GetDrawingEngine()->SetHWInterface(NULL);
if (fHWInterface.Get() != NULL) { if (fHWInterface.IsSet()) {
fHWInterface->LockExclusiveAccess(); fHWInterface->LockExclusiveAccess();
fHWInterface->Shutdown(); fHWInterface->Shutdown();
fHWInterface->UnlockExclusiveAccess(); fHWInterface->UnlockExclusiveAccess();

View File

@ -67,7 +67,7 @@ Screen::~Screen()
status_t status_t
Screen::Initialize() Screen::Initialize()
{ {
if (fHWInterface.Get() != NULL) { if (fHWInterface.IsSet()) {
// init the graphics hardware // init the graphics hardware
return fHWInterface->Initialize(); return fHWInterface->Initialize();
} }
@ -79,7 +79,7 @@ Screen::Initialize()
void void
Screen::Shutdown() Screen::Shutdown()
{ {
if (fHWInterface.Get() != NULL) if (fHWInterface.IsSet())
fHWInterface->Shutdown(); fHWInterface->Shutdown();
} }

View File

@ -234,7 +234,7 @@ ScreenManager::_AddHWInterface(HWInterface* interface)
item->owner = NULL; item->owner = NULL;
item->listener.SetTo( item->listener.SetTo(
new(nothrow) ScreenChangeListener(*this, screen)); new(nothrow) ScreenChangeListener(*this, screen));
if (item->listener.Get() != NULL if (item->listener.IsSet()
&& interface->AddListener(item->listener.Get())) { && interface->AddListener(item->listener.Get())) {
if (fScreenList.AddItem(item)) if (fScreenList.AddItem(item))
return item; return item;

View File

@ -1120,7 +1120,7 @@ ServerPicture::ServerPicture(const char* fileName, int32 offset)
fToken = gTokenSpace.NewToken(kPictureToken, this); fToken = gTokenSpace.NewToken(kPictureToken, this);
fFile.SetTo(new(std::nothrow) BFile(fileName, B_READ_WRITE)); fFile.SetTo(new(std::nothrow) BFile(fileName, B_READ_WRITE));
if (fFile.Get() == NULL) if (!fFile.IsSet())
return; return;
BPrivate::Storage::OffsetFile* offsetFile BPrivate::Storage::OffsetFile* offsetFile
@ -1142,7 +1142,7 @@ ServerPicture::~ServerPicture()
gTokenSpace.RemoveToken(fToken); gTokenSpace.RemoveToken(fToken);
if (fPictures.Get() != NULL) { if (fPictures.IsSet()) {
for (int32 i = fPictures->CountItems(); i-- > 0;) { for (int32 i = fPictures->CountItems(); i-- > 0;) {
ServerPicture* picture = fPictures->ItemAt(i); ServerPicture* picture = fPictures->ItemAt(i);
picture->SetOwner(NULL); picture->SetOwner(NULL);
@ -1314,10 +1314,10 @@ ServerPicture::AppendPicture(ServerPicture* picture)
bool bool
ServerPicture::NestPicture(ServerPicture* picture) ServerPicture::NestPicture(ServerPicture* picture)
{ {
if (fPictures.Get() == NULL) if (!fPictures.IsSet())
fPictures.SetTo(new(std::nothrow) PictureList); fPictures.SetTo(new(std::nothrow) PictureList);
if (fPictures.Get() == NULL || !fPictures->AddItem(picture)) if (!fPictures.IsSet() || !fPictures->AddItem(picture))
return false; return false;
picture->AcquireReference(); picture->AcquireReference();
@ -1328,7 +1328,7 @@ ServerPicture::NestPicture(ServerPicture* picture)
off_t off_t
ServerPicture::DataLength() const ServerPicture::DataLength() const
{ {
if (fData.Get() == NULL) if (!fData.IsSet())
return 0; return 0;
off_t size; off_t size;
fData->GetSize(&size); fData->GetSize(&size);
@ -1369,7 +1369,7 @@ ServerPicture::ExportData(BPrivate::PortLink& link)
fData->Seek(0, SEEK_SET); fData->Seek(0, SEEK_SET);
int32 subPicturesCount = 0; int32 subPicturesCount = 0;
if (fPictures.Get() != NULL) if (fPictures.IsSet())
subPicturesCount = fPictures->CountItems(); subPicturesCount = fPictures->CountItems();
link.Attach<int32>(subPicturesCount); link.Attach<int32>(subPicturesCount);
if (subPicturesCount > 0) { if (subPicturesCount > 0) {

View File

@ -280,7 +280,7 @@ ServerWindow::Init(BRect frame, window_look look, window_feel feel,
// We cannot call MakeWindow in the constructor, since it // We cannot call MakeWindow in the constructor, since it
// is a virtual function! // is a virtual function!
fWindow.SetTo(MakeWindow(frame, fTitle, look, feel, flags, workspace)); 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(); fWindow.Unset();
return B_NO_MEMORY; return B_NO_MEMORY;
} }
@ -349,7 +349,7 @@ ServerWindow::_Show()
// instead of doing it from this thread. // instead of doing it from this thread.
fDesktop->UnlockSingleWindow(); fDesktop->UnlockSingleWindow();
fDesktop->ShowWindow(fWindow.Get()); fDesktop->ShowWindow(fWindow.Get());
if (fDirectWindowInfo.Get() != NULL && fDirectWindowInfo->IsFullScreen()) if (fDirectWindowInfo.IsSet() && fDirectWindowInfo->IsFullScreen())
_ResizeToFullScreen(); _ResizeToFullScreen();
fDesktop->LockSingleWindow(); fDesktop->LockSingleWindow();
@ -408,7 +408,7 @@ ServerWindow::SetTitle(const char* newTitle)
rename_thread(Thread(), name); rename_thread(Thread(), name);
} }
if (fWindow.Get() != NULL) if (fWindow.IsSet())
fDesktop->SetWindowTitle(fWindow.Get(), newTitle); fDesktop->SetWindowTitle(fWindow.Get(), newTitle);
} }
@ -972,7 +972,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
Title())); Title()));
int32 size; int32 size;
if (fWindow.Get() != NULL && link.Read<int32>(&size) == B_OK) { if (fWindow.IsSet() && link.Read<int32>(&size) == B_OK) {
char buffer[size]; char buffer[size];
if (link.Read(buffer, size) == B_OK) { if (link.Read(buffer, size) == B_OK) {
BMessage settings; BMessage settings;
@ -1096,7 +1096,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
link.Read<bool>(&enable); link.Read<bool>(&enable);
status_t status = B_OK; status_t status = B_OK;
if (fDirectWindowInfo.Get() != NULL) if (fDirectWindowInfo.IsSet())
_DirectWindowSetFullScreen(enable); _DirectWindowSetFullScreen(enable);
else else
status = B_BAD_TYPE; status = B_BAD_TYPE;
@ -3650,7 +3650,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver& link)
ArrayDeleter<uint32> opList(new(std::nothrow) uint32[opCount]); ArrayDeleter<uint32> opList(new(std::nothrow) uint32[opCount]);
ArrayDeleter<BPoint> ptList(new(std::nothrow) BPoint[ptCount]); ArrayDeleter<BPoint> 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(opList.Get(), opCount * sizeof(uint32)) != B_OK
|| link.Read(ptList.Get(), ptCount * sizeof(BPoint)) != B_OK) || link.Read(ptList.Get(), ptCount * sizeof(BPoint)) != B_OK)
break; break;
@ -4289,7 +4289,7 @@ ServerWindow::ScreenChanged(const BMessage* message)
{ {
SendMessageToClient(message); SendMessageToClient(message);
if (fDirectWindowInfo.Get() != NULL && fDirectWindowInfo->IsFullScreen()) if (fDirectWindowInfo.IsSet() && fDirectWindowInfo->IsFullScreen())
_ResizeToFullScreen(); _ResizeToFullScreen();
} }
@ -4323,7 +4323,7 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState)
{ {
ASSERT_MULTI_LOCKED(fDesktop->WindowLocker()); ASSERT_MULTI_LOCKED(fDesktop->WindowLocker());
if (fDirectWindowInfo.Get() == NULL) if (!fDirectWindowInfo.IsSet())
return; return;
STRACE(("HandleDirectConnection(bufferState = %" B_PRId32 ", driverState = " STRACE(("HandleDirectConnection(bufferState = %" B_PRId32 ", driverState = "
@ -4475,7 +4475,7 @@ ServerWindow::_ResizeToFullScreen()
status_t status_t
ServerWindow::_EnableDirectWindowMode() ServerWindow::_EnableDirectWindowMode()
{ {
if (fDirectWindowInfo.Get() != NULL) { if (fDirectWindowInfo.IsSet()) {
// already in direct window mode // already in direct window mode
return B_ERROR; return B_ERROR;
} }
@ -4486,7 +4486,7 @@ ServerWindow::_EnableDirectWindowMode()
} }
fDirectWindowInfo.SetTo(new(std::nothrow) DirectWindowInfo); fDirectWindowInfo.SetTo(new(std::nothrow) DirectWindowInfo);
if (fDirectWindowInfo.Get() == NULL) if (!fDirectWindowInfo.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
status_t status = fDirectWindowInfo->InitCheck(); status_t status = fDirectWindowInfo->InitCheck();

View File

@ -107,7 +107,7 @@ public:
void HandleDirectConnection(int32 bufferState, void HandleDirectConnection(int32 bufferState,
int32 driverState = 0); int32 driverState = 0);
bool HasDirectFrameBufferAccess() const bool HasDirectFrameBufferAccess() const
{ return fDirectWindowInfo.Get() != NULL; } { return fDirectWindowInfo.IsSet(); }
bool IsDirectlyAccessing() const bool IsDirectlyAccessing() const
{ return fIsDirectlyAccessing; } { return fIsDirectlyAccessing; }

View File

@ -126,7 +126,7 @@ View::View(IntRect frame, IntPoint scrollingOffset, const char* name,
fUserClipping(NULL), fUserClipping(NULL),
fScreenAndUserClipping(NULL) fScreenAndUserClipping(NULL)
{ {
if (fDrawState.Get() != NULL) if (fDrawState.IsSet())
fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE); fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE);
} }
@ -1349,13 +1349,13 @@ View::PrintToStream() const
printf(" valid: %d\n", fScreenClippingValid); printf(" valid: %d\n", fScreenClippingValid);
printf(" fUserClipping:\n"); printf(" fUserClipping:\n");
if (fUserClipping.Get() != NULL) if (fUserClipping.IsSet())
fUserClipping->PrintToStream(); fUserClipping->PrintToStream();
else else
printf(" none\n"); printf(" none\n");
printf(" fScreenAndUserClipping:\n"); printf(" fScreenAndUserClipping:\n");
if (fScreenAndUserClipping.Get() != NULL) if (fScreenAndUserClipping.IsSet())
fScreenAndUserClipping->PrintToStream(); fScreenAndUserClipping->PrintToStream();
else else
printf(" invalid\n"); printf(" invalid\n");
@ -1409,9 +1409,9 @@ View::RebuildClipping(bool deep)
// hand, views for which this feature is actually used will // hand, views for which this feature is actually used will
// probably not have any children, so it is not that expensive // probably not have any children, so it is not that expensive
// after all // after all
if (fUserClipping.Get() == NULL) { if (!fUserClipping.IsSet()) {
fUserClipping.SetTo(new (nothrow) BRegion); fUserClipping.SetTo(new (nothrow) BRegion);
if (fUserClipping.Get() == NULL) if (!fUserClipping.IsSet())
return; return;
} }
@ -1429,16 +1429,16 @@ BRegion&
View::ScreenAndUserClipping(BRegion* windowContentClipping, bool force) const View::ScreenAndUserClipping(BRegion* windowContentClipping, bool force) const
{ {
// no user clipping - return screen clipping directly // no user clipping - return screen clipping directly
if (fUserClipping.Get() == NULL) if (!fUserClipping.IsSet())
return _ScreenClipping(windowContentClipping, force); return _ScreenClipping(windowContentClipping, force);
// combined screen and user clipping already valid // combined screen and user clipping already valid
if (fScreenAndUserClipping.Get() != NULL) if (fScreenAndUserClipping.IsSet())
return *fScreenAndUserClipping.Get(); return *fScreenAndUserClipping.Get();
// build a new combined user and screen clipping // build a new combined user and screen clipping
fScreenAndUserClipping.SetTo(new (nothrow) BRegion(*fUserClipping.Get())); fScreenAndUserClipping.SetTo(new (nothrow) BRegion(*fUserClipping.Get()));
if (fScreenAndUserClipping.Get() == NULL) if (!fScreenAndUserClipping.IsSet())
return fScreenClipping; return fScreenClipping;
LocalToScreenTransform().Apply(fScreenAndUserClipping.Get()); LocalToScreenTransform().Apply(fScreenAndUserClipping.Get());

View File

@ -210,9 +210,9 @@ public:
inline bool IsScreenClippingValid() const inline bool IsScreenClippingValid() const
{ {
return fScreenClippingValid return fScreenClippingValid
&& (fUserClipping.Get() == NULL && (!fUserClipping.IsSet()
|| (fUserClipping.Get() != NULL || (fUserClipping.IsSet()
&& fScreenAndUserClipping.Get() != NULL)); && fScreenAndUserClipping.IsSet()));
} }
// debugging // debugging

View File

@ -129,7 +129,7 @@ Window::Window(const BRect& frame, const char *name,
SetFlags(flags, NULL); 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 // allocates a decorator
::Decorator* decorator = Decorator(); ::Decorator* decorator = Decorator();
if (decorator != NULL) { if (decorator != NULL) {
@ -167,7 +167,7 @@ Window::Window(const BRect& frame, const char *name,
Window::~Window() Window::~Window()
{ {
if (fTopView.Get() != NULL) { if (fTopView.IsSet()) {
fTopView->DetachedFromWindow(); fTopView->DetachedFromWindow();
} }
@ -181,7 +181,7 @@ status_t
Window::InitCheck() const Window::InitCheck() const
{ {
if (GetDrawingEngine() == NULL if (GetDrawingEngine() == NULL
|| (fFeel != kOffscreenWindowFeel && fWindowBehaviour.Get() == NULL)) || (fFeel != kOffscreenWindowFeel && !fWindowBehaviour.IsSet()))
return B_NO_MEMORY; return B_NO_MEMORY;
// TODO: anything else? // TODO: anything else?
return B_OK; return B_OK;
@ -298,7 +298,7 @@ Window::MoveBy(int32 x, int32 y, bool moveStack)
fEffectiveDrawingRegionValid = false; fEffectiveDrawingRegionValid = false;
if (fTopView.Get() != NULL) { if (fTopView.IsSet()) {
fTopView->MoveBy(x, y, NULL); fTopView->MoveBy(x, y, NULL);
fTopView->UpdateOverlay(); fTopView->UpdateOverlay();
} }
@ -365,7 +365,7 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion, bool resizeStack)
fContentRegionValid = false; fContentRegionValid = false;
fEffectiveDrawingRegionValid = false; fEffectiveDrawingRegionValid = false;
if (fTopView.Get() != NULL) { if (fTopView.IsSet()) {
fTopView->ResizeBy(x, y, dirtyRegion); fTopView->ResizeBy(x, y, dirtyRegion);
fTopView->UpdateOverlay(); fTopView->UpdateOverlay();
} }
@ -515,13 +515,13 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
void void
Window::SetTopView(View* topView) Window::SetTopView(View* topView)
{ {
if (fTopView.Get() != NULL) { if (fTopView.IsSet()) {
fTopView->DetachedFromWindow(); fTopView->DetachedFromWindow();
} }
fTopView.SetTo(topView); fTopView.SetTo(topView);
if (fTopView.Get() != NULL) { if (fTopView.IsSet()) {
// the top view is special, it has a coordinate system // the top view is special, it has a coordinate system
// as if it was attached directly to the desktop, therefor, // as if it was attached directly to the desktop, therefor,
// the coordinate conversion through the view tree works // the coordinate conversion through the view tree works
@ -572,7 +572,7 @@ Window::PreviousWindow(int32 index) const
::Decorator* ::Decorator*
Window::Decorator() const Window::Decorator() const
{ {
if (fCurrentStack.Get() == NULL) if (!fCurrentStack.IsSet())
return NULL; return NULL;
return fCurrentStack->Decorator(); return fCurrentStack->Decorator();
} }
@ -1118,7 +1118,7 @@ Window::IsVisible() const
bool bool
Window::IsDragging() const Window::IsDragging() const
{ {
if (fWindowBehaviour.Get() == NULL) if (!fWindowBehaviour.IsSet())
return false; return false;
return fWindowBehaviour->IsDragging(); return fWindowBehaviour->IsDragging();
} }
@ -1127,7 +1127,7 @@ Window::IsDragging() const
bool bool
Window::IsResizing() const Window::IsResizing() const
{ {
if (fWindowBehaviour.Get() == NULL) if (!fWindowBehaviour.IsSet())
return false; return false;
return fWindowBehaviour->IsResizing(); return fWindowBehaviour->IsResizing();
} }
@ -1261,7 +1261,7 @@ Window::SetLook(window_look look, BRegion* updateRegion)
// ...and therefor the drawing region is // ...and therefor the drawing region is
// likely not valid anymore either // likely not valid anymore either
if (fCurrentStack.Get() == NULL) if (!fCurrentStack.IsSet())
return; return;
int32 stackPosition = PositionInStack(); int32 stackPosition = PositionInStack();
@ -2073,7 +2073,7 @@ Window::UpdateSession::AddCause(uint8 cause)
int32 int32
Window::PositionInStack() const Window::PositionInStack() const
{ {
if (fCurrentStack.Get() == NULL) if (!fCurrentStack.IsSet())
return -1; return -1;
return fCurrentStack->WindowList().IndexOf(this); 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. // The lock must normally be held but is not held when closing the window.
//ASSERT_MULTI_WRITE_LOCKED(fDesktop->WindowLocker()); //ASSERT_MULTI_WRITE_LOCKED(fDesktop->WindowLocker());
if (fCurrentStack.Get() == NULL) if (!fCurrentStack.IsSet())
return false; return false;
if (fCurrentStack->CountWindows() == 1) if (fCurrentStack->CountWindows() == 1)
return true; return true;
@ -2196,7 +2196,7 @@ Window::StackedWindowAt(const BPoint& where)
Window* Window*
Window::TopLayerStackWindow() Window::TopLayerStackWindow()
{ {
if (fCurrentStack.Get() == NULL) if (!fCurrentStack.IsSet())
return this; return this;
return fCurrentStack->TopLayerWindow(); return fCurrentStack->TopLayerWindow();
} }
@ -2205,7 +2205,7 @@ Window::TopLayerStackWindow()
WindowStack* WindowStack*
Window::GetWindowStack() Window::GetWindowStack()
{ {
if (fCurrentStack.Get() == NULL) if (!fCurrentStack.IsSet())
return _InitWindowStack(); return _InitWindowStack();
return fCurrentStack; return fCurrentStack;
} }
@ -2227,7 +2227,7 @@ Window::MoveToTopStackLayer()
bool bool
Window::MoveToStackPosition(int32 to, bool isMoving) Window::MoveToStackPosition(int32 to, bool isMoving)
{ {
if (fCurrentStack.Get() == NULL) if (!fCurrentStack.IsSet())
return false; return false;
int32 index = PositionInStack(); int32 index = PositionInStack();
if (fCurrentStack->Move(index, to) == false) if (fCurrentStack->Move(index, to) == false)

View File

@ -724,7 +724,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where,
} }
// if a state is active, let it do the job // if a state is active, let it do the job
if (fState.Get() != NULL) { if (fState.IsSet()) {
bool unhandled = false; bool unhandled = false;
bool result = fState->MouseDown(message, where, unhandled); bool result = fState->MouseDown(message, where, unhandled);
if (!unhandled) if (!unhandled)
@ -917,7 +917,7 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where,
void void
DefaultWindowBehaviour::MouseUp(BMessage* message, BPoint where) DefaultWindowBehaviour::MouseUp(BMessage* message, BPoint where)
{ {
if (fState.Get() != NULL) if (fState.IsSet())
fState->MouseUp(message, where); fState->MouseUp(message, where);
} }
@ -925,7 +925,7 @@ DefaultWindowBehaviour::MouseUp(BMessage* message, BPoint where)
void void
DefaultWindowBehaviour::MouseMoved(BMessage* message, BPoint where, bool isFake) DefaultWindowBehaviour::MouseMoved(BMessage* message, BPoint where, bool isFake)
{ {
if (fState.Get() != NULL) { if (fState.IsSet()) {
fState->MouseMoved(message, where, isFake); fState->MouseMoved(message, where, isFake);
} else { } else {
// If the window modifiers are hold, enter the window management state. // If the window modifiers are hold, enter the window management state.
@ -952,7 +952,7 @@ DefaultWindowBehaviour::ModifiersChanged(int32 modifiers)
int32 buttons; int32 buttons;
fDesktop->GetLastMouseState(&where, &buttons); fDesktop->GetLastMouseState(&where, &buttons);
if (fState.Get() != NULL) { if (fState.IsSet()) {
fState->ModifiersChanged(where, modifiers); fState->ModifiersChanged(where, modifiers);
} else { } else {
// If the window modifiers are hold, enter the window management state. // If the window modifiers are hold, enter the window management state.
@ -1164,17 +1164,17 @@ void
DefaultWindowBehaviour::_NextState(State* state) DefaultWindowBehaviour::_NextState(State* state)
{ {
// exit the old state // exit the old state
if (fState.Get() != NULL) if (fState.IsSet())
fState->ExitState(state); fState->ExitState(state);
// set and enter the new state // set and enter the new state
ObjectDeleter<State> oldState(fState.Detach()); ObjectDeleter<State> oldState(fState.Detach());
fState.SetTo(state); fState.SetTo(state);
if (fState.Get() != NULL) { if (fState.IsSet()) {
fState->EnterState(oldState.Get()); fState->EnterState(oldState.Get());
fDesktop->SetMouseEventWindow(fWindow); 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 // no state anymore -- reset the mouse event window, if it's still us
if (fDesktop->MouseEventWindow() == fWindow) if (fDesktop->MouseEventWindow() == fWindow)
fDesktop->SetMouseEventWindow(NULL); fDesktop->SetMouseEventWindow(NULL);

View File

@ -101,7 +101,7 @@ AlphaMask::AlphaMask(uint8 backgroundOpacity)
AlphaMask::~AlphaMask() AlphaMask::~AlphaMask()
{ {
if (fPreviousMask.Get() != NULL) if (fPreviousMask.IsSet())
atomic_add(&fPreviousMask->fNextMaskCount, -1); atomic_add(&fPreviousMask->fNextMaskCount, -1);
recursive_lock_destroy(&fLock); recursive_lock_destroy(&fLock);
@ -339,7 +339,7 @@ VectorAlphaMask<VectorMaskType>::_RenderSource(const IntRect& canvasBounds)
// Render the picture to the bitmap // Render the picture to the bitmap
BitmapHWInterface interface(bitmap); BitmapHWInterface interface(bitmap);
ObjectDeleter<DrawingEngine> engine(interface.CreateDrawingEngine()); ObjectDeleter<DrawingEngine> engine(interface.CreateDrawingEngine());
if (engine.Get() == NULL) if (!engine.IsSet())
return NULL; return NULL;
engine->SetRendererOffset(fBounds.left, fBounds.top); engine->SetRendererOffset(fBounds.left, fBounds.top);

View File

@ -20,7 +20,7 @@ status_t
BBitmapBuffer::InitCheck() const BBitmapBuffer::InitCheck() const
{ {
status_t ret = B_NO_INIT; status_t ret = B_NO_INIT;
if (fBitmap.Get() != NULL) if (fBitmap.IsSet())
ret = fBitmap->InitCheck(); ret = fBitmap->InitCheck();
return ret; return ret;
} }

View File

@ -48,7 +48,7 @@ BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight)
} }
SetHWInterface(NULL); SetHWInterface(NULL);
if (fHWInterface.Get() != NULL) { if (fHWInterface.IsSet()) {
fHWInterface->LockExclusiveAccess(); fHWInterface->LockExclusiveAccess();
fHWInterface->Shutdown(); fHWInterface->Shutdown();
fHWInterface->UnlockExclusiveAccess(); fHWInterface->UnlockExclusiveAccess();
@ -60,11 +60,11 @@ BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight)
fBitmap.SetTo(new(std::nothrow) UtilityBitmap(BRect(0, 0, newWidth - 1, fBitmap.SetTo(new(std::nothrow) UtilityBitmap(BRect(0, 0, newWidth - 1,
newHeight - 1), fColorSpace, 0)); newHeight - 1), fColorSpace, 0));
if (fBitmap.Get() == NULL) if (!fBitmap.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
fHWInterface.SetTo(new(std::nothrow) BitmapHWInterface(fBitmap)); fHWInterface.SetTo(new(std::nothrow) BitmapHWInterface(fBitmap));
if (fHWInterface.Get() == NULL) if (!fHWInterface.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
status_t result = fHWInterface->Initialize(); status_t result = fHWInterface->Initialize();

View File

@ -205,8 +205,8 @@ bool
BitmapHWInterface::IsDoubleBuffered() const BitmapHWInterface::IsDoubleBuffered() const
{ {
// overwrite double buffered preference // overwrite double buffered preference
if (fFrontBuffer.Get() != NULL) if (fFrontBuffer.IsSet())
return fBackBuffer.Get() != NULL; return fBackBuffer.IsSet();
return HWInterface::IsDoubleBuffered(); return HWInterface::IsDoubleBuffered();
} }

View File

@ -653,7 +653,7 @@ DWindowHWInterface::SetMode(const display_mode& mode)
status_t ret = B_OK; status_t ret = B_OK;
// prevent from doing the unnecessary // prevent from doing the unnecessary
if (fFrontBuffer.Get() != NULL if (fFrontBuffer.IsSet()
&& fDisplayMode.virtual_width == mode.virtual_width && fDisplayMode.virtual_width == mode.virtual_width
&& fDisplayMode.virtual_height == mode.virtual_height && fDisplayMode.virtual_height == mode.virtual_height
&& fDisplayMode.space == mode.space) && fDisplayMode.space == mode.space)
@ -772,7 +772,7 @@ DWindowHWInterface::GetDeviceInfo(accelerant_device_info* info)
status_t status_t
DWindowHWInterface::GetFrameBufferConfig(frame_buffer_config& config) DWindowHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
{ {
if (fFrontBuffer.Get() == NULL) if (!fFrontBuffer.IsSet())
return B_ERROR; return B_ERROR;
config.frame_buffer = fFrontBuffer->Bits(); config.frame_buffer = fFrontBuffer->Bits();

View File

@ -235,7 +235,7 @@ HWInterface::MoveCursorTo(float x, float y)
// anything if the cursor is hidden // anything if the cursor is hidden
// (invalid cursor frame), but explicitly // (invalid cursor frame), but explicitly
// testing for it here saves us some cycles // 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 // means we have a software cursor which we need to draw
_RestoreCursorArea(); _RestoreCursorArea();
_DrawCursor(_CursorFrame()); _DrawCursor(_CursorFrame());
@ -294,12 +294,12 @@ void
HWInterface::SetAsyncDoubleBuffered(bool doubleBuffered) HWInterface::SetAsyncDoubleBuffered(bool doubleBuffered)
{ {
if (doubleBuffered) { if (doubleBuffered) {
if (fUpdateExecutor.Get() != NULL) if (fUpdateExecutor.IsSet())
return; return;
fUpdateExecutor.SetTo(new (nothrow) UpdateQueue(this)); fUpdateExecutor.SetTo(new (nothrow) UpdateQueue(this));
AddListener(fUpdateExecutor.Get()); AddListener(fUpdateExecutor.Get());
} else { } else {
if (fUpdateExecutor.Get() == NULL) if (!fUpdateExecutor.IsSet())
return; return;
RemoveListener(fUpdateExecutor.Get()); RemoveListener(fUpdateExecutor.Get());
fUpdateExecutor.Unset(); fUpdateExecutor.Unset();
@ -480,7 +480,7 @@ HWInterface::HideFloatingOverlays(const BRect& area)
return false; return false;
if (!fFloatingOverlaysLock.Lock()) if (!fFloatingOverlaysLock.Lock())
return false; return false;
if (fCursorAreaBackup.Get() != NULL && !fCursorAreaBackup->cursor_hidden) { if (fCursorAreaBackup.IsSet() && !fCursorAreaBackup->cursor_hidden) {
BRect backupArea(fCursorAreaBackup->left, fCursorAreaBackup->top, BRect backupArea(fCursorAreaBackup->left, fCursorAreaBackup->top,
fCursorAreaBackup->right, fCursorAreaBackup->bottom); fCursorAreaBackup->right, fCursorAreaBackup->bottom);
if (area.Intersects(backupArea)) { if (area.Intersects(backupArea)) {
@ -510,7 +510,7 @@ HWInterface::HideFloatingOverlays()
void void
HWInterface::ShowFloatingOverlays() HWInterface::ShowFloatingOverlays()
{ {
if (fCursorAreaBackup.Get() != NULL && fCursorAreaBackup->cursor_hidden) if (fCursorAreaBackup.IsSet() && fCursorAreaBackup->cursor_hidden)
_DrawCursor(_CursorFrame()); _DrawCursor(_CursorFrame());
fFloatingOverlaysLock.Unlock(); fFloatingOverlaysLock.Unlock();
@ -588,7 +588,7 @@ HWInterface::_DrawCursor(IntRect area) const
uint8* dst = buffer; uint8* dst = buffer;
if (fCursorAreaBackup.Get() != NULL && fCursorAreaBackup->buffer if (fCursorAreaBackup.IsSet() && fCursorAreaBackup->buffer
&& fFloatingOverlaysLock.Lock()) { && fFloatingOverlaysLock.Lock()) {
fCursorAreaBackup->cursor_hidden = false; fCursorAreaBackup->cursor_hidden = false;
// remember which area the backup contains // remember which area the backup contains
@ -885,7 +885,7 @@ HWInterface::_CursorFrame() const
void void
HWInterface::_RestoreCursorArea() const HWInterface::_RestoreCursorArea() const
{ {
if (fCursorAreaBackup.Get() != NULL && !fCursorAreaBackup->cursor_hidden) { if (fCursorAreaBackup.IsSet() && !fCursorAreaBackup->cursor_hidden) {
_CopyToFront(fCursorAreaBackup->buffer, fCursorAreaBackup->bpr, _CopyToFront(fCursorAreaBackup->buffer, fCursorAreaBackup->bpr,
fCursorAreaBackup->left, fCursorAreaBackup->top, fCursorAreaBackup->left, fCursorAreaBackup->top,
fCursorAreaBackup->right, fCursorAreaBackup->bottom); fCursorAreaBackup->right, fCursorAreaBackup->bottom);

View File

@ -437,7 +437,7 @@ ViewHWInterface::SetMode(const display_mode& mode)
status_t ret = B_OK; status_t ret = B_OK;
// prevent from doing the unnecessary // 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_width == mode.virtual_width
&& fDisplayMode.virtual_height == mode.virtual_height && fDisplayMode.virtual_height == mode.virtual_height
&& fDisplayMode.space == mode.space) && fDisplayMode.space == mode.space)
@ -549,7 +549,7 @@ ViewHWInterface::SetMode(const display_mode& mode)
if (ret >= B_OK) { if (ret >= B_OK) {
// clear out buffers, alpha is 255 this way // clear out buffers, alpha is 255 this way
// TODO: maybe this should handle different color spaces in different ways // 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(fBackBuffer->Bits(), 255, fBackBuffer->BitsLength());
memset(fFrontBuffer->Bits(), 255, fFrontBuffer->BitsLength()); memset(fFrontBuffer->Bits(), 255, fFrontBuffer->BitsLength());
@ -603,7 +603,7 @@ ViewHWInterface::GetDeviceInfo(accelerant_device_info* info)
status_t status_t
ViewHWInterface::GetFrameBufferConfig(frame_buffer_config& config) ViewHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
{ {
if (fFrontBuffer.Get() == NULL) if (!fFrontBuffer.IsSet())
return B_ERROR; return B_ERROR;
config.frame_buffer = fFrontBuffer->Bits(); config.frame_buffer = fFrontBuffer->Bits();
@ -777,8 +777,8 @@ ViewHWInterface::BackBuffer() const
bool bool
ViewHWInterface::IsDoubleBuffered() const ViewHWInterface::IsDoubleBuffered() const
{ {
if (fFrontBuffer.Get() != NULL) if (fFrontBuffer.IsSet())
return fBackBuffer.Get() != NULL; return fBackBuffer.IsSet();
return HWInterface::IsDoubleBuffered(); return HWInterface::IsDoubleBuffered();
} }

View File

@ -564,7 +564,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
// error. // error.
// prevent from doing the unnecessary // 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 // TODO: better comparison of display modes
return B_OK; return B_OK;
} }
@ -574,7 +574,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
if (!_IsValidMode(mode)) if (!_IsValidMode(mode))
return B_BAD_VALUE; return B_BAD_VALUE;
if (fFrontBuffer.Get() == NULL) if (!fFrontBuffer.IsSet())
return B_NO_INIT; return B_NO_INIT;
// just try to set the mode - we let the graphics driver // just try to set the mode - we let the graphics driver
@ -680,11 +680,11 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
fOffscreenBackBuffer = false; fOffscreenBackBuffer = false;
// update backbuffer if neccessary // update backbuffer if neccessary
if (fBackBuffer.Get() == NULL if (!fBackBuffer.IsSet()
|| fBackBuffer->Width() != fFrontBuffer->Width() || fBackBuffer->Width() != fFrontBuffer->Width()
|| fBackBuffer->Height() != fFrontBuffer->Height() || fBackBuffer->Height() != fFrontBuffer->Height()
|| fOffscreenBackBuffer || fOffscreenBackBuffer
|| (fFrontBuffer->ColorSpace() == B_RGB32 && fBackBuffer.Get() != NULL || (fFrontBuffer->ColorSpace() == B_RGB32 && fBackBuffer.IsSet()
&& !HWInterface::IsDoubleBuffered())) { && !HWInterface::IsDoubleBuffered())) {
// NOTE: backbuffer is always B_RGBA32, this simplifies the // NOTE: backbuffer is always B_RGBA32, this simplifies the
// drawing backend implementation tremendously for the time // drawing backend implementation tremendously for the time
@ -713,7 +713,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
fFrontBuffer->Width(), fFrontBuffer->Height())); fFrontBuffer->Width(), fFrontBuffer->Height()));
} }
status = fBackBuffer.Get() != NULL status = fBackBuffer.IsSet()
? fBackBuffer->InitCheck() : B_NO_MEMORY; ? fBackBuffer->InitCheck() : B_NO_MEMORY;
if (status < B_OK) { if (status < B_OK) {
fBackBuffer.Unset(); fBackBuffer.Unset();
@ -1530,7 +1530,7 @@ AccelerantHWInterface::BackBuffer() const
bool bool
AccelerantHWInterface::IsDoubleBuffered() const AccelerantHWInterface::IsDoubleBuffered() const
{ {
return fBackBuffer.Get() != NULL; return fBackBuffer.IsSet();
} }

View File

@ -70,7 +70,7 @@ NetReceiver::_Listen()
while (!fStopThread) { while (!fStopThread) {
fEndpoint.SetTo(fListener->Accept(5000)); fEndpoint.SetTo(fListener->Accept(5000));
if (fEndpoint.Get() == NULL) { if (!fEndpoint.IsSet()) {
TRACE("got NULL endpoint from accept\n"); TRACE("got NULL endpoint from accept\n");
continue; continue;
} }

View File

@ -1107,10 +1107,10 @@ RemoteDrawingEngine::_ExtractBitmapRegions(ServerBitmap& bitmap, uint32 options,
* (int32)(sourceRect.Height() + 1.5))) { * (int32)(sourceRect.Height() + 1.5))) {
// the target bitmap is smaller than the source, scale it locally // the target bitmap is smaller than the source, scale it locally
// and send over the smaller version to avoid sending any extra data // and send over the smaller version to avoid sending any extra data
if (fBitmapDrawingEngine.Get() == NULL) { if (!fBitmapDrawingEngine.IsSet()) {
fBitmapDrawingEngine.SetTo( fBitmapDrawingEngine.SetTo(
new(std::nothrow) BitmapDrawingEngine(B_RGBA32)); new(std::nothrow) BitmapDrawingEngine(B_RGBA32));
if (fBitmapDrawingEngine.Get() == NULL) if (!fBitmapDrawingEngine.IsSet())
result = B_NO_MEMORY; result = B_NO_MEMORY;
} }

View File

@ -67,7 +67,7 @@ RemoteHWInterface::RemoteHWInterface(const char* target)
} }
fListenEndpoint.SetTo(new(std::nothrow) BNetEndpoint()); fListenEndpoint.SetTo(new(std::nothrow) BNetEndpoint());
if (fListenEndpoint.Get() == NULL) { if (!fListenEndpoint.IsSet()) {
fInitStatus = B_NO_MEMORY; fInitStatus = B_NO_MEMORY;
return; return;
} }
@ -77,7 +77,7 @@ RemoteHWInterface::RemoteHWInterface(const char* target)
return; return;
fSendBuffer.SetTo(new(std::nothrow) StreamingRingBuffer(16 * 1024)); fSendBuffer.SetTo(new(std::nothrow) StreamingRingBuffer(16 * 1024));
if (fSendBuffer.Get() == NULL) { if (!fSendBuffer.IsSet()) {
fInitStatus = B_NO_MEMORY; fInitStatus = B_NO_MEMORY;
return; return;
} }
@ -87,7 +87,7 @@ RemoteHWInterface::RemoteHWInterface(const char* target)
return; return;
fReceiveBuffer.SetTo(new(std::nothrow) StreamingRingBuffer(16 * 1024)); fReceiveBuffer.SetTo(new(std::nothrow) StreamingRingBuffer(16 * 1024));
if (fReceiveBuffer.Get() == NULL) { if (!fReceiveBuffer.IsSet()) {
fInitStatus = B_NO_MEMORY; fInitStatus = B_NO_MEMORY;
return; return;
} }
@ -98,13 +98,13 @@ RemoteHWInterface::RemoteHWInterface(const char* target)
fReceiver.SetTo(new(std::nothrow) NetReceiver(fListenEndpoint.Get(), fReceiveBuffer.Get(), fReceiver.SetTo(new(std::nothrow) NetReceiver(fListenEndpoint.Get(), fReceiveBuffer.Get(),
_NewConnectionCallback, this)); _NewConnectionCallback, this));
if (fReceiver.Get() == NULL) { if (!fReceiver.IsSet()) {
fInitStatus = B_NO_MEMORY; fInitStatus = B_NO_MEMORY;
return; return;
} }
fEventStream.SetTo(new(std::nothrow) RemoteEventStream()); fEventStream.SetTo(new(std::nothrow) RemoteEventStream());
if (fEventStream.Get() == NULL) { if (!fEventStream.IsSet()) {
fInitStatus = B_NO_MEMORY; fInitStatus = B_NO_MEMORY;
return; return;
} }
@ -335,7 +335,7 @@ RemoteHWInterface::_NewConnection(BNetEndpoint &endpoint)
return B_NO_MEMORY; return B_NO_MEMORY;
fSender.SetTo(new(std::nothrow) NetSender(sendEndpoint, fSendBuffer.Get())); fSender.SetTo(new(std::nothrow) NetSender(sendEndpoint, fSendBuffer.Get()));
if (fSender.Get() == NULL) { if (!fSender.IsSet()) {
delete sendEndpoint; delete sendEndpoint;
return B_NO_MEMORY; return B_NO_MEMORY;
} }
@ -354,7 +354,7 @@ RemoteHWInterface::_Disconnect()
fIsConnected = false; fIsConnected = false;
} }
if (fListenEndpoint.Get() != NULL) if (fListenEndpoint.IsSet())
fListenEndpoint->Close(); fListenEndpoint->Close();
} }

View File

@ -149,7 +149,7 @@ FontCacheEntry::~FontCacheEntry()
bool bool
FontCacheEntry::Init(const ServerFont& font, bool forceVector) FontCacheEntry::Init(const ServerFont& font, bool forceVector)
{ {
if (fGlyphCache.Get() == NULL) if (!fGlyphCache.IsSet())
return false; return false;
glyph_rendering renderingType = _RenderTypeFor(font, forceVector); glyph_rendering renderingType = _RenderTypeFor(font, forceVector);

View File

@ -469,7 +469,7 @@ FontManager::_SetDefaultFonts()
fDefaultPlainFont.SetTo(new (std::nothrow) ServerFont(*style, fDefaultPlainFont.SetTo(new (std::nothrow) ServerFont(*style,
DEFAULT_PLAIN_FONT_SIZE)); DEFAULT_PLAIN_FONT_SIZE));
if (fDefaultPlainFont.Get() == NULL) if (!fDefaultPlainFont.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
// bold font // bold font
@ -478,7 +478,7 @@ FontManager::_SetDefaultFonts()
fDefaultBoldFont.SetTo(new (std::nothrow) ServerFont(*style, fDefaultBoldFont.SetTo(new (std::nothrow) ServerFont(*style,
DEFAULT_BOLD_FONT_SIZE)); DEFAULT_BOLD_FONT_SIZE));
if (fDefaultBoldFont.Get() == NULL) if (!fDefaultBoldFont.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
// fixed font // fixed font
@ -487,7 +487,7 @@ FontManager::_SetDefaultFonts()
fDefaultFixedFont.SetTo(new (std::nothrow) ServerFont(*style, fDefaultFixedFont.SetTo(new (std::nothrow) ServerFont(*style,
DEFAULT_FIXED_FONT_SIZE)); DEFAULT_FIXED_FONT_SIZE));
if (fDefaultFixedFont.Get() == NULL) if (!fDefaultFixedFont.IsSet())
return B_NO_MEMORY; return B_NO_MEMORY;
fDefaultFixedFont->SetSpacing(B_FIXED_SPACING); fDefaultFixedFont->SetSpacing(B_FIXED_SPACING);

View File

@ -914,7 +914,7 @@ SATGroup::RemoveWindow(SATWindow* window, bool stayBelowMouse)
// We need the area a little bit longer because the area could hold the // We need the area a little bit longer because the area could hold the
// last reference to the group. // last reference to the group.
BReference<WindowArea> area = window->GetWindowArea(); BReference<WindowArea> area = window->GetWindowArea();
if (area.Get() != NULL) if (area.IsSet())
area->_RemoveWindow(window); area->_RemoveWindow(window);
window->RemovedFromGroup(this, stayBelowMouse); window->RemovedFromGroup(this, stayBelowMouse);