Interface: Add casts to memcpy/memset invocations on BPoint & BRect.
Their copy constructors are exactly what GCC would generate, but we can't remove them because doing so would make them trivially copyable, and so they would be passed in registers on x86_64, an ABI breakage. So instead we have to add explicit casts to void* here.
This commit is contained in:
@@ -61,8 +61,8 @@ public:
|
||||
opSize = other.opSize;
|
||||
ptCount = other.ptCount;
|
||||
ptSize = other.ptSize;
|
||||
memcpy(opList, other.opList, opSize);
|
||||
memcpy(ptList, other.ptList, ptSize);
|
||||
memcpy((void*)opList, other.opList, opSize);
|
||||
memcpy((void*)ptList, other.ptList, ptSize);
|
||||
}
|
||||
|
||||
BRect DetermineBoundingBox() const
|
||||
|
||||
@@ -33,7 +33,7 @@ NudgePointsCommand::NudgePointsCommand(VectorPath* path,
|
||||
0.0,
|
||||
1.0,
|
||||
1.0,
|
||||
count > 1 ? B_TRANSLATE("Nudge Control Points") :
|
||||
count > 1 ? B_TRANSLATE("Nudge Control Points") :
|
||||
B_TRANSLATE("Nudge Control Point"),
|
||||
// count > 1 ? NUDGE_CONTROL_POINTS : NUDGE_CONTROL_POINT),
|
||||
-1),
|
||||
@@ -48,7 +48,7 @@ NudgePointsCommand::NudgePointsCommand(VectorPath* path,
|
||||
}
|
||||
if (fCount > 0 && points) {
|
||||
fPoints = new (nothrow) control_point[fCount];
|
||||
memcpy(fPoints, points, fCount * sizeof(control_point));
|
||||
memcpy((void*)fPoints, points, fCount * sizeof(control_point));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ TransformPointsCommand::TransformPointsCommand(
|
||||
return;
|
||||
|
||||
memcpy(fIndices, indices, fCount * sizeof(int32));
|
||||
memcpy(fPoints, points, fCount * sizeof(control_point));
|
||||
memcpy((void*)fPoints, points, fCount * sizeof(control_point));
|
||||
|
||||
if (fTransformBox)
|
||||
fTransformBox->AddListener(this);
|
||||
|
||||
@@ -126,7 +126,7 @@ draw_polygon(void* _context, size_t numPoints, const BPoint _points[],
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(points, _points, numPoints * sizeof(BPoint));
|
||||
memcpy((void*)points, _points, numPoints * sizeof(BPoint));
|
||||
|
||||
((void (*)(void*, int32, BPoint*, bool))
|
||||
context->function_table[fill ? 14 : 13])(context->user_data, numPoints,
|
||||
@@ -205,7 +205,7 @@ set_clipping_rects(void* _context, size_t numRects, const BRect _rects[])
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(rects, _rects, numRects * sizeof(BRect));
|
||||
memcpy((void*)rects, _rects, numRects * sizeof(BRect));
|
||||
|
||||
((void (*)(void*, BRect*, uint32))context->function_table[20])(
|
||||
context->user_data, rects, numRects);
|
||||
|
||||
@@ -164,7 +164,7 @@ BPolygon::_AddPoints(const BPoint* points, int32 count, bool computeBounds)
|
||||
return false;
|
||||
}
|
||||
|
||||
BPoint* newPoints = (BPoint*)realloc(fPoints, (fCount + count)
|
||||
BPoint* newPoints = (BPoint*)realloc((void*)fPoints, (fCount + count)
|
||||
* sizeof(BPoint));
|
||||
if (newPoints == NULL) {
|
||||
fprintf(stderr, "BPolygon::_AddPoints(%" B_PRId32 ") out of memory\n",
|
||||
@@ -173,7 +173,7 @@ BPolygon::_AddPoints(const BPoint* points, int32 count, bool computeBounds)
|
||||
}
|
||||
|
||||
fPoints = newPoints;
|
||||
memcpy(fPoints + fCount, points, count * sizeof(BPoint));
|
||||
memcpy((void*)(fPoints + fCount), points, count * sizeof(BPoint));
|
||||
fCount += count;
|
||||
|
||||
if (computeBounds)
|
||||
|
||||
@@ -336,7 +336,7 @@ BShape::AddShape(const BShape* otherShape)
|
||||
otherData->opCount * sizeof(uint32));
|
||||
data->opCount += otherData->opCount;
|
||||
|
||||
memcpy(data->ptList + data->ptCount, otherData->ptList,
|
||||
memcpy((void*)(data->ptList + data->ptCount), otherData->ptList,
|
||||
otherData->ptCount * sizeof(BPoint));
|
||||
data->ptCount += otherData->ptCount;
|
||||
|
||||
@@ -568,7 +568,7 @@ BShape::SetData(int32 opCount, int32 ptCount, const uint32* opList,
|
||||
fBuildingOp = data->opList[data->opCount - 1];
|
||||
|
||||
if (ptCount > 0) {
|
||||
memcpy(data->ptList, ptList, ptCount * sizeof(BPoint));
|
||||
memcpy((void*)data->ptList, ptList, ptCount * sizeof(BPoint));
|
||||
data->ptCount = ptCount;
|
||||
}
|
||||
}
|
||||
@@ -620,7 +620,8 @@ BShape::AllocatePts(int32 count)
|
||||
if (data->ptSize >= newSize)
|
||||
return true;
|
||||
|
||||
BPoint* resizedArray = (BPoint*)realloc(data->ptList, newSize * sizeof(BPoint));
|
||||
BPoint* resizedArray = (BPoint*)realloc((void*)data->ptList,
|
||||
newSize * sizeof(BPoint));
|
||||
if (resizedArray) {
|
||||
data->ptList = resizedArray;
|
||||
data->ptSize = newSize;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
|
||||
#define obj_new(type, n) ((type *)malloc ((n) * sizeof(type)))
|
||||
#define obj_renew(p, type, n) ((type *)realloc (p, (n) * sizeof(type)))
|
||||
#define obj_renew(p, type, n) ((type *)realloc ((void *)p, (n) * sizeof(type)))
|
||||
#define obj_free free
|
||||
|
||||
#define ALLOC_CHUNKS 20
|
||||
@@ -303,7 +303,7 @@ VectorPath::operator=(const VectorPath& from)
|
||||
_SetPointCount(from.fPointCount);
|
||||
fClosed = from.fClosed;
|
||||
if (fPath) {
|
||||
memcpy(fPath, from.fPath, fPointCount * sizeof(control_point));
|
||||
memcpy((void*)fPath, from.fPath, fPointCount * sizeof(control_point));
|
||||
fCachedBounds = from.fCachedBounds;
|
||||
} else {
|
||||
fprintf(stderr, "VectorPath() -> allocation failed in operator=!\n");
|
||||
|
||||
@@ -357,7 +357,7 @@ KeyboardLayout::_AddKey(const Key& key)
|
||||
if (fKeyCount + 1 > fKeyCapacity) {
|
||||
// enlarge array
|
||||
int32 newCapacity = fKeyCapacity + 32;
|
||||
Key* newKeys = (Key*)realloc(fKeys, newCapacity * sizeof(Key));
|
||||
Key* newKeys = (Key*)realloc((void*)fKeys, newCapacity * sizeof(Key));
|
||||
if (newKeys == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -498,7 +498,7 @@ clip_to_picture(void* _canvas, int32 pictureToken, const BPoint& where,
|
||||
ServerPicture* picture = canvas->GetPicture(pictureToken);
|
||||
if (picture == NULL)
|
||||
return;
|
||||
AlphaMask* mask = new(std::nothrow) PictureAlphaMask(canvas->GetAlphaMask(),
|
||||
AlphaMask* mask = new(std::nothrow) PictureAlphaMask(canvas->GetAlphaMask(),
|
||||
picture, *canvas->CurrentState(), where, clipToInverse);
|
||||
canvas->SetAlphaMask(mask);
|
||||
canvas->CurrentState()->GetAlphaMask()->SetCanvasGeometry(BPoint(0, 0),
|
||||
@@ -836,7 +836,7 @@ clip_to_shape(void* _canvas, int32 opCount, const uint32 opList[],
|
||||
shapeData.opList = (uint32*)malloc(opCount * sizeof(uint32));
|
||||
memcpy(shapeData.opList, opList, opCount * sizeof(uint32));
|
||||
shapeData.ptList = (BPoint*)malloc(ptCount * sizeof(BPoint));
|
||||
memcpy(shapeData.ptList, ptList, ptCount * sizeof(BPoint));
|
||||
memcpy((void*)shapeData.ptList, ptList, ptCount * sizeof(BPoint));
|
||||
|
||||
shapeData.opCount = opCount;
|
||||
shapeData.opSize = opCount * sizeof(uint32);
|
||||
|
||||
Reference in New Issue
Block a user