* 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:
parent
5f5ba235cb
commit
fddbc2311f
@ -35,11 +35,15 @@ status_t
|
||||
ServerLink::ReadRegion(BRegion *region)
|
||||
{
|
||||
fReceiver->Read(®ion->fCount, sizeof(long));
|
||||
fReceiver->Read(®ion->fBounds, sizeof(clipping_rect));
|
||||
if (!region->_SetSize(region->fCount))
|
||||
return B_NO_MEMORY;
|
||||
return fReceiver->Read(region->fData,
|
||||
region->fCount * sizeof(clipping_rect));
|
||||
if (region->fCount > 0) {
|
||||
fReceiver->Read(®ion->fBounds, sizeof(clipping_rect));
|
||||
if (!region->_SetSize(region->fCount))
|
||||
return B_NO_MEMORY;
|
||||
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)
|
||||
{
|
||||
fSender->Attach(®ion.fCount, sizeof(long));
|
||||
fSender->Attach(®ion.fBounds, sizeof(clipping_rect));
|
||||
return fSender->Attach(region.fData,
|
||||
region.fCount * sizeof(clipping_rect));
|
||||
if (region.fCount > 0) {
|
||||
fSender->Attach(®ion.fBounds, sizeof(clipping_rect));
|
||||
return fSender->Attach(region.fData,
|
||||
region.fCount * sizeof(clipping_rect));
|
||||
} else {
|
||||
return fSender->Attach(®ion.fBounds, sizeof(clipping_rect));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user