MediaPlayer: addr_t instead of long, as suggested by Ingo.

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