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:
Augustin Cavalier
2019-05-24 14:21:37 -04:00
parent 38b015579f
commit 1705656eac
10 changed files with 116 additions and 115 deletions
+90 -90
View File
@@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.4 // Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
// //
// Permission to copy, use, modify, sell and distribute this software // Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies. // is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied // This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose. // warranty, and with no claim as to its suitability for any purpose.
// //
@@ -23,9 +23,9 @@ namespace agg
{ {
//================================================render_scanline_aa_solid //================================================render_scanline_aa_solid
template<class Scanline, class BaseRenderer, class ColorT> template<class Scanline, class BaseRenderer, class ColorT>
void render_scanline_aa_solid(const Scanline& sl, void render_scanline_aa_solid(const Scanline& sl,
BaseRenderer& ren, BaseRenderer& ren,
const ColorT& color) const ColorT& color)
{ {
int y = sl.y(); int y = sl.y();
@@ -37,14 +37,14 @@ namespace agg
int x = span->x; int x = span->x;
if(span->len > 0) if(span->len > 0)
{ {
ren.blend_solid_hspan(x, y, (unsigned)span->len, ren.blend_solid_hspan(x, y, (unsigned)span->len,
color, color,
span->covers); span->covers);
} }
else else
{ {
ren.blend_hline(x, y, (unsigned)(x - span->len - 1), ren.blend_hline(x, y, (unsigned)(x - span->len - 1),
color, color,
*(span->covers)); *(span->covers));
} }
if(--num_spans == 0) break; if(--num_spans == 0) break;
@@ -53,16 +53,16 @@ namespace agg
} }
//===============================================render_scanlines_aa_solid //===============================================render_scanlines_aa_solid
template<class Rasterizer, class Scanline, template<class Rasterizer, class Scanline,
class BaseRenderer, class ColorT> class BaseRenderer, class ColorT>
void render_scanlines_aa_solid(Rasterizer& ras, Scanline& sl, void render_scanlines_aa_solid(Rasterizer& ras, Scanline& sl,
BaseRenderer& ren, const ColorT& color) BaseRenderer& ren, const ColorT& color)
{ {
if(ras.rewind_scanlines()) if(ras.rewind_scanlines())
{ {
// Explicitly convert "color" to the BaseRenderer color type. // Explicitly convert "color" to the BaseRenderer color type.
// For example, it can be called with color type "rgba", while // For example, it can be called with color type "rgba", while
// "rgba8" is needed. Otherwise it will be implicitly // "rgba8" is needed. Otherwise it will be implicitly
// converted in the loop many times. // converted in the loop many times.
//---------------------- //----------------------
typename BaseRenderer::color_type ren_color(color); typename BaseRenderer::color_type ren_color(color);
@@ -72,7 +72,7 @@ namespace agg
{ {
//render_scanline_aa_solid(sl, ren, ren_color); //render_scanline_aa_solid(sl, ren, ren_color);
// This code is equivalent to the above call (copy/paste). // This code is equivalent to the above call (copy/paste).
// It's just a "manual" optimization for old compilers, // It's just a "manual" optimization for old compilers,
// like Microsoft Visual C++ v6.0 // like Microsoft Visual C++ v6.0
//------------------------------- //-------------------------------
@@ -85,14 +85,14 @@ namespace agg
int x = span->x; int x = span->x;
if(span->len > 0) if(span->len > 0)
{ {
ren.blend_solid_hspan(x, y, (unsigned)span->len, ren.blend_solid_hspan(x, y, (unsigned)span->len,
ren_color, ren_color,
span->covers); span->covers);
} }
else else
{ {
ren.blend_hline(x, y, (unsigned)(x - span->len - 1), ren.blend_hline(x, y, (unsigned)(x - span->len - 1),
ren_color, ren_color,
*(span->covers)); *(span->covers));
} }
if(--num_spans == 0) break; if(--num_spans == 0) break;
@@ -116,7 +116,7 @@ namespace agg
{ {
m_ren = &ren; m_ren = &ren;
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void color(const color_type& c) { m_color = c; } void color(const color_type& c) { m_color = c; }
const color_type& color() const { return m_color; } const color_type& color() const { return m_color; }
@@ -129,7 +129,7 @@ namespace agg
{ {
render_scanline_aa_solid(sl, *m_ren, m_color); render_scanline_aa_solid(sl, *m_ren, m_color);
} }
private: private:
base_ren_type* m_ren; base_ren_type* m_ren;
color_type m_color; color_type m_color;
@@ -148,9 +148,9 @@ namespace agg
//======================================================render_scanline_aa //======================================================render_scanline_aa
template<class Scanline, class BaseRenderer, template<class Scanline, class BaseRenderer,
class SpanAllocator, class SpanGenerator> class SpanAllocator, class SpanGenerator>
void render_scanline_aa(const Scanline& sl, BaseRenderer& ren, void render_scanline_aa(const Scanline& sl, BaseRenderer& ren,
SpanAllocator& alloc, SpanGenerator& span_gen) SpanAllocator& alloc, SpanGenerator& span_gen)
{ {
int y = sl.y(); int y = sl.y();
@@ -166,7 +166,7 @@ namespace agg
if(len < 0) len = -len; if(len < 0) len = -len;
typename BaseRenderer::color_type* colors = alloc.allocate(len); typename BaseRenderer::color_type* colors = alloc.allocate(len);
span_gen.generate(colors, x, y, len); span_gen.generate(colors, x, y, len);
ren.blend_color_hspan(x, y, len, colors, ren.blend_color_hspan(x, y, len, colors,
(span->len < 0) ? 0 : covers, *covers); (span->len < 0) ? 0 : covers, *covers);
if(--num_spans == 0) break; if(--num_spans == 0) break;
@@ -175,9 +175,9 @@ namespace agg
} }
//=====================================================render_scanlines_aa //=====================================================render_scanlines_aa
template<class Rasterizer, class Scanline, class BaseRenderer, template<class Rasterizer, class Scanline, class BaseRenderer,
class SpanAllocator, class SpanGenerator> class SpanAllocator, class SpanGenerator>
void render_scanlines_aa(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, void render_scanlines_aa(Rasterizer& ras, Scanline& sl, BaseRenderer& ren,
SpanAllocator& alloc, SpanGenerator& span_gen) SpanAllocator& alloc, SpanGenerator& span_gen)
{ {
if(ras.rewind_scanlines()) if(ras.rewind_scanlines())
@@ -192,7 +192,7 @@ namespace agg
} }
//====================================================renderer_scanline_aa //====================================================renderer_scanline_aa
template<class BaseRenderer, class SpanAllocator, class SpanGenerator> template<class BaseRenderer, class SpanAllocator, class SpanGenerator>
class renderer_scanline_aa class renderer_scanline_aa
{ {
public: public:
@@ -202,22 +202,22 @@ namespace agg
//-------------------------------------------------------------------- //--------------------------------------------------------------------
renderer_scanline_aa() : m_ren(0), m_alloc(0), m_span_gen(0) {} renderer_scanline_aa() : m_ren(0), m_alloc(0), m_span_gen(0) {}
renderer_scanline_aa(base_ren_type& ren, renderer_scanline_aa(base_ren_type& ren,
alloc_type& alloc, alloc_type& alloc,
span_gen_type& span_gen) : span_gen_type& span_gen) :
m_ren(&ren), m_ren(&ren),
m_alloc(&alloc), m_alloc(&alloc),
m_span_gen(&span_gen) m_span_gen(&span_gen)
{} {}
void attach(base_ren_type& ren, void attach(base_ren_type& ren,
alloc_type& alloc, alloc_type& alloc,
span_gen_type& span_gen) span_gen_type& span_gen)
{ {
m_ren = &ren; m_ren = &ren;
m_alloc = &alloc; m_alloc = &alloc;
m_span_gen = &span_gen; m_span_gen = &span_gen;
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void prepare() { m_span_gen->prepare(); } void prepare() { m_span_gen->prepare(); }
@@ -239,21 +239,21 @@ namespace agg
//===============================================render_scanline_bin_solid //===============================================render_scanline_bin_solid
template<class Scanline, class BaseRenderer, class ColorT> template<class Scanline, class BaseRenderer, class ColorT>
void render_scanline_bin_solid(const Scanline& sl, void render_scanline_bin_solid(const Scanline& sl,
BaseRenderer& ren, BaseRenderer& ren,
const ColorT& color) const ColorT& color)
{ {
unsigned num_spans = sl.num_spans(); unsigned num_spans = sl.num_spans();
typename Scanline::const_iterator span = sl.begin(); typename Scanline::const_iterator span = sl.begin();
for(;;) for(;;)
{ {
ren.blend_hline(span->x, ren.blend_hline(span->x,
sl.y(), sl.y(),
span->x - 1 + ((span->len < 0) ? span->x - 1 + ((span->len < 0) ?
-span->len : -span->len :
span->len), span->len),
color, color,
cover_full); cover_full);
if(--num_spans == 0) break; if(--num_spans == 0) break;
++span; ++span;
@@ -261,16 +261,16 @@ namespace agg
} }
//==============================================render_scanlines_bin_solid //==============================================render_scanlines_bin_solid
template<class Rasterizer, class Scanline, template<class Rasterizer, class Scanline,
class BaseRenderer, class ColorT> class BaseRenderer, class ColorT>
void render_scanlines_bin_solid(Rasterizer& ras, Scanline& sl, void render_scanlines_bin_solid(Rasterizer& ras, Scanline& sl,
BaseRenderer& ren, const ColorT& color) BaseRenderer& ren, const ColorT& color)
{ {
if(ras.rewind_scanlines()) if(ras.rewind_scanlines())
{ {
// Explicitly convert "color" to the BaseRenderer color type. // Explicitly convert "color" to the BaseRenderer color type.
// For example, it can be called with color type "rgba", while // For example, it can be called with color type "rgba", while
// "rgba8" is needed. Otherwise it will be implicitly // "rgba8" is needed. Otherwise it will be implicitly
// converted in the loop many times. // converted in the loop many times.
//---------------------- //----------------------
typename BaseRenderer::color_type ren_color(color); typename BaseRenderer::color_type ren_color(color);
@@ -280,7 +280,7 @@ namespace agg
{ {
//render_scanline_bin_solid(sl, ren, ren_color); //render_scanline_bin_solid(sl, ren, ren_color);
// This code is equivalent to the above call (copy/paste). // This code is equivalent to the above call (copy/paste).
// It's just a "manual" optimization for old compilers, // It's just a "manual" optimization for old compilers,
// like Microsoft Visual C++ v6.0 // like Microsoft Visual C++ v6.0
//------------------------------- //-------------------------------
@@ -288,12 +288,12 @@ namespace agg
typename Scanline::const_iterator span = sl.begin(); typename Scanline::const_iterator span = sl.begin();
for(;;) for(;;)
{ {
ren.blend_hline(span->x, ren.blend_hline(span->x,
sl.y(), sl.y(),
span->x - 1 + ((span->len < 0) ? span->x - 1 + ((span->len < 0) ?
-span->len : -span->len :
span->len), span->len),
ren_color, ren_color,
cover_full); cover_full);
if(--num_spans == 0) break; if(--num_spans == 0) break;
++span; ++span;
@@ -316,7 +316,7 @@ namespace agg
{ {
m_ren = &ren; m_ren = &ren;
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void color(const color_type& c) { m_color = c; } void color(const color_type& c) { m_color = c; }
const color_type& color() const { return m_color; } const color_type& color() const { return m_color; }
@@ -329,7 +329,7 @@ namespace agg
{ {
render_scanline_bin_solid(sl, *m_ren, m_color); render_scanline_bin_solid(sl, *m_ren, m_color);
} }
private: private:
base_ren_type* m_ren; base_ren_type* m_ren;
color_type m_color; color_type m_color;
@@ -343,9 +343,9 @@ namespace agg
//======================================================render_scanline_bin //======================================================render_scanline_bin
template<class Scanline, class BaseRenderer, template<class Scanline, class BaseRenderer,
class SpanAllocator, class SpanGenerator> class SpanAllocator, class SpanGenerator>
void render_scanline_bin(const Scanline& sl, BaseRenderer& ren, void render_scanline_bin(const Scanline& sl, BaseRenderer& ren,
SpanAllocator& alloc, SpanGenerator& span_gen) SpanAllocator& alloc, SpanGenerator& span_gen)
{ {
int y = sl.y(); int y = sl.y();
@@ -359,16 +359,16 @@ namespace agg
if(len < 0) len = -len; if(len < 0) len = -len;
typename BaseRenderer::color_type* colors = alloc.allocate(len); typename BaseRenderer::color_type* colors = alloc.allocate(len);
span_gen.generate(colors, x, y, len); span_gen.generate(colors, x, y, len);
ren.blend_color_hspan(x, y, len, colors, 0, cover_full); ren.blend_color_hspan(x, y, len, colors, 0, cover_full);
if(--num_spans == 0) break; if(--num_spans == 0) break;
++span; ++span;
} }
} }
//=====================================================render_scanlines_bin //=====================================================render_scanlines_bin
template<class Rasterizer, class Scanline, class BaseRenderer, template<class Rasterizer, class Scanline, class BaseRenderer,
class SpanAllocator, class SpanGenerator> class SpanAllocator, class SpanGenerator>
void render_scanlines_bin(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, void render_scanlines_bin(Rasterizer& ras, Scanline& sl, BaseRenderer& ren,
SpanAllocator& alloc, SpanGenerator& span_gen) SpanAllocator& alloc, SpanGenerator& span_gen)
{ {
if(ras.rewind_scanlines()) if(ras.rewind_scanlines())
@@ -383,7 +383,7 @@ namespace agg
} }
//====================================================renderer_scanline_bin //====================================================renderer_scanline_bin
template<class BaseRenderer, class SpanAllocator, class SpanGenerator> template<class BaseRenderer, class SpanAllocator, class SpanGenerator>
class renderer_scanline_bin class renderer_scanline_bin
{ {
public: public:
@@ -393,22 +393,22 @@ namespace agg
//-------------------------------------------------------------------- //--------------------------------------------------------------------
renderer_scanline_bin() : m_ren(0), m_alloc(0), m_span_gen(0) {} renderer_scanline_bin() : m_ren(0), m_alloc(0), m_span_gen(0) {}
renderer_scanline_bin(base_ren_type& ren, renderer_scanline_bin(base_ren_type& ren,
alloc_type& alloc, alloc_type& alloc,
span_gen_type& span_gen) : span_gen_type& span_gen) :
m_ren(&ren), m_ren(&ren),
m_alloc(&alloc), m_alloc(&alloc),
m_span_gen(&span_gen) m_span_gen(&span_gen)
{} {}
void attach(base_ren_type& ren, void attach(base_ren_type& ren,
alloc_type& alloc, alloc_type& alloc,
span_gen_type& span_gen) span_gen_type& span_gen)
{ {
m_ren = &ren; m_ren = &ren;
m_alloc = &alloc; m_alloc = &alloc;
m_span_gen = &span_gen; m_span_gen = &span_gen;
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void prepare() { m_span_gen->prepare(); } void prepare() { m_span_gen->prepare(); }
@@ -449,13 +449,13 @@ namespace agg
} }
//========================================================render_all_paths //========================================================render_all_paths
template<class Rasterizer, class Scanline, class Renderer, template<class Rasterizer, class Scanline, class Renderer,
class VertexSource, class ColorStorage, class PathId> class VertexSource, class ColorStorage, class PathId>
void render_all_paths(Rasterizer& ras, void render_all_paths(Rasterizer& ras,
Scanline& sl, Scanline& sl,
Renderer& r, Renderer& r,
VertexSource& vs, VertexSource& vs,
const ColorStorage& as, const ColorStorage& as,
const PathId& path_id, const PathId& path_id,
unsigned num_paths) unsigned num_paths)
{ {
@@ -477,13 +477,13 @@ namespace agg
//=============================================render_scanlines_compound //=============================================render_scanlines_compound
template<class Rasterizer, template<class Rasterizer,
class ScanlineAA, class ScanlineAA,
class ScanlineBin, class ScanlineBin,
class BaseRenderer, class BaseRenderer,
class SpanAllocator, class SpanAllocator,
class StyleHandler> class StyleHandler>
void render_scanlines_compound(Rasterizer& ras, void render_scanlines_compound(Rasterizer& ras,
ScanlineAA& sl_aa, ScanlineAA& sl_aa,
ScanlineBin& sl_bin, ScanlineBin& sl_bin,
BaseRenderer& ren, BaseRenderer& ren,
@@ -530,14 +530,14 @@ namespace agg
for(;;) for(;;)
{ {
len = span_aa->len; len = span_aa->len;
sh.generate_span(color_span, sh.generate_span(color_span,
span_aa->x, span_aa->x,
sl_aa.y(), sl_aa.y(),
len, len,
style); style);
ren.blend_color_hspan(span_aa->x, ren.blend_color_hspan(span_aa->x,
sl_aa.y(), sl_aa.y(),
span_aa->len, span_aa->len,
color_span, color_span,
span_aa->covers); span_aa->covers);
@@ -554,12 +554,12 @@ 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));
memset(cover_buffer + sl_start - min_x, memset(cover_buffer + sl_start - min_x,
0, 0,
sl_len * sizeof(cover_type)); sl_len * sizeof(cover_type));
int sl_y = 0x7FFFFFFF; int sl_y = 0x7FFFFFFF;
@@ -620,10 +620,10 @@ namespace agg
len = span_aa->len; len = span_aa->len;
colors = mix_buffer + span_aa->x - min_x; colors = mix_buffer + span_aa->x - min_x;
cspan = color_span; cspan = color_span;
sh.generate_span(cspan, sh.generate_span(cspan,
span_aa->x, span_aa->x,
sl_aa.y(), sl_aa.y(),
len, len,
style); style);
src_covers = span_aa->covers; src_covers = span_aa->covers;
dst_covers = cover_buffer + span_aa->x - min_x; dst_covers = cover_buffer + span_aa->x - min_x;
@@ -651,8 +651,8 @@ namespace agg
} }
} }
} }
ren.blend_color_hspan(sl_start, ren.blend_color_hspan(sl_start,
sl_y, sl_y,
sl_len, sl_len,
mix_buffer + sl_start - min_x, mix_buffer + sl_start - min_x,
0, 0,
@@ -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) {
@@ -27,8 +27,8 @@ virtual ~_BTextViewSupportBuffer_();
int32 ItemCount() const; int32 ItemCount() const;
protected: protected:
int32 fExtraCount; int32 fExtraCount;
int32 fItemCount; int32 fItemCount;
int32 fBufferCount; int32 fBufferCount;
T* fBuffer; T* fBuffer;
}; };
@@ -61,7 +61,7 @@ _BTextViewSupportBuffer_<T>::InsertItemsAt(int32 inNumItems,
{ {
if (inNumItems < 1) if (inNumItems < 1)
return; return;
inAtIndex = (inAtIndex > fItemCount) ? fItemCount : inAtIndex; inAtIndex = (inAtIndex > fItemCount) ? fItemCount : inAtIndex;
inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex; inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex;
@@ -69,15 +69,16 @@ _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;
} }
@@ -89,14 +90,14 @@ _BTextViewSupportBuffer_<T>::RemoveItemsAt(int32 inNumItems,
{ {
if (inNumItems < 1) if (inNumItems < 1)
return; return;
inAtIndex = (inAtIndex > fItemCount - 1) ? (fItemCount - 1) : inAtIndex; inAtIndex = (inAtIndex > fItemCount - 1) ? (fItemCount - 1) : inAtIndex;
inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex; inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex;
T* loc = fBuffer + inAtIndex; T* loc = fBuffer + inAtIndex;
memmove(loc, loc + inNumItems, memmove(loc, loc + inNumItems,
(fItemCount - (inNumItems + inAtIndex)) * sizeof(T)); (fItemCount - (inNumItems + inAtIndex)) * sizeof(T));
int32 delta = inNumItems * sizeof(T); int32 delta = inNumItems * sizeof(T);
int32 logSize = fItemCount * sizeof(T); int32 logSize = fItemCount * sizeof(T);
uint32 extraSize = fBufferCount - (logSize - delta); uint32 extraSize = fBufferCount - (logSize - delta);
@@ -106,7 +107,7 @@ _BTextViewSupportBuffer_<T>::RemoveItemsAt(int32 inNumItems,
if (fBuffer == NULL) if (fBuffer == NULL)
debugger("RemoveItemsAt(): reallocation failed"); debugger("RemoveItemsAt(): reallocation failed");
} }
fItemCount -= inNumItems; fItemCount -= inNumItems;
} }
+3 -3
View File
@@ -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++) {
@@ -405,7 +405,7 @@ SavePalette::IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha)
} }
} else { } else {
int closestDistance = 255 * 255 * 3; int closestDistance = 255 * 255 * 3;
if (fTransparentMode == AUTO_TRANSPARENCY) { if (fTransparentMode == AUTO_TRANSPARENCY) {
for (int i = 0; i < fTransparentIndex && closestDistance != 0; for (int i = 0; i < fTransparentIndex && closestDistance != 0;
i++) { 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));
} }
} }
} }
+1 -1
View File
@@ -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));
} }
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+3 -3
View File
@@ -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;
@@ -322,7 +322,7 @@ VectorPath::operator==(const VectorPath& other) const
{ {
if (fClosed != other.fClosed) if (fClosed != other.fClosed)
return false; return false;
if (fPointCount != other.fPointCount) if (fPointCount != other.fPointCount)
return false; return false;
@@ -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));
} }
} }
+1 -1
View File
@@ -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;