* Minor cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33584 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-10-14 12:23:48 +00:00
parent 8e52aee982
commit 780d2d5df7
2 changed files with 12 additions and 5 deletions
+8 -5
View File
@@ -463,22 +463,25 @@ Playlist::AppendToPlaylistRecursive(const entry_ref& ref, Playlist* playlist)
{
// recursively append the ref (dive into folders)
BEntry entry(&ref, true);
if (entry.InitCheck() < B_OK || !entry.Exists())
if (entry.InitCheck() != B_OK || !entry.Exists())
return;
if (entry.IsDirectory()) {
BDirectory dir(&entry);
if (dir.InitCheck() < B_OK)
if (dir.InitCheck() != B_OK)
return;
entry.Unset();
entry_ref subRef;
while (dir.GetNextRef(&subRef) == B_OK)
while (dir.GetNextRef(&subRef) == B_OK) {
AppendToPlaylistRecursive(subRef, playlist);
}
} else if (entry.IsFile()) {
BString mimeString = _MIMEString(&ref);
if (_IsMediaFile(mimeString)) {
PlaylistItem* item = new (std::nothrow) FilePlaylistItem(ref);
if (item == NULL || !playlist->AddItem(item))
if (item != NULL && !playlist->AddItem(item))
delete item;
} else
printf("MIME Type = %s\n", mimeString.String());
@@ -490,7 +493,7 @@ Playlist::AppendToPlaylistRecursive(const entry_ref& ref, Playlist* playlist)
Playlist::AppendPlaylistToPlaylist(const entry_ref& ref, Playlist* playlist)
{
BEntry entry(&ref, true);
if (entry.InitCheck() < B_OK || !entry.Exists())
if (entry.InitCheck() != B_OK || !entry.Exists())
return;
BString mimeString = _MIMEString(&ref);
+4
View File
@@ -97,6 +97,10 @@ public:
Playlist* playlist);
private:
Playlist(const Playlist& other);
Playlist& operator=(const Playlist& other);
// unimplemented
static bool _IsMediaFile(const BString& mimeString);
static bool _IsTextPlaylist(const BString& mimeString);
static bool _IsBinaryPlaylist(const BString& mimeString);