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,
AttributeCookie*& _cookie)
{
if (fPackage.Get() == NULL)
if (!fPackage.IsSet())
return B_ENTRY_NOT_FOUND;
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,
socket->family, socket->type, socket->protocol, socket->owner,
socket->first_protocol, socket->first_info, parent.Get(),
parent.Get() != NULL ? socket->is_connected ? " (c)" : " (p)" : "");
parent.IsSet() ? socket->is_connected ? " (c)" : " (p)" : "");
}
@ -836,7 +836,7 @@ socket_connected(net_socket* _socket)
}
BReference<net_socket_private> parent = socket->parent.GetReference();
if (parent.Get() == NULL)
if (!parent.IsSet())
return B_BAD_VALUE;
MutexLocker _(parent->lock);
@ -864,7 +864,7 @@ socket_aborted(net_socket* _socket)
TRACE("socket_aborted(%p)\n", socket);
BReference<net_socket_private> parent = socket->parent.GetReference();
if (parent.Get() == NULL)
if (!parent.IsSet())
return B_BAD_VALUE;
MutexLocker _(parent->lock);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1120,7 +1120,7 @@ ServerPicture::ServerPicture(const char* fileName, int32 offset)
fToken = gTokenSpace.NewToken(kPictureToken, this);
fFile.SetTo(new(std::nothrow) BFile(fileName, B_READ_WRITE));
if (fFile.Get() == NULL)
if (!fFile.IsSet())
return;
BPrivate::Storage::OffsetFile* offsetFile
@ -1142,7 +1142,7 @@ ServerPicture::~ServerPicture()
gTokenSpace.RemoveToken(fToken);
if (fPictures.Get() != NULL) {
if (fPictures.IsSet()) {
for (int32 i = fPictures->CountItems(); i-- > 0;) {
ServerPicture* picture = fPictures->ItemAt(i);
picture->SetOwner(NULL);
@ -1314,10 +1314,10 @@ ServerPicture::AppendPicture(ServerPicture* picture)
bool
ServerPicture::NestPicture(ServerPicture* picture)
{
if (fPictures.Get() == NULL)
if (!fPictures.IsSet())
fPictures.SetTo(new(std::nothrow) PictureList);
if (fPictures.Get() == NULL || !fPictures->AddItem(picture))
if (!fPictures.IsSet() || !fPictures->AddItem(picture))
return false;
picture->AcquireReference();
@ -1328,7 +1328,7 @@ ServerPicture::NestPicture(ServerPicture* picture)
off_t
ServerPicture::DataLength() const
{
if (fData.Get() == NULL)
if (!fData.IsSet())
return 0;
off_t size;
fData->GetSize(&size);
@ -1369,7 +1369,7 @@ ServerPicture::ExportData(BPrivate::PortLink& link)
fData->Seek(0, SEEK_SET);
int32 subPicturesCount = 0;
if (fPictures.Get() != NULL)
if (fPictures.IsSet())
subPicturesCount = fPictures->CountItems();
link.Attach<int32>(subPicturesCount);
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
// is a virtual function!
fWindow.SetTo(MakeWindow(frame, fTitle, look, feel, flags, workspace));
if (fWindow.Get() == NULL || fWindow->InitCheck() != B_OK) {
if (!fWindow.IsSet() || fWindow->InitCheck() != B_OK) {
fWindow.Unset();
return B_NO_MEMORY;
}
@ -349,7 +349,7 @@ ServerWindow::_Show()
// instead of doing it from this thread.
fDesktop->UnlockSingleWindow();
fDesktop->ShowWindow(fWindow.Get());
if (fDirectWindowInfo.Get() != NULL && fDirectWindowInfo->IsFullScreen())
if (fDirectWindowInfo.IsSet() && fDirectWindowInfo->IsFullScreen())
_ResizeToFullScreen();
fDesktop->LockSingleWindow();
@ -408,7 +408,7 @@ ServerWindow::SetTitle(const char* newTitle)
rename_thread(Thread(), name);
}
if (fWindow.Get() != NULL)
if (fWindow.IsSet())
fDesktop->SetWindowTitle(fWindow.Get(), newTitle);
}
@ -972,7 +972,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
Title()));
int32 size;
if (fWindow.Get() != NULL && link.Read<int32>(&size) == B_OK) {
if (fWindow.IsSet() && link.Read<int32>(&size) == B_OK) {
char buffer[size];
if (link.Read(buffer, size) == B_OK) {
BMessage settings;
@ -1096,7 +1096,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
link.Read<bool>(&enable);
status_t status = B_OK;
if (fDirectWindowInfo.Get() != NULL)
if (fDirectWindowInfo.IsSet())
_DirectWindowSetFullScreen(enable);
else
status = B_BAD_TYPE;
@ -3650,7 +3650,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver& link)
ArrayDeleter<uint32> opList(new(std::nothrow) uint32[opCount]);
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(ptList.Get(), ptCount * sizeof(BPoint)) != B_OK)
break;
@ -4289,7 +4289,7 @@ ServerWindow::ScreenChanged(const BMessage* message)
{
SendMessageToClient(message);
if (fDirectWindowInfo.Get() != NULL && fDirectWindowInfo->IsFullScreen())
if (fDirectWindowInfo.IsSet() && fDirectWindowInfo->IsFullScreen())
_ResizeToFullScreen();
}
@ -4323,7 +4323,7 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState)
{
ASSERT_MULTI_LOCKED(fDesktop->WindowLocker());
if (fDirectWindowInfo.Get() == NULL)
if (!fDirectWindowInfo.IsSet())
return;
STRACE(("HandleDirectConnection(bufferState = %" B_PRId32 ", driverState = "
@ -4475,7 +4475,7 @@ ServerWindow::_ResizeToFullScreen()
status_t
ServerWindow::_EnableDirectWindowMode()
{
if (fDirectWindowInfo.Get() != NULL) {
if (fDirectWindowInfo.IsSet()) {
// already in direct window mode
return B_ERROR;
}
@ -4486,7 +4486,7 @@ ServerWindow::_EnableDirectWindowMode()
}
fDirectWindowInfo.SetTo(new(std::nothrow) DirectWindowInfo);
if (fDirectWindowInfo.Get() == NULL)
if (!fDirectWindowInfo.IsSet())
return B_NO_MEMORY;
status_t status = fDirectWindowInfo->InitCheck();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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
// last reference to the group.
BReference<WindowArea> area = window->GetWindowArea();
if (area.Get() != NULL)
if (area.IsSet())
area->_RemoveWindow(window);
window->RemovedFromGroup(this, stayBelowMouse);