From 8708474567be756984f35cd6c5bfcc2c9546dc1e Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 7 Apr 2015 20:50:57 +0200 Subject: [PATCH] HaikuDepot: Clean up trailing whitespace. --- src/apps/haikudepot/List.h | 2 +- src/apps/haikudepot/model/Model.cpp | 44 +++++++++---------- src/apps/haikudepot/model/PackageInfo.cpp | 6 +-- src/apps/haikudepot/model/PackageInfo.h | 2 +- src/apps/haikudepot/model/WebAppInterface.cpp | 40 ++++++++--------- .../haikudepot/textview/CharacterStyleData.h | 2 +- src/apps/haikudepot/textview/Paragraph.cpp | 8 ++-- .../haikudepot/textview/ParagraphLayout.cpp | 4 +- src/apps/haikudepot/textview/TextDocument.cpp | 26 +++++------ .../textview/TextDocumentLayout.cpp | 18 ++++---- .../haikudepot/textview/TextDocumentView.cpp | 20 ++++----- src/apps/haikudepot/textview/TextEditor.cpp | 12 ++--- src/apps/haikudepot/ui/App.cpp | 10 ++--- .../haikudepot/ui/FeaturedPackagesView.cpp | 16 +++---- src/apps/haikudepot/ui/FeaturedPackagesView.h | 2 +- src/apps/haikudepot/ui/FilterView.cpp | 6 +-- src/apps/haikudepot/ui/MainWindow.cpp | 18 ++++---- .../haikudepot/ui/MessagePackageListener.cpp | 2 +- .../haikudepot/ui/PackageContentsView.cpp | 16 +++---- src/apps/haikudepot/ui/PackageInfoView.cpp | 22 +++++----- src/apps/haikudepot/ui/RatePackageWindow.cpp | 28 ++++++------ src/apps/haikudepot/ui/ScreenshotWindow.cpp | 8 ++-- src/apps/haikudepot/ui/UserLoginWindow.cpp | 38 ++++++++-------- src/apps/haikudepot/ui_generic/LinkView.cpp | 2 +- .../ui_generic/ScrollableGroupView.cpp | 4 +- .../haikudepot/ui_generic/SharedBitmap.cpp | 8 ++-- 26 files changed, 182 insertions(+), 182 deletions(-) diff --git a/src/apps/haikudepot/List.h b/src/apps/haikudepot/List.h index bf31048b9f..a8d282951d 100644 --- a/src/apps/haikudepot/List.h +++ b/src/apps/haikudepot/List.h @@ -99,7 +99,7 @@ public: { _Resize(0); } - + inline bool IsEmpty() const { return fCount == 0; diff --git a/src/apps/haikudepot/model/Model.cpp b/src/apps/haikudepot/model/Model.cpp index 74b0f4551a..5ad94c68a0 100644 --- a/src/apps/haikudepot/model/Model.cpp +++ b/src/apps/haikudepot/model/Model.cpp @@ -660,13 +660,13 @@ Model::PopulatePackage(const PackageInfoRef& package, uint32 flags) BMessage info; BString packageName; - BString architecture; + BString architecture; { BAutolock locker(&fLock); packageName = package->Name(); architecture = package->Architecture(); } - + status_t status = fWebAppInterface.RetrieveUserRatings(packageName, architecture, 0, 50, info); if (status == B_OK) { @@ -683,7 +683,7 @@ Model::PopulatePackage(const PackageInfoRef& package, uint32 flags) while (true) { BString name; name << index++; - + BMessage item; if (items.FindMessage(name, &item) != B_OK) break; @@ -831,7 +831,7 @@ Model::_UpdateIsFeaturedFilter() { if (fShowFeaturedPackages && SearchTerms().IsEmpty()) fIsFeaturedFilter = PackageFilterRef(new IsFeaturedFilter(), true); - else + else fIsFeaturedFilter = PackageFilterRef(new AnyFilter(), true); } @@ -860,7 +860,7 @@ Model::_PopulateAllPackagesThread(bool fromCacheOnly) PackageInfoRef package; { BAutolock locker(&fLock); - + if (depotIndex >= fDepots.CountItems()) break; const DepotInfo& depot = fDepots.ItemAt(depotIndex); @@ -872,14 +872,14 @@ Model::_PopulateAllPackagesThread(bool fromCacheOnly) depotIndex++; continue; } - + package = packages.ItemAt(packageIndex); packageIndex++; } - + if (package.Get() == NULL) continue; - + //_PopulatePackageInfo(package, fromCacheOnly); bulkPackageList.Add(package); if (bulkPackageList.CountItems() == 50) { @@ -954,7 +954,7 @@ Model::_PopulatePackageInfos(PackageList& packages, bool fromCacheOnly, { if (fStopPopulatingAllPackages) return; - + // See if there are cached info files for (int i = packages.CountItems() - 1; i >= 0; i--) { if (fStopPopulatingAllPackages) @@ -978,10 +978,10 @@ Model::_PopulatePackageInfos(PackageList& packages, bool fromCacheOnly, } } } - + if (fromCacheOnly || packages.IsEmpty()) return; - + // Retrieve info from web-app BMessage info; @@ -1011,11 +1011,11 @@ Model::_PopulatePackageInfos(PackageList& packages, bool fromCacheOnly, BMessage pkgInfo; if (pkgs.FindMessage(name, &pkgInfo) != B_OK) break; - + BString pkgName; if (pkgInfo.FindString("name", &pkgName) != B_OK) continue; - + // Find the PackageInfoRef bool found = false; for (int i = 0; i < packages.CountItems(); i++) { @@ -1082,7 +1082,7 @@ Model::_PopulatePackageInfo(const PackageInfoRef& package, bool fromCacheOnly) { if (fromCacheOnly) return; - + // Retrieve info from web-app BMessage info; @@ -1104,7 +1104,7 @@ append_word_list(BString& words, const char* word) if (words.Length() > 0) words << ", "; words << word; -} +} void @@ -1173,7 +1173,7 @@ Model::_PopulatePackageInfo(const PackageInfoRef& package, const BMessage& data) if (foundCategory) append_word_list(foundInfo, "categories"); } - + double derivedRating; if (data.FindDouble("derivedRating", &derivedRating) == B_OK) { RatingSummary summary; @@ -1182,14 +1182,14 @@ Model::_PopulatePackageInfo(const PackageInfoRef& package, const BMessage& data) append_word_list(foundInfo, "rating"); } - + double prominenceOrdering; if (data.FindDouble("prominenceOrdering", &prominenceOrdering) == B_OK) { package->SetProminence(prominenceOrdering); append_word_list(foundInfo, "prominence"); } - + BMessage screenshots; if (data.FindMessage("pkgScreenshots", &screenshots) == B_OK) { package->ClearScreenshotInfos(); @@ -1198,7 +1198,7 @@ Model::_PopulatePackageInfo(const PackageInfoRef& package, const BMessage& data) while (true) { BString name; name << index++; - + BMessage screenshot; if (screenshots.FindMessage(name, &screenshot) != B_OK) break; @@ -1219,7 +1219,7 @@ Model::_PopulatePackageInfo(const PackageInfoRef& package, const BMessage& data) if (foundScreenshot) append_word_list(foundInfo, "screenshots"); } - + if (foundInfo.Length() > 0) { printf("Populated package info for %s: %s\n", package->Name().String(), foundInfo.String()); @@ -1346,11 +1346,11 @@ Model::_HasNativeIcon(const BMessage& message) const while (true) { BString name; name << index++; - + BMessage typeCodeInfo; if (pkgIcons.FindMessage(name, &typeCodeInfo) != B_OK) break; - + BString mediaTypeCode; if (typeCodeInfo.FindString("mediaTypeCode", &mediaTypeCode) == B_OK && mediaTypeCode == "application/x-vnd.haiku-icon") { diff --git a/src/apps/haikudepot/model/PackageInfo.cpp b/src/apps/haikudepot/model/PackageInfo.cpp index a6281567a7..e976b3c81d 100644 --- a/src/apps/haikudepot/model/PackageInfo.cpp +++ b/src/apps/haikudepot/model/PackageInfo.cpp @@ -196,7 +196,7 @@ RatingSummary::operator==(const RatingSummary& other) const if (ratingCountByStar[i] != other.ratingCountByStar[i]) return false; } - + return true; } @@ -818,7 +818,7 @@ PackageInfo::CalculateRatingSummary() const { if (fUserRatings.CountItems() == 0) return fCachedRatingSummary; - + RatingSummary summary; summary.ratingCount = fUserRatings.CountItems(); summary.averageRating = 0.0f; @@ -1037,7 +1037,7 @@ void DepotInfo::SyncPackages(const PackageList& otherPackages) { PackageList packages(fPackages); - + for (int32 i = otherPackages.CountItems() - 1; i >= 0; i--) { const PackageInfoRef& otherPackage = otherPackages.ItemAtFast(i); bool found = false; diff --git a/src/apps/haikudepot/model/PackageInfo.h b/src/apps/haikudepot/model/PackageInfo.h index 40de3f2e7c..61480faf53 100644 --- a/src/apps/haikudepot/model/PackageInfo.h +++ b/src/apps/haikudepot/model/PackageInfo.h @@ -306,7 +306,7 @@ public: bool IsLocalFile() const; const BString& FileName() const { return fFileName; } - + void ClearCategories(); bool AddCategory(const CategoryRef& category); const CategoryList& Categories() const diff --git a/src/apps/haikudepot/model/WebAppInterface.cpp b/src/apps/haikudepot/model/WebAppInterface.cpp index ddb2b1beb6..22a0a43db3 100644 --- a/src/apps/haikudepot/model/WebAppInterface.cpp +++ b/src/apps/haikudepot/model/WebAppInterface.cpp @@ -187,24 +187,24 @@ public: { // printf("ConnectionOpened(%p)\n", caller); } - + virtual void HostnameResolved(BUrlRequest* caller, const char* ip) { // printf("HostnameResolved(%p): %s\n", caller, ip); } - + virtual void ResponseStarted(BUrlRequest* caller) { if (fDebug) printf("ResponseStarted(%p)\n", caller); } - + virtual void HeadersReceived(BUrlRequest* caller) { if (fDebug) printf("HeadersReceived(%p)\n", caller); } - + virtual void DataReceived(BUrlRequest* caller, const char* data, off_t position, ssize_t size) { @@ -216,27 +216,27 @@ public: if (fDownloadIO != NULL) fDownloadIO->Write(data, size); } - + virtual void DownloadProgress(BUrlRequest* caller, ssize_t bytesReceived, ssize_t bytesTotal) { // printf("DownloadProgress(%p): %ld/%ld\n", caller, bytesReceived, // bytesTotal); } - + virtual void UploadProgress(BUrlRequest* caller, ssize_t bytesSent, ssize_t bytesTotal) { if (fDebug) printf("UploadProgress(%p): %ld/%ld\n", caller, bytesSent, bytesTotal); } - + virtual void RequestCompleted(BUrlRequest* caller, bool success) { if (fDebug) printf("RequestCompleted(%p): %d\n", caller, success); } - + virtual void DebugMessage(BUrlRequest* caller, BUrlProtocolDebugMessage type, const char* text) { @@ -295,11 +295,11 @@ WebAppInterface::operator=(const WebAppInterface& other) { if (this == &other) return *this; - + fUsername = other.fUsername; fPassword = other.fPassword; fLanguage = other.fLanguage; - + return *this; } @@ -380,12 +380,12 @@ WebAppInterface::RetrievePackageIcon(const BString& packageName, { BString urlString = "https://depot.haiku-os.org/pkgicon/"; urlString << packageName << ".hvif"; - + BUrl url(urlString); - + ProtocolListener listener; listener.SetDownloadIO(stream); - + BHttpRequest request(url, true, "HTTP", &listener); request.SetMethod(B_HTTP_GET); @@ -396,7 +396,7 @@ WebAppInterface::RetrievePackageIcon(const BString& packageName, request.Result()); int32 statusCode = result.StatusCode(); - + if (statusCode == 200) return B_OK; @@ -523,15 +523,15 @@ WebAppInterface::RetrieveScreenshot(const BString& code, BString urlString = "https://depot.haiku-os.org/pkgscreenshot/"; urlString << code << ".png" << "?tw=" << width << "&th=" << height; - + BUrl url(urlString); - + ProtocolListener listener; listener.SetDownloadIO(stream); - BHttpHeaders headers; + BHttpHeaders headers; headers.AddHeader("User-Agent", "X-HDS-Client"); - + BHttpRequest request(url, true, "HTTP", &listener); request.SetMethod(B_HTTP_GET); request.SetHeaders(headers); @@ -543,7 +543,7 @@ WebAppInterface::RetrieveScreenshot(const BString& code, request.Result()); int32 statusCode = result.StatusCode(); - + if (statusCode == 200) return B_OK; @@ -588,7 +588,7 @@ WebAppInterface::CreateUser(const BString& nickName, if (!email.IsEmpty()) builder.AddValue("email", email); - + builder.AddValue("captchaToken", captchaToken) .AddValue("captchaResponse", captchaResponse) .AddValue("naturalLanguageCode", languageCode) diff --git a/src/apps/haikudepot/textview/CharacterStyleData.h b/src/apps/haikudepot/textview/CharacterStyleData.h index 14c47befbd..ad58241fe9 100644 --- a/src/apps/haikudepot/textview/CharacterStyleData.h +++ b/src/apps/haikudepot/textview/CharacterStyleData.h @@ -49,7 +49,7 @@ public: { return fFont; } CharacterStyleDataRef SetAscent(float ascent); - + // Returns the ascent of the configured font, unless the ascent // has been overridden by a fixed value with SetAscent(). float Ascent() const; diff --git a/src/apps/haikudepot/textview/Paragraph.cpp b/src/apps/haikudepot/textview/Paragraph.cpp index 377bca9601..907394ddd2 100644 --- a/src/apps/haikudepot/textview/Paragraph.cpp +++ b/src/apps/haikudepot/textview/Paragraph.cpp @@ -286,12 +286,12 @@ Paragraph::SubParagraph(int32 start, int32 length) const { if (start < 0) start = 0; - + if (start == 0 && length == Length()) return *this; - + Paragraph result(fStyle); - + int32 count = fTextSpans.CountItems(); for (int32 i = 0; i < count; i++) { const TextSpan& span = fTextSpans.ItemAtFast(i); @@ -312,7 +312,7 @@ Paragraph::SubParagraph(int32 start, int32 length) const result.Append(span); else result.Append(span.SubSpan(start, copyLength)); - + length -= copyLength; if (length == 0) break; diff --git a/src/apps/haikudepot/textview/ParagraphLayout.cpp b/src/apps/haikudepot/textview/ParagraphLayout.cpp index eebc22fa01..864bd16526 100644 --- a/src/apps/haikudepot/textview/ParagraphLayout.cpp +++ b/src/apps/haikudepot/textview/ParagraphLayout.cpp @@ -301,7 +301,7 @@ ParagraphLayout::LineIndexForOffset(int32 textOffset) if (textOffset < 0) textOffset = 0; - + const GlyphInfo& glyph = fGlyphInfos.ItemAtFast(textOffset); return glyph.lineIndex; } @@ -396,7 +396,7 @@ ParagraphLayout::GetTextBounds(int32 textOffset, float& x1, float& y1, if (textOffset < 0) textOffset = 0; - + const GlyphInfo& glyph = fGlyphInfos.ItemAtFast(textOffset); const LineInfo& line = fLineInfos.ItemAt(glyph.lineIndex); diff --git a/src/apps/haikudepot/textview/TextDocument.cpp b/src/apps/haikudepot/textview/TextDocument.cpp index e222d99384..3e2f1159a7 100644 --- a/src/apps/haikudepot/textview/TextDocument.cpp +++ b/src/apps/haikudepot/textview/TextDocument.cpp @@ -133,7 +133,7 @@ TextDocument::Insert(int32 textOffset, const BString& text, chunkEnd++; else chunkEnd = length; - + BString chunk; text.CopyCharsInto(chunk, chunkStart, chunkEnd - chunkStart); TextSpan span(chunk, characterStyle); @@ -171,7 +171,7 @@ TextDocument::Insert(int32 textOffset, const BString& text, if (!fParagraphs.Replace(index, paragraph)) return B_NO_MEMORY; } - + return B_OK; } @@ -214,7 +214,7 @@ TextDocument::Remove(int32 textOffset, int32 length) && index + 1 < fParagraphs.CountItems()) { // Line break between paragraphs got removed. Shift the next // paragraph's text spans into the resulting one. - + const TextSpanList& textSpans = ParagraphAt(index + 1).TextSpans(); int32 spanCount = textSpans.CountItems(); for (int32 i = 0; i < spanCount; i++) { @@ -225,7 +225,7 @@ TextDocument::Remove(int32 textOffset, int32 length) } textOffset = 0; - + while (length > 0 && index + 1 < fParagraphs.CountItems()) { const Paragraph& paragraph = ParagraphAt(index + 1); paragraphLength = paragraph.Length(); @@ -251,7 +251,7 @@ TextDocument::Remove(int32 textOffset, int32 length) const TextSpan& span = textSpans.ItemAtFast(i); resultParagraph.Append(span); } - + break; } } @@ -288,7 +288,7 @@ TextDocument::Replace(int32 textOffset, int32 length, const BString& text, status_t ret = Remove(textOffset, length); if (ret != B_OK) return ret; - + return Insert(textOffset, text, characterStyle, paragraphStyle); } @@ -405,9 +405,9 @@ TextDocument::Text(int32 start, int32 length) const { if (start < 0) start = 0; - + BString text; - + int32 count = fParagraphs.CountItems(); for (int32 i = 0; i < count; i++) { const Paragraph& paragraph = fParagraphs.ItemAtFast(i); @@ -423,9 +423,9 @@ TextDocument::Text(int32 start, int32 length) const // Remaining paragraph length after start paragraphLength -= start; int32 copyLength = std::min(paragraphLength, length); - + text << paragraph.Text(start, copyLength); - + length -= copyLength; if (length == 0) break; @@ -443,10 +443,10 @@ TextDocument::SubDocument(int32 start, int32 length) const { TextDocumentRef result(new(std::nothrow) TextDocument( fDefaultCharacterStyle, fEmptyLastParagraph.Style()), true); - + if (result.Get() == NULL) return result; - + if (start < 0) start = 0; @@ -465,7 +465,7 @@ TextDocument::SubDocument(int32 start, int32 length) const // Remaining paragraph length after start paragraphLength -= start; int32 copyLength = std::min(paragraphLength, length); - + result->Append(paragraph.SubParagraph(start, copyLength)); length -= copyLength; diff --git a/src/apps/haikudepot/textview/TextDocumentLayout.cpp b/src/apps/haikudepot/textview/TextDocumentLayout.cpp index 1e1b8d6d80..6ed09b4e97 100644 --- a/src/apps/haikudepot/textview/TextDocumentLayout.cpp +++ b/src/apps/haikudepot/textview/TextDocumentLayout.cpp @@ -97,7 +97,7 @@ TextDocumentLayout::InvalidateParagraphs(int32 start, int32 count) start); info.layout->SetParagraph(paragraph); } - + start++; count--; } @@ -161,11 +161,11 @@ TextDocumentLayout::LineIndexForOffset(int32 textOffset) for (int32 i = 0; i < index; i++) { lineIndex += fParagraphLayouts.ItemAtFast(i).layout->CountLines(); } - + const ParagraphLayoutInfo& info = fParagraphLayouts.ItemAtFast(index); return lineIndex + info.layout->LineIndexForOffset(textOffset); } - + return 0; } @@ -275,7 +275,7 @@ TextDocumentLayout::TextOffsetAt(float x, float y, bool& rightOfCenter) textOffset += info.layout->TextOffsetAt(x, y - info.y, rightOfCenter); break; } - + return textOffset; } @@ -342,16 +342,16 @@ TextDocumentLayout::_ParagraphLayoutIndexForOffset(int32& textOffset) int32 paragraphs = fParagraphLayouts.CountItems(); for (int32 i = 0; i < paragraphs - 1; i++) { const ParagraphLayoutInfo& info = fParagraphLayouts.ItemAtFast(i); - + int32 length = info.layout->CountGlyphs(); if (textOffset >= length) { textOffset -= length; continue; } - + return i; } - + if (paragraphs > 0) { const ParagraphLayoutInfo& info = fParagraphLayouts.LastItem(); @@ -361,7 +361,7 @@ TextDocumentLayout::_ParagraphLayoutIndexForOffset(int32& textOffset) if (textOffset <= length) return paragraphs - 1; } - + return -1; } @@ -382,7 +382,7 @@ TextDocumentLayout::_ParagraphLayoutIndexForLineIndex(int32& lineIndex, paragraphOffset += info.layout->CountGlyphs(); continue; } - + return i; } diff --git a/src/apps/haikudepot/textview/TextDocumentView.cpp b/src/apps/haikudepot/textview/TextDocumentView.cpp index cfd3898bab..bd8fe7b1e1 100644 --- a/src/apps/haikudepot/textview/TextDocumentView.cpp +++ b/src/apps/haikudepot/textview/TextDocumentView.cpp @@ -30,7 +30,7 @@ TextDocumentView::TextDocumentView(const char* name) fMouseDown(false) { fTextDocumentLayout.SetWidth(_TextLayoutWidth(Bounds().Width())); - + // Set default TextEditor SetTextEditor(TextEditorRef(new(std::nothrow) TextEditor(), true)); @@ -142,10 +142,10 @@ TextDocumentView::MouseDown(BPoint where) int32 modifiers = 0; if (Window() != NULL && Window()->CurrentMessage() != NULL) Window()->CurrentMessage()->FindInt32("modifiers", &modifiers); - + fMouseDown = true; SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); - + bool extendSelection = (modifiers & B_SHIFT_KEY) != 0; SetCaret(where, extendSelection); } @@ -184,7 +184,7 @@ TextDocumentView::KeyDown(const char* bytes, int32 numBytes) event.length = numBytes; event.key = 0; event.modifiers = modifiers(); - + if (Window() != NULL && Window()->CurrentMessage() != NULL) { BMessage* message = Window()->CurrentMessage(); message->FindInt32("raw_char", &event.key); @@ -391,10 +391,10 @@ TextDocumentView::Copy(BClipboard* clipboard) // Nothing to copy, don't clear clipboard contents for now reason. return; } - + if (clipboard == NULL || !clipboard->Lock()) return; - + clipboard->Clear(); BMessage* clip = clipboard->Data(); @@ -402,13 +402,13 @@ TextDocumentView::Copy(BClipboard* clipboard) int32 start; int32 end; GetSelection(start, end); - + BString text = fTextDocument->Text(start, end - start); clip->AddData("text/plain", B_MIME_TYPE, text.String(), text.Length()); - + // TODO: Support for "application/x-vnd.Be-text_run_array" - + clipboard->Commit(); } @@ -585,7 +585,7 @@ TextDocumentView::_GetSelectionShape(BShape& shape, int32 start, int32 end) } else { // Selection over multiple lines float width = ceilf(fTextDocumentLayout.Width()); - + shape.MoveTo(BPoint(startX1, startY1)); shape.LineTo(BPoint(width, startY1)); shape.LineTo(BPoint(width, endY1)); diff --git a/src/apps/haikudepot/textview/TextEditor.cpp b/src/apps/haikudepot/textview/TextEditor.cpp index 865db3edf7..fd57c7ec89 100644 --- a/src/apps/haikudepot/textview/TextEditor.cpp +++ b/src/apps/haikudepot/textview/TextEditor.cpp @@ -239,11 +239,11 @@ TextEditor::KeyDown(KeyEvent event) if (event.bytes != NULL && event.length > 0) { // Handle null-termintating the string BString text(event.bytes, event.length); - + // Remove selection, if any if (HasSelection()) Remove(SelectionStart(), SelectionLength()); - + Insert(fSelection.Caret(), text); } break; @@ -262,9 +262,9 @@ TextEditor::Insert(int32 offset, const BString& string) if (ret == B_OK) { // TODO: Via listener, and only affected paragraphs fLayout->Invalidate(); - + _SetCaretOffset(offset + string.CountChars(), true, false, true); - + fDocument->PrintToStream(); } @@ -283,7 +283,7 @@ TextEditor::Remove(int32 offset, int32 length) if (ret == B_OK) { // TODO: Via listener, and only affected paragraphs fLayout->Invalidate(); - + _SetCaretOffset(offset, true, false, true); fDocument->PrintToStream(); @@ -437,7 +437,7 @@ TextEditor::_SetSelection(int32 caret, int32 anchor, bool updateAnchor, { if (fLayout.Get() == NULL) return; - + if (caret == fSelection.Caret() && anchor == fSelection.Anchor()) return; diff --git a/src/apps/haikudepot/ui/App.cpp b/src/apps/haikudepot/ui/App.cpp index b520fec65e..cce042d586 100644 --- a/src/apps/haikudepot/ui/App.cpp +++ b/src/apps/haikudepot/ui/App.cpp @@ -69,10 +69,10 @@ App::ReadyToRun() { if (fWindowCount > 0) return; - + BMessage settings; _LoadSettings(settings); - + fMainWindow = new MainWindow(_GetNextWindowFrame(false), settings); _ShowWindow(fMainWindow); } @@ -152,7 +152,7 @@ App::_Open(const BEntry& entry) fprintf(stderr, "Could not allocate PackageInfo\n"); return; } - + package->SetLocalFilePath(path.Path()); BMessage settings; @@ -258,7 +258,7 @@ App::_CheckPackageDaemonRuns() if (!_LaunchPackageDaemon()) break; - } + } } @@ -270,7 +270,7 @@ App::_LaunchPackageDaemon() BString errorMessage = B_TRANSLATE("Starting the package daemon failed:\n\n%Error%"); errorMessage.ReplaceAll("%Error%", strerror(ret)); - + BAlert* alert = new BAlert("package_daemon_problem", errorMessage, B_TRANSLATE("Quit HaikuDepot"), diff --git a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp index 3b59cbc3c7..80904ecb91 100644 --- a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp +++ b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp @@ -46,7 +46,7 @@ public: { SetViewColor(255, 255, 255); SetEventMask(B_POINTER_EVENTS); - + fIconView = new BitmapView("package icon view"); fInstalledIconView = new BitmapView("installed icon view"); fTitleView = new BStringView("package title view", ""); @@ -131,14 +131,14 @@ public: break; } } - + virtual void MouseDown(BPoint where) { BRect bounds = Bounds(); BRect parentBounds = Parent()->Bounds(); ConvertFromParent(&parentBounds); bounds = bounds & parentBounds; - + if (bounds.Contains(where) && Window()->IsActive()) { BMessage message(MSG_PACKAGE_SELECTED); message.AddString("name", PackageName()); @@ -227,13 +227,13 @@ public: if (fSelected == selected) return; fSelected = selected; - + rgb_color bgColor; if (fSelected) bgColor = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR); else bgColor = (rgb_color){ 255, 255, 255, 255 }; - + List views; views.Add(this); @@ -245,10 +245,10 @@ public: views.Add(fRatingView); views.Add(fAvgRating); views.Add(fVoteInfo); - + for (int32 i = 0; i < views.CountItems(); i++) { BView* view = views.ItemAtFast(i); - + view->SetViewColor(bgColor); view->SetLowColor(bgColor); view->Invalidate(); @@ -376,7 +376,7 @@ FeaturedPackagesView::SelectPackage(const PackageInfoRef& package) BString selectedName; if (package.Get() != NULL) selectedName = package->Name(); - + for (int32 i = 0; BLayoutItem* item = fPackageListLayout->ItemAt(i); i++) { PackageView* view = dynamic_cast(item->View()); if (view == NULL) diff --git a/src/apps/haikudepot/ui/FeaturedPackagesView.h b/src/apps/haikudepot/ui/FeaturedPackagesView.h index b400eeca0d..83a85403d0 100644 --- a/src/apps/haikudepot/ui/FeaturedPackagesView.h +++ b/src/apps/haikudepot/ui/FeaturedPackagesView.h @@ -23,7 +23,7 @@ public: void AddPackage(const PackageInfoRef& package); void RemovePackage(const PackageInfoRef& package); void Clear(); - + void SelectPackage(const PackageInfoRef& package); static void CleanupIcons(); diff --git a/src/apps/haikudepot/ui/FilterView.cpp b/src/apps/haikudepot/ui/FilterView.cpp index 7d429f5bda..e8eb056619 100644 --- a/src/apps/haikudepot/ui/FilterView.cpp +++ b/src/apps/haikudepot/ui/FilterView.cpp @@ -138,7 +138,7 @@ FilterView::AdoptModel(const Model& model) message->AddString("name", depot.Name()); BMenuItem* item = new BMenuItem(depot.Name(), message); repositoryMenu->AddItem(item); - + if (depot.Name() == model.Depot()) { item->SetMarked(true); foundSelectedDepot = true; @@ -146,7 +146,7 @@ FilterView::AdoptModel(const Model& model) } if (!foundSelectedDepot) - repositoryMenu->ItemAt(0)->SetMarked(true); + repositoryMenu->ItemAt(0)->SetMarked(true); // Adopt categories BMenu* showMenu = fShowField->Menu(); @@ -174,6 +174,6 @@ FilterView::AdoptModel(const Model& model) } } if (!foundSelectedCategory) - showMenu->ItemAt(0)->SetMarked(true); + showMenu->ItemAt(0)->SetMarked(true); } diff --git a/src/apps/haikudepot/ui/MainWindow.cpp b/src/apps/haikudepot/ui/MainWindow.cpp index 4565b7fbb4..80307b46c0 100644 --- a/src/apps/haikudepot/ui/MainWindow.cpp +++ b/src/apps/haikudepot/ui/MainWindow.cpp @@ -101,7 +101,7 @@ public: fMessenger(messenger) { } - + virtual void AuthorizationChanged() { if (fMessenger.IsValid()) @@ -315,7 +315,7 @@ MainWindow::MessageReceived(BMessage* message) case B_PACKAGE_UPDATE: // TODO: We should do a more selective update depending on the - // "event", "location", and "change count" fields! + // "event", "location", and "change count" fields! _StartRefreshWorker(false); break; @@ -514,9 +514,9 @@ MainWindow::StoreSettings(BMessage& settings) const BMessage columnSettings; fPackageListView->SaveState(&columnSettings); - + settings.AddMessage("column settings", &columnSettings); - + settings.AddBool("show featured packages", fModel.ShowFeaturedPackages()); settings.AddBool("show available packages", @@ -660,7 +660,7 @@ MainWindow::_AdoptModel() fPackageListView->Clear(); for (int32 i = 0; i < fVisiblePackages.CountItems(); i++) { BAutolock locker(fModel.Lock()); - + const PackageInfoRef& package = fVisiblePackages.ItemAtFast(i); fPackageListView->AddPackage(package); @@ -697,7 +697,7 @@ MainWindow::_AdoptPackage(const PackageInfoRef& package) { BAutolock locker(fModel.Lock()); fPackageInfoView->SetPackage(package); - + if (fFeaturedPackagesView != NULL) fFeaturedPackagesView->SelectPackage(package); if (fPackageListView != NULL) @@ -890,7 +890,7 @@ MainWindow::_RefreshPackageList(bool force) fModel.StopPopulatingAllPackages(); BAutolock lock(fModel.Lock()); - + if (force) fModel.Clear(); @@ -1160,13 +1160,13 @@ MainWindow::_RatePackage() if (alert == NULL) return; - + int32 choice = alert->Go(); if (choice == 1) _OpenLoginWindow(BMessage(MSG_RATE_PACKAGE)); return; } - + // TODO: Allow only one RatePackageWindow // TODO: Mechanism for remembering the window frame RatePackageWindow* window = new RatePackageWindow(this, diff --git a/src/apps/haikudepot/ui/MessagePackageListener.cpp b/src/apps/haikudepot/ui/MessagePackageListener.cpp index e7678fbe71..382f8cd106 100644 --- a/src/apps/haikudepot/ui/MessagePackageListener.cpp +++ b/src/apps/haikudepot/ui/MessagePackageListener.cpp @@ -33,7 +33,7 @@ MessagePackageListener::PackageChanged(const PackageInfoEvent& event) { if ((event.Changes() & fChangesMask) == 0) return; - + BMessenger messenger(fTarget); if (!messenger.IsValid()) return; diff --git a/src/apps/haikudepot/ui/PackageContentsView.cpp b/src/apps/haikudepot/ui/PackageContentsView.cpp index 48ebd1d9f3..6e6b08cc52 100644 --- a/src/apps/haikudepot/ui/PackageContentsView.cpp +++ b/src/apps/haikudepot/ui/PackageContentsView.cpp @@ -87,7 +87,7 @@ public: fPath.Append("/"); fPath.Append(entry->Name()); } - + inline const BString& EntryPath() const { return fPath; @@ -213,11 +213,11 @@ public: { return B_OK; } - + virtual void HandleErrorOccurred() { } - + private: BOutlineListView* fListView; @@ -241,12 +241,12 @@ PackageContentsView::PackageContentsView(const char* name) BView("package_contents_view", B_WILL_DRAW), fPackageLock("package contents populator lock") { - fContentListView = new BOutlineListView("content list view", + fContentListView = new BOutlineListView("content list view", B_SINGLE_SELECTION_LIST); - - BScrollView* scrollView = new CustomScrollView("contents scroll view", + + BScrollView* scrollView = new CustomScrollView("contents scroll view", fContentListView); - + BLayoutBuilder::Group<>(this) .Add(scrollView, 1.0f) .SetInsets(0.0f, -1.0f, -1.0f, -1.0f) @@ -299,7 +299,7 @@ PackageContentsView::SetPackage(const PackageInfoRef& package) } -void +void PackageContentsView::Clear() { { diff --git a/src/apps/haikudepot/ui/PackageInfoView.cpp b/src/apps/haikudepot/ui/PackageInfoView.cpp index 7bf088a77d..4e0db2fa5e 100644 --- a/src/apps/haikudepot/ui/PackageInfoView.cpp +++ b/src/apps/haikudepot/ui/PackageInfoView.cpp @@ -215,7 +215,7 @@ public: const BMessage* dragMessage) { BButton::MouseMoved(point, transit, dragMessage); - + if (fTransitMessage != NULL && transit == B_EXITED_VIEW) Invoke(fTransitMessage); } @@ -251,7 +251,7 @@ public: const BMessage* dragMessage) { RatingView::MouseMoved(point, transit, dragMessage); - + if (fTransitMessage != NULL && transit == B_ENTERED_VIEW) Invoke(fTransitMessage); } @@ -564,12 +564,12 @@ public: { if (fButtons.CountItems() > 0) Clear(); - + if (fStatusBar == NULL) { fStatusLabel = new BStringView("progress label", B_TRANSLATE("Downloading:")); fLayout->AddView(fStatusLabel); - + fStatusBar = new BStatusBar("progress"); fStatusBar->SetMaxValue(100.0); fStatusBar->SetExplicitMinSize( @@ -577,7 +577,7 @@ public: fLayout->AddView(fStatusBar); } - + fStatusBar->SetTo(package.DownloadProgress() * 100.0); } @@ -769,7 +769,7 @@ public: Window()->PostMessage(message, Window()); break; } - + case MSG_EMAIL_PUBLISHER: { // TODO: Implement. If memory serves, there is a @@ -1068,7 +1068,7 @@ public: .Add(scrollView, 1.0f) .SetInsets(B_USE_DEFAULT_SPACING, -1.0f, -1.0f, -1.0f) ; - + _InitPreferredLanguages(); } @@ -1144,7 +1144,7 @@ private: return; BMessage preferredLanguages; - if (localeRoster->GetPreferredLanguages(&preferredLanguages) != B_OK) + if (localeRoster->GetPreferredLanguages(&preferredLanguages) != B_OK) return; BString language; @@ -1280,7 +1280,7 @@ public: AddTab(fUserRatingsView); AddTab(fChangelogView); AddTab(fContentsView); - + TabAt(0)->SetLabel(B_TRANSLATE("About")); TabAt(1)->SetLabel(B_TRANSLATE("Ratings")); TabAt(2)->SetLabel(B_TRANSLATE("Changelog")); @@ -1334,7 +1334,7 @@ PackageInfoView::PackageInfoView(BLocker* modelLock, { fCardLayout = new BCardLayout(); SetLayout(fCardLayout); - + BGroupView* noPackageCard = new BGroupView("no package card", B_VERTICAL); AddChild(noPackageCard); @@ -1459,7 +1459,7 @@ PackageInfoView::SetPackage(const PackageInfoRef& packageRef) // same package as before the refresh. switchToDefaultTab = false; } - + const PackageInfo& package = *packageRef.Get(); fTitleView->SetPackage(package); diff --git a/src/apps/haikudepot/ui/RatePackageWindow.cpp b/src/apps/haikudepot/ui/RatePackageWindow.cpp index 118c1a29d0..2d0bca6ac6 100644 --- a/src/apps/haikudepot/ui/RatePackageWindow.cpp +++ b/src/apps/haikudepot/ui/RatePackageWindow.cpp @@ -108,13 +108,13 @@ public: { if (dragMessage != NULL) return; - + if ((transit != B_INSIDE_VIEW && transit != B_ENTERED_VIEW) || where.x > MinSize().width) { SetRating(fPermanentRating); return; } - + float hoverRating = _RatingForMousePos(where); SetRating(hoverRating); } @@ -126,7 +126,7 @@ public: message.AddFloat("rating", fPermanentRating); Window()->PostMessage(&message, Window()); } - + void SetPermanentRating(float rating) { fPermanentRating = rating; @@ -187,7 +187,7 @@ RatePackageWindow::RatePackageWindow(BWindow* parent, BRect frame, BStringView* ratingLabel = new BStringView("rating label", B_TRANSLATE("Your rating:")); - fSetRatingView = new SetRatingView(); + fSetRatingView = new SetRatingView(); fTextView = new TextDocumentView(); ScrollView* textScrollView = new ScrollView( @@ -218,10 +218,10 @@ RatePackageWindow::RatePackageWindow(BWindow* parent, BRect frame, B_TRANSLATE("Very unstable"), "veryunstable")); fStabilityCodes.Add(StabilityRating( B_TRANSLATE("Does not start"), "nostart")); - + add_stabilities_to_menu(fStabilityCodes, stabilityMenu); stabilityMenu->SetTargetForItems(this); - + fStability = fStabilityCodes.ItemAt(0).Name(); stabilityMenu->ItemAt(0)->SetMarked(true); @@ -237,14 +237,14 @@ RatePackageWindow::RatePackageWindow(BWindow* parent, BRect frame, fModel.SupportedLanguages().IndexOf(fCommentLanguage)); if (defaultItem != NULL) defaultItem->SetMarked(true); - + fRatingActiveCheckBox = new BCheckBox("rating active", B_TRANSLATE("Other users can see this rating"), new BMessage(MSG_RATING_ACTIVE_CHANGED)); // Hide the check mark by default, it will be made visible when // the user already made a rating and it is loaded fRatingActiveCheckBox->Hide(); - + // Construct buttons fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"), new BMessage(B_QUIT_REQUESTED)); @@ -297,7 +297,7 @@ RatePackageWindow::MessageReceived(BMessage* message) case MSG_LANGUAGE_SELECTED: message->FindString("code", &fCommentLanguage); break; - + case MSG_RATING_ACTIVE_CHANGED: { int32 value; @@ -355,7 +355,7 @@ RatePackageWindow::_SetWorkerThread(thread_id thread) { if (!Lock()) return; - + bool enabled = thread < 0; // fTextEditor->SetEnabled(enabled); @@ -363,7 +363,7 @@ RatePackageWindow::_SetWorkerThread(thread_id thread) fStabilityField->SetEnabled(enabled); fCommentLanguageField->SetEnabled(enabled); fSendButton->SetEnabled(enabled); - + if (thread >= 0) { fWorkerThread = thread; resume_thread(fWorkerThread); @@ -418,7 +418,7 @@ RatePackageWindow::_QueryRatingThread() BMessage result; if (status == B_OK && info.FindMessage("result", &result) == B_OK && Lock()) { - + result.FindString("code", &fRatingID); result.FindBool("active", &fRatingActive); BString comment; @@ -454,7 +454,7 @@ RatePackageWindow::_QueryRatingThread() fRating = (float)rating; fSetRatingView->SetPermanentRating(fRating); } - + fRatingActiveCheckBox->SetValue(fRatingActive); fRatingActiveCheckBox->Show(); @@ -541,7 +541,7 @@ RatePackageWindow::_SendRatingThread() error = B_TRANSLATE( "It was not possible to contact the web service."); } - + if (!error.IsEmpty()) { BString failedTitle; if (ratingID.Length() > 0) diff --git a/src/apps/haikudepot/ui/ScreenshotWindow.cpp b/src/apps/haikudepot/ui/ScreenshotWindow.cpp index da0192873b..175e132327 100644 --- a/src/apps/haikudepot/ui/ScreenshotWindow.cpp +++ b/src/apps/haikudepot/ui/ScreenshotWindow.cpp @@ -53,7 +53,7 @@ ScreenshotWindow::ScreenshotWindow(BWindow* parent, BRect frame) ScreenshotWindow::~ScreenshotWindow() { BAutolock locker(&fLock); - + if (fWorkerThread >= 0) wait_for_thread(fWorkerThread, NULL); } @@ -114,7 +114,7 @@ void ScreenshotWindow::_DownloadScreenshot() { BAutolock locker(&fLock); - + if (fWorkerThread >= 0) { fDownloadPending = true; return; @@ -132,13 +132,13 @@ ScreenshotWindow::_SetWorkerThread(thread_id thread) { if (!Lock()) return; - + // bool enabled = thread < 0; // // fPreviewsButton->SetEnabled(enabled); // fNextButton->SetEnabled(enabled); // fCloseButton->SetEnabled(enabled); - + if (thread >= 0) { fWorkerThread = thread; resume_thread(fWorkerThread); diff --git a/src/apps/haikudepot/ui/UserLoginWindow.cpp b/src/apps/haikudepot/ui/UserLoginWindow.cpp index 5a24fb26db..8836922b75 100644 --- a/src/apps/haikudepot/ui/UserLoginWindow.cpp +++ b/src/apps/haikudepot/ui/UserLoginWindow.cpp @@ -102,7 +102,7 @@ UserLoginWindow::UserLoginWindow(BWindow* parent, BRect frame, Model& model) fRepeatPasswordField = new BTextControl(B_TRANSLATE("Repeat pass phrase:"), "", new BMessage(MSG_VALIDATE_FIELDS)); fRepeatPasswordField->TextView()->HideTyping(true); - + // Construct languages popup BPopUpMenu* languagesMenu = new BPopUpMenu(B_TRANSLATE("Language")); fLanguageCodeField = new BMenuField("language", @@ -115,8 +115,8 @@ UserLoginWindow::UserLoginWindow(BWindow* parent, BRect frame, Model& model) fModel.SupportedLanguages().IndexOf(fPreferredLanguage)); if (defaultItem != NULL) defaultItem->SetMarked(true); - - + + fEmailField = new BTextControl(B_TRANSLATE("Email address:"), "", NULL); fCaptchaView = new BitmapView("captcha view"); fCaptchaResultField = new BTextControl("", "", NULL); @@ -133,7 +133,7 @@ UserLoginWindow::UserLoginWindow(BWindow* parent, BRect frame, Model& model) new BMessage(MSG_VALIDATE_FIELDS)); fCaptchaResultField->SetModificationMessage( new BMessage(MSG_VALIDATE_FIELDS)); - + fTabView = new TabView(BMessenger(this), BMessage(MSG_TAB_SELECTED)); @@ -178,7 +178,7 @@ UserLoginWindow::UserLoginWindow(BWindow* parent, BRect frame, Model& model) ; SetDefaultButton(fSendButton); - + _SetMode(LOGIN); CenterIn(parent->Frame()); @@ -188,7 +188,7 @@ UserLoginWindow::UserLoginWindow(BWindow* parent, BRect frame, Model& model) UserLoginWindow::~UserLoginWindow() { BAutolock locker(&fLock); - + if (fWorkerThread >= 0) wait_for_thread(fWorkerThread, NULL); } @@ -331,13 +331,13 @@ UserLoginWindow::_ValidateCreateAccountFields(bool alertProblems) // TODO: Use the same validation as the web-serivce bool validUserName = nickName.Length() >= 3; fNewUsernameField->MarkAsInvalid(!validUserName); - + bool validPassword = password1.Length() >= 8 && count_digits(password1) >= 2 && count_upper_case_letters(password1) >= 2; fNewPasswordField->MarkAsInvalid(!validPassword); fRepeatPasswordField->MarkAsInvalid(password1 != password2); - + bool validCaptcha = captcha.Length() > 0; fCaptchaResultField->MarkAsInvalid(!validCaptcha); @@ -399,7 +399,7 @@ UserLoginWindow::_ValidateCreateAccountFields(bool alertProblems) return false; } } - + return valid; } @@ -408,7 +408,7 @@ void UserLoginWindow::_Login() { BAutolock locker(&fLock); - + if (fWorkerThread >= 0) return; @@ -424,9 +424,9 @@ UserLoginWindow::_CreateAccount() { if (!_ValidateCreateAccountFields(true)) return; - + BAutolock locker(&fLock); - + if (fWorkerThread >= 0) return; @@ -448,7 +448,7 @@ UserLoginWindow::_RequestCaptcha() } BAutolock locker(&fLock); - + if (fWorkerThread >= 0) return; @@ -466,7 +466,7 @@ UserLoginWindow::_LoginSuccessful(const BString& message) // (This method is executd from another thread.) BMessenger onSuccessTarget(fOnSuccessTarget); BMessage onSuccessMessage(fOnSuccessMessage); - + BMessenger(this).SendMessage(B_QUIT_REQUESTED); BAlert* alert = new(std::nothrow) BAlert( @@ -489,7 +489,7 @@ UserLoginWindow::_SetWorkerThread(thread_id thread) { if (!Lock()) return; - + bool enabled = thread < 0; fUsernameField->SetEnabled(enabled); @@ -501,7 +501,7 @@ UserLoginWindow::_SetWorkerThread(thread_id thread) fLanguageCodeField->SetEnabled(enabled); fCaptchaResultField->SetEnabled(enabled); fSendButton->SetEnabled(enabled); - + if (thread >= 0) { fWorkerThread = thread; resume_thread(fWorkerThread); @@ -620,7 +620,7 @@ UserLoginWindow::_RequestCaptchaThread() } delete[] buffer; } - } + } } else { fprintf(stderr, "Failed to obtain captcha: %s\n", strerror(status)); } @@ -738,7 +738,7 @@ UserLoginWindow::_CollectValidationFailures(const BMessage& result, BMessage failure; if (failures.FindMessage(name, &failure) != B_OK) break; - + BString property; BString message; if (failure.FindString("property", &property) == B_OK @@ -764,7 +764,7 @@ UserLoginWindow::_CollectValidationFailures(const BMessage& result, } } } - + if (!found) { error << B_TRANSLATE("But none could be listed here, sorry."); } diff --git a/src/apps/haikudepot/ui_generic/LinkView.cpp b/src/apps/haikudepot/ui_generic/LinkView.cpp index 673c5d5559..5d337fce58 100644 --- a/src/apps/haikudepot/ui_generic/LinkView.cpp +++ b/src/apps/haikudepot/ui_generic/LinkView.cpp @@ -65,7 +65,7 @@ LinkView::Draw(BRect updateRect) float y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent) - ceilf(fontHeight.descent)) / 2.0 + ceilf(fontHeight.ascent); float x = 0.0f; - + BString text(Text()); TruncateString(&text, B_TRUNCATE_END, bounds.Width()); DrawString(text, BPoint(x, y)); diff --git a/src/apps/haikudepot/ui_generic/ScrollableGroupView.cpp b/src/apps/haikudepot/ui_generic/ScrollableGroupView.cpp index 9be7cf4689..f876e46e99 100644 --- a/src/apps/haikudepot/ui_generic/ScrollableGroupView.cpp +++ b/src/apps/haikudepot/ui_generic/ScrollableGroupView.cpp @@ -30,9 +30,9 @@ void ScrollableGroupView::DoLayout() { BGroupView::DoLayout(); - + BScrollBar* scrollBar = ScrollBar(B_VERTICAL); - + if (scrollBar == NULL) return; diff --git a/src/apps/haikudepot/ui_generic/SharedBitmap.cpp b/src/apps/haikudepot/ui_generic/SharedBitmap.cpp index 9382c1e8a8..42d32637a4 100644 --- a/src/apps/haikudepot/ui_generic/SharedBitmap.cpp +++ b/src/apps/haikudepot/ui_generic/SharedBitmap.cpp @@ -76,7 +76,7 @@ SharedBitmap::SharedBitmap(BPositionIO& data) fBuffer = new(std::nothrow) uint8[fSize]; if (fBuffer != NULL) { data.Seek(0, SEEK_SET); - + off_t bytesRead = 0; size_t chunkSize = std::min((off_t)4096, fSize); while (bytesRead < fSize) { @@ -86,7 +86,7 @@ SharedBitmap::SharedBitmap(BPositionIO& data) else break; } - + if (bytesRead != fSize) { delete[] fBuffer; fBuffer = NULL; @@ -177,7 +177,7 @@ BBitmap* SharedBitmap::_CreateBitmapFromBuffer(int32 size) const { BBitmap* bitmap = _LoadIconFromBuffer(fBuffer, fSize, size); - + if (bitmap == NULL) bitmap = _LoadBitmapFromBuffer(fBuffer, fSize); @@ -214,7 +214,7 @@ SharedBitmap::_LoadBitmapFromBuffer(const void* buffer, size_t size) const // Try to read as an archived bitmap. BBitmap* bitmap = _LoadArchivedBitmapFromStream(stream); - + if (bitmap == NULL) { // Try to read as a translator bitmap stream.Seek(0, SEEK_SET);