Conversion to BSession API
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4924 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -38,7 +38,6 @@
|
||||
#include <Errors.h>
|
||||
#include <List.h>
|
||||
#include <AppServerLink.h>
|
||||
#include <PortLink.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
@@ -85,12 +84,11 @@ BPicture::BPicture(const BPicture &picture)
|
||||
{
|
||||
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
|
||||
link.SetOpCode(AS_CLONE_PICTURE);
|
||||
link.Attach<int32>(picture.token);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
link.WriteInt32(AS_CLONE_PICTURE);
|
||||
link.WriteInt32(picture.token);
|
||||
link.Sync();
|
||||
link.ReadInt32(&token);
|
||||
|
||||
}
|
||||
if (picture.extent->fNewData != NULL)
|
||||
@@ -160,21 +158,20 @@ BPicture::BPicture(BMessage *archive)
|
||||
if (extent->fNewSize != 0 && extent->fNewData != 0)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
BPicture *pic;
|
||||
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach<int32>(extent->fPictures.CountItems());
|
||||
link.WriteInt32(AS_CREATE_PICTURE);
|
||||
link.WriteInt32(extent->fPictures.CountItems());
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||
{
|
||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||
if(pic)
|
||||
link.Attach<int32>(pic->token);
|
||||
link.WriteInt32(pic->token);
|
||||
}
|
||||
link.Attach<int32>(extent->fNewSize);
|
||||
link.Attach(extent->fNewData,extent->fNewSize);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
link.WriteInt32(extent->fNewSize);
|
||||
link.WriteData(extent->fNewData,extent->fNewSize);
|
||||
link.Sync();
|
||||
link.ReadInt32(&token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,9 +202,9 @@ BPicture::~BPicture()
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
link.SetOpCode(AS_DELETE_PICTURE);
|
||||
link.Attach<int32>(token);
|
||||
link.Flush();
|
||||
link.WriteInt32(AS_DELETE_PICTURE);
|
||||
link.WriteInt32(token);
|
||||
link.Sync();
|
||||
}
|
||||
|
||||
if (extent->fNewData != NULL)
|
||||
@@ -341,21 +338,20 @@ status_t BPicture::Unflatten(BDataIO *stream)
|
||||
// swap_data(extent->fNewData, extent->fNewSize);
|
||||
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
BPicture *pic;
|
||||
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach<int32>(extent->fPictures.CountItems());
|
||||
link.WriteInt32(AS_CREATE_PICTURE);
|
||||
link.WriteInt32(extent->fPictures.CountItems());
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||
{
|
||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||
if(pic)
|
||||
link.Attach<int32>(pic->token);
|
||||
link.WriteInt32(pic->token);
|
||||
}
|
||||
link.Attach<int32>(extent->fNewSize);
|
||||
link.Attach(extent->fNewData, extent->fNewSize);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
link.WriteInt32(extent->fNewSize);
|
||||
link.WriteData(extent->fNewData, extent->fNewSize);
|
||||
link.Sync();
|
||||
link.ReadInt32(&token);
|
||||
|
||||
if (extent->fNewData)
|
||||
{
|
||||
@@ -395,18 +391,17 @@ void BPicture::import_data(const void *data, int32 size, BPicture **subs,
|
||||
return;
|
||||
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach<int32>(subCount);
|
||||
link.WriteInt32(AS_CREATE_PICTURE);
|
||||
link.WriteInt32(subCount);
|
||||
|
||||
for (int32 i = 0; i < subCount; i++)
|
||||
link.Attach<int32>(subs[i]->token);
|
||||
link.WriteInt32(subs[i]->token);
|
||||
|
||||
link.Attach<int32>(size);
|
||||
link.Attach(data, size);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
link.WriteInt32(size);
|
||||
link.WriteData(data, size);
|
||||
link.Sync();
|
||||
link.ReadInt32(&token);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void BPicture::import_old_data(const void *data, int32 size)
|
||||
@@ -421,14 +416,12 @@ void BPicture::import_old_data(const void *data, int32 size)
|
||||
convert_old_to_new(data, size, &extent->fNewData, &extent->fNewSize);
|
||||
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach<int32>(0L);
|
||||
link.Attach<int32>(extent->fNewSize);
|
||||
link.Attach(extent->fNewData,extent->fNewSize);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
link.WriteInt32(AS_CREATE_PICTURE);
|
||||
link.WriteInt32(0L);
|
||||
link.WriteInt32(extent->fNewSize);
|
||||
link.WriteData(extent->fNewData,extent->fNewSize);
|
||||
link.Sync();
|
||||
link.ReadInt32(&token)
|
||||
|
||||
// Do we free all data now?
|
||||
free(extent->fNewData);
|
||||
@@ -453,12 +446,11 @@ bool BPicture::assert_local_copy()
|
||||
return false;
|
||||
|
||||
/* BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
int32 count;
|
||||
|
||||
link.SetOpCode(AS_DOWNLOAD_PICTURE);
|
||||
link.Attach<int32>(token);
|
||||
link.FlushWithReply(&replydata);
|
||||
link.WriteInt32(AS_DOWNLOAD_PICTURE);
|
||||
link.WriteInt32(token);
|
||||
link.Sync();
|
||||
count=*((int32*)replydata.buffer);
|
||||
|
||||
// Read sub picture tokens
|
||||
@@ -504,16 +496,14 @@ bool BPicture::assert_server_copy()
|
||||
extent->fPictures.ItemAt(i)->assert_server_copy();
|
||||
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach<int32>(extent->fPictures.CountItems());
|
||||
link.WriteInt32(AS_CREATE_PICTURE);
|
||||
link.WriteInt32(extent->fPictures.CountItems());
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||
link.Attach<int32>(extent->fPictures.ItemAt(i)->token);
|
||||
link.Attach<int32>(extent->fNewSize);
|
||||
link.Attach(extent->fNewData,extent->fNewSize);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
link.WriteInt32(extent->fPictures.ItemAt(i)->token);
|
||||
link.WriteInt32(extent->fNewSize);
|
||||
link.WriteData(extent->fNewData,extent->fNewSize);
|
||||
link.Sync();
|
||||
link.ReadInt32(&token);
|
||||
|
||||
return token != -1;*/
|
||||
return true;
|
||||
@@ -553,9 +543,9 @@ void BPicture::usurp(BPicture *lameDuck)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
link.SetOpCode(AS_DELETE_PICTURE);
|
||||
link.Attach<int32>(token);
|
||||
link.Flush();
|
||||
link.WriteInt32(AS_DELETE_PICTURE);
|
||||
link.WriteInt32(token);
|
||||
link.Sync();
|
||||
}
|
||||
|
||||
if (extent->fNewData != NULL)
|
||||
|
||||
Reference in New Issue
Block a user