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:
@@ -554,7 +554,7 @@ namespace agg
|
|||||||
|
|
||||||
if(sl_len)
|
if(sl_len)
|
||||||
{
|
{
|
||||||
memset(mix_buffer + sl_start - min_x,
|
memset((void*)(mix_buffer + sl_start - min_x),
|
||||||
0,
|
0,
|
||||||
sl_len * sizeof(color_type));
|
sl_len * sizeof(color_type));
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ struct ValuePieceLocation {
|
|||||||
|
|
||||||
bool Copy(const ValuePieceLocation& other)
|
bool Copy(const ValuePieceLocation& other)
|
||||||
{
|
{
|
||||||
memcpy(this, &other, sizeof(ValuePieceLocation));
|
memcpy((void*)this, (void*)&other, sizeof(ValuePieceLocation));
|
||||||
if (type == VALUE_PIECE_LOCATION_IMPLICIT) {
|
if (type == VALUE_PIECE_LOCATION_IMPLICIT) {
|
||||||
void* tempValue = malloc(size);
|
void* tempValue = malloc(size);
|
||||||
if (tempValue == NULL) {
|
if (tempValue == NULL) {
|
||||||
|
|||||||
@@ -69,14 +69,15 @@ _BTextViewSupportBuffer_<T>::InsertItemsAt(int32 inNumItems,
|
|||||||
int32 logSize = fItemCount * sizeof(T);
|
int32 logSize = fItemCount * sizeof(T);
|
||||||
if ((logSize + delta) >= fBufferCount) {
|
if ((logSize + delta) >= fBufferCount) {
|
||||||
fBufferCount = logSize + delta + (fExtraCount * sizeof(T));
|
fBufferCount = logSize + delta + (fExtraCount * sizeof(T));
|
||||||
fBuffer = (T*)realloc(fBuffer, fBufferCount);
|
fBuffer = (T*)realloc((void*)fBuffer, fBufferCount);
|
||||||
if (fBuffer == NULL)
|
if (fBuffer == NULL)
|
||||||
debugger("InsertItemsAt(): reallocation failed");
|
debugger("InsertItemsAt(): reallocation failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
T* loc = fBuffer + inAtIndex;
|
T* loc = fBuffer + inAtIndex;
|
||||||
memmove(loc + inNumItems, loc, (fItemCount - inAtIndex) * sizeof(T));
|
memmove((void*)(loc + inNumItems), (void*)loc,
|
||||||
memcpy(loc, inItem, delta);
|
(fItemCount - inAtIndex) * sizeof(T));
|
||||||
|
memcpy((void*)loc, (void*)inItem, delta);
|
||||||
|
|
||||||
fItemCount += inNumItems;
|
fItemCount += inNumItems;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,11 +198,11 @@ SavePalette::SavePalette(int mode)
|
|||||||
{
|
{
|
||||||
if (IsValid()) {
|
if (IsValid()) {
|
||||||
if (fMode == WEB_SAFE_PALETTE) {
|
if (fMode == WEB_SAFE_PALETTE) {
|
||||||
memcpy(pal, wsp, sizeof(rgb_color) * 256);
|
memcpy((void*)pal, wsp, sizeof(rgb_color) * 256);
|
||||||
fSize = 216;
|
fSize = 216;
|
||||||
} else if (fMode == BEOS_SYSTEM_PALETTE) {
|
} else if (fMode == BEOS_SYSTEM_PALETTE) {
|
||||||
color_map* map = (color_map*)system_colors();
|
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;
|
fSize = 256;
|
||||||
} else if (fMode == GREYSCALE_PALETTE) {
|
} else if (fMode == GREYSCALE_PALETTE) {
|
||||||
for (int i = 0; i < 256; i++) {
|
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);
|
fPoints[i].point_out.x, fPoints[i].point_out.y);
|
||||||
bounds = bounds | dummy;
|
bounds = bounds | dummy;
|
||||||
} else {
|
} 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();
|
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));
|
memcpy(newData, fData, fSize * sizeof(Element));
|
||||||
free(fData);
|
free(fData);
|
||||||
*/
|
*/
|
||||||
Element *newData = (Element*)realloc(fData,
|
Element *newData = (Element*)realloc((void*)fData,
|
||||||
(size_t)newSize * sizeof(Element));
|
(size_t)newSize * sizeof(Element));
|
||||||
if (!newData)
|
if (!newData)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -788,7 +788,7 @@ BPoseView::SavePoseLocations(BRect* frameIfDesktop)
|
|||||||
extendedPoseInfo = (ExtendedPoseInfo*)
|
extendedPoseInfo = (ExtendedPoseInfo*)
|
||||||
new char [size];
|
new char [size];
|
||||||
|
|
||||||
memset(extendedPoseInfo, 0, size);
|
memset((void*)extendedPoseInfo, 0, size);
|
||||||
extendedPoseInfo->fWorkspaces = 0xffffffff;
|
extendedPoseInfo->fWorkspaces = 0xffffffff;
|
||||||
extendedPoseInfo->fInvisible = false;
|
extendedPoseInfo->fInvisible = false;
|
||||||
extendedPoseInfo->fShowFromBootOnly = false;
|
extendedPoseInfo->fShowFromBootOnly = false;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ VectorPath::VectorPath(BMessage* archive)
|
|||||||
if (archive->GetInfo("point", &typeFound, &countFound) >= B_OK
|
if (archive->GetInfo("point", &typeFound, &countFound) >= B_OK
|
||||||
&& typeFound == B_POINT_TYPE
|
&& typeFound == B_POINT_TYPE
|
||||||
&& _SetPointCount(countFound)) {
|
&& _SetPointCount(countFound)) {
|
||||||
memset(fPath, 0, fAllocCount * sizeof(control_point));
|
memset((void*)fPath, 0, fAllocCount * sizeof(control_point));
|
||||||
|
|
||||||
BPoint point;
|
BPoint point;
|
||||||
BPoint pointIn;
|
BPoint pointIn;
|
||||||
@@ -1073,7 +1073,7 @@ VectorPath::_SetPointCount(int32 count)
|
|||||||
fPath = obj_new(control_point, fAllocCount);
|
fPath = obj_new(control_point, fAllocCount);
|
||||||
|
|
||||||
if (fPath != NULL) {
|
if (fPath != NULL) {
|
||||||
memset(fPath + fPointCount, 0,
|
memset((void*)(fPath + fPointCount), 0,
|
||||||
(fAllocCount - fPointCount) * sizeof(control_point));
|
(fAllocCount - fPointCount) * sizeof(control_point));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -842,7 +842,7 @@ KeyboardLayout::_InitFrom(const char* data)
|
|||||||
state.mode = kKeyShape;
|
state.mode = kKeyShape;
|
||||||
break;
|
break;
|
||||||
case kKeyShape:
|
case kKeyShape:
|
||||||
memset(&key, 0, sizeof(Key));
|
memset((void*)&key, 0, sizeof(Key));
|
||||||
if (!_GetShape(state, term.String(), key))
|
if (!_GetShape(state, term.String(), key))
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user