* fix attaching and reading empty regions
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21909 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -35,11 +35,15 @@ status_t
|
|||||||
ServerLink::ReadRegion(BRegion *region)
|
ServerLink::ReadRegion(BRegion *region)
|
||||||
{
|
{
|
||||||
fReceiver->Read(®ion->fCount, sizeof(long));
|
fReceiver->Read(®ion->fCount, sizeof(long));
|
||||||
fReceiver->Read(®ion->fBounds, sizeof(clipping_rect));
|
if (region->fCount > 0) {
|
||||||
if (!region->_SetSize(region->fCount))
|
fReceiver->Read(®ion->fBounds, sizeof(clipping_rect));
|
||||||
return B_NO_MEMORY;
|
if (!region->_SetSize(region->fCount))
|
||||||
return fReceiver->Read(region->fData,
|
return B_NO_MEMORY;
|
||||||
region->fCount * sizeof(clipping_rect));
|
return fReceiver->Read(region->fData,
|
||||||
|
region->fCount * sizeof(clipping_rect));
|
||||||
|
} else {
|
||||||
|
return fReceiver->Read(®ion->fBounds, sizeof(clipping_rect));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -47,9 +51,13 @@ status_t
|
|||||||
ServerLink::AttachRegion(const BRegion ®ion)
|
ServerLink::AttachRegion(const BRegion ®ion)
|
||||||
{
|
{
|
||||||
fSender->Attach(®ion.fCount, sizeof(long));
|
fSender->Attach(®ion.fCount, sizeof(long));
|
||||||
fSender->Attach(®ion.fBounds, sizeof(clipping_rect));
|
if (region.fCount > 0) {
|
||||||
return fSender->Attach(region.fData,
|
fSender->Attach(®ion.fBounds, sizeof(clipping_rect));
|
||||||
region.fCount * sizeof(clipping_rect));
|
return fSender->Attach(region.fData,
|
||||||
|
region.fCount * sizeof(clipping_rect));
|
||||||
|
} else {
|
||||||
|
return fSender->Attach(®ion.fBounds, sizeof(clipping_rect));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user