hrev53160 adds 11 changesets to branch 'master'
old head: 1e78ac952310c9cb542a49473127a76e968e3d9f
new head: f7397837e8e8749d0a2cdf2725262f00ccd74995
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=f7397837e8e8+%5E1e78ac952310
----------------------------------------------------------------------------
fef13fb917b8: ArchitectureRules: Add -Wno-error=format-truncation for GCC 8.
It warns on snprintf's output "possibly" being truncated (e.g.,
two B_PATH_NAME_LENGTH chars being concatenated together) which may
be exactly the behavior the programmer wanted. So that's not very
helpful.
7a73df5e2cdd: Debugger: Remove needless explicit copy constructors.
These worked in identical fashion to what the default copy
constructors would be, but their mere presence marks the class
as being "non-trivially copyable," which means that memcpy'ing
it is now a -Werror on GCC 8.
We have to be careful when making this change, though: classes
which *are* trivially copyable can be passed inside registers
on x86_64, so changes like these break ABI in a dangerous way.
These classes is private, so it should not be a problem, but
for other classes (e.g. BRect, BPoint) we cannot fix them
properly right now.
38b015579ff6: Media: Use assignment operators instead of memset.
Spotted by GCC 8 -Werror=class-memaccess.
1705656eac83: 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.
5b189b0e1e2f: HaikuDepot & PoorMan: Disable -Werror.
Unlike the last commit, I am not sure whether the memcpy/memsets
in here are properly safe to do. (They look OK, but a lot of them
involve template classes that probably should not make such
assumptions.)
But the code has worked so far, so let's disable the -Werror so
we can move forward with GCC 8 for now.
a1ad8af64e5a: Change a number of sprintf to snprintf.
Fixes a number of -Werrors about format overflow from GCC 8.
43005c192550: libroot: Include emmintrin instead of x86intrin.
We only need one builtin here, not 8 files of them.
17089e9ae5dc: Terminal: Remove a copy constructor and assignment operator.
bac6edf06f8a: ArchitectureRules: Clean up GCC >= 3 logic & disable -Werror for
netfs.
632e7fd0a8ae: Interface Kit: Remove no-op TARGET_PLATFORM_HAIKU_COMPATIBLE.
f7397837e8e8: BMessage: Use assignment operator instead of memcpy().
The only non-POD types the macro is used on are BPoint, BRect, BSize,
and rgb_color, so the first change should essentially be a no-op.
The second change will technically have different behavior,
as the BMessenger copy constructor does not touch the _reserved_
field; but this shouldn't break anything, of course.
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
32 files changed, 313 insertions(+), 368 deletions(-)
build/jam/ArchitectureRules | 37 ++-
headers/libs/agg/agg_renderer_scanline.h | 180 +++++++-------
headers/private/debugger/arch/Register.h | 1 -
headers/private/debugger/types/SourceLocation.h | 14 --
.../private/debugger/types/TargetAddressRange.h | 14 --
headers/private/debugger/types/ValueLocation.h | 2 +-
.../private/interface/TextViewSupportBuffer.h | 27 +-
.../media-add-ons/opensound/OpenSoundDevice.cpp | 34 +--
.../media-add-ons/opensound/OpenSoundNode.cpp | 2 +-
src/add-ons/translators/gif/SavePalette.cpp | 6 +-
src/apps/cortex/TransportView/TransportView.cpp | 248 +++++++++----------
.../addons/LoggingConsumer/LoggingConsumer.cpp | 2 +-
src/apps/haikudepot/Jamfile | 5 +-
.../transformable/TransformPointsBox.cpp | 2 +-
src/apps/mail/Content.cpp | 12 +-
src/apps/mail/Status.cpp | 3 +-
src/apps/poorman/Jamfile | 11 +-
src/apps/terminal/TermParse.cpp | 7 +-
src/apps/terminal/TermPos.h | 8 -
src/kits/app/Message.cpp | 20 +-
src/kits/debugger/arch/Register.cpp | 13 -
src/kits/interface/Jamfile | 5 -
src/kits/shared/Variant.cpp | 2 +-
src/kits/storage/mime/AssociatedTypes.cpp | 3 +-
src/kits/storage/mime/SnifferRules.cpp | 3 +-
src/kits/tracker/FSUtils.cpp | 4 +-
src/kits/tracker/OpenHashTable.h | 2 +-
src/kits/tracker/PoseView.cpp | 2 +-
src/libs/icon/shape/VectorPath.cpp | 6 +-
src/preferences/keymap/KeyboardLayout.cpp | 2 +-
src/preferences/media/MediaViews.cpp | 2 +-
.../posix/string/arch/x86_64/arch_string.cpp | 2 +-
############################################################################
Commit: fef13fb917b88a0e7e9b008ebbca82a6ddd68bb5
URL: https://git.haiku-os.org/haiku/commit/?id=fef13fb917b8
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Thu May 23 23:50:51 2019 UTC
ArchitectureRules: Add -Wno-error=format-truncation for GCC 8.
It warns on snprintf's output "possibly" being truncated (e.g.,
two B_PATH_NAME_LENGTH chars being concatenated together) which may
be exactly the behavior the programmer wanted. So that's not very
helpful.
----------------------------------------------------------------------------
diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 4e3100621b..b91d689b8f 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -139,8 +139,9 @@ rule ArchitectureSetup architecture
HAIKU_WERROR_FLAGS_$(architecture) +=
-Wno-error=unused-but-set-variable
-Wno-error=deprecated -Wno-error=deprecated-declarations
-Wno-error=cpp -Wno-error=trigraphs ;
- # But this one can stay.
- HAIKU_WERROR_FLAGS_$(architecture) += -Wno-error=cast-align ;
+ # But these can stay.
+ HAIKU_WERROR_FLAGS_$(architecture) += -Wno-error=cast-align
+ -Wno-error=format-truncation ;
}
# debug flags
############################################################################
Commit: 7a73df5e2cdddb9dee833799ab428d2d3fcaf64a
URL: https://git.haiku-os.org/haiku/commit/?id=7a73df5e2cdd
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:17:02 2019 UTC
Debugger: Remove needless explicit copy constructors.
These worked in identical fashion to what the default copy
constructors would be, but their mere presence marks the class
as being "non-trivially copyable," which means that memcpy'ing
it is now a -Werror on GCC 8.
We have to be careful when making this change, though: classes
which *are* trivially copyable can be passed inside registers
on x86_64, so changes like these break ABI in a dangerous way.
These classes is private, so it should not be a problem, but
for other classes (e.g. BRect, BPoint) we cannot fix them
properly right now.
----------------------------------------------------------------------------
diff --git a/headers/private/debugger/arch/Register.h
b/headers/private/debugger/arch/Register.h
index 46f28cea6c..df50d9a9eb 100644
--- a/headers/private/debugger/arch/Register.h
+++ b/headers/private/debugger/arch/Register.h
@@ -32,7 +32,6 @@ public:
uint32
bitSize, uint32 valueType,
register_type type, bool calleePreserved);
// name will not be cloned
- Register(const
Register& other);
int32 Index() const
{ return fIndex; }
const char* Name() const
{ return fName; }
diff --git a/headers/private/debugger/types/SourceLocation.h
b/headers/private/debugger/types/SourceLocation.h
index d224463b1e..98c1f1bc71 100644
--- a/headers/private/debugger/types/SourceLocation.h
+++ b/headers/private/debugger/types/SourceLocation.h
@@ -17,20 +17,6 @@ public:
{
}
- SourceLocation(const SourceLocation& other)
- :
- fLine(other.fLine),
- fColumn(other.fColumn)
- {
- }
-
- SourceLocation& operator=(const SourceLocation& other)
- {
- fLine = other.fLine;
- fColumn = other.fColumn;
- return *this;
- }
-
bool operator==(const SourceLocation& other) const
{
return fLine == other.fLine && fColumn == other.fColumn;
diff --git a/headers/private/debugger/types/TargetAddressRange.h
b/headers/private/debugger/types/TargetAddressRange.h
index 74feac6d9c..81d3e49af8 100644
--- a/headers/private/debugger/types/TargetAddressRange.h
+++ b/headers/private/debugger/types/TargetAddressRange.h
@@ -26,20 +26,6 @@ public:
{
}
- TargetAddressRange(const TargetAddressRange& other)
- :
- fStart(other.fStart),
- fSize(other.fSize)
- {
- }
-
- TargetAddressRange& operator=(const TargetAddressRange& other)
- {
- fStart = other.fStart;
- fSize = other.fSize;
- return *this;
- }
-
bool operator==(const TargetAddressRange& other) const
{
return fStart == other.fStart && fSize == other.fSize;
diff --git a/src/kits/debugger/arch/Register.cpp
b/src/kits/debugger/arch/Register.cpp
index cf17f8a526..e7f640ae5c 100644
--- a/src/kits/debugger/arch/Register.cpp
+++ b/src/kits/debugger/arch/Register.cpp
@@ -43,16 +43,3 @@ Register::Register(int32 index, const char* name, uint32
bitSize,
break;
}
}
-
-
-Register::Register(const Register& other)
- :
- fIndex(other.fIndex),
- fName(other.fName),
- fBitSize(other.fBitSize),
- fValueType(other.fValueType),
- fFormat(other.fFormat),
- fType(other.fType),
- fCalleePreserved(other.fCalleePreserved)
-{
-}
############################################################################
Commit: 38b015579ff6f59763abc5ec499e401f34c3be98
URL: https://git.haiku-os.org/haiku/commit/?id=38b015579ff6
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:19:07 2019 UTC
Media: Use assignment operators instead of memset.
Spotted by GCC 8 -Werror=class-memaccess.
----------------------------------------------------------------------------
diff --git a/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp
b/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp
index cf453ded4f..9fcbf37963 100644
--- a/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp
+++ b/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp
@@ -61,12 +61,12 @@ uint32
OpenSoundDevice::convert_oss_format_to_media_format(int fmt)
{
if (fmt & AFMT_FLOAT)
return media_raw_audio_format::B_AUDIO_FLOAT;
- if (fmt & AFMT_S32_LE ||
- fmt & AFMT_S24_LE ||
- fmt & AFMT_S32_BE ||
+ if (fmt & AFMT_S32_LE ||
+ fmt & AFMT_S24_LE ||
+ fmt & AFMT_S32_BE ||
fmt & AFMT_S24_BE)
return media_raw_audio_format::B_AUDIO_INT;
- if (fmt & AFMT_S16_LE ||
+ if (fmt & AFMT_S16_LE ||
fmt & AFMT_S16_BE) /* U16 unsupported */
return media_raw_audio_format::B_AUDIO_SHORT;
if (fmt & AFMT_S8)
@@ -81,15 +81,15 @@ int OpenSoundDevice::convert_oss_format_to_endian(int fmt)
{
if (fmt & AFMT_FLOAT)
return B_MEDIA_HOST_ENDIAN;
- if (fmt & AFMT_S32_LE ||
- fmt & AFMT_S24_LE ||
- fmt & AFMT_S16_LE ||
- fmt & AFMT_U16_LE ||
+ if (fmt & AFMT_S32_LE ||
+ fmt & AFMT_S24_LE ||
+ fmt & AFMT_S16_LE ||
+ fmt & AFMT_U16_LE ||
fmt & AFMT_S24_PACKED)
return B_MEDIA_LITTLE_ENDIAN;
- if (fmt & AFMT_S32_BE ||
- fmt & AFMT_S24_BE ||
- fmt & AFMT_S16_BE ||
+ if (fmt & AFMT_S32_BE ||
+ fmt & AFMT_S24_BE ||
+ fmt & AFMT_S16_BE ||
fmt & AFMT_U16_BE)
return B_MEDIA_BIG_ENDIAN;
if (fmt & AFMT_S8 ||
@@ -189,7 +189,7 @@ status_t
OpenSoundDevice::get_media_format_description_for(int fmt, media_format
{
int i;
for (i = 0; i < count; i++)
- memset(&desc[i], 0, sizeof(media_format_description));
+ desc[i] = media_format_description();
if (count < 1)
return 0;
if (fmt & AFMT_SUPPORTED_PCM) {
@@ -366,13 +366,13 @@ status_t OpenSoundDevice::InitDriver()
CALLED();
PRINT(("OpenSoundDevice::InitDriver: %" B_PRId32 " engines, %" B_PRId32
" mixers\n", CountEngines(), CountMixers()));
-
+
if (CountMixers()) {
;//...
}
-
+
fInitCheckStatus = B_OK;
-
+
return B_OK;
}
@@ -398,7 +398,7 @@ OpenSoundDevice::AddEngine(oss_audioinfo *info)
delete engine;
return err;
}
- fEngines.AddItem(engine);
+ fEngines.AddItem(engine);
return B_OK;
}
@@ -417,7 +417,7 @@ OpenSoundDevice::AddMixer(oss_mixerinfo *info)
delete mixer;
return err;
}
- fMixers.AddItem(mixer);
+ fMixers.AddItem(mixer);
return B_OK;
}
diff --git a/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp
b/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp
index db2dec51f5..8c99a9d3d9 100644
--- a/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp
+++ b/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp
@@ -345,7 +345,7 @@ OpenSoundNode::OpenSoundNode(BMediaAddOn* addon, const
char* name,
// initialize our preferred format object
// TODO: this should go away! should use engine's preferred for each
afmt.
#if 1
- memset(&fPreferredFormat, 0, sizeof(fPreferredFormat));
+ fPreferredFormat = media_format();
// set everything to wildcard first
fPreferredFormat.type = B_MEDIA_RAW_AUDIO;
fPreferredFormat.u.raw_audio = media_multi_audio_format::wildcard;
diff --git a/src/apps/cortex/TransportView/TransportView.cpp
b/src/apps/cortex/TransportView/TransportView.cpp
index 925cec47ab..17f4cdf1e1 100644
--- a/src/apps/cortex/TransportView/TransportView.cpp
+++ b/src/apps/cortex/TransportView/TransportView.cpp
@@ -69,7 +69,7 @@ __BEGIN_CORTEX_NAMESPACE
class _GroupInfoView :
public BView {
typedef BView _inherited;
-
+
public:
// ctor/dtor
_GroupInfoView(
BRect
frame,
@@ -77,12 +77,12 @@ public:
// ctor/dtor
const char*
name,
uint32
resizeMode =B_FOLLOW_LEFT|B_FOLLOW_TOP,
uint32
flags =B_WILL_DRAW|B_FRAME_EVENTS) :
-
+
BView(frame, name, resizeMode, flags),
m_parent(parent),
m_plainFont(be_plain_font),
m_boldFont(be_bold_font) {
-
+
_initViews();
_initColors();
_updateLayout();
@@ -97,25 +97,25 @@ public:
// BView
_updateLayout();
Invalidate();
}
-
+
virtual void GetPreferredSize(
float*
width,
float*
height) {
font_height fh;
m_plainFont.GetHeight(&fh);
-
+
*width = 0.0;
*height = (fh.ascent+fh.descent+fh.leading) * 2;
*height += 4.0; //+++++
}
-
-
+
+
virtual void Draw(
BRect
updateRect) {
-
+
NodeGroup* g = m_parent->m_group;
BRect b = Bounds();
-
+
// border
rgb_color hi = tint_color(ViewColor(), B_LIGHTEN_2_TINT);
rgb_color lo = tint_color(ViewColor(), B_DARKEN_2_TINT);
@@ -130,19 +130,19 @@ public:
// BView
b.LeftBottom(), b.RightBottom());
StrokeLine(
b.RightTop(), b.RightBottom());
-
+
SetHighColor(255,255,255,255);
-
+
// background +++++
-
+
// name
BString name = g ? g->name() : "(no group)";
// +++++ constrain width
SetFont(&m_boldFont);
DrawString(name.String(), m_namePosition);
-
+
SetFont(&m_plainFont);
-
+
// node count
BString nodeCount;
if(g)
@@ -152,23 +152,23 @@ public:
// BView
nodeCount << ((nodeCount == "1") ? " node." : " nodes.");
// +++++ constrain width
DrawString(nodeCount.String(), m_nodeCountPosition);
-
+
// status
BString status = "No errors.";
// +++++ constrain width
DrawString(status.String(), m_statusPosition);
}
-
+
virtual void MouseDown(
BPoint
point) {
-
+
NodeGroup* g = m_parent->m_group;
if(!g)
return;
-
+
font_height fh;
m_boldFont.GetHeight(&fh);
-
+
BRect nameBounds(
m_namePosition.x,
m_namePosition.y - fh.ascent,
@@ -202,11 +202,11 @@ public:
// implementation
void _updateLayout() {
float _edge_pad_x = 3.0;
float _edge_pad_y = 1.0;
-
+
BRect b = Bounds();
font_height fh;
m_plainFont.GetHeight(&fh);
-
+
float realWidth = b.Width() - (_edge_pad_x * 2);
m_maxNameWidth = realWidth * 0.7;
@@ -215,7 +215,7 @@ public:
// implementation
m_namePosition.y = _edge_pad_x + fh.ascent - 2.0;
m_nodeCountPosition = m_namePosition;
m_nodeCountPosition.x = m_maxNameWidth;
-
+
m_maxStatusWidth = realWidth;
m_statusPosition.x = _edge_pad_x;
m_statusPosition.y = b.Height() - (fh.descent + fh.leading +
_edge_pad_y);
@@ -223,16 +223,16 @@ public:
// implementation
private:
TransportView*
m_parent;
-
+
BFont
m_plainFont;
BFont
m_boldFont;
-
+
BPoint
m_namePosition;
float
m_maxNameWidth;
-
+
BPoint
m_nodeCountPosition;
float
m_maxNodeCountWidth;
-
+
BPoint
m_statusPosition;
float
m_maxStatusWidth;
};
@@ -241,11 +241,11 @@ __END_CORTEX_NAMESPACE
// -------------------------------------------------------- //
// *** ctors
// -------------------------------------------------------- //
-
+
TransportView::TransportView(
NodeManager* manager,
const char* name) :
-
+
BView(
BRect(),
name,
@@ -259,7 +259,7 @@ TransportView::TransportView(
_constructControls();
// _updateLayout(); deferred until AttachedToWindow(): 24aug99
_disableControls();
-
+
SetViewColor(
tint_color(
ui_color(B_PANEL_BACKGROUND_COLOR),
@@ -272,10 +272,10 @@ TransportView::TransportView(
void TransportView::AttachedToWindow() {
_inherited::AttachedToWindow();
-
+
// finish layout
_updateLayout();
-
+
// watch the node manager (for time-source create/delete notification)
RouteApp* app = dynamic_cast<RouteApp*>(be_app);
ASSERT(app);
@@ -284,7 +284,7 @@ void TransportView::AttachedToWindow() {
void TransportView::AllAttached() {
_inherited::AllAttached();
-
+
// set message targets for view-configuation controls
for(target_set::iterator it = m_localTargets.begin();
it != m_localTargets.end(); ++it) {
@@ -295,7 +295,7 @@ void TransportView::AllAttached() {
void TransportView::DetachedFromWindow() {
_inherited::DetachedFromWindow();
-
+
RouteApp* app = dynamic_cast<RouteApp*>(be_app);
ASSERT(app);
remove_observer(this, app->manager);
@@ -324,13 +324,13 @@ void TransportView::KeyDown(
default:
_inherited::KeyDown(bytes, count);
- }
+ }
}
void TransportView::MouseDown(
BPoint
where) {
-
+
MakeFocus(true);
}
@@ -343,11 +343,11 @@ void TransportView::MessageReceived(
BMessage*
message) {
status_t err;
uint32 groupID;
-
+
// PRINT((
// "TransportView::MessageReceived()\n"));
// message->PrintToStream();
-
+
switch(message->what) {
case NodeGroup::M_RELEASED:
@@ -364,15 +364,15 @@ void TransportView::MessageReceived(
" mismatched groupID.\n"));
break;
}
-
+
_releaseGroup();
-//
+//
// BMessage m(M_REMOVE_OBSERVER);
// m.AddMessenger("observer", BMessenger(this));
// message->SendReply(&m);
}
break;
-
+
case NodeGroup::M_OBSERVER_ADDED:
err = message->FindInt32("groupID", (int32*)&groupID);
if(err < B_OK) {
@@ -387,10 +387,10 @@ void TransportView::MessageReceived(
" mismatched groupID; ignoring.\n"));
break;
}
-
+
_enableControls();
break;
-
+
case NodeGroup::M_TRANSPORT_STATE_CHANGED:
uint32 groupID;
err = message->FindInt32("groupID", (int32*)&groupID);
@@ -406,20 +406,20 @@ void TransportView::MessageReceived(
" mismatched groupID; ignoring.\n"));
break;
}
-
+
_updateTransportButtons();
break;
-
+
case NodeGroup::M_TIME_SOURCE_CHANGED:
//_updateTimeSource(); +++++ check group?
break;
-
+
case NodeGroup::M_RUN_MODE_CHANGED:
//_updateRunMode(); +++++ check group?
break;
-
+
// * CONTROL PROCESSING
-
+
case NodeGroup::M_SET_START_POSITION: {
if(!m_group)
@@ -429,7 +429,7 @@ void TransportView::MessageReceived(
m_regionStartView->value());
message->AddInt64("position", position);
BMessenger(m_group).SendMessage(message);
-
+
// update start-button duty/label [e.moon 11oct99]
if(m_group->transportState() ==
NodeGroup::TRANSPORT_STOPPED)
_updateTransportButtons();
@@ -453,7 +453,7 @@ void TransportView::MessageReceived(
break;
}
-
+
case M_SET_NAME:
{
const char* name;
@@ -469,7 +469,7 @@ void TransportView::MessageReceived(
}
}
break;
-
+
case RouteAppNodeManager::M_TIME_SOURCE_CREATED:
_timeSourceCreated(message);
break;
@@ -498,12 +498,12 @@ void TransportView::_handleSelectGroup(
"* TransportView::_handleSelectGroup(): no groupID\n"));
return;
}
-
+
if(m_group && groupID != m_group->id())
_releaseGroup();
-
+
_selectGroup(groupID);
-
+
Invalidate();
}
@@ -516,7 +516,7 @@ void TransportView::_handleSelectGroup(
void TransportView::_selectGroup(
uint32
groupID) {
status_t err;
-
+
if(m_group)
_releaseGroup();
@@ -534,19 +534,19 @@ void TransportView::_selectGroup(
strerror(err)));
return;
}
-
+
_observeGroup();
}
void TransportView::_observeGroup() {
ASSERT(m_group);
-
+
add_observer(this, m_group);
}
void TransportView::_releaseGroup() {
ASSERT(m_group);
-
+
remove_observer(this, m_group);
m_group = 0;
}
@@ -591,7 +591,7 @@ void TransportView::_constructControls() {
this,
"infoView");
AddChild(m_infoView);
-
+
m_runModeView = new BMenuField(
BRect(),
"runModeView",
@@ -613,8 +613,8 @@ void TransportView::_constructControls() {
m_fromLabel = new BStringView(BRect(), 0, "Roll from");
AddChild(m_fromLabel);
-
-
+
+
m = new BMessage(NodeGroup::M_SET_START_POSITION);
m_regionStartView = new NumericValControl(
BRect(),
@@ -622,15 +622,15 @@ void TransportView::_constructControls() {
m,
2, 4, // * DIGITS
false, ValControl::ALIGN_FLUSH_LEFT);
-
- // redirect view back to self. this gives me the chance to
- // augment the message with the position before sending
+
+ // redirect view back to self. this gives me the chance to
+ // augment the message with the position before sending
_addLocalTarget(m_regionStartView);
AddChild(m_regionStartView);
m_toLabel = new BStringView(BRect(), 0, "to");
AddChild(m_toLabel);
-
+
m = new BMessage(NodeGroup::M_SET_END_POSITION);
m_regionEndView = new NumericValControl(
BRect(),
@@ -638,9 +638,9 @@ void TransportView::_constructControls() {
m,
2, 4, // * DIGITS
false, ValControl::ALIGN_FLUSH_LEFT);
-
- // redirect view back to self. this gives me the chance to
- // augment the message with the position before sending
+
+ // redirect view back to self. this gives me the chance to
+ // augment the message with the position before sending
_addLocalTarget(m_regionEndView);
AddChild(m_regionEndView);
@@ -654,7 +654,7 @@ void TransportView::_constructControls() {
//
// _addGroupTarget(m_regionStartView);
//// m_regionStartView->TextView()->SetAlignment(B_ALIGN_RIGHT);
-//
+//
// AddChild(m_regionStartView);
//
// m = new BMessage(NodeGroup::M_SET_END_POSITION);
@@ -668,7 +668,7 @@ void TransportView::_constructControls() {
// _addGroupTarget(m_regionEndView);
//// m_regionEndView->TextView()->SetAlignment(B_ALIGN_RIGHT);
// AddChild(m_regionEndView);
-
+
m = new BMessage(NodeGroup::M_START);
m_startButton = new BButton(
BRect(),
@@ -701,7 +701,7 @@ void TransportView::_constructControls() {
// [e.moon 11oct99]
bigtime_t TransportView::_scalePosition(
double
value) {
-
+
return bigtime_t(value * 1000000.0);
}
@@ -793,7 +793,7 @@ void TransportView::_populateTimeSourceMenu(
menu->AddItem(i);
_addGroupTarget(i);
}
-
+
// BMessage* m;
// for(int n = 0; n < _time_sources; ++n) {
// m = new BMessage(NodeGroup::M_SET_TIME_SOURCE);
@@ -804,7 +804,7 @@ void TransportView::_populateTimeSourceMenu(
// sizeof(media_node));
// // +++++ copy media_node of associated time source!
//// m->AddInt32("timeSource", n);
-//
+//
// BMenuItem* i = new BMenuItem(
// _time_source_strings[n], m);
// menu->AddItem(i);
@@ -818,7 +818,7 @@ void TransportView::_populateTimeSourceMenu(
void TransportView::_addLocalTarget(
BInvoker*
invoker) {
-
+
m_localTargets.push_back(invoker);
if(Window())
invoker->SetTarget(this);
@@ -826,7 +826,7 @@ void TransportView::_addLocalTarget(
void TransportView::_addGroupTarget(
BInvoker*
invoker) {
-
+
m_groupTargets.push_back(invoker);
if(m_group)
invoker->SetTarget(m_group);
@@ -849,7 +849,7 @@ void TransportView::_disableControls() {
// m_nameView->SetText("(no group)");
m_infoView->Invalidate();
-
+
m_runModeView->SetEnabled(false);
m_runModeView->Menu()->Superitem()->SetLabel("(none)");
@@ -861,7 +861,7 @@ void TransportView::_disableControls() {
m_regionEndView->SetEnabled(false);
m_regionEndView->setValue(0);
-
+
m_startButton->SetEnabled(false);
m_stopButton->SetEnabled(false);
m_prerollButton->SetEnabled(false);
@@ -892,14 +892,14 @@ void TransportView::_enableControls() {
BView* focused = w->CurrentFocus();
if(focused)
focused->MakeFocus(false);
- }
+ }
// BString nameViewText = m_group->name();
// nameViewText << ": " << m_group->countNodes() << " nodes.";
// m_nameView->SetText(nameViewText.String());
-
+
m_infoView->Invalidate();
-
+
m_runModeView->SetEnabled(true);
_updateRunMode();
@@ -907,14 +907,14 @@ void TransportView::_enableControls() {
_updateTimeSource();
_updateTransportButtons();
-
+
// +++++ ick. hard-coded scaling factors make me queasy
-
+
m_regionStartView->SetEnabled(true);
m_regionStartView->setValue(
((double)m_group->startPosition()) / 1000000.0);
-
+
m_regionEndView->SetEnabled(true);
m_regionEndView->setValue(
((double)m_group->endPosition()) / 1000000.0);
@@ -928,7 +928,7 @@ void TransportView::_enableControls() {
if(w) {
w->EndViewTransaction();
- }
+ }
// PRINT((
// "*** DONE: _enableControls()\n"));
@@ -937,7 +937,7 @@ void TransportView::_enableControls() {
void TransportView::_updateTransportButtons() {
ASSERT(m_group);
-
+
switch(m_group->transportState()) {
case NodeGroup::TRANSPORT_INVALID:
case NodeGroup::TRANSPORT_STARTING:
@@ -946,7 +946,7 @@ void TransportView::_updateTransportButtons() {
m_stopButton->SetEnabled(false);
m_prerollButton->SetEnabled(false);
break;
-
+
case NodeGroup::TRANSPORT_STOPPED:
m_startButton->SetEnabled(true);
m_stopButton->SetEnabled(false);
@@ -964,11 +964,11 @@ void TransportView::_updateTransportButtons() {
// based on group settings, set the start button to do either
// a simple start or a roll (atomic start/stop.) [e.moon 11oct99]
ASSERT(m_startButton->Message());
-
+
// get current region settings
bigtime_t startPosition = _scalePosition(m_regionStartView->value());
bigtime_t endPosition = _scalePosition(m_regionEndView->value());
-
+
// get current run-mode setting
uint32 runMode = 0;
BMenuItem* i = m_runModeView->Menu()->FindMarked();
@@ -979,7 +979,7 @@ void TransportView::_updateTransportButtons() {
endPosition > startPosition &&
(runMode == BMediaNode::B_OFFLINE ||
!m_group->canCycle())) {
-
+
m_startButton->SetLabel("Roll");
m_startButton->Message()->what = NodeGroup::M_ROLL;
@@ -1017,27 +1017,27 @@ void TransportView::_updateTimeSource() {
BMessage* message = menu->ItemAt(n)->Message();
if(!message)
continue;
-
+
ssize_t size = sizeof(media_node);
- err = message->FindData(
+ err = message->FindData(
"timeSourceNode",
B_RAW_TYPE,
&data,
&size);
if(err < B_OK)
continue;
-
- memcpy(&itemNode, data, sizeof(media_node));
+
+ itemNode = *((media_node*)data);
if(itemNode != tsNode)
continue;
-
+
// found it
PRINT((
"### _updateTimeSource: %s\n",
menu->ItemAt(n)->Label()));
menu->ItemAt(n)->SetMarked(true);
break;
- }
+ }
// ASSERT(m_timeSourcePresets);
// int n;
// for(n = 0; n < _time_sources; ++n) {
@@ -1054,7 +1054,7 @@ void TransportView::_updateTimeSource() {
}
void TransportView::_updateRunMode() {
ASSERT(m_group);
-
+
BMenu* menu = m_runModeView->Menu();
uint32 runMode = m_group->runMode() - 1; // real run mode starts at 1
ASSERT((uint32)menu->CountItems() > runMode);
@@ -1069,7 +1069,7 @@ void TransportView::_updateRunMode() {
// if(err == B_OK) {
// m_timeSources.push_back(node.node);
// }
-//
+//
// err = m_manager->roster->GetSystemTimeSource(&m_timeSourcePresets[1]);
// if(err < B_OK) {
// PRINT((
@@ -1087,7 +1087,7 @@ void TransportView::_timeSourceCreated(
err = message->FindInt32("nodeID", &id);
if(err < B_OK)
return;
-
+
// PRINT(("### _timeSourceCreated(): %" B_PRId32 "\n", id));
NodeRef* ref;
err = m_manager->getNodeRef(id, &ref);
@@ -1095,7 +1095,7 @@ void TransportView::_timeSourceCreated(
PRINT((
"!!! TransportView::_timeSourceCreated(): node %"
B_PRId32 " doesn't exist\n",
id));
- return;
+ return;
}
char nameBuffer[B_MEDIA_NAME_LENGTH+16];
@@ -1125,7 +1125,7 @@ void TransportView::_timeSourceDeleted(
err = message->FindInt32("nodeID", &id);
if(err < B_OK)
return;
-
+
// PRINT(("### _timeSourceDeleted(): %" B_PRId32 "\n", id));
BMenu* menu = m_timeSourceView->Menu();
@@ -1139,20 +1139,20 @@ void TransportView::_timeSourceDeleted(
BMessage* message = menu->ItemAt(n)->Message();
if(!message)
continue;
-
+
ssize_t size = sizeof(media_node);
- err = message->FindData(
+ err = message->FindData(
"timeSourceNode",
B_RAW_TYPE,
&data,
&size);
if(err < B_OK)
continue;
-
- memcpy(&itemNode, data, sizeof(media_node));
+
+ itemNode = *((media_node*)data);
if(itemNode.node != id)
continue;
-
+
// found it; remove the item
menu->RemoveItem(n);
break;
@@ -1190,7 +1190,7 @@ class TransportView::_layout_state {
public:
_layout_state() {}
- // +++++
+ // +++++
};
inline float _menu_width(
@@ -1198,7 +1198,7 @@ inline float _menu_width(
const BFont* font) {
float max = 0.0;
-
+
int total = menu->CountItems();
for(int n = 0; n < total; ++n) {
float w = font->StringWidth(
@@ -1206,7 +1206,7 @@ inline float _menu_width(
if(w > max)
max = w;
}
-
+
return max;
}
@@ -1227,10 +1227,10 @@ void TransportView::_updateLayout() // +++++
// * max label width
float maxLabelWidth = 0.0;
float w;
-
+
maxLabelWidth = be_bold_font->StringWidth(
m_runModeView->Label());
-
+
w = be_bold_font->StringWidth(
m_timeSourceView->Label());
if(w > maxLabelWidth)
@@ -1277,7 +1277,7 @@ void TransportView::_updateLayout() // +++++
viewWidth += (buttonSpan - columnWidth);
// float insideWidth = viewWidth - (_edge_pad_x*2);
-
+
// * figure view height a row at a time
font_height fh;
be_plain_font->GetHeight(&fh);
@@ -1286,20 +1286,20 @@ void TransportView::_updateLayout() // +++++
float prefInfoWidth, prefInfoHeight;
m_infoView->GetPreferredSize(&prefInfoWidth, &prefInfoHeight);
float row_1_height = max(prefInfoHeight, _transport_button_height);
-
+
float row1_y = _edge_pad_y;
float row2_y = row1_y + row_1_height + _transport_pad_y;
float row3_y = row2_y + lineHeight + _control_pad_y;
// float row4_y = row3_y + lineHeight + _control_pad_y + _transport_pad_y;
// float row5_y = row4_y + lineHeight + _control_pad_y;
float viewHeight = row3_y + lineHeight + _control_pad_y + _edge_pad_y;
-
+
// Place controls
m_infoView->MoveTo(
column1_x+1.0, row1_y+1.0);
m_infoView->ResizeTo(
columnWidth, prefInfoHeight);
-
+
BRect br(
column2_x, row1_y,
column2_x+_transport_button_width,
@@ -1326,7 +1326,7 @@ void TransportView::_updateLayout() // +++++
maxLabelWidth+_label_pad_x);
m_runModeView->SetAlignment(
B_ALIGN_LEFT);
-
+
m_timeSourceView->MoveTo(
column2_x, row3_y);
m_timeSourceView->ResizeTo(
@@ -1343,27 +1343,27 @@ void TransportView::_updateLayout() // +++++
// B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP);
// "FROM"
-
+
BPoint rtLeftTop(column1_x, row2_y + 5.0);
BPoint rtRightBottom;
-
+
m_fromLabel->MoveTo(rtLeftTop);
m_fromLabel->ResizeToPreferred();
rtRightBottom = rtLeftTop + BPoint(
m_fromLabel->Bounds().Width(),
m_fromLabel->Bounds().Height());
-
-
+
+
// (region-start)
rtLeftTop.x = rtRightBottom.x+4;
-
+
m_regionStartView->MoveTo(rtLeftTop + BPoint(0.0, 2.0));
m_regionStartView->ResizeToPreferred();
rtRightBottom = rtLeftTop + BPoint(
m_regionStartView->Bounds().Width(),
m_regionStartView->Bounds().Height());
-
+
// m_regionStartView->SetDivider(
// maxLabelWidth);
// m_regionStartView->TextView()->ResizeTo(
@@ -1379,11 +1379,11 @@ void TransportView::_updateLayout() // +++++
rtRightBottom = rtLeftTop + BPoint(
m_toLabel->Bounds().Width(),
m_toLabel->Bounds().Height());
-
+
// (region-end)
rtLeftTop.x = rtRightBottom.x + 4;
-
+
m_regionEndView->MoveTo(rtLeftTop + BPoint(0.0, 2.0));
m_regionEndView->ResizeToPreferred();
// m_regionEndView->SetDivider(
@@ -1400,7 +1400,7 @@ void TransportView::_updateLayout() // +++++
float targetHeight = (b.Height() < viewHeight) ?
viewHeight :
b.Height();
-
+
// Resize view to fit contents
ResizeTo(targetWidth, targetHeight);
@@ -1429,6 +1429,6 @@ TransportView::~TransportView() {
if(m_layout)
delete m_layout;
}
-
+
// END -- TransportView.cpp --
diff --git a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp
b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp
index 5539dbcf63..4630a017dd 100644
--- a/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp
+++ b/src/apps/cortex/addons/LoggingConsumer/LoggingConsumer.cpp
@@ -465,7 +465,7 @@ LoggingConsumer::Disconnected(
mLogger->Log(LOG_DISCONNECTED, logMsg);
// wipe out our input record
- memset(&mInput, 0, sizeof(mInput));
+ mInput = media_input();
}
status_t
diff --git a/src/preferences/media/MediaViews.cpp
b/src/preferences/media/MediaViews.cpp
index c0e2f785ed..831549d818 100644
--- a/src/preferences/media/MediaViews.cpp
+++ b/src/preferences/media/MediaViews.cpp
@@ -432,7 +432,7 @@ AudioSettingsView::_FillChannelMenu(const
dormant_node_info* nodeInfo)
for (int32 i = 0; i < inputCount; i++) {
media_input* input = new media_input();
- memcpy(input, &inputs[i], sizeof(*input));
+ *input = inputs[i];
ChannelMenuItem* channelItem = new
ChannelMenuItem(input,
new BMessage(message));
fChannelMenu->AddItem(channelItem);
############################################################################
Commit: 1705656eac83cd8b65c2ee895888cd529c62c04c
URL: https://git.haiku-os.org/haiku/commit/?id=1705656eac83
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:21:37 2019 UTC
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.
----------------------------------------------------------------------------
diff --git a/headers/libs/agg/agg_renderer_scanline.h
b/headers/libs/agg/agg_renderer_scanline.h
index 615fffb42b..efa713b20c 100644
--- a/headers/libs/agg/agg_renderer_scanline.h
+++ b/headers/libs/agg/agg_renderer_scanline.h
@@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
-// Permission to copy, use, modify, sell and distribute this software
-// is granted provided this copyright notice appears in all copies.
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
@@ -23,9 +23,9 @@ namespace agg
{
//================================================render_scanline_aa_solid
- template<class Scanline, class BaseRenderer, class ColorT>
- void render_scanline_aa_solid(const Scanline& sl,
- BaseRenderer& ren,
+ template<class Scanline, class BaseRenderer, class ColorT>
+ void render_scanline_aa_solid(const Scanline& sl,
+ BaseRenderer& ren,
const ColorT& color)
{
int y = sl.y();
@@ -37,14 +37,14 @@ namespace agg
int x = span->x;
if(span->len > 0)
{
- ren.blend_solid_hspan(x, y, (unsigned)span->len,
- color,
+ ren.blend_solid_hspan(x, y, (unsigned)span->len,
+ color,
span->covers);
}
else
{
- ren.blend_hline(x, y, (unsigned)(x - span->len - 1),
- color,
+ ren.blend_hline(x, y, (unsigned)(x - span->len - 1),
+ color,
*(span->covers));
}
if(--num_spans == 0) break;
@@ -53,16 +53,16 @@ namespace agg
}
//===============================================render_scanlines_aa_solid
- template<class Rasterizer, class Scanline,
+ template<class Rasterizer, class Scanline,
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)
{
if(ras.rewind_scanlines())
{
// Explicitly convert "color" to the BaseRenderer color type.
// 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.
//----------------------
typename BaseRenderer::color_type ren_color(color);
@@ -72,7 +72,7 @@ namespace agg
{
//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,
// like Microsoft Visual C++ v6.0
//-------------------------------
@@ -85,14 +85,14 @@ namespace agg
int x = span->x;
if(span->len > 0)
{
- ren.blend_solid_hspan(x, y, (unsigned)span->len,
- ren_color,
+ ren.blend_solid_hspan(x, y, (unsigned)span->len,
+ ren_color,
span->covers);
}
else
{
- ren.blend_hline(x, y, (unsigned)(x - span->len - 1),
- ren_color,
+ ren.blend_hline(x, y, (unsigned)(x - span->len - 1),
+ ren_color,
*(span->covers));
}
if(--num_spans == 0) break;
@@ -116,7 +116,7 @@ namespace agg
{
m_ren = &ren;
}
-
+
//--------------------------------------------------------------------
void color(const color_type& c) { m_color = c; }
const color_type& color() const { return m_color; }
@@ -129,7 +129,7 @@ namespace agg
{
render_scanline_aa_solid(sl, *m_ren, m_color);
}
-
+
private:
base_ren_type* m_ren;
color_type m_color;
@@ -148,9 +148,9 @@ namespace agg
//======================================================render_scanline_aa
- template<class Scanline, class BaseRenderer,
- class SpanAllocator, class SpanGenerator>
- void render_scanline_aa(const Scanline& sl, BaseRenderer& ren,
+ template<class Scanline, class BaseRenderer,
+ class SpanAllocator, class SpanGenerator>
+ void render_scanline_aa(const Scanline& sl, BaseRenderer& ren,
SpanAllocator& alloc, SpanGenerator& span_gen)
{
int y = sl.y();
@@ -166,7 +166,7 @@ namespace agg
if(len < 0) len = -len;
typename BaseRenderer::color_type* colors = alloc.allocate(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);
if(--num_spans == 0) break;
@@ -175,9 +175,9 @@ namespace agg
}
//=====================================================render_scanlines_aa
- template<class Rasterizer, class Scanline, class BaseRenderer,
+ template<class Rasterizer, class Scanline, class BaseRenderer,
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)
{
if(ras.rewind_scanlines())
@@ -192,7 +192,7 @@ namespace agg
}
//====================================================renderer_scanline_aa
- template<class BaseRenderer, class SpanAllocator, class SpanGenerator>
+ template<class BaseRenderer, class SpanAllocator, class SpanGenerator>
class renderer_scanline_aa
{
public:
@@ -202,22 +202,22 @@ namespace agg
//--------------------------------------------------------------------
renderer_scanline_aa() : m_ren(0), m_alloc(0), m_span_gen(0) {}
- renderer_scanline_aa(base_ren_type& ren,
- alloc_type& alloc,
+ renderer_scanline_aa(base_ren_type& ren,
+ alloc_type& alloc,
span_gen_type& span_gen) :
m_ren(&ren),
m_alloc(&alloc),
m_span_gen(&span_gen)
{}
- void attach(base_ren_type& ren,
- alloc_type& alloc,
+ void attach(base_ren_type& ren,
+ alloc_type& alloc,
span_gen_type& span_gen)
{
m_ren = &ren;
m_alloc = &alloc;
m_span_gen = &span_gen;
}
-
+
//--------------------------------------------------------------------
void prepare() { m_span_gen->prepare(); }
@@ -239,21 +239,21 @@ namespace agg
//===============================================render_scanline_bin_solid
- template<class Scanline, class BaseRenderer, class ColorT>
- void render_scanline_bin_solid(const Scanline& sl,
- BaseRenderer& ren,
+ template<class Scanline, class BaseRenderer, class ColorT>
+ void render_scanline_bin_solid(const Scanline& sl,
+ BaseRenderer& ren,
const ColorT& color)
{
unsigned num_spans = sl.num_spans();
typename Scanline::const_iterator span = sl.begin();
for(;;)
{
- ren.blend_hline(span->x,
- sl.y(),
- span->x - 1 + ((span->len < 0) ?
- -span->len :
- span->len),
- color,
+ ren.blend_hline(span->x,
+ sl.y(),
+ span->x - 1 + ((span->len < 0) ?
+ -span->len :
+ span->len),
+ color,
cover_full);
if(--num_spans == 0) break;
++span;
@@ -261,16 +261,16 @@ namespace agg
}
//==============================================render_scanlines_bin_solid
- template<class Rasterizer, class Scanline,
+ template<class Rasterizer, class Scanline,
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)
{
if(ras.rewind_scanlines())
{
// Explicitly convert "color" to the BaseRenderer color type.
// 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.
//----------------------
typename BaseRenderer::color_type ren_color(color);
@@ -280,7 +280,7 @@ namespace agg
{
//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,
// like Microsoft Visual C++ v6.0
//-------------------------------
@@ -288,12 +288,12 @@ namespace agg
typename Scanline::const_iterator span = sl.begin();
for(;;)
{
- ren.blend_hline(span->x,
- sl.y(),
- span->x - 1 + ((span->len < 0) ?
- -span->len :
- span->len),
- ren_color,
+ ren.blend_hline(span->x,
+ sl.y(),
+ span->x - 1 + ((span->len < 0) ?
+ -span->len :
+ span->len),
+ ren_color,
cover_full);
if(--num_spans == 0) break;
++span;
@@ -316,7 +316,7 @@ namespace agg
{
m_ren = &ren;
}
-
+
//--------------------------------------------------------------------
void color(const color_type& c) { m_color = c; }
const color_type& color() const { return m_color; }
@@ -329,7 +329,7 @@ namespace agg
{
render_scanline_bin_solid(sl, *m_ren, m_color);
}
-
+
private:
base_ren_type* m_ren;
color_type m_color;
@@ -343,9 +343,9 @@ namespace agg
//======================================================render_scanline_bin
- template<class Scanline, class BaseRenderer,
- class SpanAllocator, class SpanGenerator>
- void render_scanline_bin(const Scanline& sl, BaseRenderer& ren,
+ template<class Scanline, class BaseRenderer,
+ class SpanAllocator, class SpanGenerator>
+ void render_scanline_bin(const Scanline& sl, BaseRenderer& ren,
SpanAllocator& alloc, SpanGenerator& span_gen)
{
int y = sl.y();
@@ -359,16 +359,16 @@ namespace agg
if(len < 0) len = -len;
typename BaseRenderer::color_type* colors = alloc.allocate(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;
++span;
}
}
//=====================================================render_scanlines_bin
- template<class Rasterizer, class Scanline, class BaseRenderer,
+ template<class Rasterizer, class Scanline, class BaseRenderer,
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)
{
if(ras.rewind_scanlines())
@@ -383,7 +383,7 @@ namespace agg
}
//====================================================renderer_scanline_bin
- template<class BaseRenderer, class SpanAllocator, class SpanGenerator>
+ template<class BaseRenderer, class SpanAllocator, class SpanGenerator>
class renderer_scanline_bin
{
public:
@@ -393,22 +393,22 @@ namespace agg
//--------------------------------------------------------------------
renderer_scanline_bin() : m_ren(0), m_alloc(0), m_span_gen(0) {}
- renderer_scanline_bin(base_ren_type& ren,
- alloc_type& alloc,
+ renderer_scanline_bin(base_ren_type& ren,
+ alloc_type& alloc,
span_gen_type& span_gen) :
m_ren(&ren),
m_alloc(&alloc),
m_span_gen(&span_gen)
{}
- void attach(base_ren_type& ren,
- alloc_type& alloc,
+ void attach(base_ren_type& ren,
+ alloc_type& alloc,
span_gen_type& span_gen)
{
m_ren = &ren;
m_alloc = &alloc;
m_span_gen = &span_gen;
}
-
+
//--------------------------------------------------------------------
void prepare() { m_span_gen->prepare(); }
@@ -449,13 +449,13 @@ namespace agg
}
//========================================================render_all_paths
- template<class Rasterizer, class Scanline, class Renderer,
+ template<class Rasterizer, class Scanline, class Renderer,
class VertexSource, class ColorStorage, class PathId>
- void render_all_paths(Rasterizer& ras,
+ void render_all_paths(Rasterizer& ras,
Scanline& sl,
- Renderer& r,
- VertexSource& vs,
- const ColorStorage& as,
+ Renderer& r,
+ VertexSource& vs,
+ const ColorStorage& as,
const PathId& path_id,
unsigned num_paths)
{
@@ -477,13 +477,13 @@ namespace agg
//=============================================render_scanlines_compound
- template<class Rasterizer,
- class ScanlineAA,
- class ScanlineBin,
- class BaseRenderer,
+ template<class Rasterizer,
+ class ScanlineAA,
+ class ScanlineBin,
+ class BaseRenderer,
class SpanAllocator,
class StyleHandler>
- void render_scanlines_compound(Rasterizer& ras,
+ void render_scanlines_compound(Rasterizer& ras,
ScanlineAA& sl_aa,
ScanlineBin& sl_bin,
BaseRenderer& ren,
@@ -530,14 +530,14 @@ namespace agg
for(;;)
{
len = span_aa->len;
- sh.generate_span(color_span,
- span_aa->x,
- sl_aa.y(),
- len,
+ sh.generate_span(color_span,
+ span_aa->x,
+ sl_aa.y(),
+ len,
style);
- ren.blend_color_hspan(span_aa->x,
- sl_aa.y(),
+ ren.blend_color_hspan(span_aa->x,
+ sl_aa.y(),
span_aa->len,
color_span,
span_aa->covers);
@@ -554,12 +554,12 @@ namespace agg
if(sl_len)
{
- memset(mix_buffer + sl_start - min_x,
- 0,
+ memset((void*)(mix_buffer + sl_start - min_x),
+ 0,
sl_len * sizeof(color_type));
- memset(cover_buffer + sl_start - min_x,
- 0,
+ memset(cover_buffer + sl_start - min_x,
+ 0,
sl_len * sizeof(cover_type));
int sl_y = 0x7FFFFFFF;
@@ -620,10 +620,10 @@ namespace agg
len = span_aa->len;
colors = mix_buffer + span_aa->x -
min_x;
cspan = color_span;
- sh.generate_span(cspan,
- span_aa->x,
- sl_aa.y(),
- len,
+ sh.generate_span(cspan,
+ span_aa->x,
+ sl_aa.y(),
+ len,
style);
src_covers = span_aa->covers;
dst_covers = cover_buffer + span_aa->x
- min_x;
@@ -651,8 +651,8 @@ namespace agg
}
}
}
- ren.blend_color_hspan(sl_start,
- sl_y,
+ ren.blend_color_hspan(sl_start,
+ sl_y,
sl_len,
mix_buffer + sl_start - min_x,
0,
diff --git a/headers/private/debugger/types/ValueLocation.h
b/headers/private/debugger/types/ValueLocation.h
index 045e7db91e..5ea82eb10f 100644
--- a/headers/private/debugger/types/ValueLocation.h
+++ b/headers/private/debugger/types/ValueLocation.h
@@ -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) {
diff --git a/headers/private/interface/TextViewSupportBuffer.h
b/headers/private/interface/TextViewSupportBuffer.h
index 52cf15b291..7d5b670a1c 100644
--- a/headers/private/interface/TextViewSupportBuffer.h
+++ b/headers/private/interface/TextViewSupportBuffer.h
@@ -27,8 +27,8 @@ virtual ~_BTextViewSupportBuffer_();
int32 ItemCount() const;
protected:
- int32 fExtraCount;
- int32 fItemCount;
+ int32 fExtraCount;
+ int32 fItemCount;
int32 fBufferCount;
T* fBuffer;
};
@@ -61,7 +61,7 @@ _BTextViewSupportBuffer_<T>::InsertItemsAt(int32 inNumItems,
{
if (inNumItems < 1)
return;
-
+
inAtIndex = (inAtIndex > fItemCount) ? fItemCount : inAtIndex;
inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex;
@@ -69,15 +69,16 @@ _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;
}
@@ -89,14 +90,14 @@ _BTextViewSupportBuffer_<T>::RemoveItemsAt(int32 inNumItems,
{
if (inNumItems < 1)
return;
-
+
inAtIndex = (inAtIndex > fItemCount - 1) ? (fItemCount - 1) : inAtIndex;
inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex;
-
+
T* loc = fBuffer + inAtIndex;
- memmove(loc, loc + inNumItems,
+ memmove(loc, loc + inNumItems,
(fItemCount - (inNumItems + inAtIndex)) * sizeof(T));
-
+
int32 delta = inNumItems * sizeof(T);
int32 logSize = fItemCount * sizeof(T);
uint32 extraSize = fBufferCount - (logSize - delta);
@@ -106,7 +107,7 @@ _BTextViewSupportBuffer_<T>::RemoveItemsAt(int32 inNumItems,
if (fBuffer == NULL)
debugger("RemoveItemsAt(): reallocation failed");
}
-
+
fItemCount -= inNumItems;
}
diff --git a/src/add-ons/translators/gif/SavePalette.cpp
b/src/add-ons/translators/gif/SavePalette.cpp
index 329d02cb6f..39b2647ed2 100644
--- a/src/add-ons/translators/gif/SavePalette.cpp
+++ b/src/add-ons/translators/gif/SavePalette.cpp
@@ -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++) {
@@ -405,7 +405,7 @@ SavePalette::IndexForColor(uint8 red, uint8 green, uint8
blue, uint8 alpha)
}
} else {
int closestDistance = 255 * 255 * 3;
-
+
if (fTransparentMode == AUTO_TRANSPARENCY) {
for (int i = 0; i < fTransparentIndex &&
closestDistance != 0;
i++) {
diff --git a/src/apps/icon-o-matic/transformable/TransformPointsBox.cpp
b/src/apps/icon-o-matic/transformable/TransformPointsBox.cpp
index c3f2c665c8..bb262dc1df 100644
--- a/src/apps/icon-o-matic/transformable/TransformPointsBox.cpp
+++ b/src/apps/icon-o-matic/transformable/TransformPointsBox.cpp
@@ -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));
}
}
}
diff --git a/src/kits/shared/Variant.cpp b/src/kits/shared/Variant.cpp
index 7d32e42c1d..c10ba8db4b 100644
--- a/src/kits/shared/Variant.cpp
+++ b/src/kits/shared/Variant.cpp
@@ -353,7 +353,7 @@ BVariant::_SetTo(const BVariant& other)
other.fReferenceable->AcquireReference();
}
- memcpy(this, &other, sizeof(BVariant));
+ memcpy((void*)this, (void*)&other, sizeof(BVariant));
}
diff --git a/src/kits/tracker/OpenHashTable.h b/src/kits/tracker/OpenHashTable.h
index eb000595c6..d7cfb3f467 100644
--- a/src/kits/tracker/OpenHashTable.h
+++ b/src/kits/tracker/OpenHashTable.h
@@ -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;
diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp
index 7aa0f65e11..8dcf25f507 100644
--- a/src/kits/tracker/PoseView.cpp
+++ b/src/kits/tracker/PoseView.cpp
@@ -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;
diff --git a/src/libs/icon/shape/VectorPath.cpp
b/src/libs/icon/shape/VectorPath.cpp
index 4e4f7ba560..db7d345d2a 100644
--- a/src/libs/icon/shape/VectorPath.cpp
+++ b/src/libs/icon/shape/VectorPath.cpp
@@ -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;
@@ -322,7 +322,7 @@ VectorPath::operator==(const VectorPath& other) const
{
if (fClosed != other.fClosed)
return false;
-
+
if (fPointCount != other.fPointCount)
return false;
@@ -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));
}
}
diff --git a/src/preferences/keymap/KeyboardLayout.cpp
b/src/preferences/keymap/KeyboardLayout.cpp
index 01ad5cf720..1b50ec0b25 100644
--- a/src/preferences/keymap/KeyboardLayout.cpp
+++ b/src/preferences/keymap/KeyboardLayout.cpp
@@ -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;
############################################################################
Commit: 5b189b0e1e2f51f367bfcb126b2f00a3702f352d
URL: https://git.haiku-os.org/haiku/commit/?id=5b189b0e1e2f
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:23:12 2019 UTC
HaikuDepot & PoorMan: Disable -Werror.
Unlike the last commit, I am not sure whether the memcpy/memsets
in here are properly safe to do. (They look OK, but a lot of them
involve template classes that probably should not make such
assumptions.)
But the code has worked so far, so let's disable the -Werror so
we can move forward with GCC 8 for now.
----------------------------------------------------------------------------
diff --git a/src/apps/haikudepot/Jamfile b/src/apps/haikudepot/Jamfile
index 875f9fec7b..8e69fdfa76 100644
--- a/src/apps/haikudepot/Jamfile
+++ b/src/apps/haikudepot/Jamfile
@@ -1,5 +1,8 @@
SubDir HAIKU_TOP src apps haikudepot ;
+# disable -Werror for this directory only
+SubDirC++Flags -Wno-error ;
+
include [ FDirName $(HAIKU_TOP) src apps haikudepot build jam
HdsSchemaGenRules ] ;
@@ -314,4 +317,4 @@ Depends [ FGristFiles $(applicationSources:S=.o) ]
[ FGristFiles $(generatedRepositoryModelSourceFiles:S=.h) ]
[ FGristFiles $(generatedReferenceParserSourceFiles:S=.h) ]
[ FGristFiles $(generatedReferenceModelSourceFiles:S=.h) ]
-;
\ No newline at end of file
+;
diff --git a/src/apps/poorman/Jamfile b/src/apps/poorman/Jamfile
index ac661568a7..2d49161dc0 100644
--- a/src/apps/poorman/Jamfile
+++ b/src/apps/poorman/Jamfile
@@ -1,5 +1,8 @@
SubDir HAIKU_TOP src apps poorman ;
+# disable -Werror for this directory only
+SubDirCcFlags -Wno-error ;
+
SubDirCcFlags [ FDefines HAVE__PROGNAME=1 HAVE_FCNTL_H=1 HAVE_GRP_H=1
HAVE_MEMORY_H=1 HAVE_POLL_H=1 HAVE_SYS_POLL_H=1 TIME_WITH_SYS_TIME=1
HAVE_DIRENT_H=1 HAVE_STRERROR=1 HAVE_WAITPID=1 HAVE_VSNPRINTF=1 HAVE_SETSID=1
HAVE_SIGSET=1 HAVE_ATOLL=1 HAVE_UNISTD_H=1 HAVE_GETPAGESIZE=1 HAVE_MMAP=1
HAVE_SELECT=1 HAVE_POLL=1 HAVE_TM_GMTOFF=1 HAVE_SOCKLENT=1 HAVE_INT64T=1 ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src apps poorman libhttpd ] ;
@@ -42,20 +45,20 @@ Application PoorMan : PoorMan.cpp
PoorManSiteView.cpp
PoorManLogger.cpp
PoorManLoggingView.cpp
- PoorManPreferencesWindow.cpp
+ PoorManPreferencesWindow.cpp
PoorManApplication.cpp
constants.cpp
-
+
# libhttpd
libhttpd.c
match.c
tdate_parse.c
-
+
: be network tracker [ TargetLibstdc++ ] localestub
;
-DoCatalogs PoorMan :
+DoCatalogs PoorMan :
x-vnd.Haiku-PoorMan
:
constants.cpp
############################################################################
Commit: a1ad8af64e5af891b4144d0d971d4e1659751396
URL: https://git.haiku-os.org/haiku/commit/?id=a1ad8af64e5a
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:23:56 2019 UTC
Change a number of sprintf to snprintf.
Fixes a number of -Werrors about format overflow from GCC 8.
----------------------------------------------------------------------------
diff --git a/src/apps/mail/Content.cpp b/src/apps/mail/Content.cpp
index 716d97c282..e174f74185 100644
--- a/src/apps/mail/Content.cpp
+++ b/src/apps/mail/Content.cpp
@@ -1845,8 +1845,10 @@ TTextView::Open(hyper_text *enclosure)
char
baseName[B_FILE_NAME_LENGTH];
strcpy(baseName,
enclosure->name ? enclosure->name : "enclosure");
strcpy(name, baseName);
- for (int32 index = 0;
dir.Contains(name); index++)
- sprintf(name, "%s_%"
B_PRId32, baseName, index);
+ for (int32 index = 0;
dir.Contains(name); index++) {
+ snprintf(name,
B_FILE_NAME_LENGTH, "%s_%" B_PRId32,
+ baseName,
index);
+ }
BEntry entry(path.Path());
entry_ref ref;
@@ -2234,7 +2236,7 @@ TTextView::Reader::ParseMail(BMailContainer *container,
if (enclosure == NULL)
return false;
- memset(enclosure, 0, sizeof(hyper_text));
+ memset((void*)enclosure, 0, sizeof(hyper_text));
enclosure->type = TYPE_ENCLOSURE;
@@ -2264,7 +2266,7 @@ TTextView::Reader::ParseMail(BMailContainer *container,
if (enclosure == NULL)
return false;
- memset(enclosure, 0, sizeof(hyper_text));
+ memset((void*)enclosure, 0, sizeof(hyper_text));
enclosure->type = TYPE_ENCLOSURE;
enclosure->component = component;
@@ -2344,7 +2346,7 @@ TTextView::Reader::Process(const char *data, int32
data_len, bool isHeader)
if (enclosure == NULL)
return false;
- memset(enclosure, 0, sizeof(hyper_text));
+ memset((void*)enclosure, 0, sizeof(hyper_text));
fView->GetSelection(&enclosure->text_start,
&enclosure->text_end);
enclosure->type = type;
diff --git a/src/apps/mail/Status.cpp b/src/apps/mail/Status.cpp
index 6911efddcc..dce4065c3e 100644
--- a/src/apps/mail/Status.cpp
+++ b/src/apps/mail/Status.cpp
@@ -165,7 +165,8 @@ TStatusWindow::MessageReceived(BMessage* msg)
break;
if (result != EEXIST)
goto err_exit;
- sprintf(newName, "%s_%"
B_PRId32, name, index++);
+ snprintf(newName,
B_FILE_NAME_LENGTH, "%s_%" B_PRId32,
+ name, index++);
}
dir.FindEntry(newName, &entry);
node = new BNodeInfo(&file);
diff --git a/src/apps/terminal/TermParse.cpp b/src/apps/terminal/TermParse.cpp
index b80d3d997a..b8ac127e14 100644
--- a/src/apps/terminal/TermParse.cpp
+++ b/src/apps/terminal/TermParse.cpp
@@ -1311,9 +1311,10 @@ TermParse::_DeviceStatusReport(int n)
}
case 6:
// Cursor position report requested
- len = sprintf(sbuf, "\033[%" B_PRId32 ";%" B_PRId32 "R",
- fBuffer->Cursor().y + 1,
- fBuffer->Cursor().x + 1);
+ len = snprintf(sbuf, sizeof(sbuf),
+ "\033[%" B_PRId32 ";%" B_PRId32 "R",
+ fBuffer->Cursor().y + 1,
+ fBuffer->Cursor().x + 1);
write(fFd, sbuf, len);
break ;
default:
diff --git a/src/kits/storage/mime/AssociatedTypes.cpp
b/src/kits/storage/mime/AssociatedTypes.cpp
index a8d966d0e7..109007752a 100644
--- a/src/kits/storage/mime/AssociatedTypes.cpp
+++ b/src/kits/storage/mime/AssociatedTypes.cpp
@@ -376,7 +376,8 @@ AssociatedTypes::BuildAssociatedTypesTable()
BPrivate::Storage::to_lower(subtype);
char
fulltype[B_PATH_NAME_LENGTH];
-
sprintf(fulltype, "%s/%s", supertype, subtype);
+
snprintf(fulltype, B_PATH_NAME_LENGTH, "%s/%s",
+
supertype, subtype);
//
Process the subtype
ProcessType(fulltype);
diff --git a/src/kits/storage/mime/SnifferRules.cpp
b/src/kits/storage/mime/SnifferRules.cpp
index 0efdb936e1..f9211fb674 100644
--- a/src/kits/storage/mime/SnifferRules.cpp
+++ b/src/kits/storage/mime/SnifferRules.cpp
@@ -374,7 +374,8 @@ SnifferRules::BuildRuleList()
BPrivate::Storage::to_lower(subtype);
char
fulltype[B_PATH_NAME_LENGTH];
-
sprintf(fulltype, "%s/%s", supertype, subtype);
+
snprintf(fulltype, B_PATH_NAME_LENGTH, "%s/%s",
+
supertype, subtype);
//
Process the subtype
ProcessType(fulltype, &bytesNeeded);
diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp
index 19dbe280d9..2603d62b50 100644
--- a/src/kits/tracker/FSUtils.cpp
+++ b/src/kits/tracker/FSUtils.cpp
@@ -2424,7 +2424,7 @@ FSMakeOriginalName(char* name, BDirectory* destDir, const
char* suffix)
fnum = 1;
strcpy(temp_name, name);
while (destDir->Contains(temp_name)) {
- sprintf(temp_name, "%s %" B_PRId32, copybase, ++fnum);
+ snprintf(temp_name, sizeof(temp_name), "%s %" B_PRId32,
copybase, ++fnum);
if (strlen(temp_name) > (B_FILE_NAME_LENGTH - 1)) {
// The name has grown too long. Maybe we just went from
@@ -2433,7 +2433,7 @@ FSMakeOriginalName(char* name, BDirectory* destDir, const
char* suffix)
// truncate the 'root' name and continue.
// ??? should we reset fnum or not ???
root[strlen(root) - 1] = '\0';
- sprintf(temp_name, "%s%s %" B_PRId32, root, suffix,
fnum);
+ snprintf(temp_name, sizeof(temp_name), "%s%s %"
B_PRId32, root, suffix, fnum);
}
}
############################################################################
Commit: 43005c1925504580ed6498eb859087fac4562547
URL: https://git.haiku-os.org/haiku/commit/?id=43005c192550
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:24:27 2019 UTC
libroot: Include emmintrin instead of x86intrin.
We only need one builtin here, not 8 files of them.
----------------------------------------------------------------------------
diff --git a/src/system/libroot/posix/string/arch/x86_64/arch_string.cpp
b/src/system/libroot/posix/string/arch/x86_64/arch_string.cpp
index 8d33b7ceb5..d2f135b14e 100644
--- a/src/system/libroot/posix/string/arch/x86_64/arch_string.cpp
+++ b/src/system/libroot/posix/string/arch/x86_64/arch_string.cpp
@@ -9,7 +9,7 @@
#include <cstddef>
#include <cstdint>
-#include <x86intrin.h>
+#include <emmintrin.h>
namespace {
############################################################################
Commit: 17089e9ae5dc3bad2b1f3d5a40f50009e24cd879
URL: https://git.haiku-os.org/haiku/commit/?id=17089e9ae5dc
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:24:47 2019 UTC
Terminal: Remove a copy constructor and assignment operator.
----------------------------------------------------------------------------
diff --git a/src/apps/terminal/TermPos.h b/src/apps/terminal/TermPos.h
index e2bc18c6ed..1a127e5c0a 100644
--- a/src/apps/terminal/TermPos.h
+++ b/src/apps/terminal/TermPos.h
@@ -15,7 +15,6 @@ public:
inline TermPos() : x(0),
y(0) { }
inline TermPos(int32 x, int32 y) : x(x), y(y) { }
- inline TermPos(const TermPos& other) : x(other.x), y(other.y) { }
inline void SetTo(int32 x, int32 y)
{
@@ -52,13 +51,6 @@ public:
{
return !(*this <= other);
}
-
- inline TermPos& operator=(const TermPos& other)
- {
- x = other.x;
- y = other.y;
- return *this;
- }
};
############################################################################
Commit: bac6edf06f8a002a25d16921fb477b4ea5b40d2b
URL: https://git.haiku-os.org/haiku/commit/?id=bac6edf06f8a
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:25:26 2019 UTC
ArchitectureRules: Clean up GCC >= 3 logic & disable -Werror for netfs.
----------------------------------------------------------------------------
diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index b91d689b8f..daddcbd284 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -18,28 +18,24 @@ rule ArchitectureSetup architecture
ccBaseFlags = -pipe ;
}
- # disable strict aliasing on anything newer than gcc 2 as it may lead to
- # unexpected results.
- # TODO: remove the -fno-strict-aliasing option when all code has been
- # analyzed/fixed with regard to aliasing.
if $(gccVersion[1]) >= 3 {
+ # disable strict aliasing on anything newer than gcc 2 as it
may lead to
+ # unexpected results.
+ # TODO: remove the -fno-strict-aliasing option when all code
has been
+ # analyzed/fixed with regard to aliasing.
ccBaseFlags += -fno-strict-aliasing ;
- }
- # Without this flag, GCC deletes many null-pointer checks that are
- # technically undefined behavior (e.g. passing NULL to strdup, among
- # others), which breaks both the kernel and various applications. See:
- # -
https://freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization
- # - https://dev.haiku-os.org/ticket/13285#comment:8 ;(& subsequent
comments)
- # - https://dev.haiku-os.org/ticket/10803#comment:4 ;(& subsequent
comments)
- # Note that the Linux also does the same:
- # - https://github.com/torvalds/linux/commit/a3ca86aea507904
- if $(gccVersion[1]) >= 3 {
+ # Without this flag, GCC deletes many null-pointer checks that
are
+ # technically undefined behavior (e.g. passing NULL to strdup,
among
+ # others), which breaks both the kernel and various
applications. See:
+ # -
https://freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization
+ # - https://dev.haiku-os.org/ticket/13285#comment:8 ;(&
subsequent comments)
+ # - https://dev.haiku-os.org/ticket/10803#comment:4 ;(&
subsequent comments)
+ # Note that the Linux also does the same:
+ # - https://github.com/torvalds/linux/commit/a3ca86aea507904
ccBaseFlags += -fno-delete-null-pointer-checks ;
- }
- # disable some builtins that are incompatible with our definitions
- if $(gccVersion[1]) >= 3 {
+ # disable some builtins that are incompatible with our
definitions
ccBaseFlags += -fno-builtin-fork -fno-builtin-vfork ;
}
@@ -650,7 +646,7 @@ rule ArchitectureSetupWarnings architecture
# EnableWerror src add-ons kernel file_systems googlefs ;
EnableWerror src add-ons kernel file_systems iso9660 ;
EnableWerror src add-ons kernel file_systems layers ;
- EnableWerror src add-ons kernel file_systems netfs ;
+# EnableWerror src add-ons kernel file_systems netfs ;
# EnableWerror src add-ons kernel file_systems nfs ;
EnableWerror src add-ons kernel file_systems nfs4 ;
# EnableWerror src add-ons kernel file_systems ntfs ;
############################################################################
Commit: 632e7fd0a8ae9604fe2c6f4b1e30892f36ca5178
URL: https://git.haiku-os.org/haiku/commit/?id=632e7fd0a8ae
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:25:44 2019 UTC
Interface Kit: Remove no-op TARGET_PLATFORM_HAIKU_COMPATIBLE.
----------------------------------------------------------------------------
diff --git a/src/kits/interface/Jamfile b/src/kits/interface/Jamfile
index bfc5e4a587..86b93f25f7 100644
--- a/src/kits/interface/Jamfile
+++ b/src/kits/interface/Jamfile
@@ -17,11 +17,6 @@ if $(RUN_WITHOUT_APP_SERVER) != 0 {
SubDirC++Flags $(defines) ;
}
-if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
- SubDirCcFlags $(defines) ;
- SubDirC++Flags $(defines) ;
-}
-
SetSubDirSupportedPlatforms haiku libbe_test ;
UseLibraryHeaders agg ;
############################################################################
Revision: hrev53160
Commit: f7397837e8e8749d0a2cdf2725262f00ccd74995
URL: https://git.haiku-os.org/haiku/commit/?id=f7397837e8e8
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 24 18:28:19 2019 UTC
BMessage: Use assignment operator instead of memcpy().
The only non-POD types the macro is used on are BPoint, BRect, BSize,
and rgb_color, so the first change should essentially be a no-op.
The second change will technically have different behavior,
as the BMessenger copy constructor does not touch the _reserved_
field; but this shouldn't break anything, of course.
----------------------------------------------------------------------------
diff --git a/src/kits/app/Message.cpp b/src/kits/app/Message.cpp
index 01699b3ebd..a111a294bf 100644
--- a/src/kits/app/Message.cpp
+++ b/src/kits/app/Message.cpp
@@ -2438,24 +2438,14 @@ BMessage::Add##typeName(const char* name, type val)
\
status_t
\
BMessage::Find##typeName(const char* name, type* p) const
\
{
\
- void* ptr = NULL;
\
- ssize_t bytes = 0;
\
- status_t error = B_OK;
\
-
\
- *p = type();
\
- error = FindData(name, typeCode, 0, (const void**)&ptr, &bytes);
\
-
\
- if (error == B_OK)
\
- memcpy(p, ptr, sizeof(type));
\
-
\
- return error;
\
+ return Find##typeName(name, 0, p);
\
}
\
\
\
status_t
\
BMessage::Find##typeName(const char* name, int32 index, type* p) const
\
{
\
- void* ptr = NULL;
\
+ type* ptr = NULL;
\
ssize_t bytes = 0;
\
status_t error = B_OK;
\
\
@@ -2463,7 +2453,7 @@ BMessage::Find##typeName(const char* name, int32 index,
type* p) const \
error = FindData(name, typeCode, index, (const void**)&ptr, &bytes);
\
\
if (error == B_OK)
\
- memcpy(p, ptr, sizeof(type));
\
+ *p = *ptr;
\
\
return error;
\
}
\
@@ -2957,13 +2947,13 @@ BMessage::FindMessenger(const char* name, int32 index,
if (messenger == NULL)
return B_BAD_VALUE;
- void* data = NULL;
+ BMessenger* data = NULL;
ssize_t size = 0;
status_t error = FindData(name, B_MESSENGER_TYPE, index,
(const void**)&data, &size);
if (error == B_OK)
- memcpy(messenger, data, sizeof(BMessenger));
+ *messenger = *data;
else
*messenger = BMessenger();