Skip to content

Commit

Permalink
Fix more gcc compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Feb 13, 2025
1 parent 4cd9bd4 commit f66dbeb
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Source/Dialogs/MainMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MainMenu : public PopupMenu {
});
}

if (auto const isActive = menuItems[2]->isActive = recentlyOpenedTree.getNumChildren() > 0) {
if ((menuItems[2]->isActive = recentlyOpenedTree.getNumChildren() > 0)) {
recentlyOpened->addSeparator();
recentlyOpened->addItem("Clear recently opened", [recentlyOpenedTree, editor]() mutable {
recentlyOpenedTree.removeAllChildren(nullptr);
Expand Down
2 changes: 1 addition & 1 deletion Source/Dialogs/ThemeSettingsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ class ThemeSettingsPanel final : public SettingsDialogPanel
PlugDataLook::setDefaultFont(fontValue.toString());
SettingsFile::getInstance()->setProperty("default_font", fontValue.getValue());

if (auto const changed = previousFontName != Fonts::getCurrentFont().toString())
if (previousFontName != Fonts::getCurrentFont().toString())
pd->updateAllEditorsLNF();

CachedStringWidth<14>::clearCache();
Expand Down
2 changes: 1 addition & 1 deletion Source/Objects/FloatAtomObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class FloatAtomObject final : public ObjectBase {
g.setColour(outlineColour);
g.drawRoundedRectangle(getLocalBounds().toFloat().reduced(0.5f), Corners::objectCornerRadius, 1.0f);

if (bool const highlighed = hasKeyboardFocus(true) && ::getValue<bool>(object->locked)) {
if (hasKeyboardFocus(true) && ::getValue<bool>(object->locked)) {
g.setColour(cnv->editor->getLookAndFeel().findColour(PlugDataColour::objectSelectedOutlineColourId));
g.drawRoundedRectangle(getLocalBounds().toFloat().reduced(1.0f), Corners::objectCornerRadius, 2.0f);
}
Expand Down
18 changes: 8 additions & 10 deletions Source/Objects/IEMHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class IEMHelper {

iemcolor = iemgui_color_hex[iemcolor];
} else
iemcolor = -1 - iemcolor & 0xffffff;
iemcolor = (-1 - iemcolor) & 0xffffff;

auto const colour = convertFromIEMColour(iemcolor);
gui->setParameterExcludingListener(targetValue, colour.toString());
Expand Down Expand Up @@ -328,15 +328,13 @@ class IEMHelper {

if (auto iemgui = ptr.get<t_iemgui>()) {
if (iemgui->x_lab) {
if (t_symbol const* sym = canvas_realizedollar(iemgui->x_glist, iemgui->x_lab)) {
auto const labelText = getExpandedLabelText();
int const fontHeight = getFontHeight();
int const fontWidth = sys_fontwidth(fontHeight);
int const posx = objectBounds.getX() + iemgui->x_ldx;
int const posy = objectBounds.getY() + iemgui->x_ldy;
int const textWidth = fontHeight > 55 ? Font(fontHeight).getStringWidth(labelText) : fontWidth * (labelText.length() + 1);
return { posx, posy, textWidth, fontHeight + 2 };
}
auto const labelText = getExpandedLabelText();
int const fontHeight = getFontHeight();
int const fontWidth = sys_fontwidth(fontHeight);
int const posx = objectBounds.getX() + iemgui->x_ldx;
int const posy = objectBounds.getY() + iemgui->x_ldy;
int const textWidth = fontHeight > 55 ? Font(fontHeight).getStringWidth(labelText) : fontWidth * (labelText.length() + 1);
return { posx, posy, textWidth, fontHeight + 2 };
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Objects/ScalarObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class DrawableSymbol final : public DrawableTemplate
if (type < 0)
buf[0] = 0;
else {
strncpy(buf, object->x_label->s_name, DRAWNUMBER_BUFSIZE);
strncpy(buf, object->x_label->s_name, DRAWNUMBER_BUFSIZE-1);
buf[DRAWNUMBER_BUFSIZE - 1] = 0;
int const nchars = static_cast<int>(strlen(buf));
if (type == DT_TEXT) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Sidebar/CommandInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ class CommandInput final
currentHistoryIndex = -1;
} else if (currentHistoryIndex < commandHistory.size()) {
auto const command = commandHistory[currentHistoryIndex];
if (auto const isMultiLine = command.containsChar('\n'))
if (command.containsChar('\n'))
setConsoleTargetName("lua");
else
updateCommandInputTarget();
Expand Down
2 changes: 1 addition & 1 deletion Source/TabComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ void TabComponent::showHiddenTabsMenu(int const splitIndex)
void paint(Graphics& g) override
{

if (auto const isActive = tabbar.getVisibleCanvases().contains(cnv)) {
if (tabbar.getVisibleCanvases().contains(cnv)) {
g.setColour(findColour(PlugDataColour::popupMenuActiveBackgroundColourId));
} else if (isItemHighlighted()) {
g.setColour(findColour(PlugDataColour::popupMenuActiveBackgroundColourId).interpolatedWith(findColour(PlugDataColour::popupMenuBackgroundColourId), 0.4f));
Expand Down
2 changes: 1 addition & 1 deletion Source/Utility/CircularBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ class CircularBuffer {
size_t mask(size_t const val) const
{
// val = static_cast<size_t>(val >= 0 ? val : val + static_cast<long long>(size));
return val & size - 1;
return val & (size - 1);
}
};
2 changes: 1 addition & 1 deletion Source/Utility/ValueTreeViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class ValueTreeNodeComponent final : public Component {
void paint(Graphics& g) override
{
// Either show single selection or multi-selection
if (auto selected = getOwnerView()->selectedNode ? isSelected() : valueTreeNode.getProperty("Selected") == var(true)) {
if (getOwnerView()->selectedNode ? isSelected() : valueTreeNode.getProperty("Selected") == var(true)) {
auto const highlightCol = findColour(PlugDataColour::sidebarActiveBackgroundColourId);
g.setColour(isSelected() ? highlightCol.brighter(0.2f) : highlightCol);
g.fillRoundedRectangle(getLocalBounds().withHeight(25).reduced(2).toFloat(), Corners::defaultCornerRadius);
Expand Down

0 comments on commit f66dbeb

Please sign in to comment.