Add (void*) casts to memcpy/memset invocations to appease GCC 8.
A lot of these classes are not *technically* "trivially copyable" for one reason or another, but in all of these cases it seems OK to me to use memcpy/memset on them. Adding a cast to void* tells GCC that "I know what I'm doing here" and shuts up the warning.
This commit is contained in:
parent
38b015579f
commit
1705656eac
@ -554,7 +554,7 @@ namespace agg
|
||||
|
||||
if(sl_len)
|
||||
{
|
||||
memset(mix_buffer + sl_start - min_x,
|
||||
memset((void*)(mix_buffer + sl_start - min_x),
|
||||
0,
|
||||
sl_len * sizeof(color_type));
|
||||
|
||||
|
@ -72,7 +72,7 @@ struct ValuePieceLocation {
|
||||
|
||||
bool Copy(const ValuePieceLocation& other)
|
||||
{
|
||||
memcpy(this, &other, sizeof(ValuePieceLocation));
|
||||
memcpy((void*)this, (void*)&other, sizeof(ValuePieceLocation));
|
||||
if (type == VALUE_PIECE_LOCATION_IMPLICIT) {
|
||||
void* tempValue = malloc(size);
|
||||
if (tempValue == NULL) {
|
||||
|
@ -69,14 +69,15 @@ _BTextViewSupportBuffer_<T>::InsertItemsAt(int32 inNumItems,
|
||||
int32 logSize = fItemCount * sizeof(T);
|
||||
if ((logSize + delta) >= fBufferCount) {
|
||||
fBufferCount = logSize + delta + (fExtraCount * sizeof(T));
|
||||
fBuffer = (T*)realloc(fBuffer, fBufferCount);
|
||||
fBuffer = (T*)realloc((void*)fBuffer, fBufferCount);
|
||||
if (fBuffer == NULL)
|
||||
debugger("InsertItemsAt(): reallocation failed");
|
||||
}
|
||||
|
||||
T* loc = fBuffer + inAtIndex;
|
||||
memmove(loc + inNumItems, loc, (fItemCount - inAtIndex) * sizeof(T));
|
||||
memcpy(loc, inItem, delta);
|
||||
memmove((void*)(loc + inNumItems), (void*)loc,
|
||||
(fItemCount - inAtIndex) * sizeof(T));
|
||||
memcpy((void*)loc, (void*)inItem, delta);
|
||||
|
||||
fItemCount += inNumItems;
|
||||
}
|
||||
|
@ -198,11 +198,11 @@ SavePalette::SavePalette(int mode)
|
||||
{
|
||||
if (IsValid()) {
|
||||
if (fMode == WEB_SAFE_PALETTE) {
|
||||
memcpy(pal, wsp, sizeof(rgb_color) * 256);
|
||||
memcpy((void*)pal, wsp, sizeof(rgb_color) * 256);
|
||||
fSize = 216;
|
||||
} else if (fMode == BEOS_SYSTEM_PALETTE) {
|
||||
color_map* map = (color_map*)system_colors();
|
||||
memcpy(pal, map->color_list, sizeof(rgb_color) * 256);
|
||||
memcpy((void*)pal, map->color_list, sizeof(rgb_color) * 256);
|
||||
fSize = 256;
|
||||
} else if (fMode == GREYSCALE_PALETTE) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
|
@ -57,7 +57,7 @@ TransformPointsBox::TransformPointsBox(CanvasView* view,
|
||||
fPoints[i].point_out.x, fPoints[i].point_out.y);
|
||||
bounds = bounds | dummy;
|
||||
} else {
|
||||
memset(&fPoints[i], 0, sizeof(control_point));
|
||||
memset((void*)&fPoints[i], 0, sizeof(control_point));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ BVariant::_SetTo(const BVariant& other)
|
||||
other.fReferenceable->AcquireReference();
|
||||
}
|
||||
|
||||
memcpy(this, &other, sizeof(BVariant));
|
||||
memcpy((void*)this, (void*)&other, sizeof(BVariant));
|
||||
}
|
||||
|
||||
|
||||
|
@ -474,7 +474,7 @@ OpenHashElementArray<Element>::Add()
|
||||
memcpy(newData, fData, fSize * sizeof(Element));
|
||||
free(fData);
|
||||
*/
|
||||
Element *newData = (Element*)realloc(fData,
|
||||
Element *newData = (Element*)realloc((void*)fData,
|
||||
(size_t)newSize * sizeof(Element));
|
||||
if (!newData)
|
||||
return NULL;
|
||||
|
@ -788,7 +788,7 @@ BPoseView::SavePoseLocations(BRect* frameIfDesktop)
|
||||
extendedPoseInfo = (ExtendedPoseInfo*)
|
||||
new char [size];
|
||||
|
||||
memset(extendedPoseInfo, 0, size);
|
||||
memset((void*)extendedPoseInfo, 0, size);
|
||||
extendedPoseInfo->fWorkspaces = 0xffffffff;
|
||||
extendedPoseInfo->fInvisible = false;
|
||||
extendedPoseInfo->fShowFromBootOnly = false;
|
||||
|
@ -145,7 +145,7 @@ VectorPath::VectorPath(BMessage* archive)
|
||||
if (archive->GetInfo("point", &typeFound, &countFound) >= B_OK
|
||||
&& typeFound == B_POINT_TYPE
|
||||
&& _SetPointCount(countFound)) {
|
||||
memset(fPath, 0, fAllocCount * sizeof(control_point));
|
||||
memset((void*)fPath, 0, fAllocCount * sizeof(control_point));
|
||||
|
||||
BPoint point;
|
||||
BPoint pointIn;
|
||||
@ -1073,7 +1073,7 @@ VectorPath::_SetPointCount(int32 count)
|
||||
fPath = obj_new(control_point, fAllocCount);
|
||||
|
||||
if (fPath != NULL) {
|
||||
memset(fPath + fPointCount, 0,
|
||||
memset((void*)(fPath + fPointCount), 0,
|
||||
(fAllocCount - fPointCount) * sizeof(control_point));
|
||||
}
|
||||
}
|
||||
|
@ -842,7 +842,7 @@ KeyboardLayout::_InitFrom(const char* data)
|
||||
state.mode = kKeyShape;
|
||||
break;
|
||||
case kKeyShape:
|
||||
memset(&key, 0, sizeof(Key));
|
||||
memset((void*)&key, 0, sizeof(Key));
|
||||
if (!_GetShape(state, term.String(), key))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user