SpiderSaver: PVS 2044.

Missing std::nothrow.
This commit is contained in:
Adrien Destugues
2015-04-28 22:00:32 +02:00
parent 7dc68bfba5
commit ad077e2bd2
@@ -213,14 +213,12 @@ SpiderSaver::_Init(BRect bounds)
maxQueueDepth /= 4; maxQueueDepth /= 4;
} }
for (uint32 i = 0; i < fQueueNumber; i++) for (uint32 i = 0; i < fQueueNumber; i++)
fQueues[i] = new PolygonQueue(new Polygon(bounds, minPoints fQueues[i] = new PolygonQueue(new Polygon(bounds,
+ lrand48() minPoints + lrand48() % (maxPoints - minPoints)),
% (maxPoints minQueueDepth + lrand48() % (maxQueueDepth - minQueueDepth));
- minPoints)),
minQueueDepth + lrand48() % (maxQueueDepth
- minQueueDepth));
} }
// _Cleanup // _Cleanup
void void
SpiderSaver::_Cleanup() SpiderSaver::_Cleanup()
@@ -232,6 +230,7 @@ SpiderSaver::_Cleanup()
} }
} }
// _AllocBackBitmap // _AllocBackBitmap
void void
SpiderSaver::_AllocBackBitmap(float width, float height) SpiderSaver::_AllocBackBitmap(float width, float height)
@@ -241,11 +240,18 @@ SpiderSaver::_AllocBackBitmap(float width, float height)
return; return;
BRect b(0.0, 0.0, width, height); BRect b(0.0, 0.0, width, height);
fBackBitmap = new BBitmap(b, B_RGB32, true); fBackBitmap = new(std::nothrow) BBitmap(b, B_RGB32, true);
if (!fBackBitmap) if (!fBackBitmap)
return; return;
if (fBackBitmap->IsValid()) { if (fBackBitmap->IsValid()) {
fBackView = new BView(b, 0, B_FOLLOW_NONE, B_WILL_DRAW); fBackView = new(std::nothrow) BView(b, 0, B_FOLLOW_NONE, B_WILL_DRAW);
if (fBackView == NULL) {
_FreeBackBitmap();
fprintf(stderr,
"SpiderSaver::_AllocBackBitmap(): view allocation failed\n");
return;
}
fBackBitmap->AddChild(fBackView); fBackBitmap->AddChild(fBackView);
memset(fBackBitmap->Bits(), 0, fBackBitmap->BitsLength()); memset(fBackBitmap->Bits(), 0, fBackBitmap->BitsLength());
} else { } else {
@@ -254,6 +260,7 @@ SpiderSaver::_AllocBackBitmap(float width, float height)
} }
} }
// _FreeBackBitmap // _FreeBackBitmap
void void
SpiderSaver::_FreeBackBitmap() SpiderSaver::_FreeBackBitmap()
@@ -265,6 +272,7 @@ SpiderSaver::_FreeBackBitmap()
} }
} }
// _DrawInto // _DrawInto
void void
SpiderSaver::_DrawInto(BView *view) SpiderSaver::_DrawInto(BView *view)