handle errors when reading from the link, at least for the bigger items, it should be enough to just check the error in the last call to Read(), since previous errors are kept in the Link
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14819 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1834,28 +1834,28 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
{
|
{
|
||||||
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_POLYGON\n", Title()));
|
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_POLYGON\n", Title()));
|
||||||
|
|
||||||
BRect polyframe;
|
BRect polyFrame;
|
||||||
bool isclosed = true;
|
bool isClosed = true;
|
||||||
int32 pointcount;
|
int32 pointCount;
|
||||||
BPoint *pointlist;
|
|
||||||
|
|
||||||
link.Read<BRect>(&polyframe);
|
link.Read<BRect>(&polyFrame);
|
||||||
if (code == AS_STROKE_POLYGON)
|
if (code == AS_STROKE_POLYGON)
|
||||||
link.Read<bool>(&isclosed);
|
link.Read<bool>(&isClosed);
|
||||||
link.Read<int32>(&pointcount);
|
link.Read<int32>(&pointCount);
|
||||||
|
|
||||||
pointlist = new BPoint[pointcount];
|
BPoint* pointList = new(nothrow) BPoint[pointCount];
|
||||||
|
if (link.Read(pointList, pointCount * sizeof(BPoint)) >= B_OK) {
|
||||||
link.Read(pointlist, sizeof(BPoint)*pointcount);
|
|
||||||
|
|
||||||
for (int32 i = 0; i < pointcount; i++)
|
|
||||||
fCurrentLayer->ConvertToScreen(&pointlist[i]);
|
|
||||||
|
|
||||||
driver->DrawPolygon(pointlist, pointcount, polyframe,
|
for (int32 i = 0; i < pointCount; i++)
|
||||||
fCurrentLayer->CurrentState(), code == AS_FILL_POLYGON,
|
fCurrentLayer->ConvertToScreen(&pointList[i]);
|
||||||
isclosed);
|
|
||||||
|
driver->DrawPolygon(pointList, pointCount, polyFrame,
|
||||||
|
fCurrentLayer->CurrentState(), code == AS_FILL_POLYGON,
|
||||||
|
isClosed && pointCount > 2);
|
||||||
|
|
||||||
|
delete[] pointList;
|
||||||
|
}
|
||||||
|
|
||||||
delete [] pointlist;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_STROKE_SHAPE:
|
case AS_STROKE_SHAPE:
|
||||||
@@ -1863,28 +1863,29 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
{
|
{
|
||||||
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_SHAPE\n", Title()));
|
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_SHAPE\n", Title()));
|
||||||
|
|
||||||
BRect shaperect;
|
BRect shapeFrame;
|
||||||
int32 opcount;
|
int32 opCount;
|
||||||
int32 ptcount;
|
int32 ptCount;
|
||||||
|
|
||||||
link.Read<BRect>(&shaperect);
|
link.Read<BRect>(&shapeFrame);
|
||||||
link.Read<int32>(&opcount);
|
link.Read<int32>(&opCount);
|
||||||
link.Read<int32>(&ptcount);
|
link.Read<int32>(&ptCount);
|
||||||
|
|
||||||
uint32* oplist = new uint32[opcount];
|
uint32* opList = new(nothrow) uint32[opCount];
|
||||||
BPoint* ptlist = new BPoint[ptcount];
|
BPoint* ptList = new(nothrow) BPoint[ptCount];
|
||||||
|
if (link.Read(opList, opCount * sizeof(uint32)) >= B_OK &&
|
||||||
|
link.Read(ptList, ptCount * sizeof(BPoint)) >= B_OK) {
|
||||||
|
|
||||||
link.Read(oplist, opcount * sizeof(uint32));
|
for (int32 i = 0; i < ptCount; i++)
|
||||||
link.Read(ptlist, ptcount * sizeof(BPoint));
|
fCurrentLayer->ConvertToScreen(&ptList[i]);
|
||||||
|
|
||||||
|
driver->DrawShape(shapeFrame, opCount, opList, ptCount, ptList,
|
||||||
|
fCurrentLayer->CurrentState(), code == AS_FILL_SHAPE);
|
||||||
|
}
|
||||||
|
|
||||||
for (int32 i = 0; i < ptcount; i++)
|
delete[] opList;
|
||||||
fCurrentLayer->ConvertToScreen(&ptlist[i]);
|
delete[] ptList;
|
||||||
|
|
||||||
driver->DrawShape(shaperect, opcount, oplist, ptcount, ptlist,
|
|
||||||
fCurrentLayer->CurrentState(), code == AS_FILL_SHAPE);
|
|
||||||
|
|
||||||
delete[] oplist;
|
|
||||||
delete[] ptlist;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_FILL_REGION:
|
case AS_FILL_REGION:
|
||||||
@@ -1894,8 +1895,8 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
int32 count;
|
int32 count;
|
||||||
link.Read<int32>(&count);
|
link.Read<int32>(&count);
|
||||||
|
|
||||||
BRect *rects = new BRect[count];
|
BRect* rects = new(nothrow) BRect[count];
|
||||||
if (link.Read(rects, sizeof(BRect) * count) != B_OK) {
|
if (link.Read(rects, sizeof(BRect) * count) < B_OK) {
|
||||||
delete[] rects;
|
delete[] rects;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2074,7 +2075,7 @@ status_t
|
|||||||
ServerWindow::SendMessageToClient(const BMessage* msg, int32 target, bool usePreferred) const
|
ServerWindow::SendMessageToClient(const BMessage* msg, int32 target, bool usePreferred) const
|
||||||
{
|
{
|
||||||
ssize_t size = msg->FlattenedSize();
|
ssize_t size = msg->FlattenedSize();
|
||||||
char* buffer = new char[size];
|
char* buffer = new(nothrow) char[size];
|
||||||
status_t ret;
|
status_t ret;
|
||||||
|
|
||||||
if ((ret = msg->Flatten(buffer, size)) == B_OK) {
|
if ((ret = msg->Flatten(buffer, size)) == B_OK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user