MediaPlayer: 64 bit build fixes for an ugly use of BList.

This commit is contained in:
Jérôme Duval
2013-05-04 15:31:07 +02:00
parent cf91714bf2
commit 113817f035
3 changed files with 12 additions and 12 deletions
+7 -7
View File
@@ -328,7 +328,7 @@ DragSortableListView::MessageReceived(BMessage* message)
BList indices; BList indices;
int32 index; int32 index;
for (int32 i = 0; message->FindInt32("index", i, &index) == B_OK; i++) for (int32 i = 0; message->FindInt32("index", i, &index) == B_OK; i++)
indices.AddItem((void*)index); indices.AddItem((void*)(long)index);
if (indices.CountItems() > 0) { if (indices.CountItems() > 0) {
if (modifiers() & B_SHIFT_KEY) if (modifiers() & B_SHIFT_KEY)
CopyItems(indices, fDropIndex); CopyItems(indices, fDropIndex);
@@ -636,7 +636,7 @@ DragSortableListView::MoveItems(const BList& indices, int32 index)
BList removedItems; BList removedItems;
int32 count = indices.CountItems(); int32 count = indices.CountItems();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
int32 removeIndex = (int32)indices.ItemAtFast(i) - i; int32 removeIndex = (int32)(long)indices.ItemAtFast(i) - i;
BListItem* item = RemoveItem(removeIndex); BListItem* item = RemoveItem(removeIndex);
if (item && removedItems.AddItem((void*)item)) { if (item && removedItems.AddItem((void*)item)) {
if (removeIndex < index) if (removeIndex < index)
@@ -669,9 +669,9 @@ DragSortableListView::CopyItems(const BList& indices, int32 toIndex)
BList clonedItems; BList clonedItems;
int32 count = indices.CountItems(); int32 count = indices.CountItems();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
int32 index = (int32)indices.ItemAtFast(i); int32 index = (int32)(long)indices.ItemAtFast(i);
BListItem* item = CloneItem(index); BListItem* item = CloneItem(index);
if (item && !clonedItems.AddItem((void*)item)) if (item && !clonedItems.AddItem((void*)(long)item))
delete item; delete item;
} }
count = clonedItems.CountItems(); count = clonedItems.CountItems();
@@ -693,7 +693,7 @@ DragSortableListView::RemoveItemList(const BList& indices)
{ {
int32 count = indices.CountItems(); int32 count = indices.CountItems();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
int32 index = (int32)indices.ItemAtFast(i) - i; int32 index = (int32)(long)indices.ItemAtFast(i) - i;
delete RemoveItem(index); delete RemoveItem(index);
} }
} }
@@ -706,7 +706,7 @@ DragSortableListView::GetSelectedItems(BList& indices)
int32 index = CurrentSelection(i); int32 index = CurrentSelection(i);
if (index < 0) if (index < 0)
break; break;
if (!indices.AddItem((void*)index)) if (!indices.AddItem((void*)(long)index))
break; break;
} }
} }
@@ -731,7 +731,7 @@ DragSortableListView::RemoveAll()
BList indices; BList indices;
int32 count = CountItems(); int32 count = CountItems();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
if (!indices.AddItem((void*)i)) if (!indices.AddItem((void*)(long)i))
break; break;
} }
@@ -425,7 +425,7 @@ PlaylistListView::Randomize()
int32 index = CurrentSelection(count); int32 index = CurrentSelection(count);
if (index < 0) if (index < 0)
break; break;
if (!indices.AddItem((void*)index)) if (!indices.AddItem((void*)(long)index))
return; return;
count++; count++;
} }
@@ -435,7 +435,7 @@ PlaylistListView::Randomize()
// no selection, simply add all items // no selection, simply add all items
count = CountItems(); count = CountItems();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
if (!indices.AddItem((void*)i)) if (!indices.AddItem((void*)(long)i))
return; return;
} }
} }
@@ -458,7 +458,7 @@ void
PlaylistListView::RemoveToTrash(int32 index) PlaylistListView::RemoveToTrash(int32 index)
{ {
BList indices; BList indices;
indices.AddItem((void*)index); indices.AddItem((void*)(long)index);
RemoveItemList(indices, true); RemoveItemList(indices, true);
} }
@@ -48,7 +48,7 @@ RandomizePLItemsCommand::RandomizePLItemsCommand(Playlist* playlist,
BList indexSet; BList indexSet;
for (int32 i = 0; i < fCount; i++) { for (int32 i = 0; i < fCount; i++) {
fItems[i] = fPlaylist->ItemAt(fListIndices[i]); fItems[i] = fPlaylist->ItemAt(fListIndices[i]);
if (fItems[i] == NULL || !indexSet.AddItem((void*)i)) { if (fItems[i] == NULL || !indexSet.AddItem((void*)(long)i)) {
// indicate a bad object state // indicate a bad object state
delete[] fItems; delete[] fItems;
fItems = NULL; fItems = NULL;
@@ -59,7 +59,7 @@ RandomizePLItemsCommand::RandomizePLItemsCommand(Playlist* playlist,
// remove the indices from the set in random order // remove the indices from the set in random order
for (int32 i = 0; i < fCount; i++) { for (int32 i = 0; i < fCount; i++) {
int32 randomSetIndex = rand() % indexSet.CountItems(); int32 randomSetIndex = rand() % indexSet.CountItems();
fRandomInternalIndices[i] = (int32)indexSet.RemoveItem(randomSetIndex); fRandomInternalIndices[i] = (int32)(long)indexSet.RemoveItem(randomSetIndex);
} }
} }