From 3a7eb1b4360d0ad99e978ddd1fd1286e6f721926 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 20 Jun 2014 17:25:14 -0400 Subject: [PATCH] Tracker: style fixes to Bitmaps --- src/kits/tracker/Bitmaps.cpp | 27 +++++++++++++++++---------- src/kits/tracker/Bitmaps.h | 7 ++++--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/kits/tracker/Bitmaps.cpp b/src/kits/tracker/Bitmaps.cpp index a1483426cc..5f1b515107 100644 --- a/src/kits/tracker/Bitmaps.cpp +++ b/src/kits/tracker/Bitmaps.cpp @@ -48,6 +48,9 @@ All rights reserved. #endif +// #pragma mark - BImageResources + + BImageResources::BImageResources(void* memAddr) { image_id image = find_image(memAddr); @@ -99,6 +102,7 @@ BImageResources::FinishResources(BResources* res) const return B_BAD_VALUE; fLock.Unlock(); + return B_OK; } @@ -238,21 +242,21 @@ BImageResources::GetBitmapResource(type_code type, int32 id, // Try to read as an archived bitmap. stream.Seek(0, SEEK_SET); BMessage archive; - status_t err = archive.Unflatten(&stream); - if (err != B_OK) - return err; + status_t result = archive.Unflatten(&stream); + if (result != B_OK) + return result; *out = new BBitmap(&archive); - if (!*out) + if (*out == NULL) return B_ERROR; - err = (*out)->InitCheck(); - if (err != B_OK) { + result = (*out)->InitCheck(); + if (result != B_OK) { delete *out; *out = NULL; } - return err; + return result; } @@ -263,7 +267,10 @@ static BImageResources* resources = NULL; // global object when the image is getting unloaded. class _TTrackerCleanupResources { public: - _TTrackerCleanupResources() { } + _TTrackerCleanupResources() + { + } + ~_TTrackerCleanupResources() { delete resources; @@ -276,14 +283,14 @@ namespace BPrivate { static _TTrackerCleanupResources CleanupResources; - BImageResources* GetTrackerResources() { if (!resources) { BAutolock lock(&resLock); resources = new BImageResources(&resources); } + return resources; } -} +} // namespace BPrivate diff --git a/src/kits/tracker/Bitmaps.h b/src/kits/tracker/Bitmaps.h index b32698ca0e..0c1adb95a8 100644 --- a/src/kits/tracker/Bitmaps.h +++ b/src/kits/tracker/Bitmaps.h @@ -31,8 +31,8 @@ of Be Incorporated in the United States and other countries. Other brand product names are registered trademarks or trademarks of their respective holders. All rights reserved. */ -#ifndef __BITS__ -#define __BITS__ +#ifndef _TRACKER_BITMAPS_H +#define _TRACKER_BITMAPS_H #include @@ -104,4 +104,5 @@ BImageResources* GetTrackerResources(); using namespace BPrivate; -#endif // __BITS__ + +#endif // _TRACKER_BITMAPS_H